diff -aruN --binary 14/administrator/components/com_admin/admin.admin.html.php 15/administrator/components/com_admin/admin.admin.html.php
--- 14/administrator/components/com_admin/admin.admin.html.php	2009-05-29 14:51:00.000000000 +0200
+++ 15/administrator/components/com_admin/admin.admin.html.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: admin.admin.html.php 11300 2008-11-22 02:19:40Z ian $
+ * @version		$Id: admin.admin.html.php 12694 2009-09-11 21:03:02Z ian $
  * @package		Joomla
  * @subpackage	Admin
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -145,7 +145,7 @@
 			$langTag = 'en-GB';		// use english as fallback
 		}
 
-		if (!eregi( '\.html$', $page )) {
+		if (!preg_match( '#\.html$#i', $page )) {
 			$page .= '.xml';
 		}
 		?>
diff -aruN --binary 14/administrator/components/com_admin/tmpl/sysinfo_config.php 15/administrator/components/com_admin/tmpl/sysinfo_config.php
--- 14/administrator/components/com_admin/tmpl/sysinfo_config.php	2009-05-29 14:51:00.000000000 +0200
+++ 15/administrator/components/com_admin/tmpl/sysinfo_config.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: sysinfo_config.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: sysinfo_config.php 12694 2009-09-11 21:03:02Z ian $
  */
 // No direct access
 defined('_JEXEC') or die('Restricted access');
@@ -32,29 +32,29 @@
 			$cf = file( JPATH_CONFIGURATION . '/configuration.php' );
 			$config_output = array();
 			foreach ($cf as $k => $v) {
-				if (eregi( 'var \$host', $v)) {
+				if (preg_match( '#var \$host#i', $v)) {
 					$cf[$k] = 'var $host = \'xxxxxx\'';
-				} else if (eregi( 'var \$user', $v)) {
+				} else if (preg_match( '#var \$user#i', $v)) {
 					$cf[$k] = 'var $user = \'xxxxxx\'';
-				} else if (eregi( 'var \$password', $v)) {
+				} else if (preg_match( '#var \$password#i', $v)) {
 					$cf[$k] = 'var $password = \'xxxxxx\'';
-				} else if (eregi( 'var \$db ', $v)) {
+				} else if (preg_match( '#var \$db#i', $v)) {
 					$cf[$k] = 'var $db = \'xxxxxx\'';
-				} else if (eregi( 'var \$ftp_user ', $v)) {
+				} else if (preg_match( '#var \$ftp_user#i', $v)) {
 					$cf[$k] = 'var $ftp_user = \'xxxxxx\'';
-				} else if (eregi( 'var \$ftp_pass ', $v)) {
+				} else if (preg_match( '#var \$ftp_pass#i', $v)) {
 					$cf[$k] = 'var $ftp_pass = \'xxxxxx\'';
-				} else if (eregi( 'var \$smtpuser ', $v)) {
+				} else if (preg_match( '#var \$smtpuser#i', $v)) {
 					$cf[$k] = 'var $smtpuser = \'xxxxxx\'';
-				} else if (eregi( 'var \$smtppass ', $v)) {
+				} else if (preg_match( '#var \$smtppass#i', $v)) {
 					$cf[$k] = 'var $smtppass = \'xxxxxx\'';
-				} else if (eregi( '<?php', $v)) {
+				} else if (preg_match( '#<\?php#i', $v)) {
 					$cf[$k] = '';
-				} else if (eregi( '\?>', $v)) {
+				} else if (preg_match( '#\?>#i', $v)) {
 					$cf[$k] = '';
-				} else if (eregi( '}', $v)) {
+				} else if (preg_match( '#\}#i', $v)) {
 					$cf[$k] = '';
-				} else if (eregi( 'class JConfig {', $v)) {
+				} else if (preg_match( '#class JConfig \{#i', $v)) {
 					$cf[$k] = '';
 				}
 				$cf[$k]		= str_replace('var ','',$cf[$k]);
diff -aruN --binary 14/administrator/components/com_banners/views/banner.php 15/administrator/components/com_banners/views/banner.php
--- 14/administrator/components/com_banners/views/banner.php	2009-05-29 14:51:00.000000000 +0200
+++ 15/administrator/components/com_banners/views/banner.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: banner.php 11655 2009-03-08 20:04:17Z willebil $
+ * @version		$Id: banner.php 12694 2009-09-11 21:03:02Z ian $
  * @package		Joomla
  * @subpackage	Banners
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -432,7 +432,7 @@
 									<param name="movie" value="../images/banners/<?php echo $row->imageurl; ?>"><embed src="../images/banners/<?php echo $row->imageurl; ?>" loop="false" pluginspage="http://www.macromedia.com/go/get/flashplayer" type="application/x-shockwave-flash"  width="<?php echo $lists['width'];?>" height="<?php echo $lists['height'];?>"></embed>
 								</object>
 								<?php
-							} elseif (eregi("gif|jpg|png", $row->imageurl)) {
+							} elseif (preg_match("#gif|jpg|png#i", $row->imageurl)) {
 								?>
 								<img src="../images/banners/<?php echo $row->imageurl; ?>" name="imagelib" />
 								<?php
diff -aruN --binary 14/administrator/components/com_config/controllers/application.php 15/administrator/components/com_config/controllers/application.php
--- 14/administrator/components/com_config/controllers/application.php	2009-06-30 22:01:32.000000000 +0200
+++ 15/administrator/components/com_config/controllers/application.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: application.php 12389 2009-07-01 00:34:45Z ian $
+ * @version		$Id: application.php 13243 2009-10-20 04:01:04Z ian $
  * @package		Joomla
  * @subpackage	Config
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -117,7 +117,7 @@
 		$lists['force_ssl'] = JHTML::_('select.genericlist', $forceSSL, 'force_ssl', 'class="inputbox" size="1"', 'value', 'text', @$row->force_ssl);
 
 		// LOCALE SETTINGS
-		$timeoffset = array (	
+		$timeoffset = array (
 			JHTML::_('select.option', -12, JText::_('(UTC -12:00) International Date Line West')),
 			JHTML::_('select.option', -11, JText::_('(UTC -11:00) Midway Island, Samoa')),
 			JHTML::_('select.option', -10, JText::_('(UTC -10:00) Hawaii')),
@@ -147,7 +147,7 @@
 			JHTML::_('select.option', 6.30, JText::_('(UTC +06:30) Yagoon')),
 			JHTML::_('select.option', 7, JText::_('(UTC +07:00) Bangkok, Hanoi, Jakarta')),
 			JHTML::_('select.option', 8, JText::_('(UTC +08:00) Beijing, Perth, Singapore, Hong Kong')),
-			JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Western Australia')),
+			JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Ulaanbaatar, Western Australia')),
 			JHTML::_('select.option', 9, JText::_('(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk')),
 			JHTML::_('select.option', 9.5, JText::_('(UTC +09:30) Adelaide, Darwin, Yakutsk')),
 			JHTML::_('select.option', 10, JText::_('(UTC +10:00) Eastern Australia, Guam, Vladivostok')),
@@ -162,7 +162,7 @@
 
 		// MAIL SETTINGS
 		$mailer = array (
-			JHTML::_('select.option', 'mail', JText::_('PHP mail function')), 
+			JHTML::_('select.option', 'mail', JText::_('PHP mail function')),
 			JHTML::_('select.option', 'sendmail', JText::_('Sendmail')),
 			JHTML::_('select.option', 'smtp', JText::_('SMTP Server')));
 		$lists['mailer'] = JHTML::_('select.genericlist',  $mailer, 'mailer', 'class="inputbox" size="1"', 'value', 'text', $row->mailer);
@@ -206,7 +206,7 @@
 		$emailOptions = array (	JHTML::_('select.option', 'author', JText::_('Author Email')),
 								JHTML::_('select.option', 'site', JText::_('Site Email')));
 		$lists['feed_email'] = JHTML::_('select.genericlist', $emailOptions, 'feed_email', 'class="inputbox" size="1"', 'value', 'text', (@$row->feed_email) ? $row->feed_email : 'author');
-		
+
 		// SESSION SETTINGS
 		$stores = JSession::getStores();
 		$options = array();
diff -aruN --binary 14/administrator/components/com_config/views/application/view.php 15/administrator/components/com_config/views/application/view.php
--- 14/administrator/components/com_config/views/application/view.php	2009-05-29 14:51:16.000000000 +0200
+++ 15/administrator/components/com_config/views/application/view.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: view.php 10882 2008-08-31 17:55:14Z willebil $
+ * @version		$Id: view.php 13237 2009-10-20 01:00:39Z ian $
  * @package		Joomla
  * @subpackage	Config
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -52,7 +52,7 @@
 		jimport('joomla.client.helper');
 		$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
 		?>
-		<form action="index.php" method="post" name="adminForm">
+		<form action="index.php" method="post" name="adminForm" autocomplete="off">
 		<?php if ($ftp) {
 			require_once($tmplpath.DS.'ftp.php');
 		} ?>
diff -aruN --binary 14/administrator/components/com_contact/tables/contact.php 15/administrator/components/com_contact/tables/contact.php
--- 14/administrator/components/com_contact/tables/contact.php	2009-05-29 14:51:02.000000000 +0200
+++ 15/administrator/components/com_contact/tables/contact.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: contact.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: contact.php 12694 2009-09-11 21:03:02Z ian $
  * @package		Joomla
  * @subpackage	Contact
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -101,7 +101,7 @@
 		}
 
 		// check for http on webpage
-		if (strlen($this->webpage) > 0 && (!(eregi('http://', $this->webpage) || (eregi('https://', $this->webpage)) || (eregi('ftp://', $this->webpage))))) {
+		if (strlen($this->webpage) > 0 && (!(preg_match('#http://#i', $this->webpage) || (preg_match('#https://#i', $this->webpage)) || (preg_match('#ftp://#i', $this->webpage))))) {
 			$this->webpage = 'http://'.$this->webpage;
 		}
 
diff -aruN --binary 14/administrator/components/com_media/media.php 15/administrator/components/com_media/media.php
--- 14/administrator/components/com_media/media.php	2009-05-29 14:51:32.000000000 +0200
+++ 15/administrator/components/com_media/media.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: media.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: media.php 12696 2009-09-12 02:08:54Z ian $
  * @package		Joomla
  * @subpackage	Media
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -31,7 +31,7 @@
 $popup_upload = JRequest::getCmd('pop_up',null);
 $path = "file_path";
 if(substr(strtolower($view),0,6) == "images" || $popup_upload == 1) $path = "image_path";
-define('COM_MEDIA_BASE',    JPATH_ROOT.DS.$params->get($path, 'images/stories'));
+define('COM_MEDIA_BASE',    JPath::clean(JPATH_ROOT.DS.$params->get($path, 'images'.DS.'stories')));
 define('COM_MEDIA_BASEURL', JURI::root().$params->get($path, 'images/stories'));
 
 // Require the base controller
diff -aruN --binary 14/administrator/components/com_media/models/manager.php 15/administrator/components/com_media/models/manager.php
--- 14/administrator/components/com_media/models/manager.php	2009-05-29 14:51:26.000000000 +0200
+++ 15/administrator/components/com_media/models/manager.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: manager.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: manager.php 13297 2009-10-24 01:29:37Z ian $
  * @package		Joomla
  * @subpackage	Content
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -64,7 +64,6 @@
 
 		// Load appropriate language files
 		$lang = & JFactory::getLanguage();
-		$lang->load('', JPATH_ADMINISTRATOR);
 		$lang->load(JRequest::getCmd( 'option' ), JPATH_ADMINISTRATOR);
 
 		$document =& JFactory::getDocument();
diff -aruN --binary 14/administrator/components/com_menus/classes/ilink.php 15/administrator/components/com_menus/classes/ilink.php
--- 14/administrator/components/com_menus/classes/ilink.php	2009-05-29 14:50:54.000000000 +0200
+++ 15/administrator/components/com_menus/classes/ilink.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: ilink.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: ilink.php 12694 2009-09-11 21:03:02Z ian $
  * @package		Joomla
  * @subpackage	Menus
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -151,7 +151,8 @@
 
 		// Does the metadata file say no options available?
 		if ($e->attributes('options') == 'none') {
-			$node =& new iLinkNode($e->attributes('name'), $purl, $e->attributes('msg'));
+			unset($node);
+			$node = new iLinkNode($e->attributes('name'), $purl, $e->attributes('msg'));
 			$parent->addChild($node);
 			return true;
 		}
@@ -164,10 +165,12 @@
 			{
 				if ($child->name() == 'option') {
 					$url = $purl.'&amp;url['.$options->attributes('var').']='.$child->attributes('value');
-					$node =& new iLinkNode($child->attributes('name'), $url, $child->attributes('msg'));
+					unset($node);
+					$node = new iLinkNode($child->attributes('name'), $url, $child->attributes('msg'));
 					$parent->addChild($node);
 				} elseif ($child->name() == 'default') {
-					$node =& new iLinkNode($child->attributes('name'), $purl, $child->attributes('msg'));
+					unset($node);
+					$node = new iLinkNode($child->attributes('name'), $purl, $child->attributes('msg'));
 					$parent->addChild($node);
 				}
 			}
@@ -213,7 +216,8 @@
 							if ($m) {
 								$message = $m->data();
 							}
-							$node =& new iLinkNode($data->attributes('title'), $url, $message);
+							unset($node);
+							$node = new iLinkNode($data->attributes('title'), $url, $message);
 							$this->addChild($node);
 							if ($options = $data->getElementByPath('options')) {
 								$this->_getOptions($data, $node, $url);
@@ -223,7 +227,8 @@
 						}
 					} else {
 						$onclick = null;
-						$node =& new iLinkNode(ucfirst($view), $url);
+						unset($node);
+						$node = new iLinkNode(ucfirst($view), $url);
 						$this->addChild($node);
 						$this->_getLayouts(dirname($xmlpath), $node);
 					}
@@ -267,12 +272,14 @@
 								if ($m) {
 									$message = $m->data();
 								}
-								$child =& new iLinkNode($data->attributes('title'), $url, $message);
+								unset($child);
+								$child = new iLinkNode($data->attributes('title'), $url, $message);
 								$node->addChild($child);
 							}
 						} else {
 							// Add default info for the layout
-							$child =& new iLinkNode(ucfirst($layout).' '.JText::_('Layout'), $url);
+							unset($child);
+							$child = new iLinkNode(ucfirst($layout).' '.JText::_('Layout'), $url);
 							$node->addChild($child);
 						}
 					}
@@ -387,4 +394,4 @@
 		$this->url		= $url;
 		$this->msg		= trim($msg);
 	}
-}
\ No hay ningún carácter de nueva línea al final del fichero
+}
diff -aruN --binary 14/administrator/components/com_menus/views/item/tmpl/form.php 15/administrator/components/com_menus/views/item/tmpl/form.php
--- 14/administrator/components/com_menus/views/item/tmpl/form.php	2009-05-29 14:50:56.000000000 +0200
+++ 15/administrator/components/com_menus/views/item/tmpl/form.php	2009-11-04 18:51:18.000000000 +0100
@@ -144,6 +144,7 @@
 								<?php echo JHTML::_('list.accesslevel',  $this->item ); ?>
 							</td>
 						</tr>
+						<?php if ($this->item->type != "menulink") : ?>
 						<tr>
 							<td class="key" valign="top" align="right">
 								<?php echo JText::_( 'On Click, Open in' ); ?>:
@@ -152,6 +153,7 @@
 								<?php echo MenusHelper::Target( $this->item ); ?>
 							</td>
 						</tr>
+						<?php endif; ?>
 					</table>
 				</fieldset>
 			</td>
diff -aruN --binary 14/administrator/components/com_weblinks/tables/weblink.php 15/administrator/components/com_weblinks/tables/weblink.php
--- 14/administrator/components/com_weblinks/tables/weblink.php	2009-05-29 14:51:26.000000000 +0200
+++ 15/administrator/components/com_weblinks/tables/weblink.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: weblink.php 11253 2008-11-10 23:38:48Z ircmaxell $
+* @version		$Id: weblink.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla
 * @subpackage	Weblinks
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -162,7 +162,7 @@
 			return false;
 		}
 
-		if (!(eregi('http://', $this->url) || (eregi('https://', $this->url)) || (eregi('ftp://', $this->url)))) {
+		if (!(preg_match('#http://#i', $this->url) || (preg_match('#https://#i', $this->url)) || (preg_match('#ftp://#i', $this->url)))) {
 			$this->url = 'http://'.$this->url;
 		}
 
diff -aruN --binary 14/administrator/help/helpsites-15.xml 15/administrator/help/helpsites-15.xml
--- 14/administrator/help/helpsites-15.xml	2009-07-01 10:12:32.000000000 +0200
+++ 15/administrator/help/helpsites-15.xml	2009-11-04 18:51:18.000000000 +0100
@@ -2,6 +2,13 @@
 <joshelp>
 <sites>
    	<site tag="en-GB" url="http://help.joomla.org">English (GB) - help.joomla.org</site>
+   	<site tag="es-ES" url="http://comunidadjoomla.org"> Spanish -comunidadjoomla.org</site>
+    <site tag="it-IT" url="http://www.joomla.it"> Italian - joomla.it</site>
+    <site tag="hu-HU" url="http://help.joomla.org.hu"> Hungarian -joomla.org.hu</site>
+    <site tag="de-DE" url="http://hilfe.jgerman.de"> German -hilfe.jgerman.de</site>
+    <site tag="nl-NL" url="http://help.joomlacommunity.eu"> Dutch(NL) - help.joomlacommunity.eu</site>
     <site tag="ca-ES" url="http://www.joomla.cat"> Catalan - joomla.cat</site>
+	<site tag="fr-FR" url="http://help.joomla.fr"> French - Joomla.fr</site>
+	<site tag="fa-IR" url="http://joomfa.org"> Farsi - Joomfa.org</site>
 </sites>
-</joshelp>
\ No hay ningún carácter de nueva línea al final del fichero
+</joshelp>
diff -aruN --binary 14/administrator/includes/framework.php 15/administrator/includes/framework.php
--- 14/administrator/includes/framework.php	2009-07-30 21:02:22.000000000 +0200
+++ 15/administrator/includes/framework.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: framework.php 12584 2009-07-30 17:46:47Z ian $
+* @version		$Id: framework.php 13415 2009-11-03 15:53:25Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
diff -aruN --binary 14/administrator/language/en-GB/en-GB.com_content.ini 15/administrator/language/en-GB/en-GB.com_content.ini
--- 14/administrator/language/en-GB/en-GB.com_content.ini	2009-06-30 22:01:32.000000000 +0200
+++ 15/administrator/language/en-GB/en-GB.com_content.ini	2009-11-04 18:51:18.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: en-GB.com_content.ini 12386 2009-06-30 01:15:31Z ian $
+# $Id: en-GB.com_content.ini 12768 2009-09-17 04:46:46Z ian $
 # Joomla! Project
 # Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 # License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
@@ -186,4 +186,3 @@
 YOU CANNOT EDIT AN ARCHIVED ITEM=You cannot edit an Archived Article.
 YOU MUST SELECT A CATEGORY=You must select a Category.
 YOU MUST SELECT A SECTION=You must select a Section.
-TOGGLE EDITOR=Toggle editor
diff -aruN --binary 14/administrator/language/en-GB/en-GB.com_media.ini 15/administrator/language/en-GB/en-GB.com_media.ini
--- 14/administrator/language/en-GB/en-GB.com_media.ini	2009-07-23 04:25:36.000000000 +0200
+++ 15/administrator/language/en-GB/en-GB.com_media.ini	2009-11-04 18:51:18.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: en-GB.com_media.ini 12540 2009-07-22 17:34:44Z ian $
+# $Id: en-GB.com_media.ini 13311 2009-10-24 04:13:49Z ian $
 # Joomla! Project
 # Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 # License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
@@ -30,6 +30,7 @@
 DIRECTORY=Directory
 DIRECTORY UP=Directory Up
 DOES NOT EXIST.=does not exist!
+ERROR. FILE ALREADY EXISTS=Error. File already exists
 ERROR. UNABLE TO UPLOAD FILE=Error. Unable to upload file.
 FILESIZE=Filesize
 FILES/FOLDERS IN=files/folders in
@@ -70,6 +71,7 @@
 NUMFILES=Files:
 NUMFOLDERS=Folders:
 PLEASE DELETE ALL FILES/FOLDER IN=Please delete all files/folder in
+PLEASE INPUT A FILE FOR UPLOAD=Please input a file for upload
 PX=px
 REMOVE FROM QUEUE=Remove from queue
 SELECT FILE=Select File
diff -aruN --binary 14/administrator/language/en-GB/en-GB.ini 15/administrator/language/en-GB/en-GB.ini
--- 14/administrator/language/en-GB/en-GB.ini	2009-06-30 22:01:32.000000000 +0200
+++ 15/administrator/language/en-GB/en-GB.ini	2009-11-04 18:51:18.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: en-GB.ini 12308 2009-06-23 04:05:28Z ian $
+# $Id: en-GB.ini 13243 2009-10-20 04:01:04Z ian $
 # Joomla! Project
 # Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 # License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
@@ -109,7 +109,7 @@
 (UTC +06:30) YAGOON=(UTC +06:30) Yagoon
 (UTC +07:00) BANGKOK, HANOI, JAKARTA=(UTC +07:00) Bangkok, Hanoi, Jakarta
 (UTC +08:00) BEIJING, PERTH, SINGAPORE, HONG KONG=(UTC +08:00) Beijing, Perth, Singapore, Hong Kong
-(UTC +08:00) WESTERN AUSTRALIA=(UTC +08:00) Western Australia
+(UTC +08:00) ULAANBAATAR, WESTERN AUSTRALIA=(UTC +08:00) Ulaanbaatar, Western Australia
 (UTC +09:00) TOKYO, SEOUL, OSAKA, SAPPORO, YAKUTSK=(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk
 (UTC +09:30) ADELAIDE, DARWIN, YAKUTSK=(UTC +09:30) Adelaide, Darwin, Yakutsk
 (UTC +10:00) EASTERN AUSTRALIA, GUAM, VLADIVOSTOK=(UTC +10:00) Eastern Australia, Guam, Vladivostok
@@ -315,6 +315,7 @@
 JOOMLA! ADMINISTRATION LOGIN=Joomla! Administration Login
 JOOMLA! LOGO=Joomla! Logo
 JOOMLA WARNING=Joomla! Warning
+JPAGE_CURRENT_OF_TOTAL=Page %s of %s
 LANGUAGE=Language Name
 LAST=Last
 LAST MODIFIED=Last Modified
diff -aruN --binary 14/administrator/language/en-GB/en-GB.plg_editors_tinymce.ini 15/administrator/language/en-GB/en-GB.plg_editors_tinymce.ini
--- 14/administrator/language/en-GB/en-GB.plg_editors_tinymce.ini	2009-06-30 22:01:32.000000000 +0200
+++ 15/administrator/language/en-GB/en-GB.plg_editors_tinymce.ini	2009-11-04 18:51:18.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: en-GB.plg_editors_tinymce.ini 12386 2009-06-30 01:15:31Z ian $
+# $Id: en-GB.plg_editors_tinymce.ini 13247 2009-10-20 04:27:52Z ian $
 # Joomla! Project
 # Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 # License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
@@ -14,9 +14,9 @@
 CODE CLEANUP=Code Cleanup
 CODE CLEANUP ON SAVE=Code cleanup on save
 CODE CLEANUP ON STARTUP=Code Cleanup on Startup
-CODE CLEANUP UPON SAVING ARTICLE=Code cleaning upon saving article
 COMPRESSED VERSION=Compressed Version
 CUSTOM CSS CLASSES=Custom CSS Classes
+CUSTOMCSSFILENOTPRESENT=The file name %s was entered in the TinyMCE Custom CSS field. This file could not be found in the default templates folder. No styles are available.
 DATE FORMAT=Date Format
 DESCLANGCODE=Editor UI Language. A value here is mandatory if manual language selection is set.
 DESCLANGMODE=If Yes, editor language will automatically match selected UI language. Do not activate if appropriate editor languages are not installed.
@@ -45,9 +45,11 @@
 NEWLINES=New Lines
 NEWLINES WILL BE MADE INTO THE SELECTED OPTION=New lines will be created using the selected option.
 P ELEMENTS=P Elements
+PARAMBLOCKQUOTE=Insert blockquote tags around the highlighted text.
 PARAMCODECLEANUP=By default, TinyMCE will clean your code of certain HTML elements like script and center tags and check for security and XHTML compliance. We recommend you do not deactivate this functionality
+PARAMCODECLEANUPONSAVE=Recommended setting is 'Always'. Never = Do not clean up code on save. Front End = Clean up code on save when editing from front end only. Always = Cleanup on save when editing from front and back end.
 PARAMCOMPRESSEDVERSION=Tiny can be run in compressed mode resulting in slightly faster load speeds. However, this mode does not always work (especially in IE) so default for this is Off.  Be careful when enabling this to ensure it works on your system.
-PARAMCUSTOMCSS=You can specify the loading of a custom CSS file. Simply enter the full URL path to the CSS file you want loaded.  If you enter a value in this field, this will overrule the template CSS classes parameter.
+PARAMCUSTOMCSS=Optional CSS file that will override the standard editor.css file. Enter a file name to point to a file in the CSS folder of the default template (for example, templates/rhuk_milkyway/css/). Or enter a full URL path to the custom CSS file. If you enter a value in this field, this file will be used instead of the editor.css file.
 PARAMDIRECTIONALITY=Select whether to display the RTL button. Only Works in Advanced mode
 PARAMELEMENTPATH=If set to ON, it shows the set classes for the marked text.
 PARAMENTITIECLEANUP=If set to No, entities are stripped from the code.
@@ -86,8 +88,10 @@
 STYLE=Style
 TABLE=Table
 TEMPLATE CSS CLASSES=Template CSS classes
+TEMPLATECSSFILENOTPRESENT=Could not find the file 'editor.css' in the template or templates/system folder. No styles are available.
 TEXT DIRECTION=Text Direction
 TIME FORMAT=Time Format
+TOGGLE EDITOR=Toggle editor
 TOOLBAR=Toolbar
 URL BEHAVIOUR=URL behaviour
 URLS=URLs
@@ -103,9 +107,9 @@
 ADVANCED LINK=Advanced link
 ALIGNMENT OF THE TOOLBAR=Alignment of the toolbar
 ALL DIALOGS TO OPEN AS FLOATING DIV LAYERS INSTEAD OF POPUP WINDOWS. THIS OPTION CAN BE VERY USEFUL IN ORDER TO GET AROUND POPUP BLOCKERS.=All dialogs to open as floating DIV layers instead of popup windows. This option can be very useful in order to get around popup blockers.
+BLOCKQUOTE=Blockquote
 COLORS=Colors
 CONTEXT MENU=Context menu
-CONTROLS HOW ENTITIES GET PROCESSED BY EDITOR=Controls how entities get processed by editor
 CUSTOM BUTTON=Custom button
 CUSTOM PLUGIN=Custom plugin
 ENTITY ENCODING=Entity Encoding
@@ -120,6 +124,7 @@
 OFFICE2007 BLUE=Office2007 Blue
 OFFICE2007 SILVER=Office2007 Silver
 PARAMCOLORS=Show/Hide the Colors control buttons. Only applies in Extended mode
+PARAMENTITYENCODING=Controls how HTML entities are encoded. Recommended setting is 'raw'. 'named' = used named entity encoding (for example, '&lt;'). 'numeric' = use numeric HTML encoding (for example, '%03c'). raw = Do not encode HTML entities. Note that searching content may not work properly if setting is not 'raw'.
 PARAMS EXTENDED MODE=<strong>Extended Mode Options</strong><br />These options only apply in Extended mode.
 PARAMFONTS=Show/Hide the Fonts control selectors. Only applies in Extended mode
 PARAMMEDIA=Show/Hide the Media button. Only applies in Extended mode
diff -aruN --binary 14/administrator/language/en-GB/en-GB.xml 15/administrator/language/en-GB/en-GB.xml
--- 14/administrator/language/en-GB/en-GB.xml	2009-05-29 14:50:44.000000000 +0200
+++ 15/administrator/language/en-GB/en-GB.xml	2009-11-04 18:51:18.000000000 +0100
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- $Id: en-GB.xml 11409 2009-01-10 02:27:08Z willebil $ -->
+<!-- $Id: en-GB.xml 13357 2009-10-28 02:45:40Z ian $ -->
 <metafile version="1.5" client="administrator">
 	<name>English(United Kingdom)</name>
-	<version>1.5.9</version>
-	<creationDate>2008-03-15</creationDate>
+	<version>1.5.15</version>
+	<creationDate>2009-10-27</creationDate>
 	<author>Joomla! Project</author>
 	<authorEmail>admin@joomla.org</authorEmail>
 	<authorUrl>www.joomla.org</authorUrl>
-	<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
+	<copyright>Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.</copyright>
 	<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
 	<description></description>
 	<metadata>
diff -aruN --binary 14/administrator/language/es-ES/es-ES.com_config.ini 15/administrator/language/es-ES/es-ES.com_config.ini
--- 14/administrator/language/es-ES/es-ES.com_config.ini	2009-07-25 18:10:26.000000000 +0200
+++ 15/administrator/language/es-ES/es-ES.com_config.ini	2009-11-05 16:29:12.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: es-ES.com_config.ini 1.5.0 2009-07-01 10:19:41 15:45:22 ~0 $
+# $Id: es-ES.com_config.ini 1.5.0 2009-11-05 16:29:12 15:45:22 ~0 $
 # author Joomla! Spanish
 # copyright (C) 2009 JoomlaSpanish.org  All rights reserved.
 # license http://www.gnu.org/copyleft/gpl.html GNU/GPL
@@ -192,7 +192,7 @@
 TIPLOGFOLDER=Para acceder la cuenta de Joomla!, por favor, especifica una carpeta.
 TIPMAILER=Selecciona que correo deseas usar para los e-mails del sitio
 TIPMAILFROM=La dirección de e-mail que se usará para enviar correos desde el sitio
-TIPLINKS=Si está configurado en sí, los enlaces hacia el contenido para usuarios registrados será mostrado también la los visitantes sin loguear. Necesitarás loguearte para poder acceder por completo al contendido que conduce dicho enlace.
+TIPLINKS=Si está configurado en sí, los enlaces hacia el contenido para usuarios registrados será mostrado también la de los visitantes sin loguear. Necesitarás loguearte para poder acceder por completo al contendido que conduce dicho enlace.
 TIPNEWUSERTYPE=El nivel de acceso predeterminado de los nuevos usuarios que se registran desde la página principal.
 TIPPRINTPDFEMAIL=Imprimir, PDF y e-mail utilizarán iconos o texto
 TIPSECRETWORD=Esto es un código alfanumérico único, autogenerado para cada instalación de Joomla!. Se usa para funciones de seguridad
diff -aruN --binary 14/administrator/language/es-ES/es-ES.com_content.ini 15/administrator/language/es-ES/es-ES.com_content.ini
--- 14/administrator/language/es-ES/es-ES.com_content.ini	2009-07-25 18:10:24.000000000 +0200
+++ 15/administrator/language/es-ES/es-ES.com_content.ini	2009-11-05 16:17:44.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: es-ES.com_content.ini 1.5.0 2009-07-01 10:20:41 21:06:30 ~0 $
+# $Id: es-ES.com_content.ini 1.5.0 2009-11-05 16:17:44 21:06:30 ~0 $
 # author Joomla! Spanish
 # copyright (C) 2009 JoomlaSpanish.org  All rights reserved.
 # license http://www.gnu.org/copyleft/gpl.html GNU/GPL
@@ -186,5 +186,4 @@
 WHITE LIST=Lista blanca
 YOU CANNOT EDIT AN ARCHIVED ITEM=No puedes editar un artículo archivado.
 YOU MUST SELECT A CATEGORY=Debes seleccionar una categoría.
-YOU MUST SELECT A SECTION=Debes seleccionar una sección.
-TOGGLE EDITOR=Ocultar editor
\ No hay ningún carácter de nueva línea al final del fichero
+YOU MUST SELECT A SECTION=Debes seleccionar una sección.
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/administrator/language/es-ES/es-ES.com_media.ini 15/administrator/language/es-ES/es-ES.com_media.ini
--- 14/administrator/language/es-ES/es-ES.com_media.ini	2009-07-25 18:44:44.000000000 +0200
+++ 15/administrator/language/es-ES/es-ES.com_media.ini	2009-11-05 16:20:24.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: es-ES.com_media.ini 1.5.0 2009-07-25 18:44:43 15:24:34 ~0 $
+# $Id: es-ES.com_media.ini 1.5.0 2009-11-05 16:20:24 15:24:34 ~0 $
 # author Joomla! Spanish
 # copyright (C) 2009 JoomlaSpanish.org  All rights reserved.
 # license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
@@ -31,6 +31,7 @@
 DIRECTORY=Directorio
 DIRECTORY UP=Subir directorio
 DOES NOT EXIST.=¡no existe!
+ERROR. FILE ALREADY EXISTS=Error. El archivo ya existe
 ERROR. UNABLE TO UPLOAD FILE=Error. No se puede subir el archivo.
 FILESIZE=Tamaño del archivo
 FILES/FOLDERS IN=archivos/carpetas dentro
@@ -71,6 +72,7 @@
 NUMFILES=Archivos:
 NUMFOLDERS=Carpetas:
 PLEASE DELETE ALL FILES/FOLDER IN=Por favor, borra todos los archivos/carpetas del interior
+PLEASE INPUT A FILE FOR UPLOAD=Introduzca un archivo para subir
 PX=px
 REMOVE FROM QUEUE=Eliminar de la cola
 SELECT FILE=Selecionar Archivo
@@ -97,5 +99,4 @@
 WARNINVALIDIMG=Imagen inválida.
 WARNINVALIDMIME=Se ha encontrado un tipo de MIME inválido o no autorizado.
 WARNNOTADMIN=El archivo subido no es una imagen y tú no eres usuario con rango de Autor o superior.
-WARNIEXSS=Se ha encontrado un posible ataque del tipo XSS.
-UNABLE TO DELETE: NOT EMPTY!=Imposible borrarlo: ¡No está vacio!
\ No hay ningún carácter de nueva línea al final del fichero
+WARNIEXSS=Se ha encontrado un posible ataque del tipo XSS.
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/administrator/language/es-ES/es-ES.ini 15/administrator/language/es-ES/es-ES.ini
--- 14/administrator/language/es-ES/es-ES.ini	2009-07-25 18:10:16.000000000 +0200
+++ 15/administrator/language/es-ES/es-ES.ini	2009-11-05 16:22:38.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: es-ES.ini 1.5.0 2009-07-01 10:18:34 16:28:06 ~0 $
+# $Id: es-ES.ini 1.5.0 2009-11-05 16:22:39 16:28:06 ~0 $
 # author Joomla! Spanish
 # copyright (C) 2009 JoomlaSpanish.org  All rights reserved.
 # license http://www.gnu.org/copyleft/gpl.html GNU/GPL
@@ -109,7 +109,7 @@
 (UTC +06:30) YAGOON=(UTC +06:30) Yagoon
 (UTC +07:00) BANGKOK, HANOI, JAKARTA=(UTC +07:00) Bangkok, Hanoi, Jakarta
 (UTC +08:00) BEIJING, PERTH, SINGAPORE, HONG KONG=(UTC +08:00) Beijing, Perth, Singapore, Hong Kong
-(UTC +08:00) WESTERN AUSTRALIA=(UTC +08:00) Western Australia
+(UTC +08:00) ULAANBAATAR, WESTERN AUSTRALIA=(UTC +08:00) Ulaanbaatar, Western Australia
 (UTC +09:00) TOKYO, SEOUL, OSAKA, SAPPORO, YAKUTSK=(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk
 (UTC +09:30) ADELAIDE, DARWIN, YAKUTSK=(UTC +09:30) Adelaide, Darwin, Yakutsk
 (UTC +10:00) EASTERN AUSTRALIA, GUAM, VLADIVOSTOK=(UTC +10:00) Eastern Australia, Guam, Vladivostok
@@ -314,6 +314,7 @@
 JOOMLA! ADMINISTRATION LOGIN=Acceso a la administración de Joomla!
 JOOMLA! LOGO=Logo de Joomla!
 JOOMLA WARNING=Joomla! Advertencia
+JPAGE_CURRENT_OF_TOTAL=Página %s de %s
 LANGUAGE=Nombre del idioma
 LAST=Último
 LAST MODIFIED=Última modificación
diff -aruN --binary 14/administrator/language/es-ES/es-ES.plg_editors_tinymce.ini 15/administrator/language/es-ES/es-ES.plg_editors_tinymce.ini
--- 14/administrator/language/es-ES/es-ES.plg_editors_tinymce.ini	2009-07-25 18:10:06.000000000 +0200
+++ 15/administrator/language/es-ES/es-ES.plg_editors_tinymce.ini	2009-11-05 16:24:28.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: es-ES.plg_editors_tinymce.ini 1.5.0 2009-07-01 10:35:31 20:37:15 ~0 $
+# $Id: es-ES.plg_editors_tinymce.ini 1.5.0 2009-11-05 16:24:29 20:37:15 ~0 $
 # author Joomla! Spanish
 # copyright (C) 2009 JoomlaSpanish.org  All rights reserved.
 # license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
@@ -15,9 +15,9 @@
 CODE CLEANUP=Limpiar código
 CODE CLEANUP ON SAVE=Limpia el código al guardar
 CODE CLEANUP ON STARTUP=Limpia el código al iniciar
-CODE CLEANUP UPON SAVING ARTICLE=Limpia el código al guardar el artículo
 COMPRESSED VERSION=Versión comprimida
 CUSTOM CSS CLASSES=Clases CSS personalizadas
+CUSTOMCSSFILENOTPRESENT=The file name %s was entered in the TinyMCE Custom CSS field. This file could not be found in the default templates folder. No styles are available.
 DATE FORMAT=Formato de fecha
 DESCLANGCODE=Idioma UI del editor. Es obligatorio que haya un valor aquí, si la selección manual del idioma está activada.
 DESCLANGMODE=Si se activa el idioma, va a coincidir automáticamente con el idioma seleccionado por el usuario. No activar en caso de que los idiomas del editor no están instalados.
@@ -46,7 +46,9 @@
 NEWLINES=Líneas nuevas
 NEWLINES WILL BE MADE INTO THE SELECTED OPTION=Las líneas nuevas se crearán según la opción elegida.
 P ELEMENTS=Elementos P
+PARAMBLOCKQUOTE=Insert blockquote tags around the highlighted text.
 PARAMCODECLEANUP=TinyMCE, por razones de seguridad y conformidad con XHTML, limpiará de tu código a  ciertos elementos HTML, como puedan ser las etiquetas script y de centrado. Recomendamos que no desactives esta función.
+PARAMCODECLEANUPONSAVE=Recommended setting is 'Always'. Never = Do not clean up code on save. Front End = Clean up code on save when editing from front end only. Always = Cleanup on save when editing from front and back end.
 PARAMCOMPRESSEDVERSION=TinyMCE puede funcionar en modo de compresión, lo que permitirá una carga ligeramente más rápida. No obstante, este modo no funciona siempre, especialmente con Internet Explorer, por lo que está normalmente desactivado. Si decides activarlo, asegúrate de que funciona en tu sistema.
 PARAMCUSTOMCSS=Puedes especificar la carga un archivo CSS personalizado - simplemente ingresa la URL completa al archivo CSS que quieres cargar. Si ingresas un valor en este campo, sobrescribe el parámetro de la clase CSS de la plantilla.
 PARAMDIRECTIONALITY=Selecciona mostrar, o no, el botón RTL. Sólo funciona en el modo avanzado.
@@ -87,8 +89,10 @@
 STYLE=Estilo
 TABLE=Tabla
 TEMPLATE CSS CLASSES=Clases CSS de la plantilla
+TEMPLATECSSFILENOTPRESENT=Could not find the file 'editor.css' in the template or templates/system folder. No styles are available.
 TEXT DIRECTION=Dirección del texto
 TIME FORMAT=Formato de la hora
+TOGGLE EDITOR=Toggle editor
 TOOLBAR=Barra de herramientas
 URL BEHAVIOUR=Comportamiento URL
 URLS=URLs
@@ -104,9 +108,9 @@
 ADVANCED LINK=Enlace avanzado
 ALIGNMENT OF THE TOOLBAR=Alineación de la barra de herramientas
 ALL DIALOGS TO OPEN AS FLOATING DIV LAYERS INSTEAD OF POPUP WINDOWS. THIS OPTION CAN BE VERY USEFUL IN ORDER TO GET AROUND POPUP BLOCKERS.=Todos los cuadros de diálogo para abrir capas flotantes como DIV en lugar de ventanas emergentes. Esta opción puede ser muy útil a fin de evitar bloqueadores de popups.
+BLOCKQUOTE=Blockquote
 COLORS=Colores
 CONTEXT MENU=Contexto menu
-CONTROLS HOW ENTITIES GET PROCESSED BY EDITOR=Controla la forma como las entidades obtienen procesos por el editor
 CUSTOM BUTTON=Custom button
 CUSTOM PLUGIN=Custom plugin
 ENTITY ENCODING=Entidad de codificación
@@ -121,6 +125,7 @@
 OFFICE2007 BLUE=Office2007 Blue
 OFFICE2007 SILVER=Office2007 Silver
 PARAMCOLORS=Mostrar / Ocultar los colores de los botones de control. Sólo se aplica en el modo Extended
+PARAMENTITYENCODING=Controls how HTML entities are encoded. Recommended setting is 'raw'. 'named' = used named entity encoding (for example, '&lt;'). 'numeric' = use numeric HTML encoding (for example, '%03c'). raw = Do not encode HTML entities. Note that searching content may not work properly if setting is not 'raw'.
 PARAMS EXTENDED MODE=<strong>Opciones del modo extendido</strong><br />Estas opciones sólo se aplican en modo Extended.
 PARAMFONTS=Mostrar / Ocultar el control de fuentes. Sólo se aplica en el modo Extended
 PARAMMEDIA=Mostrar / Ocultar el botón de los medios multimedia. Sólo se aplica en el modo Extended
diff -aruN --binary 14/administrator/language/es-ES/es-ES.xml 15/administrator/language/es-ES/es-ES.xml
--- 14/administrator/language/es-ES/es-ES.xml	2009-07-25 18:42:22.000000000 +0200
+++ 15/administrator/language/es-ES/es-ES.xml	2009-11-05 16:16:00.000000000 +0100
@@ -3,7 +3,7 @@
 	<tag>es-ES</tag>
 	<name>Español (spanish formal Internacional)</name>
 	<description>Idioma para usar en la parte administrativa de Joomla! 1.5. Creado por Joomla! Spanish - Traductor oficial asociado</description>
-	<version>1.5.13</version>
+	<version>1.5.15</version>
 	<creationDate>2009-05-21</creationDate>
 	<author>Joomla! Spanish</author>
 	<authorUrl>www.joomlaspanish.org</authorUrl>
diff -aruN --binary 14/administrator/templates/system/css/system.css 15/administrator/templates/system/css/system.css
--- 14/administrator/templates/system/css/system.css	2009-05-29 14:51:56.000000000 +0200
+++ 15/administrator/templates/system/css/system.css	2009-11-04 18:51:18.000000000 +0100
@@ -5,8 +5,10 @@
    background-position: 0 50%;
    color: #000;
    padding-left: 18px;
+   
 }
 
+body {color: #000}
 /* System Messages */
 #system-message    { margin-bottom: 10px; padding: 0;}
 #system-message dt { font-weight: bold; }
diff -aruN --binary 14/CHANGELOG.php 15/CHANGELOG.php
--- 14/CHANGELOG.php	2009-07-30 21:02:22.000000000 +0200
+++ 15/CHANGELOG.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: CHANGELOG.php 12584 2009-07-30 17:46:47Z ian $
+* @version		$Id: CHANGELOG.php 13426 2009-11-04 16:36:00Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -17,7 +17,7 @@
 1. Copyright and disclaimer
 ---------------------------
 This application is opensource software released under the GPL.  Please
-see source code and the LICENSE file
+see source code and the LICENSE file.
 
 
 2. Changelog
@@ -37,6 +37,98 @@
 - -> Removed
 ! -> Note
 
+-------------------- 1.5.15 Stable Release [05-November-2009] ------------------
+04-Nov-2009 Ian MacLennan
+ # [#17475] Fixed missing = in patch (parse error)
+
+03-Nov-2009 Ian MacLennan
+ # [#18050] Reverting router change.
+
+29-Oct-2009 Ian MacLennan
+ # [#18537] error.php rtl issue
+
+28-Oct-2009 Ian MacLennan
+ ^ Updated CREDITS.php
+ ^ Updated installation language pack
+ ^ Updated help sites
+ # [#16445] SEF rewrites href urls in editor textarea
+
+27-Oct-2009 Ian MacLennan
+ # [#16914] Default style for admin backend does not specify text color of input fields.
+ # [#16609] templates/system/css/template.css not found when using templates/system/component
+ # [#18493] UTF problems with HTML entities in pathway.
+ # [#18518] Change in mod_search.ini
+ # [#18522] Correct version info site/admin for core languages
+ # [#18481] Emailcloak on image
+ # [#18430] com_content fails to pass an article reference to onAfterDisplayTitle event handler
+ $ Added new installer language packs
+
+26-Oct-2009 Ian MacLennan
+ # [#18245] Implementing templates feature in tinymce
+ # [#15780] Search result list uses always the Itemid of the default Menu-item
+ # [#17110] Section/Category List - Table width issue in IE8
+ # [#17470] Archive filters don't work with cache on + com_content cache optimization
+ # [#17475] Cache unused by core components
+ # [#18050] SEF category links lead to article not found
+ # [#18080] Core - Missing JEXEC Check
+ # [#18142] utf8_accents_to_ascii() does nothing
+
+23-Oct-2009 Ian MacLennan
+ # [#11578] Email cloaking does not work properly with non-ASCII characters
+ # [#16804] Linked image in Beez template jumps in IE8
+ # [#17259] html not allowed in user confirmation message
+ # [#17430] Image Title attribute field has different names
+ # [#17964] Email cloaking. Syntax error in email.php. Patch included.
+ # [#18246] Tinymce sql correction
+ # [#18310] Email cloak breaks emails used in scripts
+ # [#18343] & in page title breaks RSS feed
+ # [#18349] Missing com_media strings
+ # [#18353] Information leak - anybody can see installed extensions versions
+ # Upgrade to Mootool 1.12
+
+
+19-Oct-2009 Ian MacLennan
+ # [#18297] Setting ftp fields to not autocomplete
+ # [#16927] Router fatal error then Itemid is null
+ # [#18240] Menu item is not opened to new window
+ $ [#18124] String for JPagination missing in en-GB.ini
+ # [#18070] Error in Ja_purity and IE8
+ # [#17692] Email Cloaking on an image
+ $ [#17618] Localisation of pagination
+ $ [#17577] Adding Ulaanbaatar in timezones
+ # [#17559] Change to Beez Template to make it more generic
+ # [#17231] mod_newsflash doesn't honour alternative read more text
+ # [#17215] Missing <blockquote> button in TinyMCE 3
+ 
+25-Sept-2009 Ian MacLennan
+ # [#16484] Password field changed in configuration.php by Administration > Global Configuration
+ # [#16804] Linked image in Beez template jumps in IE8
+
+18-Sept-2009 Ian MacLennan
+ # [#16982] Fixed issue with editor.css files
+
+17-Sept-2009 Ian MacLennan
+ # [#16982] TinyMCE Configuration Error
+ # [#17057] TinyMCE strips some image html
+ # [#17379] Tinymce 3.2.4.1 generates different html breaking caption.js and messing with content filtering
+ # [#17121] TinyMCE Extended Valid Elements dont work anymore
+ # [#17043] Multiply instances of TinyMCE on the page
+ # [#17367] Cannot add or edit content items
+ # [#17356] Firefox inline spell check doesn't work in 1.5.12 / TinyMCE - suggested fix
+ $ [#17332] TinyMCE Language file omission for Toggle Editor button
+ # [#17438] TinyMCE Libary Upgrade - International Users Beware - big changes to language files
+
+16-Sept-2009 Ian MacLennan
+ # [#18010] Captions don't align properly if image alignment is not set.
+ # [#18008] Additional PHP 5.3 Issues
+
+11-Sept-2009 Ian MacLennan
+ # [#17150] Patch to solve PHP 5.3 issues
+ # [#17432] Missing spinner.gif
+ # [#17337] Media manager popup is broken in Windows
+ # [#16919] Results of search - unnecessary quotation marks
+ # [#16086] Unique menu names now disallow underscores
+
 -------------------- 1.5.14 Stable Release [30-July-2009] ------------------
 
 23-Jul-2009 Gergo Erdosi
diff -aruN --binary 14/components/com_contact/controller.php 15/components/com_contact/controller.php
--- 14/components/com_contact/controller.php	2009-05-29 14:53:02.000000000 +0200
+++ 15/components/com_contact/controller.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: controller.php 11679 2009-03-08 20:50:06Z willebil $
+ * @version		$Id: controller.php 13426 2009-11-04 16:36:00Z ian $
  * @package		Joomla
  * @subpackage	Contact
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -69,7 +69,19 @@
 
 		// Display the view
 		$view->assign('error', $this->getError());
-		$view->display();
+		
+		// View caching logic -- simple... are we logged in?
+		$user = &JFactory::getUser();
+		$viewnow = JRequest::getVar('view');
+		$viewcache = JRequest::getVar('viewcache','1','POST','INT');
+		
+		if ($user->get('id') || ($viewnow == 'category' && $viewcache == 0)) {
+			$view->display();
+		} else {
+			$option = JRequest::getCmd('option');
+			$cache =& JFactory::getCache($option, 'view');
+			$cache->get($view, 'display');
+		}
 	}
 
 	/**
diff -aruN --binary 14/components/com_contact/views/category/tmpl/default.php 15/components/com_contact/views/category/tmpl/default.php
--- 14/components/com_contact/views/category/tmpl/default.php	2009-05-29 15:32:52.000000000 +0200
+++ 15/components/com_contact/views/category/tmpl/default.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,10 +1,9 @@
 <?php
 /**
- * $Id: default.php 11917 2009-05-29 19:37:05Z ian $
+ * $Id: default.php 13339 2009-10-27 02:27:05Z ian $
  */
 defined( '_JEXEC' ) or die( 'Restricted access' );
 
-$cparams =& JComponentHelper::getParams('com_media');
 ?>
 
 <?php if ( $this->params->get( 'show_page_title', 1 ) ) : ?>
@@ -100,5 +99,6 @@
 <input type="hidden" name="catid" value="<?php echo $this->category->id;?>" />
 <input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
 <input type="hidden" name="filter_order_Dir" value="" />
+<input type="hidden" name="viewcache" value="0" />
 </form>
 </div>
diff -aruN --binary 14/components/com_contact/views/category/view.html.php 15/components/com_contact/views/category/view.html.php
--- 14/components/com_contact/views/category/view.html.php	2009-05-29 14:53:02.000000000 +0200
+++ 15/components/com_contact/views/category/view.html.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: view.html.php 11665 2009-03-08 20:30:23Z willebil $
+ * @version		$Id: view.html.php 13339 2009-10-27 02:27:05Z ian $
  * @package		Joomla
  * @subpackage	Contact
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -76,7 +76,7 @@
 		{
 			$contact =& $contacts[$i];
 
-			$contact->link = JRoute::_('index.php?option=com_contact&view=contact&id='.$contact->slug.'&catid='.$contact->catslug);
+			$contact->link = JRoute::_('index.php?option=com_contact&view=contact&id='.$contact->slug.'&catid='.$contact->catslug, false);
 			if ($pparams->get('show_email', 0) == 1) {
 				$contact->email_to = trim($contact->email_to);
 				if (!empty($contact->email_to) && JMailHelper::isEmailAddress($contact->email_to)) {
diff -aruN --binary 14/components/com_content/controller.php 15/components/com_content/controller.php
--- 14/components/com_content/controller.php	2009-05-29 14:53:00.000000000 +0200
+++ 15/components/com_content/controller.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: controller.php 11386 2009-01-04 02:34:35Z ian $
+ * @version		$Id: controller.php 13338 2009-10-27 02:15:55Z ian $
  * @package		Joomla
  * @subpackage	Content
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -44,7 +44,12 @@
 
 		// View caching logic -- simple... are we logged in?
 		$user = &JFactory::getUser();
-		if ($user->get('id') || (JRequest::getVar('view') == 'category' && JRequest::getVar('layout') != 'blog')) {
+		$view = JRequest::getVar('view');
+		$viewcache = JRequest::getVar('viewcache',1,'POST','INT');
+
+		if ($user->get('id') ||
+			($view == 'category' && JRequest::getVar('layout') != 'blog' && $viewcache == 0) ||
+			 $view == 'archive' && $viewcache == 0) {
 			parent::display(false);
 		} else {
 			parent::display(true);
diff -aruN --binary 14/components/com_content/models/article.php 15/components/com_content/models/article.php
--- 14/components/com_content/models/article.php	2009-05-29 14:52:58.000000000 +0200
+++ 15/components/com_content/models/article.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: article.php 11646 2009-03-01 19:34:56Z ian $
+ * @version		$Id: article.php 13415 2009-11-03 15:53:25Z ian $
  * @package		Joomla
  * @subpackage	Content
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -313,6 +313,20 @@
 
 		$article->title = trim( $article->title );
 
+		// get state and created_by from existing article
+		$originalState = 0;
+		if (!$isNew)
+		{
+			$query = 'SELECT state, created_by' .
+			' FROM #__content' .
+			' WHERE id = '.(int) $article->id;
+			$this->_db->setQuery($query);
+			$originalArticle = $this->_db->loadObject();
+			$originalState = $originalArticle->state;
+			// force the created_by to the existing value
+			$article->created_by = $originalArticle->created_by;
+		}
+
 		// Publishing state hardening for Authors
 		if (!$user->authorize('com_content', 'publish', 'content', 'all'))
 		{
@@ -324,12 +338,8 @@
 			else
 			{
 				// For existing items keep existing state - author is not allowed to change status
-				$query = 'SELECT state' .
-						' FROM #__content' .
-						' WHERE id = '.(int) $article->id;
 
-				$this->_db->setQuery($query);
-				$state = $this->_db->loadResult();
+				$state = $originalState;
 
 				if ($state) {
 					$article->state = 1;
@@ -337,6 +347,15 @@
 				else {
 					$article->state = 0;
 				}
+
+				// if current user is author, check that the current user is really the author
+				if (!$user->authorize('com_content', 'edit', 'content', 'all'))
+				{
+					if ($originalArticle->created_by != $user->id)
+					{
+						JError::raiseError( 403, JText::_("ALERTNOTAUTH") );
+					}
+				}
 			}
 		}
 
@@ -364,7 +383,7 @@
 		if ( (!is_array($filterGroups) && (int) $filterGroups > 0) ) { 
 			$filterGroups = array($filterGroups);
 		}
-		
+
 		if (is_array($filterGroups) && in_array( $gid, $filterGroups ))
 		{
 			$filterType		= $config->get( 'filter_type' );
diff -aruN --binary 14/components/com_content/router.php 15/components/com_content/router.php
--- 14/components/com_content/router.php	2009-05-29 14:53:00.000000000 +0200
+++ 15/components/com_content/router.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: router.php 10711 2008-08-21 10:09:03Z eddieajau $
+* @version		$Id: router.php 13420 2009-11-04 02:17:02Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
diff -aruN --binary 14/components/com_content/views/archive/tmpl/default.php 15/components/com_content/views/archive/tmpl/default.php
--- 14/components/com_content/views/archive/tmpl/default.php	2009-05-29 15:22:46.000000000 +0200
+++ 15/components/com_content/views/archive/tmpl/default.php	2009-11-04 18:51:18.000000000 +0100
@@ -19,4 +19,5 @@
 
 	<input type="hidden" name="view" value="archive" />
 	<input type="hidden" name="option" value="com_content" />
+	<input type="hidden" name="viewcache" value="0" />
 </form>
diff -aruN --binary 14/components/com_content/views/article/view.html.php 15/components/com_content/views/article/view.html.php
--- 14/components/com_content/views/article/view.html.php	2009-05-29 14:52:58.000000000 +0200
+++ 15/components/com_content/views/article/view.html.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: view.html.php 11213 2008-10-25 12:43:11Z pasamio $
+ * @version		$Id: view.html.php 13361 2009-10-28 04:34:03Z ian $
  * @package		Joomla
  * @subpackage	Content
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -29,7 +29,7 @@
 	function display($tpl = null)
 	{
 		global $mainframe;
-		
+
 		$user		=& JFactory::getUser();
 		$document	=& JFactory::getDocument();
 		$dispatcher	=& JDispatcher::getInstance();
@@ -58,7 +58,7 @@
 		}
 
 		$limitstart	= JRequest::getVar('limitstart', 0, '', 'int');
-		
+
 		if (!$params->get('intro_only') && ($this->getLayout() == 'default') && ($limitstart == 0))
 		{
 			$model =& $this->getModel();
@@ -171,19 +171,19 @@
 		 * Handle display events
 		 */
 		$article->event = new stdClass();
-		$results = $dispatcher->trigger('onAfterDisplayTitle', array ($article, &$params, $limitstart));
+		$results = $dispatcher->trigger('onAfterDisplayTitle', array (&$article, &$params, $limitstart));
 		$article->event->afterDisplayTitle = trim(implode("\n", $results));
 
-		$results = $dispatcher->trigger('onBeforeDisplayContent', array (& $article, & $params, $limitstart));
+		$results = $dispatcher->trigger('onBeforeDisplayContent', array (&$article, &$params, $limitstart));
 		$article->event->beforeDisplayContent = trim(implode("\n", $results));
 
-		$results = $dispatcher->trigger('onAfterDisplayContent', array (& $article, & $params, $limitstart));
+		$results = $dispatcher->trigger('onAfterDisplayContent', array (&$article, &$params, $limitstart));
 		$article->event->afterDisplayContent = trim(implode("\n", $results));
 
 		$print = JRequest::getBool('print');
 		if ($print) {
-      $document->setMetaData('robots', 'noindex, nofollow');
-    }
+			$document->setMetaData('robots', 'noindex, nofollow');
+		}
 
 		$this->assignRef('article', $article);
 		$this->assignRef('params' , $params);
@@ -206,8 +206,8 @@
 
 		// Make sure you are logged in and have the necessary access rights
 		if ($user->get('gid') < 19) {
-			  JResponse::setHeader('HTTP/1.0 403',true);
-              JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
+			JResponse::setHeader('HTTP/1.0 403',true);
+			  JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
 			return;
 		}
 
@@ -390,4 +390,4 @@
 		parent::display($tpl);
 	}
 }
-?>
+
diff -aruN --binary 14/components/com_content/views/category/tmpl/default_items.php 15/components/com_content/views/category/tmpl/default_items.php
--- 14/components/com_content/views/category/tmpl/default_items.php	2009-06-30 22:01:32.000000000 +0200
+++ 15/components/com_content/views/category/tmpl/default_items.php	2009-11-04 18:51:18.000000000 +0100
@@ -43,7 +43,7 @@
 		<?php echo JText::_('Num'); ?>
 	</td>
 	<?php if ($this->params->get('show_title')) : ?>
- 	<td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" width="45%">
+ 	<td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" >
 		<?php echo JHTML::_('grid.sort',  'Item Title', 'a.title', $this->lists['order_Dir'], $this->lists['order'] ); ?>
 	</td>
 	<?php endif; ?>
@@ -131,4 +131,5 @@
 <input type="hidden" name="filter_order" value="" />
 <input type="hidden" name="filter_order_Dir" value="" />
 <input type="hidden" name="limitstart" value="0" />
+<input type="hidden" name="viewcache" value="0" />
 </form>
diff -aruN --binary 14/components/com_content/views/category/tmpl/default.php 15/components/com_content/views/category/tmpl/default.php
--- 14/components/com_content/views/category/tmpl/default.php	2009-05-29 15:22:46.000000000 +0200
+++ 15/components/com_content/views/category/tmpl/default.php	2009-11-04 18:51:18.000000000 +0100
@@ -9,7 +9,7 @@
 <?php endif; ?>
 <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="contentpane<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
 <tr>
-	<td width="60%" valign="top" class="contentdescription<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" colspan="2">
+	<td valign="top" class="contentdescription<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" colspan="2">
 	<?php if ($this->category->image) : ?>
 		<img src="<?php echo $this->baseurl . '/' . $cparams->get('image_path') . '/'. $this->category->image;?>" align="<?php echo $this->category->image_position;?>" hspace="6" alt="<?php echo $this->category->image;?>" />
 	<?php endif; ?>
diff -aruN --binary 14/components/com_content/views/section/tmpl/default.php 15/components/com_content/views/section/tmpl/default.php
--- 14/components/com_content/views/section/tmpl/default.php	2009-05-29 15:22:46.000000000 +0200
+++ 15/components/com_content/views/section/tmpl/default.php	2009-11-04 18:51:20.000000000 +0100
@@ -9,7 +9,7 @@
 <?php endif; ?>
 <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="contentpane<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
 <tr>
-	<td width="60%" valign="top" class="contentdescription<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" colspan="2">
+	<td valign="top" class="contentdescription<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" colspan="2">
 	<?php if ($this->params->get('show_description_image') && $this->section->image) : ?>
 		<img src="<?php echo $this->baseurl . '/' . $cparams->get('image_path') . '/'.  $this->section->image;?>" align="<?php echo $this->section->image_position;?>" hspace="6" alt="<?php echo $this->section->image;?>" />
 	<?php endif; ?>
diff -aruN --binary 14/components/com_media/media.php 15/components/com_media/media.php
--- 14/components/com_media/media.php	2009-07-23 04:25:36.000000000 +0200
+++ 15/components/com_media/media.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: media.php 12542 2009-07-22 17:40:48Z ian $
+ * @version		$Id: media.php 12696 2009-09-12 02:08:54Z ian $
  * @package		Joomla
  * @subpackage	Massmail
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -22,7 +22,7 @@
 }
 
 // Set the path definitions
-define('COM_MEDIA_BASE',    JPATH_ROOT.DS.$params->get('image_path', 'images'.DS.'stories'));
+define('COM_MEDIA_BASE',    JPath::clean(JPATH_ROOT.DS.$params->get('image_path', 'images'.DS.'stories')));
 define('COM_MEDIA_BASEURL', JURI::root(true).'/'.$params->get('image_path', 'images/stories'));
 
 // Load the admin HTML view
diff -aruN --binary 14/components/com_search/controller.php 15/components/com_search/controller.php
--- 14/components/com_search/controller.php	2009-05-29 14:52:54.000000000 +0200
+++ 15/components/com_search/controller.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: controller.php 11676 2009-03-08 20:45:04Z willebil $
+ * @version		$Id: controller.php 13338 2009-10-27 02:15:55Z ian $
  * @package		Joomla
  * @subpackage	Content
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -63,21 +63,16 @@
 				$post['areas'][] = JFilterInput::clean($area, 'cmd');
 			}
 		}
-
-		// No need to guess Itemid if it's already present in the URL
-		if (JRequest::getInt('Itemid') > 0) {
+		
+		// set Itemid id for links from menu
+		$menu = &JSite::getMenu();
+		$items	= $menu->getItems('link', 'index.php?option=com_search&view=search');
+
+		if(isset($items[0])) {
+			$post['Itemid'] = $items[0]->id;
+		} else if (JRequest::getInt('Itemid') > 0) { //use Itemid from requesting page only if there is no existing menu
 			$post['Itemid'] = JRequest::getInt('Itemid');
-		} else {
-
-			// set Itemid id for links
-			$menu = &JSite::getMenu();
-			$items	= $menu->getItems('link', 'index.php?option=com_search&view=search');
-
-			if(isset($items[0])) {
-				$post['Itemid'] = $items[0]->id;
-			}
-
-		}
+		} 
 		
 		unset($post['task']);
 		unset($post['submit']);
diff -aruN --binary 14/components/com_weblinks/controller.php 15/components/com_weblinks/controller.php
--- 14/components/com_weblinks/controller.php	2009-05-29 14:53:10.000000000 +0200
+++ 15/components/com_weblinks/controller.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: controller.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: controller.php 13339 2009-10-27 02:27:05Z ian $
  * @package		Joomla
  * @subpackage	Content
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -45,7 +45,15 @@
 			$model =& $this->getModel('weblink');
 			$model->hit();
 		}
-
-		parent::display();
+		
+		// View caching logic -- simple... are we logged in?
+		$user = &JFactory::getUser();
+		$view = JRequest::getVar('view');
+		$viewcache = JRequest::getVar('viewcache', '1', 'POST', 'INT');
+		if ($user->get('id') || ($view == 'category' && $viewcache == 0)) {
+			parent::display(false);
+		} else {
+			parent::display(true);
+		}
 	}
-}
\ No hay ningún carácter de nueva línea al final del fichero
+}
diff -aruN --binary 14/components/com_weblinks/views/category/tmpl/default_items.php 15/components/com_weblinks/views/category/tmpl/default_items.php
--- 14/components/com_weblinks/views/category/tmpl/default_items.php	2009-05-29 15:22:46.000000000 +0200
+++ 15/components/com_weblinks/views/category/tmpl/default_items.php	2009-11-04 18:51:20.000000000 +0100
@@ -69,4 +69,5 @@
 </table>
 <input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
 <input type="hidden" name="filter_order_Dir" value="" />
+<input type="hidden" name="viewcache" value="0" />
 </form>
diff -aruN --binary 14/components/com_weblinks/views/category/view.html.php 15/components/com_weblinks/views/category/view.html.php
--- 14/components/com_weblinks/views/category/view.html.php	2009-05-29 15:32:52.000000000 +0200
+++ 15/components/com_weblinks/views/category/view.html.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: view.html.php 11917 2009-05-29 19:37:05Z ian $
+* @version		$Id: view.html.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla
 * @subpackage	Weblinks
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -48,7 +48,7 @@
 		$state		= &$this->get('state');
 
 		$model =& JModel::getInstance('categories', 'weblinksmodel');
-		$categories =& $model->getData();
+		$categories = $model->getData();
 
 		// Get the page/component configuration
 		$params = &$mainframe->getParams();
diff -aruN --binary 14/CREDITS.php 15/CREDITS.php
--- 14/CREDITS.php	2009-06-30 22:01:32.000000000 +0200
+++ 15/CREDITS.php	2009-11-04 18:51:18.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: CREDITS.php 12356 2009-06-24 18:20:14Z ian $
+ * @version		$Id: CREDITS.php 13370 2009-10-28 14:48:04Z ian $
  * @package		Joomla
  * @copyright	Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.
  * @license		GNU/GPL, see LICENSE.php
@@ -66,10 +66,9 @@
 
 Translation contributors:
 -------------------------
-Translation contributors:
--------------------------
 Albanian (sp-AL) - Blendi Kraja
 Arabic Algeria (ar-DZ) - Saber Bousba
+Azeri (az-AZ) - Azeri Translation Team - Mahmud and Yusif
 Basque (eu-ES) - Basque Translation Team (Basque Language School of Santurtzi) - Abel Camacho, Pedro Lonbide
 Belarusian (be-BY) - Dennis Hermacki
 Bengali (bn-BD) – Kamal Sikder
@@ -80,6 +79,7 @@
 Croatian (hr-HR) - Croatian Translation Team - Klaudia B.
 Czech (cs-CZ) - Czech Translation Team - Svatopluk Vit
 Danish (da-DK) - Danish Translation Team - Ronny Buelund, Mikael Winther, Ole Bang Ottosen
+Dari (Afghanistan) (fa-AF) - Dari (Afghanistan) Translation Team - Daud Nigaresh
 Dutch (nl-NL) - Dutch Translation Team - Vancanneyt Sander, Marijke Stuivenberg
 English (en-US) -  US English Translation Team - Jennifer Marriott
 Esperanto (eo-XX) - Esperanto Translation Team - Cindy McKee, Fabien Tschudy
@@ -93,14 +93,17 @@
 Hindi-Devanagari (hi-IN) - IndicJoomla! Team - Vishal Pahuja
 Hungarian (hu-HU) - Magyar Joomla! Felhasznalok Nemzetkozi Egyesulete - Jozsef Tamas Herczeg, Annamaria Ban
 Icelandic (is-IS) - Joomlis! Icelandic Joomla Community [joomlis.net] - Magnús Guðlaugsson
+Indonesian (id-ID) - Indonesian (Bahasa Indonesia) Translation Community - Andy Sikumbang
 Italian (it-IT) - Italian Translation Team - Stefania Gaianigo, Alessandro Rossi
 Japanese (ja-JP) - Japanese Translation Team - Noriaki Koide, Hiroko Hirano
+Khmer (Cambodia) (km-KH) - Khmer (Cambodia) Translation Team - Heng Sovann
 Laotian (lo-LA) - Joomla LaiLao Team (LaoOpenSource) - Akarawuth Tamrareang , Viengsakhone phanthanousy , Outhai Saioudom
 Latvian (lv-LV) - Joomla Latvian Team - Edgars Piruška, Iveta Rītiņa-Namiķe, Ingars Stepkāns
 Lithuanian (lt-LT) - Lithuanian Translation Team - Stasys Svabas
 Mongolian (mn-MN) - Mongolian Translation Team, Altansukh T.
 Montenegrin (sr-ME) - Montenegrin Translation Team (joomlamontenegro.com) - Miljan Vujosevic, Dragan Djordjevic
 Norwegian bokmål (nb-NO) - Joomla! i Norge - Jens-Christian Skibakk, Rune Rasmussen
+Pashto (Afghanistan) (ps-AF) - Pashto (Afghanistan) Translation Team - Daud Nigaresh
 Persian/Farsi (fa-IR) - Joomfa Team(Joomla Farsi) - M.Alavi nik, Hamid abolhasani,Amin bagheri,Sayyed Saeed farzad,Sayyed ahmad sayyedi,Vahid Hosein Khani,Omid pileh var
 Polish - Poland (pl-PL) - Polskie Centrum Joomla! - Michał Sobkowiak, Stefan Wajda
 Portuguese Brazilian (pt-BR) - Joomla! Brasil - Fabricio Elias Costa (FaBMak)
@@ -111,12 +114,14 @@
 Sindhi (sd-PK) - Raheel H. Kaghzi, Shafiq-ur-rehman Khatri
 Sinhala (si-LK) - Rashan Anushka
 Slovak (sk-SK) - Slovak Translation Team - Karol Cejka, Viliam Kmec, Alexander Horvath, Marek Sabo
+Slovenian (sl-SI) - Slovenian Translation Team - Borut Planinc
 Spanish (es-ES) - Joomla!'s Spanish Community Translation Team - Javier Galasse
 Swedish (sv-SE) - Swedish Translation Team (SvenskJoomla!) - Sune Hultman, Christer Gerhardsson
-Syriac (sy-IQ) - Pauls! Dinka
+Syriac (sy-IQ) - East Syriac Translation (Syriac Joomla) - Pauls Dinka
+Tagalog (Philippines) (tl-PH) - Tagalog (Philippines) Translation Community - Aristedes Royo
 Tamil (ta-LK) - Sri Lanka -UoM, LK, sarves
 Thai (th-TH) - Joomla LaiThai Team (JoomlaCorner) - Akarawuth Tamrareang , Supachai Teasakul, Pisan Chueachatchai
-Turkish (tr-TR) - Joomla! Turkiye - Ümit Kenan Gönüllü, Uğur Uygur
+Turkish (tr-TR) - Joomla! Turkiye - Ümit Kenan Gönüllü
 Ukrainian (uk-UA) - Ukrainian Translation Team - Denys Nosov
 Urdu Pakistan (ur-PK) - Basim
 Vietnamese (vi-VN) - Việt Nam Translation Team - Viet Hoang Vu
diff -aruN --binary 14/htaccess.txt 15/htaccess.txt
--- 14/htaccess.txt	2009-05-29 14:54:48.000000000 +0200
+++ 15/htaccess.txt	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1,5 @@
 ##
-# @version $Id: htaccess.txt 10492 2008-07-02 06:38:28Z ircmaxell $
+# @version $Id: htaccess.txt 13415 2009-11-03 15:53:25Z ian $
 # @package Joomla
 # @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 # @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
@@ -31,7 +31,13 @@
 ## If you experience problems on your site block out the operations listed below
 ## This attempts to block the most common type of exploit `attempts` to Joomla!
 #
-# Block out any script trying to set a mosConfig value through the URL
+## Deny access to extension xml files (uncomment out to activate)
+#<Files ~ "\.xml$">
+#Order allow,deny
+#Deny from all
+#Satisfy all
+#</Files>
+## End of deny access to extension xml files
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
 # Block out any script trying to base64_encode crap to send via URL
 RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
@@ -63,5 +69,3 @@
 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
 #
 ########## End - Joomla! core SEF Section
-
-
diff -aruN --binary 14/includes/framework.php 15/includes/framework.php
--- 14/includes/framework.php	2009-07-30 21:02:22.000000000 +0200
+++ 15/includes/framework.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: framework.php 12584 2009-07-30 17:46:47Z ian $
+* @version		$Id: framework.php 13415 2009-11-03 15:53:25Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
diff -aruN --binary 14/includes/router.php 15/includes/router.php
--- 14/includes/router.php	2009-05-29 14:54:02.000000000 +0200
+++ 15/includes/router.php	2009-11-04 18:51:20.000000000 +0100
@@ -145,7 +145,9 @@
 		if(count($this->getVars()) == 1)
 		{
 			$item = $menu->getItem($this->getVar('Itemid'));
-			$vars = $vars + $item->query;
+			if($item !== NULL && is_array($item->query)) {
+				$vars = $vars + $item->query;
+			}
 		}
 
 		// Set the active menu item
diff -aruN --binary 14/language/en-GB/en-GB.ini 15/language/en-GB/en-GB.ini
--- 14/language/en-GB/en-GB.ini	2009-06-30 22:01:32.000000000 +0200
+++ 15/language/en-GB/en-GB.ini	2009-11-04 18:51:20.000000000 +0100
@@ -107,7 +107,7 @@
 (UTC +06:30) YAGOON=(UTC +06:30) Yagoon
 (UTC +07:00) BANGKOK, HANOI, JAKARTA=(UTC +07:00) Bangkok, Hanoi, Jakarta
 (UTC +08:00) BEIJING, PERTH, SINGAPORE, HONG KONG=(UTC +08:00) Beijing, Perth, Singapore, Hong Kong
-(UTC +08:00) WESTERN AUSTRALIA=(UTC +08:00) Western Australia
+(UTC +08:00) ULAANBAATAR, WESTERN AUSTRALIA=(UTC +08:00) Ulaanbaatar, Western Australia
 (UTC +09:00) TOKYO, SEOUL, OSAKA, SAPPORO, YAKUTSK=(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk
 (UTC +09:30) ADELAIDE, DARWIN, YAKUTSK=(UTC +09:30) Adelaide, Darwin, Yakutsk
 (UTC +10:00) EASTERN AUSTRALIA, GUAM, VLADIVOSTOK=(UTC +10:00) Eastern Australia, Guam, Vladivostok
@@ -171,6 +171,7 @@
 DESCNEWITEMSFIRST=New items default to the first position. Ordering can be changed after this item has been saved.
 DESCNEWITEMSLAST=New items default to the last position. Ordering can be changed after this item has been saved.
 DIRECTORY UNWRITABLE=Directory Unwritable
+DISPLAY NUM=Display #
 E_LOGIN_AUTHENTICATE=Username and password do not match or you do not have an account yet.
 E_NOLOGIN_BLOCKED=Login denied! Your account has either been blocked or you have not activated it yet. Did you not get an activation e-mail and follow the validation link?
 EDIT=edit
@@ -195,6 +196,7 @@
 IMAGE=Image
 ITEMS=items
 JOOMLA WARNING=<font color="red">Joomla! Warning!</font>
+JPAGE_CURRENT_OF_TOTAL=Page %s of %s
 LAST=last
 LAST UPDATED=Last Updated
 LAST_UPDATED2=Last Updated on %s
diff -aruN --binary 14/language/en-GB/en-GB.mod_search.ini 15/language/en-GB/en-GB.mod_search.ini
--- 14/language/en-GB/en-GB.mod_search.ini	2009-05-29 14:52:48.000000000 +0200
+++ 15/language/en-GB/en-GB.mod_search.ini	2009-11-04 18:51:20.000000000 +0100
@@ -18,6 +18,7 @@
 SEARCH...=search...
 SEARCH MODULE=Search Module
 SET ITEMID=Set ItemID
+PARAMSETITEMID=Assign an ItemId for the display of the search results if there is no com_search menu and a specific display is desired. The ItemId may be chosen among those available through the Menu Manager. If you do not know what this means, you may not need it.
 SIZE OF THE SEARCH TEXT BOX IN CHARACTERS=Size of the search text box in characters
 TEXT=Text
 THIS MODULE WILL DISPLAY A SEARCH BOX=This module will display a search box.
diff -aruN --binary 14/language/en-GB/en-GB.xml 15/language/en-GB/en-GB.xml
--- 14/language/en-GB/en-GB.xml	2009-05-29 14:52:48.000000000 +0200
+++ 15/language/en-GB/en-GB.xml	2009-11-04 18:51:20.000000000 +0100
@@ -3,12 +3,12 @@
 <metafile version="1.5"  client="site" >
 	<name>English(United Kingdom)</name>
 	<tag>en-GB</tag>
-	<version>1.5.9</version>
-	<creationDate>2008-03-15</creationDate>
+	<version>1.5.15</version>
+	<creationDate>2009-10-27</creationDate>
 	<author>Joomla! Project</author>
 	<authorEmail>admin@joomla.org</authorEmail>
 	<authorUrl>www.joomla.org</authorUrl>
-	<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
+	<copyright>Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.</copyright>
 	<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
 	<description></description>
 	<metadata>
diff -aruN --binary 14/language/es-ES/es-ES.ini 15/language/es-ES/es-ES.ini
--- 14/language/es-ES/es-ES.ini	2009-07-25 18:09:48.000000000 +0200
+++ 15/language/es-ES/es-ES.ini	2009-11-05 16:03:14.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: es-ES.ini 1.5.0 2009-07-06 10:50:23 2007-10-06 ~0 $
+# $Id: es-ES.ini 1.5.0 2009-11-05 16:03:14 2007-10-06 ~0 $
 # author Joomla! Spanish
 # copyright (C) 2009 JoomlaSpanish.org  All rights reserved.
 # license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
@@ -107,7 +107,7 @@
 (UTC +06:30) YAGOON=(UTC +06:30) Yagoon
 (UTC +07:00) BANGKOK, HANOI, JAKARTA=(UTC +07:00) Bangkok, Hanoi, Jakarta
 (UTC +08:00) BEIJING, PERTH, SINGAPORE, HONG KONG=(UTC +08:00) Beijing, Perth, Singapore, Hong Kong
-(UTC +08:00) WESTERN AUSTRALIA=(UTC +08:00) Western Australia
+(UTC +08:00) ULAANBAATAR, WESTERN AUSTRALIA=(UTC +08:00) Ulaanbaatar, Western Australia
 (UTC +09:00) TOKYO, SEOUL, OSAKA, SAPPORO, YAKUTSK=(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk
 (UTC +09:30) ADELAIDE, DARWIN, YAKUTSK=(UTC +09:30) Adelaide, Darwin, Yakutsk
 (UTC +10:00) EASTERN AUSTRALIA, GUAM, VLADIVOSTOK=(UTC +10:00) Eastern Australia, Guam, Vladivostok
@@ -171,6 +171,7 @@
 DESCNEWITEMSFIRST=Los nuevos artículos se sitúan en la primera posición. El orden puede ser modificado una vez guardado.
 DESCNEWITEMSLAST=Los nuevos artículos se sitúan en la última posición. El orden puede ser modificado una vez guardado.
 DIRECTORY UNWRITABLE=Directorio no escribible
+DISPLAY NUM=Exponer#
 E_LOGIN_AUTHENTICATE=El nombre de usuario y la contraseña no coinciden o usted no tiene una cuenta aún.
 E_NOLOGIN_BLOCKED=Usuario denegado! Su cuenta ha sido bloqueada o usted no ha activado aún. ¿Si no tiene una activación e-mail y siga el vínculo de validación?
 EDIT=Editar
@@ -195,6 +196,7 @@
 IMAGE=Imagen
 ITEMS=ítems
 JOOMLA WARNING=<font color="red">Advertencia de Joomla!</font>
+JPAGE_CURRENT_OF_TOTAL=Página %s de %s
 LAST=Última
 LAST UPDATED=Actualizado
 LAST_UPDATED2=Última actualización el %s
diff -aruN --binary 14/language/es-ES/es-ES.mod_search.ini 15/language/es-ES/es-ES.mod_search.ini
--- 14/language/es-ES/es-ES.mod_search.ini	2009-07-25 18:09:44.000000000 +0200
+++ 15/language/es-ES/es-ES.mod_search.ini	2009-11-05 16:05:58.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: es-ES.mod_search.ini 1.5.0 2009-01-10 21:06:08 2007-09-01 ~0 $
+# $Id: es-ES.mod_search.ini 1.5.0 2009-11-05 16:05:58 2007-09-01 ~0 $
 # author Joomla! Spanish
 # copyright (C) 2008 JoomlaSpanish.org  All rights reserved.
 # license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
@@ -19,6 +19,7 @@
 SEARCH...=buscar...
 SEARCH MODULE=Módulo de búsqueda
 SET ITEMID=Configurar ItemID
+PARAMSETITEMID=Asigne una ItemId para la presentación de los resultados de búsqueda si no hay un menú com_search y una pantalla específica. El ItemId puede ser elegido entre los disponibles a través del Administrador de Menú. Si usted no sabe lo que esto significa, puede que no lo necesite.
 SIZE OF THE SEARCH TEXT BOX IN CHARACTERS=Tamaño de la caja de búsqueda de texto en caracteres
 TEXT=Texto
 THIS MODULE WILL DISPLAY A SEARCH BOX=Este módulo mostrará una caja de búsqueda
diff -aruN --binary 14/language/es-ES/es-ES.xml 15/language/es-ES/es-ES.xml
--- 14/language/es-ES/es-ES.xml	2009-07-25 18:41:56.000000000 +0200
+++ 15/language/es-ES/es-ES.xml	2009-11-05 15:59:38.000000000 +0100
@@ -3,7 +3,7 @@
 	<tag>es-ES</tag>
 	<name>Español (spanish formal Internacional)</name>
 	<description>Idioma creado por Joomla! Spanish para Joomla 1.5 zona frontal - Traductor oficial asociado</description>
-	<version>1.5.13</version>
+	<version>1.5.15</version>
 	<creationDate>2009-05-21</creationDate>
 	<author>Joomla! Spanish</author>
 	<authorUrl>www.joomlaspanish.org</authorUrl>
diff -aruN --binary 14/libraries/domit/xml_domit_lite_parser.php 15/libraries/domit/xml_domit_lite_parser.php
--- 14/libraries/domit/xml_domit_lite_parser.php	2009-05-29 14:54:44.000000000 +0200
+++ 15/libraries/domit/xml_domit_lite_parser.php	2009-11-04 18:51:20.000000000 +0100
@@ -1746,7 +1746,7 @@
 		//parse out whitespace -  (XML_OPTION_SKIP_WHITE = 1 does not
 		//seem to work consistently across versions of PHP and Expat
 		if (!$this->xmlDoc->preserveWhitespace) {
-			$xmlText = eregi_replace('>' . "[[:space:]]+" . '<' , '><', $xmlText);
+			$xmlText = preg_replace('#>' . "[[:space:]]+" . '<#i' , '><', $xmlText);
 		}
 
 		$success = xml_parse($parser, $xmlText);
diff -aruN --binary 14/libraries/domit/xml_domit_parser.php 15/libraries/domit/xml_domit_parser.php
--- 14/libraries/domit/xml_domit_parser.php	2009-05-29 14:54:44.000000000 +0200
+++ 15/libraries/domit/xml_domit_parser.php	2009-11-04 18:51:20.000000000 +0100
@@ -3309,7 +3309,7 @@
 		//parse out whitespace -  (XML_OPTION_SKIP_WHITE = 1 does not
 		//seem to work consistently across versions of PHP and Expat
 		if (!$this->xmlDoc->preserveWhitespace) {
-			$xmlText = eregi_replace('>' . "[[:space:]]+" . '<' , '><', $xmlText);
+			$xmlText = preg_replace('#>' . "[[:space:]]+" . '<#i' , '><', $xmlText);
 		}
 
 		$success = xml_parse($parser, $xmlText);
@@ -3676,4 +3676,4 @@
 
 } //DOMIT_Parser
 
-?>
\ No hay ningún carácter de nueva línea al final del fichero
+?>
diff -aruN --binary 14/libraries/joomla/application/pathway.php 15/libraries/joomla/application/pathway.php
--- 14/libraries/joomla/application/pathway.php	2009-05-29 14:54:26.000000000 +0200
+++ 15/libraries/joomla/application/pathway.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: pathway.php 10707 2008-08-21 09:52:47Z eddieajau $
+* @version		$Id: pathway.php 13354 2009-10-28 02:05:38Z ian $
 * @package		Joomla.Framework
 * @subpackage	Application
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -206,7 +206,7 @@
 	function _makeItem($name, $link)
 	{
 		$item = new stdClass();
-		$item->name = html_entity_decode($name);
+		$item->name = html_entity_decode($name, ENT_COMPAT, 'UTF-8');
 		$item->link = $link;
 
 		return $item;
diff -aruN --binary 14/libraries/joomla/base/object.php 15/libraries/joomla/base/object.php
--- 14/libraries/joomla/base/object.php	2009-05-29 14:54:30.000000000 +0200
+++ 15/libraries/joomla/base/object.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: object.php 10707 2008-08-21 09:52:47Z eddieajau $
+ * @version		$Id: object.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	Base
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
  * other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * Object class, allowing __construct in PHP4.
  *
diff -aruN --binary 14/libraries/joomla/cache/cache.php 15/libraries/joomla/cache/cache.php
--- 14/libraries/joomla/cache/cache.php	2009-05-29 14:54:24.000000000 +0200
+++ 15/libraries/joomla/cache/cache.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: cache.php 10707 2008-08-21 09:52:47Z eddieajau $
+ * @version		$Id: cache.php 12694 2009-09-11 21:03:02Z ian $
  * @package		Joomla.Framework
  * @subpackage	Cache
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -140,7 +140,7 @@
 				require_once(dirname(__FILE__).DS.'storage'.DS.$name.'.php');
 			}
 
-			if(call_user_func_array( array( trim($class), 'test' ), null)) {
+			if(call_user_func_array( array( trim($class), 'test' ), array())) {
 				$names[] = $name;
 			}
 		}
diff -aruN --binary 14/libraries/joomla/client/helper.php 15/libraries/joomla/client/helper.php
--- 14/libraries/joomla/client/helper.php	2009-05-29 14:54:34.000000000 +0200
+++ 15/libraries/joomla/client/helper.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: helper.php 10707 2008-08-21 09:52:47Z eddieajau $
+ * @version		$Id: helper.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	Client
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -9,7 +9,7 @@
  * GNU General Public License or other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * Client helper class
  *
diff -aruN --binary 14/libraries/joomla/database/database.php 15/libraries/joomla/database/database.php
--- 14/libraries/joomla/database/database.php	2009-05-29 14:54:30.000000000 +0200
+++ 15/libraries/joomla/database/database.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: database.php 11137 2008-10-15 19:47:01Z kdevine $
+* @version		$Id: database.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla.Framework
 * @subpackage	Database
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -959,7 +959,7 @@
 
 		$query = trim( $query );
 		$this->setQuery( $query );
-		if (eregi( '^select', $query )) {
+		if (preg_match('#^select#i', $query )) {
 			$result = $this->loadRowList();
 			return new JRecordSet( $result );
 		} else {
diff -aruN --binary 14/libraries/joomla/database/recordset.php 15/libraries/joomla/database/recordset.php
--- 14/libraries/joomla/database/recordset.php	2009-05-29 14:54:30.000000000 +0200
+++ 15/libraries/joomla/database/recordset.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: recordset.php 11074 2008-10-13 04:54:12Z ian $
+* @version		$Id: recordset.php 13341 2009-10-27 03:03:54Z ian $
 * @package		Joomla.Framework
 * @subpackage	Database
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
-
+defined('JPATH_BASE') or die();
 /**
  * Simple Record Set object to allow our database connector to be used with
  * ADODB driven 3rd party libraries
diff -aruN --binary 14/libraries/joomla/database/table/menutypes.php 15/libraries/joomla/database/table/menutypes.php
--- 14/libraries/joomla/database/table/menutypes.php	2009-05-29 14:54:30.000000000 +0200
+++ 15/libraries/joomla/database/table/menutypes.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: menutypes.php 10572 2008-07-21 01:52:00Z pasamio $
+ * @version		$Id: menutypes.php 12698 2009-09-12 02:12:51Z ian $
  * @package		Joomla.Framework
  * @subpackage	Table
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -49,7 +49,16 @@
 	 */
 	function check()
 	{
-		$this->menutype = JFilterOutput::stringURLSafe($this->menutype);
+		
+		$this->menutype = str_replace('-', ' ', $this->menutype);
+
+		$lang =& JFactory::getLanguage();
+		$this->menutype = $lang->transliterate($this->menutype);
+
+		$this->menutype = preg_replace(array('/\s+/','/[^A-Za-z0-9\-\_]/'), array('-',''), $this->menutype);
+
+		$this->menutype = trim(strtolower($this->menutype));
+		
 		if(empty($this->menutype)) {
 			$this->setError( "Cannot save: Empty menu type" );
 			return false;
diff -aruN --binary 14/libraries/joomla/database/table/user.php 15/libraries/joomla/database/table/user.php
--- 14/libraries/joomla/database/table/user.php	2009-05-29 14:54:30.000000000 +0200
+++ 15/libraries/joomla/database/table/user.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: user.php 11223 2008-10-29 03:10:37Z pasamio $
+* @version		$Id: user.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla.Framework
 * @subpackage	Table
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -148,7 +148,7 @@
 			return false;
 		}
 
-		if (eregi( "[<>\"'%;()&]", $this->username) || strlen(utf8_decode($this->username )) < 2) {
+		if (preg_match( "#[<>\"'%;()&]#i", $this->username) || strlen(utf8_decode($this->username )) < 2) {
 			$this->setError( JText::sprintf( 'VALID_AZ09', JText::_( 'Username' ), 2 ) );
 			return false;
 		}
diff -aruN --binary 14/libraries/joomla/document/feed/renderer/rss.php 15/libraries/joomla/document/feed/renderer/rss.php
--- 14/libraries/joomla/document/feed/renderer/rss.php	2009-05-29 14:54:32.000000000 +0200
+++ 15/libraries/joomla/document/feed/renderer/rss.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: rss.php 11806 2009-05-10 00:28:51Z kdevine $
+ * @version		$Id: rss.php 13310 2009-10-24 04:09:35Z ian $
  * @package		Joomla.Framework
  * @subpackage	Document
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -55,7 +55,7 @@
 		$feed = "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";
 		$feed.= "	<channel>\n";
 		$feed.= "		<title>".$data->title."</title>\n";
-		$feed.= "		<description>".$data->description."</description>\n";
+		$feed.= "		<description>".htmlspecialchars($data->description)."</description>\n";
 		$feed.= "		<link>".str_replace(' ','%20',$url.$data->link)."</link>\n";
 		$feed.= "		<lastBuildDate>".htmlspecialchars($now->toRFC822(), ENT_COMPAT, 'UTF-8')."</lastBuildDate>\n";
 		$feed.= "		<generator>".$data->getGenerator()."</generator>\n";
diff -aruN --binary 14/libraries/joomla/environment/response.php 15/libraries/joomla/environment/response.php
--- 14/libraries/joomla/environment/response.php	2009-05-29 14:54:28.000000000 +0200
+++ 15/libraries/joomla/environment/response.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: response.php 10707 2008-08-21 09:52:47Z eddieajau $
+ * @version		$Id: response.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	Environment
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -15,6 +15,7 @@
 /**
  * Create the response global object
  */
+defined('JPATH_BASE') or die();
 $GLOBALS['_JRESPONSE'] = new stdClass();
 $GLOBALS['_JRESPONSE']->cachable = false;
 $GLOBALS['_JRESPONSE']->headers  = array();
diff -aruN --binary 14/libraries/joomla/error/error.php 15/libraries/joomla/error/error.php
--- 14/libraries/joomla/error/error.php	2009-05-29 14:54:22.000000000 +0200
+++ 15/libraries/joomla/error/error.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: error.php 10871 2008-08-30 07:30:33Z willebil $
+ * @version		$Id: error.php 13385 2009-10-29 13:35:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	Error
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -547,6 +547,15 @@
 		$document	= & JDocument::getInstance('error');
 		$config		= & JFactory::getConfig();
 
+		//Get the current language direction
+		$language = &JFactory::getLanguage();
+		if ($language->isRTL()){
+		$dir ="rtl";
+		}
+		else {
+		$dir ="ltr";
+		}
+
 		// Get the current template from the application
 		$template = $app->getTemplate();
 
@@ -555,6 +564,8 @@
 
 		@ob_end_clean();
 		$document->setTitle(JText::_('Error').': '.$error->code);
+		$document->setLanguage($language->getTag());
+		$document->setDirection($dir);
 		$data = $document->render(false, array (
 			'template' => $template,
 			'directory' => JPATH_THEMES,
@@ -570,4 +581,4 @@
 	{
 		JError::raise($level, '', $msg);
 	}
-}
\ No hay ningún carácter de nueva línea al final del fichero
+}
diff -aruN --binary 14/libraries/joomla/factory.php 15/libraries/joomla/factory.php
--- 14/libraries/joomla/factory.php	2009-06-30 22:01:32.000000000 +0200
+++ 15/libraries/joomla/factory.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: factory.php 12389 2009-07-01 00:34:45Z ian $
+ * @version		$Id: factory.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
  * @license		GNU/GPL, see LICENSE.php
@@ -10,7 +10,7 @@
  * other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * Joomla Framework Factory class
  *
diff -aruN --binary 14/libraries/joomla/filesystem/archive.php 15/libraries/joomla/filesystem/archive.php
--- 14/libraries/joomla/filesystem/archive.php	2009-05-29 14:54:22.000000000 +0200
+++ 15/libraries/joomla/filesystem/archive.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: archive.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: archive.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	FileSystem
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
  * other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * An Archive handling class
  *
diff -aruN --binary 14/libraries/joomla/filesystem/path.php 15/libraries/joomla/filesystem/path.php
--- 14/libraries/joomla/filesystem/path.php	2009-05-29 14:54:22.000000000 +0200
+++ 15/libraries/joomla/filesystem/path.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: path.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: path.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	FileSystem
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
  * other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /** boolean True if a Windows based host */
 define('JPATH_ISWIN', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'));
 /** boolean True if a Mac based host */
diff -aruN --binary 14/libraries/joomla/filter/filteroutput.php 15/libraries/joomla/filter/filteroutput.php
--- 14/libraries/joomla/filter/filteroutput.php	2009-05-29 14:54:22.000000000 +0200
+++ 15/libraries/joomla/filter/filteroutput.php	2009-11-04 18:51:20.000000000 +0100
@@ -11,7 +11,7 @@
  * source software licenses. See COPYRIGHT.php for copyright notices and
  * details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * JFilterOutput
  *
diff -aruN --binary 14/libraries/joomla/html/editor.php 15/libraries/joomla/html/editor.php
--- 14/libraries/joomla/html/editor.php	2009-06-30 22:01:32.000000000 +0200
+++ 15/libraries/joomla/html/editor.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: editor.php 12075 2009-06-14 18:32:10Z ian $
+ * @version		$Id: editor.php 13376 2009-10-29 01:44:22Z ian $
  * @package		Joomla.Framework
  * @subpackage	HTML
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -39,6 +39,13 @@
 	 * @var string
 	 */
 	var $_name = null;
+	
+	/**
+	 * Editor start and end tag
+	 * Used to tell SEF plugin not to process editor contents
+	 * @var array
+	 */
+	var $_tagForSEF = array('start' => '<!-- Start Editor -->', 'end' => '<!-- End Editor -->'); 
 
 	/**
 	 * constructor
@@ -150,7 +157,7 @@
 				$return .= $result;
 			}
 		}
-		return $return;
+		return $this->_tagForSEF['start'] . $return . $this->_tagForSEF['end'];
 	}
 
 	/**
diff -aruN --binary 14/libraries/joomla/html/html/behavior.php 15/libraries/joomla/html/html/behavior.php
--- 14/libraries/joomla/html/html/behavior.php	2009-05-29 14:54:28.000000000 +0200
+++ 15/libraries/joomla/html/html/behavior.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: behavior.php 11683 2009-03-08 20:55:17Z willebil $
+* @version		$Id: behavior.php 13341 2009-10-27 03:03:54Z ian $
 * @package		Joomla.Framework
 * @subpackage	HTML
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
-
+defined('JPATH_BASE') or die();
 /**
  * Utility class for javascript behaviors
  *
diff -aruN --binary 14/libraries/joomla/html/html/email.php 15/libraries/joomla/html/html/email.php
--- 14/libraries/joomla/html/html/email.php	2009-05-29 14:54:28.000000000 +0200
+++ 15/libraries/joomla/html/html/email.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: email.php 11236 2008-11-02 02:44:35Z ian $
+* @version		$Id: email.php 13341 2009-10-27 03:03:54Z ian $
 * @package		Joomla.Framework
 * @subpackage	HTML
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
-
+defined('JPATH_BASE') or die();
 /**
  * Utility class for cloaking email adresses
  *
@@ -27,7 +27,7 @@
 	*
  	* By default replaces an email with a mailto link with email cloacked
 	*/
-	function cloak( $mail, $mailto=1, $text='', $email=1 )
+	function cloak( $mail, $mailto=1, $text='', $email=1, $prefix='mailto:', $suffix='', $attribs='' )
 	{
 		// convert text
 		$mail 			= JHTMLEmail::_convertEncoding( $mail );
@@ -36,10 +36,14 @@
 		$mail_parts		= explode( '.', $mail[1] );
 		// random number
 		$rand			= rand( 1, 100000 );
+        // obfuscate prefix
+        $prefix = JHTMLEmail::_convertEncoding( $prefix );
 
 		$replacement 	= "\n <script language='JavaScript' type='text/javascript'>";
 		$replacement 	.= "\n <!--";
-		$replacement 	.= "\n var prefix = '&#109;a' + 'i&#108;' + '&#116;o';";
+		$replacement 	.= "\n var prefix = '$prefix';";
+        $replacement    .= "\n var suffix = '$suffix';";
+        $replacement    .= "\n var attribs = '$attribs';";
 		$replacement 	.= "\n var path = 'hr' + 'ef' + '=';";
 		$replacement 	.= "\n var addy". $rand ." = '". @$mail[0] ."' + '&#64;';";
 		$replacement 	.= "\n addy". $rand ." = addy". $rand ." + '". implode( "' + '&#46;' + '", $mail_parts ) ."';";
@@ -57,11 +61,11 @@
 				} else {
 					$replacement 	.= "\n var addy_text". $rand ." = '". $text ."';";
 				}
-				$replacement 	.= "\n document.write( '<a ' + path + '\'' + prefix + ':' + addy". $rand ." + '\'>' );";
+				$replacement 	.= "\n document.write( '<a ' + path + '\'' + prefix + addy". $rand ." + suffix + '\'' + attribs + '>' );";
 				$replacement 	.= "\n document.write( addy_text". $rand ." );";
 				$replacement 	.= "\n document.write( '<\/a>' );";
 			} else {
-				$replacement 	.= "\n document.write( '<a ' + path + '\'' + prefix + ':' + addy". $rand ." + '\'>' );";
+				$replacement 	.= "\n document.write( '<a ' + path + '\'' + prefix + addy". $rand ." + suffix + '\'' + attribs + '>' );";
 				$replacement 	.= "\n document.write( addy". $rand ." );";
 				$replacement 	.= "\n document.write( '<\/a>' );";
 			}
@@ -69,7 +73,7 @@
 			$replacement 	.= "\n document.write( addy". $rand ." );";
 		}
 		$replacement 	.= "\n //-->";
-		$replacement 	.= '\n </script> ';
+		$replacement 	.= "\n </script> ";
 
 		// XHTML compliance `No Javascript` text handling
 		$replacement 	.= "<script language='JavaScript' type='text/javascript'>";
@@ -101,3 +105,4 @@
 	}
 }
 
+
diff -aruN --binary 14/libraries/joomla/html/html/form.php 15/libraries/joomla/html/html/form.php
--- 14/libraries/joomla/html/html/form.php	2009-05-29 14:54:28.000000000 +0200
+++ 15/libraries/joomla/html/html/form.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: form.php 10381 2008-06-01 03:35:53Z pasamio $
+ * @version		$Id: form.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	HTML
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
  * other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * Utility class for form elements
  *
diff -aruN --binary 14/libraries/joomla/html/html/grid.php 15/libraries/joomla/html/html/grid.php
--- 14/libraries/joomla/html/html/grid.php	2009-05-29 14:54:28.000000000 +0200
+++ 15/libraries/joomla/html/html/grid.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: grid.php 11682 2009-03-08 20:54:02Z willebil $
+* @version		$Id: grid.php 13341 2009-10-27 03:03:54Z ian $
 * @package		Joomla.Framework
 * @subpackage	HTML
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
-
+defined('JPATH_BASE') or die();
 /**
  * Utility class for creating HTML Grids
  *
diff -aruN --binary 14/libraries/joomla/html/html/list.php 15/libraries/joomla/html/html/list.php
--- 14/libraries/joomla/html/html/list.php	2009-06-30 22:01:32.000000000 +0200
+++ 15/libraries/joomla/html/html/list.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: list.php 12348 2009-06-24 13:34:12Z ian $
+* @version		$Id: list.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla.Framework
 * @subpackage		HTML
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -60,7 +60,7 @@
 		$imageFiles = JFolder::files( JPATH_SITE.DS.$directory );
 		$images 	= array(  JHTML::_('select.option',  '', '- '. JText::_( 'Select Image' ) .' -' ) );
 		foreach ( $imageFiles as $file ) {
-		   if ( eregi( $extensions, $file ) ) {
+		   if ( preg_match( "#$extensions#i", $file ) ) {
 				$images[] = JHTML::_('select.option',  $file );
 			}
 		}
diff -aruN --binary 14/libraries/joomla/html/html/select.php 15/libraries/joomla/html/html/select.php
--- 14/libraries/joomla/html/html/select.php	2009-05-29 14:54:28.000000000 +0200
+++ 15/libraries/joomla/html/html/select.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: select.php 10824 2008-08-27 17:20:01Z tcp $
+* @version		$Id: select.php 13341 2009-10-27 03:03:54Z ian $
 * @package		Joomla.Framework
 * @subpackage	HTML
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
-
+defined('JPATH_BASE') or die();
 /**
  * Utility class for creating HTML select lists
  *
diff -aruN --binary 14/libraries/joomla/html/html.php 15/libraries/joomla/html/html.php
--- 14/libraries/joomla/html/html.php	2009-06-30 22:01:32.000000000 +0200
+++ 15/libraries/joomla/html/html.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: html.php 12350 2009-06-24 13:42:16Z ian $
+ * @version		$Id: html.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	HTML
  * @copyright	Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
  * other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * Utility class for all HTML drawing classes
  *
@@ -82,8 +82,12 @@
 
 		if (is_callable( array( $className, $func ) ))
 		{
-			$args = func_get_args();
-			array_shift( $args );
+			$temp = func_get_args();
+			array_shift( $temp );
+			$args = array();
+			foreach ($temp as $k => $v) {
+			    $args[] = &$temp[$k];
+			}
 			return call_user_func_array( array( $className, $func ), $args );
 		}
 		else
diff -aruN --binary 14/libraries/joomla/html/pagination.php 15/libraries/joomla/html/pagination.php
--- 14/libraries/joomla/html/pagination.php	2009-05-29 14:54:28.000000000 +0200
+++ 15/libraries/joomla/html/pagination.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: pagination.php 10707 2008-08-21 09:52:47Z eddieajau $
+ * @version		$Id: pagination.php 13242 2009-10-20 03:54:55Z ian $
  * @package		Joomla.Framework
  * @subpackage	HTML
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -148,7 +148,7 @@
 		// Initialize variables
 		$html = null;
 		if ($this->get('pages.total') > 1) {
-			$html .= JText::_('Page')." ".$this->get('pages.current')." ".JText::_('of')." ".$this->get('pages.total');
+			$html .= JText::sprintf('JPAGE_CURRENT_OF_TOTAL', $this->get('pages.current'), $this->get('pages.total'));
 		}
 		return $html;
 	}
diff -aruN --binary 14/libraries/joomla/html/parameter/element/timezones.php 15/libraries/joomla/html/parameter/element/timezones.php
--- 14/libraries/joomla/html/parameter/element/timezones.php	2009-05-29 14:54:28.000000000 +0200
+++ 15/libraries/joomla/html/parameter/element/timezones.php	2009-11-04 18:51:20.000000000 +0100
@@ -71,7 +71,7 @@
 			JHTML::_('select.option', 6.30, JText::_('(UTC +06:30) Yagoon')),
 			JHTML::_('select.option', 7, JText::_('(UTC +07:00) Bangkok, Hanoi, Jakarta')),
 			JHTML::_('select.option', 8, JText::_('(UTC +08:00) Beijing, Perth, Singapore, Hong Kong')),
-			JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Western Australia')),
+			JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Ulaanbaatar, Western Australia')),
 			JHTML::_('select.option', 9, JText::_('(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk')),
 			JHTML::_('select.option', 9.5, JText::_('(UTC +09:30) Adelaide, Darwin, Yakutsk')),
 			JHTML::_('select.option', 10, JText::_('(UTC +10:00) Eastern Australia, Guam, Vladivostok')),
diff -aruN --binary 14/libraries/joomla/installer/adapters/module.php 15/libraries/joomla/installer/adapters/module.php
--- 14/libraries/joomla/installer/adapters/module.php	2009-05-29 14:54:22.000000000 +0200
+++ 15/libraries/joomla/installer/adapters/module.php	2009-11-04 18:51:20.000000000 +0100
@@ -99,7 +99,7 @@
 		// Set the installation path
 		$element =& $this->manifest->getElementByPath('files');
 		if (is_a($element, 'JSimpleXMLElement') && count($element->children())) {
-			$files =& $element->children();
+			$files = $element->children();
 			foreach ($files as $file) {
 				if ($file->attributes('module')) {
 					$mname = $file->attributes('module');
diff -aruN --binary 14/libraries/joomla/installer/adapters/plugin.php 15/libraries/joomla/installer/adapters/plugin.php
--- 14/libraries/joomla/installer/adapters/plugin.php	2009-05-29 14:54:22.000000000 +0200
+++ 15/libraries/joomla/installer/adapters/plugin.php	2009-11-04 18:51:20.000000000 +0100
@@ -81,7 +81,7 @@
 		// Set the installation path
 		$element =& $this->manifest->getElementByPath('files');
 		if (is_a($element, 'JSimpleXMLElement') && count($element->children())) {
-			$files =& $element->children();
+			$files = $element->children();
 			foreach ($files as $file) {
 				if ($file->attributes($type)) {
 					$pname = $file->attributes($type);
diff -aruN --binary 14/libraries/joomla/language/help.php 15/libraries/joomla/language/help.php
--- 14/libraries/joomla/language/help.php	2009-05-29 14:54:20.000000000 +0200
+++ 15/libraries/joomla/language/help.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: help.php 10381 2008-06-01 03:35:53Z pasamio $
+* @version		$Id: help.php 13341 2009-10-27 03:03:54Z ian $
 * @package		Joomla.Framework
 * @subpackage	Language
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
-
+defined('JPATH_BASE') or die();
 /**
  * Help system class
  *
@@ -39,7 +39,7 @@
 
 		if ($useComponent)
 		{
-			if (!eregi( '\.html$', $ref )) {
+			if (!preg_match( '#\.html$#i', $ref )) {
 				$ref = $ref . '.html';
 			}
 
@@ -77,7 +77,7 @@
 			// Included html help files
 			$helpURL = 'help/' .$lang->getTag() .'/';
 
-			if (!eregi( '\.html$', $ref )) {
+			if (!preg_match( '#\.html$#i', $ref )) {
 				$ref = $ref . '.html';
 			}
 
diff -aruN --binary 14/libraries/joomla/language/language.php 15/libraries/joomla/language/language.php
--- 14/libraries/joomla/language/language.php	2009-05-29 14:54:20.000000000 +0200
+++ 15/libraries/joomla/language/language.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: language.php 11305 2008-11-23 19:14:25Z ian $
+* @version		$Id: language.php 13297 2009-10-24 01:29:37Z ian $
 * @package		Joomla.Framework
 * @subpackage	Language
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -286,7 +286,10 @@
 
 		$path = JLanguage::getLanguagePath( $basePath, $lang);
 
-		$filename = ( $extension == 'joomla' || $extension == '' ) ?  $lang : $lang . '.' . $extension ;
+		if ( !strlen( $extension ) ) {
+			$extension = 'joomla';
+		}
+		$filename = ( $extension == 'joomla' ) ?  $lang : $lang . '.' . $extension ;
 		$filename = $path.DS.$filename.'.ini';
 
 		$result = false;
@@ -305,7 +308,7 @@
 			{
 				// No strings, which probably means that the language file does not exist
 				$path		= JLanguage::getLanguagePath( $basePath, $this->_default);
-				$filename	= ( $extension == 'joomla' || $extension == '' ) ?  $this->_default : $this->_default . '.' . $extension ;
+				$filename	= ( $extension == 'joomla' ) ?  $this->_default : $this->_default . '.' . $extension ;
 				$filename	= $path.DS.$filename.'.ini';
 
 				$result = $this->_load( $filename, $extension, false );
@@ -316,7 +319,6 @@
 		return $result;
 
 	}
-
 	/**
 	* Loads a language file
 	*
diff -aruN --binary 14/libraries/joomla/registry/format/php.php 15/libraries/joomla/registry/format/php.php
--- 14/libraries/joomla/registry/format/php.php	2009-05-29 14:54:30.000000000 +0200
+++ 15/libraries/joomla/registry/format/php.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: php.php 10707 2008-08-21 09:52:47Z eddieajau $
+ * @version		$Id: php.php 12849 2009-09-25 16:47:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	Registry
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -41,7 +41,7 @@
 		foreach (get_object_vars( $object ) as $k => $v)
 		{
 			if (is_scalar($v)) {
-				$vars .= "\tvar $". $k . " = '" . addslashes($v) . "';\n";
+				$vars .= "\tvar $". $k . " = '" . addcslashes($v, '\\\'') . "';\n";
 			} elseif (is_array($v)) {
 				$vars .= "\tvar $". $k . " = " . $this->_getArrayString($v) . ";\n";
 			}
@@ -83,4 +83,4 @@
 		$s .= ')';
 		return $s;
 	}
-}
\ No hay ningún carácter de nueva línea al final del fichero
+}
diff -aruN --binary 14/libraries/joomla/session/session.php 15/libraries/joomla/session/session.php
--- 14/libraries/joomla/session/session.php	2009-05-29 14:54:22.000000000 +0200
+++ 15/libraries/joomla/session/session.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: session.php 11409 2009-01-10 02:27:08Z willebil $
+* @version		$Id: session.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla.Framework
 * @subpackage	Session
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -280,7 +280,7 @@
 				require_once(dirname(__FILE__).DS.'storage'.DS.$name.'.php');
 			}
 
-			if(call_user_func_array( array( trim($class), 'test' ), null)) {
+			if(call_user_func_array( array( trim($class), 'test' ), array())) {
 				$names[] = $name;
 			}
 		}
diff -aruN --binary 14/libraries/joomla/user/helper.php 15/libraries/joomla/user/helper.php
--- 14/libraries/joomla/user/helper.php	2009-05-29 14:54:34.000000000 +0200
+++ 15/libraries/joomla/user/helper.php	2009-11-04 18:51:20.000000000 +0100
@@ -11,7 +11,7 @@
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
-
+defined('JPATH_BASE') or die();
 /**
  * Authorization helper class, provides static methods to perform various tasks relevant
  * to the Joomla user and authorization classes
diff -aruN --binary 14/libraries/joomla/utilities/arrayhelper.php 15/libraries/joomla/utilities/arrayhelper.php
--- 14/libraries/joomla/utilities/arrayhelper.php	2009-05-29 14:54:32.000000000 +0200
+++ 15/libraries/joomla/utilities/arrayhelper.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: arrayhelper.php 10707 2008-08-21 09:52:47Z eddieajau $
+ * @version		$Id: arrayhelper.php 13341 2009-10-27 03:03:54Z ian $
  * @package		Joomla.Framework
  * @subpackage	Utilities
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -11,7 +11,7 @@
  * source software licenses. See COPYRIGHT.php for copyright notices and
  * details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * JArrayHelper is an array utility class for doing all sorts of odds and ends with arrays.
  *
diff -aruN --binary 14/libraries/joomla/utilities/buffer.php 15/libraries/joomla/utilities/buffer.php
--- 14/libraries/joomla/utilities/buffer.php	2009-05-29 14:54:32.000000000 +0200
+++ 15/libraries/joomla/utilities/buffer.php	2009-11-04 18:51:20.000000000 +0100
@@ -11,7 +11,7 @@
  * other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * Generic Buffer stream handler
  *
diff -aruN --binary 14/libraries/joomla/utilities/compat/php51x.php 15/libraries/joomla/utilities/compat/php51x.php
--- 14/libraries/joomla/utilities/compat/php51x.php	2009-05-29 14:54:32.000000000 +0200
+++ 15/libraries/joomla/utilities/compat/php51x.php	2009-11-04 18:51:20.000000000 +0100
@@ -11,7 +11,7 @@
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
-
+defined('JPATH_BASE') or die();
  /**
  * PHP 5.1.x Compatibility functions
  *
diff -aruN --binary 14/libraries/joomla/version.php 15/libraries/joomla/version.php
--- 14/libraries/joomla/version.php	2009-07-30 21:02:22.000000000 +0200
+++ 15/libraries/joomla/version.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: version.php 12584 2009-07-30 17:46:47Z ian $
+ * @version		$Id: version.php 13426 2009-11-04 16:36:00Z ian $
  * @package	Joomla.Framework
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
  * @license		GNU/GPL, see LICENSE.php
@@ -10,7 +10,7 @@
  * other free or open source software licenses.
  * See COPYRIGHT.php for copyright notices and details.
  */
-
+defined('JPATH_BASE') or die();
 /**
  * Version information
  *
@@ -26,15 +26,15 @@
 	/** @var string Development Status */
 	var $DEV_STATUS = 'Stable';
 	/** @var int Sub Release Level */
-	var $DEV_LEVEL 	= '14';
+	var $DEV_LEVEL 	= '15';
 	/** @var int build Number */
 	var $BUILD	= '';
 	/** @var string Codename */
-	var $CODENAME 	= 'Wojmamni Ama Naiki';
+	var $CODENAME 	= 'Wojmamni Ama Mamni';
 	/** @var string Date */
-	var $RELDATE 	= '30-July-2009';
+	var $RELDATE 	= '05-November-2009';
 	/** @var string Time */
-	var $RELTIME 	= '23:00';
+	var $RELTIME 	= '04:00';
 	/** @var string Timezone */
 	var $RELTZ 	= 'GMT';
 	/** @var string Copyright Text */
diff -aruN --binary 14/libraries/pattemplate/patErrorManager.php 15/libraries/pattemplate/patErrorManager.php
--- 14/libraries/pattemplate/patErrorManager.php	2009-05-29 14:54:20.000000000 +0200
+++ 15/libraries/pattemplate/patErrorManager.php	2009-11-04 18:51:20.000000000 +0100
@@ -4,7 +4,7 @@
  * application-internal error management. Creates patError objects for
  * any errors for precise error management.
  *
- *	$Id: patErrorManager.php 10871 2008-08-30 07:30:33Z willebil $
+ *	$Id: patErrorManager.php 12694 2009-09-11 21:03:02Z ian $
  *
  * @package	patError
  */
@@ -199,7 +199,7 @@
 		}
 
 		// build error object
-		$error			=&	new	$class( $level, $code, $msg, $info );
+		$error			= new $class( $level, $code, $msg, $info );
 
 		// see what to do with this kind of error
 		$handling	=	patErrorManager::getErrorHandling( $level );
@@ -707,4 +707,4 @@
 		return $result;
     }
 }
-?>
\ No hay ningún carácter de nueva línea al final del fichero
+?>
diff -aruN --binary 14/libraries/pattemplate/patError.php 15/libraries/pattemplate/patError.php
--- 14/libraries/pattemplate/patError.php	2009-05-29 14:54:20.000000000 +0200
+++ 15/libraries/pattemplate/patError.php	2009-11-04 18:51:20.000000000 +0100
@@ -3,7 +3,7 @@
  * patError error object used by the patFormsError manager as error messages
  * container for precise error management.
  *
- *	$Id: patError.php 10381 2008-06-01 03:35:53Z pasamio $
+ *	$Id: patError.php 12694 2009-09-11 21:03:02Z ian $
  *
  * @access		public
  * @package		patError
@@ -13,7 +13,7 @@
  * patError error object used by the patFormsError manager as error messages
  * container for precise error management.
  *
- * $Id: patError.php 10381 2008-06-01 03:35:53Z pasamio $
+ * $Id: patError.php 12694 2009-09-11 21:03:02Z ian $
  *
  * @access		public
  * @package		patError
@@ -257,7 +257,7 @@
     	if ($formatted && is_array( $this->backtrace )) {
     		$result = '';
     		foreach( debug_backtrace() as $back) {
-			    if (!eregi( 'patErrorManager.php', $back['file'])) {
+			    if (!preg_match( '#patErrorManager.php#i', $back['file'])) {
 				    $result .= '<br />'.$back['file'].':'.$back['line'];
 				}
 			}
@@ -294,4 +294,4 @@
 		return $this->line;
     }
 }
-?>
\ No hay ningún carácter de nueva línea al final del fichero
+?>
diff -aruN --binary 14/libraries/pattemplate/patTemplate.php 15/libraries/pattemplate/patTemplate.php
--- 14/libraries/pattemplate/patTemplate.php	2009-05-29 14:54:20.000000000 +0200
+++ 15/libraries/pattemplate/patTemplate.php	2009-11-04 18:51:20.000000000 +0100
@@ -2,7 +2,7 @@
 /**
  * patTemplate
  *
- * $Id: patTemplate.php 10381 2008-06-01 03:35:53Z pasamio $
+ * $Id: patTemplate.php 12694 2009-09-11 21:03:02Z ian $
  *
  * powerful templating engine
  *
@@ -1421,7 +1421,7 @@
 			return	patErrorManager::raiseError( PATTEMPLATE_ERROR_MODULE_NOT_FOUND, "Module file $moduleFile does not contain class $moduleClass." );
 		}
 
-		$this->_modules[$moduleType][$sig]	=	&new $moduleClass;
+		$this->_modules[$moduleType][$sig]	= new $moduleClass;
 		if( method_exists( $this->_modules[$moduleType][$sig], 'setTemplateReference' ) )
 		{
 			$this->_modules[$moduleType][$sig]->setTemplateReference( $this );
@@ -2667,4 +2667,4 @@
 		return $this->getParsedTemplate();
 	}
 }
-?>
\ No hay ningún carácter de nueva línea al final del fichero
+?>
diff -aruN --binary 14/libraries/phpinputfilter/inputfilter.php 15/libraries/phpinputfilter/inputfilter.php
--- 14/libraries/phpinputfilter/inputfilter.php	2009-05-29 14:54:44.000000000 +0200
+++ 15/libraries/phpinputfilter/inputfilter.php	2009-11-04 18:51:20.000000000 +0100
@@ -361,7 +361,7 @@
 			 * Remove all "non-regular" attribute names
 			 * AND blacklisted attributes
 			 */
-			if ((!eregi("^[a-z]*$", $attrSubSet[0])) || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on'))))
+			if ((!preg_match("#^[a-z]*$#i", $attrSubSet[0])) || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on'))))
 			{
 				continue;
 			}
@@ -548,4 +548,4 @@
 		return $string;
 	}
 }
-?>
\ No hay ningún carácter de nueva línea al final del fichero
+?>
diff -aruN --binary 14/libraries/phpmailer/phpmailer.php 15/libraries/phpmailer/phpmailer.php
--- 14/libraries/phpmailer/phpmailer.php	2009-06-30 22:01:32.000000000 +0200
+++ 15/libraries/phpmailer/phpmailer.php	2009-11-04 18:51:20.000000000 +0100
@@ -589,7 +589,7 @@
     /* Retry while there is no connection */
     while($index < count($hosts) && $connection == false) {
       $hostinfo = array();
-      if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
+      if(preg_match('#^(.+):([0-9]+)$#i', $hosts[$index], $hostinfo)) {
         $host = $hostinfo[1];
         $port = $hostinfo[2];
       } else {
diff -aruN --binary 14/libraries/phputf8/utils/ascii.php 15/libraries/phputf8/utils/ascii.php
--- 14/libraries/phputf8/utils/ascii.php	2009-05-29 14:54:38.000000000 +0200
+++ 15/libraries/phputf8/utils/ascii.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,69 +1,11 @@
 <?php
 /**
 * Tools to help with ASCII in UTF-8
-* @version $Id: ascii.php 10381 2008-06-01 03:35:53Z pasamio $
+* @version $Id: ascii.php 13342 2009-10-27 03:25:58Z ian $
 * @package utf8
 * @subpackage ascii
 */
 
-//---------------------------------------------------------------
-/**
-* UTF-8 lookup table for lower case accented letters
-* This lookuptable defines replacements for accented characters from the ASCII-7
-* range. This are lower case letters only.
-* @author Andreas Gohr <andi@splitbrain.org>
-* @see utf8_deaccent()
-* @package utf8
-* @subpackage ascii
-*/
-$GLOBALS['UTF8_LOWER_ACCENTS'] = array(
-    'Ã ' => 'a', 'Ã´' => 'o', 'Ä�?' => 'd', 'á¸Ÿ' => 'f', 'Ã«' => 'e', 'Å¡' => 's', 'Æ¡' => 'o',
-    'ÃŸ' => 'ss', 'Äƒ' => 'a', 'Å™' => 'r', 'È›' => 't', 'Åˆ' => 'n', 'Ä�?' => 'a', 'Ä·' => 'k',
-    'Å�?' => 's', 'á»³' => 'y', 'Å†' => 'n', 'Äº' => 'l', 'Ä§' => 'h', 'á¹—' => 'p', 'Ã³' => 'o',
-    'Ãº' => 'u', 'Ä›' => 'e', 'Ã©' => 'e', 'Ã§' => 'c', 'áº�?' => 'w', 'Ä‹' => 'c', 'Ãµ' => 'o',
-    'á¹¡' => 's', 'Ã¸' => 'o', 'Ä£' => 'g', 'Å§' => 't', 'È™' => 's', 'Ä—' => 'e', 'Ä‰' => 'c',
-    'Å›' => 's', 'Ã®' => 'i', 'Å±' => 'u', 'Ä‡' => 'c', 'Ä™' => 'e', 'Åµ' => 'w', 'á¹«' => 't',
-    'Å«' => 'u', 'Ä�?' => 'c', 'Ã¶' => 'oe', 'Ã¨' => 'e', 'Å·' => 'y', 'Ä…' => 'a', 'Å‚' => 'l',
-    'Å³' => 'u', 'Å¯' => 'u', 'ÅŸ' => 's', 'ÄŸ' => 'g', 'Ä¼' => 'l', 'Æ’' => 'f', 'Å¾' => 'z',
-    'áºƒ' => 'w', 'á¸ƒ' => 'b', 'Ã¥' => 'a', 'Ã¬' => 'i', 'Ã¯' => 'i', 'á¸‹' => 'd', 'Å¥' => 't',
-    'Å—' => 'r', 'Ã¤' => 'ae', 'Ã­' => 'i', 'Å•' => 'r', 'Ãª' => 'e', 'Ã¼' => 'ue', 'Ã²' => 'o',
-    'Ä“' => 'e', 'Ã±' => 'n', 'Å„' => 'n', 'Ä¥' => 'h', 'Ä�?' => 'g', 'Ä‘' => 'd', 'Äµ' => 'j',
-    'Ã¿' => 'y', 'Å©' => 'u', 'Å­' => 'u', 'Æ°' => 'u', 'Å£' => 't', 'Ã½' => 'y', 'Å‘' => 'o',
-    'Ã¢' => 'a', 'Ä¾' => 'l', 'áº…' => 'w', 'Å¼' => 'z', 'Ä«' => 'i', 'Ã£' => 'a', 'Ä¡' => 'g',
-    'á¹�?' => 'm', 'Å�?' => 'o', 'Ä©' => 'i', 'Ã¹' => 'u', 'Ä¯' => 'i', 'Åº' => 'z', 'Ã¡' => 'a',
-    'Ã»' => 'u', 'Ã¾' => 'th', 'Ã°' => 'dh', 'Ã¦' => 'ae', 'Âµ' => 'u',
-);
-
-
-//---------------------------------------------------------------
-/**
-* UTF-8 lookup table for upper case accented letters
-* This lookuptable defines replacements for accented characters from the ASCII-7
-* range. This are upper case letters only.
-* @author Andreas Gohr <andi@splitbrain.org>
-* @see utf8_deaccent()
-* @package utf8
-* @subpackage ascii
- */
-
-$GLOBALS['UTF8_UPPER_ACCENTS'] = array(
-    'Ã ' => 'A', 'Ã´' => 'O', 'Ä�?' => 'D', 'á¸Ÿ' => 'F', 'Ã«' => 'E', 'Å¡' => 'S', 'Æ¡' => 'O',
-    'ÃŸ' => 'Ss', 'Äƒ' => 'A', 'Å™' => 'R', 'È›' => 'T', 'Åˆ' => 'N', 'Ä�?' => 'A', 'Ä·' => 'K',
-    'Å�?' => 'S', 'á»³' => 'Y', 'Å†' => 'N', 'Äº' => 'L', 'Ä§' => 'H', 'á¹—' => 'P', 'Ã³' => 'O',
-    'Ãº' => 'U', 'Ä›' => 'E', 'Ã©' => 'E', 'Ã§' => 'C', 'áº�?' => 'W', 'Ä‹' => 'C', 'Ãµ' => 'O',
-    'á¹¡' => 'S', 'Ã¸' => 'O', 'Ä£' => 'G', 'Å§' => 'T', 'È™' => 'S', 'Ä—' => 'E', 'Ä‰' => 'C',
-    'Å›' => 'S', 'Ã®' => 'I', 'Å±' => 'U', 'Ä‡' => 'C', 'Ä™' => 'E', 'Åµ' => 'W', 'á¹«' => 'T',
-    'Å«' => 'U', 'Ä�?' => 'C', 'Ã¶' => 'Oe', 'Ã¨' => 'E', 'Å·' => 'Y', 'Ä…' => 'A', 'Å‚' => 'L',
-    'Å³' => 'U', 'Å¯' => 'U', 'ÅŸ' => 'S', 'ÄŸ' => 'G', 'Ä¼' => 'L', 'Æ’' => 'F', 'Å¾' => 'Z',
-    'áºƒ' => 'W', 'á¸ƒ' => 'B', 'Ã¥' => 'A', 'Ã¬' => 'I', 'Ã¯' => 'I', 'á¸‹' => 'D', 'Å¥' => 'T',
-    'Å—' => 'R', 'Ã¤' => 'Ae', 'Ã­' => 'I', 'Å•' => 'R', 'Ãª' => 'E', 'Ã¼' => 'Ue', 'Ã²' => 'O',
-    'Ä“' => 'E', 'Ã±' => 'N', 'Å„' => 'N', 'Ä¥' => 'H', 'Ä�?' => 'G', 'Ä‘' => 'D', 'Äµ' => 'J',
-    'Ã¿' => 'Y', 'Å©' => 'U', 'Å­' => 'U', 'Æ°' => 'U', 'Å£' => 'T', 'Ã½' => 'Y', 'Å‘' => 'O',
-    'Ã¢' => 'A', 'Ä¾' => 'L', 'áº…' => 'W', 'Å¼' => 'Z', 'Ä«' => 'I', 'Ã£' => 'A', 'Ä¡' => 'G',
-    'á¹�?' => 'M', 'Å�?' => 'O', 'Ä©' => 'I', 'Ã¹' => 'U', 'Ä¯' => 'I', 'Åº' => 'Z', 'Ã¡' => 'A',
-    'Ã»' => 'U', 'Ãž' => 'Th', 'Ã�?' => 'Dh', 'Ã†' => 'Ae',
-);
-
 //--------------------------------------------------------------------
 /**
 * Tests whether a string contains only 7bit ASCII bytes.
@@ -72,16 +14,14 @@
 * benefits by using the native PHP equivalent if it's just ASCII e.g.;
 *
 * <code>
-* <?php
 * if ( utf8_is_ascii($someString) ) {
 *     // It's just ASCII - use the native PHP version
 *     $someString = strtolower($someString);
 * } else {
 *     $someString = utf8_strtolower($someString);
 * }
-* ?>
 * </code>
-*
+* 
 * @param string
 * @return boolean TRUE if it's all ASCII
 * @package utf8
@@ -89,11 +29,8 @@
 * @see utf8_is_ascii_ctrl
 */
 function utf8_is_ascii($str) {
-    if ( strlen($str) > 0 ) {
-        // Search for any bytes which are outside the ASCII range...
-        return (preg_match('/[^\x00-\x7F]/',$str) !== 1);
-    }
-    return FALSE;
+    // Search for any bytes which are outside the ASCII range...
+    return (preg_match('/(?:[^\x00-\x7F])/',$str) !== 1);
 }
 
 //--------------------------------------------------------------------
@@ -101,7 +38,7 @@
 * Tests whether a string contains only 7bit ASCII bytes with device
 * control codes omitted. The device control codes can be found on the
 * second table here: http://www.w3schools.com/tags/ref_ascii.asp
-*
+* 
 * @param string
 * @return boolean TRUE if it's all ASCII without device control codes
 * @package utf8
@@ -145,10 +82,35 @@
 
 //--------------------------------------------------------------------
 /**
+* Strip out device control codes in the ASCII range
+* which are not permitted in XML. Note that this leaves
+* multi-byte characters untouched - it only removes device
+* control codes
+* @see http://hsivonen.iki.fi/producing-xml/#controlchar
+* @param string
+* @return string control codes removed
+*/
+function utf8_strip_ascii_ctrl($str) {
+    ob_start();
+    while ( preg_match(
+        '/^([^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)|([\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)/S',
+            $str, $matches) ) {
+        if ( !isset($matches[2]) ) {
+            echo $matches[0];
+        }
+        $str = substr($str, strlen($matches[0]));
+    }
+    $result = ob_get_contents();
+    ob_end_clean();
+    return $result;
+}
+
+//--------------------------------------------------------------------
+/**
 * Strip out all non 7bit ASCII bytes and ASCII device control codes.
 * For a list of ASCII device control codes see the 2nd table here:
 * http://www.w3schools.com/tags/ref_ascii.asp
-*
+* 
 * @param string
 * @return boolean TRUE if it's all ASCII
 * @package utf8
@@ -179,6 +141,11 @@
 * through utf8_strip_non_ascii to clean out any other non-ASCII chars
 * Use the optional parameter to just deaccent lower ($case = -1) or upper ($case = 1)
 * letters. Default is to deaccent both cases ($case = 0)
+*
+* For a more complete implementation of transliteration, see the utf8_to_ascii package
+* available from the phputf8 project downloads:
+* http://prdownloads.sourceforge.net/phputf8
+*
 * @param string UTF-8 string
 * @param int (optional) -1 lowercase only, +1 uppercase only, 1 both cases
 * @param string UTF-8 with accented characters replaced by ASCII chars
@@ -188,25 +155,66 @@
 * @subpackage ascii
 */
 function utf8_accents_to_ascii( $str, $case=0 ){
-
-	  if($case <= 0){
-        global $UTF8_LOWER_ACCENTS;
-        $string = str_replace(
+    
+    static $UTF8_LOWER_ACCENTS = NULL;
+    static $UTF8_UPPER_ACCENTS = NULL;
+    
+    if($case <= 0){
+        
+        if ( is_null($UTF8_LOWER_ACCENTS) ) {
+            $UTF8_LOWER_ACCENTS = array(
+  'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o',
+  'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k',
+  'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o',
+  'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', 'ẁ' => 'w', 'ċ' => 'c', 'õ' => 'o',
+  'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c',
+  'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't',
+  'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l',
+  'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z',
+  'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't',
+  'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o',
+  'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j',
+  'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o',
+  'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g',
+  'ṁ' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a',
+  'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e', 
+            );
+        }
+        
+        $str = str_replace(
                 array_keys($UTF8_LOWER_ACCENTS),
                 array_values($UTF8_LOWER_ACCENTS),
                 $str
             );
     }
-
+    
     if($case >= 0){
-        global $UTF8_UPPER_ACCENTS;
-        $string = str_replace(
+        if ( is_null($UTF8_UPPER_ACCENTS) ) {
+            $UTF8_UPPER_ACCENTS = array(
+  'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O',
+  'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K',
+  'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O',
+  'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', 'Ẁ' => 'W', 'Ċ' => 'C', 'Õ' => 'O',
+  'Ṡ' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C',
+  'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', 'Ṫ' => 'T',
+  'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L',
+  'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z',
+  'Ẃ' => 'W', 'Ḃ' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', 'Ḋ' => 'D', 'Ť' => 'T',
+  'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O',
+  'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J',
+  'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O',
+  'Â' => 'A', 'Ľ' => 'L', 'Ẅ' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G',
+  'Ṁ' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A',
+  'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E',
+            );
+        }
+        $str = str_replace(
                 array_keys($UTF8_UPPER_ACCENTS),
                 array_values($UTF8_UPPER_ACCENTS),
                 $str
             );
     }
-
+    
     return $str;
-
-}
\ No hay ningún carácter de nueva línea al final del fichero
+    
+}
diff -aruN --binary 14/libraries/simplepie/simplepie.php 15/libraries/simplepie/simplepie.php
--- 14/libraries/simplepie/simplepie.php	2009-05-29 14:54:36.000000000 +0200
+++ 15/libraries/simplepie/simplepie.php	2009-11-04 18:51:20.000000000 +0100
@@ -5,7 +5,7 @@
  * A PHP-Based RSS and Atom Feed Framework.
  * Takes the hard work out of managing a complete RSS/Atom solution.
  *
- * Copyright (c) 2004-2007, Ryan Parman and Geoffrey Sneddon
+ * Copyright (c) 2004-2009, Ryan Parman and Geoffrey Sneddon
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification, are
@@ -33,8 +33,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *
  * @package SimplePie
- * @version "Razzleberry"
- * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
+ * @version 1.2
+ * @copyright 2004-2009 Ryan Parman, Geoffrey Sneddon
  * @author Ryan Parman
  * @author Geoffrey Sneddon
  * @link http://simplepie.org/ SimplePie
@@ -51,18 +51,17 @@
 /**
  * SimplePie Version
  */
-define('SIMPLEPIE_VERSION', '1.0.1');
+define('SIMPLEPIE_VERSION', '1.2');
 
 /**
  * SimplePie Build
- * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::parse_date() only every load of simplepie.inc)
  */
-define('SIMPLEPIE_BUILD', 20070719221955);
+define('SIMPLEPIE_BUILD', '20090627192103');
 
 /**
  * SimplePie Website URL
  */
-define('SIMPLEPIE_URL', 'http://simplepie.org/');
+define('SIMPLEPIE_URL', 'http://simplepie.org');
 
 /**
  * SimplePie Useragent
@@ -243,9 +242,24 @@
 define('SIMPLEPIE_CONSTRUCT_ALL', 63);
 
 /**
+ * Don't change case
+ */
+define('SIMPLEPIE_SAME_CASE', 1);
+
+/**
+ * Change to lowercase
+ */
+define('SIMPLEPIE_LOWERCASE', 2);
+
+/**
+ * Change to uppercase
+ */
+define('SIMPLEPIE_UPPERCASE', 4);
+
+/**
  * PCRE for HTML attributes
  */
-define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[a-z0-9\-._:]*)))?)*)\s*');
+define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*');
 
 /**
  * PCRE for XML attributes
@@ -288,6 +302,12 @@
 define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/');
 
 /**
+ * RSS 2.0 Namespace
+ * (Stupid, I know, but I'm certain it will confuse people less with support.)
+ */
+define('SIMPLEPIE_NAMESPACE_RSS_20', '');
+
+/**
  * DC 1.0 Namespace
  */
 define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/');
@@ -313,6 +333,11 @@
 define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/');
 
 /**
+ * Wrong Media RSS Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss');
+
+/**
  * iTunes RSS Namespace
  */
 define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
@@ -333,14 +358,39 @@
 define('SIMPLEPIE_PHP5', version_compare(PHP_VERSION, '5.0.0', '>='));
 
 /**
+ * No file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_NONE', 0);
+
+/**
+ * Remote file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1);
+
+/**
+ * Local file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2);
+
+/**
+ * fsockopen() file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4);
+
+/**
+ * cURL file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_CURL', 8);
+
+/**
+ * file_get_contents() file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
+
+/**
  * SimplePie
  *
  * @package SimplePie
- * @version "Razzleberry"
- * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
- * @author Ryan Parman
- * @author Geoffrey Sneddon
- * @todo Option for type of fetching (cache, not modified header, fetch, etc.)
  */
 class SimplePie
 {
@@ -407,6 +457,14 @@
 	var $force_fsockopen = false;
 
 	/**
+	 * @var bool Force the given data/URL to be treated as a feed no matter what
+	 * it appears like
+	 * @see SimplePie::force_feed()
+	 * @access private
+	 */
+	var $force_feed = false;
+
+	/**
 	 * @var bool Enable/Disable XML dump
 	 * @see SimplePie::enable_xml_dump()
 	 * @access private
@@ -562,6 +620,20 @@
 	var $restriction_class = 'SimplePie_Restriction';
 
 	/**
+	 * @var string Class used for content-type sniffing
+	 * @see SimplePie::set_content_type_sniffer_class()
+	 * @access private
+	 */
+	var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
+
+	/**
+	 * @var string Class used for item sources.
+	 * @see SimplePie::set_source_class()
+	 * @access private
+	 */
+	var $source_class = 'SimplePie_Source';
+
+	/**
 	 * @var mixed Set javascript query string parameter (false, or
 	 * anything type-cast to false, disables this feature)
 	 * @see SimplePie::set_javascript()
@@ -577,6 +649,13 @@
 	var $max_checked_feeds = 10;
 
 	/**
+	 * @var array All the feeds found during the autodiscovery process
+	 * @see SimplePie::get_all_discovered_feeds()
+	 * @access private
+	 */
+	var $all_discovered_feeds = array();
+
+	/**
 	 * @var string Web-accessible path to the handler_favicon.php file.
 	 * @see SimplePie::set_favicon_handler()
 	 * @access private
@@ -611,6 +690,13 @@
 	var $config_settings = null;
 
 	/**
+	 * @var integer Stores the number of items to return per-feed with multifeeds.
+	 * @see SimplePie::set_item_limit()
+	 * @access private
+	 */
+	var $item_limit = 0;
+
+	/**
 	 * @var array Stores the default attributes to be stripped by strip_attributes().
 	 * @see SimplePie::strip_attributes()
 	 * @access private
@@ -648,7 +734,7 @@
 	function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null)
 	{
 		// Other objects, instances created here so we can set options on them
-		$this->sanitize =& new SimplePie_Sanitize;
+		$this->sanitize = new SimplePie_Sanitize;
 
 		// Set options if they're passed to the constructor
 		if ($cache_location !== null)
@@ -678,6 +764,45 @@
 	}
 
 	/**
+	 * Remove items that link back to this before destroying this object
+	 */
+	function __destruct()
+	{
+		if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
+		{
+			if (!empty($this->data['items']))
+			{
+				foreach ($this->data['items'] as $item)
+				{
+					$item->__destruct();
+				}
+				unset($item, $this->data['items']);
+			}
+			if (!empty($this->data['ordered_items']))
+			{
+				foreach ($this->data['ordered_items'] as $item)
+				{
+					$item->__destruct();
+				}
+				unset($item, $this->data['ordered_items']);
+			}
+		}
+	}
+
+	/**
+	 * Force the given data/URL to be treated as a feed no matter what it
+	 * appears like
+	 *
+	 * @access public
+	 * @since 1.1
+	 * @param bool $enable Force the given data/URL to be treated as a feed
+	 */
+	function force_feed($enable = false)
+	{
+		$this->force_feed = (bool) $enable;
+	}
+
+	/**
 	 * This is the URL of the feed you want to parse.
 	 *
 	 * This allows you to enter the URL of the feed you want to parse, or the
@@ -718,7 +843,7 @@
 	 */
 	function set_file(&$file)
 	{
-		if (SimplePie_Misc::is_a($file, 'SimplePie_File'))
+		if (is_a($file, 'SimplePie_File'))
 		{
 			$this->feed_url = $file->url;
 			$this->file =& $file;
@@ -741,7 +866,7 @@
 	 */
 	function set_raw_data($data)
 	{
-		$this->raw_data = trim($data);
+		$this->raw_data = $data;
 	}
 
 	/**
@@ -979,7 +1104,7 @@
 	{
 		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize'))
 		{
-			$this->sanitize =& new $class;
+			$this->sanitize = new $class;
 			return true;
 		}
 		return false;
@@ -1157,6 +1282,44 @@
 	}
 
 	/**
+	 * Allows you to change which class SimplePie uses for content-type sniffing.
+	 * Useful when you are overloading or extending SimplePie's default classes.
+	 *
+	 * @access public
+	 * @param string $class Name of custom class.
+	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+	 */
+	function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
+	{
+		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer'))
+		{
+			$this->content_type_sniffer_class = $class;
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Allows you to change which class SimplePie uses item sources.
+	 * Useful when you are overloading or extending SimplePie's default classes.
+	 *
+	 * @access public
+	 * @param string $class Name of custom class.
+	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+	 */
+	function set_source_class($class = 'SimplePie_Source')
+	{
+		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source'))
+		{
+			$this->source_class = $class;
+			return true;
+		}
+		return false;
+	}
+
+	/**
 	 * Allows you to override the default user agent string.
 	 *
 	 * @access public
@@ -1294,7 +1457,7 @@
 	 */
 	function set_favicon_handler($page = false, $qs = 'i')
 	{
-		if ($page != false)
+		if ($page !== false)
 		{
 			$this->favicon_handler = $page . '?' . $qs . '=';
 		}
@@ -1313,7 +1476,7 @@
 	 */
 	function set_image_handler($page = false, $qs = 'i')
 	{
-		if ($page != false)
+		if ($page !== false)
 		{
 			$this->sanitize->set_image_handler($page . '?' . $qs . '=');
 		}
@@ -1323,47 +1486,44 @@
 		}
 	}
 
+	/**
+	 * Set the limit for items returned per-feed with multifeeds.
+	 *
+	 * @access public
+	 * @param integer $limit The maximum number of items to return.
+	 */
+	function set_item_limit($limit = 0)
+	{
+		$this->item_limit = (int) $limit;
+	}
+
 	function init()
 	{
-		if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.1.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre'))
+		// Check absolute bare minimum requirements.
+		if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre'))
 		{
 			return false;
 		}
-		if (isset($_GET[$this->javascript]))
+		// Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader.
+		elseif (!extension_loaded('xmlreader'))
 		{
-			if (function_exists('ob_gzhandler'))
+			static $xml_is_sane = null;
+			if ($xml_is_sane === null)
 			{
-				ob_start('ob_gzhandler');
+				$parser_check = xml_parser_create();
+				xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
+				xml_parser_free($parser_check);
+				$xml_is_sane = isset($values[0]['value']);
 			}
-			header('Content-type: text/javascript; charset: UTF-8');
-			header('Cache-Control: must-revalidate');
-			header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
-			?>
-function embed_odeo(link) {
-	document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
-}
-
-function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
-	if (placeholder != '') {
-		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
-	}
-	else {
-		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
-	}
-}
-
-function embed_flash(bgcolor, width, height, link, loop, type) {
-	document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
-}
-
-function embed_flv(width, height, link, placeholder, loop, player) {
-	document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');
-}
+			if (!$xml_is_sane)
+			{
+				return false;
+			}
+		}
 
-function embed_wmedia(width, height, link) {
-	document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
-}
-			<?php
+		if (isset($_GET[$this->javascript]))
+		{
+			SimplePie_Misc::output_javascript();
 			exit;
 		}
 
@@ -1383,7 +1543,7 @@
 				// Decide whether to enable caching
 				if ($this->cache && $parsed_feed_url['scheme'] !== '')
 				{
-					$cache =& new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
+					$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
 				}
 				// If it's enabled and we don't want an XML dump, use the cache
 				if ($cache && !$this->xml_dump)
@@ -1393,13 +1553,13 @@
 					if (!empty($this->data))
 					{
 						// If the cache is for an outdated build of SimplePie
-						if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD)
+						if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD)
 						{
 							$cache->unlink();
 							$this->data = array();
 						}
 						// If we've hit a collision just rerun it with caching disabled
-						elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url)
+						elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url)
 						{
 							$cache = false;
 							$this->data = array();
@@ -1411,7 +1571,7 @@
 							if ($cache->mtime() + $this->autodiscovery_cache_duration > time())
 							{
 								// Do not need to do feed autodiscovery yet.
-								if ($this->data['feed_url'] == $this->data['url'])
+								if ($this->data['feed_url'] === $this->data['url'])
 								{
 									$cache->unlink();
 									$this->data = array();
@@ -1436,12 +1596,12 @@
 								}
 								if (isset($this->data['headers']['etag']))
 								{
-									$headers['if-none-match'] = $this->data['headers']['etag'];
+									$headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"';
 								}
-								$file =& new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen);
+								$file = new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen);
 								if ($file->success)
 								{
-									if ($file->status_code == 304)
+									if ($file->status_code === 304)
 									{
 										$cache->touch();
 										return true;
@@ -1473,17 +1633,17 @@
 				// If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
 				if (!isset($file))
 				{
-					if (SimplePie_Misc::is_a($this->file, 'SimplePie_File') && $this->file->url == $this->feed_url)
+					if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url)
 					{
 						$file =& $this->file;
 					}
 					else
 					{
-						$file =& new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen);
+						$file = new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen);
 					}
 				}
 				// If the file connection has an error, set SimplePie::error to that and quit
-				if (!$file->success)
+				if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
 				{
 					$this->error = $file->error;
 					if (!empty($this->data))
@@ -1496,148 +1656,150 @@
 					}
 				}
 
-				// Check if the supplied URL is a feed, if it isn't, look for it.
-				$locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds);
-				if (!$locate->is_feed($file))
+				if (!$this->force_feed)
 				{
-					// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
-					unset($file);
-					if ($file = $locate->find($this->autodiscovery))
+					// Check if the supplied URL is a feed, if it isn't, look for it.
+					$locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
+					if (!$locate->is_feed($file))
 					{
-						if ($cache)
+						// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
+						unset($file);
+						if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))
 						{
-							if (!$cache->save(array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD)))
+							if ($cache)
 							{
-								trigger_error("$cache->name is not writeable", E_USER_WARNING);
+								$this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
+								if (!$cache->save($this))
+								{
+									trigger_error("$this->cache_location is not writeable", E_USER_WARNING);
+								}
+								$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
 							}
-							$cache =& new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
+							$this->feed_url = $file->url;
+						}
+						else
+						{
+							$this->error = "A feed could not be found at $this->feed_url";
+							SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+							return false;
 						}
-						$this->feed_url = $file->url;
-					}
-					else
-					{
-						$this->error = "A feed could not be found at $this->feed_url";
-						SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
-						return false;
 					}
+					$locate = null;
 				}
-				$locate = null;
 
 				$headers = $file->headers;
-				$data = trim($file->body);
-				unset($file);
+				$data = $file->body;
+				$sniffer = new $this->content_type_sniffer_class($file);
+				$sniffed = $sniffer->get_type();
 			}
 			else
 			{
 				$data = $this->raw_data;
 			}
 
+			// Set up array of possible encodings
+			$encodings = array();
+
 			// First check to see if input has been overridden.
 			if ($this->input_encoding !== false)
 			{
-				$encoding = $this->input_encoding;
-			}
-			// Second try HTTP headers
-			elseif (isset($headers['content-type']) && preg_match('/;[\x09\x20]*charset=([^;]*)/i', $headers['content-type'], $charset))
-			{
-				$encoding = $charset[1];
-			}
-			// Then prolog, if at the very start of the document
-			elseif (preg_match("/^<\?xml[\x20\x9\xD\xA]+version([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"1.0\"|'1.0'|\"1.1\"|'1.1')[\x20\x9\xD\xA]+encoding([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"[A-Za-z][A-Za-z0-9._\-]*\"|'[A-Za-z][A-Za-z0-9._\-]*')([\x20\x9\xD\xA]+standalone([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"(yes|no)\"|'(yes|no)'))?([\x20\x9\xD\xA]+)?\?>/", $data, $prolog))
-			{
-				$encoding = substr($prolog[6], 1, -1);
-			}
-			// UTF-32 Big Endian BOM
-			elseif (strpos($data, "\x0\x0\xFE\xFF") === 0)
-			{
-				$encoding = 'UTF-32be';
-			}
-			// UTF-32 Little Endian BOM
-			elseif (strpos($data, "\xFF\xFE\x0\x0") === 0)
-			{
-				$encoding = 'UTF-32';
-			}
-			// UTF-16 Big Endian BOM
-			elseif (strpos($data, "\xFE\xFF") === 0)
-			{
-				$encoding = 'UTF-16be';
-			}
-			// UTF-16 Little Endian BOM
-			elseif (strpos($data, "\xFF\xFE") === 0)
-			{
-				$encoding = 'UTF-16le';
-			}
-			// UTF-8 BOM
-			elseif (strpos($data, "\xEF\xBB\xBF") === 0)
-			{
-				$encoding = 'UTF-8';
-			}
-			// Fallback to the default (US-ASCII for text/xml, ISO-8859-1 for text/* MIME types, UTF-8 otherwise)
-			elseif (isset($headers['content-type']) && strtolower(SimplePie_Misc::parse_mime($headers['content-type'])) == 'text/xml')
-			{
-				$encoding = 'US-ASCII';
-			}
-			elseif (isset($headers['content-type']) && SimplePie_Misc::stripos(SimplePie_Misc::parse_mime($headers['content-type']), 'text/') === 0)
-			{
-				$encoding = 'ISO-8859-1';
-			}
-			else
-			{
-				$encoding = 'UTF-8';
+				$encodings[] = $this->input_encoding;
 			}
 
-			// Change the encoding to UTF-8 (as we always use UTF-8 internally)
-			if ($encoding != 'UTF-8')
+			$application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity');
+			$text_types = array('text/xml', 'text/xml-external-parsed-entity');
+
+			// RFC 3023 (only applies to sniffed content)
+			if (isset($sniffed))
 			{
-				$data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8');
+				if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml')
+				{
+					if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
+					{
+						$encodings[] = strtoupper($charset[1]);
+					}
+					$encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
+					$encodings[] = 'UTF-8';
+				}
+				elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
+				{
+					if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
+					{
+						$encodings[] = $charset[1];
+					}
+					$encodings[] = 'US-ASCII';
+				}
+				// Text MIME-type default
+				elseif (substr($sniffed, 0, 5) === 'text/')
+				{
+					$encodings[] = 'US-ASCII';
+				}
 			}
 
-			// Strip illegal characters
-			//$data = SimplePie_Misc::utf8_bad_replace($data);
+			// Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1
+			$encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
+			$encodings[] = 'UTF-8';
+			$encodings[] = 'ISO-8859-1';
 
-			$parser =& new $this->parser_class();
-			$parser->pre_process($data, 'UTF-8');
-			// If we want the XML, just output that and quit
+			// There's no point in trying an encoding twice
+			$encodings = array_unique($encodings);
+
+			// If we want the XML, just output that with the most likely encoding and quit
 			if ($this->xml_dump)
 			{
-				header('Content-type: text/xml; charset=UTF-8');
+				header('Content-type: text/xml; charset=' . $encodings[0]);
 				echo $data;
 				exit;
 			}
-			// If it's parsed fine
-			elseif ($parser->parse($data))
+
+			// Loop through each possible encoding, till we return something, or run out of possibilities
+			foreach ($encodings as $encoding)
 			{
-				unset($data);
-				$this->data = $parser->get_data();
-				if (isset($this->data['child']))
+				// Change the encoding to UTF-8 (as we always use UTF-8 internally)
+				if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8'))
 				{
-					if (isset($headers))
-					{
-						$this->data['headers'] = $headers;
-					}
-					$this->data['build'] = SIMPLEPIE_BUILD;
+					// Create new parser
+					$parser = new $this->parser_class();
 
-					// Cache the file if caching is enabled
-					if ($cache && !$cache->save($this->data))
+					// If it's parsed fine
+					if ($parser->parse($utf8_data, 'UTF-8'))
 					{
-						trigger_error("$cache->name is not writeable", E_USER_WARNING);
+						$this->data = $parser->get_data();
+						if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE)
+						{
+							if (isset($headers))
+							{
+								$this->data['headers'] = $headers;
+							}
+							$this->data['build'] = SIMPLEPIE_BUILD;
+
+							// Cache the file if caching is enabled
+							if ($cache && !$cache->save($this))
+							{
+								trigger_error("$cache->name is not writeable", E_USER_WARNING);
+							}
+							return true;
+						}
+						else
+						{
+							$this->error = "A feed could not be found at $this->feed_url";
+							SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+							return false;
+						}
 					}
-					return true;
-				}
-				else
-				{
-					$this->error = "A feed could not be found at $this->feed_url";
-					SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
-					return false;
 				}
 			}
-			// If we have an error, just set SimplePie::error to it and quit
-			else
+			if(isset($parser))
 			{
+				// We have an error, just set SimplePie_Misc::error to it and quit
 				$this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
-				SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
-				return false;
 			}
+			else
+			{
+				$this->error = 'The data could not be converted to UTF-8';
+			}
+			SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+			return false;
 		}
 		elseif (!empty($this->multifeed_url))
 		{
@@ -1730,18 +1892,18 @@
 					$this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
 				}
 			}
-			elseif (isset($this->data['child']['']['rss']))
+			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
 			{
 				$this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
-				if (isset($this->data['child']['']['rss'][0]['attribs']['']['version']))
+				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
 				{
-					switch (trim($this->data['child']['']['rss'][0]['attribs']['']['version']))
+					switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
 					{
 						case '0.91':
 							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
-							if (isset($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
+							if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
 							{
-								switch (trim($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
+								switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
 								{
 									case '0':
 										$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
@@ -1783,6 +1945,7 @@
 	/**
 	 * Returns the URL for the favicon of the feed's website.
 	 *
+	 * @todo Cache atom:icon
 	 * @access public
 	 * @since 1.0
 	 */
@@ -1798,26 +1961,36 @@
 
 			if ($this->cache && $this->favicon_handler)
 			{
-				$cache =& new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $favicon), 'spi');
+				$favicon_filename = call_user_func($this->cache_name_function, $favicon);
+				$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $favicon_filename, 'spi');
 
 				if ($cache->load())
 				{
-					return $this->sanitize($this->favicon_handler . rawurlencode($favicon), SIMPLEPIE_CONSTRUCT_IRI);
+					return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
 				}
 				else
 				{
-					$file =& new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
+					$file = new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
 
-					if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
+					if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
 					{
-						if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+						$sniffer = new $this->content_type_sniffer_class($file);
+						if (substr($sniffer->get_type(), 0, 6) === 'image/')
 						{
-							return $this->sanitize($this->favicon_handler . rawurlencode($favicon), SIMPLEPIE_CONSTRUCT_IRI);
+							if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+							{
+								return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
+							}
+							else
+							{
+								trigger_error("$cache->name is not writeable", E_USER_WARNING);
+								return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
+							}
 						}
+						// not an image
 						else
 						{
-							trigger_error("$cache->name is not writeable", E_USER_WARNING);
-							return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
+							return false;
 						}
 					}
 				}
@@ -1863,7 +2036,7 @@
 	{
 		if ($this->feed_url !== null)
 		{
-			return 'outlook' . $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
+			return $this->sanitize('outlook' . SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
 		}
 		else
 		{
@@ -1908,12 +2081,12 @@
 	{
 		if ($this->subscribe_url())
 		{
-			$return = $this->sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->subscribe_url());
+			$return = $feed_url . rawurlencode($this->feed_url);
 			if ($site_url !== null && $this->get_link() !== null)
 			{
-				$return .= $this->sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_link());
+				$return .= $site_url . rawurlencode($this->get_link());
 			}
-			return $return;
+			return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI);
 		}
 		else
 		{
@@ -1928,7 +2101,7 @@
 
 	function subscribe_bloglines()
 	{
-		return urldecode($this->subscribe_service('http://www.bloglines.com/sub/'));
+		return $this->subscribe_service('http://www.bloglines.com/sub/');
 	}
 
 	function subscribe_eskobo()
@@ -2022,9 +2195,9 @@
 		}
 		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
 		{
-			if (isset($this->data['child']['']['rss'][0]['child'][$namespace][$tag]))
+			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]))
 			{
-				return $this->data['child']['']['rss'][0]['child'][$namespace][$tag];
+				return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag];
 			}
 		}
 		return null;
@@ -2062,7 +2235,7 @@
 		}
 		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
 		{
-			if ($channel = $this->get_feed_tags('', 'channel'))
+			if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel'))
 			{
 				if (isset($channel[0]['child'][$namespace][$tag]))
 				{
@@ -2098,7 +2271,7 @@
 		}
 		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
 		{
-			if ($image = $this->get_channel_tags('', 'image'))
+			if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image'))
 			{
 				if (isset($image[0]['child'][$namespace][$tag]))
 				{
@@ -2119,10 +2292,6 @@
 		{
 			return $this->get_link();
 		}
-		elseif (isset($this->data['headers']['content-location']))
-		{
-			return SimplePie_Misc::absolutize_url($this->data['headers']['content-location'], $this->subscribe_url());
-		}
 		else
 		{
 			return $this->subscribe_url();
@@ -2152,7 +2321,7 @@
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_channel_tags('', 'title'))
+		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
@@ -2170,12 +2339,12 @@
 		}
 	}
 
-	function get_link($key = 0, $rel = 'alternate')
+	function get_category($key = 0)
 	{
-		$links = $this->get_links($rel);
-		if (isset($links[$key]))
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
 		{
-			return $links[$key];
+			return $categories[$key];
 		}
 		else
 		{
@@ -2183,28 +2352,252 @@
 		}
 	}
 
-	/**
-	 * Added for parity between the parent-level and the item/entry-level.
-	 */
-	function get_permalink()
+	function get_categories()
 	{
-		return $this->get_link(0);
-	}
+		$categories = array();
 
-	function get_links($rel = 'alternate')
-	{
-		if (!isset($this->data['links']))
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
 		{
-			$this->data['links'] = array();
-			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
+			$term = null;
+			$scheme = null;
+			$label = null;
+			if (isset($category['attribs']['']['term']))
 			{
-				foreach ($links as $link)
-				{
-					if (isset($link['attribs']['']['href']))
-					{
-						$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
-						$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
-					}
+				$term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($category['attribs']['']['scheme']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($category['attribs']['']['label']))
+			{
+				$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			$categories[] = new $this->category_class($term, $scheme, $label);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
+		{
+			// This is really the label, but keep this as the term also for BC.
+			// Label will also work on retrieving because that falls back to term.
+			$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			if (isset($category['attribs']['']['domain']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			else
+			{
+				$scheme = null;
+			}
+			$categories[] = new $this->category_class($term, $scheme, null);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
+		{
+			$categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
+		{
+			$categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+
+		if (!empty($categories))
+		{
+			return SimplePie_Misc::array_unique($categories);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_author($key = 0)
+	{
+		$authors = $this->get_authors();
+		if (isset($authors[$key]))
+		{
+			return $authors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_authors()
+	{
+		$authors = array();
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
+		{
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$authors[] = new $this->author_class($name, $uri, $email);
+			}
+		}
+		if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
+		{
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+			{
+				$name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+			{
+				$url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$authors[] = new $this->author_class($name, $url, $email);
+			}
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+		{
+			$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+		{
+			$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+		{
+			$authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+		}
+
+		if (!empty($authors))
+		{
+			return SimplePie_Misc::array_unique($authors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_contributor($key = 0)
+	{
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
+		{
+			return $contributors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_contributors()
+	{
+		$contributors = array();
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
+		{
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$contributors[] = new $this->author_class($name, $uri, $email);
+			}
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
+		{
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+			{
+				$url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$contributors[] = new $this->author_class($name, $url, $email);
+			}
+		}
+
+		if (!empty($contributors))
+		{
+			return SimplePie_Misc::array_unique($contributors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_link($key = 0, $rel = 'alternate')
+	{
+		$links = $this->get_links($rel);
+		if (isset($links[$key]))
+		{
+			return $links[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Added for parity between the parent-level and the item/entry-level.
+	 */
+	function get_permalink()
+	{
+		return $this->get_link(0);
+	}
+
+	function get_links($rel = 'alternate')
+	{
+		if (!isset($this->data['links']))
+		{
+			$this->data['links'] = array();
+			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
+			{
+				foreach ($links as $link)
+				{
+					if (isset($link['attribs']['']['href']))
+					{
+						$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+						$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+					}
 				}
 			}
 			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
@@ -2227,7 +2620,7 @@
 			{
 				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 			}
-			if ($links = $this->get_channel_tags('', 'link'))
+			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
 			{
 				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 			}
@@ -2247,7 +2640,7 @@
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
 					}
 				}
-				elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
 				{
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
 				}
@@ -2265,6 +2658,11 @@
 		}
 	}
 
+	function get_all_discovered_feeds()
+	{
+		return $this->all_discovered_feeds;
+	}
+
 	function get_description()
 	{
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
@@ -2283,9 +2681,9 @@
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_channel_tags('', 'description'))
+		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 		}
 		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
 		{
@@ -2315,7 +2713,11 @@
 		{
 			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_channel_tags('', 'copyright'))
+		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
+		{
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+		}
+		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
@@ -2335,7 +2737,7 @@
 
 	function get_language()
 	{
-		if ($return = $this->get_channel_tags('', 'language'))
+		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
@@ -2415,7 +2817,7 @@
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-		elseif ($return = $this->get_image_tags('', 'title'))
+		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
@@ -2455,7 +2857,7 @@
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_image_tags('', 'url'))
+		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
@@ -2475,7 +2877,7 @@
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_image_tags('', 'link'))
+		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
@@ -2487,11 +2889,11 @@
 
 	function get_image_width()
 	{
-		if ($return = $this->get_image_tags('', 'width'))
+		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width'))
 		{
 			return round($return[0]['data']);
 		}
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
+		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
 		{
 			return 88.0;
 		}
@@ -2503,11 +2905,11 @@
 
 	function get_image_height()
 	{
-		if ($return = $this->get_image_tags('', 'height'))
+		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height'))
 		{
 			return round($return[0]['data']);
 		}
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
+		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
 		{
 			return 31.0;
 		}
@@ -2519,8 +2921,9 @@
 
 	function get_item_quantity($max = 0)
 	{
+		$max = (int) $max;
 		$qty = count($this->get_items());
-		if ($max == 0)
+		if ($max === 0)
 		{
 			return $qty;
 		}
@@ -2545,50 +2948,54 @@
 
 	function get_items($start = 0, $end = 0)
 	{
-		if (!empty($this->multifeed_objects))
-		{
-			return SimplePie::merge_items($this->multifeed_objects, $start, $end);
-		}
-		elseif (!isset($this->data['items']))
+		if (!isset($this->data['items']))
 		{
-			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
+			if (!empty($this->multifeed_objects))
 			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
-				{
-					$this->data['items'][] =& new $this->item_class($this, $items[$key]);
-				}
+				$this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
 			}
-			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
+			else
 			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
+				$this->data['items'] = array();
+				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
 				{
-					$this->data['items'][] =& new $this->item_class($this, $items[$key]);
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
 				}
-			}
-			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
-			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
+				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
 				{
-					$this->data['items'][] =& new $this->item_class($this, $items[$key]);
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
 				}
-			}
-			if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
-			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
+				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
+				{
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
+				}
+				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
 				{
-					$this->data['items'][] =& new $this->item_class($this, $items[$key]);
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
 				}
-			}
-			if ($items = $this->get_channel_tags('', 'item'))
-			{
-				$keys = array_keys($items);
-				foreach ($keys as $key)
+				if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item'))
 				{
-					$this->data['items'][] =& new $this->item_class($this, $items[$key]);
+					$keys = array_keys($items);
+					foreach ($keys as $key)
+					{
+						$this->data['items'][] = new $this->item_class($this, $items[$key]);
+					}
 				}
 			}
 		}
@@ -2596,7 +3003,7 @@
 		if (!empty($this->data['items']))
 		{
 			// If we want to order it by date, check if all items have a date, and then sort it
-			if ($this->order_by_date)
+			if ($this->order_by_date && empty($this->multifeed_objects))
 			{
 				if (!isset($this->data['ordered_items']))
 				{
@@ -2624,7 +3031,7 @@
 			}
 
 			// Slice the data as desired
-			if ($end == 0)
+			if ($end === 0)
 			{
 				return array_slice($items, $start);
 			}
@@ -2639,21 +3046,27 @@
 		}
 	}
 
+	/**
+	 * @static
+	 */
 	function sort_items($a, $b)
 	{
 		return $a->get_date('U') <= $b->get_date('U');
 	}
 
-	function merge_items($urls, $start = 0, $end = 0)
+	/**
+	 * @static
+	 */
+	function merge_items($urls, $start = 0, $end = 0, $limit = 0)
 	{
 		if (is_array($urls) && sizeof($urls) > 0)
 		{
 			$items = array();
 			foreach ($urls as $arg)
 			{
-				if (SimplePie_Misc::is_a($arg, 'SimplePie'))
+				if (is_a($arg, 'SimplePie'))
 				{
-					$items = array_merge($items, $arg->get_items());
+					$items = array_merge($items, $arg->get_items(0, $limit));
 				}
 				else
 				{
@@ -2676,7 +3089,7 @@
 				usort($items, array('SimplePie', 'sort_items'));
 			}
 
-			if ($end == 0)
+			if ($end === 0)
 			{
 				return array_slice($items, $start);
 			}
@@ -2709,6 +3122,17 @@
 		return md5(serialize($this->data));
 	}
 
+	/**
+	 * Remove items that link back to this before destroying this object
+	 */
+	function __destruct()
+	{
+		if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
+		{
+			unset($this->feed);
+		}
+	}
+
 	function get_item_tags($namespace, $tag)
 	{
 		if (isset($this->data['child'][$namespace][$tag]))
@@ -2738,78 +3162,85 @@
 
 	function get_id($hash = false)
 	{
-		if ($hash)
-		{
-			return $this->__toString();
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
+		if (!$hash)
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
+			{
+				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif (($return = $this->get_permalink()) !== null)
+			{
+				return $return;
+			}
+			elseif (($return = $this->get_title()) !== null)
+			{
+				return $return;
+			}
 		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
+		if ($this->get_permalink() !== null || $this->get_title() !== null)
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			return md5($this->get_permalink() . $this->get_title());
 		}
-		elseif ($return = $this->get_item_tags('', 'guid'))
+		else
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			return md5(serialize($this->data));
 		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
+	}
+
+	function get_title()
+	{
+		if (!isset($this->data['title']))
 		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		elseif (($return = $this->get_permalink()) !== null)
-		{
-			return $return;
-		}
-		elseif (($return = $this->get_title()) !== null)
-		{
-			return $return;
-		}
-		else
-		{
-			return $this->__toString();
-		}
-	}
-
-	function get_title()
-	{
-		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags('', 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
-		{
-			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
-		}
-		else
-		{
-			return null;
+			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
+			{
+				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			else
+			{
+				$this->data['title'] = null;
+			}
 		}
+		return $this->data['title'];
 	}
 
 	function get_description($description_only = false)
@@ -2826,7 +3257,7 @@
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		elseif ($return = $this->get_item_tags('', 'description'))
+		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
 		{
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 		}
@@ -2914,19 +3345,30 @@
 			{
 				$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
 			}
-			$categories[] =& new $this->feed->category_class($term, $scheme, $label);
+			$categories[] = new $this->feed->category_class($term, $scheme, $label);
 		}
-		foreach ((array) $this->get_item_tags('', 'category') as $category)
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
 		{
-			$categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+			// This is really the label, but keep this as the term also for BC.
+			// Label will also work on retrieving because that falls back to term.
+			$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			if (isset($category['attribs']['']['domain']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			else
+			{
+				$scheme = null;
+			}
+			$categories[] = new $this->feed->category_class($term, $scheme, null);
 		}
 		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
 		{
-			$categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+			$categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
 		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
 		{
-			$categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+			$categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
 
 		if (!empty($categories))
@@ -2952,9 +3394,77 @@
 		}
 	}
 
-	/**
-	 * @todo Atom inheritance (item author, source author, feed author)
-	 */
+	function get_contributor($key = 0)
+	{
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
+		{
+			return $contributors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_contributors()
+	{
+		$contributors = array();
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
+		{
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$contributors[] = new $this->feed->author_class($name, $uri, $email);
+			}
+		}
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
+		{
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+			{
+				$url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$contributors[] = new $this->feed->author_class($name, $url, $email);
+			}
+		}
+
+		if (!empty($contributors))
+		{
+			return SimplePie_Misc::array_unique($contributors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
 	function get_authors()
 	{
 		$authors = array();
@@ -2977,7 +3487,7 @@
 			}
 			if ($name !== null || $email !== null || $uri !== null)
 			{
-				$authors[] =& new $this->feed->author_class($name, $uri, $email);
+				$authors[] = new $this->feed->author_class($name, $uri, $email);
 			}
 		}
 		if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
@@ -2991,38 +3501,66 @@
 			}
 			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
 			{
-				$uri = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+				$url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
 			}
 			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
 			{
 				$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 			}
-			if ($name !== null || $email !== null || $uri !== null)
+			if ($name !== null || $email !== null || $url !== null)
 			{
-				$authors[] =& new $this->feed->author_class($name, $url, $email);
+				$authors[] = new $this->feed->author_class($name, $url, $email);
 			}
 		}
-		if ($author = $this->get_item_tags('', 'author'))
+		if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
 		{
-			$authors[] =& new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+			$authors[] = new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
 		}
 		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
 		{
-			$authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+			$authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
 		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
 		{
-			$authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+			$authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
 		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
 		{
-			$authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+			$authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
 
 		if (!empty($authors))
 		{
 			return SimplePie_Misc::array_unique($authors);
 		}
+		elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
+		{
+			return $authors;
+		}
+		elseif ($authors = $this->feed->get_authors())
+		{
+			return $authors;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_copyright()
+	{
+		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+		}
+		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
+		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
 		else
 		{
 			return null;
@@ -3053,7 +3591,7 @@
 			{
 				$this->data['date']['raw'] = $return[0]['data'];
 			}
-			elseif ($return = $this->get_item_tags('', 'pubDate'))
+			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
 			{
 				$this->data['date']['raw'] = $return[0]['data'];
 			}
@@ -3068,7 +3606,8 @@
 
 			if (!empty($this->data['date']['raw']))
 			{
-				$this->data['date']['parsed'] = SimplePie_Misc::parse_date($this->data['date']['raw']);
+				$parser = SimplePie_Parse_Date::get();
+				$this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
 			}
 			else
 			{
@@ -3173,13 +3712,13 @@
 			{
 				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 			}
-			if ($links = $this->get_item_tags('', 'link'))
+			if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
 			{
 				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 			}
-			if ($links = $this->get_item_tags('', 'guid'))
+			if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
 			{
-				if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) == 'true')
+				if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true')
 				{
 					$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 				}
@@ -3200,7 +3739,7 @@
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
 					}
 				}
-				elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
 				{
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
 				}
@@ -3241,7 +3780,6 @@
 	 * At this point, we're pretty much assuming that all enclosures for an item are the same content.  Anything else is too complicated to properly support.
 	 *
 	 * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
-	 * @todo Add support for itunes: tags.  These should be relatively simple compared to media:.
 	 * @todo If an element exists at a level, but it's value is empty, we should fall back to the value from the parent (if it exists).
 	 */
 	function get_enclosures()
@@ -3298,7 +3836,7 @@
 					{
 						$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+					$captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 				}
 			}
 			elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
@@ -3330,7 +3868,7 @@
 					{
 						$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+					$captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 				}
 			}
 			if (is_array($captions_parent))
@@ -3360,7 +3898,7 @@
 				{
 					$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
 				}
-				$categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
+				$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
 			}
 			foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
 			{
@@ -3383,7 +3921,7 @@
 				{
 					$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
 				}
-				$categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
+				$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
 			}
 			foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category)
 			{
@@ -3394,7 +3932,7 @@
 				{
 					$label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
 				}
-				$categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
+				$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
 
 				if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category']))
 				{
@@ -3404,7 +3942,7 @@
 						{
 							$label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
 						}
-						$categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
+						$categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
 					}
 				}
 			}
@@ -3426,7 +3964,7 @@
 				{
 					$copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 				}
-				$copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+				$copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label);
 			}
 			elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
 			{
@@ -3440,7 +3978,7 @@
 				{
 					$copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 				}
-				$copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+				$copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label);
 			}
 
 			// CREDITS
@@ -3467,7 +4005,7 @@
 					{
 						$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+					$credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 				}
 			}
 			elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
@@ -3493,7 +4031,7 @@
 					{
 						$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+					$credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 				}
 			}
 			if (is_array($credits_parent))
@@ -3682,7 +4220,7 @@
 					{
 						$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+					$ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 				}
 			}
 			elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
@@ -3695,7 +4233,7 @@
 					{
 						$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+					$ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 				}
 			}
 			elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
@@ -3716,7 +4254,7 @@
 					{
 						$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+					$ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 				}
 			}
 			elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
@@ -3729,7 +4267,7 @@
 					{
 						$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+					$ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 				}
 			}
 			if (is_array($ratings_parent))
@@ -3757,7 +4295,7 @@
 					{
 						$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+					$restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 				}
 			}
 			elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
@@ -3767,11 +4305,11 @@
 					$restriction_relationship = 'allow';
 					$restriction_type = null;
 					$restriction_value = 'itunes';
-					if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
+					if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes')
 					{
 						$restriction_relationship = 'deny';
 					}
-					$restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+					$restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 				}
 			}
 			elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
@@ -3793,7 +4331,7 @@
 					{
 						$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 					}
-					$restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+					$restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 				}
 			}
 			elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
@@ -3803,11 +4341,11 @@
 					$restriction_relationship = 'allow';
 					$restriction_type = null;
 					$restriction_value = 'itunes';
-					if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
+					if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes')
 					{
 						$restriction_relationship = 'deny';
 					}
-					$restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+					$restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 				}
 			}
 			if (is_array($restrictions_parent))
@@ -3856,6 +4394,36 @@
 			// Clear the memory
 			unset($parent);
 
+			// Attributes
+			$bitrate = null;
+			$channels = null;
+			$duration = null;
+			$expression = null;
+			$framerate = null;
+			$height = null;
+			$javascript = null;
+			$lang = null;
+			$length = null;
+			$medium = null;
+			$samplingrate = null;
+			$type = null;
+			$url = null;
+			$width = null;
+
+			// Elements
+			$captions = null;
+			$categories = null;
+			$copyrights = null;
+			$credits = null;
+			$description = null;
+			$hashes = null;
+			$keywords = null;
+			$player = null;
+			$ratings = null;
+			$restrictions = null;
+			$thumbnails = null;
+			$title = null;
+
 			// If we have media:group tags, loop through them.
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group)
 			{
@@ -3981,7 +4549,7 @@
 								{
 									$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+								$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 							}
 							if (is_array($captions))
 							{
@@ -4017,7 +4585,7 @@
 								{
 									$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+								$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 							}
 							if (is_array($captions))
 							{
@@ -4053,7 +4621,7 @@
 								{
 									$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$categories[] =& new $this->feed->category_class($term, $scheme, $label);
+								$categories[] = new $this->feed->category_class($term, $scheme, $label);
 							}
 						}
 						if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
@@ -4079,7 +4647,7 @@
 								{
 									$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$categories[] =& new $this->feed->category_class($term, $scheme, $label);
+								$categories[] = new $this->feed->category_class($term, $scheme, $label);
 							}
 						}
 						if (is_array($categories) && is_array($categories_parent))
@@ -4108,7 +4676,7 @@
 							{
 								$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 							}
-							$copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+							$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
 						}
 						elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
 						{
@@ -4122,7 +4690,7 @@
 							{
 								$copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 							}
-							$copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+							$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
 						}
 						else
 						{
@@ -4153,7 +4721,7 @@
 								{
 									$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+								$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 							}
 							if (is_array($credits))
 							{
@@ -4183,7 +4751,7 @@
 								{
 									$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+								$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 							}
 							if (is_array($credits))
 							{
@@ -4336,7 +4904,7 @@
 								{
 									$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+								$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 							}
 							if (is_array($ratings))
 							{
@@ -4361,7 +4929,7 @@
 								{
 									$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+								$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 							}
 							if (is_array($ratings))
 							{
@@ -4393,7 +4961,7 @@
 								{
 									$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+								$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 							}
 							if (is_array($restrictions))
 							{
@@ -4419,7 +4987,7 @@
 								{
 									$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+								$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 							}
 							if (is_array($restrictions))
 							{
@@ -4473,7 +5041,7 @@
 							$title = $title_parent;
 						}
 
-						$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
+						$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
 					}
 				}
 			}
@@ -4602,7 +5170,7 @@
 								{
 									$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+								$captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
 							}
 							if (is_array($captions))
 							{
@@ -4638,7 +5206,7 @@
 								{
 									$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$categories[] =& new $this->feed->category_class($term, $scheme, $label);
+								$categories[] = new $this->feed->category_class($term, $scheme, $label);
 							}
 						}
 						if (is_array($categories) && is_array($categories_parent))
@@ -4671,7 +5239,7 @@
 							{
 								$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 							}
-							$copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+							$copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
 						}
 						else
 						{
@@ -4702,7 +5270,7 @@
 								{
 									$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+								$credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
 							}
 							if (is_array($credits))
 							{
@@ -4806,7 +5374,7 @@
 								{
 									$rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+								$ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
 							}
 							if (is_array($ratings))
 							{
@@ -4838,7 +5406,7 @@
 								{
 									$restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 								}
-								$restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+								$restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
 							}
 							if (is_array($restrictions))
 							{
@@ -4877,14 +5445,14 @@
 							$title = $title_parent;
 						}
 
-						$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
+						$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
 					}
 				}
 			}
 
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
 			{
-				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
+				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
 				{
 					// Attributes
 					$bitrate = null;
@@ -4913,13 +5481,13 @@
 					}
 
 					// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
-					$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+					$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
 				}
 			}
 
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
 			{
-				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
+				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
 				{
 					// Attributes
 					$bitrate = null;
@@ -4948,11 +5516,11 @@
 					}
 
 					// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
-					$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+					$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
 				}
 			}
 
-			if ($enclosure = $this->get_item_tags('', 'enclosure'))
+			if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure'))
 			{
 				if (isset($enclosure[0]['attribs']['']['url']))
 				{
@@ -4983,9 +5551,16 @@
 					}
 
 					// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
-					$this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+					$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
 				}
 			}
+
+			if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width))
+			{
+				// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
+				$this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+			}
+
 			$this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures']));
 		}
 		if (!empty($this->data['enclosures']))
@@ -5034,6 +5609,18 @@
 		}
 	}
 
+	function get_source()
+	{
+		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
+		{
+			return new $this->feed->source_class($this, $return[0]);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
 	/**
 	 * Creates the add_to_* methods' return data
 	 *
@@ -5043,16 +5630,20 @@
 	 * (and suffix to the item permalink)
 	 * @return mixed URL if feed exists, false otherwise
 	 */
-	function add_to_service($item_url, $title_url = null)
+	function add_to_service($item_url, $title_url = null, $summary_url = null)
 	{
 		if ($this->get_permalink() !== null)
 		{
-			$return = $this->sanitize($item_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_permalink());
+			$return = $item_url . rawurlencode($this->get_permalink());
 			if ($title_url !== null && $this->get_title() !== null)
 			{
-				$return .= $this->sanitize($title_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_title());
+				$return .= $title_url . rawurlencode($this->get_title());
 			}
-			return $return;
+			if ($summary_url !== null && $this->get_description() !== null)
+			{
+				$return .= $summary_url . rawurlencode($this->get_description());
+			}
+			return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI);
 		}
 		else
 		{
@@ -5072,12 +5663,12 @@
 
 	function add_to_delicious()
 	{
-		return $this->add_to_service('http://del.icio.us/post/?v=3&url=', '&title=');
+		return $this->add_to_service('http://del.icio.us/post/?v=4&url=', '&title=');
 	}
 
 	function add_to_digg()
 	{
-		return $this->add_to_service('http://digg.com/submit?phase=2&URL=');
+		return $this->add_to_service('http://digg.com/submit?url=', '&title=', '&bodytext=');
 	}
 
 	function add_to_furl()
@@ -5131,43 +5722,27 @@
 	}
 }
 
-class SimplePie_Author
+class SimplePie_Source
 {
-	var $name;
-	var $link;
-	var $email;
+	var $item;
+	var $data = array();
 
-	// Constructor, used to input the data
-	function SimplePie_Author($name = null, $link = null, $email = null)
+	function SimplePie_Source($item, $data)
 	{
-		$this->name = $name;
-		$this->link = $link;
-		$this->email = $email;
+		$this->item = $item;
+		$this->data = $data;
 	}
 
 	function __toString()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
-	}
-
-	function get_name()
-	{
-		if ($this->name !== null)
-		{
-			return $this->name;
-		}
-		else
-		{
-			return null;
-		}
+		return md5(serialize($this->data));
 	}
 
-	function get_link()
+	function get_source_tags($namespace, $tag)
 	{
-		if ($this->link !== null)
+		if (isset($this->data['child'][$namespace][$tag]))
 		{
-			return $this->link;
+			return $this->data['child'][$namespace][$tag];
 		}
 		else
 		{
@@ -5175,56 +5750,50 @@
 		}
 	}
 
-	function get_email()
+	function get_base($element = array())
 	{
-		if ($this->email !== null)
-		{
-			return $this->email;
-		}
-		else
-		{
-			return null;
-		}
+		return $this->item->get_base($element);
 	}
-}
-
-class SimplePie_Category
-{
-	var $term;
-	var $scheme;
-	var $label;
 
-	// Constructor, used to input the data
-	function SimplePie_Category($term = null, $scheme = null, $label = null)
+	function sanitize($data, $type, $base = '')
 	{
-		$this->term = $term;
-		$this->scheme = $scheme;
-		$this->label = $label;
+		return $this->item->sanitize($data, $type, $base);
 	}
 
-	function __toString()
+	function get_item()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
+		return $this->item;
 	}
 
-	function get_term()
+	function get_title()
 	{
-		if ($this->term !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
 		{
-			return $this->term;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-	}
-
-	function get_scheme()
-	{
-		if ($this->scheme !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
 		{
-			return $this->scheme;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
 		else
 		{
@@ -5232,123 +5801,69 @@
 		}
 	}
 
-	function get_label()
+	function get_category($key = 0)
 	{
-		if ($this->label !== null)
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
 		{
-			return $this->label;
+			return $categories[$key];
 		}
 		else
 		{
-			return $this->get_term();
+			return null;
 		}
 	}
-}
 
-class SimplePie_Enclosure
-{
-	var $bitrate;
-	var $captions;
-	var $categories;
-	var $channels;
-	var $copyright;
-	var $credits;
-	var $description;
-	var $duration;
-	var $expression;
-	var $framerate;
-	var $handler;
-	var $hashes;
-	var $height;
-	var $javascript;
-	var $keywords;
-	var $lang;
-	var $length;
-	var $link;
-	var $medium;
-	var $player;
-	var $ratings;
-	var $restrictions;
-	var $samplingrate;
-	var $thumbnails;
-	var $title;
-	var $type;
-	var $width;
-
-	// Constructor, used to input the data
-	function SimplePie_Enclosure($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
-	{
-		$this->bitrate = $bitrate;
-		$this->captions = $captions;
-		$this->categories = $categories;
-		$this->channels = $channels;
-		$this->copyright = $copyright;
-		$this->credits = $credits;
-		$this->description = $description;
-		$this->duration = $duration;
-		$this->expression = $expression;
-		$this->framerate = $framerate;
-		$this->hashes = $hashes;
-		$this->height = $height;
-		$this->javascript = $javascript;
-		$this->keywords = $keywords;
-		$this->lang = $lang;
-		$this->length = $length;
-		$this->link = $link;
-		$this->medium = $medium;
-		$this->player = $player;
-		$this->ratings = $ratings;
-		$this->restrictions = $restrictions;
-		$this->samplingrate = $samplingrate;
-		$this->thumbnails = $thumbnails;
-		$this->title = $title;
-		$this->type = $type;
-		$this->width = $width;
-		if (class_exists('idna_convert'))
-		{
-			$idn =& new idna_convert;
-			$parsed = SimplePie_Misc::parse_url($link);
-			$this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
-		}
-		$this->handler = $this->get_handler(); // Needs to load last
-	}
-
-	function __toString()
+	function get_categories()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
-	}
+		$categories = array();
 
-	function get_bitrate()
-	{
-		if ($this->bitrate !== null)
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
 		{
-			return $this->bitrate;
+			$term = null;
+			$scheme = null;
+			$label = null;
+			if (isset($category['attribs']['']['term']))
+			{
+				$term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($category['attribs']['']['scheme']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($category['attribs']['']['label']))
+			{
+				$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			$categories[] = new $this->item->feed->category_class($term, $scheme, $label);
 		}
-		else
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
 		{
-			return null;
+			// This is really the label, but keep this as the term also for BC.
+			// Label will also work on retrieving because that falls back to term.
+			$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			if (isset($category['attribs']['']['domain']))
+			{
+				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			else
+			{
+				$scheme = null;
+			}
+			$categories[] = new $this->item->feed->category_class($term, $scheme, null);
 		}
-	}
-
-	function get_caption($key = 0)
-	{
-		$captions = $this->get_captions();
-		if (isset($captions[$key]))
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
 		{
-			return $captions[$key];
+			$categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
-		else
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
 		{
-			return null;
+			$categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
-	}
 
-	function get_captions()
-	{
-		if ($this->captions !== null)
+		if (!empty($categories))
 		{
-			return $this->captions;
+			return SimplePie_Misc::array_unique($categories);
 		}
 		else
 		{
@@ -5356,12 +5871,12 @@
 		}
 	}
 
-	function get_category($key = 0)
+	function get_author($key = 0)
 	{
-		$categories = $this->get_categories();
-		if (isset($categories[$key]))
+		$authors = $this->get_authors();
+		if (isset($authors[$key]))
 		{
-			return $categories[$key];
+			return $authors[$key];
 		}
 		else
 		{
@@ -5369,48 +5884,69 @@
 		}
 	}
 
-	function get_categories()
+	function get_authors()
 	{
-		if ($this->categories !== null)
-		{
-			return $this->categories;
-		}
-		else
+		$authors = array();
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
 		{
-			return null;
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$authors[] = new $this->item->feed->author_class($name, $uri, $email);
+			}
 		}
-	}
-
-	function get_channels()
-	{
-		if ($this->channels !== null)
+		if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
 		{
-			return $this->channels;
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+			{
+				$name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+			{
+				$url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$authors[] = new $this->item->feed->author_class($name, $url, $email);
+			}
 		}
-		else
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
 		{
-			return null;
+			$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
-	}
-
-	function get_copyright()
-	{
-		if ($this->copyright !== null)
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
 		{
-			return $this->copyright;
+			$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
-		else
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
 		{
-			return null;
+			$authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
 		}
-	}
 
-	function get_credit($key = 0)
-	{
-		$credits = $this->get_credits();
-		if (isset($credits[$key]))
+		if (!empty($authors))
 		{
-			return $credits[$key];
+			return SimplePie_Misc::array_unique($authors);
 		}
 		else
 		{
@@ -5418,11 +5954,12 @@
 		}
 	}
 
-	function get_credits()
+	function get_contributor($key = 0)
 	{
-		if ($this->credits !== null)
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
 		{
-			return $this->credits;
+			return $contributors[$key];
 		}
 		else
 		{
@@ -5430,86 +5967,152 @@
 		}
 	}
 
-	function get_description()
+	function get_contributors()
 	{
-		if ($this->description !== null)
-		{
-			return $this->description;
-		}
-		else
+		$contributors = array();
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
 		{
-			return null;
+			$name = null;
+			$uri = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+			{
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+			{
+				$uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $uri !== null)
+			{
+				$contributors[] = new $this->item->feed->author_class($name, $uri, $email);
+			}
 		}
-	}
-
-	function get_duration($convert = false)
-	{
-		if ($this->duration !== null)
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
 		{
-			if ($convert)
+			$name = null;
+			$url = null;
+			$email = null;
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
 			{
-				$time = SimplePie_Misc::time_hms($this->duration);
-				return $time;
+				$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 			}
-			else
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
 			{
-				return $this->duration;
+				$url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+			}
+			if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+			{
+				$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+			}
+			if ($name !== null || $email !== null || $url !== null)
+			{
+				$contributors[] = new $this->item->feed->author_class($name, $url, $email);
 			}
 		}
+
+		if (!empty($contributors))
+		{
+			return SimplePie_Misc::array_unique($contributors);
+		}
 		else
 		{
 			return null;
 		}
 	}
 
-	function get_expression()
+	function get_link($key = 0, $rel = 'alternate')
 	{
-		if ($this->expression !== null)
+		$links = $this->get_links($rel);
+		if (isset($links[$key]))
 		{
-			return $this->expression;
+			return $links[$key];
 		}
 		else
 		{
-			return 'full';
+			return null;
 		}
 	}
 
-	function get_extension()
+	/**
+	 * Added for parity between the parent-level and the item/entry-level.
+	 */
+	function get_permalink()
 	{
-		if ($this->link !== null)
-		{
-			$url = SimplePie_Misc::parse_url($this->link);
-			if ($url['path'] !== '')
-			{
-				return pathinfo($url['path'], PATHINFO_EXTENSION);
-			}
-		}
-		return null;
+		return $this->get_link(0);
 	}
 
-	function get_framerate()
+	function get_links($rel = 'alternate')
 	{
-		if ($this->framerate !== null)
+		if (!isset($this->data['links']))
 		{
-			return $this->framerate;
-		}
-		else
-		{
-			return null;
-		}
-	}
+			$this->data['links'] = array();
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
+			{
+				foreach ($links as $link)
+				{
+					if (isset($link['attribs']['']['href']))
+					{
+						$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+						$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+					}
+				}
+			}
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
+			{
+				foreach ($links as $link)
+				{
+					if (isset($link['attribs']['']['href']))
+					{
+						$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+						$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
 
-	function get_handler()
-	{
-		return $this->get_real_type(true);
-	}
+					}
+				}
+			}
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
+			{
+				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+			}
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
+			{
+				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+			}
+			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
+			{
+				$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+			}
 
-	function get_hash($key = 0)
-	{
-		$hashes = $this->get_hashes();
-		if (isset($hashes[$key]))
+			$keys = array_keys($this->data['links']);
+			foreach ($keys as $key)
+			{
+				if (SimplePie_Misc::is_isegment_nz_nc($key))
+				{
+					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
+					{
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
+						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
+					}
+					else
+					{
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
+					}
+				}
+				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+				{
+					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
+				}
+				$this->data['links'][$key] = array_unique($this->data['links'][$key]);
+			}
+		}
+
+		if (isset($this->data['links'][$rel]))
 		{
-			return $hashes[$key];
+			return $this->data['links'][$rel];
 		}
 		else
 		{
@@ -5517,60 +6120,43 @@
 		}
 	}
 
-	function get_hashes()
+	function get_description()
 	{
-		if ($this->hashes !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
 		{
-			return $this->hashes;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-	}
-
-	function get_height()
-	{
-		if ($this->height !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
 		{
-			return $this->height;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-	}
-
-	function get_language()
-	{
-		if ($this->lang !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
 		{
-			return $this->lang;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-	}
-
-	function get_keyword($key = 0)
-	{
-		$keywords = $this->get_keywords();
-		if (isset($keywords[$key]))
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
 		{
-			return $keywords[$key];
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 		}
-	}
-
-	function get_keywords()
-	{
-		if ($this->keywords !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
 		{
-			return $this->keywords;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 		}
 		else
 		{
@@ -5578,35 +6164,27 @@
 		}
 	}
 
-	function get_length()
+	function get_copyright()
 	{
-		if ($this->length !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
 		{
-			return $this->length;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
 		}
-	}
-
-	function get_link()
-	{
-		if ($this->link !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
 		{
-			return urldecode($this->link);
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-	}
-
-	function get_medium()
-	{
-		if ($this->medium !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
 		{
-			return $this->medium;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
 		else
 		{
@@ -5614,24 +6192,23 @@
 		}
 	}
 
-	function get_player()
+	function get_language()
 	{
-		if ($this->player !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
 		{
-			return $this->player;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
-	}
-
-	function get_rating($key = 0)
-	{
-		$ratings = $this->get_ratings();
-		if (isset($ratings[$key]))
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
 		{
-			return $ratings[$key];
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+		}
+		elseif (isset($this->data['xml_lang']))
+		{
+			return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
 		}
 		else
 		{
@@ -5639,11 +6216,15 @@
 		}
 	}
 
-	function get_ratings()
+	function get_latitude()
 	{
-		if ($this->ratings !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
 		{
-			return $this->ratings;
+			return (float) $return[0]['data'];
+		}
+		elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+		{
+			return (float) $match[1];
 		}
 		else
 		{
@@ -5651,24 +6232,19 @@
 		}
 	}
 
-	function get_restriction($key = 0)
+	function get_longitude()
 	{
-		$restrictions = $this->get_restrictions();
-		if (isset($restrictions[$key]))
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
 		{
-			return $restrictions[$key];
+			return (float) $return[0]['data'];
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
 		{
-			return null;
+			return (float) $return[0]['data'];
 		}
-	}
-
-	function get_restrictions()
-	{
-		if ($this->restrictions !== null)
+		elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
 		{
-			return $this->restrictions;
+			return (float) $match[2];
 		}
 		else
 		{
@@ -5676,61 +6252,52 @@
 		}
 	}
 
-	function get_sampling_rate()
+	function get_image_url()
 	{
-		if ($this->samplingrate !== null)
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
 		{
-			return $this->samplingrate;
+			return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
 		}
-		else
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
 		{
-			return null;
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
-	}
-
-	function get_size()
-	{
-		$length = $this->get_length();
-		if ($length !== null)
+		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
 		{
-			return round($length/1048576, 2);
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 		}
 		else
 		{
 			return null;
 		}
 	}
+}
 
-	function get_thumbnail($key = 0)
+class SimplePie_Author
+{
+	var $name;
+	var $link;
+	var $email;
+
+	// Constructor, used to input the data
+	function SimplePie_Author($name = null, $link = null, $email = null)
 	{
-		$thumbnails = $this->get_thumbnails();
-		if (isset($thumbnails[$key]))
-		{
-			return $thumbnails[$key];
-		}
-		else
-		{
-			return null;
-		}
+		$this->name = $name;
+		$this->link = $link;
+		$this->email = $email;
 	}
 
-	function get_thumbnails()
+	function __toString()
 	{
-		if ($this->thumbnails !== null)
-		{
-			return $this->thumbnails;
-		}
-		else
-		{
-			return null;
-		}
+		// There is no $this->data here
+		return md5(serialize($this));
 	}
 
-	function get_title()
+	function get_name()
 	{
-		if ($this->title !== null)
+		if ($this->name !== null)
 		{
-			return $this->title;
+			return $this->name;
 		}
 		else
 		{
@@ -5738,11 +6305,11 @@
 		}
 	}
 
-	function get_type()
+	function get_link()
 	{
-		if ($this->type !== null)
+		if ($this->link !== null)
 		{
-			return $this->type;
+			return $this->link;
 		}
 		else
 		{
@@ -5750,483 +6317,426 @@
 		}
 	}
 
-	function get_width()
+	function get_email()
 	{
-		if ($this->width !== null)
+		if ($this->email !== null)
 		{
-			return $this->width;
+			return $this->email;
 		}
 		else
 		{
 			return null;
 		}
 	}
+}
 
-	function native_embed($options='')
-	{
-		return $this->embed($options, true);
-	}
-
-	/**
-	 * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
-	 */
-	function embed($options = '', $native = false)
+class SimplePie_Category
+{
+	var $term;
+	var $scheme;
+	var $label;
+
+	// Constructor, used to input the data
+	function SimplePie_Category($term = null, $scheme = null, $label = null)
 	{
-		// Set up defaults
-		$audio = '';
-		$video = '';
-		$alt = '';
-		$altclass = '';
-		$loop = 'false';
-		$width = 'auto';
-		$height = 'auto';
-		$bgcolor = '#ffffff';
-		$mediaplayer = '';
-		$widescreen = false;
-		$handler = $this->get_handler();
-		$type = $this->get_real_type();
+		$this->term = $term;
+		$this->scheme = $scheme;
+		$this->label = $label;
+	}
 
-		// Process options and reassign values as necessary
-		if (is_array($options))
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_term()
+	{
+		if ($this->term !== null)
 		{
-			extract($options);
+			return $this->term;
 		}
 		else
 		{
-			$options = explode(',', $options);
-			foreach($options as $option)
-			{
-				$opt = explode(':', $option, 2);
-				if (isset($opt[0], $opt[1]))
-				{
-					$opt[0] = trim($opt[0]);
-					$opt[1] = trim($opt[1]);
-					switch ($opt[0])
-					{
-						case 'audio':
-							$audio = $opt[1];
-							break;
-
-						case 'video':
-							$video = $opt[1];
-							break;
-
-						case 'alt':
-							$alt = $opt[1];
-							break;
-
-						case 'altclass':
-							$altclass = $opt[1];
-							break;
-
-						case 'loop':
-							$loop = $opt[1];
-							break;
-
-						case 'width':
-							$width = $opt[1];
-							break;
-
-						case 'height':
-							$height = $opt[1];
-							break;
-
-						case 'bgcolor':
-							$bgcolor = $opt[1];
-							break;
+			return null;
+		}
+	}
 
-						case 'mediaplayer':
-							$mediaplayer = $opt[1];
-							break;
+	function get_scheme()
+	{
+		if ($this->scheme !== null)
+		{
+			return $this->scheme;
+		}
+		else
+		{
+			return null;
+		}
+	}
 
-						case 'widescreen':
-							$widescreen = $opt[1];
-							break;
-					}
-				}
-			}
+	function get_label()
+	{
+		if ($this->label !== null)
+		{
+			return $this->label;
+		}
+		else
+		{
+			return $this->get_term();
 		}
+	}
+}
 
-		$mime = explode('/', $type, 2);
-		$mime = $mime[0];
+class SimplePie_Enclosure
+{
+	var $bitrate;
+	var $captions;
+	var $categories;
+	var $channels;
+	var $copyright;
+	var $credits;
+	var $description;
+	var $duration;
+	var $expression;
+	var $framerate;
+	var $handler;
+	var $hashes;
+	var $height;
+	var $javascript;
+	var $keywords;
+	var $lang;
+	var $length;
+	var $link;
+	var $medium;
+	var $player;
+	var $ratings;
+	var $restrictions;
+	var $samplingrate;
+	var $thumbnails;
+	var $title;
+	var $type;
+	var $width;
 
-		// Process values for 'auto'
-		if ($width == 'auto')
+	// Constructor, used to input the data
+	function SimplePie_Enclosure($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
+	{
+		$this->bitrate = $bitrate;
+		$this->captions = $captions;
+		$this->categories = $categories;
+		$this->channels = $channels;
+		$this->copyright = $copyright;
+		$this->credits = $credits;
+		$this->description = $description;
+		$this->duration = $duration;
+		$this->expression = $expression;
+		$this->framerate = $framerate;
+		$this->hashes = $hashes;
+		$this->height = $height;
+		$this->javascript = $javascript;
+		$this->keywords = $keywords;
+		$this->lang = $lang;
+		$this->length = $length;
+		$this->link = $link;
+		$this->medium = $medium;
+		$this->player = $player;
+		$this->ratings = $ratings;
+		$this->restrictions = $restrictions;
+		$this->samplingrate = $samplingrate;
+		$this->thumbnails = $thumbnails;
+		$this->title = $title;
+		$this->type = $type;
+		$this->width = $width;
+		if (class_exists('idna_convert'))
 		{
-			if ($mime == 'video')
-			{
-				if ($height == 'auto')
-				{
-					$width = 480;
-				}
-				elseif ($widescreen)
-				{
-					$width = round((intval($height)/9)*16);
-				}
-				else
-				{
-					$width = round((intval($height)/3)*4);
-				}
-			}
-			else
-			{
-				$width = '100%';
-			}
+			$idn = new idna_convert;
+			$parsed = SimplePie_Misc::parse_url($link);
+			$this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
 		}
+		$this->handler = $this->get_handler(); // Needs to load last
+	}
 
-		if ($height == 'auto')
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_bitrate()
+	{
+		if ($this->bitrate !== null)
 		{
-			if ($mime == 'audio')
-			{
-				$height = 0;
-			}
-			elseif ($mime == 'video')
-			{
-				if ($width == 'auto')
-				{
-					if ($widescreen)
-					{
-						$height = 270;
-					}
-					else
-					{
-						$height = 360;
-					}
-				}
-				elseif ($widescreen)
-				{
-					$height = round((intval($width)/16)*9);
-				}
-				else
-				{
-					$height = round((intval($width)/4)*3);
-				}
-			}
-			else
-			{
-				$height = 376;
-			}
+			return $this->bitrate;
 		}
-		elseif ($mime == 'audio')
+		else
 		{
-			$height = 0;
+			return null;
 		}
+	}
 
-		// Set proper placeholder value
-		if ($mime == 'audio')
+	function get_caption($key = 0)
+	{
+		$captions = $this->get_captions();
+		if (isset($captions[$key]))
 		{
-			$placeholder = $audio;
+			return $captions[$key];
 		}
-		elseif ($mime == 'video')
+		else
 		{
-			$placeholder = $video;
+			return null;
 		}
+	}
 
-		$embed = '';
-
-		// Make sure the JS library is included
-		if (!$native)
+	function get_captions()
+	{
+		if ($this->captions !== null)
 		{
-			static $javascript_outputted = null;
-			if (!$javascript_outputted && $this->javascript)
-			{
-				$embed .= '<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) . '"></script>';
-				$javascript_outputted = true;
-			}
+			return $this->captions;
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// Odeo Feed MP3's
-		if ($handler == 'odeo')
+	function get_category($key = 0)
+	{
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
 		{
-			if ($native)
-			{
-				$embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url=' . $this->get_link() . '"></embed>';
-			}
-			else
-			{
-				$embed .= '<script type="text/javascript">embed_odeo("' . $this->get_link() . '");</script>';
-			}
+			return $categories[$key];
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// Flash
-		elseif ($handler == 'flash')
+	function get_categories()
+	{
+		if ($this->categories !== null)
 		{
-			if ($native)
-			{
-				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
-			}
-			else
-			{
-				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
-			}
+			return $this->categories;
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// Flash Media Player file types.
-		// Preferred handler for MP3 file types.
-		elseif ($handler == 'fmedia' || ($handler == 'mp3' && $mediaplayer != ''))
+	function get_channels()
+	{
+		if ($this->channels !== null)
 		{
-			$height += 20;
-			if ($native)
-			{
-				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
-			}
-			else
-			{
-				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
-			}
+			return $this->channels;
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// QuickTime 7 file types.  Need to test with QuickTime 6.
-		// Only handle MP3's if the Flash Media Player is not present.
-		elseif ($handler == 'quicktime' || ($handler == 'mp3' && $mediaplayer == ''))
+	function get_copyright()
+	{
+		if ($this->copyright !== null)
 		{
-			$height += 16;
-			if ($native)
-			{
-				if ($placeholder != ""){
-					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
-				}
-				else {
-					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
-				}
-			}
-			else
-			{
-				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
-			}
+			return $this->copyright;
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// Windows Media
-		elseif ($handler == 'wmedia')
+	function get_credit($key = 0)
+	{
+		$credits = $this->get_credits();
+		if (isset($credits[$key]))
 		{
-			$height += 45;
-			if ($native)
+			return $credits[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_credits()
+	{
+		if ($this->credits !== null)
+		{
+			return $this->credits;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_description()
+	{
+		if ($this->description !== null)
+		{
+			return $this->description;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_duration($convert = false)
+	{
+		if ($this->duration !== null)
+		{
+			if ($convert)
 			{
-				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
+				$time = SimplePie_Misc::time_hms($this->duration);
+				return $time;
 			}
 			else
 			{
-				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
+				return $this->duration;
 			}
 		}
+		else
+		{
+			return null;
+		}
+	}
 
-		// Everything else
-		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
+	function get_expression()
+	{
+		if ($this->expression !== null)
+		{
+			return $this->expression;
+		}
+		else
+		{
+			return 'full';
+		}
+	}
 
-		return $embed;
+	function get_extension()
+	{
+		if ($this->link !== null)
+		{
+			$url = SimplePie_Misc::parse_url($this->link);
+			if ($url['path'] !== '')
+			{
+				return pathinfo($url['path'], PATHINFO_EXTENSION);
+			}
+		}
+		return null;
 	}
 
-	function get_real_type($find_handler = false)
+	function get_framerate()
 	{
-		// If it's Odeo, let's get it out of the way.
-		if (substr(strtolower($this->get_link()), 0, 15) == 'http://odeo.com')
+		if ($this->framerate !== null)
 		{
-			return 'odeo';
+			return $this->framerate;
+		}
+		else
+		{
+			return null;
 		}
+	}
 
-		// Mime-types by handler.
-		$types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
-		$types_fmedia = array('video/flv', 'video/x-flv'); // Flash Media Player
-		$types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
-		$types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
-		$types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
+	function get_handler()
+	{
+		return $this->get_real_type(true);
+	}
 
-		if ($this->get_type() !== null)
+	function get_hash($key = 0)
+	{
+		$hashes = $this->get_hashes();
+		if (isset($hashes[$key]))
 		{
-			$type = strtolower($this->type);
+			return $hashes[$key];
 		}
 		else
 		{
-			$type = null;
+			return null;
 		}
+	}
 
-		// If we encounter an unsupported mime-type, check the file extension and guess intelligently.
-		if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
+	function get_hashes()
+	{
+		if ($this->hashes !== null)
 		{
-			switch (strtolower($this->get_extension()))
-			{
-				// Audio mime-types
-				case 'aac':
-				case 'adts':
-					$type = 'audio/acc';
-					break;
+			return $this->hashes;
+		}
+		else
+		{
+			return null;
+		}
+	}
 
-				case 'aif':
-				case 'aifc':
-				case 'aiff':
-				case 'cdda':
-					$type = 'audio/aiff';
-					break;
+	function get_height()
+	{
+		if ($this->height !== null)
+		{
+			return $this->height;
+		}
+		else
+		{
+			return null;
+		}
+	}
 
-				case 'bwf':
-					$type = 'audio/wav';
-					break;
+	function get_language()
+	{
+		if ($this->lang !== null)
+		{
+			return $this->lang;
+		}
+		else
+		{
+			return null;
+		}
+	}
 
-				case 'kar':
-				case 'mid':
-				case 'midi':
-				case 'smf':
-					$type = 'audio/midi';
-					break;
-
-				case 'm4a':
-					$type = 'audio/x-m4a';
-					break;
-
-				case 'mp3':
-				case 'swa':
-					$type = 'audio/mp3';
-					break;
-
-				case 'wav':
-					$type = 'audio/wav';
-					break;
-
-				case 'wax':
-					$type = 'audio/x-ms-wax';
-					break;
-
-				case 'wma':
-					$type = 'audio/x-ms-wma';
-					break;
-
-				// Video mime-types
-				case '3gp':
-				case '3gpp':
-					$type = 'video/3gpp';
-					break;
-
-				case '3g2':
-				case '3gp2':
-					$type = 'video/3gpp2';
-					break;
-
-				case 'asf':
-					$type = 'video/x-ms-asf';
-					break;
-
-				case 'flv':
-					$type = 'video/x-flv';
-					break;
-
-				case 'm1a':
-				case 'm1s':
-				case 'm1v':
-				case 'm15':
-				case 'm75':
-				case 'mp2':
-				case 'mpa':
-				case 'mpeg':
-				case 'mpg':
-				case 'mpm':
-				case 'mpv':
-					$type = 'video/mpeg';
-					break;
-
-				case 'm4v':
-					$type = 'video/x-m4v';
-					break;
-
-				case 'mov':
-				case 'qt':
-					$type = 'video/quicktime';
-					break;
-
-				case 'mp4':
-				case 'mpg4':
-					$type = 'video/mp4';
-					break;
-
-				case 'sdv':
-					$type = 'video/sd-video';
-					break;
-
-				case 'wm':
-					$type = 'video/x-ms-wm';
-					break;
-
-				case 'wmv':
-					$type = 'video/x-ms-wmv';
-					break;
-
-				case 'wvx':
-					$type = 'video/x-ms-wvx';
-					break;
-
-				// Flash mime-types
-				case 'spl':
-					$type = 'application/futuresplash';
-					break;
-
-				case 'swf':
-					$type = 'application/x-shockwave-flash';
-					break;
-			}
-		}
-
-		if ($find_handler)
+	function get_keyword($key = 0)
+	{
+		$keywords = $this->get_keywords();
+		if (isset($keywords[$key]))
 		{
-			if (in_array($type, $types_flash))
-			{
-				return 'flash';
-			}
-			elseif (in_array($type, $types_fmedia))
-			{
-				return 'fmedia';
-			}
-			elseif (in_array($type, $types_quicktime))
-			{
-				return 'quicktime';
-			}
-			elseif (in_array($type, $types_wmedia))
-			{
-				return 'wmedia';
-			}
-			elseif (in_array($type, $types_mp3))
-			{
-				return 'mp3';
-			}
-			else
-			{
-				return null;
-			}
+			return $keywords[$key];
 		}
 		else
 		{
-			return $type;
+			return null;
 		}
 	}
-}
-
-class SimplePie_Caption
-{
-	var $type;
-	var $lang;
-	var $startTime;
-	var $endTime;
-	var $text;
 
-	// Constructor, used to input the data
-	function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
+	function get_keywords()
 	{
-		$this->type = $type;
-		$this->lang = $lang;
-		$this->startTime = $startTime;
-		$this->endTime = $endTime;
-		$this->text = $text;
+		if ($this->keywords !== null)
+		{
+			return $this->keywords;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function __toString()
+	function get_length()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
+		if ($this->length !== null)
+		{
+			return $this->length;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function get_endtime()
+	function get_link()
 	{
-		if ($this->endTime !== null)
+		if ($this->link !== null)
 		{
-			return $this->endTime;
+			return urldecode($this->link);
 		}
 		else
 		{
@@ -6234,11 +6744,11 @@
 		}
 	}
 
-	function get_language()
+	function get_medium()
 	{
-		if ($this->language !== null)
+		if ($this->medium !== null)
 		{
-			return $this->language;
+			return $this->medium;
 		}
 		else
 		{
@@ -6246,11 +6756,11 @@
 		}
 	}
 
-	function get_starttime()
+	function get_player()
 	{
-		if ($this->startTime !== null)
+		if ($this->player !== null)
 		{
-			return $this->startTime;
+			return $this->player;
 		}
 		else
 		{
@@ -6258,11 +6768,12 @@
 		}
 	}
 
-	function get_text()
+	function get_rating($key = 0)
 	{
-		if ($this->text !== null)
+		$ratings = $this->get_ratings();
+		if (isset($ratings[$key]))
 		{
-			return $this->text;
+			return $ratings[$key];
 		}
 		else
 		{
@@ -6270,44 +6781,48 @@
 		}
 	}
 
-	function get_type()
+	function get_ratings()
 	{
-		if ($this->type !== null)
+		if ($this->ratings !== null)
 		{
-			return $this->type;
+			return $this->ratings;
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
-
-class SimplePie_Credit
-{
-	var $role;
-	var $scheme;
-	var $name;
 
-	// Constructor, used to input the data
-	function SimplePie_Credit($role = null, $scheme = null, $name = null)
+	function get_restriction($key = 0)
 	{
-		$this->role = $role;
-		$this->scheme = $scheme;
-		$this->name = $name;
+		$restrictions = $this->get_restrictions();
+		if (isset($restrictions[$key]))
+		{
+			return $restrictions[$key];
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function __toString()
+	function get_restrictions()
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
+		if ($this->restrictions !== null)
+		{
+			return $this->restrictions;
+		}
+		else
+		{
+			return null;
+		}
 	}
 
-	function get_role()
+	function get_sampling_rate()
 	{
-		if ($this->role !== null)
+		if ($this->samplingrate !== null)
 		{
-			return $this->role;
+			return $this->samplingrate;
 		}
 		else
 		{
@@ -6315,11 +6830,12 @@
 		}
 	}
 
-	function get_scheme()
+	function get_size()
 	{
-		if ($this->scheme !== null)
+		$length = $this->get_length();
+		if ($length !== null)
 		{
-			return $this->scheme;
+			return round($length/1048576, 2);
 		}
 		else
 		{
@@ -6327,42 +6843,24 @@
 		}
 	}
 
-	function get_name()
+	function get_thumbnail($key = 0)
 	{
-		if ($this->name !== null)
+		$thumbnails = $this->get_thumbnails();
+		if (isset($thumbnails[$key]))
 		{
-			return $this->name;
+			return $thumbnails[$key];
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
 
-class SimplePie_Copyright
-{
-	var $url;
-	var $label;
-
-	// Constructor, used to input the data
-	function SimplePie_Copyright($url = null, $label = null)
-	{
-		$this->url = $url;
-		$this->label = $label;
-	}
-
-	function __toString()
-	{
-		// There is no $this->data here
-		return md5(serialize($this));
-	}
-
-	function get_url()
+	function get_thumbnails()
 	{
-		if ($this->url !== null)
+		if ($this->thumbnails !== null)
 		{
-			return $this->url;
+			return $this->thumbnails;
 		}
 		else
 		{
@@ -6370,42 +6868,23 @@
 		}
 	}
 
-	function get_attribution()
+	function get_title()
 	{
-		if ($this->label !== null)
+		if ($this->title !== null)
 		{
-			return $this->label;
+			return $this->title;
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
-
-class SimplePie_Rating
-{
-	var $scheme;
-	var $value;
-
-	// Constructor, used to input the data
-	function SimplePie_Rating($scheme = null, $value = null)
-	{
-		$this->scheme = $scheme;
-		$this->value = $value;
-	}
 
-	function __toString()
-	{
-		// There is no $this->data here
-		return md5(serialize($this));
-	}
-
-	function get_scheme()
+	function get_type()
 	{
-		if ($this->scheme !== null)
+		if ($this->type !== null)
 		{
-			return $this->scheme;
+			return $this->type;
 		}
 		else
 		{
@@ -6413,380 +6892,1019 @@
 		}
 	}
 
-	function get_value()
+	function get_width()
 	{
-		if ($this->value !== null)
+		if ($this->width !== null)
 		{
-			return $this->value;
+			return $this->width;
 		}
 		else
 		{
 			return null;
 		}
 	}
-}
-
-class SimplePie_Restriction
-{
-	var $relationship;
-	var $type;
-	var $value;
 
-	// Constructor, used to input the data
-	function SimplePie_Restriction($relationship = null, $type = null, $value = null)
+	function native_embed($options='')
 	{
-		$this->relationship = $relationship;
-		$this->type = $type;
-		$this->value = $value;
+		return $this->embed($options, true);
 	}
 
-	function __toString()
+	/**
+	 * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
+	 */
+	function embed($options = '', $native = false)
 	{
-		// There is no $this->data here
-		return md5(serialize($this));
-	}
+		// Set up defaults
+		$audio = '';
+		$video = '';
+		$alt = '';
+		$altclass = '';
+		$loop = 'false';
+		$width = 'auto';
+		$height = 'auto';
+		$bgcolor = '#ffffff';
+		$mediaplayer = '';
+		$widescreen = false;
+		$handler = $this->get_handler();
+		$type = $this->get_real_type();
 
-	function get_relationship()
-	{
-		if ($this->relationship !== null)
+		// Process options and reassign values as necessary
+		if (is_array($options))
 		{
-			return $this->relationship;
+			extract($options);
 		}
 		else
 		{
-			return null;
-		}
-	}
+			$options = explode(',', $options);
+			foreach($options as $option)
+			{
+				$opt = explode(':', $option, 2);
+				if (isset($opt[0], $opt[1]))
+				{
+					$opt[0] = trim($opt[0]);
+					$opt[1] = trim($opt[1]);
+					switch ($opt[0])
+					{
+						case 'audio':
+							$audio = $opt[1];
+							break;
 
-	function get_type()
-	{
-		if ($this->type !== null)
-		{
-			return $this->type;
-		}
-		else
-		{
-			return null;
-		}
-	}
+						case 'video':
+							$video = $opt[1];
+							break;
 
-	function get_value()
-	{
-		if ($this->value !== null)
-		{
-			return $this->value;
-		}
-		else
-		{
-			return null;
-		}
-	}
-}
+						case 'alt':
+							$alt = $opt[1];
+							break;
 
-/**
- * @todo Move to properly supporting RFC2616 (HTTP/1.1)
- */
-class SimplePie_File
-{
-	var $url;
-	var $useragent;
-	var $success = true;
-	var $headers = array();
-	var $body;
-	var $status_code;
-	var $redirects = 0;
-	var $error;
-	var $method;
+						case 'altclass':
+							$altclass = $opt[1];
+							break;
 
-	function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
-	{
-		if (class_exists('idna_convert'))
-		{
-			$idn =& new idna_convert;
-			$parsed = SimplePie_Misc::parse_url($url);
-			$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+						case 'loop':
+							$loop = $opt[1];
+							break;
+
+						case 'width':
+							$width = $opt[1];
+							break;
+
+						case 'height':
+							$height = $opt[1];
+							break;
+
+						case 'bgcolor':
+							$bgcolor = $opt[1];
+							break;
+
+						case 'mediaplayer':
+							$mediaplayer = $opt[1];
+							break;
+
+						case 'widescreen':
+							$widescreen = $opt[1];
+							break;
+					}
+				}
+			}
 		}
-		$this->url = $url;
-		$this->useragent = $useragent;
-		if (preg_match('/^http(s)?:\/\//i', $url))
+
+		$mime = explode('/', $type, 2);
+		$mime = $mime[0];
+
+		// Process values for 'auto'
+		if ($width === 'auto')
 		{
-			if ($useragent === null)
-			{
-				$useragent = ini_get('user_agent');
-				$this->useragent = $useragent;
-			}
-			if (!is_array($headers))
-			{
-				$headers = array();
-			}
-			if (!$force_fsockopen && extension_loaded('curl'))
+			if ($mime === 'video')
 			{
-				$this->method = 'curl';
-				$fp = curl_init();
-				$headers2 = array();
-				foreach ($headers as $key => $value)
+				if ($height === 'auto')
 				{
-					$headers2[] = "$key: $value";
+					$width = 480;
 				}
-				if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
+				elseif ($widescreen)
 				{
-					curl_setopt($fp, CURLOPT_ENCODING, '');
+					$width = round((intval($height)/9)*16);
 				}
-				curl_setopt($fp, CURLOPT_URL, $url);
-				curl_setopt($fp, CURLOPT_HEADER, 1);
-				curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
-				curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
-				curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
-				curl_setopt($fp, CURLOPT_REFERER, $url);
-				curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
-				curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
-				if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
+				else
 				{
-					curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
-					curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
+					$width = round((intval($height)/3)*4);
 				}
+			}
+			else
+			{
+				$width = '100%';
+			}
+		}
 
-				$this->headers = curl_exec($fp);
-				if (curl_errno($fp) == 23 || curl_errno($fp) == 61)
+		if ($height === 'auto')
+		{
+			if ($mime === 'audio')
+			{
+				$height = 0;
+			}
+			elseif ($mime === 'video')
+			{
+				if ($width === 'auto')
 				{
-					curl_setopt($fp, CURLOPT_ENCODING, 'none');
-					$this->headers = curl_exec($fp);
+					if ($widescreen)
+					{
+						$height = 270;
+					}
+					else
+					{
+						$height = 360;
+					}
 				}
-				if (curl_errno($fp))
+				elseif ($widescreen)
 				{
-					$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
-					$this->success = false;
+					$height = round((intval($width)/16)*9);
 				}
 				else
 				{
-					$info = curl_getinfo($fp);
-					curl_close($fp);
-					$this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
-					$this->headers = array_pop($this->headers);
-					$parser =& new SimplePie_HTTP_Parser($this->headers);
-					if ($parser->parse())
-					{
-						$this->headers = $parser->headers;
-						$this->body = $parser->body;
-						$this->status_code = $parser->status_code;
-						if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
-						{
-							$this->redirects++;
-							if (isset($this->headers['content-location']))
-							{
-								$location = SimplePie_Misc::absolutize_url($this->headers['location'], SimplePie_Misc::absolutize_url($this->headers['content-location'], $url));
-							}
-							else
-							{
-								$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
-							}
-							return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
-						}
-					}
+					$height = round((intval($width)/4)*3);
 				}
 			}
 			else
 			{
-				$this->method = 'fsockopen';
-				$url_parts = parse_url($url);
-				if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) == 'https')
-				{
-					$url_parts['host'] = "ssl://$url_parts[host]";
-					$url_parts['port'] = 443;
-				}
-				if (!isset($url_parts['port']))
-				{
-					$url_parts['port'] = 80;
-				}
-				$fp = fsockopen($url_parts['host'], $url_parts['port'], $errno, $errstr, $timeout);
-				if (!$fp)
-				{
-					$this->error = 'fsockopen error: ' . $errstr;
-					$this->success = false;
-				}
-				else
-				{
-					if (function_exists('stream_set_timeout'))
-					{
-						stream_set_timeout($fp, $timeout);
-					}
-					else
-					{
-						socket_set_timeout($fp, $timeout);
-					}
-					if (isset($url_parts['path']))
-					{
-						if (isset($url_parts['query']))
-						{
-							$get = "$url_parts[path]?$url_parts[query]";
-						}
-						else
-						{
-							$get = $url_parts['path'];
-						}
-					}
-					else
-					{
-						$get = '/';
-					}
-					$out = "GET $get HTTP/1.0\r\n";
-					$out .= "Host: $url_parts[host]\r\n";
-					$out .= "User-Agent: $useragent\r\n";
-					if (function_exists('gzinflate'))
-					{
-						$out .= "Accept-Encoding: gzip,deflate\r\n";
-					}
+				$height = 376;
+			}
+		}
+		elseif ($mime === 'audio')
+		{
+			$height = 0;
+		}
 
-					if (isset($url_parts['user']) && isset($url_parts['pass']))
-					{
-						$out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
-					}
-					foreach ($headers as $key => $value)
-					{
-						$out .= "$key: $value\r\n";
-					}
-					$out .= "Connection: Close\r\n\r\n";
-					fwrite($fp, $out);
+		// Set proper placeholder value
+		if ($mime === 'audio')
+		{
+			$placeholder = $audio;
+		}
+		elseif ($mime === 'video')
+		{
+			$placeholder = $video;
+		}
 
-					if (function_exists('stream_get_meta_data'))
-					{
-						$info = stream_get_meta_data($fp);
-					}
-					else
-					{
-						$info = socket_get_status($fp);
-					}
+		$embed = '';
 
-					$this->headers = '';
-					while (!$info['eof'] && !$info['timed_out'])
-					{
-						$this->headers .= fread($fp, 1160);
-						if (function_exists('stream_get_meta_data'))
-						{
-							$info = stream_get_meta_data($fp);
-						}
-						else
-						{
-							$info = socket_get_status($fp);
-						}
-					}
-					if (!$info['timed_out'])
-					{
-						$parser =& new SimplePie_HTTP_Parser($this->headers);
-						if ($parser->parse())
-						{
-							$this->headers = $parser->headers;
-							$this->body = $parser->body;
-							$this->status_code = $parser->status_code;
-							if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
-							{
-								$this->redirects++;
-								if (isset($this->headers['content-location']))
-								{
-									$location = SimplePie_Misc::absolutize_url($this->headers['location'], SimplePie_Misc::absolutize_url($this->headers['content-location'], $url));
-								}
-								else
-								{
-									$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
-								}
-								return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
-							}
-							if (isset($this->headers['content-encoding']) && ($this->headers['content-encoding'] == 'gzip' || $this->headers['content-encoding'] == 'deflate'))
-							{
-								if (substr($this->body, 0, 8) == "\x1f\x8b\x08\x00\x00\x00\x00\x00")
-								{
-									$this->body = substr($this->body, 10);
-								}
-								$this->body = gzinflate($this->body);
-							}
-						}
-					}
-					else
-					{
-						$this->error = 'fsocket timed out';
-						$this->success = false;
-					}
-					fclose($fp);
-				}
+		// Make sure the JS library is included
+		if (!$native)
+		{
+			static $javascript_outputted = null;
+			if (!$javascript_outputted && $this->javascript)
+			{
+				$embed .= '<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) . '"></script>';
+				$javascript_outputted = true;
 			}
 		}
-		elseif (function_exists('file_get_contents'))
+
+		// Odeo Feed MP3's
+		if ($handler === 'odeo')
 		{
-			$this->method = 'file_get_contents';
-			if (!$this->body = file_get_contents($url))
+			if ($native)
 			{
-				$this->error = 'file_get_contents could not read the file';
-				$this->success = false;
+				$embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url=' . $this->get_link() . '"></embed>';
+			}
+			else
+			{
+				$embed .= '<script type="text/javascript">embed_odeo("' . $this->get_link() . '");</script>';
 			}
 		}
-		else
+
+		// Flash
+		elseif ($handler === 'flash')
 		{
-			$this->method = 'fopen';
-			if (($fp = fopen($url, 'rb')) === false)
+			if ($native)
 			{
-				$this->error = 'failed to open stream: No such file or directory';
-				$this->success = false;
+				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
+			}
+		}
+
+		// Flash Media Player file types.
+		// Preferred handler for MP3 file types.
+		elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== ''))
+		{
+			$height += 20;
+			if ($native)
+			{
+				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
 			}
 			else
 			{
-				$this->body = '';
-				while (!feof($fp))
+				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
+			}
+		}
+
+		// QuickTime 7 file types.  Need to test with QuickTime 6.
+		// Only handle MP3's if the Flash Media Player is not present.
+		elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === ''))
+		{
+			$height += 16;
+			if ($native)
+			{
+				if ($placeholder !== '')
+				{
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
+				}
+				else
 				{
-					$this->body .= fread($fp, 8192);
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
 				}
-				fclose($fp);
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
 			}
 		}
-	}
-}
 
-/**
- * HTTP Response Parser
- *
- * @package SimplePie
- * @todo Support HTTP Requests
- */
-class SimplePie_HTTP_Parser
-{
-	/**
-	 * HTTP Version
-	 *
-	 * @access public
-	 * @var string
-	 */
-	var $http_version = '';
+		// Windows Media
+		elseif ($handler === 'wmedia')
+		{
+			$height += 45;
+			if ($native)
+			{
+				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
+			}
+		}
 
-	/**
-	 * Status code
-	 *
-	 * @access public
-	 * @var string
-	 */
-	var $status_code = '';
+		// Everything else
+		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
 
-	/**
-	 * Reason phrase
-	 *
-	 * @access public
-	 * @var string
-	 */
-	var $reason = '';
+		return $embed;
+	}
 
-	/**
-	 * Key/value pairs of the headers
-	 *
-	 * @access public
-	 * @var array
-	 */
-	var $headers = array();
+	function get_real_type($find_handler = false)
+	{
+		// If it's Odeo, let's get it out of the way.
+		if (substr(strtolower($this->get_link()), 0, 15) === 'http://odeo.com')
+		{
+			return 'odeo';
+		}
 
-	/**
-	 * Body of the response
-	 *
-	 * @access public
-	 * @var string
-	 */
-	var $body = '';
+		// Mime-types by handler.
+		$types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
+		$types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
+		$types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
+		$types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
+		$types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
+
+		if ($this->get_type() !== null)
+		{
+			$type = strtolower($this->type);
+		}
+		else
+		{
+			$type = null;
+		}
+
+		// If we encounter an unsupported mime-type, check the file extension and guess intelligently.
+		if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
+		{
+			switch (strtolower($this->get_extension()))
+			{
+				// Audio mime-types
+				case 'aac':
+				case 'adts':
+					$type = 'audio/acc';
+					break;
+
+				case 'aif':
+				case 'aifc':
+				case 'aiff':
+				case 'cdda':
+					$type = 'audio/aiff';
+					break;
+
+				case 'bwf':
+					$type = 'audio/wav';
+					break;
+
+				case 'kar':
+				case 'mid':
+				case 'midi':
+				case 'smf':
+					$type = 'audio/midi';
+					break;
+
+				case 'm4a':
+					$type = 'audio/x-m4a';
+					break;
+
+				case 'mp3':
+				case 'swa':
+					$type = 'audio/mp3';
+					break;
+
+				case 'wav':
+					$type = 'audio/wav';
+					break;
+
+				case 'wax':
+					$type = 'audio/x-ms-wax';
+					break;
+
+				case 'wma':
+					$type = 'audio/x-ms-wma';
+					break;
+
+				// Video mime-types
+				case '3gp':
+				case '3gpp':
+					$type = 'video/3gpp';
+					break;
+
+				case '3g2':
+				case '3gp2':
+					$type = 'video/3gpp2';
+					break;
+
+				case 'asf':
+					$type = 'video/x-ms-asf';
+					break;
+
+				case 'flv':
+					$type = 'video/x-flv';
+					break;
+
+				case 'm1a':
+				case 'm1s':
+				case 'm1v':
+				case 'm15':
+				case 'm75':
+				case 'mp2':
+				case 'mpa':
+				case 'mpeg':
+				case 'mpg':
+				case 'mpm':
+				case 'mpv':
+					$type = 'video/mpeg';
+					break;
+
+				case 'm4v':
+					$type = 'video/x-m4v';
+					break;
+
+				case 'mov':
+				case 'qt':
+					$type = 'video/quicktime';
+					break;
+
+				case 'mp4':
+				case 'mpg4':
+					$type = 'video/mp4';
+					break;
+
+				case 'sdv':
+					$type = 'video/sd-video';
+					break;
+
+				case 'wm':
+					$type = 'video/x-ms-wm';
+					break;
+
+				case 'wmv':
+					$type = 'video/x-ms-wmv';
+					break;
+
+				case 'wvx':
+					$type = 'video/x-ms-wvx';
+					break;
+
+				// Flash mime-types
+				case 'spl':
+					$type = 'application/futuresplash';
+					break;
+
+				case 'swf':
+					$type = 'application/x-shockwave-flash';
+					break;
+			}
+		}
+
+		if ($find_handler)
+		{
+			if (in_array($type, $types_flash))
+			{
+				return 'flash';
+			}
+			elseif (in_array($type, $types_fmedia))
+			{
+				return 'fmedia';
+			}
+			elseif (in_array($type, $types_quicktime))
+			{
+				return 'quicktime';
+			}
+			elseif (in_array($type, $types_wmedia))
+			{
+				return 'wmedia';
+			}
+			elseif (in_array($type, $types_mp3))
+			{
+				return 'mp3';
+			}
+			else
+			{
+				return null;
+			}
+		}
+		else
+		{
+			return $type;
+		}
+	}
+}
+
+class SimplePie_Caption
+{
+	var $type;
+	var $lang;
+	var $startTime;
+	var $endTime;
+	var $text;
+
+	// Constructor, used to input the data
+	function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
+	{
+		$this->type = $type;
+		$this->lang = $lang;
+		$this->startTime = $startTime;
+		$this->endTime = $endTime;
+		$this->text = $text;
+	}
+
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_endtime()
+	{
+		if ($this->endTime !== null)
+		{
+			return $this->endTime;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_language()
+	{
+		if ($this->lang !== null)
+		{
+			return $this->lang;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_starttime()
+	{
+		if ($this->startTime !== null)
+		{
+			return $this->startTime;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_text()
+	{
+		if ($this->text !== null)
+		{
+			return $this->text;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_type()
+	{
+		if ($this->type !== null)
+		{
+			return $this->type;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
+class SimplePie_Credit
+{
+	var $role;
+	var $scheme;
+	var $name;
+
+	// Constructor, used to input the data
+	function SimplePie_Credit($role = null, $scheme = null, $name = null)
+	{
+		$this->role = $role;
+		$this->scheme = $scheme;
+		$this->name = $name;
+	}
+
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_role()
+	{
+		if ($this->role !== null)
+		{
+			return $this->role;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_scheme()
+	{
+		if ($this->scheme !== null)
+		{
+			return $this->scheme;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_name()
+	{
+		if ($this->name !== null)
+		{
+			return $this->name;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
+class SimplePie_Copyright
+{
+	var $url;
+	var $label;
+
+	// Constructor, used to input the data
+	function SimplePie_Copyright($url = null, $label = null)
+	{
+		$this->url = $url;
+		$this->label = $label;
+	}
+
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_url()
+	{
+		if ($this->url !== null)
+		{
+			return $this->url;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_attribution()
+	{
+		if ($this->label !== null)
+		{
+			return $this->label;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
+class SimplePie_Rating
+{
+	var $scheme;
+	var $value;
+
+	// Constructor, used to input the data
+	function SimplePie_Rating($scheme = null, $value = null)
+	{
+		$this->scheme = $scheme;
+		$this->value = $value;
+	}
+
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_scheme()
+	{
+		if ($this->scheme !== null)
+		{
+			return $this->scheme;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_value()
+	{
+		if ($this->value !== null)
+		{
+			return $this->value;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
+class SimplePie_Restriction
+{
+	var $relationship;
+	var $type;
+	var $value;
+
+	// Constructor, used to input the data
+	function SimplePie_Restriction($relationship = null, $type = null, $value = null)
+	{
+		$this->relationship = $relationship;
+		$this->type = $type;
+		$this->value = $value;
+	}
+
+	function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	function get_relationship()
+	{
+		if ($this->relationship !== null)
+		{
+			return $this->relationship;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_type()
+	{
+		if ($this->type !== null)
+		{
+			return $this->type;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	function get_value()
+	{
+		if ($this->value !== null)
+		{
+			return $this->value;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
+/**
+ * @todo Move to properly supporting RFC2616 (HTTP/1.1)
+ */
+class SimplePie_File
+{
+	var $url;
+	var $useragent;
+	var $success = true;
+	var $headers = array();
+	var $body;
+	var $status_code;
+	var $redirects = 0;
+	var $error;
+	var $method = SIMPLEPIE_FILE_SOURCE_NONE;
+
+	function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
+	{
+		if (class_exists('idna_convert'))
+		{
+			$idn = new idna_convert;
+			$parsed = SimplePie_Misc::parse_url($url);
+			$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+		}
+		$this->url = $url;
+		$this->useragent = $useragent;
+		if (preg_match('/^http(s)?:\/\//i', $url))
+		{
+			if ($useragent === null)
+			{
+				$useragent = ini_get('user_agent');
+				$this->useragent = $useragent;
+			}
+			if (!is_array($headers))
+			{
+				$headers = array();
+			}
+			if (!$force_fsockopen && function_exists('curl_exec'))
+			{
+				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
+				$fp = curl_init();
+				$headers2 = array();
+				foreach ($headers as $key => $value)
+				{
+					$headers2[] = "$key: $value";
+				}
+				if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
+				{
+					curl_setopt($fp, CURLOPT_ENCODING, '');
+				}
+				curl_setopt($fp, CURLOPT_URL, $url);
+				curl_setopt($fp, CURLOPT_HEADER, 1);
+				curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
+				curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
+				curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
+				curl_setopt($fp, CURLOPT_REFERER, $url);
+				curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
+				curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
+				if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
+				{
+					curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
+					curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
+				}
+
+				$this->headers = curl_exec($fp);
+				if (curl_errno($fp) === 23 || curl_errno($fp) === 61)
+				{
+					curl_setopt($fp, CURLOPT_ENCODING, 'none');
+					$this->headers = curl_exec($fp);
+				}
+				if (curl_errno($fp))
+				{
+					$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
+					$this->success = false;
+				}
+				else
+				{
+					$info = curl_getinfo($fp);
+					curl_close($fp);
+					$this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
+					$this->headers = array_pop($this->headers);
+					$parser = new SimplePie_HTTP_Parser($this->headers);
+					if ($parser->parse())
+					{
+						$this->headers = $parser->headers;
+						$this->body = $parser->body;
+						$this->status_code = $parser->status_code;
+						if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
+						{
+							$this->redirects++;
+							$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
+							return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
+						}
+					}
+				}
+			}
+			else
+			{
+				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
+				$url_parts = parse_url($url);
+				if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https')
+				{
+					$url_parts['host'] = "ssl://$url_parts[host]";
+					$url_parts['port'] = 443;
+				}
+				if (!isset($url_parts['port']))
+				{
+					$url_parts['port'] = 80;
+				}
+				$fp = @fsockopen($url_parts['host'], $url_parts['port'], $errno, $errstr, $timeout);
+				if (!$fp)
+				{
+					$this->error = 'fsockopen error: ' . $errstr;
+					$this->success = false;
+				}
+				else
+				{
+					stream_set_timeout($fp, $timeout);
+					if (isset($url_parts['path']))
+					{
+						if (isset($url_parts['query']))
+						{
+							$get = "$url_parts[path]?$url_parts[query]";
+						}
+						else
+						{
+							$get = $url_parts['path'];
+						}
+					}
+					else
+					{
+						$get = '/';
+					}
+					$out = "GET $get HTTP/1.0\r\n";
+					$out .= "Host: $url_parts[host]\r\n";
+					$out .= "User-Agent: $useragent\r\n";
+					if (extension_loaded('zlib'))
+					{
+						$out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n";
+					}
+
+					if (isset($url_parts['user']) && isset($url_parts['pass']))
+					{
+						$out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
+					}
+					foreach ($headers as $key => $value)
+					{
+						$out .= "$key: $value\r\n";
+					}
+					$out .= "Connection: Close\r\n\r\n";
+					fwrite($fp, $out);
+
+					$info = stream_get_meta_data($fp);
+
+					$this->headers = '';
+					while (!$info['eof'] && !$info['timed_out'])
+					{
+						$this->headers .= fread($fp, 1160);
+						$info = stream_get_meta_data($fp);
+					}
+					if (!$info['timed_out'])
+					{
+						$parser = new SimplePie_HTTP_Parser($this->headers);
+						if ($parser->parse())
+						{
+							$this->headers = $parser->headers;
+							$this->body = $parser->body;
+							$this->status_code = $parser->status_code;
+							if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
+							{
+								$this->redirects++;
+								$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
+								return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
+							}
+							if (isset($this->headers['content-encoding']))
+							{
+								// Hey, we act dumb elsewhere, so let's do that here too
+								switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20")))
+								{
+									case 'gzip':
+									case 'x-gzip':
+										$decoder = new SimplePie_gzdecode($this->body);
+										if (!$decoder->parse())
+										{
+											$this->error = 'Unable to decode HTTP "gzip" stream';
+											$this->success = false;
+										}
+										else
+										{
+											$this->body = $decoder->data;
+										}
+										break;
+
+									case 'deflate':
+										if (($body = gzuncompress($this->body)) === false)
+										{
+											if (($body = gzinflate($this->body)) === false)
+											{
+												$this->error = 'Unable to decode HTTP "deflate" stream';
+												$this->success = false;
+											}
+										}
+										$this->body = $body;
+										break;
+
+									default:
+										$this->error = 'Unknown content coding';
+										$this->success = false;
+								}
+							}
+						}
+					}
+					else
+					{
+						$this->error = 'fsocket timed out';
+						$this->success = false;
+					}
+					fclose($fp);
+				}
+			}
+		}
+		else
+		{
+			$this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
+			if (!$this->body = file_get_contents($url))
+			{
+				$this->error = 'file_get_contents could not read the file';
+				$this->success = false;
+			}
+		}
+	}
+}
+
+/**
+ * HTTP Response Parser
+ *
+ * @package SimplePie
+ */
+class SimplePie_HTTP_Parser
+{
+	/**
+	 * HTTP Version
+	 *
+	 * @access public
+	 * @var float
+	 */
+	var $http_version = 0.0;
+
+	/**
+	 * Status code
+	 *
+	 * @access public
+	 * @var int
+	 */
+	var $status_code = 0;
+
+	/**
+	 * Reason phrase
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $reason = '';
+
+	/**
+	 * Key/value pairs of the headers
+	 *
+	 * @access public
+	 * @var array
+	 */
+	var $headers = array();
+
+	/**
+	 * Body of the response
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $body = '';
 
 	/**
 	 * Current state of the state machine
@@ -6794,7 +7912,7 @@
 	 * @access private
 	 * @var string
 	 */
-	var $state = 'start';
+	var $state = 'http_version';
 
 	/**
 	 * Input data
@@ -6815,8 +7933,8 @@
 	/**
 	 * Current position of the pointer
 	 *
-	 * @access private
 	 * @var int
+	 * @access private
 	 */
 	var $position = 0;
 
@@ -6856,13 +7974,13 @@
 	 */
 	function parse()
 	{
-		while ($this->state && $this->state != 'emit' && $this->has_data())
+		while ($this->state && $this->state !== 'emit' && $this->has_data())
 		{
 			$state = $this->state;
 			$this->$state();
 		}
 		$this->data = '';
-		if ($this->state == 'emit')
+		if ($this->state === 'emit' || $this->state === 'body')
 		{
 			return true;
 		}
@@ -6870,6 +7988,7 @@
 		{
 			$this->http_version = '';
 			$this->status_code = '';
+			$this->reason = '';
 			$this->headers = array();
 			$this->body = '';
 			return false;
@@ -6895,92 +8014,133 @@
 	 */
 	function is_linear_whitespace()
 	{
-		return (bool) (strspn($this->data, "\x09\x20", $this->position, 1)
-			|| (substr($this->data, $this->position, 2) == "\r\n" && strspn($this->data, "\x09\x20", $this->position + 2, 1))
-			|| (strspn($this->data, "\r\n", $this->position, 1) && strspn($this->data, "\x09\x20", $this->position + 1, 1)));
+		return (bool) ($this->data[$this->position] === "\x09"
+			|| $this->data[$this->position] === "\x20"
+			|| ($this->data[$this->position] === "\x0A"
+				&& isset($this->data[$this->position + 1])
+				&& ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
 	}
 
 	/**
-	 * The starting state of the state machine, see if the data is a response or request
+	 * Parse the HTTP version
 	 *
 	 * @access private
 	 */
-	function start()
+	function http_version()
 	{
-		$this->state = 'http_version_response';
+		if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/')
+		{
+			$len = strspn($this->data, '0123456789.', 5);
+			$this->http_version = substr($this->data, 5, $len);
+			$this->position += 5 + $len;
+			if (substr_count($this->http_version, '.') <= 1)
+			{
+				$this->http_version = (float) $this->http_version;
+				$this->position += strspn($this->data, "\x09\x20", $this->position);
+				$this->state = 'status';
+			}
+			else
+			{
+				$this->state = false;
+			}
+		}
+		else
+		{
+			$this->state = false;
+		}
 	}
 
 	/**
-	 * Parse an HTTP-version string
+	 * Parse the status code
 	 *
 	 * @access private
 	 */
-	function http_version()
+	function status()
 	{
-		if (preg_match('/^HTTP\/([0-9]+\.[0-9]+)/i', substr($this->data, $this->position, strcspn($this->data, "\r\n", $this->position)), $match))
+		if ($len = strspn($this->data, '0123456789', $this->position))
 		{
-			$this->position += strlen($match[0]);
-			$this->http_version = $match[1];
-			return true;
+			$this->status_code = (int) substr($this->data, $this->position, $len);
+			$this->position += $len;
+			$this->state = 'reason';
 		}
 		else
 		{
-			return false;
+			$this->state = false;
 		}
 	}
 
 	/**
-	 * Parse LWS, replacing consecutive characters with a single space
+	 * Parse the reason phrase
 	 *
 	 * @access private
 	 */
-	function linear_whitespace()
+	function reason()
 	{
-		do
-		{
-			if (substr($this->data, $this->position, 2) == "\r\n")
-			{
-				$this->position += 2;
-			}
-			elseif (strspn($this->data, "\r\n", $this->position, 1))
-			{
-				$this->position++;
-			}
-			$this->position += strspn($this->data, "\x09\x20", $this->position);
-		} while ($this->is_linear_whitespace());
-		$this->value .= "\x20";
+		$len = strcspn($this->data, "\x0A", $this->position);
+		$this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20");
+		$this->position += $len + 1;
+		$this->state = 'new_line';
 	}
 
 	/**
-	 * Parse an HTTP-version string within a response
+	 * Deal with a new line, shifting data around as needed
 	 *
 	 * @access private
 	 */
-	function http_version_response()
+	function new_line()
 	{
-		if ($this->http_version() && $this->data[$this->position] == "\x20")
+		$this->value = trim($this->value, "\x0D\x20");
+		if ($this->name !== '' && $this->value !== '')
+		{
+			$this->name = strtolower($this->name);
+			if (isset($this->headers[$this->name]))
+			{
+				$this->headers[$this->name] .= ', ' . $this->value;
+			}
+			else
+			{
+				$this->headers[$this->name] = $this->value;
+			}
+		}
+		$this->name = '';
+		$this->value = '';
+		if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A")
+		{
+			$this->position += 2;
+			$this->state = 'body';
+		}
+		elseif ($this->data[$this->position] === "\x0A")
 		{
-			$this->state = 'status_code';
 			$this->position++;
+			$this->state = 'body';
 		}
 		else
 		{
-			$this->state = false;
+			$this->state = 'name';
 		}
 	}
 
 	/**
-	 * Parse a status code
+	 * Parse a header name
 	 *
 	 * @access private
 	 */
-	function status_code()
+	function name()
 	{
-		if (strspn($this->data, '1234567890', $this->position, 3) == 3)
+		$len = strcspn($this->data, "\x0A:", $this->position);
+		if (isset($this->data[$this->position + $len]))
 		{
-			$this->status_code = substr($this->data, $this->position, 3);
-			$this->state = 'reason_phrase';
-			$this->position += 3;
+			if ($this->data[$this->position + $len] === "\x0A")
+			{
+				$this->position += $len;
+				$this->state = 'new_line';
+			}
+			else
+			{
+				$this->name = substr($this->data, $this->position, $len);
+				$this->position += $len + 1;
+				$this->state = 'value';
+			}
 		}
 		else
 		{
@@ -6989,80 +8149,56 @@
 	}
 
 	/**
-	 * Skip over the reason phrase (it has no normative value, and you can send absolutely anything here)
+	 * Parse LWS, replacing consecutive LWS characters with a single space
 	 *
 	 * @access private
 	 */
-	function reason_phrase()
+	function linear_whitespace()
 	{
-		$len = strcspn($this->data, "\r\n", $this->position);
-		$this->reason = substr($this->data, $this->position, $len);
-		$this->position += $len;
-		if ($this->has_data())
+		do
 		{
-			if (substr($this->data, $this->position, 2) == "\r\n")
+			if (substr($this->data, $this->position, 2) === "\x0D\x0A")
 			{
 				$this->position += 2;
 			}
-			elseif (strspn($this->data, "\r\n", $this->position, 1))
+			elseif ($this->data[$this->position] === "\x0A")
 			{
 				$this->position++;
 			}
-			$this->state = 'name';
-		}
-	}
-
-	/**
-	 * Parse a header name
-	 *
-	 * @access private
-	 */
-	function name()
-	{
-		$len = strcspn($this->data, ':', $this->position);
-		$this->name = substr($this->data, $this->position, $len);
-		$this->position += $len;
-
-		if ($this->has_data() && $this->data[$this->position] == ':')
-		{
-			$this->state = 'value_next';
-			$this->position++;
-		}
-		else
-		{
-			$this->state = false;
-		}
+			$this->position += strspn($this->data, "\x09\x20", $this->position);
+		} while ($this->has_data() && $this->is_linear_whitespace());
+		$this->value .= "\x20";
 	}
 
 	/**
-	 * See what state to move the state machine to while within non-quoted header values
+	 * See what state to move to while within non-quoted header values
 	 *
 	 * @access private
 	 */
-	function value_next()
+	function value()
 	{
 		if ($this->is_linear_whitespace())
 		{
-			$this->state = 'value_linear_whitespace';
-		}
-		elseif ($this->data[$this->position] == '"')
-		{
-			$this->state = 'value_quote_next';
-			$this->position++;
-		}
-		elseif (substr($this->data, $this->position, 2) == "\r\n")
-		{
-			$this->state = 'end_crlf';
-			$this->position += 2;
-		}
-		elseif (strspn($this->data, "\r\n", $this->position, 1))
-		{
-			$this->state = 'end_crlf';
-			$this->position++;
+			$this->linear_whitespace();
 		}
 		else
 		{
-			$this->state = 'value_no_quote';
+			switch ($this->data[$this->position])
+			{
+				case '"':
+					$this->position++;
+					$this->state = 'quote';
+					break;
+
+				case "\x0A":
+					$this->position++;
+					$this->state = 'new_line';
+					break;
+
+				default:
+					$this->state = 'value_char';
+					break;
+			}
 		}
 	}
 
@@ -7071,52 +8207,46 @@
 	 *
 	 * @access private
 	 */
-	function value_no_quote()
+	function value_char()
 	{
-		$len = strcspn($this->data, "\x09\x20\r\n\"", $this->position);
+		$len = strcspn($this->data, "\x09\x20\x0A\"", $this->position);
 		$this->value .= substr($this->data, $this->position, $len);
-		$this->state = 'value_next';
 		$this->position += $len;
+		$this->state = 'value';
 	}
 
 	/**
-	 * Parse LWS outside quotes
-	 *
-	 * @access private
-	 */
-	function value_linear_whitespace()
-	{
-		$this->linear_whitespace();
-		$this->state = 'value_next';
-	}
-
-	/**
-	 * See what state to move the state machine to while within quoted header values
+	 * See what state to move to while within quoted header values
 	 *
 	 * @access private
 	 */
-	function value_quote_next()
+	function quote()
 	{
 		if ($this->is_linear_whitespace())
 		{
-			$this->state = 'value_linear_whitespace_quote';
+			$this->linear_whitespace();
 		}
 		else
 		{
 			switch ($this->data[$this->position])
 			{
 				case '"':
-					$this->state = 'value_next';
 					$this->position++;
+					$this->state = 'value';
+					break;
+
+				case "\x0A":
+					$this->position++;
+					$this->state = 'new_line';
 					break;
 
 				case '\\':
-					$this->state = 'value_quote_char';
 					$this->position++;
+					$this->state = 'quote_escaped';
 					break;
 
 				default:
-					$this->state = 'value_quote';
+					$this->state = 'quote_char';
 					break;
 			}
 		}
@@ -7127,12 +8257,12 @@
 	 *
 	 * @access private
 	 */
-	function value_quote()
+	function quote_char()
 	{
-		$len = strcspn($this->data, "\x09\x20\r\n\"\\", $this->position);
+		$len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position);
 		$this->value .= substr($this->data, $this->position, $len);
 		$this->position += $len;
-		$this->state = 'value_quote_next';
+		$this->state = 'value';
 	}
 
 	/**
@@ -7140,90 +8270,407 @@
 	 *
 	 * @access private
 	 */
-	function value_quote_char()
+	function quote_escaped()
 	{
 		$this->value .= $this->data[$this->position];
-		$this->state = 'value_quote_next';
 		$this->position++;
+		$this->state = 'quote';
+	}
+
+	/**
+	 * Parse the body
+	 *
+	 * @access private
+	 */
+	function body()
+	{
+		$this->body = substr($this->data, $this->position);
+		$this->state = 'emit';
 	}
+}
+
+/**
+ * gzdecode
+ *
+ * @package SimplePie
+ */
+class SimplePie_gzdecode
+{
+	/**
+	 * Compressed data
+	 *
+	 * @access private
+	 * @see gzdecode::$data
+	 */
+	var $compressed_data;
+
+	/**
+	 * Size of compressed data
+	 *
+	 * @access private
+	 */
+	var $compressed_size;
+
+	/**
+	 * Minimum size of a valid gzip string
+	 *
+	 * @access private
+	 */
+	var $min_compressed_size = 18;
+
+	/**
+	 * Current position of pointer
+	 *
+	 * @access private
+	 */
+	var $position = 0;
 
 	/**
-	 * Parse LWS within quotes
+	 * Flags (FLG)
 	 *
 	 * @access private
 	 */
-	function value_linear_whitespace_quote()
+	var $flags;
+
+	/**
+	 * Uncompressed data
+	 *
+	 * @access public
+	 * @see gzdecode::$compressed_data
+	 */
+	var $data;
+
+	/**
+	 * Modified time
+	 *
+	 * @access public
+	 */
+	var $MTIME;
+
+	/**
+	 * Extra Flags
+	 *
+	 * @access public
+	 */
+	var $XFL;
+
+	/**
+	 * Operating System
+	 *
+	 * @access public
+	 */
+	var $OS;
+
+	/**
+	 * Subfield ID 1
+	 *
+	 * @access public
+	 * @see gzdecode::$extra_field
+	 * @see gzdecode::$SI2
+	 */
+	var $SI1;
+
+	/**
+	 * Subfield ID 2
+	 *
+	 * @access public
+	 * @see gzdecode::$extra_field
+	 * @see gzdecode::$SI1
+	 */
+	var $SI2;
+
+	/**
+	 * Extra field content
+	 *
+	 * @access public
+	 * @see gzdecode::$SI1
+	 * @see gzdecode::$SI2
+	 */
+	var $extra_field;
+
+	/**
+	 * Original filename
+	 *
+	 * @access public
+	 */
+	var $filename;
+
+	/**
+	 * Human readable comment
+	 *
+	 * @access public
+	 */
+	var $comment;
+
+	/**
+	 * Don't allow anything to be set
+	 *
+	 * @access public
+	 */
+	function __set($name, $value)
+	{
+		trigger_error("Cannot write property $name", E_USER_ERROR);
+	}
+
+	/**
+	 * Set the compressed string and related properties
+	 *
+	 * @access public
+	 */
+	function SimplePie_gzdecode($data)
+	{
+		$this->compressed_data = $data;
+		$this->compressed_size = strlen($data);
+	}
+
+	/**
+	 * Decode the GZIP stream
+	 *
+	 * @access public
+	 */
+	function parse()
 	{
-		$this->linear_whitespace();
-		$this->state = 'value_quote_next';
+		if ($this->compressed_size >= $this->min_compressed_size)
+		{
+			// Check ID1, ID2, and CM
+			if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08")
+			{
+				return false;
+			}
+
+			// Get the FLG (FLaGs)
+			$this->flags = ord($this->compressed_data[3]);
+
+			// FLG bits above (1 << 4) are reserved
+			if ($this->flags > 0x1F)
+			{
+				return false;
+			}
+
+			// Advance the pointer after the above
+			$this->position += 4;
+
+			// MTIME
+			$mtime = substr($this->compressed_data, $this->position, 4);
+			// Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
+			if (current(unpack('S', "\x00\x01")) === 1)
+			{
+				$mtime = strrev($mtime);
+			}
+			$this->MTIME = current(unpack('l', $mtime));
+			$this->position += 4;
+
+			// Get the XFL (eXtra FLags)
+			$this->XFL = ord($this->compressed_data[$this->position++]);
+
+			// Get the OS (Operating System)
+			$this->OS = ord($this->compressed_data[$this->position++]);
+
+			// Parse the FEXTRA
+			if ($this->flags & 4)
+			{
+				// Read subfield IDs
+				$this->SI1 = $this->compressed_data[$this->position++];
+				$this->SI2 = $this->compressed_data[$this->position++];
+
+				// SI2 set to zero is reserved for future use
+				if ($this->SI2 === "\x00")
+				{
+					return false;
+				}
+
+				// Get the length of the extra field
+				$len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
+				$position += 2;
+
+				// Check the length of the string is still valid
+				$this->min_compressed_size += $len + 4;
+				if ($this->compressed_size >= $this->min_compressed_size)
+				{
+					// Set the extra field to the given data
+					$this->extra_field = substr($this->compressed_data, $this->position, $len);
+					$this->position += $len;
+				}
+				else
+				{
+					return false;
+				}
+			}
+
+			// Parse the FNAME
+			if ($this->flags & 8)
+			{
+				// Get the length of the filename
+				$len = strcspn($this->compressed_data, "\x00", $this->position);
+
+				// Check the length of the string is still valid
+				$this->min_compressed_size += $len + 1;
+				if ($this->compressed_size >= $this->min_compressed_size)
+				{
+					// Set the original filename to the given string
+					$this->filename = substr($this->compressed_data, $this->position, $len);
+					$this->position += $len + 1;
+				}
+				else
+				{
+					return false;
+				}
+			}
+
+			// Parse the FCOMMENT
+			if ($this->flags & 16)
+			{
+				// Get the length of the comment
+				$len = strcspn($this->compressed_data, "\x00", $this->position);
+
+				// Check the length of the string is still valid
+				$this->min_compressed_size += $len + 1;
+				if ($this->compressed_size >= $this->min_compressed_size)
+				{
+					// Set the original comment to the given string
+					$this->comment = substr($this->compressed_data, $this->position, $len);
+					$this->position += $len + 1;
+				}
+				else
+				{
+					return false;
+				}
+			}
+
+			// Parse the FHCRC
+			if ($this->flags & 2)
+			{
+				// Check the length of the string is still valid
+				$this->min_compressed_size += $len + 2;
+				if ($this->compressed_size >= $this->min_compressed_size)
+				{
+					// Read the CRC
+					$crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
+
+					// Check the CRC matches
+					if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
+					{
+						$this->position += 2;
+					}
+					else
+					{
+						return false;
+					}
+				}
+				else
+				{
+					return false;
+				}
+			}
+
+			// Decompress the actual data
+			if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
+			{
+				return false;
+			}
+			else
+			{
+				$this->position = $this->compressed_size - 8;
+			}
+
+			// Check CRC of data
+			$crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
+			$this->position += 4;
+			/*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
+			{
+				return false;
+			}*/
+
+			// Check ISIZE of data
+			$isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
+			$this->position += 4;
+			if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
+			{
+				return false;
+			}
+
+			// Wow, against all odds, we've actually got a valid gzip string
+			return true;
+		}
+		else
+		{
+			return false;
+		}
 	}
+}
 
+class SimplePie_Cache
+{
 	/**
-	 * Parse a CRLF, and see whether we have a further header, or whether we are followed by the body
+	 * Don't call the constructor. Please.
 	 *
 	 * @access private
 	 */
-	function end_crlf()
+	function SimplePie_Cache()
+	{
+		trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
+	}
+
+	/**
+	 * Create a new SimplePie_Cache object
+	 *
+	 * @static
+	 * @access public
+	 */
+	function create($location, $filename, $extension)
 	{
-		$this->name = strtolower($this->name);
-		$this->value = trim($this->value, "\x20");
-		if (isset($this->headers[$this->name]))
-		{
-			$this->headers[$this->name] .= ', ' . $this->value;
-		}
-		else
+		$location_iri = new SimplePie_IRI($location);
+		switch ($location_iri->get_scheme())
 		{
-			$this->headers[$this->name] = $this->value;
-		}
+			case 'mysql':
+				if (extension_loaded('mysql'))
+				{
+					return new SimplePie_Cache_MySQL($location_iri, $filename, $extension);
+				}
+				break;
 
-		if (substr($this->data, $this->position, 2) == "\r\n")
-		{
-			$this->body = substr($this->data, $this->position + 2);
-			$this->state = 'emit';
-		}
-		elseif (strspn($this->data, "\r\n", $this->position, 1))
-		{
-			$this->body = substr($this->data, $this->position + 1);
-			$this->state = 'emit';
-		}
-		else
-		{
-			$this->name = '';
-			$this->value = '';
-			$this->state = 'name';
+			default:
+				return new SimplePie_Cache_File($location, $filename, $extension);
 		}
 	}
 }
 
-class SimplePie_Cache
+class SimplePie_Cache_File
 {
 	var $location;
 	var $filename;
 	var $extension;
 	var $name;
 
-	function SimplePie_Cache($location, $filename, $extension)
+	function SimplePie_Cache_File($location, $filename, $extension)
 	{
 		$this->location = $location;
-		$this->filename = rawurlencode($filename);
-		$this->extension = rawurlencode($extension);
-		$this->name = "$location/$this->filename.$this->extension";
+		$this->filename = $filename;
+		$this->extension = $extension;
+		$this->name = "$this->location/$this->filename.$this->extension";
 	}
 
 	function save($data)
 	{
 		if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
 		{
+			if (is_a($data, 'SimplePie'))
+			{
+				$data = $data->data;
+			}
+
+			$data = serialize($data);
+
 			if (function_exists('file_put_contents'))
 			{
-				return (bool) file_put_contents($this->name, serialize($data));
+				return (bool) file_put_contents($this->name, $data);
 			}
 			else
 			{
 				$fp = fopen($this->name, 'wb');
 				if ($fp)
 				{
-					fwrite($fp, serialize($data));
+					fwrite($fp, $data);
 					fclose($fp);
 					return true;
 				}
@@ -7236,20 +8683,7 @@
 	{
 		if (file_exists($this->name) && is_readable($this->name))
 		{
-			if (function_exists('file_get_contents'))
-			{
-				return unserialize(file_get_contents($this->name));
-			}
-			elseif (($fp = fopen($this->name, 'rb')) !== false)
-			{
-				$data = '';
-				while (!feof($fp))
-				{
-					$data .= fread($fp, 8192);
-				}
-				fclose($fp);
-				return unserialize($data);
-			}
+			return unserialize(file_get_contents($this->name));
 		}
 		return false;
 	}
@@ -7282,121 +8716,398 @@
 	}
 }
 
-class SimplePie_Misc
+class SimplePie_Cache_DB
 {
-	function time_hms($seconds)
+	function prepare_simplepie_object_for_cache($data)
 	{
-		$time = '';
+		$items = $data->get_items();
+		$items_by_id = array();
 
-		$hours = floor($seconds / 3600);
-		$remainder = $seconds % 3600;
-		if ($hours > 0)
+		if (!empty($items))
 		{
-			$time .= $hours.':';
+			foreach ($items as $item)
+			{
+				$items_by_id[$item->get_id()] = $item;
+			}
+
+			if (count($items_by_id) !== count($items))
+			{
+				$items_by_id = array();
+				foreach ($items as $item)
+				{
+					$items_by_id[$item->get_id(true)] = $item;
+				}
+			}
+
+			if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
+			{
+				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
+			}
+			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
+			{
+				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
+			}
+			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
+			{
+				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
+			}
+			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
+			{
+				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
+			}
+			else
+			{
+				$channel = null;
+			}
+
+			if ($channel !== null)
+			{
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']);
+				}
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']);
+				}
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']);
+				}
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']);
+				}
+				if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']))
+				{
+					unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']);
+				}
+			}
+			if (isset($data->data['items']))
+			{
+				unset($data->data['items']);
+			}
+			if (isset($data->data['ordered_items']))
+			{
+				unset($data->data['ordered_items']);
+			}
 		}
+		return array(serialize($data->data), $items_by_id);
+	}
+}
 
-		$minutes = floor($remainder / 60);
-		$seconds = $remainder % 60;
-		if ($minutes < 10 && $hours > 0)
+class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
+{
+	var $mysql;
+	var $options;
+	var $id;
+
+	function SimplePie_Cache_MySQL($mysql_location, $name, $extension)
+	{
+		$host = $mysql_location->get_host();
+		if (SimplePie_Misc::stripos($host, 'unix(') === 0 && substr($host, -1) === ')')
 		{
-			$minutes = '0' . $minutes;
+			$server = ':' . substr($host, 5, -1);
 		}
-		if ($seconds < 10)
+		else
 		{
-			$seconds = '0' . $seconds;
+			$server = $host;
+			if ($mysql_location->get_port() !== null)
+			{
+				$server .= ':' . $mysql_location->get_port();
+			}
 		}
 
-		$time .= $minutes.':';
-		$time .= $seconds;
+		if (strpos($mysql_location->get_userinfo(), ':') !== false)
+		{
+			list($username, $password) = explode(':', $mysql_location->get_userinfo(), 2);
+		}
+		else
+		{
+			$username = $mysql_location->get_userinfo();
+			$password = null;
+		}
 
-		return $time;
+		if ($this->mysql = mysql_connect($server, $username, $password))
+		{
+			$this->id = $name . $extension;
+			$this->options = SimplePie_Misc::parse_str($mysql_location->get_query());
+			if (!isset($this->options['prefix'][0]))
+			{
+				$this->options['prefix'][0] = '';
+			}
+
+			if (mysql_select_db(ltrim($mysql_location->get_path(), '/'))
+				&& mysql_query('SET NAMES utf8')
+				&& ($query = mysql_unbuffered_query('SHOW TABLES')))
+			{
+				$db = array();
+				while ($row = mysql_fetch_row($query))
+				{
+					$db[] = $row[0];
+				}
+
+				if (!in_array($this->options['prefix'][0] . 'cache_data', $db))
+				{
+					if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'))
+					{
+						$this->mysql = null;
+					}
+				}
+
+				if (!in_array($this->options['prefix'][0] . 'items', $db))
+				{
+					if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'))
+					{
+						$this->mysql = null;
+					}
+				}
+			}
+			else
+			{
+				$this->mysql = null;
+			}
+		}
 	}
 
-	function absolutize_url($relative, $base)
+	function save($data)
 	{
-		if ($relative !== '')
+		if ($this->mysql)
 		{
-			$relative = SimplePie_Misc::parse_url($relative);
-			if ($relative['scheme'] !== '')
-			{
-				$target = $relative;
-			}
-			elseif ($base !== '')
+			$feed_id = "'" . mysql_real_escape_string($this->id) . "'";
+
+			if (is_a($data, 'SimplePie'))
 			{
-				$base = SimplePie_Misc::parse_url($base);
-				$target = SimplePie_Misc::parse_url('');
-				if ($relative['authority'] !== '')
+				if (SIMPLEPIE_PHP5)
 				{
-					$target = $relative;
-					$target['scheme'] = $base['scheme'];
+					// This keyword needs to defy coding standards for PHP4 compatibility
+					$data = clone($data);
 				}
-				else
+
+				$prepared = $this->prepare_simplepie_object_for_cache($data);
+
+				if ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql))
 				{
-					$target['scheme'] = $base['scheme'];
-					$target['authority'] = $base['authority'];
-					if ($relative['path'] !== '')
+					if (mysql_num_rows($query))
 					{
-						if (strpos($relative['path'], '/') === 0)
-						{
-							$target['path'] = $relative['path'];
-						}
-						elseif (($target['path'] = dirname("$base[path].")) == '/')
+						$items = count($prepared[1]);
+						if ($items)
 						{
-							$target['path'] .= $relative['path'];
+							$sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = ' . $items . ', `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id;
 						}
 						else
 						{
-							$target['path'] .= '/' . $relative['path'];
+							$sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id;
 						}
-						if ($relative['query'] !== '')
+
+						if (!mysql_query($sql, $this->mysql))
 						{
-							$target['query'] = $relative['query'];
+							return false;
 						}
 					}
-					else
+					elseif (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(' . $feed_id . ', ' . count($prepared[1]) . ', \'' . mysql_real_escape_string($prepared[0]) . '\', ' . time() . ')', $this->mysql))
 					{
-						if ($base['path'] !== '')
-						{
-							$target['path'] = $base['path'];
-						}
-						else
-						{
-							$target['path'] = '/';
-						}
-						if ($relative['query'] !== '')
+						return false;
+					}
+
+					$ids = array_keys($prepared[1]);
+					if (!empty($ids))
+					{
+						foreach ($ids as $id)
 						{
-							$target['query'] = $relative['query'];
+							$database_ids[] = mysql_real_escape_string($id);
 						}
-						elseif ($base['query'] !== '')
+
+						if ($query = mysql_unbuffered_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'items` WHERE `id` = \'' . implode('\' OR `id` = \'', $database_ids) . '\' AND `feed_id` = ' . $feed_id, $this->mysql))
 						{
-							$target['query'] = $base['query'];
+							$existing_ids = array();
+							while ($row = mysql_fetch_row($query))
+							{
+								$existing_ids[] = $row[0];
+							}
+
+							$new_ids = array_diff($ids, $existing_ids);
+
+							foreach ($new_ids as $new_id)
+							{
+								if (!($date = $prepared[1][$new_id]->get_date('U')))
+								{
+									$date = time();
+								}
+
+								if (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(' . $feed_id . ', \'' . mysql_real_escape_string($new_id) . '\', \'' . mysql_real_escape_string(serialize($prepared[1][$new_id]->data)) . '\', ' . $date . ')', $this->mysql))
+								{
+									return false;
+								}
+							}
+							return true;
 						}
 					}
+					else
+					{
+						return true;
+					}
+				}
+			}
+			elseif ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql))
+			{
+				if (mysql_num_rows($query))
+				{
+					if (mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = 0, `data` = \'' . mysql_real_escape_string(serialize($data)) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id, $this->mysql))
+					{
+						return true;
+					}
 				}
-				if ($relative['fragment'] !== '')
+				elseif (mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(\'' . mysql_real_escape_string($this->id) . '\', 0, \'' . mysql_real_escape_string(serialize($data)) . '\', ' . time() . ')', $this->mysql))
 				{
-					$target['fragment'] = $relative['fragment'];
+					return true;
 				}
 			}
+		}
+		return false;
+	}
+
+	function load()
+	{
+		if ($this->mysql && ($query = mysql_query('SELECT `items`, `data` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query)))
+		{
+			$data = unserialize($row[1]);
+
+			if (isset($this->options['items'][0]))
+			{
+				$items = (int) $this->options['items'][0];
+			}
 			else
 			{
-				// No base URL, just return the relative URL
-				$target = $relative;
+				$items = (int) $row[0];
+			}
+
+			if ($items !== 0)
+			{
+				if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
+				{
+					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
+				}
+				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
+				{
+					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
+				}
+				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
+				{
+					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
+				}
+				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]))
+				{
+					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0];
+				}
+				else
+				{
+					$feed = null;
+				}
+
+				if ($feed !== null)
+				{
+					$sql = 'SELECT `data` FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . '\' ORDER BY `posted` DESC';
+					if ($items > 0)
+					{
+						$sql .= ' LIMIT ' . $items;
+					}
+
+					if ($query = mysql_unbuffered_query($sql, $this->mysql))
+					{
+						while ($row = mysql_fetch_row($query))
+						{
+							$feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row[0]);
+						}
+					}
+					else
+					{
+						return false;
+					}
+				}
 			}
-			$return = SimplePie_Misc::compress_parse_url($target['scheme'], $target['authority'], $target['path'], $target['query'], $target['fragment']);
+			return $data;
+		}
+		return false;
+	}
+
+	function mtime()
+	{
+		if ($this->mysql && ($query = mysql_query('SELECT `mtime` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query)))
+		{
+			return $row[0];
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	function touch()
+	{
+		if ($this->mysql && ($query = mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `mtime` = ' . time() . ' WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && mysql_affected_rows($this->mysql))
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	function unlink()
+	{
+		if ($this->mysql && ($query = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($query2 = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)))
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+}
+
+class SimplePie_Misc
+{
+	function time_hms($seconds)
+	{
+		$time = '';
+
+		$hours = floor($seconds / 3600);
+		$remainder = $seconds % 3600;
+		if ($hours > 0)
+		{
+			$time .= $hours.':';
 		}
-		else
+
+		$minutes = floor($remainder / 60);
+		$seconds = $remainder % 60;
+		if ($minutes < 10 && $hours > 0)
 		{
-			$return = $base;
+			$minutes = '0' . $minutes;
 		}
-		$return = SimplePie_Misc::normalize_url($return);
-		return $return;
+		if ($seconds < 10)
+		{
+			$seconds = '0' . $seconds;
+		}
+
+		$time .= $minutes.':';
+		$time .= $seconds;
+
+		return $time;
+	}
+
+	function absolutize_url($relative, $base)
+	{
+		$iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
+		return $iri->get_iri();
 	}
 
 	function remove_dot_segments($input)
 	{
 		$output = '';
-		while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input == '.' || $input == '..')
+		while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
 		{
 			// A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
 			if (strpos($input, '../') === 0)
@@ -7412,7 +9123,7 @@
 			{
 				$input = substr_replace($input, '/', 0, 3);
 			}
-			elseif ($input == '/.')
+			elseif ($input === '/.')
 			{
 				$input = '/';
 			}
@@ -7422,13 +9133,13 @@
 				$input = substr_replace($input, '/', 0, 4);
 				$output = substr_replace($output, '', strrpos($output, '/'));
 			}
-			elseif ($input == '/..')
+			elseif ($input === '/..')
 			{
 				$input = '/';
 				$output = substr_replace($output, '', strrpos($output, '/'));
 			}
 			// D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
-			elseif ($input == '.' || $input == '..')
+			elseif ($input === '.' || $input === '..')
 			{
 				$input = '';
 			}
@@ -7468,11 +9179,11 @@
 					$return[$i]['content'] = $matches[$i][4][0];
 				}
 				$return[$i]['attribs'] = array();
-				if (isset($matches[$i][2][0]) && preg_match_all('/((?:[^\s:]+:)?[^\s:]+)(?:\s*=\s*(?:"([^"]*)"|\'([^\']*)\'|([a-z0-9\-._:]*)))?\s/U', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER))
+				if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER))
 				{
 					for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
 					{
-						if (count($attribs[$j]) == 2)
+						if (count($attribs[$j]) === 2)
 						{
 							$attribs[$j][2] = $attribs[$j][1];
 						}
@@ -7505,22 +9216,25 @@
 
 	function error($message, $level, $file, $line)
 	{
-		switch ($level)
+		if ((ini_get('error_reporting') & $level) > 0)
 		{
-			case E_USER_ERROR:
-				$note = 'PHP Error';
-				break;
-			case E_USER_WARNING:
-				$note = 'PHP Warning';
-				break;
-			case E_USER_NOTICE:
-				$note = 'PHP Notice';
-				break;
-			default:
-				$note = 'Unknown Error';
-				break;
+			switch ($level)
+			{
+				case E_USER_ERROR:
+					$note = 'PHP Error';
+					break;
+				case E_USER_WARNING:
+					$note = 'PHP Warning';
+					break;
+				case E_USER_NOTICE:
+					$note = 'PHP Notice';
+					break;
+				default:
+					$note = 'Unknown Error';
+					break;
+			}
+			error_log("$note: $message in $file on line $line", 0);
 		}
-		error_log("$note: $message in $file on line $line", 0);
 		return $message;
 	}
 
@@ -7543,16 +9257,23 @@
 	 * @param str $cache_class Name of the cache-handling class being used
 	 * in SimplePie.  Defaults to 'SimplePie_Cache', and should be left
 	 * as-is unless you've overloaded the class.
-	 * @param str $cache_name_function Function that converts the filename
-	 * for saving.  Defaults to 'md5'.
+	 * @param str $cache_name_function Obsolete. Exists for backwards
+	 * compatibility reasons only.
 	 */
 	function display_cached_file($identifier_url, $cache_location = './cache', $cache_extension = 'spc', $cache_class = 'SimplePie_Cache', $cache_name_function = 'md5')
 	{
-		$cache =& new $cache_class($cache_location, call_user_func($cache_name_function, $identifier_url), $cache_extension);
+		$cache = call_user_func(array($cache_class, 'create'), $cache_location, $identifier_url, $cache_extension);
 
 		if ($file = $cache->load())
 		{
-			header('Content-type:' . $file['headers']['content-type']);
+			if (isset($file['headers']['content-type']))
+			{
+				header('Content-type:' . $file['headers']['content-type']);
+			}
+			else
+			{
+				header('Content-type: application/octet-stream');
+			}
 			header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
 			echo $file['body'];
 			exit;
@@ -7565,7 +9286,7 @@
 	{
 		$url = SimplePie_Misc::normalize_url($url);
 		$parsed = SimplePie_Misc::parse_url($url);
-		if ($parsed['scheme'] !== '' && $parsed['scheme'] != 'http' && $parsed['scheme'] != 'https')
+		if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https')
 		{
 			return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
 		}
@@ -7575,15 +9296,15 @@
 			return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
 		}
 
-		if ($http == 2 && $parsed['scheme'] !== '')
+		if ($http === 2 && $parsed['scheme'] !== '')
 		{
 			return "feed:$url";
 		}
-		elseif ($http == 3 && strtolower($parsed['scheme']) == 'http')
+		elseif ($http === 3 && strtolower($parsed['scheme']) === 'http')
 		{
 			return substr_replace($url, 'podcast', 0, 4);
 		}
-		elseif ($http == 4 && strtolower($parsed['scheme']) == 'http')
+		elseif ($http === 4 && strtolower($parsed['scheme']) === 'http')
 		{
 			return substr_replace($url, 'itpc', 0, 4);
 		}
@@ -7595,68 +9316,37 @@
 
 	function parse_url($url)
 	{
-		static $cache = array();
-		if (isset($cache[$url]))
-		{
-			return $cache[$url];
-		}
-		elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match))
-		{
-			for ($i = count($match); $i <= 9; $i++)
-			{
-				$match[$i] = '';
-			}
-			return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
-		}
-		else
-		{
-			return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '');
-		}
+		$iri = new SimplePie_IRI($url);
+		return array(
+			'scheme' => (string) $iri->get_scheme(),
+			'authority' => (string) $iri->get_authority(),
+			'path' => (string) $iri->get_path(),
+			'query' => (string) $iri->get_query(),
+			'fragment' => (string) $iri->get_fragment()
+		);
 	}
 
 	function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
 	{
-		$return = '';
-		if ($scheme !== '')
-		{
-			$return .= "$scheme:";
-		}
-		if ($authority !== '')
-		{
-			$return .= "//$authority";
-		}
-		if ($path !== '')
-		{
-			$return .= $path;
-		}
-		if ($query !== '')
-		{
-			$return .= "?$query";
-		}
-		if ($fragment !== '')
-		{
-			$return .= "#$fragment";
-		}
-		return $return;
+		$iri = new SimplePie_IRI('');
+		$iri->set_scheme($scheme);
+		$iri->set_authority($authority);
+		$iri->set_path($path);
+		$iri->set_query($query);
+		$iri->set_fragment($fragment);
+		return $iri->get_iri();
 	}
 
 	function normalize_url($url)
 	{
-		$url = preg_replace_callback('/%([0-9A-Fa-f]{2})/', array('SimplePie_Misc', 'percent_encoding_normalization'), $url);
-		$url = SimplePie_Misc::parse_url($url);
-		$url['scheme'] = strtolower($url['scheme']);
-		if ($url['authority'] !== '')
-		{
-			$url['authority'] = strtolower($url['authority']);
-			$url['path'] = SimplePie_Misc::remove_dot_segments($url['path']);
-		}
-		return SimplePie_Misc::compress_parse_url($url['scheme'], $url['authority'], $url['path'], $url['query'], $url['fragment']);
+		$iri = new SimplePie_IRI($url);
+		return $iri->get_iri();
 	}
 
 	function percent_encoding_normalization($match)
 	{
 		$integer = hexdec($match[1]);
-		if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer == 0x2D || $integer == 0x2E || $integer == 0x5F || $integer == 0x7E)
+		if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E)
 		{
 			return chr($integer);
 		}
@@ -7679,15 +9369,15 @@
 	 */
 	function utf8_bad_replace($str)
 	{
-		if (function_exists('iconv'))
+		if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str)))
 		{
-			return iconv('UTF-8', 'UTF-8//IGNORE', $str);
+			return $return;
 		}
-		elseif (function_exists('mb_convert_encoding'))
+		elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8')))
 		{
-			return mb_convert_encoding($str, 'UTF-8', 'UTF-8');
+			return $return;
 		}
-		elseif (preg_match_all('/([\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})/', $str, $matches))
+		elseif (preg_match_all('/(?:[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+/', $str, $matches))
 		{
 			return implode("\xEF\xBF\xBD", $matches[0]);
 		}
@@ -7701,2120 +9391,4407 @@
 		}
 	}
 
+	/**
+	 * Converts a Windows-1252 encoded string to a UTF-8 encoded string
+	 *
+	 * @static
+	 * @access public
+	 * @param string $string Windows-1252 encoded string
+	 * @return string UTF-8 encoded string
+	 */
+	function windows_1252_to_utf8($string)
+	{
+		static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF");
+
+		return strtr($string, $convert_table);
+	}
+
 	function change_encoding($data, $input, $output)
 	{
 		$input = SimplePie_Misc::encoding($input);
 		$output = SimplePie_Misc::encoding($output);
 
-		if (function_exists('iconv') && ($return = @iconv($input, "$output//IGNORE", $data)))
-		{
-			return $return;
-		}
-		elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data)))
-		{
-			return $return;
-		}
-		elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($data, $output, $input)))
-		{
-			return $return;
-		}
-		elseif ($input == 'ISO-8859-1' && $output == 'UTF-8')
-		{
-			return utf8_encode($data);
-		}
-		elseif ($input == 'UTF-8' && $output == 'ISO-8859-1')
-		{
-			return utf8_decode($data);
-		}
-		return $data;
-	}
+		// We fail to fail on non US-ASCII bytes
+		if ($input === 'US-ASCII')
+		{
+			static $non_ascii_octects = '';
+			if (!$non_ascii_octects)
+			{
+				for ($i = 0x80; $i <= 0xFF; $i++)
+				{
+					$non_ascii_octects .= chr($i);
+				}
+			}
+			$data = substr($data, 0, strcspn($data, $non_ascii_octects));
+		}
+
+		// This is first, as behaviour of this is completely predictable
+		if ($input === 'Windows-1252' && $output === 'UTF-8')
+		{
+			return SimplePie_Misc::windows_1252_to_utf8($data);
+		}
+		// This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported).
+		elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input)))
+		{
+			return $return;
+		}
+		// This is last, as behaviour of this varies with OS userland and PHP version
+		elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data)))
+		{
+			return $return;
+		}
+		// If we can't do anything, just fail
+		else
+		{
+			return false;
+		}
+	}
+
+	function encoding($charset)
+	{
+		// Normalization from UTS #22
+		switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset)))
+		{
+			case 'adobestandardencoding':
+			case 'csadobestandardencoding':
+				return 'Adobe-Standard-Encoding';
+
+			case 'adobesymbolencoding':
+			case 'cshppsmath':
+				return 'Adobe-Symbol-Encoding';
+
+			case 'ami1251':
+			case 'amiga1251':
+				return 'Amiga-1251';
+
+			case 'ansix31101983':
+			case 'csat5001983':
+			case 'csiso99naplps':
+			case 'isoir99':
+			case 'naplps':
+				return 'ANSI_X3.110-1983';
+
+			case 'arabic7':
+			case 'asmo449':
+			case 'csiso89asmo449':
+			case 'iso9036':
+			case 'isoir89':
+				return 'ASMO_449';
+
+			case 'big5':
+			case 'csbig5':
+			case 'xxbig5':
+				return 'Big5';
+
+			case 'big5hkscs':
+				return 'Big5-HKSCS';
+
+			case 'bocu1':
+			case 'csbocu1':
+				return 'BOCU-1';
+
+			case 'brf':
+			case 'csbrf':
+				return 'BRF';
+
+			case 'bs4730':
+			case 'csiso4unitedkingdom':
+			case 'gb':
+			case 'iso646gb':
+			case 'isoir4':
+			case 'uk':
+				return 'BS_4730';
+
+			case 'bsviewdata':
+			case 'csiso47bsviewdata':
+			case 'isoir47':
+				return 'BS_viewdata';
+
+			case 'cesu8':
+			case 'cscesu8':
+				return 'CESU-8';
+
+			case 'ca':
+			case 'csa71':
+			case 'csaz243419851':
+			case 'csiso121canadian1':
+			case 'iso646ca':
+			case 'isoir121':
+				return 'CSA_Z243.4-1985-1';
+
+			case 'csa72':
+			case 'csaz243419852':
+			case 'csiso122canadian2':
+			case 'iso646ca2':
+			case 'isoir122':
+				return 'CSA_Z243.4-1985-2';
+
+			case 'csaz24341985gr':
+			case 'csiso123csaz24341985gr':
+			case 'isoir123':
+				return 'CSA_Z243.4-1985-gr';
+
+			case 'csiso139csn369103':
+			case 'csn369103':
+			case 'isoir139':
+				return 'CSN_369103';
+
+			case 'csdecmcs':
+			case 'dec':
+			case 'decmcs':
+				return 'DEC-MCS';
+
+			case 'csiso21german':
+			case 'de':
+			case 'din66003':
+			case 'iso646de':
+			case 'isoir21':
+				return 'DIN_66003';
+
+			case 'csdkus':
+			case 'dkus':
+				return 'dk-us';
+
+			case 'csiso646danish':
+			case 'dk':
+			case 'ds2089':
+			case 'iso646dk':
+				return 'DS_2089';
+
+			case 'csibmebcdicatde':
+			case 'ebcdicatde':
+				return 'EBCDIC-AT-DE';
+
+			case 'csebcdicatdea':
+			case 'ebcdicatdea':
+				return 'EBCDIC-AT-DE-A';
+
+			case 'csebcdiccafr':
+			case 'ebcdiccafr':
+				return 'EBCDIC-CA-FR';
+
+			case 'csebcdicdkno':
+			case 'ebcdicdkno':
+				return 'EBCDIC-DK-NO';
+
+			case 'csebcdicdknoa':
+			case 'ebcdicdknoa':
+				return 'EBCDIC-DK-NO-A';
+
+			case 'csebcdices':
+			case 'ebcdices':
+				return 'EBCDIC-ES';
+
+			case 'csebcdicesa':
+			case 'ebcdicesa':
+				return 'EBCDIC-ES-A';
+
+			case 'csebcdicess':
+			case 'ebcdicess':
+				return 'EBCDIC-ES-S';
+
+			case 'csebcdicfise':
+			case 'ebcdicfise':
+				return 'EBCDIC-FI-SE';
+
+			case 'csebcdicfisea':
+			case 'ebcdicfisea':
+				return 'EBCDIC-FI-SE-A';
+
+			case 'csebcdicfr':
+			case 'ebcdicfr':
+				return 'EBCDIC-FR';
+
+			case 'csebcdicit':
+			case 'ebcdicit':
+				return 'EBCDIC-IT';
+
+			case 'csebcdicpt':
+			case 'ebcdicpt':
+				return 'EBCDIC-PT';
+
+			case 'csebcdicuk':
+			case 'ebcdicuk':
+				return 'EBCDIC-UK';
+
+			case 'csebcdicus':
+			case 'ebcdicus':
+				return 'EBCDIC-US';
+
+			case 'csiso111ecmacyrillic':
+			case 'ecmacyrillic':
+			case 'isoir111':
+			case 'koi8e':
+				return 'ECMA-cyrillic';
+
+			case 'csiso17spanish':
+			case 'es':
+			case 'iso646es':
+			case 'isoir17':
+				return 'ES';
+
+			case 'csiso85spanish2':
+			case 'es2':
+			case 'iso646es2':
+			case 'isoir85':
+				return 'ES2';
+
+			case 'cseucfixwidjapanese':
+			case 'extendedunixcodefixedwidthforjapanese':
+				return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
+
+			case 'cseucpkdfmtjapanese':
+			case 'eucjp':
+			case 'extendedunixcodepackedformatforjapanese':
+				return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
+
+			case 'gb18030':
+				return 'GB18030';
+
+			case 'chinese':
+			case 'cp936':
+			case 'csgb2312':
+			case 'csiso58gb231280':
+			case 'gb2312':
+			case 'gb231280':
+			case 'gbk':
+			case 'isoir58':
+			case 'ms936':
+			case 'windows936':
+				return 'GBK';
+
+			case 'cn':
+			case 'csiso57gb1988':
+			case 'gb198880':
+			case 'iso646cn':
+			case 'isoir57':
+				return 'GB_1988-80';
+
+			case 'csiso153gost1976874':
+			case 'gost1976874':
+			case 'isoir153':
+			case 'stsev35888':
+				return 'GOST_19768-74';
+
+			case 'csiso150':
+			case 'csiso150greekccitt':
+			case 'greekccitt':
+			case 'isoir150':
+				return 'greek-ccitt';
+
+			case 'csiso88greek7':
+			case 'greek7':
+			case 'isoir88':
+				return 'greek7';
+
+			case 'csiso18greek7old':
+			case 'greek7old':
+			case 'isoir18':
+				return 'greek7-old';
+
+			case 'cshpdesktop':
+			case 'hpdesktop':
+				return 'HP-DeskTop';
+
+			case 'cshplegal':
+			case 'hplegal':
+				return 'HP-Legal';
+
+			case 'cshpmath8':
+			case 'hpmath8':
+				return 'HP-Math8';
+
+			case 'cshppifont':
+			case 'hppifont':
+				return 'HP-Pi-font';
+
+			case 'cshproman8':
+			case 'hproman8':
+			case 'r8':
+			case 'roman8':
+				return 'hp-roman8';
+
+			case 'hzgb2312':
+				return 'HZ-GB-2312';
+
+			case 'csibmsymbols':
+			case 'ibmsymbols':
+				return 'IBM-Symbols';
+
+			case 'csibmthai':
+			case 'ibmthai':
+				return 'IBM-Thai';
+
+			case 'ccsid858':
+			case 'cp858':
+			case 'ibm858':
+			case 'pcmultilingual850euro':
+				return 'IBM00858';
+
+			case 'ccsid924':
+			case 'cp924':
+			case 'ebcdiclatin9euro':
+			case 'ibm924':
+				return 'IBM00924';
+
+			case 'ccsid1140':
+			case 'cp1140':
+			case 'ebcdicus37euro':
+			case 'ibm1140':
+				return 'IBM01140';
+
+			case 'ccsid1141':
+			case 'cp1141':
+			case 'ebcdicde273euro':
+			case 'ibm1141':
+				return 'IBM01141';
+
+			case 'ccsid1142':
+			case 'cp1142':
+			case 'ebcdicdk277euro':
+			case 'ebcdicno277euro':
+			case 'ibm1142':
+				return 'IBM01142';
+
+			case 'ccsid1143':
+			case 'cp1143':
+			case 'ebcdicfi278euro':
+			case 'ebcdicse278euro':
+			case 'ibm1143':
+				return 'IBM01143';
+
+			case 'ccsid1144':
+			case 'cp1144':
+			case 'ebcdicit280euro':
+			case 'ibm1144':
+				return 'IBM01144';
+
+			case 'ccsid1145':
+			case 'cp1145':
+			case 'ebcdices284euro':
+			case 'ibm1145':
+				return 'IBM01145';
+
+			case 'ccsid1146':
+			case 'cp1146':
+			case 'ebcdicgb285euro':
+			case 'ibm1146':
+				return 'IBM01146';
+
+			case 'ccsid1147':
+			case 'cp1147':
+			case 'ebcdicfr297euro':
+			case 'ibm1147':
+				return 'IBM01147';
+
+			case 'ccsid1148':
+			case 'cp1148':
+			case 'ebcdicinternational500euro':
+			case 'ibm1148':
+				return 'IBM01148';
+
+			case 'ccsid1149':
+			case 'cp1149':
+			case 'ebcdicis871euro':
+			case 'ibm1149':
+				return 'IBM01149';
+
+			case 'cp37':
+			case 'csibm37':
+			case 'ebcdiccpca':
+			case 'ebcdiccpnl':
+			case 'ebcdiccpus':
+			case 'ebcdiccpwt':
+			case 'ibm37':
+				return 'IBM037';
+
+			case 'cp38':
+			case 'csibm38':
+			case 'ebcdicint':
+			case 'ibm38':
+				return 'IBM038';
+
+			case 'cp273':
+			case 'csibm273':
+			case 'ibm273':
+				return 'IBM273';
+
+			case 'cp274':
+			case 'csibm274':
+			case 'ebcdicbe':
+			case 'ibm274':
+				return 'IBM274';
+
+			case 'cp275':
+			case 'csibm275':
+			case 'ebcdicbr':
+			case 'ibm275':
+				return 'IBM275';
+
+			case 'csibm277':
+			case 'ebcdiccpdk':
+			case 'ebcdiccpno':
+			case 'ibm277':
+				return 'IBM277';
+
+			case 'cp278':
+			case 'csibm278':
+			case 'ebcdiccpfi':
+			case 'ebcdiccpse':
+			case 'ibm278':
+				return 'IBM278';
+
+			case 'cp280':
+			case 'csibm280':
+			case 'ebcdiccpit':
+			case 'ibm280':
+				return 'IBM280';
+
+			case 'cp281':
+			case 'csibm281':
+			case 'ebcdicjpe':
+			case 'ibm281':
+				return 'IBM281';
+
+			case 'cp284':
+			case 'csibm284':
+			case 'ebcdiccpes':
+			case 'ibm284':
+				return 'IBM284';
+
+			case 'cp285':
+			case 'csibm285':
+			case 'ebcdiccpgb':
+			case 'ibm285':
+				return 'IBM285';
+
+			case 'cp290':
+			case 'csibm290':
+			case 'ebcdicjpkana':
+			case 'ibm290':
+				return 'IBM290';
+
+			case 'cp297':
+			case 'csibm297':
+			case 'ebcdiccpfr':
+			case 'ibm297':
+				return 'IBM297';
+
+			case 'cp420':
+			case 'csibm420':
+			case 'ebcdiccpar1':
+			case 'ibm420':
+				return 'IBM420';
+
+			case 'cp423':
+			case 'csibm423':
+			case 'ebcdiccpgr':
+			case 'ibm423':
+				return 'IBM423';
 
-	function encoding($encoding)
-	{
-		// Character sets are case-insensitive (though we'll return them in the form given in their registration)
-		switch (strtoupper($encoding))
-		{
-			case 'ANSI_X3.4-1968':
-			case 'ISO-IR-6':
-			case 'ANSI_X3.4-1986':
-			case 'ISO_646.IRV:1991':
-			case 'ASCII':
-			case 'ISO646-US':
-			case 'US-ASCII':
-			case 'US':
-			case 'IBM367':
-			case 'CP367':
-			case 'CSASCII':
-				return 'US-ASCII';
+			case 'cp424':
+			case 'csibm424':
+			case 'ebcdiccphe':
+			case 'ibm424':
+				return 'IBM424';
 
-			case 'ISO_8859-1:1987':
-			case 'ISO-IR-100':
-			case 'ISO_8859-1':
-			case 'ISO-8859-1':
-			case 'LATIN1':
-			case 'L1':
-			case 'IBM819':
-			case 'CP819':
-			case 'CSISOLATIN1':
-				return 'ISO-8859-1';
-
-			case 'ISO_8859-2:1987':
-			case 'ISO-IR-101':
-			case 'ISO_8859-2':
-			case 'ISO-8859-2':
-			case 'LATIN2':
-			case 'L2':
-			case 'CSISOLATIN2':
-				return 'ISO-8859-2';
+			case '437':
+			case 'cp437':
+			case 'cspc8codepage437':
+			case 'ibm437':
+				return 'IBM437';
 
-			case 'ISO_8859-3:1988':
-			case 'ISO-IR-109':
-			case 'ISO_8859-3':
-			case 'ISO-8859-3':
-			case 'LATIN3':
-			case 'L3':
-			case 'CSISOLATIN3':
-				return 'ISO-8859-3';
+			case 'cp500':
+			case 'csibm500':
+			case 'ebcdiccpbe':
+			case 'ebcdiccpch':
+			case 'ibm500':
+				return 'IBM500';
 
-			case 'ISO_8859-4:1988':
-			case 'ISO-IR-110':
-			case 'ISO_8859-4':
-			case 'ISO-8859-4':
-			case 'LATIN4':
-			case 'L4':
-			case 'CSISOLATIN4':
-				return 'ISO-8859-4';
+			case 'cp775':
+			case 'cspc775baltic':
+			case 'ibm775':
+				return 'IBM775';
 
-			case 'ISO_8859-5:1988':
-			case 'ISO-IR-144':
-			case 'ISO_8859-5':
-			case 'ISO-8859-5':
-			case 'CYRILLIC':
-			case 'CSISOLATINCYRILLIC':
-				return 'ISO-8859-5';
+			case '850':
+			case 'cp850':
+			case 'cspc850multilingual':
+			case 'ibm850':
+				return 'IBM850';
 
-			case 'ISO_8859-6:1987':
-			case 'ISO-IR-127':
-			case 'ISO_8859-6':
-			case 'ISO-8859-6':
-			case 'ECMA-114':
-			case 'ASMO-708':
-			case 'ARABIC':
-			case 'CSISOLATINARABIC':
-				return 'ISO-8859-6';
+			case '851':
+			case 'cp851':
+			case 'csibm851':
+			case 'ibm851':
+				return 'IBM851';
 
-			case 'ISO_8859-7:1987':
-			case 'ISO-IR-126':
-			case 'ISO_8859-7':
-			case 'ISO-8859-7':
-			case 'ELOT_928':
-			case 'ECMA-118':
-			case 'GREEK':
-			case 'GREEK8':
-			case 'CSISOLATINGREEK':
-				return 'ISO-8859-7';
+			case '852':
+			case 'cp852':
+			case 'cspcp852':
+			case 'ibm852':
+				return 'IBM852';
 
-			case 'ISO_8859-8:1988':
-			case 'ISO-IR-138':
-			case 'ISO_8859-8':
-			case 'ISO-8859-8':
-			case 'HEBREW':
-			case 'CSISOLATINHEBREW':
-				return 'ISO-8859-8';
+			case '855':
+			case 'cp855':
+			case 'csibm855':
+			case 'ibm855':
+				return 'IBM855';
 
-			case 'ISO_8859-9:1989':
-			case 'ISO-IR-148':
-			case 'ISO_8859-9':
-			case 'ISO-8859-9':
-			case 'LATIN5':
-			case 'L5':
-			case 'CSISOLATIN5':
-				return 'ISO-8859-9';
-
-			case 'ISO-8859-10':
-			case 'ISO-IR-157':
-			case 'L6':
-			case 'ISO_8859-10:1992':
-			case 'CSISOLATIN6':
-			case 'LATIN6':
-				return 'ISO-8859-10';
+			case '857':
+			case 'cp857':
+			case 'csibm857':
+			case 'ibm857':
+				return 'IBM857';
 
-			case 'ISO_6937-2-ADD':
-			case 'ISO-IR-142':
-			case 'CSISOTEXTCOMM':
-				return 'ISO_6937-2-add';
+			case '860':
+			case 'cp860':
+			case 'csibm860':
+			case 'ibm860':
+				return 'IBM860';
 
-			case 'JIS_X0201':
-			case 'X0201':
-			case 'CSHALFWIDTHKATAKANA':
-				return 'JIS_X0201';
+			case '861':
+			case 'cp861':
+			case 'cpis':
+			case 'csibm861':
+			case 'ibm861':
+				return 'IBM861';
 
-			case 'JIS_ENCODING':
-			case 'CSJISENCODING':
-				return 'JIS_Encoding';
+			case '862':
+			case 'cp862':
+			case 'cspc862latinhebrew':
+			case 'ibm862':
+				return 'IBM862';
 
-			case 'SHIFT_JIS':
-			case 'MS_KANJI':
-			case 'CSSHIFTJIS':
-				return 'Shift_JIS';
+			case '863':
+			case 'cp863':
+			case 'csibm863':
+			case 'ibm863':
+				return 'IBM863';
 
-			case 'EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE':
-			case 'CSEUCPKDFMTJAPANESE':
-			case 'EUC-JP':
-				return 'EUC-JP';
+			case 'cp864':
+			case 'csibm864':
+			case 'ibm864':
+				return 'IBM864';
 
-			case 'EXTENDED_UNIX_CODE_FIXED_WIDTH_FOR_JAPANESE':
-			case 'CSEUCFIXWIDJAPANESE':
-				return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
+			case '865':
+			case 'cp865':
+			case 'csibm865':
+			case 'ibm865':
+				return 'IBM865';
 
-			case 'BS_4730':
-			case 'ISO-IR-4':
-			case 'ISO646-GB':
-			case 'GB':
-			case 'UK':
-			case 'CSISO4UNITEDKINGDOM':
-				return 'BS_4730';
+			case '866':
+			case 'cp866':
+			case 'csibm866':
+			case 'ibm866':
+				return 'IBM866';
 
-			case 'SEN_850200_C':
-			case 'ISO-IR-11':
-			case 'ISO646-SE2':
-			case 'SE2':
-			case 'CSISO11SWEDISHFORNAMES':
-				return 'SEN_850200_C';
+			case 'cp868':
+			case 'cpar':
+			case 'csibm868':
+			case 'ibm868':
+				return 'IBM868';
 
-			case 'IT':
-			case 'ISO-IR-15':
-			case 'ISO646-IT':
-			case 'CSISO15ITALIAN':
-				return 'IT';
+			case '869':
+			case 'cp869':
+			case 'cpgr':
+			case 'csibm869':
+			case 'ibm869':
+				return 'IBM869';
 
-			case 'ES':
-			case 'ISO-IR-17':
-			case 'ISO646-ES':
-			case 'CSISO17SPANISH':
-				return 'ES';
+			case 'cp870':
+			case 'csibm870':
+			case 'ebcdiccproece':
+			case 'ebcdiccpyu':
+			case 'ibm870':
+				return 'IBM870';
 
-			case 'DIN_66003':
-			case 'ISO-IR-21':
-			case 'DE':
-			case 'ISO646-DE':
-			case 'CSISO21GERMAN':
-				return 'DIN_66003';
+			case 'cp871':
+			case 'csibm871':
+			case 'ebcdiccpis':
+			case 'ibm871':
+				return 'IBM871';
 
-			case 'NS_4551-1':
-			case 'ISO-IR-60':
-			case 'ISO646-NO':
-			case 'NO':
-			case 'CSISO60DANISHNORWEGIAN':
-			case 'CSISO60NORWEGIAN1':
-				return 'NS_4551-1';
+			case 'cp880':
+			case 'csibm880':
+			case 'ebcdiccyrillic':
+			case 'ibm880':
+				return 'IBM880';
 
-			case 'NF_Z_62-010':
-			case 'ISO-IR-69':
-			case 'ISO646-FR':
-			case 'FR':
-			case 'CSISO69FRENCH':
-				return 'NF_Z_62-010';
+			case 'cp891':
+			case 'csibm891':
+			case 'ibm891':
+				return 'IBM891';
 
-			case 'ISO-10646-UTF-1':
-			case 'CSISO10646UTF1':
-				return 'ISO-10646-UTF-1';
+			case 'cp903':
+			case 'csibm903':
+			case 'ibm903':
+				return 'IBM903';
 
-			case 'ISO_646.BASIC:1983':
-			case 'REF':
-			case 'CSISO646BASIC1983':
-				return 'ISO_646.basic:1983';
+			case '904':
+			case 'cp904':
+			case 'csibbm904':
+			case 'ibm904':
+				return 'IBM904';
 
-			case 'INVARIANT':
-			case 'CSINVARIANT':
-				return 'INVARIANT';
+			case 'cp905':
+			case 'csibm905':
+			case 'ebcdiccptr':
+			case 'ibm905':
+				return 'IBM905';
 
-			case 'ISO_646.IRV:1983':
-			case 'ISO-IR-2':
-			case 'IRV':
-			case 'CSISO2INTLREFVERSION':
-				return 'ISO_646.irv:1983';
+			case 'cp918':
+			case 'csibm918':
+			case 'ebcdiccpar2':
+			case 'ibm918':
+				return 'IBM918';
 
-			case 'NATS-SEFI':
-			case 'ISO-IR-8-1':
-			case 'CSNATSSEFI':
-				return 'NATS-SEFI';
+			case 'cp1026':
+			case 'csibm1026':
+			case 'ibm1026':
+				return 'IBM1026';
 
-			case 'NATS-SEFI-ADD':
-			case 'ISO-IR-8-2':
-			case 'CSNATSSEFIADD':
-				return 'NATS-SEFI-ADD';
+			case 'ibm1047':
+				return 'IBM1047';
 
-			case 'NATS-DANO':
-			case 'ISO-IR-9-1':
-			case 'CSNATSDANO':
-				return 'NATS-DANO';
+			case 'csiso143iecp271':
+			case 'iecp271':
+			case 'isoir143':
+				return 'IEC_P27-1';
 
-			case 'NATS-DANO-ADD':
-			case 'ISO-IR-9-2':
-			case 'CSNATSDANOADD':
-				return 'NATS-DANO-ADD';
+			case 'csiso49inis':
+			case 'inis':
+			case 'isoir49':
+				return 'INIS';
 
-			case 'SEN_850200_B':
-			case 'ISO-IR-10':
-			case 'FI':
-			case 'ISO646-FI':
-			case 'ISO646-SE':
-			case 'SE':
-			case 'CSISO10SWEDISH':
-				return 'SEN_850200_B';
+			case 'csiso50inis8':
+			case 'inis8':
+			case 'isoir50':
+				return 'INIS-8';
+
+			case 'csiso51iniscyrillic':
+			case 'iniscyrillic':
+			case 'isoir51':
+				return 'INIS-cyrillic';
 
-			case 'KS_C_5601-1987':
-			case 'ISO-IR-149':
-			case 'KS_C_5601-1989':
-			case 'KSC_5601':
-			case 'KOREAN':
-			case 'CSKSC56011987':
-				return 'KS_C_5601-1987';
+			case 'csinvariant':
+			case 'invariant':
+				return 'INVARIANT';
 
-			case 'ISO-2022-KR':
-			case 'CSISO2022KR':
-				return 'ISO-2022-KR';
+			case 'iso2022cn':
+				return 'ISO-2022-CN';
 
-			case 'EUC-KR':
-			case 'CSEUCKR':
-				return 'EUC-KR';
+			case 'iso2022cnext':
+				return 'ISO-2022-CN-EXT';
 
-			case 'ISO-2022-JP':
-			case 'CSISO2022JP':
+			case 'csiso2022jp':
+			case 'iso2022jp':
 				return 'ISO-2022-JP';
 
-			case 'ISO-2022-JP-2':
-			case 'CSISO2022JP2':
+			case 'csiso2022jp2':
+			case 'iso2022jp2':
 				return 'ISO-2022-JP-2';
 
-			case 'JIS_C6220-1969-JP':
-			case 'JIS_C6220-1969':
-			case 'ISO-IR-13':
-			case 'KATAKANA':
-			case 'X0201-7':
-			case 'CSISO13JISC6220JP':
-				return 'JIS_C6220-1969-jp';
+			case 'csiso2022kr':
+			case 'iso2022kr':
+				return 'ISO-2022-KR';
 
-			case 'JIS_C6220-1969-RO':
-			case 'ISO-IR-14':
-			case 'JP':
-			case 'ISO646-JP':
-			case 'CSISO14JISC6220RO':
-				return 'JIS_C6220-1969-ro';
+			case 'cswindows30latin1':
+			case 'iso88591windows30latin1':
+				return 'ISO-8859-1-Windows-3.0-Latin-1';
 
-			case 'PT':
-			case 'ISO-IR-16':
-			case 'ISO646-PT':
-			case 'CSISO16PORTUGUESE':
-				return 'PT';
+			case 'cswindows31latin1':
+			case 'iso88591windows31latin1':
+				return 'ISO-8859-1-Windows-3.1-Latin-1';
 
-			case 'GREEK7-OLD':
-			case 'ISO-IR-18':
-			case 'CSISO18GREEK7OLD':
-				return 'greek7-old';
+			case 'csisolatin2':
+			case 'iso88592':
+			case 'iso885921987':
+			case 'isoir101':
+			case 'l2':
+			case 'latin2':
+				return 'ISO-8859-2';
 
-			case 'LATIN-GREEK':
-			case 'ISO-IR-19':
-			case 'CSISO19LATINGREEK':
-				return 'latin-greek';
+			case 'cswindows31latin2':
+			case 'iso88592windowslatin2':
+				return 'ISO-8859-2-Windows-Latin-2';
 
-			case 'NF_Z_62-010_(1973)':
-			case 'ISO-IR-25':
-			case 'ISO646-FR1':
-			case 'CSISO25FRENCH':
-				return 'NF_Z_62-010_(1973)';
+			case 'csisolatin3':
+			case 'iso88593':
+			case 'iso885931988':
+			case 'isoir109':
+			case 'l3':
+			case 'latin3':
+				return 'ISO-8859-3';
 
-			case 'LATIN-GREEK-1':
-			case 'ISO-IR-27':
-			case 'CSISO27LATINGREEK1':
-				return 'Latin-greek-1';
+			case 'csisolatin4':
+			case 'iso88594':
+			case 'iso885941988':
+			case 'isoir110':
+			case 'l4':
+			case 'latin4':
+				return 'ISO-8859-4';
 
-			case 'ISO_5427':
-			case 'ISO-IR-37':
-			case 'CSISO5427CYRILLIC':
-				return 'ISO_5427';
+			case 'csisolatincyrillic':
+			case 'cyrillic':
+			case 'iso88595':
+			case 'iso885951988':
+			case 'isoir144':
+				return 'ISO-8859-5';
 
-			case 'JIS_C6226-1978':
-			case 'ISO-IR-42':
-			case 'CSISO42JISC62261978':
-				return 'JIS_C6226-1978';
+			case 'arabic':
+			case 'asmo708':
+			case 'csisolatinarabic':
+			case 'ecma114':
+			case 'iso88596':
+			case 'iso885961987':
+			case 'isoir127':
+				return 'ISO-8859-6';
 
-			case 'BS_VIEWDATA':
-			case 'ISO-IR-47':
-			case 'CSISO47BSVIEWDATA':
-				return 'BS_viewdata';
+			case 'csiso88596e':
+			case 'iso88596e':
+				return 'ISO-8859-6-E';
 
-			case 'INIS':
-			case 'ISO-IR-49':
-			case 'CSISO49INIS':
-				return 'INIS';
+			case 'csiso88596i':
+			case 'iso88596i':
+				return 'ISO-8859-6-I';
 
-			case 'INIS-8':
-			case 'ISO-IR-50':
-			case 'CSISO50INIS8':
-				return 'INIS-8';
+			case 'csisolatingreek':
+			case 'ecma118':
+			case 'elot928':
+			case 'greek':
+			case 'greek8':
+			case 'iso88597':
+			case 'iso885971987':
+			case 'isoir126':
+				return 'ISO-8859-7';
 
-			case 'INIS-CYRILLIC':
-			case 'ISO-IR-51':
-			case 'CSISO51INISCYRILLIC':
-				return 'INIS-cyrillic';
+			case 'csisolatinhebrew':
+			case 'hebrew':
+			case 'iso88598':
+			case 'iso885981988':
+			case 'isoir138':
+				return 'ISO-8859-8';
 
-			case 'ISO_5427:1981':
-			case 'ISO-IR-54':
-			case 'ISO5427CYRILLIC1981':
-				return 'ISO_5427:1981';
+			case 'csiso88598e':
+			case 'iso88598e':
+				return 'ISO-8859-8-E';
 
-			case 'ISO_5428:1980':
-			case 'ISO-IR-55':
-			case 'CSISO5428GREEK':
-				return 'ISO_5428:1980';
+			case 'csiso88598i':
+			case 'iso88598i':
+				return 'ISO-8859-8-I';
 
-			case 'GB_1988-80':
-			case 'ISO-IR-57':
-			case 'CN':
-			case 'ISO646-CN':
-			case 'CSISO57GB1988':
-				return 'GB_1988-80';
+			case 'cswindows31latin5':
+			case 'iso88599windowslatin5':
+				return 'ISO-8859-9-Windows-Latin-5';
 
-			case 'GB_2312-80':
-			case 'ISO-IR-58':
-			case 'CHINESE':
-			case 'CSISO58GB231280':
-				return 'GB_2312-80';
-
-			case 'NS_4551-2':
-			case 'ISO646-NO2':
-			case 'ISO-IR-61':
-			case 'NO2':
-			case 'CSISO61NORWEGIAN2':
-				return 'NS_4551-2';
+			case 'csisolatin6':
+			case 'iso885910':
+			case 'iso8859101992':
+			case 'isoir157':
+			case 'l6':
+			case 'latin6':
+				return 'ISO-8859-10';
 
-			case 'VIDEOTEX-SUPPL':
-			case 'ISO-IR-70':
-			case 'CSISO70VIDEOTEXSUPP1':
-				return 'videotex-suppl';
+			case 'iso885913':
+				return 'ISO-8859-13';
 
-			case 'PT2':
-			case 'ISO-IR-84':
-			case 'ISO646-PT2':
-			case 'CSISO84PORTUGUESE2':
-				return 'PT2';
+			case 'iso885914':
+			case 'iso8859141998':
+			case 'isoceltic':
+			case 'isoir199':
+			case 'l8':
+			case 'latin8':
+				return 'ISO-8859-14';
 
-			case 'ES2':
-			case 'ISO-IR-85':
-			case 'ISO646-ES2':
-			case 'CSISO85SPANISH2':
-				return 'ES2';
+			case 'iso885915':
+			case 'latin9':
+				return 'ISO-8859-15';
 
-			case 'MSZ_7795.3':
-			case 'ISO-IR-86':
-			case 'ISO646-HU':
-			case 'HU':
-			case 'CSISO86HUNGARIAN':
-				return 'MSZ_7795.3';
+			case 'iso885916':
+			case 'iso8859162001':
+			case 'isoir226':
+			case 'l10':
+			case 'latin10':
+				return 'ISO-8859-16';
 
-			case 'JIS_C6226-1983':
-			case 'ISO-IR-87':
-			case 'X0208':
-			case 'JIS_X0208-1983':
-			case 'CSISO87JISX0208':
-				return 'JIS_C6226-1983';
+			case 'iso10646j1':
+				return 'ISO-10646-J-1';
 
-			case 'GREEK7':
-			case 'ISO-IR-88':
-			case 'CSISO88GREEK7':
-				return 'greek7';
+			case 'csunicode':
+			case 'iso10646ucs2':
+				return 'ISO-10646-UCS-2';
 
-			case 'ASMO_449':
-			case 'ISO_9036':
-			case 'ARABIC7':
-			case 'ISO-IR-89':
-			case 'CSISO89ASMO449':
-				return 'ASMO_449';
+			case 'csucs4':
+			case 'iso10646ucs4':
+				return 'ISO-10646-UCS-4';
+
+			case 'csunicodeascii':
+			case 'iso10646ucsbasic':
+				return 'ISO-10646-UCS-Basic';
+
+			case 'csunicodelatin1':
+			case 'iso10646':
+			case 'iso10646unicodelatin1':
+				return 'ISO-10646-Unicode-Latin1';
+
+			case 'csiso10646utf1':
+			case 'iso10646utf1':
+				return 'ISO-10646-UTF-1';
+
+			case 'csiso115481':
+			case 'iso115481':
+			case 'isotr115481':
+				return 'ISO-11548-1';
 
-			case 'ISO-IR-90':
-			case 'CSISO90':
+			case 'csiso90':
+			case 'isoir90':
 				return 'iso-ir-90';
 
-			case 'JIS_C6229-1984-A':
-			case 'ISO-IR-91':
-			case 'JP-OCR-A':
-			case 'CSISO91JISC62291984A':
-				return 'JIS_C6229-1984-a';
+			case 'csunicodeibm1261':
+			case 'isounicodeibm1261':
+				return 'ISO-Unicode-IBM-1261';
 
-			case 'JIS_C6229-1984-B':
-			case 'ISO-IR-92':
-			case 'ISO646-JP-OCR-B':
-			case 'JP-OCR-B':
-			case 'CSISO92JISC62991984B':
-				return 'JIS_C6229-1984-b';
+			case 'csunicodeibm1264':
+			case 'isounicodeibm1264':
+				return 'ISO-Unicode-IBM-1264';
 
-			case 'JIS_C6229-1984-B-ADD':
-			case 'ISO-IR-93':
-			case 'JP-OCR-B-ADD':
-			case 'CSISO93JIS62291984BADD':
-				return 'JIS_C6229-1984-b-add';
+			case 'csunicodeibm1265':
+			case 'isounicodeibm1265':
+				return 'ISO-Unicode-IBM-1265';
 
-			case 'JIS_C6229-1984-HAND':
-			case 'ISO-IR-94':
-			case 'JP-OCR-HAND':
-			case 'CSISO94JIS62291984HAND':
-				return 'JIS_C6229-1984-hand';
+			case 'csunicodeibm1268':
+			case 'isounicodeibm1268':
+				return 'ISO-Unicode-IBM-1268';
 
-			case 'JIS_C6229-1984-HAND-ADD':
-			case 'ISO-IR-95':
-			case 'JP-OCR-HAND-ADD':
-			case 'CSISO95JIS62291984HANDADD':
-				return 'JIS_C6229-1984-hand-add';
+			case 'csunicodeibm1276':
+			case 'isounicodeibm1276':
+				return 'ISO-Unicode-IBM-1276';
 
-			case 'JIS_C6229-1984-KANA':
-			case 'ISO-IR-96':
-			case 'CSISO96JISC62291984KANA':
-				return 'JIS_C6229-1984-kana';
+			case 'csiso646basic1983':
+			case 'iso646basic1983':
+			case 'ref':
+				return 'ISO_646.basic:1983';
+
+			case 'csiso2intlrefversion':
+			case 'irv':
+			case 'iso646irv1983':
+			case 'isoir2':
+				return 'ISO_646.irv:1983';
 
-			case 'ISO_2033-1983':
-			case 'ISO-IR-98':
-			case 'E13B':
-			case 'CSISO2033':
+			case 'csiso2033':
+			case 'e13b':
+			case 'iso20331983':
+			case 'isoir98':
 				return 'ISO_2033-1983';
 
-			case 'ANSI_X3.110-1983':
-			case 'ISO-IR-99':
-			case 'CSA_T500-1983':
-			case 'NAPLPS':
-			case 'CSISO99NAPLPS':
-				return 'ANSI_X3.110-1983';
+			case 'csiso5427cyrillic':
+			case 'iso5427':
+			case 'isoir37':
+				return 'ISO_5427';
 
-			case 'T.61-7BIT':
-			case 'ISO-IR-102':
-			case 'CSISO102T617BIT':
-				return 'T.61-7bit';
+			case 'iso5427cyrillic1981':
+			case 'iso54271981':
+			case 'isoir54':
+				return 'ISO_5427:1981';
 
-			case 'T.61-8BIT':
-			case 'T.61':
-			case 'ISO-IR-103':
-			case 'CSISO103T618BIT':
-				return 'T.61-8bit';
+			case 'csiso5428greek':
+			case 'iso54281980':
+			case 'isoir55':
+				return 'ISO_5428:1980';
 
-			case 'ECMA-CYRILLIC':
-			case 'ISO-IR-111':
-			case 'KOI8-E':
-			case 'CSISO111ECMACYRILLIC':
-				return 'ECMA-cyrillic';
+			case 'csiso6937add':
+			case 'iso6937225':
+			case 'isoir152':
+				return 'ISO_6937-2-25';
 
-			case 'CSA_Z243.4-1985-1':
-			case 'ISO-IR-121':
-			case 'ISO646-CA':
-			case 'CSA7-1':
-			case 'CA':
-			case 'CSISO121CANADIAN1':
-				return 'CSA_Z243.4-1985-1';
+			case 'csisotextcomm':
+			case 'iso69372add':
+			case 'isoir142':
+				return 'ISO_6937-2-add';
 
-			case 'CSA_Z243.4-1985-2':
-			case 'ISO-IR-122':
-			case 'ISO646-CA2':
-			case 'CSA7-2':
-			case 'CSISO122CANADIAN2':
-				return 'CSA_Z243.4-1985-2';
+			case 'csiso8859supp':
+			case 'iso8859supp':
+			case 'isoir154':
+			case 'latin125':
+				return 'ISO_8859-supp';
 
-			case 'CSA_Z243.4-1985-GR':
-			case 'ISO-IR-123':
-			case 'CSISO123CSAZ24341985GR':
-				return 'CSA_Z243.4-1985-gr';
+			case 'csiso10367box':
+			case 'iso10367box':
+			case 'isoir155':
+				return 'ISO_10367-box';
 
-			case 'ISO_8859-6-E':
-			case 'CSISO88596E':
-			case 'ISO-8859-6-E':
-				return 'ISO-8859-6-E';
+			case 'csiso15italian':
+			case 'iso646it':
+			case 'isoir15':
+			case 'it':
+				return 'IT';
 
-			case 'ISO_8859-6-I':
-			case 'CSISO88596I':
-			case 'ISO-8859-6-I':
-				return 'ISO-8859-6-I';
+			case 'csiso13jisc6220jp':
+			case 'isoir13':
+			case 'jisc62201969':
+			case 'jisc62201969jp':
+			case 'katakana':
+			case 'x2017':
+				return 'JIS_C6220-1969-jp';
 
-			case 'T.101-G2':
-			case 'ISO-IR-128':
-			case 'CSISO128T101G2':
-				return 'T.101-G2';
+			case 'csiso14jisc6220ro':
+			case 'iso646jp':
+			case 'isoir14':
+			case 'jisc62201969ro':
+			case 'jp':
+				return 'JIS_C6220-1969-ro';
 
-			case 'ISO_8859-8-E':
-			case 'CSISO88598E':
-			case 'ISO-8859-8-E':
-				return 'ISO-8859-8-E';
+			case 'csiso42jisc62261978':
+			case 'isoir42':
+			case 'jisc62261978':
+				return 'JIS_C6226-1978';
 
-			case 'ISO_8859-8-I':
-			case 'CSISO88598I':
-			case 'ISO-8859-8-I':
-				return 'ISO-8859-8-I';
+			case 'csiso87jisx208':
+			case 'isoir87':
+			case 'jisc62261983':
+			case 'jisx2081983':
+			case 'x208':
+				return 'JIS_C6226-1983';
 
-			case 'CSN_369103':
-			case 'ISO-IR-139':
-			case 'CSISO139CSN369103':
-				return 'CSN_369103';
+			case 'csiso91jisc62291984a':
+			case 'isoir91':
+			case 'jisc62291984a':
+			case 'jpocra':
+				return 'JIS_C6229-1984-a';
 
-			case 'JUS_I.B1.002':
-			case 'ISO-IR-141':
-			case 'ISO646-YU':
-			case 'JS':
-			case 'YU':
-			case 'CSISO141JUSIB1002':
-				return 'JUS_I.B1.002';
+			case 'csiso92jisc62991984b':
+			case 'iso646jpocrb':
+			case 'isoir92':
+			case 'jisc62291984b':
+			case 'jpocrb':
+				return 'JIS_C6229-1984-b';
 
-			case 'IEC_P27-1':
-			case 'ISO-IR-143':
-			case 'CSISO143IECP271':
-				return 'IEC_P27-1';
+			case 'csiso93jis62291984badd':
+			case 'isoir93':
+			case 'jisc62291984badd':
+			case 'jpocrbadd':
+				return 'JIS_C6229-1984-b-add';
 
-			case 'JUS_I.B1.003-SERB':
-			case 'ISO-IR-146':
-			case 'SERBIAN':
-			case 'CSISO146SERBIAN':
-				return 'JUS_I.B1.003-serb';
+			case 'csiso94jis62291984hand':
+			case 'isoir94':
+			case 'jisc62291984hand':
+			case 'jpocrhand':
+				return 'JIS_C6229-1984-hand';
+
+			case 'csiso95jis62291984handadd':
+			case 'isoir95':
+			case 'jisc62291984handadd':
+			case 'jpocrhandadd':
+				return 'JIS_C6229-1984-hand-add';
+
+			case 'csiso96jisc62291984kana':
+			case 'isoir96':
+			case 'jisc62291984kana':
+				return 'JIS_C6229-1984-kana';
+
+			case 'csjisencoding':
+			case 'jisencoding':
+				return 'JIS_Encoding';
+
+			case 'cshalfwidthkatakana':
+			case 'jisx201':
+			case 'x201':
+				return 'JIS_X0201';
+
+			case 'csiso159jisx2121990':
+			case 'isoir159':
+			case 'jisx2121990':
+			case 'x212':
+				return 'JIS_X0212-1990';
+
+			case 'csiso141jusib1002':
+			case 'iso646yu':
+			case 'isoir141':
+			case 'js':
+			case 'jusib1002':
+			case 'yu':
+				return 'JUS_I.B1.002';
 
-			case 'JUS_I.B1.003-MAC':
-			case 'MACEDONIAN':
-			case 'ISO-IR-147':
-			case 'CSISO147MACEDONIAN':
+			case 'csiso147macedonian':
+			case 'isoir147':
+			case 'jusib1003mac':
+			case 'macedonian':
 				return 'JUS_I.B1.003-mac';
 
-			case 'GREEK-CCITT':
-			case 'ISO-IR-150':
-			case 'CSISO150':
-			case 'CSISO150GREEKCCITT':
-				return 'greek-ccitt';
+			case 'csiso146serbian':
+			case 'isoir146':
+			case 'jusib1003serb':
+			case 'serbian':
+				return 'JUS_I.B1.003-serb';
 
-			case 'NC_NC00-10:81':
-			case 'CUBA':
-			case 'ISO-IR-151':
-			case 'ISO646-CU':
-			case 'CSISO151CUBA':
-				return 'NC_NC00-10:81';
+			case 'koi7switched':
+				return 'KOI7-switched';
 
-			case 'ISO_6937-2-25':
-			case 'ISO-IR-152':
-			case 'CSISO6937ADD':
-				return 'ISO_6937-2-25';
+			case 'cskoi8r':
+			case 'koi8r':
+				return 'KOI8-R';
 
-			case 'GOST_19768-74':
-			case 'ST_SEV_358-88':
-			case 'ISO-IR-153':
-			case 'CSISO153GOST1976874':
-				return 'GOST_19768-74';
+			case 'koi8u':
+				return 'KOI8-U';
 
-			case 'ISO_8859-SUPP':
-			case 'ISO-IR-154':
-			case 'LATIN1-2-5':
-			case 'CSISO8859SUPP':
-				return 'ISO_8859-supp';
+			case 'csksc5636':
+			case 'iso646kr':
+			case 'ksc5636':
+				return 'KSC5636';
 
-			case 'ISO_10367-BOX':
-			case 'ISO-IR-155':
-			case 'CSISO10367BOX':
-				return 'ISO_10367-box';
+			case 'cskz1048':
+			case 'kz1048':
+			case 'rk1048':
+			case 'strk10482002':
+				return 'KZ-1048';
 
-			case 'LATIN-LAP':
-			case 'LAP':
-			case 'ISO-IR-158':
-			case 'CSISO158LAP':
-				return 'latin-lap';
+			case 'csiso19latingreek':
+			case 'isoir19':
+			case 'latingreek':
+				return 'latin-greek';
 
-			case 'JIS_X0212-1990':
-			case 'X0212':
-			case 'ISO-IR-159':
-			case 'CSISO159JISX02121990':
-				return 'JIS_X0212-1990';
+			case 'csiso27latingreek1':
+			case 'isoir27':
+			case 'latingreek1':
+				return 'Latin-greek-1';
 
-			case 'DS_2089':
-			case 'DS2089':
-			case 'ISO646-DK':
-			case 'DK':
-			case 'CSISO646DANISH':
-				return 'DS_2089';
+			case 'csiso158lap':
+			case 'isoir158':
+			case 'lap':
+			case 'latinlap':
+				return 'latin-lap';
 
-			case 'US-DK':
-			case 'CSUSDK':
-				return 'us-dk';
+			case 'csmacintosh':
+			case 'mac':
+			case 'macintosh':
+				return 'macintosh';
 
-			case 'DK-US':
-			case 'CSDKUS':
-				return 'dk-us';
+			case 'csmicrosoftpublishing':
+			case 'microsoftpublishing':
+				return 'Microsoft-Publishing';
 
-			case 'KSC5636':
-			case 'ISO646-KR':
-			case 'CSKSC5636':
-				return 'KSC5636';
+			case 'csmnem':
+			case 'mnem':
+				return 'MNEM';
 
-			case 'UNICODE-1-1-UTF-7':
-			case 'CSUNICODE11UTF7':
-				return 'UNICODE-1-1-UTF-7';
+			case 'csmnemonic':
+			case 'mnemonic':
+				return 'MNEMONIC';
 
-			case 'ISO-2022-CN':
-				return 'ISO-2022-CN';
+			case 'csiso86hungarian':
+			case 'hu':
+			case 'iso646hu':
+			case 'isoir86':
+			case 'msz77953':
+				return 'MSZ_7795.3';
 
-			case 'ISO-2022-CN-EXT':
-				return 'ISO-2022-CN-EXT';
+			case 'csnatsdano':
+			case 'isoir91':
+			case 'natsdano':
+				return 'NATS-DANO';
 
-			case 'UTF-8':
-				return 'UTF-8';
+			case 'csnatsdanoadd':
+			case 'isoir92':
+			case 'natsdanoadd':
+				return 'NATS-DANO-ADD';
 
-			case 'ISO-8859-13':
-				return 'ISO-8859-13';
+			case 'csnatssefi':
+			case 'isoir81':
+			case 'natssefi':
+				return 'NATS-SEFI';
 
-			case 'ISO-8859-14':
-			case 'ISO-IR-199':
-			case 'ISO_8859-14:1998':
-			case 'ISO_8859-14':
-			case 'LATIN8':
-			case 'ISO-CELTIC':
-			case 'L8':
-				return 'ISO-8859-14';
+			case 'csnatssefiadd':
+			case 'isoir82':
+			case 'natssefiadd':
+				return 'NATS-SEFI-ADD';
 
-			case 'ISO-8859-15':
-			case 'ISO_8859-15':
-			case 'LATIN-9':
-				return 'ISO-8859-15';
+			case 'csiso151cuba':
+			case 'cuba':
+			case 'iso646cu':
+			case 'isoir151':
+			case 'ncnc1081':
+				return 'NC_NC00-10:81';
 
-			case 'ISO-8859-16':
-			case 'ISO-IR-226':
-			case 'ISO_8859-16:2001':
-			case 'ISO_8859-16':
-			case 'LATIN10':
-			case 'L10':
-				return 'ISO-8859-16';
+			case 'csiso69french':
+			case 'fr':
+			case 'iso646fr':
+			case 'isoir69':
+			case 'nfz62010':
+				return 'NF_Z_62-010';
 
-			case 'GBK':
-			case 'CP936':
-			case 'MS936':
-			case 'WINDOWS-936':
-				return 'GBK';
+			case 'csiso25french':
+			case 'iso646fr1':
+			case 'isoir25':
+			case 'nfz620101973':
+				return 'NF_Z_62-010_(1973)';
 
-			case 'GB18030':
-				return 'GB18030';
+			case 'csiso60danishnorwegian':
+			case 'csiso60norwegian1':
+			case 'iso646no':
+			case 'isoir60':
+			case 'no':
+			case 'ns45511':
+				return 'NS_4551-1';
 
-			case 'OSD_EBCDIC_DF04_15':
-				return 'OSD_EBCDIC_DF04_15';
+			case 'csiso61norwegian2':
+			case 'iso646no2':
+			case 'isoir61':
+			case 'no2':
+			case 'ns45512':
+				return 'NS_4551-2';
 
-			case 'OSD_EBCDIC_DF03_IRV':
+			case 'osdebcdicdf3irv':
 				return 'OSD_EBCDIC_DF03_IRV';
 
-			case 'OSD_EBCDIC_DF04_1':
+			case 'osdebcdicdf41':
 				return 'OSD_EBCDIC_DF04_1';
 
-			case 'ISO-11548-1':
-			case 'ISO_11548-1':
-			case 'ISO_TR_11548-1':
-			case 'CSISO115481':
-				return 'ISO-11548-1';
-
-			case 'KZ-1048':
-			case 'STRK1048-2002':
-			case 'RK1048':
-			case 'CSKZ1048':
-				return 'KZ-1048';
-
-			case 'ISO-10646-UCS-2':
-			case 'CSUNICODE':
-				return 'ISO-10646-UCS-2';
-
-			case 'ISO-10646-UCS-4':
-			case 'CSUCS4':
-				return 'ISO-10646-UCS-4';
+			case 'osdebcdicdf415':
+				return 'OSD_EBCDIC_DF04_15';
 
-			case 'ISO-10646-UCS-BASIC':
-			case 'CSUNICODEASCII':
-				return 'ISO-10646-UCS-Basic';
+			case 'cspc8danishnorwegian':
+			case 'pc8danishnorwegian':
+				return 'PC8-Danish-Norwegian';
 
-			case 'ISO-10646-UNICODE-LATIN1':
-			case 'CSUNICODELATIN1':
-			case 'ISO-10646':
-				return 'ISO-10646-Unicode-Latin1';
+			case 'cspc8turkish':
+			case 'pc8turkish':
+				return 'PC8-Turkish';
 
-			case 'ISO-10646-J-1':
-				return 'ISO-10646-J-1';
+			case 'csiso16portuguese':
+			case 'iso646pt':
+			case 'isoir16':
+			case 'pt':
+				return 'PT';
 
-			case 'ISO-UNICODE-IBM-1261':
-			case 'CSUNICODEIBM1261':
-				return 'ISO-Unicode-IBM-1261';
+			case 'csiso84portuguese2':
+			case 'iso646pt2':
+			case 'isoir84':
+			case 'pt2':
+				return 'PT2';
 
-			case 'ISO-UNICODE-IBM-1268':
-			case 'CSUNICODEIBM1268':
-				return 'ISO-Unicode-IBM-1268';
+			case 'cp154':
+			case 'csptcp154':
+			case 'cyrillicasian':
+			case 'pt154':
+			case 'ptcp154':
+				return 'PTCP154';
 
-			case 'ISO-UNICODE-IBM-1276':
-			case 'CSUNICODEIBM1276':
-				return 'ISO-Unicode-IBM-1276';
+			case 'scsu':
+				return 'SCSU';
 
-			case 'ISO-UNICODE-IBM-1264':
-			case 'CSUNICODEIBM1264':
-				return 'ISO-Unicode-IBM-1264';
+			case 'csiso10swedish':
+			case 'fi':
+			case 'iso646fi':
+			case 'iso646se':
+			case 'isoir10':
+			case 'se':
+			case 'sen850200b':
+				return 'SEN_850200_B';
 
-			case 'ISO-UNICODE-IBM-1265':
-			case 'CSUNICODEIBM1265':
-				return 'ISO-Unicode-IBM-1265';
+			case 'csiso11swedishfornames':
+			case 'iso646se2':
+			case 'isoir11':
+			case 'se2':
+			case 'sen850200c':
+				return 'SEN_850200_C';
 
-			case 'UNICODE-1-1':
-			case 'CSUNICODE11':
-				return 'UNICODE-1-1';
+			case 'csshiftjis':
+			case 'mskanji':
+			case 'shiftjis':
+				return 'Shift_JIS';
 
-			case 'SCSU':
-				return 'SCSU';
+			case 'csiso102t617bit':
+			case 'isoir102':
+			case 't617bit':
+				return 'T.61-7bit';
 
-			case 'UTF-7':
-				return 'UTF-7';
+			case 'csiso103t618bit':
+			case 'isoir103':
+			case 't61':
+			case 't618bit':
+				return 'T.61-8bit';
 
-			case 'UTF-16BE':
-				return 'UTF-16BE';
+			case 'csiso128t101g2':
+			case 'isoir128':
+			case 't101g2':
+				return 'T.101-G2';
 
-			case 'UTF-16LE':
-				return 'UTF-16LE';
+			case 'cstscii':
+			case 'tscii':
+				return 'TSCII';
 
-			case 'UTF-16':
-				return 'UTF-16';
+			case 'csunicode11':
+			case 'unicode11':
+				return 'UNICODE-1-1';
 
-			case 'CESU-8':
-			case 'CSCESU-8':
-				return 'CESU-8';
+			case 'csunicode11utf7':
+			case 'unicode11utf7':
+				return 'UNICODE-1-1-UTF-7';
 
-			case 'UTF-32':
-				return 'UTF-32';
+			case 'csunknown8bit':
+			case 'unknown8bit':
+				return 'UNKNOWN-8BIT';
 
-			case 'UTF-32BE':
-				return 'UTF-32BE';
+			case 'ansix341968':
+			case 'ansix341986':
+			case 'ascii':
+			case 'cp367':
+			case 'csascii':
+			case 'ibm367':
+			case 'iso646irv1991':
+			case 'iso646us':
+			case 'isoir6':
+			case 'us':
+			case 'usascii':
+				return 'US-ASCII';
 
-			case 'UTF-32LE':
-				return 'UTF-32LE';
+			case 'csusdk':
+			case 'usdk':
+				return 'us-dk';
 
-			case 'BOCU-1':
-			case 'CSBOCU-1':
-				return 'BOCU-1';
+			case 'utf7':
+				return 'UTF-7';
 
-			case 'ISO-8859-1-WINDOWS-3.0-LATIN-1':
-			case 'CSWINDOWS30LATIN1':
-				return 'ISO-8859-1-Windows-3.0-Latin-1';
+			case 'utf8':
+				return 'UTF-8';
 
-			case 'ISO-8859-1-WINDOWS-3.1-LATIN-1':
-			case 'CSWINDOWS31LATIN1':
-				return 'ISO-8859-1-Windows-3.1-Latin-1';
+			case 'utf16':
+				return 'UTF-16';
 
-			case 'ISO-8859-2-WINDOWS-LATIN-2':
-			case 'CSWINDOWS31LATIN2':
-				return 'ISO-8859-2-Windows-Latin-2';
+			case 'utf16be':
+				return 'UTF-16BE';
 
-			case 'ISO-8859-9-WINDOWS-LATIN-5':
-			case 'CSWINDOWS31LATIN5':
-				return 'ISO-8859-9-Windows-Latin-5';
+			case 'utf16le':
+				return 'UTF-16LE';
 
-			case 'HP-ROMAN8':
-			case 'ROMAN8':
-			case 'R8':
-			case 'CSHPROMAN8':
-				return 'hp-roman8';
+			case 'utf32':
+				return 'UTF-32';
 
-			case 'ADOBE-STANDARD-ENCODING':
-			case 'CSADOBESTANDARDENCODING':
-				return 'Adobe-Standard-Encoding';
+			case 'utf32be':
+				return 'UTF-32BE';
 
-			case 'VENTURA-US':
-			case 'CSVENTURAUS':
-				return 'Ventura-US';
+			case 'utf32le':
+				return 'UTF-32LE';
 
-			case 'VENTURA-INTERNATIONAL':
-			case 'CSVENTURAINTERNATIONAL':
+			case 'csventurainternational':
+			case 'venturainternational':
 				return 'Ventura-International';
 
-			case 'DEC-MCS':
-			case 'DEC':
-			case 'CSDECMCS':
-				return 'DEC-MCS';
-
-			case 'IBM850':
-			case 'CP850':
-			case '850':
-			case 'CSPC850MULTILINGUAL':
-				return 'IBM850';
+			case 'csventuramath':
+			case 'venturamath':
+				return 'Ventura-Math';
 
-			case 'PC8-DANISH-NORWEGIAN':
-			case 'CSPC8DANISHNORWEGIAN':
-				return 'PC8-Danish-Norwegian';
+			case 'csventuraus':
+			case 'venturaus':
+				return 'Ventura-US';
 
-			case 'IBM862':
-			case 'CP862':
-			case '862':
-			case 'CSPC862LATINHEBREW':
-				return 'IBM862';
+			case 'csiso70videotexsupp1':
+			case 'isoir70':
+			case 'videotexsuppl':
+				return 'videotex-suppl';
 
-			case 'PC8-TURKISH':
-			case 'CSPC8TURKISH':
-				return 'PC8-Turkish';
+			case 'csviqr':
+			case 'viqr':
+				return 'VIQR';
 
-			case 'IBM-SYMBOLS':
-			case 'CSIBMSYMBOLS':
-				return 'IBM-Symbols';
+			case 'csviscii':
+			case 'viscii':
+				return 'VISCII';
 
-			case 'IBM-THAI':
-			case 'CSIBMTHAI':
-				return 'IBM-Thai';
+			case 'cswindows31j':
+			case 'windows31j':
+				return 'Windows-31J';
 
-			case 'HP-LEGAL':
-			case 'CSHPLEGAL':
-				return 'HP-Legal';
+			case 'iso885911':
+			case 'tis620':
+				return 'windows-874';
+
+			case 'cseuckr':
+			case 'csksc56011987':
+			case 'euckr':
+			case 'isoir149':
+			case 'korean':
+			case 'ksc5601':
+			case 'ksc56011987':
+			case 'ksc56011989':
+			case 'windows949':
+				return 'windows-949';
 
-			case 'HP-PI-FONT':
-			case 'CSHPPIFONT':
-				return 'HP-Pi-font';
+			case 'windows1250':
+				return 'windows-1250';
 
-			case 'HP-MATH8':
-			case 'CSHPMATH8':
-				return 'HP-Math8';
+			case 'windows1251':
+				return 'windows-1251';
 
-			case 'ADOBE-SYMBOL-ENCODING':
-			case 'CSHPPSMATH':
-				return 'Adobe-Symbol-Encoding';
+			case 'cp819':
+			case 'csisolatin1':
+			case 'ibm819':
+			case 'iso88591':
+			case 'iso885911987':
+			case 'isoir100':
+			case 'l1':
+			case 'latin1':
+			case 'windows1252':
+				return 'windows-1252';
 
-			case 'HP-DESKTOP':
-			case 'CSHPDESKTOP':
-				return 'HP-DeskTop';
+			case 'windows1253':
+				return 'windows-1253';
 
-			case 'VENTURA-MATH':
-			case 'CSVENTURAMATH':
-				return 'Ventura-Math';
+			case 'csisolatin5':
+			case 'iso88599':
+			case 'iso885991989':
+			case 'isoir148':
+			case 'l5':
+			case 'latin5':
+			case 'windows1254':
+				return 'windows-1254';
 
-			case 'MICROSOFT-PUBLISHING':
-			case 'CSMICROSOFTPUBLISHING':
-				return 'Microsoft-Publishing';
+			case 'windows1255':
+				return 'windows-1255';
 
-			case 'WINDOWS-31J':
-			case 'CSWINDOWS31J':
-				return 'Windows-31J';
+			case 'windows1256':
+				return 'windows-1256';
 
-			case 'GB2312':
-			case 'CSGB2312':
-				return 'GB2312';
+			case 'windows1257':
+				return 'windows-1257';
 
-			case 'BIG5':
-			case 'CSBIG5':
-				return 'Big5';
+			case 'windows1258':
+				return 'windows-1258';
 
-			case 'MACINTOSH':
-			case 'MAC':
-			case 'CSMACINTOSH':
-				return 'macintosh';
+			default:
+				return $charset;
+		}
+	}
 
-			case 'IBM037':
-			case 'CP037':
-			case 'EBCDIC-CP-US':
-			case 'EBCDIC-CP-CA':
-			case 'EBCDIC-CP-WT':
-			case 'EBCDIC-CP-NL':
-			case 'CSIBM037':
-				return 'IBM037';
+	function get_curl_version()
+	{
+		if (is_array($curl = curl_version()))
+		{
+			$curl = $curl['version'];
+		}
+		elseif (substr($curl, 0, 5) === 'curl/')
+		{
+			$curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
+		}
+		elseif (substr($curl, 0, 8) === 'libcurl/')
+		{
+			$curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
+		}
+		else
+		{
+			$curl = 0;
+		}
+		return $curl;
+	}
 
-			case 'IBM038':
-			case 'EBCDIC-INT':
-			case 'CP038':
-			case 'CSIBM038':
-				return 'IBM038';
+	function is_subclass_of($class1, $class2)
+	{
+		if (func_num_args() !== 2)
+		{
+			trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
+		}
+		elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
+		{
+			return is_subclass_of($class1, $class2);
+		}
+		elseif (is_string($class1) && is_string($class2))
+		{
+			if (class_exists($class1))
+			{
+				if (class_exists($class2))
+				{
+					$class2 = strtolower($class2);
+					while ($class1 = strtolower(get_parent_class($class1)))
+					{
+						if ($class1 === $class2)
+						{
+							return true;
+						}
+					}
+				}
+			}
+			else
+			{
+				trigger_error('Unknown class passed as parameter', E_USER_WARNNG);
+			}
+		}
+		return false;
+	}
 
-			case 'IBM273':
-			case 'CP273':
-			case 'CSIBM273':
-				return 'IBM273';
+	/**
+	 * Strip HTML comments
+	 *
+	 * @access public
+	 * @param string $data Data to strip comments from
+	 * @return string Comment stripped string
+	 */
+	function strip_comments($data)
+	{
+		$output = '';
+		while (($start = strpos($data, '<!--')) !== false)
+		{
+			$output .= substr($data, 0, $start);
+			if (($end = strpos($data, '-->', $start)) !== false)
+			{
+				$data = substr_replace($data, '', 0, $end + 3);
+			}
+			else
+			{
+				$data = '';
+			}
+		}
+		return $output . $data;
+	}
 
-			case 'IBM274':
-			case 'EBCDIC-BE':
-			case 'CP274':
-			case 'CSIBM274':
-				return 'IBM274';
+	function parse_date($dt)
+	{
+		$parser = SimplePie_Parse_Date::get();
+		return $parser->parse($dt);
+	}
 
-			case 'IBM275':
-			case 'EBCDIC-BR':
-			case 'CP275':
-			case 'CSIBM275':
-				return 'IBM275';
+	/**
+	 * Decode HTML entities
+	 *
+	 * @static
+	 * @access public
+	 * @param string $data Input data
+	 * @return string Output data
+	 */
+	function entities_decode($data)
+	{
+		$decoder = new SimplePie_Decode_HTML_Entities($data);
+		return $decoder->parse();
+	}
 
-			case 'IBM277':
-			case 'EBCDIC-CP-DK':
-			case 'EBCDIC-CP-NO':
-			case 'CSIBM277':
-				return 'IBM277';
+	/**
+	 * Remove RFC822 comments
+	 *
+	 * @access public
+	 * @param string $data Data to strip comments from
+	 * @return string Comment stripped string
+	 */
+	function uncomment_rfc822($string)
+	{
+		$string = (string) $string;
+		$position = 0;
+		$length = strlen($string);
+		$depth = 0;
 
-			case 'IBM278':
-			case 'CP278':
-			case 'EBCDIC-CP-FI':
-			case 'EBCDIC-CP-SE':
-			case 'CSIBM278':
-				return 'IBM278';
+		$output = '';
 
-			case 'IBM280':
-			case 'CP280':
-			case 'EBCDIC-CP-IT':
-			case 'CSIBM280':
-				return 'IBM280';
+		while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
+		{
+			$output .= substr($string, $position, $pos - $position);
+			$position = $pos + 1;
+			if ($string[$pos - 1] !== '\\')
+			{
+				$depth++;
+				while ($depth && $position < $length)
+				{
+					$position += strcspn($string, '()', $position);
+					if ($string[$position - 1] === '\\')
+					{
+						$position++;
+						continue;
+					}
+					elseif (isset($string[$position]))
+					{
+						switch ($string[$position])
+						{
+							case '(':
+								$depth++;
+								break;
 
-			case 'IBM281':
-			case 'EBCDIC-JP-E':
-			case 'CP281':
-			case 'CSIBM281':
-				return 'IBM281';
+							case ')':
+								$depth--;
+								break;
+						}
+						$position++;
+					}
+					else
+					{
+						break;
+					}
+				}
+			}
+			else
+			{
+				$output .= '(';
+			}
+		}
+		$output .= substr($string, $position);
 
-			case 'IBM284':
-			case 'CP284':
-			case 'EBCDIC-CP-ES':
-			case 'CSIBM284':
-				return 'IBM284';
+		return $output;
+	}
 
-			case 'IBM285':
-			case 'CP285':
-			case 'EBCDIC-CP-GB':
-			case 'CSIBM285':
-				return 'IBM285';
+	function parse_mime($mime)
+	{
+		if (($pos = strpos($mime, ';')) === false)
+		{
+			return trim($mime);
+		}
+		else
+		{
+			return trim(substr($mime, 0, $pos));
+		}
+	}
 
-			case 'IBM290':
-			case 'CP290':
-			case 'EBCDIC-JP-KANA':
-			case 'CSIBM290':
-				return 'IBM290';
+	function htmlspecialchars_decode($string, $quote_style)
+	{
+		if (function_exists('htmlspecialchars_decode'))
+		{
+			return htmlspecialchars_decode($string, $quote_style);
+		}
+		else
+		{
+			return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
+		}
+	}
 
-			case 'IBM297':
-			case 'CP297':
-			case 'EBCDIC-CP-FR':
-			case 'CSIBM297':
-				return 'IBM297';
+	function atom_03_construct_type($attribs)
+	{
+		if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64'))
+		{
+			$mode = SIMPLEPIE_CONSTRUCT_BASE64;
+		}
+		else
+		{
+			$mode = SIMPLEPIE_CONSTRUCT_NONE;
+		}
+		if (isset($attribs['']['type']))
+		{
+			switch (strtolower(trim($attribs['']['type'])))
+			{
+				case 'text':
+				case 'text/plain':
+					return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
 
-			case 'IBM420':
-			case 'CP420':
-			case 'EBCDIC-CP-AR1':
-			case 'CSIBM420':
-				return 'IBM420';
+				case 'html':
+				case 'text/html':
+					return SIMPLEPIE_CONSTRUCT_HTML | $mode;
 
-			case 'IBM423':
-			case 'CP423':
-			case 'EBCDIC-CP-GR':
-			case 'CSIBM423':
-				return 'IBM423';
+				case 'xhtml':
+				case 'application/xhtml+xml':
+					return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
 
-			case 'IBM424':
-			case 'CP424':
-			case 'EBCDIC-CP-HE':
-			case 'CSIBM424':
-				return 'IBM424';
+				default:
+					return SIMPLEPIE_CONSTRUCT_NONE | $mode;
+			}
+		}
+		else
+		{
+			return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+		}
+	}
 
-			case 'IBM437':
-			case 'CP437':
-			case '437':
-			case 'CSPC8CODEPAGE437':
-				return 'IBM437';
+	function atom_10_construct_type($attribs)
+	{
+		if (isset($attribs['']['type']))
+		{
+			switch (strtolower(trim($attribs['']['type'])))
+			{
+				case 'text':
+					return SIMPLEPIE_CONSTRUCT_TEXT;
 
-			case 'IBM500':
-			case 'CP500':
-			case 'EBCDIC-CP-BE':
-			case 'EBCDIC-CP-CH':
-			case 'CSIBM500':
-				return 'IBM500';
+				case 'html':
+					return SIMPLEPIE_CONSTRUCT_HTML;
 
-			case 'IBM851':
-			case 'CP851':
-			case '851':
-			case 'CSIBM851':
-				return 'IBM851';
+				case 'xhtml':
+					return SIMPLEPIE_CONSTRUCT_XHTML;
 
-			case 'IBM852':
-			case 'CP852':
-			case '852':
-			case 'CSPCP852':
-				return 'IBM852';
+				default:
+					return SIMPLEPIE_CONSTRUCT_NONE;
+			}
+		}
+		return SIMPLEPIE_CONSTRUCT_TEXT;
+	}
 
-			case 'IBM855':
-			case 'CP855':
-			case '855':
-			case 'CSIBM855':
-				return 'IBM855';
+	function atom_10_content_construct_type($attribs)
+	{
+		if (isset($attribs['']['type']))
+		{
+			$type = strtolower(trim($attribs['']['type']));
+			switch ($type)
+			{
+				case 'text':
+					return SIMPLEPIE_CONSTRUCT_TEXT;
 
-			case 'IBM857':
-			case 'CP857':
-			case '857':
-			case 'CSIBM857':
-				return 'IBM857';
+				case 'html':
+					return SIMPLEPIE_CONSTRUCT_HTML;
 
-			case 'IBM860':
-			case 'CP860':
-			case '860':
-			case 'CSIBM860':
-				return 'IBM860';
+				case 'xhtml':
+					return SIMPLEPIE_CONSTRUCT_XHTML;
+			}
+			if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/')
+			{
+				return SIMPLEPIE_CONSTRUCT_NONE;
+			}
+			else
+			{
+				return SIMPLEPIE_CONSTRUCT_BASE64;
+			}
+		}
+		else
+		{
+			return SIMPLEPIE_CONSTRUCT_TEXT;
+		}
+	}
 
-			case 'IBM861':
-			case 'CP861':
-			case '861':
-			case 'CP-IS':
-			case 'CSIBM861':
-				return 'IBM861';
+	function is_isegment_nz_nc($string)
+	{
+		return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
+	}
 
-			case 'IBM863':
-			case 'CP863':
-			case '863':
-			case 'CSIBM863':
-				return 'IBM863';
+	function space_seperated_tokens($string)
+	{
+		$space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
+		$string_length = strlen($string);
 
-			case 'IBM864':
-			case 'CP864':
-			case 'CSIBM864':
-				return 'IBM864';
+		$position = strspn($string, $space_characters);
+		$tokens = array();
 
-			case 'IBM865':
-			case 'CP865':
-			case '865':
-			case 'CSIBM865':
-				return 'IBM865';
+		while ($position < $string_length)
+		{
+			$len = strcspn($string, $space_characters, $position);
+			$tokens[] = substr($string, $position, $len);
+			$position += $len;
+			$position += strspn($string, $space_characters, $position);
+		}
 
-			case 'IBM868':
-			case 'CP868':
-			case 'CP-AR':
-			case 'CSIBM868':
-				return 'IBM868';
+		return $tokens;
+	}
 
-			case 'IBM869':
-			case 'CP869':
-			case '869':
-			case 'CP-GR':
-			case 'CSIBM869':
-				return 'IBM869';
+	function array_unique($array)
+	{
+		if (version_compare(PHP_VERSION, '5.2', '>='))
+		{
+			return array_unique($array);
+		}
+		else
+		{
+			$array = (array) $array;
+			$new_array = array();
+			$new_array_strings = array();
+			foreach ($array as $key => $value)
+			{
+				if (is_object($value))
+				{
+					if (method_exists($value, '__toString'))
+					{
+						$cmp = $value->__toString();
+					}
+					else
+					{
+						trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
+					}
+				}
+				elseif (is_array($value))
+				{
+					$cmp = (string) reset($value);
+				}
+				else
+				{
+					$cmp = (string) $value;
+				}
+				if (!in_array($cmp, $new_array_strings))
+				{
+					$new_array[$key] = $value;
+					$new_array_strings[] = $cmp;
+				}
+			}
+			return $new_array;
+		}
+	}
 
-			case 'IBM870':
-			case 'CP870':
-			case 'EBCDIC-CP-ROECE':
-			case 'EBCDIC-CP-YU':
-			case 'CSIBM870':
-				return 'IBM870';
+	/**
+	 * Converts a unicode codepoint to a UTF-8 character
+	 *
+	 * @static
+	 * @access public
+	 * @param int $codepoint Unicode codepoint
+	 * @return string UTF-8 character
+	 */
+	function codepoint_to_utf8($codepoint)
+	{
+		$codepoint = (int) $codepoint;
+		if ($codepoint < 0)
+		{
+			return false;
+		}
+		else if ($codepoint <= 0x7f)
+		{
+			return chr($codepoint);
+		}
+		else if ($codepoint <= 0x7ff)
+		{
+			return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+		}
+		else if ($codepoint <= 0xffff)
+		{
+			return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+		}
+		else if ($codepoint <= 0x10ffff)
+		{
+			return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+		}
+		else
+		{
+			// U+FFFD REPLACEMENT CHARACTER
+			return "\xEF\xBF\xBD";
+		}
+	}
 
-			case 'IBM871':
-			case 'CP871':
-			case 'EBCDIC-CP-IS':
-			case 'CSIBM871':
-				return 'IBM871';
+	/**
+	 * Re-implementation of PHP 5's stripos()
+	 *
+	 * Returns the numeric position of the first occurrence of needle in the
+	 * haystack string.
+	 *
+	 * @static
+	 * @access string
+	 * @param object $haystack
+	 * @param string $needle Note that the needle may be a string of one or more
+	 *     characters. If needle is not a string, it is converted to an integer
+	 *     and applied as the ordinal value of a character.
+	 * @param int $offset The optional offset parameter allows you to specify which
+	 *     character in haystack to start searching. The position returned is still
+	 *     relative to the beginning of haystack.
+	 * @return bool If needle is not found, stripos() will return boolean false.
+	 */
+	function stripos($haystack, $needle, $offset = 0)
+	{
+		if (function_exists('stripos'))
+		{
+			return stripos($haystack, $needle, $offset);
+		}
+		else
+		{
+			if (is_string($needle))
+			{
+				$needle = strtolower($needle);
+			}
+			elseif (is_int($needle) || is_bool($needle) || is_double($needle))
+			{
+				$needle = strtolower(chr($needle));
+			}
+			else
+			{
+				trigger_error('needle is not a string or an integer', E_USER_WARNING);
+				return false;
+			}
 
-			case 'IBM880':
-			case 'CP880':
-			case 'EBCDIC-CYRILLIC':
-			case 'CSIBM880':
-				return 'IBM880';
+			return strpos(strtolower($haystack), $needle, $offset);
+		}
+	}
 
-			case 'IBM891':
-			case 'CP891':
-			case 'CSIBM891':
-				return 'IBM891';
+	/**
+	 * Similar to parse_str()
+	 *
+	 * Returns an associative array of name/value pairs, where the value is an
+	 * array of values that have used the same name
+	 *
+	 * @static
+	 * @access string
+	 * @param string $str The input string.
+	 * @return array
+	 */
+	function parse_str($str)
+	{
+		$return = array();
+		$str = explode('&', $str);
 
-			case 'IBM903':
-			case 'CP903':
-			case 'CSIBM903':
-				return 'IBM903';
+		foreach ($str as $section)
+		{
+			if (strpos($section, '=') !== false)
+			{
+				list($name, $value) = explode('=', $section, 2);
+				$return[urldecode($name)][] = urldecode($value);
+			}
+			else
+			{
+				$return[urldecode($section)][] = null;
+			}
+		}
 
-			case 'IBM904':
-			case 'CP904':
-			case '904':
-			case 'CSIBBM904':
-				return 'IBM904';
+		return $return;
+	}
 
-			case 'IBM905':
-			case 'CP905':
-			case 'EBCDIC-CP-TR':
-			case 'CSIBM905':
-				return 'IBM905';
+	/**
+	 * Detect XML encoding, as per XML 1.0 Appendix F.1
+	 *
+	 * @todo Add support for EBCDIC
+	 * @param string $data XML data
+	 * @return array Possible encodings
+	 */
+	function xml_encoding($data)
+	{
+		// UTF-32 Big Endian BOM
+		if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
+		{
+			$encoding[] = 'UTF-32BE';
+		}
+		// UTF-32 Little Endian BOM
+		elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
+		{
+			$encoding[] = 'UTF-32LE';
+		}
+		// UTF-16 Big Endian BOM
+		elseif (substr($data, 0, 2) === "\xFE\xFF")
+		{
+			$encoding[] = 'UTF-16BE';
+		}
+		// UTF-16 Little Endian BOM
+		elseif (substr($data, 0, 2) === "\xFF\xFE")
+		{
+			$encoding[] = 'UTF-16LE';
+		}
+		// UTF-8 BOM
+		elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
+		{
+			$encoding[] = 'UTF-8';
+		}
+		// UTF-32 Big Endian Without BOM
+		elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C")
+		{
+			if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-32BE';
+		}
+		// UTF-32 Little Endian Without BOM
+		elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00")
+		{
+			if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-32LE';
+		}
+		// UTF-16 Big Endian Without BOM
+		elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
+		{
+			if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-16BE';
+		}
+		// UTF-16 Little Endian Without BOM
+		elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
+		{
+			if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-16LE';
+		}
+		// US-ASCII (or superset)
+		elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C")
+		{
+			if ($pos = strpos($data, "\x3F\x3E"))
+			{
+				$parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-8';
+		}
+		// Fallback to UTF-8
+		else
+		{
+			$encoding[] = 'UTF-8';
+		}
+		return $encoding;
+	}
 
-			case 'IBM918':
-			case 'CP918':
-			case 'EBCDIC-CP-AR2':
-			case 'CSIBM918':
-				return 'IBM918';
+	function output_javascript()
+	{
+		if (function_exists('ob_gzhandler'))
+		{
+			ob_start('ob_gzhandler');
+		}
+		header('Content-type: text/javascript; charset: UTF-8');
+		header('Cache-Control: must-revalidate');
+		header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
+		?>
+function embed_odeo(link) {
+	document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
+}
 
-			case 'IBM1026':
-			case 'CP1026':
-			case 'CSIBM1026':
-				return 'IBM1026';
+function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
+	if (placeholder != '') {
+		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
+	}
+	else {
+		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
+	}
+}
 
-			case 'EBCDIC-AT-DE':
-			case 'CSIBMEBCDICATDE':
-				return 'EBCDIC-AT-DE';
+function embed_flash(bgcolor, width, height, link, loop, type) {
+	document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
+}
 
-			case 'EBCDIC-AT-DE-A':
-			case 'CSEBCDICATDEA':
-				return 'EBCDIC-AT-DE-A';
+function embed_flv(width, height, link, placeholder, loop, player) {
+	document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');
+}
 
-			case 'EBCDIC-CA-FR':
-			case 'CSEBCDICCAFR':
-				return 'EBCDIC-CA-FR';
+function embed_wmedia(width, height, link) {
+	document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
+}
+		<?php
+	}
+}
 
-			case 'EBCDIC-DK-NO':
-			case 'CSEBCDICDKNO':
-				return 'EBCDIC-DK-NO';
+/**
+ * Decode HTML Entities
+ *
+ * This implements HTML5 as of revision 967 (2007-06-28)
+ *
+ * @package SimplePie
+ */
+class SimplePie_Decode_HTML_Entities
+{
+	/**
+	 * Data to be parsed
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $data = '';
 
-			case 'EBCDIC-DK-NO-A':
-			case 'CSEBCDICDKNOA':
-				return 'EBCDIC-DK-NO-A';
+	/**
+	 * Currently consumed bytes
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $consumed = '';
 
-			case 'EBCDIC-FI-SE':
-			case 'CSEBCDICFISE':
-				return 'EBCDIC-FI-SE';
+	/**
+	 * Position of the current byte being parsed
+	 *
+	 * @access private
+	 * @var int
+	 */
+	var $position = 0;
 
-			case 'EBCDIC-FI-SE-A':
-			case 'CSEBCDICFISEA':
-				return 'EBCDIC-FI-SE-A';
+	/**
+	 * Create an instance of the class with the input data
+	 *
+	 * @access public
+	 * @param string $data Input data
+	 */
+	function SimplePie_Decode_HTML_Entities($data)
+	{
+		$this->data = $data;
+	}
 
-			case 'EBCDIC-FR':
-			case 'CSEBCDICFR':
-				return 'EBCDIC-FR';
+	/**
+	 * Parse the input data
+	 *
+	 * @access public
+	 * @return string Output data
+	 */
+	function parse()
+	{
+		while (($this->position = strpos($this->data, '&', $this->position)) !== false)
+		{
+			$this->consume();
+			$this->entity();
+			$this->consumed = '';
+		}
+		return $this->data;
+	}
 
-			case 'EBCDIC-IT':
-			case 'CSEBCDICIT':
-				return 'EBCDIC-IT';
+	/**
+	 * Consume the next byte
+	 *
+	 * @access private
+	 * @return mixed The next byte, or false, if there is no more data
+	 */
+	function consume()
+	{
+		if (isset($this->data[$this->position]))
+		{
+			$this->consumed .= $this->data[$this->position];
+			return $this->data[$this->position++];
+		}
+		else
+		{
+			return false;
+		}
+	}
 
-			case 'EBCDIC-PT':
-			case 'CSEBCDICPT':
-				return 'EBCDIC-PT';
+	/**
+	 * Consume a range of characters
+	 *
+	 * @access private
+	 * @param string $chars Characters to consume
+	 * @return mixed A series of characters that match the range, or false
+	 */
+	function consume_range($chars)
+	{
+		if ($len = strspn($this->data, $chars, $this->position))
+		{
+			$data = substr($this->data, $this->position, $len);
+			$this->consumed .= $data;
+			$this->position += $len;
+			return $data;
+		}
+		else
+		{
+			return false;
+		}
+	}
 
-			case 'EBCDIC-ES':
-			case 'CSEBCDICES':
-				return 'EBCDIC-ES';
+	/**
+	 * Unconsume one byte
+	 *
+	 * @access private
+	 */
+	function unconsume()
+	{
+		$this->consumed = substr($this->consumed, 0, -1);
+		$this->position--;
+	}
 
-			case 'EBCDIC-ES-A':
-			case 'CSEBCDICESA':
-				return 'EBCDIC-ES-A';
+	/**
+	 * Decode an entity
+	 *
+	 * @access private
+	 */
+	function entity()
+	{
+		switch ($this->consume())
+		{
+			case "\x09":
+			case "\x0A":
+			case "\x0B":
+			case "\x0B":
+			case "\x0C":
+			case "\x20":
+			case "\x3C":
+			case "\x26":
+			case false:
+				break;
 
-			case 'EBCDIC-ES-S':
-			case 'CSEBCDICESS':
-				return 'EBCDIC-ES-S';
+			case "\x23":
+				switch ($this->consume())
+				{
+					case "\x78":
+					case "\x58":
+						$range = '0123456789ABCDEFabcdef';
+						$hex = true;
+						break;
 
-			case 'EBCDIC-UK':
-			case 'CSEBCDICUK':
-				return 'EBCDIC-UK';
+					default:
+						$range = '0123456789';
+						$hex = false;
+						$this->unconsume();
+						break;
+				}
 
-			case 'EBCDIC-US':
-			case 'CSEBCDICUS':
-				return 'EBCDIC-US';
+				if ($codepoint = $this->consume_range($range))
+				{
+					static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
 
-			case 'UNKNOWN-8BIT':
-			case 'CSUNKNOWN8BIT':
-				return 'UNKNOWN-8BIT';
+					if ($hex)
+					{
+						$codepoint = hexdec($codepoint);
+					}
+					else
+					{
+						$codepoint = intval($codepoint);
+					}
 
-			case 'MNEMONIC':
-			case 'CSMNEMONIC':
-				return 'MNEMONIC';
+					if (isset($windows_1252_specials[$codepoint]))
+					{
+						$replacement = $windows_1252_specials[$codepoint];
+					}
+					else
+					{
+						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
+					}
 
-			case 'MNEM':
-			case 'CSMNEM':
-				return 'MNEM';
+					if (!in_array($this->consume(), array(';', false), true))
+					{
+						$this->unconsume();
+					}
 
-			case 'VISCII':
-			case 'CSVISCII':
-				return 'VISCII';
+					$consumed_length = strlen($this->consumed);
+					$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
+					$this->position += strlen($replacement) - $consumed_length;
+				}
+				break;
 
-			case 'VIQR':
-			case 'CSVIQR':
-				return 'VIQR';
+			default:
+				static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
 
-			case 'KOI8-R':
-			case 'CSKOI8R':
-				return 'KOI8-R';
+				for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
+				{
+					$consumed = substr($this->consumed, 1);
+					if (isset($entities[$consumed]))
+					{
+						$match = $consumed;
+					}
+				}
 
-			case 'HZ-GB-2312':
-				return 'HZ-GB-2312';
+				if ($match !== null)
+				{
+ 					$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
+					$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
+				}
+				break;
+		}
+	}
+}
 
-			case 'IBM866':
-			case 'CP866':
-			case '866':
-			case 'CSIBM866':
-				return 'IBM866';
+/**
+ * IRI parser/serialiser
+ *
+ * @package SimplePie
+ */
+class SimplePie_IRI
+{
+	/**
+	 * Scheme
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $scheme;
 
-			case 'IBM775':
-			case 'CP775':
-			case 'CSPC775BALTIC':
-				return 'IBM775';
+	/**
+	 * User Information
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $userinfo;
 
-			case 'KOI8-U':
-				return 'KOI8-U';
+	/**
+	 * Host
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $host;
 
-			case 'IBM00858':
-			case 'CCSID00858':
-			case 'CP00858':
-			case 'PC-MULTILINGUAL-850+EURO':
-				return 'IBM00858';
+	/**
+	 * Port
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $port;
 
-			case 'IBM00924':
-			case 'CCSID00924':
-			case 'CP00924':
-			case 'EBCDIC-LATIN9--EURO':
-				return 'IBM00924';
+	/**
+	 * Path
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $path;
 
-			case 'IBM01140':
-			case 'CCSID01140':
-			case 'CP01140':
-			case 'EBCDIC-US-37+EURO':
-				return 'IBM01140';
+	/**
+	 * Query
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $query;
 
-			case 'IBM01141':
-			case 'CCSID01141':
-			case 'CP01141':
-			case 'EBCDIC-DE-273+EURO':
-				return 'IBM01141';
+	/**
+	 * Fragment
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $fragment;
 
-			case 'IBM01142':
-			case 'CCSID01142':
-			case 'CP01142':
-			case 'EBCDIC-DK-277+EURO':
-			case 'EBCDIC-NO-277+EURO':
-				return 'IBM01142';
+	/**
+	 * Whether the object represents a valid IRI
+	 *
+	 * @access private
+	 * @var array
+	 */
+	var $valid = array();
 
-			case 'IBM01143':
-			case 'CCSID01143':
-			case 'CP01143':
-			case 'EBCDIC-FI-278+EURO':
-			case 'EBCDIC-SE-278+EURO':
-				return 'IBM01143';
+	/**
+	 * Return the entire IRI when you try and read the object as a string
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function __toString()
+	{
+		return $this->get_iri();
+	}
 
-			case 'IBM01144':
-			case 'CCSID01144':
-			case 'CP01144':
-			case 'EBCDIC-IT-280+EURO':
-				return 'IBM01144';
+	/**
+	 * Create a new IRI object, from a specified string
+	 *
+	 * @access public
+	 * @param string $iri
+	 * @return SimplePie_IRI
+	 */
+	function SimplePie_IRI($iri)
+	{
+		$iri = (string) $iri;
+		if ($iri !== '')
+		{
+			$parsed = $this->parse_iri($iri);
+			$this->set_scheme($parsed['scheme']);
+			$this->set_authority($parsed['authority']);
+			$this->set_path($parsed['path']);
+			$this->set_query($parsed['query']);
+			$this->set_fragment($parsed['fragment']);
+		}
+	}
 
-			case 'IBM01145':
-			case 'CCSID01145':
-			case 'CP01145':
-			case 'EBCDIC-ES-284+EURO':
-				return 'IBM01145';
+	/**
+	 * Create a new IRI object by resolving a relative IRI
+	 *
+	 * @static
+	 * @access public
+	 * @param SimplePie_IRI $base Base IRI
+	 * @param string $relative Relative IRI
+	 * @return SimplePie_IRI
+	 */
+	function absolutize($base, $relative)
+	{
+		$relative = (string) $relative;
+		if ($relative !== '')
+		{
+			$relative = new SimplePie_IRI($relative);
+			if ($relative->get_scheme() !== null)
+			{
+				$target = $relative;
+			}
+			elseif ($base->get_iri() !== null)
+			{
+				if ($relative->get_authority() !== null)
+				{
+					$target = $relative;
+					$target->set_scheme($base->get_scheme());
+				}
+				else
+				{
+					$target = new SimplePie_IRI('');
+					$target->set_scheme($base->get_scheme());
+					$target->set_userinfo($base->get_userinfo());
+					$target->set_host($base->get_host());
+					$target->set_port($base->get_port());
+					if ($relative->get_path() !== null)
+					{
+						if (strpos($relative->get_path(), '/') === 0)
+						{
+							$target->set_path($relative->get_path());
+						}
+						elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null)
+						{
+							$target->set_path('/' . $relative->get_path());
+						}
+						elseif (($last_segment = strrpos($base->get_path(), '/')) !== false)
+						{
+							$target->set_path(substr($base->get_path(), 0, $last_segment + 1) . $relative->get_path());
+						}
+						else
+						{
+							$target->set_path($relative->get_path());
+						}
+						$target->set_query($relative->get_query());
+					}
+					else
+					{
+						$target->set_path($base->get_path());
+						if ($relative->get_query() !== null)
+						{
+							$target->set_query($relative->get_query());
+						}
+						elseif ($base->get_query() !== null)
+						{
+							$target->set_query($base->get_query());
+						}
+					}
+				}
+				$target->set_fragment($relative->get_fragment());
+			}
+			else
+			{
+				// No base URL, just return the relative URL
+				$target = $relative;
+			}
+		}
+		else
+		{
+			$target = $base;
+		}
+		return $target;
+	}
 
-			case 'IBM01146':
-			case 'CCSID01146':
-			case 'CP01146':
-			case 'EBCDIC-GB-285+EURO':
-				return 'IBM01146';
+	/**
+	 * Parse an IRI into scheme/authority/path/query/fragment segments
+	 *
+	 * @access private
+	 * @param string $iri
+	 * @return array
+	 */
+	function parse_iri($iri)
+	{
+		preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match);
+		for ($i = count($match); $i <= 9; $i++)
+		{
+			$match[$i] = '';
+		}
+		return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
+	}
 
-			case 'IBM01147':
-			case 'CCSID01147':
-			case 'CP01147':
-			case 'EBCDIC-FR-297+EURO':
-				return 'IBM01147';
+	/**
+	 * Remove dot segments from a path
+	 *
+	 * @access private
+	 * @param string $input
+	 * @return string
+	 */
+	function remove_dot_segments($input)
+	{
+		$output = '';
+		while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
+		{
+			// A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
+			if (strpos($input, '../') === 0)
+			{
+				$input = substr($input, 3);
+			}
+			elseif (strpos($input, './') === 0)
+			{
+				$input = substr($input, 2);
+			}
+			// B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
+			elseif (strpos($input, '/./') === 0)
+			{
+				$input = substr_replace($input, '/', 0, 3);
+			}
+			elseif ($input === '/.')
+			{
+				$input = '/';
+			}
+			// C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
+			elseif (strpos($input, '/../') === 0)
+			{
+				$input = substr_replace($input, '/', 0, 4);
+				$output = substr_replace($output, '', strrpos($output, '/'));
+			}
+			elseif ($input === '/..')
+			{
+				$input = '/';
+				$output = substr_replace($output, '', strrpos($output, '/'));
+			}
+			// D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
+			elseif ($input === '.' || $input === '..')
+			{
+				$input = '';
+			}
+			// E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
+			elseif (($pos = strpos($input, '/', 1)) !== false)
+			{
+				$output .= substr($input, 0, $pos);
+				$input = substr_replace($input, '', 0, $pos);
+			}
+			else
+			{
+				$output .= $input;
+				$input = '';
+			}
+		}
+		return $output . $input;
+	}
 
-			case 'IBM01148':
-			case 'CCSID01148':
-			case 'CP01148':
-			case 'EBCDIC-INTERNATIONAL-500+EURO':
-				return 'IBM01148';
+	/**
+	 * Replace invalid character with percent encoding
+	 *
+	 * @access private
+	 * @param string $string Input string
+	 * @param string $valid_chars Valid characters
+	 * @param int $case Normalise case
+	 * @return string
+	 */
+	function replace_invalid_with_pct_encoding($string, $valid_chars, $case = SIMPLEPIE_SAME_CASE)
+	{
+		// Normalise case
+		if ($case & SIMPLEPIE_LOWERCASE)
+		{
+			$string = strtolower($string);
+		}
+		elseif ($case & SIMPLEPIE_UPPERCASE)
+		{
+			$string = strtoupper($string);
+		}
 
-			case 'IBM01149':
-			case 'CCSID01149':
-			case 'CP01149':
-			case 'EBCDIC-IS-871+EURO':
-				return 'IBM01149';
+		// Store position and string length (to avoid constantly recalculating this)
+		$position = 0;
+		$strlen = strlen($string);
 
-			case 'BIG5-HKSCS':
-				return 'Big5-HKSCS';
+		// Loop as long as we have invalid characters, advancing the position to the next invalid character
+		while (($position += strspn($string, $valid_chars, $position)) < $strlen)
+		{
+			// If we have a % character
+			if ($string[$position] === '%')
+			{
+				// If we have a pct-encoded section
+				if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2)
+				{
+					// Get the the represented character
+					$chr = chr(hexdec(substr($string, $position + 1, 2)));
 
-			case 'IBM1047':
-			case 'IBM-1047':
-				return 'IBM1047';
+					// If the character is valid, replace the pct-encoded with the actual character while normalising case
+					if (strpos($valid_chars, $chr) !== false)
+					{
+						if ($case & SIMPLEPIE_LOWERCASE)
+						{
+							$chr = strtolower($chr);
+						}
+						elseif ($case & SIMPLEPIE_UPPERCASE)
+						{
+							$chr = strtoupper($chr);
+						}
+						$string = substr_replace($string, $chr, $position, 3);
+						$strlen -= 2;
+						$position++;
+					}
 
-			case 'PTCP154':
-			case 'CSPTCP154':
-			case 'PT154':
-			case 'CP154':
-			case 'CYRILLIC-ASIAN':
-				return 'PTCP154';
+					// Otherwise just normalise the pct-encoded to uppercase
+					else
+					{
+						$string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2);
+						$position += 3;
+					}
+				}
+				// If we don't have a pct-encoded section, just replace the % with its own esccaped form
+				else
+				{
+					$string = substr_replace($string, '%25', $position, 1);
+					$strlen += 2;
+					$position += 3;
+				}
+			}
+			// If we have an invalid character, change into its pct-encoded form
+			else
+			{
+				$replacement = sprintf("%%%02X", ord($string[$position]));
+				$string = str_replace($string[$position], $replacement, $string);
+				$strlen = strlen($string);
+			}
+		}
+		return $string;
+	}
 
-			case 'AMIGA-1251':
-			case 'AMI1251':
-			case 'AMIGA1251':
-			case 'AMI-1251':
-				return 'Amiga-1251';
+	/**
+	 * Check if the object represents a valid IRI
+	 *
+	 * @access public
+	 * @return bool
+	 */
+	function is_valid()
+	{
+		return array_sum($this->valid) === count($this->valid);
+	}
 
-			case 'KOI7-SWITCHED':
-				return 'KOI7-switched';
+	/**
+	 * Set the scheme. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @access public
+	 * @param string $scheme
+	 * @return bool
+	 */
+	function set_scheme($scheme)
+	{
+		if ($scheme === null || $scheme === '')
+		{
+			$this->scheme = null;
+		}
+		else
+		{
+			$len = strlen($scheme);
+			switch (true)
+			{
+				case $len > 1:
+					if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
+					{
+						$this->scheme = null;
+						$this->valid[__FUNCTION__] = false;
+						return false;
+					}
 
-			case 'BRF':
-			case 'CSBRF':
-				return 'BRF';
+				case $len > 0:
+					if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
+					{
+						$this->scheme = null;
+						$this->valid[__FUNCTION__] = false;
+						return false;
+					}
+			}
+			$this->scheme = strtolower($scheme);
+		}
+		$this->valid[__FUNCTION__] = true;
+		return true;
+	}
 
-			case 'TSCII':
-			case 'CSTSCII':
-				return 'TSCII';
+	/**
+	 * Set the authority. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @access public
+	 * @param string $authority
+	 * @return bool
+	 */
+	function set_authority($authority)
+	{
+		if (($userinfo_end = strrpos($authority, '@')) !== false)
+		{
+			$userinfo = substr($authority, 0, $userinfo_end);
+			$authority = substr($authority, $userinfo_end + 1);
+		}
+		else
+		{
+			$userinfo = null;
+		}
 
-			case 'WINDOWS-1250':
-				return 'windows-1250';
+		if (($port_start = strpos($authority, ':')) !== false)
+		{
+			$port = substr($authority, $port_start + 1);
+			$authority = substr($authority, 0, $port_start);
+		}
+		else
+		{
+			$port = null;
+		}
 
-			case 'WINDOWS-1251':
-				return 'windows-1251';
+		return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port);
+	}
 
-			case 'WINDOWS-1252':
-				return 'windows-1252';
+	/**
+	 * Set the userinfo.
+	 *
+	 * @access public
+	 * @param string $userinfo
+	 * @return bool
+	 */
+	function set_userinfo($userinfo)
+	{
+		if ($userinfo === null || $userinfo === '')
+		{
+			$this->userinfo = null;
+		}
+		else
+		{
+			$this->userinfo = $this->replace_invalid_with_pct_encoding($userinfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:');
+		}
+		$this->valid[__FUNCTION__] = true;
+		return true;
+	}
 
-			case 'WINDOWS-1253':
-				return 'windows-1253';
+	/**
+	 * Set the host. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @access public
+	 * @param string $host
+	 * @return bool
+	 */
+	function set_host($host)
+	{
+		if ($host === null || $host === '')
+		{
+			$this->host = null;
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+		elseif ($host[0] === '[' && substr($host, -1) === ']')
+		{
+			if (Net_IPv6::checkIPv6(substr($host, 1, -1)))
+			{
+				$this->host = $host;
+				$this->valid[__FUNCTION__] = true;
+				return true;
+			}
+			else
+			{
+				$this->host = null;
+				$this->valid[__FUNCTION__] = false;
+				return false;
+			}
+		}
+		else
+		{
+			$this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE);
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+	}
 
-			case 'WINDOWS-1254':
-				return 'windows-1254';
+	/**
+	 * Set the port. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @access public
+	 * @param string $port
+	 * @return bool
+	 */
+	function set_port($port)
+	{
+		if ($port === null || $port === '')
+		{
+			$this->port = null;
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+		elseif (strspn($port, '0123456789') === strlen($port))
+		{
+			$this->port = (int) $port;
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+		else
+		{
+			$this->port = null;
+			$this->valid[__FUNCTION__] = false;
+			return false;
+		}
+	}
 
-			case 'WINDOWS-1255':
-				return 'windows-1255';
+	/**
+	 * Set the path.
+	 *
+	 * @access public
+	 * @param string $path
+	 * @return bool
+	 */
+	function set_path($path)
+	{
+		if ($path === null || $path === '')
+		{
+			$this->path = null;
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+		elseif (substr($path, 0, 2) === '//' && $this->userinfo === null && $this->host === null && $this->port === null)
+		{
+			$this->path = null;
+			$this->valid[__FUNCTION__] = false;
+			return false;
+		}
+		else
+		{
+			$this->path = $this->replace_invalid_with_pct_encoding($path, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=@/');
+			if ($this->scheme !== null)
+			{
+				$this->path = $this->remove_dot_segments($this->path);
+			}
+			$this->valid[__FUNCTION__] = true;
+			return true;
+		}
+	}
 
-			case 'WINDOWS-1256':
-				return 'windows-1256';
+	/**
+	 * Set the query.
+	 *
+	 * @access public
+	 * @param string $query
+	 * @return bool
+	 */
+	function set_query($query)
+	{
+		if ($query === null || $query === '')
+		{
+			$this->query = null;
+		}
+		else
+		{
+			$this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
+		}
+		$this->valid[__FUNCTION__] = true;
+		return true;
+	}
 
-			case 'WINDOWS-1257':
-				return 'windows-1257';
+	/**
+	 * Set the fragment.
+	 *
+	 * @access public
+	 * @param string $fragment
+	 * @return bool
+	 */
+	function set_fragment($fragment)
+	{
+		if ($fragment === null || $fragment === '')
+		{
+			$this->fragment = null;
+		}
+		else
+		{
+			$this->fragment = $this->replace_invalid_with_pct_encoding($fragment, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
+		}
+		$this->valid[__FUNCTION__] = true;
+		return true;
+	}
 
-			case 'WINDOWS-1258':
-				return 'windows-1258';
+	/**
+	 * Get the complete IRI
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_iri()
+	{
+		$iri = '';
+		if ($this->scheme !== null)
+		{
+			$iri .= $this->scheme . ':';
+		}
+		if (($authority = $this->get_authority()) !== null)
+		{
+			$iri .= '//' . $authority;
+		}
+		if ($this->path !== null)
+		{
+			$iri .= $this->path;
+		}
+		if ($this->query !== null)
+		{
+			$iri .= '?' . $this->query;
+		}
+		if ($this->fragment !== null)
+		{
+			$iri .= '#' . $this->fragment;
+		}
 
-			default:
-				return (string) $encoding;
+		if ($iri !== '')
+		{
+			return $iri;
+		}
+		else
+		{
+			return null;
 		}
 	}
 
-	function get_curl_version()
+	/**
+	 * Get the scheme
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_scheme()
 	{
-		if (is_array($curl = curl_version()))
+		return $this->scheme;
+	}
+
+	/**
+	 * Get the complete authority
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_authority()
+	{
+		$authority = '';
+		if ($this->userinfo !== null)
 		{
-			$curl = $curl['version'];
+			$authority .= $this->userinfo . '@';
 		}
-		elseif (substr($curl, 0, 5) == 'curl/')
+		if ($this->host !== null)
 		{
-			$curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
+			$authority .= $this->host;
 		}
-		elseif (substr($curl, 0, 8) == 'libcurl/')
+		if ($this->port !== null)
 		{
-			$curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
+			$authority .= ':' . $this->port;
+		}
+
+		if ($authority !== '')
+		{
+			return $authority;
 		}
 		else
 		{
-			$curl = 0;
+			return null;
 		}
-		return $curl;
 	}
 
-	function is_subclass_of($class1, $class2)
+	/**
+	 * Get the user information
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_userinfo()
+	{
+		return $this->userinfo;
+	}
+
+	/**
+	 * Get the host
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_host()
+	{
+		return $this->host;
+	}
+
+	/**
+	 * Get the port
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_port()
+	{
+		return $this->port;
+	}
+
+	/**
+	 * Get the path
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_path()
+	{
+		return $this->path;
+	}
+
+	/**
+	 * Get the query
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_query()
+	{
+		return $this->query;
+	}
+
+	/**
+	 * Get the fragment
+	 *
+	 * @access public
+	 * @return string
+	 */
+	function get_fragment()
+	{
+		return $this->fragment;
+	}
+}
+
+/**
+ * Class to validate and to work with IPv6 addresses.
+ *
+ * @package SimplePie
+ * @copyright 2003-2005 The PHP Group
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Net_IPv6
+ * @author Alexander Merz <alexander.merz@web.de>
+ * @author elfrink at introweb dot nl
+ * @author Josh Peck <jmp at joshpeck dot org>
+ * @author Geoffrey Sneddon <geoffers@gmail.com>
+ */
+class SimplePie_Net_IPv6
+{
+	/**
+	 * Removes a possible existing netmask specification of an IP address.
+	 *
+	 * @param string $ip the (compressed) IP as Hex representation
+	 * @return string the IP the without netmask
+	 * @since 1.1.0
+	 * @access public
+	 * @static
+	 */
+	function removeNetmaskSpec($ip)
 	{
-		if (func_num_args() != 2)
+		if (strpos($ip, '/') !== false)
 		{
-			trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
+			list($addr, $nm) = explode('/', $ip);
 		}
-		elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
+		else
 		{
-			return is_subclass_of($class1, $class2);
+			$addr = $ip;
 		}
-		elseif (is_string($class1) && is_string($class2))
+		return $addr;
+	}
+
+	/**
+	 * Uncompresses an IPv6 address
+	 *
+	 * RFC 2373 allows you to compress zeros in an address to '::'. This
+	 * function expects an valid IPv6 address and expands the '::' to
+	 * the required zeros.
+	 *
+	 * Example:	 FF01::101	->	FF01:0:0:0:0:0:0:101
+	 *			 ::1		->	0:0:0:0:0:0:0:1
+	 *
+	 * @access public
+	 * @static
+	 * @param string $ip a valid IPv6-address (hex format)
+	 * @return string the uncompressed IPv6-address (hex format)
+	 */
+	function Uncompress($ip)
+	{
+		$uip = SimplePie_Net_IPv6::removeNetmaskSpec($ip);
+		$c1 = -1;
+		$c2 = -1;
+		if (strpos($ip, '::') !== false)
 		{
-			if (class_exists($class1))
+			list($ip1, $ip2) = explode('::', $ip);
+			if ($ip1 === '')
+			{
+				$c1 = -1;
+			}
+			else
+			{
+				$pos = 0;
+				if (($pos = substr_count($ip1, ':')) > 0)
+				{
+					$c1 = $pos;
+				}
+				else
+				{
+					$c1 = 0;
+				}
+			}
+			if ($ip2 === '')
+			{
+				$c2 = -1;
+			}
+			else
 			{
-				if (class_exists($class2))
+				$pos = 0;
+				if (($pos = substr_count($ip2, ':')) > 0)
 				{
-					$class2 = strtolower($class2);
-					while ($class1 = strtolower(get_parent_class($class1)))
-					{
-						if ($class1 == $class2)
-						{
-							return true;
-						}
-					}
+					$c2 = $pos;
+				}
+				else
+				{
+					$c2 = 0;
 				}
 			}
+			if (strstr($ip2, '.'))
+			{
+				$c2++;
+			}
+			// ::
+			if ($c1 === -1 && $c2 === -1)
+			{
+				$uip = '0:0:0:0:0:0:0:0';
+			}
+			// ::xxx
+			else if ($c1 === -1)
+			{
+				$fill = str_repeat('0:', 7 - $c2);
+				$uip =	str_replace('::', $fill, $uip);
+			}
+			// xxx::
+			else if ($c2 === -1)
+			{
+				$fill = str_repeat(':0', 7 - $c1);
+				$uip =	str_replace('::', $fill, $uip);
+			}
+			// xxx::xxx
 			else
 			{
-				trigger_error('Unknown class passed as parameter', E_USER_WARNNG);
+				$fill = str_repeat(':0:', 6 - $c2 - $c1);
+				$uip =	str_replace('::', $fill, $uip);
+				$uip =	str_replace('::', ':', $uip);
 			}
 		}
-		return false;
+		return $uip;
 	}
 
 	/**
-	 * Strip HTML comments
+	 * Splits an IPv6 address into the IPv6 and a possible IPv4 part
+	 *
+	 * RFC 2373 allows you to note the last two parts of an IPv6 address as
+	 * an IPv4 compatible address
+	 *
+	 * Example:	 0:0:0:0:0:0:13.1.68.3
+	 *			 0:0:0:0:0:FFFF:129.144.52.38
 	 *
 	 * @access public
-	 * @param string $data Data to strip comments from
-	 * @return string Comment stripped string
+	 * @static
+	 * @param string $ip a valid IPv6-address (hex format)
+	 * @return array [0] contains the IPv6 part, [1] the IPv4 part (hex format)
 	 */
-	function strip_comments($data)
+	function SplitV64($ip)
 	{
-		$output = '';
-		while (($start = strpos($data, '<!--')) !== false)
+		$ip = SimplePie_Net_IPv6::Uncompress($ip);
+		if (strstr($ip, '.'))
 		{
-			$output .= substr($data, 0, $start);
-			if (($end = strpos($data, '-->', $start)) !== false)
-			{
-				$data = substr_replace($data, '', 0, $end + 3);
-			}
-			else
-			{
-				$data = '';
-			}
+			$pos = strrpos($ip, ':');
+			$ip[$pos] = '_';
+			$ipPart = explode('_', $ip);
+			return $ipPart;
+		}
+		else
+		{
+			return array($ip, '');
 		}
-		return $output . $data;
 	}
 
-	function parse_date($dt, $rfc822_tz = true)
+	/**
+	 * Checks an IPv6 address
+	 *
+	 * Checks if the given IP is IPv6-compatible
+	 *
+	 * @access public
+	 * @static
+	 * @param string $ip a valid IPv6-address
+	 * @return bool true if $ip is an IPv6 address
+	 */
+	function checkIPv6($ip)
 	{
-		static $cache = array();
-		if (!isset($cache[$dt][$rfc822_tz]))
+		$ipPart = SimplePie_Net_IPv6::SplitV64($ip);
+		$count = 0;
+		if (!empty($ipPart[0]))
 		{
-			$dt = SimplePie_Misc::uncomment_rfc822($dt);
-			/*
-			Capturing subpatterns:
-			1: RFC 822 date
-			2: RFC 822 day
-			3: RFC 822 month
-			4: RFC 822 year
-			5: ISO 8601 date
-			6: ISO 8601 century
-			7: ISO 8601 year
-			8: ISO 8601 month
-			9: ISO 8601 day
-			10: ISO 8601 ordinal day
-			11: ISO 8601 month
-			12: ISO 8601 day
-			13: ISO 8601 week
-			14: ISO 8601 day of week
-			15: Time
-			16: Hour
-			17: Hour Decimal
-			18: Minute
-			19: Minute Decimal
-			20: Second
-			21: Second Decimal
-			22: Timezone
-			23: Diff ±
-			24: Hour
-			25: Hour Decimal
-			26: Minute
-			27: Minute Decimal
-			28: Alphabetic Timezone
-			*/
-			if (preg_match('/^(?:(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)[,\s]+)?(([0-9]{1,2})\s*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s*([0-9]{4}|[0-9]{2}))|(([0-9]{2})(?:([0-9]{2})(?:(?:-|\s)*(?:([0-9]{2})([0-9]{2})|([0-9]{3})|([0-9]{2})(?:(?:-|\s)*([0-9]{2}))?|W([0-9]{2})(?:(?:-|\s)*([0-9]))?))?)?))((?:T|\s)+([0-9]{2})(?:(?:,|\.)([0-9]*)|(?:\:|\s)*([0-9]{2})(?:(?:,|\.)([0-9]*)|(?:\:|\s)*([0-9]{2})(?:(?:,|\.)([0-9]*))?)?)?(?:\s)*((?:(\+|-)([0-9]{2})(?:(?:,|\.)([0-9]*)|(?:\:|\s)*(?:([0-9]{2})(?:(?:,|\.)([0-9]*))?))?)|(UTC|GMT|EST|CST|MST|PST|EDT|CDT|MDT|PDT|UT|[A-IK-Z]))?)?$/i', $dt, $match))
+			$ipv6 = explode(':', $ipPart[0]);
+			for ($i = 0; $i < count($ipv6); $i++)
 			{
-				// Fill all matches
-				for ($i = count($match); $i <= 28; $i++)
+				$dec = hexdec($ipv6[$i]);
+				$hex = strtoupper(preg_replace('/^[0]{1,3}(.*[0-9a-fA-F])$/', '\\1', $ipv6[$i]));
+				if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex === strtoupper(dechex($dec)))
 				{
-					$match[$i] = '';
+					$count++;
 				}
-
-				// Set blank vars
-				$year = 1970;
-				$month = 1;
-				$day = 1;
-				$hour = 0;
-				$minute = 0;
-				$second = 0;
-				$timezone = false;
-
-				// RFC 822
-				if ($match[1] !== '')
+			}
+			if ($count === 8)
+			{
+				return true;
+			}
+			elseif ($count === 6 && !empty($ipPart[1]))
+			{
+				$ipv4 = explode('.', $ipPart[1]);
+				$count = 0;
+				foreach ($ipv4 as $ipv4_part)
 				{
-					if (strlen($match[4]) == 2)
-					{
-						$year = ($match[4] < 70) ? "20$match[4]" : "19$match[4]";
-					}
-					else
+					if ($ipv4_part >= 0 && $ipv4_part <= 255 && preg_match('/^\d{1,3}$/', $ipv4_part))
 					{
-						$year = $match[4];
+						$count++;
 					}
-					switch (strtolower($match[3]))
-					{
-						case 'jan':
-							$month = 1;
-							break;
-
-						case 'feb':
-							$month = 2;
-							break;
-
-						case 'mar':
-							$month = 3;
-							break;
-
-						case 'apr':
-							$month = 4;
-							break;
-
-						case 'may':
-							$month = 5;
-							break;
-
-						case 'jun':
-							$month = 6;
-							break;
-
-						case 'jul':
-							$month = 7;
-							break;
-
-						case 'aug':
-							$month = 8;
-							break;
-
-						case 'sep':
-							$month = 9;
-							break;
-
-						case 'oct':
-							$month = 10;
-							break;
-
-						case 'nov':
-							$month = 11;
-							break;
-
-						case 'dec':
-							$month = 12;
-							break;
-					}
-					$day = $match[2];
 				}
-				// ISO 8601
-				else
+				if ($count === 4)
 				{
-					// Year
-					if ($match[7] !== '')
-					{
-						$year = "$match[6]$match[7]";
-
-						// Two Digit Month/Day
-						if ($match[11] !== '')
-						{
-							$month = $match[11];
-							if ($match[12] !== '')
-							{
-								$day = $match[12];
-							}
-						}
-
-						// Four Digit Month/Day
-						elseif ($match[8] !== '')
-						{
-							$month = $match[8];
-							$day = $match[9];
-						}
-
-						// Ordinal Day
-						elseif ($match[10] !== '')
-						{
-							$day = $match[10];
-						}
-
-						// Week Date
-						elseif ($match[13] !== '')
-						{
-							// Week Day
-							if ($match[14] !== '')
-							{
-								$day = $match[14];
-							}
-
-							$first_day_of_year = date('w', mktime(0, 0, 0, 1, 1, $year));
-							if ($first_day_of_year == 0)
-							{
-								$first_day_of_year = 7;
-							}
-
-							$day = 7 * ($match[13] - 1) + $day - ($first_day_of_year - 1);
-						}
-					}
-					else
-					{
-						$year = "$match[6]00";
-					}
+					return true;
 				}
-				// Time
-				if ($match[15] !== '')
-				{
-					$time = 0;
-					$time += ($match[16] + ('.' . $match[17])) * 3600;
-					$time += ($match[18] + ('.' . $match[19])) * 60;
-					$time += $match[20] + ('.' . $match[21]);
-					$hour = floor($time / 3600);
-					$time -= $hour * 3600;
-					$minute = floor($time / 60);
-					$time -= $minute * 60;
-					$second = round($time);
-
-					// Timezone
-					if ($match[22] !== '')
-					{
-						// Alphabetic Timezone
-						if ($match[28] !== '')
-						{
-							// Military
-							if (strlen($match[28]) == 1)
-							{
-								if ($match[28] == 'Z' || $match[28] == 'z' || !$rfc822_tz)
-								{
-									$timezone = 0;
-								}
-								else
-								{
-									$timezone = ord(strtoupper($match[28]));
+			}
+			else
+			{
+				return false;
+			}
 
-									if ($timezone > 74)
-									{
-										$timezone--;
-									}
+		}
+		else
+		{
+			return false;
+		}
+	}
+}
 
-									if ($timezone <= 76)
-									{
-										$timezone = -($timezone - 64);
-									}
-									else
-									{
-										$timezone -= 76;
-									}
+/**
+ * Date Parser
+ *
+ * @package SimplePie
+ */
+class SimplePie_Parse_Date
+{
+	/**
+	 * Input data
+	 *
+	 * @access protected
+	 * @var string
+	 */
+	var $date;
 
-									$timezone *= 3600;
-								}
-							}
-							// Code
-							else
-							{
-								switch (strtoupper($match[28]))
-								{
-									case 'UT':
-									case 'UTC':
-									case 'GMT':
-										$timezone = 0;
-										break;
+	/**
+	 * List of days, calendar day name => ordinal day number in the week
+	 *
+	 * @access protected
+	 * @var array
+	 */
+	var $day = array(
+		// English
+		'mon' => 1,
+		'monday' => 1,
+		'tue' => 2,
+		'tuesday' => 2,
+		'wed' => 3,
+		'wednesday' => 3,
+		'thu' => 4,
+		'thursday' => 4,
+		'fri' => 5,
+		'friday' => 5,
+		'sat' => 6,
+		'saturday' => 6,
+		'sun' => 7,
+		'sunday' => 7,
+		// Dutch
+		'maandag' => 1,
+		'dinsdag' => 2,
+		'woensdag' => 3,
+		'donderdag' => 4,
+		'vrijdag' => 5,
+		'zaterdag' => 6,
+		'zondag' => 7,
+		// French
+		'lundi' => 1,
+		'mardi' => 2,
+		'mercredi' => 3,
+		'jeudi' => 4,
+		'vendredi' => 5,
+		'samedi' => 6,
+		'dimanche' => 7,
+		// German
+		'montag' => 1,
+		'dienstag' => 2,
+		'mittwoch' => 3,
+		'donnerstag' => 4,
+		'freitag' => 5,
+		'samstag' => 6,
+		'sonnabend' => 6,
+		'sonntag' => 7,
+		// Italian
+		'lunedì' => 1,
+		'martedì' => 2,
+		'mercoledì' => 3,
+		'giovedì' => 4,
+		'venerdì' => 5,
+		'sabato' => 6,
+		'domenica' => 7,
+		// Spanish
+		'lunes' => 1,
+		'martes' => 2,
+		'miércoles' => 3,
+		'jueves' => 4,
+		'viernes' => 5,
+		'sábado' => 6,
+		'domingo' => 7,
+		// Finnish
+		'maanantai' => 1,
+		'tiistai' => 2,
+		'keskiviikko' => 3,
+		'torstai' => 4,
+		'perjantai' => 5,
+		'lauantai' => 6,
+		'sunnuntai' => 7,
+		// Hungarian
+		'hétfő' => 1,
+		'kedd' => 2,
+		'szerda' => 3,
+		'csütörtok' => 4,
+		'péntek' => 5,
+		'szombat' => 6,
+		'vasárnap' => 7,
+		// Greek
+		'Δευ' => 1,
+		'Τρι' => 2,
+		'Τετ' => 3,
+		'Πεμ' => 4,
+		'Παρ' => 5,
+		'Σαβ' => 6,
+		'Κυρ' => 7,
+	);
 
-									case 'EST':
-										$timezone = -18000;
-										break;
+	/**
+	 * List of months, calendar month name => calendar month number
+	 *
+	 * @access protected
+	 * @var array
+	 */
+	var $month = array(
+		// English
+		'jan' => 1,
+		'january' => 1,
+		'feb' => 2,
+		'february' => 2,
+		'mar' => 3,
+		'march' => 3,
+		'apr' => 4,
+		'april' => 4,
+		'may' => 5,
+		// No long form of May
+		'jun' => 6,
+		'june' => 6,
+		'jul' => 7,
+		'july' => 7,
+		'aug' => 8,
+		'august' => 8,
+		'sep' => 9,
+		'september' => 8,
+		'oct' => 10,
+		'october' => 10,
+		'nov' => 11,
+		'november' => 11,
+		'dec' => 12,
+		'december' => 12,
+		// Dutch
+		'januari' => 1,
+		'februari' => 2,
+		'maart' => 3,
+		'april' => 4,
+		'mei' => 5,
+		'juni' => 6,
+		'juli' => 7,
+		'augustus' => 8,
+		'september' => 9,
+		'oktober' => 10,
+		'november' => 11,
+		'december' => 12,
+		// French
+		'janvier' => 1,
+		'février' => 2,
+		'mars' => 3,
+		'avril' => 4,
+		'mai' => 5,
+		'juin' => 6,
+		'juillet' => 7,
+		'août' => 8,
+		'septembre' => 9,
+		'octobre' => 10,
+		'novembre' => 11,
+		'décembre' => 12,
+		// German
+		'januar' => 1,
+		'februar' => 2,
+		'märz' => 3,
+		'april' => 4,
+		'mai' => 5,
+		'juni' => 6,
+		'juli' => 7,
+		'august' => 8,
+		'september' => 9,
+		'oktober' => 10,
+		'november' => 11,
+		'dezember' => 12,
+		// Italian
+		'gennaio' => 1,
+		'febbraio' => 2,
+		'marzo' => 3,
+		'aprile' => 4,
+		'maggio' => 5,
+		'giugno' => 6,
+		'luglio' => 7,
+		'agosto' => 8,
+		'settembre' => 9,
+		'ottobre' => 10,
+		'novembre' => 11,
+		'dicembre' => 12,
+		// Spanish
+		'enero' => 1,
+		'febrero' => 2,
+		'marzo' => 3,
+		'abril' => 4,
+		'mayo' => 5,
+		'junio' => 6,
+		'julio' => 7,
+		'agosto' => 8,
+		'septiembre' => 9,
+		'setiembre' => 9,
+		'octubre' => 10,
+		'noviembre' => 11,
+		'diciembre' => 12,
+		// Finnish
+		'tammikuu' => 1,
+		'helmikuu' => 2,
+		'maaliskuu' => 3,
+		'huhtikuu' => 4,
+		'toukokuu' => 5,
+		'kesäkuu' => 6,
+		'heinäkuu' => 7,
+		'elokuu' => 8,
+		'suuskuu' => 9,
+		'lokakuu' => 10,
+		'marras' => 11,
+		'joulukuu' => 12,
+		// Hungarian
+		'január' => 1,
+		'február' => 2,
+		'március' => 3,
+		'április' => 4,
+		'május' => 5,
+		'június' => 6,
+		'július' => 7,
+		'augusztus' => 8,
+		'szeptember' => 9,
+		'október' => 10,
+		'november' => 11,
+		'december' => 12,
+		// Greek
+		'Ιαν' => 1,
+		'Φεβ' => 2,
+		'Μάώ' => 3,
+		'Μαώ' => 3,
+		'Απρ' => 4,
+		'Μάι' => 5,
+		'Μαϊ' => 5,
+		'Μαι' => 5,
+		'Ιούν' => 6,
+		'Ιον' => 6,
+		'Ιούλ' => 7,
+		'Ιολ' => 7,
+		'Αύγ' => 8,
+		'Αυγ' => 8,
+		'Σεπ' => 9,
+		'Οκτ' => 10,
+		'Νοέ' => 11,
+		'Δεκ' => 12,
+	);
 
-									case 'CST':
-										$timezone = -21600;
-										break;
+	/**
+	 * List of timezones, abbreviation => offset from UTC
+	 *
+	 * @access protected
+	 * @var array
+	 */
+	var $timezone = array(
+		'ACDT' => 37800,
+		'ACIT' => 28800,
+		'ACST' => 34200,
+		'ACT' => -18000,
+		'ACWDT' => 35100,
+		'ACWST' => 31500,
+		'AEDT' => 39600,
+		'AEST' => 36000,
+		'AFT' => 16200,
+		'AKDT' => -28800,
+		'AKST' => -32400,
+		'AMDT' => 18000,
+		'AMT' => -14400,
+		'ANAST' => 46800,
+		'ANAT' => 43200,
+		'ART' => -10800,
+		'AZOST' => -3600,
+		'AZST' => 18000,
+		'AZT' => 14400,
+		'BIOT' => 21600,
+		'BIT' => -43200,
+		'BOT' => -14400,
+		'BRST' => -7200,
+		'BRT' => -10800,
+		'BST' => 3600,
+		'BTT' => 21600,
+		'CAST' => 18000,
+		'CAT' => 7200,
+		'CCT' => 23400,
+		'CDT' => -18000,
+		'CEDT' => 7200,
+		'CET' => 3600,
+		'CGST' => -7200,
+		'CGT' => -10800,
+		'CHADT' => 49500,
+		'CHAST' => 45900,
+		'CIST' => -28800,
+		'CKT' => -36000,
+		'CLDT' => -10800,
+		'CLST' => -14400,
+		'COT' => -18000,
+		'CST' => -21600,
+		'CVT' => -3600,
+		'CXT' => 25200,
+		'DAVT' => 25200,
+		'DTAT' => 36000,
+		'EADT' => -18000,
+		'EAST' => -21600,
+		'EAT' => 10800,
+		'ECT' => -18000,
+		'EDT' => -14400,
+		'EEST' => 10800,
+		'EET' => 7200,
+		'EGT' => -3600,
+		'EKST' => 21600,
+		'EST' => -18000,
+		'FJT' => 43200,
+		'FKDT' => -10800,
+		'FKST' => -14400,
+		'FNT' => -7200,
+		'GALT' => -21600,
+		'GEDT' => 14400,
+		'GEST' => 10800,
+		'GFT' => -10800,
+		'GILT' => 43200,
+		'GIT' => -32400,
+		'GST' => 14400,
+		'GST' => -7200,
+		'GYT' => -14400,
+		'HAA' => -10800,
+		'HAC' => -18000,
+		'HADT' => -32400,
+		'HAE' => -14400,
+		'HAP' => -25200,
+		'HAR' => -21600,
+		'HAST' => -36000,
+		'HAT' => -9000,
+		'HAY' => -28800,
+		'HKST' => 28800,
+		'HMT' => 18000,
+		'HNA' => -14400,
+		'HNC' => -21600,
+		'HNE' => -18000,
+		'HNP' => -28800,
+		'HNR' => -25200,
+		'HNT' => -12600,
+		'HNY' => -32400,
+		'IRDT' => 16200,
+		'IRKST' => 32400,
+		'IRKT' => 28800,
+		'IRST' => 12600,
+		'JFDT' => -10800,
+		'JFST' => -14400,
+		'JST' => 32400,
+		'KGST' => 21600,
+		'KGT' => 18000,
+		'KOST' => 39600,
+		'KOVST' => 28800,
+		'KOVT' => 25200,
+		'KRAST' => 28800,
+		'KRAT' => 25200,
+		'KST' => 32400,
+		'LHDT' => 39600,
+		'LHST' => 37800,
+		'LINT' => 50400,
+		'LKT' => 21600,
+		'MAGST' => 43200,
+		'MAGT' => 39600,
+		'MAWT' => 21600,
+		'MDT' => -21600,
+		'MESZ' => 7200,
+		'MEZ' => 3600,
+		'MHT' => 43200,
+		'MIT' => -34200,
+		'MNST' => 32400,
+		'MSDT' => 14400,
+		'MSST' => 10800,
+		'MST' => -25200,
+		'MUT' => 14400,
+		'MVT' => 18000,
+		'MYT' => 28800,
+		'NCT' => 39600,
+		'NDT' => -9000,
+		'NFT' => 41400,
+		'NMIT' => 36000,
+		'NOVST' => 25200,
+		'NOVT' => 21600,
+		'NPT' => 20700,
+		'NRT' => 43200,
+		'NST' => -12600,
+		'NUT' => -39600,
+		'NZDT' => 46800,
+		'NZST' => 43200,
+		'OMSST' => 25200,
+		'OMST' => 21600,
+		'PDT' => -25200,
+		'PET' => -18000,
+		'PETST' => 46800,
+		'PETT' => 43200,
+		'PGT' => 36000,
+		'PHOT' => 46800,
+		'PHT' => 28800,
+		'PKT' => 18000,
+		'PMDT' => -7200,
+		'PMST' => -10800,
+		'PONT' => 39600,
+		'PST' => -28800,
+		'PWT' => 32400,
+		'PYST' => -10800,
+		'PYT' => -14400,
+		'RET' => 14400,
+		'ROTT' => -10800,
+		'SAMST' => 18000,
+		'SAMT' => 14400,
+		'SAST' => 7200,
+		'SBT' => 39600,
+		'SCDT' => 46800,
+		'SCST' => 43200,
+		'SCT' => 14400,
+		'SEST' => 3600,
+		'SGT' => 28800,
+		'SIT' => 28800,
+		'SRT' => -10800,
+		'SST' => -39600,
+		'SYST' => 10800,
+		'SYT' => 7200,
+		'TFT' => 18000,
+		'THAT' => -36000,
+		'TJT' => 18000,
+		'TKT' => -36000,
+		'TMT' => 18000,
+		'TOT' => 46800,
+		'TPT' => 32400,
+		'TRUT' => 36000,
+		'TVT' => 43200,
+		'TWT' => 28800,
+		'UYST' => -7200,
+		'UYT' => -10800,
+		'UZT' => 18000,
+		'VET' => -14400,
+		'VLAST' => 39600,
+		'VLAT' => 36000,
+		'VOST' => 21600,
+		'VUT' => 39600,
+		'WAST' => 7200,
+		'WAT' => 3600,
+		'WDT' => 32400,
+		'WEST' => 3600,
+		'WFT' => 43200,
+		'WIB' => 25200,
+		'WIT' => 32400,
+		'WITA' => 28800,
+		'WKST' => 18000,
+		'WST' => 28800,
+		'YAKST' => 36000,
+		'YAKT' => 32400,
+		'YAPT' => 36000,
+		'YEKST' => 21600,
+		'YEKT' => 18000,
+	);
 
-									case 'MST':
-										$timezone = -25200;
-										break;
+	/**
+	 * Cached PCRE for SimplePie_Parse_Date::$day
+	 *
+	 * @access protected
+	 * @var string
+	 */
+	var $day_pcre;
 
-									case 'PST':
-										$timezone = -28800;
-										break;
+	/**
+	 * Cached PCRE for SimplePie_Parse_Date::$month
+	 *
+	 * @access protected
+	 * @var string
+	 */
+	var $month_pcre;
 
-									case 'EDT':
-										$timezone = -14400;
-										break;
+	/**
+	 * Array of user-added callback methods
+	 *
+	 * @access private
+	 * @var array
+	 */
+	var $built_in = array();
 
-									case 'CDT':
-										$timezone = -18000;
-										break;
+	/**
+	 * Array of user-added callback methods
+	 *
+	 * @access private
+	 * @var array
+	 */
+	var $user = array();
 
-									case 'MDT':
-										$timezone = -21600;
-										break;
+	/**
+	 * Create new SimplePie_Parse_Date object, and set self::day_pcre,
+	 * self::month_pcre, and self::built_in
+	 *
+	 * @access private
+	 */
+	function SimplePie_Parse_Date()
+	{
+		$this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')';
+		$this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')';
 
-									case 'PDT':
-										$timezone = -25200;
-										break;
-								}
-							}
-						}
-						// Timezone difference from UTC
-						else
-						{
-							$timezone = 0;
-							$timezone += ($match[24] + ('.' . $match[25])) * 3600;
-							$timezone += ($match[26] + ('.' . $match[27])) * 60;
-							$timezone = (int) round($timezone);
+		static $cache;
+		if (!isset($cache[get_class($this)]))
+		{
+			$all_methods = get_class_methods($this);
 
-							if ($match[23] == '-')
-							{
-								$timezone = -$timezone;
-							}
-						}
-					}
-				}
-				if ($timezone === false)
-				{
-					$cache[$dt][$rfc822_tz] = mktime($hour, $minute, $second, $month, $day, $year);
-				}
-				else
+			foreach ($all_methods as $method)
+			{
+				if (strtolower(substr($method, 0, 5)) === 'date_')
 				{
-					$cache[$dt][$rfc822_tz] = gmmktime($hour, $minute, $second, $month, $day, $year) - $timezone;
+					$cache[get_class($this)][] = $method;
 				}
 			}
-			elseif (($time = strtotime($dt)) > 0)
-			{
-				$cache[$dt][$rfc822_tz] = $time;
-			}
-			else
-			{
-				$cache[$dt][$rfc822_tz] = false;
-			}
 		}
-		return $cache[$dt][$rfc822_tz];
+
+		foreach ($cache[get_class($this)] as $method)
+		{
+			$this->built_in[] = $method;
+		}
 	}
 
 	/**
-	 * Decode HTML entities
+	 * Get the object
 	 *
-	 * @static
 	 * @access public
-	 * @param string $data Input data
-	 * @return string Output data
 	 */
-	function entities_decode($data)
+	function get()
 	{
-		$decoder = new SimplePie_Decode_HTML_Entities($data);
-		return $decoder->parse();
+		static $object;
+		if (!$object)
+		{
+			$object = new SimplePie_Parse_Date;
+		}
+		return $object;
+	}
+
+	/**
+	 * Parse a date
+	 *
+	 * @final
+	 * @access public
+	 * @param string $date Date to parse
+	 * @return int Timestamp corresponding to date string, or false on failure
+	 */
+	function parse($date)
+	{
+		foreach ($this->user as $method)
+		{
+			if (($returned = call_user_func($method, $date)) !== false)
+			{
+				return $returned;
+			}
+		}
+
+		foreach ($this->built_in as $method)
+		{
+			if (($returned = call_user_func(array(&$this, $method), $date)) !== false)
+			{
+				return $returned;
+			}
+		}
+
+		return false;
 	}
 
 	/**
-	 * Remove RFC822 comments
+	 * Add a callback method to parse a date
 	 *
-	 * @author Tomas V.V.Cox <cox@idecnet.com>
-	 * @author Pierre-Alain Joye <pajoye@php.net>
-	 * @author Amir Mohammad Saied <amir@php.net>
-	 * @copyright 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
-	 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
-	 * @version CVS: $Id: simplepie.php 10381 2008-06-01 03:35:53Z pasamio $
-	 * @link http://pear.php.net/package/Validate
+	 * @final
 	 * @access public
-	 * @param string $data Data to strip comments from
-	 * @return string Comment stripped string
+	 * @param callback $callback
 	 */
-	function uncomment_rfc822($data)
+	function add_callback($callback)
 	{
-		if ((version_compare(PHP_VERSION, '4.4.6', '>=') && version_compare(PHP_VERSION, '5', '<')) || version_compare(PHP_VERSION, '5.2.2', '>='))
+		if (is_callable($callback))
 		{
-			return $data;
+			$this->user[] = $callback;
 		}
 		else
 		{
-			return preg_replace('/((?:(?:\\\\"|[^("])*(?:"(?:[^"\\\\\r]|\\\\.)*"\s*)?)*)((?<!\\\\)\((?:(?2)|.)*?(?<!\\\\)\))/', '$1', $data);
+			trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
 		}
 	}
 
-	function parse_mime($mime)
+	/**
+	 * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
+	 * well as allowing any of upper or lower case "T", horizontal tabs, or
+	 * spaces to be used as the time seperator (including more than one))
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_w3cdtf($date)
 	{
-		if (($pos = strpos($mime, ';')) === false)
+		static $pcre;
+		if (!$pcre)
 		{
-			return trim($mime);
+			$year = '([0-9]{4})';
+			$month = $day = $hour = $minute = $second = '([0-9]{2})';
+			$decimal = '([0-9]*)';
+			$zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))';
+			$pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/';
 		}
-		else
+		if (preg_match($pcre, $date, $match))
 		{
-			return trim(substr($mime, 0, $pos));
-		}
-	}
+			/*
+			Capturing subpatterns:
+			1: Year
+			2: Month
+			3: Day
+			4: Hour
+			5: Minute
+			6: Second
+			7: Decimal fraction of a second
+			8: Zulu
+			9: Timezone ±
+			10: Timezone hours
+			11: Timezone minutes
+			*/
 
-	function htmlspecialchars_decode($string, $quote_style)
-	{
-		if (function_exists('htmlspecialchars_decode'))
-		{
-			return htmlspecialchars_decode($string, $quote_style);
+			// Fill in empty matches
+			for ($i = count($match); $i <= 3; $i++)
+			{
+				$match[$i] = '1';
+			}
+
+			for ($i = count($match); $i <= 7; $i++)
+			{
+				$match[$i] = '0';
+			}
+
+			// Numeric timezone
+			if (isset($match[9]) && $match[9] !== '')
+			{
+				$timezone = $match[10] * 3600;
+				$timezone += $match[11] * 60;
+				if ($match[9] === '-')
+				{
+					$timezone = 0 - $timezone;
+				}
+			}
+			else
+			{
+				$timezone = 0;
+			}
+
+			// Convert the number of seconds to an integer, taking decimals into account
+			$second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
+
+			return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
 		}
 		else
 		{
-			return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
+			return false;
 		}
 	}
 
-	function atom_03_construct_type($attribs)
+	/**
+	 * Remove RFC822 comments
+	 *
+	 * @access protected
+	 * @param string $data Data to strip comments from
+	 * @return string Comment stripped string
+	 */
+	function remove_rfc2822_comments($string)
 	{
-		if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) == 'base64'))
+		$string = (string) $string;
+		$position = 0;
+		$length = strlen($string);
+		$depth = 0;
+
+		$output = '';
+
+		while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
 		{
-			$mode = SIMPLEPIE_CONSTRUCT_BASE64;
+			$output .= substr($string, $position, $pos - $position);
+			$position = $pos + 1;
+			if ($string[$pos - 1] !== '\\')
+			{
+				$depth++;
+				while ($depth && $position < $length)
+				{
+					$position += strcspn($string, '()', $position);
+					if ($string[$position - 1] === '\\')
+					{
+						$position++;
+						continue;
+					}
+					elseif (isset($string[$position]))
+					{
+						switch ($string[$position])
+						{
+							case '(':
+								$depth++;
+								break;
+
+							case ')':
+								$depth--;
+								break;
+						}
+						$position++;
+					}
+					else
+					{
+						break;
+					}
+				}
+			}
+			else
+			{
+				$output .= '(';
+			}
 		}
-		else
+		$output .= substr($string, $position);
+
+		return $output;
+	}
+
+	/**
+	 * Parse RFC2822's date format
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_rfc2822($date)
+	{
+		static $pcre;
+		if (!$pcre)
 		{
-			$mode = SIMPLEPIE_CONSTRUCT_NONE;
+			$wsp = '[\x09\x20]';
+			$fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
+			$optional_fws = $fws . '?';
+			$day_name = $this->day_pcre;
+			$month = $this->month_pcre;
+			$day = '([0-9]{1,2})';
+			$hour = $minute = $second = '([0-9]{2})';
+			$year = '([0-9]{2,4})';
+			$num_zone = '([+\-])([0-9]{2})([0-9]{2})';
+			$character_zone = '([A-Z]{1,5})';
+			$zone = '(?:' . $num_zone . '|' . $character_zone . ')';
+			$pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
 		}
-		if (isset($attribs['']['type']))
+		if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
 		{
-			switch (strtolower(trim($attribs['']['type'])))
-			{
-				case 'text':
-				case 'text/plain':
-					return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+			/*
+			Capturing subpatterns:
+			1: Day name
+			2: Day
+			3: Month
+			4: Year
+			5: Hour
+			6: Minute
+			7: Second
+			8: Timezone ±
+			9: Timezone hours
+			10: Timezone minutes
+			11: Alphabetic timezone
+			*/
 
-				case 'html':
-				case 'text/html':
-					return SIMPLEPIE_CONSTRUCT_HTML | $mode;
+			// Find the month number
+			$month = $this->month[strtolower($match[3])];
 
-				case 'xhtml':
-				case 'application/xhtml+xml':
-					return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
+			// Numeric timezone
+			if ($match[8] !== '')
+			{
+				$timezone = $match[9] * 3600;
+				$timezone += $match[10] * 60;
+				if ($match[8] === '-')
+				{
+					$timezone = 0 - $timezone;
+				}
+			}
+			// Character timezone
+			elseif (isset($this->timezone[strtoupper($match[11])]))
+			{
+				$timezone = $this->timezone[strtoupper($match[11])];
+			}
+			// Assume everything else to be -0000
+			else
+			{
+				$timezone = 0;
+			}
 
-				default:
-					return SIMPLEPIE_CONSTRUCT_NONE | $mode;
+			// Deal with 2/3 digit years
+			if ($match[4] < 50)
+			{
+				$match[4] += 2000;
+			}
+			elseif ($match[4] < 1000)
+			{
+				$match[4] += 1900;
+			}
+
+			// Second is optional, if it is empty set it to zero
+			if ($match[7] !== '')
+			{
+				$second = $match[7];
+			}
+			else
+			{
+				$second = 0;
 			}
+
+			return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
 		}
 		else
 		{
-			return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+			return false;
 		}
 	}
 
-	function atom_10_construct_type($attribs)
+	/**
+	 * Parse RFC850's date format
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_rfc850($date)
 	{
-		if (isset($attribs['']['type']))
+		static $pcre;
+		if (!$pcre)
 		{
-			switch (strtolower(trim($attribs['']['type'])))
-			{
-				case 'text':
-					return SIMPLEPIE_CONSTRUCT_TEXT;
-
-				case 'html':
-					return SIMPLEPIE_CONSTRUCT_HTML;
-
-				case 'xhtml':
-					return SIMPLEPIE_CONSTRUCT_XHTML;
-
-				default:
-					return SIMPLEPIE_CONSTRUCT_NONE;
-			}
+			$space = '[\x09\x20]+';
+			$day_name = $this->day_pcre;
+			$month = $this->month_pcre;
+			$day = '([0-9]{1,2})';
+			$year = $hour = $minute = $second = '([0-9]{2})';
+			$zone = '([A-Z]{1,5})';
+			$pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
 		}
-		return SIMPLEPIE_CONSTRUCT_TEXT;
-	}
-
-	function atom_10_content_construct_type($attribs)
-	{
-		if (isset($attribs['']['type']))
+		if (preg_match($pcre, $date, $match))
 		{
-			$type = strtolower(trim($attribs['']['type']));
-			switch ($type)
-			{
-				case 'text':
-					return SIMPLEPIE_CONSTRUCT_TEXT;
+			/*
+			Capturing subpatterns:
+			1: Day name
+			2: Day
+			3: Month
+			4: Year
+			5: Hour
+			6: Minute
+			7: Second
+			8: Timezone
+			*/
 
-				case 'html':
-					return SIMPLEPIE_CONSTRUCT_HTML;
+			// Month
+			$month = $this->month[strtolower($match[3])];
 
-				case 'xhtml':
-					return SIMPLEPIE_CONSTRUCT_XHTML;
+			// Character timezone
+			if (isset($this->timezone[strtoupper($match[8])]))
+			{
+				$timezone = $this->timezone[strtoupper($match[8])];
 			}
-			if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) == 'text/')
+			// Assume everything else to be -0000
+			else
 			{
-				return SIMPLEPIE_CONSTRUCT_NONE;
+				$timezone = 0;
+			}
+
+			// Deal with 2 digit year
+			if ($match[4] < 50)
+			{
+				$match[4] += 2000;
 			}
 			else
 			{
-				return SIMPLEPIE_CONSTRUCT_BASE64;
+				$match[4] += 1900;
 			}
+
+			return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
 		}
 		else
 		{
-			return SIMPLEPIE_CONSTRUCT_TEXT;
+			return false;
 		}
 	}
 
-	function is_isegment_nz_nc($string)
-	{
-		return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
-	}
-
-	function space_seperated_tokens($string)
+	/**
+	 * Parse C99's asctime()'s date format
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_asctime($date)
 	{
-		$space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
-		$string_length = strlen($string);
-
-		$position = strspn($string, $space_characters);
-		$tokens = array();
+		static $pcre;
+		if (!$pcre)
+		{
+			$space = '[\x09\x20]+';
+			$wday_name = $this->day_pcre;
+			$mon_name = $this->month_pcre;
+			$day = '([0-9]{1,2})';
+			$hour = $sec = $min = '([0-9]{2})';
+			$year = '([0-9]{4})';
+			$terminator = '\x0A?\x00?';
+			$pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
+		}
+		if (preg_match($pcre, $date, $match))
+		{
+			/*
+			Capturing subpatterns:
+			1: Day name
+			2: Month
+			3: Day
+			4: Hour
+			5: Minute
+			6: Second
+			7: Year
+			*/
 
-		while ($position < $string_length)
+			$month = $this->month[strtolower($match[2])];
+			return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
+		}
+		else
 		{
-			$len = strcspn($string, $space_characters, $position);
-			$tokens[] = substr($string, $position, $len);
-			$position += $len;
-			$position += strspn($string, $space_characters, $position);
+			return false;
 		}
-
-		return $tokens;
 	}
 
-	function array_unique($array)
+	/**
+	 * Parse dates using strtotime()
+	 *
+	 * @access protected
+	 * @return int Timestamp
+	 */
+	function date_strtotime($date)
 	{
-		if (version_compare(PHP_VERSION, '5.2', '>='))
+		$strtotime = strtotime($date);
+		if ($strtotime === -1 || $strtotime === false)
 		{
-			return array_unique($array);
+			return false;
 		}
 		else
 		{
-			$array = (array) $array;
-			$new_array = array();
-			$new_array_strings = array();
-			foreach ($array as $key => $value)
+			return $strtotime;
+		}
+	}
+}
+
+/**
+ * Content-type sniffing
+ *
+ * @package SimplePie
+ */
+class SimplePie_Content_Type_Sniffer
+{
+	/**
+	 * File object
+	 *
+	 * @var SimplePie_File
+	 * @access private
+	 */
+	var $file;
+
+	/**
+	 * Create an instance of the class with the input file
+	 *
+	 * @access public
+	 * @param SimplePie_Content_Type_Sniffer $file Input file
+	 */
+	function SimplePie_Content_Type_Sniffer($file)
+	{
+		$this->file = $file;
+	}
+
+	/**
+	 * Get the Content-Type of the specified file
+	 *
+	 * @access public
+	 * @return string Actual Content-Type
+	 */
+	function get_type()
+	{
+		if (isset($this->file->headers['content-type']))
+		{
+			if (!isset($this->file->headers['content-encoding'])
+				&& ($this->file->headers['content-type'] === 'text/plain'
+					|| $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
+					|| $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'))
 			{
-				if (is_object($value))
-				{
-					if (method_exists($value, '__toString'))
-					{
-						$cmp = $value->__toString();
-					}
-					else
-					{
-						trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
-					}
-				}
-				elseif (is_array($value))
+				return $this->text_or_binary();
+			}
+
+			if (($pos = strpos($this->file->headers['content-type'], ';')) !== false)
+			{
+				$official = substr($this->file->headers['content-type'], 0, $pos);
+			}
+			else
+			{
+				$official = $this->file->headers['content-type'];
+			}
+			$official = strtolower($official);
+
+			if ($official === 'unknown/unknown'
+				|| $official === 'application/unknown')
+			{
+				return $this->unknown();
+			}
+			elseif (substr($official, -4) === '+xml'
+				|| $official === 'text/xml'
+				|| $official === 'application/xml')
+			{
+				return $official;
+			}
+			elseif (substr($official, 0, 6) === 'image/')
+			{
+				if ($return = $this->image())
 				{
-					$cmp = (string) reset($value);
+					return $return;
 				}
 				else
 				{
-					$cmp = (string) $value;
-				}
-				if (!in_array($cmp, $new_array_strings))
-				{
-					$new_array[$key] = $value;
-					$new_array_strings[] = $cmp;
+					return $official;
 				}
 			}
-			return $new_array;
+			elseif ($official === 'text/html')
+			{
+				return $this->feed_or_html();
+			}
+			else
+			{
+				return $official;
+			}
+		}
+		else
+		{
+			return $this->unknown();
 		}
 	}
 
 	/**
-	 * Converts a unicode codepoint to a UTF-8 character
+	 * Sniff text or binary
 	 *
-	 * @static
-	 * @access public
-	 * @param int $codepoint Unicode codepoint
-	 * @return string UTF-8 character
+	 * @access private
+	 * @return string Actual Content-Type
 	 */
-	function codepoint_to_utf8($codepoint)
+	function text_or_binary()
 	{
-		static $cache = array();
-		$codepoint = (int) $codepoint;
-		if (isset($cache[$codepoint]))
+		if (substr($this->file->body, 0, 2) === "\xFE\xFF"
+			|| substr($this->file->body, 0, 2) === "\xFF\xFE"
+			|| substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
+			|| substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
 		{
-			return $cache[$codepoint];
+			return 'text/plain';
 		}
-		elseif ($codepoint < 0)
+		elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
 		{
-			return $cache[$codepoint] = false;
+			return 'application/octect-stream';
 		}
-		else if ($codepoint <= 0x7f)
+		else
 		{
-			return $cache[$codepoint] = chr($codepoint);
+			return 'text/plain';
 		}
-		else if ($codepoint <= 0x7ff)
+	}
+
+	/**
+	 * Sniff unknown
+	 *
+	 * @access private
+	 * @return string Actual Content-Type
+	 */
+	function unknown()
+	{
+		$ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
+		if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
+			|| strtolower(substr($this->file->body, $ws, 5)) === '<html'
+			|| strtolower(substr($this->file->body, $ws, 7)) === '<script')
 		{
-			return $cache[$codepoint] = chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+			return 'text/html';
 		}
-		else if ($codepoint <= 0xffff)
+		elseif (substr($this->file->body, 0, 5) === '%PDF-')
 		{
-			return $cache[$codepoint] = chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+			return 'application/pdf';
 		}
-		else if ($codepoint <= 0x10ffff)
+		elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
+		{
+			return 'application/postscript';
+		}
+		elseif (substr($this->file->body, 0, 6) === 'GIF87a'
+			|| substr($this->file->body, 0, 6) === 'GIF89a')
 		{
-			return $cache[$codepoint] = chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+			return 'image/gif';
+		}
+		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
+		{
+			return 'image/png';
+		}
+		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
+		{
+			return 'image/jpeg';
+		}
+		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
+		{
+			return 'image/bmp';
 		}
 		else
 		{
-			// U+FFFD REPLACEMENT CHARACTER
-			return $cache[$codepoint] = "\xEF\xBF\xBD";
+			return $this->text_or_binary();
 		}
 	}
 
 	/**
-	 * Re-implementation of PHP 4.2.0's is_a()
+	 * Sniff images
 	 *
-	 * @static
-	 * @access public
-	 * @param object $object The tested object
-	 * @param string $class_name The class name
-	 * @return bool Returns true if the object is of this class or has this class as one of its parents, false otherwise
-	 */
-	 function is_a($object, $class_name)
-	 {
-	 	if (function_exists('is_a'))
-	 	{
-	 		return is_a($object, $class_name);
-	 	}
-	 	elseif (!is_object($object))
-	 	{
-	 		return false;
-	 	}
-	 	elseif (get_class($object) == strtolower($class_name))
-	 	{
-	 		return true;
-	 	}
-	 	else
-	 	{
-	 		return is_subclass_of($object, $class_name);
-	 	}
-	 }
+	 * @access private
+	 * @return string Actual Content-Type
+	 */
+	function image()
+	{
+		if (substr($this->file->body, 0, 6) === 'GIF87a'
+			|| substr($this->file->body, 0, 6) === 'GIF89a')
+		{
+			return 'image/gif';
+		}
+		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
+		{
+			return 'image/png';
+		}
+		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
+		{
+			return 'image/jpeg';
+		}
+		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
+		{
+			return 'image/bmp';
+		}
+		else
+		{
+			return false;
+		}
+	}
 
 	/**
-	 * Re-implementation of PHP 5's stripos()
-	 *
-	 * Returns the numeric position of the first occurrence of needle in the
-	 * haystack string.
+	 * Sniff HTML
 	 *
-	 * @static
-	 * @access string
-	 * @param object $haystack
-	 * @param string $needle Note that the needle may be a string of one or more
-	 *     characters. If needle is not a string, it is converted to an integer
-	 *     and applied as the ordinal value of a character.
-	 * @param int $offset The optional offset parameter allows you to specify which
-	 *     character in haystack to start searching. The position returned is still
-	 *     relative to the beginning of haystack.
-	 * @return bool If needle is not found, stripos() will return boolean false.
+	 * @access private
+	 * @return string Actual Content-Type
 	 */
-	 function stripos($haystack, $needle, $offset = 0)
-	 {
-	 	if (function_exists('stripos'))
-	 	{
-	 		return stripos($haystack, $needle, $offset);
-	 	}
-	 	else
-	 	{
-	 		if (is_string($needle))
-	 		{
-	 			$needle = strtolower($needle);
-	 		}
-	 		elseif (is_int($needle) || is_bool($needle) || is_double($needle))
-	 		{
-	 			$needle = strtolower(chr($needle));
-	 		}
-	 		else
-	 		{
-	 			trigger_error('needle is not a string or an integer', E_USER_WARNING);
-	 			return false;
-	 		}
-
-	 		return strpos(strtolower($haystack), $needle, $offset);
-	 	}
-	 }
+	function feed_or_html()
+	{
+		$len = strlen($this->file->body);
+		$pos = strspn($this->file->body, "\x09\x0A\x0D\x20");
+
+		while ($pos < $len)
+		{
+			switch ($this->file->body[$pos])
+			{
+				case "\x09":
+				case "\x0A":
+				case "\x0D":
+				case "\x20":
+					$pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
+					continue 2;
+
+				case '<':
+					$pos++;
+					break;
+
+				default:
+					return 'text/html';
+			}
+
+			if (substr($this->file->body, $pos, 3) === '!--')
+			{
+				$pos += 3;
+				if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false)
+				{
+					$pos += 3;
+				}
+				else
+				{
+					return 'text/html';
+				}
+			}
+			elseif (substr($this->file->body, $pos, 1) === '!')
+			{
+				if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false)
+				{
+					$pos++;
+				}
+				else
+				{
+					return 'text/html';
+				}
+			}
+			elseif (substr($this->file->body, $pos, 1) === '?')
+			{
+				if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false)
+				{
+					$pos += 2;
+				}
+				else
+				{
+					return 'text/html';
+				}
+			}
+			elseif (substr($this->file->body, $pos, 3) === 'rss'
+				|| substr($this->file->body, $pos, 7) === 'rdf:RDF')
+			{
+				return 'application/rss+xml';
+			}
+			elseif (substr($this->file->body, $pos, 4) === 'feed')
+			{
+				return 'application/atom+xml';
+			}
+			else
+			{
+				return 'text/html';
+			}
+		}
+
+		return 'text/html';
+	}
 }
 
 /**
- * Decode HTML Entities
- *
- * This implements HTML5 as of revision 967 (2007-06-28)
+ * Parses the XML Declaration
  *
  * @package SimplePie
  */
-class SimplePie_Decode_HTML_Entities
+class SimplePie_XML_Declaration_Parser
 {
 	/**
-	 * Data to be parsed
+	 * XML Version
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $version = '1.0';
+
+	/**
+	 * Encoding
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $encoding = 'UTF-8';
+
+	/**
+	 * Standalone
+	 *
+	 * @access public
+	 * @var bool
+	 */
+	var $standalone = false;
+
+	/**
+	 * Current state of the state machine
 	 *
 	 * @access private
 	 * @var string
 	 */
-	var $data = '';
+	var $state = 'before_version_name';
 
 	/**
-	 * Currently consumed bytes
+	 * Input data
 	 *
 	 * @access private
 	 * @var string
 	 */
-	var $consumed = '';
+	var $data = '';
 
 	/**
-	 * Position of the current byte being parsed
+	 * Input data length (to avoid calling strlen() everytime this is needed)
 	 *
 	 * @access private
 	 * @var int
 	 */
+	var $data_length = 0;
+
+	/**
+	 * Current position of the pointer
+	 *
+	 * @var int
+	 * @access private
+	 */
 	var $position = 0;
 
 	/**
@@ -9823,169 +13800,250 @@
 	 * @access public
 	 * @param string $data Input data
 	 */
-	function SimplePie_Decode_HTML_Entities($data)
+	function SimplePie_XML_Declaration_Parser($data)
 	{
 		$this->data = $data;
+		$this->data_length = strlen($this->data);
 	}
 
 	/**
 	 * Parse the input data
 	 *
 	 * @access public
-	 * @return string Output data
+	 * @return bool true on success, false on failure
 	 */
 	function parse()
 	{
-		while (($this->position = strpos($this->data, '&', $this->position)) !== false)
+		while ($this->state && $this->state !== 'emit' && $this->has_data())
 		{
-			$this->consume();
-			$this->entity();
-			$this->consumed = '';
+			$state = $this->state;
+			$this->$state();
+		}
+		$this->data = '';
+		if ($this->state === 'emit')
+		{
+			return true;
+		}
+		else
+		{
+			$this->version = '';
+			$this->encoding = '';
+			$this->standalone = '';
+			return false;
+		}
+	}
+
+	/**
+	 * Check whether there is data beyond the pointer
+	 *
+	 * @access private
+	 * @return bool true if there is further data, false if not
+	 */
+	function has_data()
+	{
+		return (bool) ($this->position < $this->data_length);
+	}
+
+	/**
+	 * Advance past any whitespace
+	 *
+	 * @return int Number of whitespace characters passed
+	 */
+	function skip_whitespace()
+	{
+		$whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position);
+		$this->position += $whitespace;
+		return $whitespace;
+	}
+
+	/**
+	 * Read value
+	 */
+	function get_value()
+	{
+		$quote = substr($this->data, $this->position, 1);
+		if ($quote === '"' || $quote === "'")
+		{
+			$this->position++;
+			$len = strcspn($this->data, $quote, $this->position);
+			if ($this->has_data())
+			{
+				$value = substr($this->data, $this->position, $len);
+				$this->position += $len + 1;
+				return $value;
+			}
+		}
+		return false;
+	}
+
+	function before_version_name()
+	{
+		if ($this->skip_whitespace())
+		{
+			$this->state = 'version_name';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	function version_name()
+	{
+		if (substr($this->data, $this->position, 7) === 'version')
+		{
+			$this->position += 7;
+			$this->skip_whitespace();
+			$this->state = 'version_equals';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	function version_equals()
+	{
+		if (substr($this->data, $this->position, 1) === '=')
+		{
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'version_value';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	function version_value()
+	{
+		if ($this->version = $this->get_value())
+		{
+			$this->skip_whitespace();
+			if ($this->has_data())
+			{
+				$this->state = 'encoding_name';
+			}
+			else
+			{
+				$this->state = 'emit';
+			}
+		}
+		else
+		{
+			$this->state = 'standalone_name';
+		}
+	}
+
+	function encoding_name()
+	{
+		if (substr($this->data, $this->position, 8) === 'encoding')
+		{
+			$this->position += 8;
+			$this->skip_whitespace();
+			$this->state = 'encoding_equals';
+		}
+		else
+		{
+			$this->state = false;
 		}
-		return $this->data;
 	}
 
-	/**
-	 * Consume the next byte
-	 *
-	 * @access private
-	 * @return mixed The next byte, or false, if there is no more data
-	 */
-	function consume()
+	function encoding_equals()
 	{
-		if (isset($this->data[$this->position]))
+		if (substr($this->data, $this->position, 1) === '=')
 		{
-			$this->consumed .= $this->data[$this->position];
-			return $this->data[$this->position++];
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'encoding_value';
 		}
 		else
 		{
-			$this->consumed = false;
-			return false;
+			$this->state = false;
 		}
 	}
 
-	/**
-	 * Consume a range of characters
-	 *
-	 * @access private
-	 * @param string $chars Characters to consume
-	 * @return mixed A series of characters that match the range, or false
-	 */
-	function consume_range($chars)
+	function encoding_value()
 	{
-		if ($len = strspn($this->data, $chars, $this->position))
+		if ($this->encoding = $this->get_value())
 		{
-			$data = substr($this->data, $this->position, $len);
-			$this->consumed .= $data;
-			$this->position += $len;
-			return $data;
+			$this->skip_whitespace();
+			if ($this->has_data())
+			{
+				$this->state = 'standalone_name';
+			}
+			else
+			{
+				$this->state = 'emit';
+			}
 		}
 		else
 		{
-			$this->consumed = false;
-			return false;
+			$this->state = false;
 		}
 	}
 
-	/**
-	 * Unconsume one byte
-	 *
-	 * @access private
-	 */
-	function unconsume()
+	function standalone_name()
 	{
-		$this->consumed = substr($this->consumed, 0, -1);
-		$this->position--;
+		if (substr($this->data, $this->position, 10) === 'standalone')
+		{
+			$this->position += 10;
+			$this->skip_whitespace();
+			$this->state = 'standalone_equals';
+		}
+		else
+		{
+			$this->state = false;
+		}
 	}
 
-	/**
-	 * Decode an entity
-	 *
-	 * @access private
-	 */
-	function entity()
+	function standalone_equals()
 	{
-		switch ($this->consume())
+		if (substr($this->data, $this->position, 1) === '=')
 		{
-			case "\x09":
-			case "\x0A":
-			case "\x0B":
-			case "\x0B":
-			case "\x0C":
-			case "\x20":
-			case "\x3C":
-			case "\x26":
-			case false:
-				break;
-
-			case "\x23":
-				switch ($this->consume())
-				{
-					case "\x78":
-					case "\x58":
-						$range = '0123456789ABCDEFabcdef';
-						$hex = true;
-						break;
-
-					default:
-						$range = '0123456789';
-						$hex = false;
-						$this->unconsume();
-						break;
-				}
-
-				if ($codepoint = $this->consume_range($range))
-				{
-					static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
-
-					if ($hex)
-					{
-						$codepoint = hexdec($codepoint);
-					}
-					else
-					{
-						$codepoint = intval($codepoint);
-					}
-
-					if (isset($windows_1252_specials[$codepoint]))
-					{
-						$replacement = $windows_1252_specials[$codepoint];
-					}
-					else
-					{
-						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
-					}
-
-					if ($this->consume() != ';')
-					{
-						$this->unconsume();
-					}
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'standalone_value';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
 
-					$consumed_length = strlen($this->consumed);
-					$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
-					$this->position += strlen($replacement) - $consumed_length;
-				}
-				break;
+	function standalone_value()
+	{
+		if ($standalone = $this->get_value())
+		{
+			switch ($standalone)
+			{
+				case 'yes':
+					$this->standalone = true;
+					break;
 
-			default:
-				static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
+				case 'no':
+					$this->standalone = false;
+					break;
 
-				for ($i = 0, $match = null; $i < 9 && $this->consume(); $i++)
-				{
-					$consumed = substr($this->consumed, 1);
-					if (isset($entities[$consumed]))
-					{
-						$match = $consumed;
-					}
-				}
+				default:
+					$this->state = false;
+					return;
+			}
 
-				if ($match !== null)
-				{
- 					$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
-					$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
-				}
-				break;
+			$this->skip_whitespace();
+			if ($this->has_data())
+			{
+				$this->state = false;
+			}
+			else
+			{
+				$this->state = 'emit';
+			}
+		}
+		else
+		{
+			$this->state = false;
 		}
 	}
 }
@@ -10004,23 +14062,34 @@
 	var $base_location = 0;
 	var $checked_feeds = 0;
 	var $max_checked_feeds = 10;
+	var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
 
-	function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10)
+	function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10, $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer')
 	{
 		$this->file =& $file;
 		$this->file_class = $file_class;
 		$this->useragent = $useragent;
 		$this->timeout = $timeout;
 		$this->max_checked_feeds = $max_checked_feeds;
+		$this->content_type_sniffer_class = $content_type_sniffer_class;
 	}
 
-	function find($type = SIMPLEPIE_LOCATOR_ALL)
+	function find($type = SIMPLEPIE_LOCATOR_ALL, &$working)
 	{
 		if ($this->is_feed($this->file))
 		{
 			return $this->file;
 		}
 
+		if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
+		{
+			$sniffer = new $this->content_type_sniffer_class($this->file);
+			if ($sniffer->get_type() !== 'text/html')
+			{
+				return null;
+			}
+		}
+
 		if ($type & ~SIMPLEPIE_LOCATOR_NONE)
 		{
 			$this->get_base();
@@ -10028,7 +14097,7 @@
 
 		if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
 		{
-			return $working;
+			return $working[0];
 		}
 
 		if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links())
@@ -10058,24 +14127,32 @@
 
 	function is_feed(&$file)
 	{
-		$body = SimplePie_Misc::strip_comments($file->body);
-		if (preg_match('/<([^\s:]+:)?(rss|RDF|feed)' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/i', $body))
+		if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
 		{
-			return true;
+			$sniffer = new $this->content_type_sniffer_class($file);
+			$sniffed = $sniffer->get_type();
+			if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
+			{
+				return true;
+			}
+			else
+			{
+				return false;
+			}
 		}
-		return false;
-	}
-
-	function get_base()
-	{
-		if (isset($this->file->headers['content-location']))
+		elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
 		{
-			$this->http_base = SimplePie_Misc::absolutize_url(trim($this->file->headers['content-location']), $this->file->url);
+			return true;
 		}
 		else
 		{
-			$this->http_base = $this->file->url;
+			return false;
 		}
+	}
+
+	function get_base()
+	{
+		$this->http_base = $this->file->url;
 		$this->base = $this->http_base;
 		$elements = SimplePie_Misc::get_element('base', $this->file->body);
 		foreach ($elements as $element)
@@ -10093,9 +14170,10 @@
 	{
 		$links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
 		$done = array();
+		$feeds = array();
 		foreach ($links as $link)
 		{
-			if ($this->checked_feeds == $this->max_checked_feeds)
+			if ($this->checked_feeds === $this->max_checked_feeds)
 			{
 				break;
 			}
@@ -10112,19 +14190,26 @@
 					$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
 				}
 
-				if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))))
+				if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href]))
 				{
 					$this->checked_feeds++;
-					$feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
-					if ($this->is_feed($feed))
+					$feed = new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
+					if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
 					{
-						return $feed;
+						$feeds[$href] = $feed;
 					}
 				}
 				$done[] = $href;
 			}
 		}
-		return null;
+
+		if (!empty($feeds))
+		{
+			return array_values($feeds);
+		}
+		else {
+			return null;
+		}
 	}
 
 	function get_links()
@@ -10149,7 +14234,7 @@
 
 					$current = SimplePie_Misc::parse_url($this->file->url);
 
-					if ($parsed['authority'] === '' || $parsed['authority'] == $current['authority'])
+					if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority'])
 					{
 						$this->local[] = $href;
 					}
@@ -10173,15 +14258,15 @@
 	{
 		foreach ($array as $key => $value)
 		{
-			if ($this->checked_feeds == $this->max_checked_feeds)
+			if ($this->checked_feeds === $this->max_checked_feeds)
 			{
 				break;
 			}
 			if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml')))
 			{
 				$this->checked_feeds++;
-				$feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
-				if ($this->is_feed($feed))
+				$feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
+				if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
 				{
 					return $feed;
 				}
@@ -10198,15 +14283,15 @@
 	{
 		foreach ($array as $key => $value)
 		{
-			if ($this->checked_feeds == $this->max_checked_feeds)
+			if ($this->checked_feeds === $this->max_checked_feeds)
 			{
 				break;
 			}
 			if (preg_match('/(rss|rdf|atom|xml)/i', $value))
 			{
 				$this->checked_feeds++;
-				$feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
-				if ($this->is_feed($feed))
+				$feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
+				if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
 				{
 					return $feed;
 				}
@@ -10222,14 +14307,12 @@
 
 class SimplePie_Parser
 {
-	var $xml;
 	var $error_code;
 	var $error_string;
 	var $current_line;
 	var $current_column;
 	var $current_byte;
 	var $separator = ' ';
-	var $feed = false;
 	var $namespace = array('');
 	var $element = array('');
 	var $xml_base = array('');
@@ -10240,10 +14323,10 @@
 	var $current_xhtml_construct = -1;
 	var $encoding;
 
-	function pre_process(&$data, $encoding)
+	function parse(&$data, $encoding)
 	{
 		// Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
-		if (strtoupper($encoding) == 'US-ASCII')
+		if (strtoupper($encoding) === 'US-ASCII')
 		{
 			$this->encoding = 'UTF-8';
 		}
@@ -10254,61 +14337,150 @@
 
 		// Strip BOM:
 		// UTF-32 Big Endian BOM
-		if (strpos($data, "\x0\x0\xFE\xFF") === 0)
+		if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
 		{
 			$data = substr($data, 4);
 		}
 		// UTF-32 Little Endian BOM
-		elseif (strpos($data, "\xFF\xFE\x0\x0") === 0)
+		elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
 		{
 			$data = substr($data, 4);
 		}
 		// UTF-16 Big Endian BOM
-		elseif (strpos($data, "\xFE\xFF") === 0)
+		elseif (substr($data, 0, 2) === "\xFE\xFF")
 		{
 			$data = substr($data, 2);
 		}
 		// UTF-16 Little Endian BOM
-		elseif (strpos($data, "\xFF\xFE") === 0)
+		elseif (substr($data, 0, 2) === "\xFF\xFE")
 		{
 			$data = substr($data, 2);
 		}
 		// UTF-8 BOM
-		elseif (strpos($data, "\xEF\xBB\xBF") === 0)
+		elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
 		{
 			$data = substr($data, 3);
 		}
 
-		// Make sure the XML prolog is sane and has the correct encoding
-		$data = preg_replace("/^<\?xml[\x20\x9\xD\xA]+version([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"1.0\"|'1.0'|\"1.1\"|'1.1')([\x20\x9\xD\xA]+encoding([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"[A-Za-z][A-Za-z0-9._\-]*\"|'[A-Za-z][A-Za-z0-9._\-]*'))?([\x20\x9\xD\xA]+standalone([\x20\x9\xD\xA]+)?=([\x20\x9\xD\xA]+)?(\"(yes|no)\"|'(yes|no)'))?([\x20\x9\xD\xA]+)?\?>/", '', $data);
-		$data = "<?xml version='1.0' encoding='$encoding'?>\n" . $data;
-	}
+		if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
+		{
+			$declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+			if ($declaration->parse())
+			{
+				$data = substr($data, $pos + 2);
+				$data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
+			}
+			else
+			{
+				$this->error_string = 'SimplePie bug! Please report this!';
+				return false;
+			}
+		}
 
-	function parse(&$data)
-	{
 		$return = true;
 
+		static $xml_is_sane = null;
+		if ($xml_is_sane === null)
+		{
+			$parser_check = xml_parser_create();
+			xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
+			xml_parser_free($parser_check);
+			$xml_is_sane = isset($values[0]['value']);
+		}
+
 		// Create the parser
-		$this->xml = xml_parser_create_ns($this->encoding, $this->separator);
-		xml_parser_set_option($this->xml, XML_OPTION_SKIP_WHITE, 1);
-		xml_parser_set_option($this->xml, XML_OPTION_CASE_FOLDING, 0);
-		xml_set_object($this->xml, $this);
-		xml_set_character_data_handler($this->xml, 'cdata');
-		xml_set_element_handler($this->xml, 'tag_open', 'tag_close');
-
-		// Parse!
-		if (!xml_parse($this->xml, $data, true))
-		{
-			$this->data = null;
-			$this->error_code = xml_get_error_code($this->xml);
-			$this->error_string = xml_error_string($this->error_code);
-			$return = false;
-		}
-		$this->current_line = xml_get_current_line_number($this->xml);
-		$this->current_column = xml_get_current_column_number($this->xml);
-		$this->current_byte = xml_get_current_byte_index($this->xml);
-		xml_parser_free($this->xml);
-		return $return;
+		if ($xml_is_sane)
+		{
+			$xml = xml_parser_create_ns($this->encoding, $this->separator);
+			xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
+			xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
+			xml_set_object($xml, $this);
+			xml_set_character_data_handler($xml, 'cdata');
+			xml_set_element_handler($xml, 'tag_open', 'tag_close');
+
+			// Parse!
+			if (!xml_parse($xml, $data, true))
+			{
+				$this->error_code = xml_get_error_code($xml);
+				$this->error_string = xml_error_string($this->error_code);
+				$return = false;
+			}
+			$this->current_line = xml_get_current_line_number($xml);
+			$this->current_column = xml_get_current_column_number($xml);
+			$this->current_byte = xml_get_current_byte_index($xml);
+			xml_parser_free($xml);
+			return $return;
+		}
+		else
+		{
+			libxml_clear_errors();
+			$xml = new XMLReader();
+			$xml->xml($data);
+			while (@$xml->read())
+			{
+				switch ($xml->nodeType)
+				{
+
+					case constant('XMLReader::END_ELEMENT'):
+						if ($xml->namespaceURI !== '')
+						{
+							$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+						}
+						else
+						{
+							$tagName = $xml->localName;
+						}
+						$this->tag_close(null, $tagName);
+						break;
+					case constant('XMLReader::ELEMENT'):
+						$empty = $xml->isEmptyElement;
+						if ($xml->namespaceURI !== '')
+						{
+							$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+						}
+						else
+						{
+							$tagName = $xml->localName;
+						}
+						$attributes = array();
+						while ($xml->moveToNextAttribute())
+						{
+							if ($xml->namespaceURI !== '')
+							{
+								$attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+							}
+							else
+							{
+								$attrName = $xml->localName;
+							}
+							$attributes[$attrName] = $xml->value;
+						}
+						$this->tag_open(null, $tagName, $attributes);
+						if ($empty)
+						{
+							$this->tag_close(null, $tagName);
+						}
+						break;
+					case constant('XMLReader::TEXT'):
+
+					case constant('XMLReader::CDATA'):
+						$this->cdata(null, $xml->value);
+						break;
+				}
+			}
+			if ($error = libxml_get_last_error())
+			{
+				$this->error_code = $error->code;
+				$this->error_string = $error->message;
+				$this->current_line = $error->line;
+				$this->current_column = $error->column;
+				return false;
+			}
+			else
+			{
+				return true;
+			}
+		}
 	}
 
 	function get_error_code()
@@ -10343,27 +14515,6 @@
 
 	function tag_open($parser, $tag, $attributes)
 	{
-		if ($this->feed === 0)
-		{
-			return;
-		}
-		elseif ($this->feed == false)
-		{
-			if (in_array($tag, array(
-				SIMPLEPIE_NAMESPACE_ATOM_10 . $this->separator . 'feed',
-				SIMPLEPIE_NAMESPACE_ATOM_03 . $this->separator . 'feed',
-				'rss',
-				SIMPLEPIE_NAMESPACE_RDF . $this->separator . 'RDF'
-			)))
-			{
-					$this->feed = 1;
-			}
-		}
-		else
-		{
-			$this->feed++;
-		}
-
 		list($this->namespace[], $this->element[]) = $this->split_ns($tag);
 
 		$attribs = array();
@@ -10396,7 +14547,7 @@
 		if ($this->current_xhtml_construct >= 0)
 		{
 			$this->current_xhtml_construct++;
-			if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML)
+			if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML)
 			{
 				$this->data['data'] .= '<' . end($this->element);
 				if (isset($attribs['']))
@@ -10414,8 +14565,8 @@
 			$this->datas[] =& $this->data;
 			$this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
 			$this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
-			if ((end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] == 'xml')
-			|| (end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] == 'xhtml'))
+			if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
+			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml'))
 			{
 				$this->current_xhtml_construct = 0;
 			}
@@ -10428,7 +14579,7 @@
 		{
 			$this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
 		}
-		elseif ($this->feed > 1)
+		else
 		{
 			$this->data['data'] .= $cdata;
 		}
@@ -10436,22 +14587,17 @@
 
 	function tag_close($parser, $tag)
 	{
-		if (!$this->feed)
-		{
-			return;
-		}
-
 		if ($this->current_xhtml_construct >= 0)
 		{
 			$this->current_xhtml_construct--;
-			if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
+			if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
 			{
 				$this->data['data'] .= '</' . end($this->element) . '>';
 			}
 		}
-		if ($this->current_xhtml_construct == -1)
+		if ($this->current_xhtml_construct === -1)
 		{
-			$this->data =& $this->datas[$this->feed];
+			$this->data =& $this->datas[count($this->datas) - 1];
 			array_pop($this->datas);
 		}
 
@@ -10460,7 +14606,6 @@
 		array_pop($this->xml_base);
 		array_pop($this->xml_base_explicit);
 		array_pop($this->xml_lang);
-		$this->feed--;
 	}
 
 	function split_ns($string)
@@ -10475,7 +14620,19 @@
 				{
 					$separator_length = strlen($this->separator);
 				}
-				$cache[$string] = array(substr($string, 0, $pos), substr($string, $pos + $separator_length));
+				$namespace = substr($string, 0, $pos);
+				$local_name = substr($string, $pos + $separator_length);
+				if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES)
+				{
+					$namespace = SIMPLEPIE_NAMESPACE_ITUNES;
+				}
+
+				// Normalize the Media RSS namespaces
+				if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG)
+				{
+					$namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
+				}
+				$cache[$string] = array($namespace, $local_name);
 			}
 			else
 			{
@@ -10487,7 +14644,7 @@
 }
 
 /**
- * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shortern a string while preserving HTML tags
+ * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags
  */
 class SimplePie_Sanitize
 {
@@ -10659,7 +14816,7 @@
 		{
 			if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
 			{
-				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/(\w+)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
+				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
 				{
 					$type |= SIMPLEPIE_CONSTRUCT_HTML;
 				}
@@ -10714,9 +14871,7 @@
 				{
 					foreach ($this->strip_attributes as $attrib)
 					{
-						$data = preg_replace('/ '. trim($attrib) .'=("|&quot;)(\w|\s|=|-|:|;|\/|\.|\?|&|,|#|!|\(|\)|\'|&apos;|<|>|\+|{|})*("|&quot;)/i', '', $data);
-						$data = preg_replace('/ '. trim($attrib) .'=(\'|&apos;)(\w|\s|=|-|:|;|\/|\.|\?|&|,|#|!|\(|\)|"|&quot;|<|>|\+|{|})*(\'|&apos;)/i', '', $data);
-						$data = preg_replace('/ '. trim($attrib) .'=(\w|\s|=|-|:|;|\/|\.|\?|&|,|#|!|\(|\)|\+|{|})*/i', '', $data);
+						$data = preg_replace('/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . trim($attrib) . '(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>/', '\1\2\3>', $data);
 					}
 				}
 
@@ -10735,27 +14890,30 @@
 					{
 						if (isset($img['attribs']['src']['data']))
 						{
-							$image_url = $img['attribs']['src']['data'];
-							$cache =& new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $image_url), 'spi');
+							$image_url = call_user_func($this->cache_name_function, $img['attribs']['src']['data']);
+							$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $image_url, 'spi');
 
 							if ($cache->load())
 							{
-								$img['attribs']['src']['data'] = $this->image_handler . rawurlencode($img['attribs']['src']['data']);
+								$img['attribs']['src']['data'] = $this->image_handler . $image_url;
 								$data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
 							}
 							else
 							{
-								$file =& new $this->file_class($image_url, $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
+								$file = new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
 								$headers = $file->headers;
 
-								if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)))
+								if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
 								{
-									if (!$cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+									if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+									{
+										$img['attribs']['src']['data'] = $this->image_handler . $image_url;
+										$data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
+									}
+									else
 									{
-										trigger_error("$cache->name is not writeable", E_USER_WARNING);
+										trigger_error("$this->cache_location is not writeable", E_USER_WARNING);
 									}
-									$img['attribs']['src']['data'] = $this->image_handler . rawurlencode($img['attribs']['src']['data']);
-									$data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
 								}
 							}
 						}
@@ -10776,7 +14934,7 @@
 				$data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
 			}
 
-			if ($this->output_encoding != 'UTF-8')
+			if ($this->output_encoding !== 'UTF-8')
 			{
 				$data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding);
 			}
@@ -10798,7 +14956,9 @@
 						if (isset($element['attribs'][$attribute]['data']))
 						{
 							$element['attribs'][$attribute]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attribute]['data'], $this->base);
-							$data = str_replace($element['full'], SimplePie_Misc::element_implode($element), $data);
+							$new_element = SimplePie_Misc::element_implode($element);
+							$data = str_replace($element['full'], $new_element, $data);
+							$element['full'] = $new_element;
 						}
 					}
 				}
@@ -10838,4 +14998,4 @@
 	}
 }
 
-?>
\ No hay ningún carácter de nueva línea al final del fichero
+?>
diff -aruN --binary 14/media/system/images/spinner.gif 15/media/system/images/spinner.gif
--- 14/media/system/images/spinner.gif	1970-01-01 01:00:00.000000000 +0100
+++ 15/media/system/images/spinner.gif	2009-11-04 18:56:08.000000000 +0100
@@ -0,0 +1,20 @@
+GIF89a�?
+
+
+%%%666DDDLLLTTT[[[dddlllttt{{{���������������������������������������������������������������������������������������������������������������������������������������������������������������!�NETSCAPE2.0!�?,�����n
+��RC�~o�Y-1����J��eF�$�v1_oa��SFr��29?,	8:BS".J#EJ')C-W7"#
,W6C.&>K,�C9!;K 6?>$�'75-8)�+b1)#/(?5)�?:>!?!4W1/? >8�K>�?$�:IBA!�?,
X��p��$zD�+��!=�3������~/�T))@B�X�r
+��C	Ȅ����	w6D(>IB$0�B1�D3,�?:%�A!�?,Q��pXi�B���c~6CY[@~�g#�l���A������PT:ȆE�~'�F�D2:C<7
+>B.%HMC"3�1WBA!�?,

+O�����L�H�,�M?ܢ��U2?
+4B0%Y���*@~7�j��P�/D�~���<I�G��.
�j�?HA!�?,Z�����	���T�� �#���6��%����%,�V$G��0 =ݣ� ����][ 
w-w"{?>JH).{?(<{�?A!�?,P��o�Y	�_);^d��O���X�ʱ8"��$�
+g�r�)�12��D��b8
?*=B1f.�f6^A!�?,
+
O��p��ňB,C�w�ȅ���FU!�2�d�2��1A�H�ߢ�x�$-������ 
+@~-X=?	?(D�0D
+	=?NCA!�?,
V��pH̸��S
+ɼ�>�SH�T.��YB8dDA��6����
+)h��B�	d���+�h	?	?,C"+?=2"C=a�<?:DA!�?,Q��p��
�X��?��XS�'��HL!�� 6Ԥ�Ӱ~�_�H)@�Z�J �?
+0P'??
>5qG>7BOGA!�?,

+N��0�	�BE�p !�C�zZS+�䞞_�`������~�ꩠ�8V�H�(?4G.M??6zG_?HA!�?,
U����3��ȟ�!B�_��vѣ��u �SV1 FY�꓾M
+ݘ�]>�Z�X*�X
+"/I8??PG/)??8i$>?A!�?,S����W��W���O�\~AWP�~(�9�Fñ6�j�s�|�G��
!
+5!'7?&*?0)#C:?!C1/? A;
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/media/system/js/caption.js 15/media/system/js/caption.js
--- 14/media/system/js/caption.js	2009-05-29 14:50:40.000000000 +0200
+++ 15/media/system/js/caption.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 /**
-* @version		$Id: modal.js 5263 2006-10-02 01:25:24Z webImagery $
-* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
+* @version		$Id: caption.js 5263 2006-10-02 01:25:24Z webImagery $
+* @copyright	Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
@@ -10,14 +10,14 @@
 */
 
 /**
- * JCaption javascript behavior
- *
- * Used for displaying image captions
- *
- * @package		Joomla
- * @since		1.5
- * @version     1.0
- */
+* JCaption javascript behavior
+*
+* Used for displaying image captions
+*
+* @package	Joomla
+* @since	1.5
+* @version	1.0
+*/
 var JCaption = new Class({
 	initialize: function(selector)
 	{
@@ -34,27 +34,43 @@
 		var text      = document.createElement("p");
 		var width     = element.getAttribute("width");
 		var align     = element.getAttribute("align");
+		var docMode = document.documentMode;
 
-		if(!width) {
-			width = element.width;
-		}
+		//Windows fix
+		if (!align)
+			align = element.getStyle("float");  // Rest of the world fix
+		if (!align) // IE DOM Fix
+			align = element.style.styleFloat;
 
 		text.appendChild(caption);
-		element.parentNode.insertBefore(container, element);
-		container.appendChild(element);
-		if ( element.title != "" ) {
-			container.appendChild(text);
+		text.className = this.selector.replace('.', '_');
+
+		if (align=="none") {
+			if (element.title != "") {
+				element.parentNode.replaceChild(text, element);
+				text.parentNode.insertBefore(element, text);
+			}
+		} else {
+			element.parentNode.insertBefore(container, element);
+			container.appendChild(element);
+			if ( element.title != "" ) {
+				container.appendChild(text);
+			}
+			container.className   = this.selector.replace('.', '_');
+			container.className   = container.className + " " + align;
+			container.setAttribute("style","float:"+align);
+
+			//IE8 fix
+			if (!docMode|| docMode < 8) {
+				container.style.width = width + "px";
+			}
 		}
-		container.className   = this.selector.replace('.', '_');
-		container.className   = container.className + " " + align;
-		container.setAttribute("style","float:"+align);
-		container.style.width = width + "px";
 
 	}
 });
 
-document.caption = null
+document.caption = null;
 window.addEvent('load', function() {
-  var caption = new JCaption('img.caption')
-  document.caption = caption
+	var caption = new JCaption('img.caption')
+	document.caption = caption
 });
diff -aruN --binary 14/media/system/js/mootools.js 15/media/system/js/mootools.js
--- 14/media/system/js/mootools.js	2009-05-29 14:50:40.000000000 +0200
+++ 15/media/system/js/mootools.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,10 +1,10 @@
 //MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006 Valerio Proietti, <http://mad4milk.net>, MIT Style License.
 
-var MooTools={version:'1.11'};function $defined(obj){return(obj!=undefined);};function $type(obj){if(!$defined(obj))return false;if(obj.htmlElement)return'element';var type=typeof obj;if(type=='object'&&obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}
+var MooTools={version:'1.12'};function $defined(obj){return(obj!=undefined);};function $type(obj){if(!$defined(obj))return false;if(obj.htmlElement)return'element';var type=typeof obj;if(type=='object'&&obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}
 if(type=='object'||type=='function'){switch(obj.constructor){case Array:return'array';case RegExp:return'regexp';case Class:return'class';}
 if(typeof obj.length=='number'){if(obj.item)return'collection';if(obj.callee)return'arguments';}}
 return type;};function $merge(){var mix={};for(var i=0;i<arguments.length;i++){for(var property in arguments[i]){var ap=arguments[i][property];var mp=mix[property];if(mp&&$type(ap)=='object'&&$type(mp)=='object')mix[property]=$merge(mp,ap);else mix[property]=ap;}}
-return mix;};var $extend=function(){var args=arguments;if(!args[1])args=[this,args[0]];for(var property in args[1])args[0][property]=args[1][property];return args[0];};var $native=function(){for(var i=0,l=arguments.length;i<l;i++){arguments[i].extend=function(props){for(var prop in props){if(!this.prototype[prop])this.prototype[prop]=props[prop];if(!this[prop])this[prop]=$native.generic(prop);}};}};$native.generic=function(prop){return function(bind){return this.prototype[prop].apply(bind,Array.prototype.slice.call(arguments,1));};};$native(Function,Array,String,Number);function $chk(obj){return!!(obj||obj===0);};function $pick(obj,picked){return $defined(obj)?obj:picked;};function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);};function $time(){return new Date().getTime();};function $clear(timer){clearTimeout(timer);clearInterval(timer);return null;};var Abstract=function(obj){obj=obj||{};obj.extend=$extend;return obj;};var Window=new Abstract(window);var Document=new Abstract(document);document.head=document.getElementsByTagName('head')[0];window.xpath=!!(document.evaluate);if(window.ActiveXObject)window.ie=window[window.XMLHttpRequest?'ie7':'ie6']=true;else if(document.childNodes&&!document.all&&!navigator.taintEnabled)window.webkit=window[window.xpath?'webkit420':'webkit419']=true;else if(document.getBoxObjectFor!=null)window.gecko=true;window.khtml=window.webkit;Object.extend=$extend;if(typeof HTMLElement=='undefined'){var HTMLElement=function(){};if(window.webkit)document.createElement("iframe");HTMLElement.prototype=(window.webkit)?window["[[DOMElement.prototype]]"]:{};}
+return mix;};var $extend=function(){var args=arguments;if(!args[1])args=[this,args[0]];for(var property in args[1])args[0][property]=args[1][property];return args[0];};var $native=function(){for(var i=0,l=arguments.length;i<l;i++){arguments[i].extend=function(props){for(var prop in props){if(!this.prototype[prop])this.prototype[prop]=props[prop];if(!this[prop])this[prop]=$native.generic(prop);}};}};$native.generic=function(prop){return function(bind){return this.prototype[prop].apply(bind,Array.prototype.slice.call(arguments,1));};};$native(Function,Array,String,Number);function $chk(obj){return!!(obj||obj===0);};function $pick(obj,picked){return $defined(obj)?obj:picked;};function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);};function $time(){return new Date().getTime();};function $clear(timer){clearTimeout(timer);clearInterval(timer);return null;};var Abstract=function(obj){obj=obj||{};obj.extend=$extend;return obj;};var Window=new Abstract(window);var Document=new Abstract(document);document.head=document.getElementsByTagName('head')[0];window.xpath=!!(document.evaluate);if(window.ActiveXObject)window.ie=window[window.XMLHttpRequest?'ie7':'ie6']=true;else if(document.childNodes&&!document.all&&!navigator.taintEnabled)window.webkit=window[window.xpath?'webkit420':'webkit419']=true;else if(document.getBoxObjectFor!=null||window.mozInnerScreenX!=null)window.gecko=true;window.khtml=window.webkit;Object.extend=$extend;if(typeof HTMLElement=='undefined'){var HTMLElement=function(){};if(window.webkit)document.createElement("iframe");HTMLElement.prototype=(window.webkit)?window["[[DOMElement.prototype]]"]:{};}
 HTMLElement.prototype.htmlElement=function(){};if(window.ie6)try{document.execCommand("BackgroundImageCache",false,true);}catch(e){};var Class=function(properties){var klass=function(){return(arguments[0]!==null&&this.initialize&&$type(this.initialize)=='function')?this.initialize.apply(this,arguments):this;};$extend(klass,this);klass.prototype=properties;klass.constructor=Class;return klass;};Class.empty=function(){};Class.prototype={extend:function(properties){var proto=new this(null);for(var property in properties){var pp=proto[property];proto[property]=Class.Merge(pp,properties[property]);}
 return new Class(proto);},implement:function(){for(var i=0,l=arguments.length;i<l;i++)$extend(this.prototype,arguments[i]);}};Class.Merge=function(previous,current){if(previous&&previous!=current){var type=$type(current);if(type!=$type(previous))return current;switch(type){case'function':var merged=function(){this.parent=arguments.callee.parent;return current.apply(this,arguments);};merged.parent=previous;return merged;case'object':return $merge(previous,current);}}
 return current;};var Chain=new Class({chain:function(fn){this.chains=this.chains||[];this.chains.push(fn);return this;},callChain:function(){if(this.chains&&this.chains.length)this.chains.shift().delay(10,this);},clearChain:function(){this.chains=[];}});var Events=new Class({addEvent:function(type,fn){if(fn!=Class.empty){this.$events=this.$events||{};this.$events[type]=this.$events[type]||[];this.$events[type].include(fn);}
diff -aruN --binary 14/media/system/js/mootools-uncompressed.js 15/media/system/js/mootools-uncompressed.js
--- 14/media/system/js/mootools-uncompressed.js	2009-05-29 14:50:40.000000000 +0200
+++ 15/media/system/js/mootools-uncompressed.js	2009-11-04 18:51:20.000000000 +0100
@@ -15,7 +15,7 @@
 */
 
 var MooTools = {
-	version: '1.11'
+	version: '1.12'
 };
 
 /* Section: Core Functions */
@@ -286,7 +286,7 @@
 /*
 Class: window
 	Some properties are attached to the window object by the browser detection.
-
+	
 Note:
 	browser detection is entirely object-based. We dont sniff.
 
@@ -304,7 +304,7 @@
 window.xpath = !!(document.evaluate);
 if (window.ActiveXObject) window.ie = window[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true;
 else if (document.childNodes && !document.all && !navigator.taintEnabled) window.webkit = window[window.xpath ? 'webkit420' : 'webkit419'] = true;
-else if (document.getBoxObjectFor != null) window.gecko = true;
+else if (document.getBoxObjectFor != null || window.mozInnerScreenX != null) window.gecko = true;
 
 /*compatibility*/
 
diff -aruN --binary 14/modules/mod_footer/mod_footer.php 15/modules/mod_footer/mod_footer.php
--- 14/modules/mod_footer/mod_footer.php	2009-05-29 14:54:10.000000000 +0200
+++ 15/modules/mod_footer/mod_footer.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: mod_footer.php 10381 2008-06-01 03:35:53Z pasamio $
+* @version		$Id: mod_footer.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -21,13 +21,13 @@
 $csite_name	= $mainframe->getCfg('sitename');
 
 if (JString::strpos(JText :: _('FOOTER_LINE1'), '%date%')) {
-	$line1 = ereg_replace('%date%', $cur_year, JText :: _('FOOTER_LINE1'));
+	$line1 = str_replace('%date%', $cur_year, JText :: _('FOOTER_LINE1'));
 } else {
 	$line1 = JText :: _('FOOTER_LINE1');
 }
 
 if (JString::strpos($line1, '%sitename%')) {
-	$lineone = ereg_replace('%sitename%', $csite_name, $line1);
+	$lineone = str_replace('%sitename%', $csite_name, $line1);
 } else {
 	$lineone = $line1;
 }
diff -aruN --binary 14/modules/mod_mainmenu/helper.php 15/modules/mod_mainmenu/helper.php
--- 14/modules/mod_mainmenu/helper.php	2009-05-29 14:54:12.000000000 +0200
+++ 15/modules/mod_mainmenu/helper.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: helper.php 11799 2009-05-06 02:15:50Z ian $
+* @version		$Id: helper.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -28,7 +28,7 @@
  */
 class modMainMenuHelper
 {
-	function buildXML(&$params)
+	function buildXML($params)
 	{
 		$menu = new JMenuTree($params);
 		$items = &JSite::getMenu();
diff -aruN --binary 14/modules/mod_mainmenu/legacy.php 15/modules/mod_mainmenu/legacy.php
--- 14/modules/mod_mainmenu/legacy.php	2009-05-29 14:54:12.000000000 +0200
+++ 15/modules/mod_mainmenu/legacy.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: legacy.php 10856 2008-08-30 06:35:08Z willebil $
+* @version		$Id: legacy.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -47,8 +47,8 @@
 			break;
 
 		case 'url' :
-			if (eregi('index.php\?', $mitem->link)) {
-				if (!eregi('Itemid=', $mitem->link)) {
+			if (preg_match('#index.php\?#i', $mitem->link)) {
+				if (!preg_match('#Itemid=#i', $mitem->link)) {
 					$mitem->link .= '&amp;Itemid='.$mitem->id;
 				}
 			}
diff -aruN --binary 14/modules/mod_newsflash/helper.php 15/modules/mod_newsflash/helper.php
--- 14/modules/mod_newsflash/helper.php	2009-05-29 14:54:10.000000000 +0200
+++ 15/modules/mod_newsflash/helper.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: helper.php 10868 2008-08-30 07:22:26Z willebil $
+* @version		$Id: helper.php 13246 2009-10-20 04:24:06Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -38,8 +38,11 @@
 			{
 				// Check to see if the user has access to view the full article
 				if ($item->access <= $user->get('aid', 0)) {
+					$itemparams=new JParameter($item->attribs);
+					$readmoretxt=$itemparams->get('readmore',JText::_('Read more text'));
+
 					$item->linkOn = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid));
-					$item->linkText = JText::_('Read more text');
+					$item->linkText = $readmoretxt;
 				} else {
 					$item->linkOn = JRoute::_('index.php?option=com_user&view=login');
 					$item->linkText = JText::_('Login To Read More');
diff -aruN --binary 14/modules/mod_random_image/helper.php 15/modules/mod_random_image/helper.php
--- 14/modules/mod_random_image/helper.php	2009-05-29 14:54:06.000000000 +0200
+++ 15/modules/mod_random_image/helper.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: helper.php 10381 2008-06-01 03:35:53Z pasamio $
+* @version		$Id: helper.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -81,7 +81,7 @@
 			{
 				if (!is_dir($dir .DS. $img))
 				{
-					if (eregi($type, $img)) {
+					if (preg_match("#$type#i", $img)) {
 						$images[$i]->name 	= $img;
 						$images[$i]->folder	= $folder;
 						++$i;
diff -aruN --binary 14/modules/mod_search/mod_search.php 15/modules/mod_search/mod_search.php
--- 14/modules/mod_search/mod_search.php	2009-05-29 14:54:12.000000000 +0200
+++ 15/modules/mod_search/mod_search.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: mod_search.php 10855 2008-08-29 22:47:34Z willebil $
+* @version		$Id: mod_search.php 13338 2009-10-27 02:15:55Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -30,4 +30,5 @@
 if ($imagebutton) {
     $img = modSearchHelper::getSearchImage( $button_text );
 }
+$mitemid = $set_Itemid > 0 ? $set_Itemid : JRequest::getInt('Itemid');
 require(JModuleHelper::getLayoutPath('mod_search'));
diff -aruN --binary 14/modules/mod_search/mod_search.xml 15/modules/mod_search/mod_search.xml
--- 14/modules/mod_search/mod_search.xml	2009-05-29 14:54:12.000000000 +0200
+++ 15/modules/mod_search/mod_search.xml	2009-11-04 18:51:20.000000000 +0100
@@ -33,6 +33,8 @@
 			<option value="1">Yes</option>
 		</param>
 		<param name="button_text" type="text" default="" label="Button Text" description="PARAMBUTTONTEXT" />
+		<param name="@spacer" type="spacer" default="" label="" description="" />
+		<param name="set_itemid" type="text" default="" label="Set Itemid" description="PARAMSETITEMID" />
 	</params>
 	<params group="advanced">
 		<param name="cache" type="list" default="1" label="Caching" description="Select whether to cache the content of this module">
diff -aruN --binary 14/modules/mod_search/tmpl/default.php 15/modules/mod_search/tmpl/default.php
--- 14/modules/mod_search/tmpl/default.php	2009-05-29 14:54:12.000000000 +0200
+++ 15/modules/mod_search/tmpl/default.php	2009-11-04 18:51:20.000000000 +0100
@@ -39,4 +39,5 @@
 	</div>
 	<input type="hidden" name="task"   value="search" />
 	<input type="hidden" name="option" value="com_search" />
+	<input type="hidden" name="Itemid" value=<?php echo $mitemid; ?> />
 </form>
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/content/emailcloak.php 15/plugins/content/emailcloak.php
--- 14/plugins/content/emailcloak.php	2009-07-23 04:25:36.000000000 +0200
+++ 15/plugins/content/emailcloak.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: emailcloak.php 12537 2009-07-22 17:15:21Z ian $
+* @version		$Id: emailcloak.php 13360 2009-10-28 04:30:10Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -43,8 +43,8 @@
  */
 function plgContentEmailCloak_searchPattern ($link, $text) {
 	// <a href="mailto:anyLink">anyText</a>
-	$pattern = '~(?:<a [\w "\'=\@\.\-]*href\s*=\s*"mailto:'
-		. $link . '"[\w "\'=\@\.\-]*)>' . $text . '</a>~i';
+	$pattern = '~(?:<a [\w "\'=\@\.\-]*href\s*=\s*"(mailto:|https?://(?:[a-z0-9][a-z0-9\-]*[a-z0-9]\.)*(?:[a-z0-9]+)(?::\d+)?[a-z0-9;/\?:\@&=+\$,\-_\.!\~*\'\(\)%]+?%3C)'
+		. $link . '(%3E)?"([\w "\'=\@\.\-]*))>' . $text . '</a>~i';
 
 	return $pattern;
 }
@@ -80,12 +80,51 @@
 	$pluginParams = new JParameter($plugin->params);
 	$mode = $pluginParams->def('mode', 1);
 
+	// split the string into parts to exclude strcipt tags from being handled
+	$text = explode( '<script', $text );
+	foreach ( $text as $i => $str ) {
+		if ( $i == 0 ) {
+			plgEmailCloakString( $text[$i], $mode );
+		} else {
+			$str_split = explode( '</script>', $str );
+			foreach ( $str_split as $j => $str_split_part ) {
+				if ( ( $j % 2 ) == 1 ) {
+					plgEmailCloakString( $str_split[$i], $mode );
+				}
+			}
+			$text[$i] = implode( '</script>', $str_split );
+		}
+	}
+	$text = implode( '<script', $text );
+	return true;
+}
+
+/**
+ * Cloak all emails in text from spambots via Javascript.
+ *
+ * @param string The string to be cloaked.
+ * @param string The mode.
+ * replaces addresses with "mailto:" links if nonzero.
+ * @return boolean True on success.
+ */
+function plgEmailCloakString(&$text, $mode = 1)
+{
+	// Simple performance check to determine whether bot should process further.
+	if (JString::strpos($text, '@') === false) {
+		return true;
+	}
+
+
 	// any@email.address.com
 	$searchEmail = '([\w\.\-]+\@(?:[a-z0-9\.\-]+\.)+(?:[a-z0-9\-]{2,4}))';
 	// any@email.address.com?subject=anyText
 	$searchEmailLink = $searchEmail . '([?&][\x20-\x7f][^"<>]+)';
 	// anyText
-	$searchText = '([\x20-\x7f][^<>]+)';
+	$searchText = '((?:[\x20-\x7f]|[\xA1-\xFF]|[\xC2-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF4][\x80-\xBF]{3})[^<>]+)';
+
+	//$searchText = '(+)';
+	//Any Image link
+	$searchImage	=	"(<img[^>]+>)";
 
 	/*
 	 * Search for derivatives of link code <a href="mailto:email@amail.com"
@@ -93,8 +132,8 @@
 	 */
 	$pattern = plgContentEmailCloak_searchPattern($searchEmail, $searchEmail);
 	while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
-		$mail = $regs[1][0];
-		$mailText = $regs[2][0];
+		$mail = $regs[2][0];
+		$mailText = $regs[3][0];
 
 		// Check to see if mail text is different from mail addy
 		$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText);
@@ -109,10 +148,31 @@
 	 */
 	$pattern = plgContentEmailCloak_searchPattern($searchEmail, $searchText);
 	while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
-		$mail = $regs[1][0];
-		$mailText = $regs[2][0];
+        $prefix = $regs[1][0];
+		$mail = $regs[2][0];
+        $suffix = $regs[3][0];
+        $attribs = $regs[4][0];
+		$mailText = $regs[5][0];
 
-		$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText, 0);
+		$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText, 0, $prefix, $suffix, $attribs);
+
+		// Replace the found address with the js cloaked email
+		$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
+	}
+
+	/*
+	 * Search for derivatives of link code <a href="mailto:email@amail.com">
+	 * <img anything></a>
+	 */
+	$pattern = plgContentEmailCloak_searchPattern($searchEmail, $searchImage);
+	while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
+		$prefix = $regs[1][0];
+		$mail = $regs[2][0];
+		$suffix = $regs[3][0];
+		$attribs = $regs[4][0];
+		$mailText = $regs[5][0];
+
+		$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText, 0, $prefix, $suffix, $attribs);
 
 		// Replace the found address with the js cloaked email
 		$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
@@ -124,8 +184,8 @@
 	 */
 	$pattern = plgContentEmailCloak_searchPattern($searchEmailLink, $searchEmail);
 	while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
-		$mail = $regs[1][0] . $regs[2][0];
-		$mailText = $regs[3][0];
+		$mail = $regs[2][0] . $regs[3][0];
+		$mailText = $regs[6][0];
 		// Needed for handling of Body parameter
 		$mail = str_replace( '&amp;', '&', $mail );
 
@@ -142,8 +202,8 @@
 	 */
 	$pattern = plgContentEmailCloak_searchPattern($searchEmailLink, $searchText);
 	while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
-		$mail = $regs[1][0] . $regs[2][0];
-		$mailText = $regs[3][0];
+		$mail = $regs[2][0] . $regs[3][0];
+		$mailText = $regs[6][0];
 		// Needed for handling of Body parameter
 		$mail = str_replace('&amp;', '&', $mail);
 
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/langs/en.js	2009-06-23 13:11:08.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,8 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-insert_advhr_desc : 'Horizontal rule',
-insert_advhr_width : 'Width',
-insert_advhr_size : 'Height',
-insert_advhr_noshade : 'No shadow'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/langs/en.js	2009-06-23 13:11:10.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,27 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('advimage',{
-tab_general : 'General',
-tab_appearance : 'Appearance',
-tab_advanced : 'Advanced',
-general : 'General',
-title : 'Title',
-preview : 'Preview',
-constrain_proportions : 'Constrain proportions',
-langdir : 'Language direction',
-langcode : 'Language code',
-long_desc : 'Long description link',
-style : 'Style',
-classes : 'Classes',
-ltr : 'Left to right',
-rtl : 'Right to left',
-id : 'Id',
-image_map : 'Image map',
-swap_image : 'Swap image',
-alt_image : 'Alternative image',
-mouseover : 'for mouse over',
-mouseout : 'for mouse out',
-misc : 'Miscellaneous',
-example_img : 'Appearance&nbsp;preview&nbsp;image',
-missing_alt : 'Are you sure you want to continue without including an Image Description? Without  it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/langs/en.js	2009-06-23 13:11:18.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,46 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('advlink',{
-general_tab : 'General',
-popup_tab : 'Popup',
-events_tab : 'Events',
-advanced_tab : 'Advanced',
-general_props : 'General properties',
-popup_props : 'Popup properties',
-event_props : 'Events',
-advanced_props : 'Advanced properties',
-popup_opts : 'Options',
-anchor_names : 'Anchors',
-target_same : 'Open in this window / frame',
-target_parent : 'Open in parent window / frame',
-target_top : 'Open in top frame (replaces all frames)',
-target_blank : 'Open in new window',
-popup : 'Javascript popup',
-popup_url : 'Popup URL',
-popup_name : 'Window name',
-popup_return : 'Insert \'return false\'',
-popup_scrollbars : 'Show scrollbars',
-popup_statusbar : 'Show status bar',
-popup_toolbar : 'Show toolbars',
-popup_menubar : 'Show menu bar',
-popup_location : 'Show location bar',
-popup_resizable : 'Make window resizable',
-popup_dependent : 'Dependent (Mozilla/Firefox only)',
-popup_size : 'Size',
-popup_position : 'Position (X/Y)',
-id : 'Id',
-style: 'Style',
-classes : 'Classes',
-target_name : 'Target name',
-langdir : 'Language direction',
-target_langcode : 'Target language',
-langcode : 'Language code',
-encoding : 'Target character encoding',
-mime : 'Target MIME type',
-rel : 'Relationship page to target',
-rev : 'Relationship target to page',
-tabindex : 'Tabindex',
-accesskey : 'Accesskey',
-ltr : 'Left to right',
-rtl : 'Right to left'
-});
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/langs/en.js	2009-06-23 13:11:14.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1 @@
 // EN lang variables
-
-tinyMCE.addToLang('',{
-autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/langs/en.js	2009-06-23 13:11:14.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,23 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('devkit',{
-title : 'TinyMCE Development Kit',
-info_tab : 'Info',
-settings_tab : 'Settings',
-log_tab : 'Log',
-content_tab : 'Content',
-command_states_tab : 'Commands',
-undo_redo_tab : 'Undo/Redo',
-misc_tab : 'Misc',
-filter : 'Filter:',
-clear_log : 'Clear log',
-refresh : 'Refresh',
-info_help : 'Press Refresh to view info.',
-settings_help : 'Press Refresh to display the settings array for each TinyMCE_Control instance.',
-content_help : 'Press Refresh to display the raw and cleaned HTML content for each TinyMCE_Control instance.',
-command_states_help : 'Press Refresh to display the current command states from inst.queryCommandState. This list will also mark unsupported commands.',
-undo_redo_help : 'Press Refresh to display the global and instance undo/redo levels.',
-misc_help : 'Here are various tools for debugging and development purposes.',
-debug_events : 'Debug events',
-undo_diff : 'Diff undo levels'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/langs/en.js	2009-06-23 13:11:12.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-directionality_ltr_desc : 'Direction left to right',
-directionality_rtl_desc : 'Direction right to left'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/langs/en.js	2009-06-23 13:11:04.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,22 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('emotions',{
-title : 'Insert emotion',
-desc : 'Emotions',
-cool : 'Cool',
-cry : 'Cry',
-embarassed : 'Embarassed',
-foot_in_mouth : 'Foot in mouth',
-frown : 'Frown',
-innocent : 'Innocent',
-kiss : 'Kiss',
-laughing : 'Laughing',
-money_mouth : 'Money mouth',
-sealed : 'Sealed',
-smile : 'Smile',
-surprised : 'Surprised',
-tongue_out : 'Tongue out',
-undecided : 'Undecided',
-wink : 'Wink',
-yell : 'Yell'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/langs/en.js	2009-06-23 13:11:18.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,11 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('flash',{
-title : 'Insert / edit Flash Movie',
-desc : 'Insert / edit Flash Movie',
-file : 'Flash-File (.swf)',
-size : 'Size',
-list : 'Flash files',
-props : 'Flash properties',
-general : 'General'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js	2009-06-30 22:05:14.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js	2009-11-04 18:51:20.000000000 +0100
@@ -123,7 +123,7 @@
 	// Parse xml and doctype
 	xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
 	xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
-	docType = getReItem(/<\!DOCTYPE.*?>/gi, h, 0);
+	docType = getReItem(/<\!DOCTYPE.*?>/gi, h.replace(/\n/g, ''), 0).replace(/ +/g, ' ');
 	f.langcode.value = getReItem(/lang="(.*?)"/gi, h, 1);
 
 	// Parse title
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/en.js	2009-06-23 13:11:20.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,92 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('fullpage',{
-	title : 'Document properties',
-	desc : 'Document properties',
-	meta_tab : 'General',
-	appearance_tab : 'Appearance',
-	advanced_tab : 'Advanced',
-	meta_props : 'Meta information',
-	langprops : 'Language and encoding',
-	meta_title : 'Title',
-	meta_keywords : 'Keywords',
-	meta_description : 'Description',
-	meta_robots : 'Robots',
-	doctypes : 'Doctype',
-	langcode : 'Language code',
-	langdir : 'Language direction',
-	ltr : 'Left to right',
-	rtl : 'Right to left',
-	xml_pi : 'XML declaration',
-	encoding : 'Character encoding',
-	appearance_bgprops : 'Background properties',
-	appearance_marginprops : 'Body margins',
-	appearance_linkprops : 'Link colors',
-	appearance_textprops : 'Text properties',
-	bgcolor : 'Background color',
-	bgimage : 'Background image',
-	left_margin : 'Left margin',
-	right_margin : 'Right margin',
-	top_margin : 'Top margin',
-	bottom_margin : 'Bottom margin',
-	text_color : 'Text color',
-	font_size : 'Font size',
-	font_face : 'Font face',
-	link_color : 'Link color',
-	hover_color : 'Hover color',
-	visited_color : 'Visited color',
-	active_color : 'Active color',
-	textcolor : 'Color',
-	fontsize : 'Font size',
-	fontface : 'Font family',
-	meta_index_follow : 'Index and follow the links',
-	meta_index_nofollow : 'Index and don\'t follow the links',
-	meta_noindex_follow : 'Do not index but follow the links',
-	meta_noindex_nofollow : 'Do not index and don\'t follow the links',
-	appearance_style : 'Stylesheet and style properties',
-	stylesheet : 'Stylesheet',
-	style : 'Style',
-	author : 'Author',
-	copyright : 'Copyright',
-	add : 'Add new element',
-	remove : 'Remove selected element',
-	moveup : 'Move selected element up',
-	movedown : 'Move selected element down',
-	head_elements : 'Head elements',
-	info : 'Information',
-	info_text : '',
-	add_title : 'Title element',
-	add_meta : 'Meta element',
-	add_script : 'Script element',
-	add_style : 'Style element',
-	add_link : 'Link element',
-	add_base : 'Base element',
-	add_comment : 'Comment node',
-	title_element : 'Title element',
-	script_element : 'Script element',
-	style_element : 'Style element',
-	base_element : 'Base element',
-	link_element : 'Link element',
-	meta_element : 'Meta element',
-	comment_element : 'Comment',
-	src : 'Src',
-	language : 'Language',
-	href : 'Href',
-	target : 'Target',
-	rel : 'Rel',
-	type : 'Type',
-	charset : 'Charset',
-	defer : 'Defer',
-	media : 'Media',
-	properties : 'Properties',
-	name : 'Name',
-	value : 'Value',
-	content : 'Content',
-	rel : 'Rel',
-	rev : 'Rev',
-	hreflang : 'Href lang',
-	general_props : 'General',
-	advanced_props : 'Advanced',
-	delta_width : 0,
-	delta_height : 0
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/langs/en.js	2009-06-23 13:11:24.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-fullscreen_desc : 'Toggle fullscreen mode'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/langs/en.js	2009-06-23 13:11:04.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,7 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-iespell_desc : 'Run spell checking',
-iespell_download : "ieSpell not detected. Click OK to go to download page."
-});
-
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js	2009-06-30 22:01:32.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js	2009-11-04 18:51:20.000000000 +0100
@@ -1 +1 @@
-(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark("simple")}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":q.settings.inlinepopups_skin||"clearlooks2",style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
\ No hay ningún carácter de nueva línea al final del fichero
+(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":q.settings.inlinepopups_skin||"clearlooks2",style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js	2009-06-30 22:01:32.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 999 2009-02-10 17:42:58Z spocke $
+ * $Id: editor_plugin_src.js 1150 2009-06-01 11:50:46Z spocke $
  *
  * @author Moxiecode
  * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -50,7 +50,7 @@
 
 			// Only store selection if the type is a normal window
 			if (!f.type)
-				t.bookmark = ed.selection.getBookmark('simple');
+				t.bookmark = ed.selection.getBookmark(1);
 
 			id = DOM.uniqueId();
 			vp = DOM.getViewPort();
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/langs/en.js	2009-06-23 13:10:58.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,12 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-insertdate_def_fmt : '%Y-%m-%d',
-inserttime_def_fmt : '%H:%M:%S',
-insertdate_desc : 'Insert date',
-inserttime_desc : 'Insert time',
-inserttime_months_long : new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"),
-inserttime_months_short : new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"),
-inserttime_day_long : new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"),
-inserttime_day_short : new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/langs/en.js	2009-06-23 13:11:10.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,9 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('layer',{
-insertlayer_desc : 'Insert new layer',
-forward_desc : 'Move forward',
-backward_desc : 'Move backward',
-absolute_desc : 'Toggle absolute positioning',
-content : 'New layer...'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/langs/en.js	2009-06-23 13:10:56.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,94 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('media',{
-title : 'Insert / edit embedded media',
-desc : 'Insert / edit embedded media',
-general : 'General',
-advanced : 'Advanced',
-file : 'File/URL',
-list : 'List',
-size : 'Dimensions',
-preview : 'Preview',
-constrain_proportions : 'Constrain proportions',
-type : 'Type',
-id : 'Id',
-name : 'Name',
-class_name : 'Class',
-vspace : 'V-Space',
-hspace : 'H-Space',
-play : 'Auto play',
-loop : 'Loop',
-menu : 'Show menu',
-quality : 'Quality',
-scale : 'Scale',
-align : 'Align',
-salign : 'SAlign',
-wmode : 'WMode',
-bgcolor : 'Background',
-base : 'Base',
-flashvars : 'Flashvars',
-liveconnect : 'SWLiveConnect',
-autohref : 'AutoHREF',
-cache : 'Cache',
-hidden : 'Hidden',
-controller : 'Controller',
-kioskmode : 'Kiosk mode',
-playeveryframe : 'Play every frame',
-targetcache : 'Target cache',
-correction : 'No correction',
-enablejavascript : 'Enable JavaScript',
-starttime : 'Start time',
-endtime : 'End time',
-href : 'Href',
-qtsrcchokespeed : 'Choke speed',
-target : 'Target',
-volume : 'Volume',
-autostart : 'Auto start',
-enabled : 'Enabled',
-fullscreen : 'Fullscreen',
-invokeurls : 'Invoke URLs',
-mute : 'Mute',
-stretchtofit : 'Stretch to fit',
-windowlessvideo : 'Windowless video',
-balance : 'Balance',
-baseurl : 'Base URL',
-captioningid : 'Captioning id',
-currentmarker : 'Current marker',
-currentposition : 'Current position',
-defaultframe : 'Default frame',
-playcount : 'Play count',
-rate : 'Rate',
-uimode : 'UI Mode',
-flash_options : 'Flash options',
-qt_options : 'Quicktime options',
-wmp_options : 'Windows media player options',
-rmp_options : 'Real media player options',
-shockwave_options : 'Shockwave options',
-autogotourl : 'Auto goto URL',
-center : 'Center',
-imagestatus : 'Image status',
-maintainaspect : 'Maintain aspect',
-nojava : 'No java',
-prefetch : 'Prefetch',
-shuffle : 'Shuffle',
-console : 'Console',
-numloop : 'Num loops',
-controls : 'Controls',
-scriptcallbacks : 'Script callbacks',
-swstretchstyle : 'Stretch style',
-swstretchhalign : 'Stretch H-Align',
-swstretchvalign : 'Stretch V-Align',
-sound : 'Sound',
-progress : 'Progress',
-qtsrc : 'QT Src',
-qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
-align_top : 'Top',
-align_right : 'Right',
-align_bottom : 'Bottom',
-align_left : 'Left',
-align_center : 'Center',
-align_top_left : 'Top left',
-align_top_right : 'Top right',
-align_bottom_left : 'Bottom left',
-align_bottom_right : 'Bottom right'
-});
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/langs/en.js	2009-06-23 13:11:18.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('nonbreaking',{
-desc : 'Insert non-breaking space character'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js	2009-06-30 22:01:32.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js	2009-11-04 18:51:20.000000000 +0100
@@ -1 +1 @@
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var k=c.dom,j={content:i};e.onPreProcess.dispatch(e,j);j.node=k.create("div",0,j.content);e.onPostProcess.dispatch(e,j);j.content=c.serializer.serialize(j.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(j.content)){e._insertBlockContent(c,k,j.content)}else{e._insert(j.content)}}c.addCommand("mceInsertClipboardContent",function(i,h){g(h)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"},"&nbsp;");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);g(p.innerHTML);return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var r=o.get("_mcePaste"),q;r.id="_mceRemoved";o.remove(r);r=o.get("_mcePaste")||r;q=(o.select("> span.Apple-style-span div",r)[0]||o.select("> span.Apple-style-span",r)[0]||r).innerHTML;o.remove(r);if(k){j.setRng(k)}g(q)},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}if(c.getParam("paste_block_drop")){c.onInit.add(function(){c.dom.bind(c.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(h){h.preventDefault();h.stopPropagation();return false})})}e._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(d,g){var b=this.editor,c=g.content,f,e;function f(h){a(h,function(i){if(i.constructor==RegExp){c=c.replace(i,"")}else{c=c.replace(i[0],i[1])}})}f([/^\s*(&nbsp;)+/g,/(&nbsp;|<br[^>]*>)+\s*$/g]);if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c)){g.wordContent=true;if(b.getParam("paste_convert_middot_lists",true)){f([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+:\s*symbol[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<span[^>]+mso-list:[^>]+>)/gi,"$1__MCE_ITEM__"]])}f([/<!--[\s\S]+?-->/gi,/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/<script[^>]+>[\s\S]*?<\/script>/gi,[/&nbsp;/g,"\u00a0"]]);if(!b.getParam("paste_retain_style_properties")){f([/<\/?(span)[^>]*>/gi])}}e=b.getParam("paste_strip_class_attributes","all");if(e!="none"){if(e=="all"){f([/ class=\"([^\"]*)\"/gi,/ class=(\w+)/gi])}else{f([/ class=\"(mso[^\"]*)\"/gi,/ class=(mso\w+)/gi])}}if(b.getParam("paste_remove_spans")){f([/<\/?(span)[^>]*>/gi])}g.content=c},_postProcess:function(e,g){var d=this,c=d.editor,f=c.dom,b;if(g.wordContent){a(f.select("a",g.node),function(h){if(!h.href||h.href.indexOf("#_Toc")!=-1){f.remove(h,1)}});if(d.editor.getParam("paste_convert_middot_lists",true)){d._convertLists(e,g)}b=c.getParam("paste_retain_style_properties");if(tinymce.is(b,"string")){b=tinymce.explode(b)}a(f.select("*",g.node),function(l){var m={},j=0,k,n,h;if(b){for(k=0;k<b.length;k++){n=b[k];h=f.getStyle(l,n);if(h){m[n]=h;j++}}}f.setAttrib(l,"style","");if(b&&j>0){f.setStyles(l,m)}else{if(l.nodeName=="SPAN"&&!l.className){f.remove(l,true)}}})}if(c.getParam("paste_remove_styles")||(c.getParam("paste_remove_styles_if_webkit")&&tinymce.isWebKit)){a(f.select("*[style]",g.node),function(h){h.removeAttribute("style");h.removeAttribute("mce_style")})}else{if(tinymce.isWebKit){a(f.select("*",g.node),function(h){h.removeAttribute("mce_style")})}}},_convertLists:function(e,c){var g=e.editor.dom,f,j,b=-1,d,k=[],i,h;a(g.select("p",c.node),function(r){var n,s="",q,o,l,m;for(n=r.firstChild;n&&n.nodeType==3;n=n.nextSibling){s+=n.nodeValue}s=r.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(s)){q="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(s)){q="ol"}if(q){d=parseFloat(r.style.marginLeft||0);if(d>b){k.push(d)}if(!f||q!=i){f=g.create(q);g.insertAfter(f,r)}else{if(d>b){f=j.appendChild(g.create(q))}else{if(d<b){l=tinymce.inArray(k,d);m=g.getParents(f.parentNode,q);f=m[m.length-1-l]||f}}}a(g.select("span",r),function(t){var p=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(q=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){g.remove(t)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){g.remove(t)}}});o=r.innerHTML;if(q=="ul"){o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}j=f.appendChild(g.create("li",0,o));g.remove(r);b=d;i=q}else{f=b=0}});h=c.node.innerHTML;if(h.indexOf("__MCE_ITEM__")!=-1){c.node.innerHTML=h.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(h,e,i){var c,g,d=h.selection,m,j,b,k,f;function l(p){var o;if(tinymce.isIE){o=h.getDoc().body.createTextRange();o.moveToElementText(p);o.collapse(false);o.select()}else{d.select(p,1);d.collapse(false)}}this._insert('<span id="_marker">&nbsp;</span>',1);g=e.get("_marker");c=e.getParent(g,"p,h1,h2,h3,h4,h5,h6,ul,ol");if(c){g=e.split(c,g);a(e.create("div",0,i).childNodes,function(o){m=g.parentNode.insertBefore(o.cloneNode(true),g)});l(m)}else{e.setOuterHTML(g,i);d.select(h.getBody(),1);d.collapse(0)}e.remove("_marker");j=d.getStart();b=e.getViewPort(h.getWin());k=h.dom.getPos(j).y;f=j.clientHeight;if(k<b.y||k+f>b.y+b.h){h.getDoc().body.scrollTop=k<b.y?k:k-b.h+25}},_insert:function(d,b){var c=this.editor;if(!c.selection.isCollapsed()){c.getDoc().execCommand("Delete",false,null)}c.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,d,{skip_undo:b})},_legacySupport:function(){var c=this,b=c.editor;a(["mcePasteText","mcePasteWord"],function(d){b.addCommand(d,function(){b.windowManager.open({file:c.url+(d=="mcePasteText"?"/pastetext.htm":"/pasteword.htm"),width:parseInt(b.getParam("paste_dialog_width","450")),height:parseInt(b.getParam("paste_dialog_height","400")),inline:1})})});b.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});b.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"});b.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No hay ningún carácter de nueva línea al final del fichero
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var h=c.dom;e.onPreProcess.dispatch(e,i);i.node=h.create("div",0,i.content);e.onPostProcess.dispatch(e,i);i.content=c.serializer.serialize(i.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(i.content)){e._insertBlockContent(c,h,i.content)}else{e._insert(i.content)}}c.addCommand("mceInsertClipboardContent",function(h,i){g(i)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"},"&nbsp;");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);if(p.innerHTML==="&nbsp;"){return}g({content:p.innerHTML});return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var n="";a(o.select("div[id=_mcePaste]").reverse(),function(q){n+=(o.select("> span.Apple-style-span div",q)[0]||o.select("> span.Apple-style-span",q)[0]||q).innerHTML;o.remove(q)});if(k){j.setRng(k)}g({content:n})},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}if(c.getParam("paste_block_drop")){c.onInit.add(function(){c.dom.bind(c.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(h){h.preventDefault();h.stopPropagation();return false})})}e._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(d,g){var b=this.editor,c=g.content,f,e;function f(h){a(h,function(i){if(i.constructor==RegExp){c=c.replace(i,"")}else{c=c.replace(i[0],i[1])}})}if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c)||g.wordContent){g.wordContent=true;f([/^\s*(&nbsp;)+/g,/(&nbsp;|<br[^>]*>)+\s*$/g]);if(b.getParam("paste_convert_middot_lists",true)){f([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+:\s*symbol[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<span[^>]+mso-list:[^>]+>)/gi,"$1__MCE_ITEM__"]])}f([/<!--[\s\S]+?-->/gi,/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/<script[^>]+>[\s\S]*?<\/script>/gi,[/&nbsp;/g,"\u00a0"]]);if(!b.getParam("paste_retain_style_properties")){f([/<\/?(span)[^>]*>/gi])}}e=b.getParam("paste_strip_class_attributes","all");if(e!="none"){if(e=="all"){f([/ class=\"([^\"]*)\"/gi,/ class=(\w+)/gi])}else{f([/ class=\"(mso[^\"]*)\"/gi,/ class=(mso\w+)/gi])}}if(b.getParam("paste_remove_spans")){f([/<\/?(span)[^>]*>/gi])}g.content=c},_postProcess:function(e,g){var d=this,c=d.editor,f=c.dom,b;if(g.wordContent){a(f.select("a",g.node),function(h){if(!h.href||h.href.indexOf("#_Toc")!=-1){f.remove(h,1)}});if(d.editor.getParam("paste_convert_middot_lists",true)){d._convertLists(e,g)}b=c.getParam("paste_retain_style_properties");if(tinymce.is(b,"string")){b=tinymce.explode(b)}a(f.select("*",g.node),function(l){var m={},j=0,k,n,h;if(b){for(k=0;k<b.length;k++){n=b[k];h=f.getStyle(l,n);if(h){m[n]=h;j++}}}f.setAttrib(l,"style","");if(b&&j>0){f.setStyles(l,m)}else{if(l.nodeName=="SPAN"&&!l.className){f.remove(l,true)}}})}if(c.getParam("paste_remove_styles")||(c.getParam("paste_remove_styles_if_webkit")&&tinymce.isWebKit)){a(f.select("*[style]",g.node),function(h){h.removeAttribute("style");h.removeAttribute("mce_style")})}else{if(tinymce.isWebKit){a(f.select("*",g.node),function(h){h.removeAttribute("mce_style")})}}},_convertLists:function(e,c){var g=e.editor.dom,f,j,b=-1,d,k=[],i,h;a(g.select("p",c.node),function(r){var n,s="",q,o,l,m;for(n=r.firstChild;n&&n.nodeType==3;n=n.nextSibling){s+=n.nodeValue}s=r.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(s)){q="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(s)){q="ol"}if(q){d=parseFloat(r.style.marginLeft||0);if(d>b){k.push(d)}if(!f||q!=i){f=g.create(q);g.insertAfter(f,r)}else{if(d>b){f=j.appendChild(g.create(q))}else{if(d<b){l=tinymce.inArray(k,d);m=g.getParents(f.parentNode,q);f=m[m.length-1-l]||f}}}a(g.select("span",r),function(t){var p=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(q=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){g.remove(t)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){g.remove(t)}}});o=r.innerHTML;if(q=="ul"){o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}j=f.appendChild(g.create("li",0,o));g.remove(r);b=d;i=q}else{f=b=0}});h=c.node.innerHTML;if(h.indexOf("__MCE_ITEM__")!=-1){c.node.innerHTML=h.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(h,e,i){var c,g,d=h.selection,m,j,b,k,f;function l(p){var o;if(tinymce.isIE){o=h.getDoc().body.createTextRange();o.moveToElementText(p);o.collapse(false);o.select()}else{d.select(p,1);d.collapse(false)}}this._insert('<span id="_marker">&nbsp;</span>',1);g=e.get("_marker");c=e.getParent(g,"p,h1,h2,h3,h4,h5,h6,ul,ol,th,td");if(c&&!/TD|TH/.test(c.nodeName)){g=e.split(c,g);a(e.create("div",0,i).childNodes,function(o){m=g.parentNode.insertBefore(o.cloneNode(true),g)});l(m)}else{e.setOuterHTML(g,i);d.select(h.getBody(),1);d.collapse(0)}e.remove("_marker");j=d.getStart();b=e.getViewPort(h.getWin());k=h.dom.getPos(j).y;f=j.clientHeight;if(k<b.y||k+f>b.y+b.h){h.getDoc().body.scrollTop=k<b.y?k:k-b.h+25}},_insert:function(d,b){var c=this.editor;if(!c.selection.isCollapsed()){c.getDoc().execCommand("Delete",false,null)}c.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,d,{skip_undo:b})},_legacySupport:function(){var c=this,b=c.editor;a(["mcePasteText","mcePasteWord"],function(d){b.addCommand(d,function(){b.windowManager.open({file:c.url+(d=="mcePasteText"?"/pastetext.htm":"/pasteword.htm"),width:parseInt(b.getParam("paste_dialog_width","450")),height:parseInt(b.getParam("paste_dialog_height","400")),inline:1})})});b.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});b.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"});b.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js	2009-06-30 22:01:32.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 1134 2009-05-21 12:48:25Z spocke $
+ * $Id: editor_plugin_src.js 1199 2009-08-18 11:55:59Z spocke $
  *
  * @author Moxiecode
  * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -34,8 +34,8 @@
 			});
 
 			// This function executes the process handlers and inserts the contents
-			function process(h) {
-				var dom = ed.dom, o = {content : h};
+			function process(o) {
+				var dom = ed.dom;
 
 				// Execute pre process handlers
 				t.onPreProcess.dispatch(t, o);
@@ -57,8 +57,8 @@
 			};
 
 			// Add command for external usage
-			ed.addCommand('mceInsertClipboardContent', function(u, v) {
-				process(v);
+			ed.addCommand('mceInsertClipboardContent', function(u, o) {
+				process(o);
 			});
 
 			// This function grabs the contents from the clipboard by adding a
@@ -98,9 +98,15 @@
 					// Remove container
 					dom.remove(n);
 
+					// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
+					// to IE security settings so we pass the junk though better than nothing right
+					if (n.innerHTML === '&nbsp;')
+						return;
+
 					// Process contents
-					process(n.innerHTML);
+					process({content : n.innerHTML});
 
+					// Block the real paste event
 					return tinymce.dom.Event.cancel(e);
 				} else {
 					or = ed.selection.getRng();
@@ -114,26 +120,19 @@
 
 					// Wait a while and grab the pasted contents
 					window.setTimeout(function() {
-						var n = dom.get('_mcePaste'), h;
-
-						// Webkit clones the _mcePaste div for some odd reason so this will ensure that we get the real new div not the old empty one
-						n.id = '_mceRemoved';
-						dom.remove(n);
-						n = dom.get('_mcePaste') || n;
-
-						// Grab the HTML contents
-						// We need to look for a apple style wrapper on webkit it also adds a div wrapper if you copy/paste the body of the editor
-						// It's amazing how strange the contentEditable mode works in WebKit
-						h = (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML;
+						var h = '';
 
-						// Remove hidden div and restore selection
-						dom.remove(n);
+						// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
+						each(dom.select('div[id=_mcePaste]').reverse(), function(n) {
+							h += (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML;
+							dom.remove(n);
+						});
 
 						// Restore the old selection
 						if (or)
 							sel.setRng(or);
 
-						process(h);
+						process({content : h});
 					}, 0);
 				}
 			};
@@ -195,17 +194,17 @@
 				});
 			};
 
-			// Process away some basic content
-			process([
-				/^\s*(&nbsp;)+/g,											// nbsp entities at the start of contents
-				/(&nbsp;|<br[^>]*>)+\s*$/g									// nbsp entities at the end of contents
-			]);
-
 			// Detect Word content and process it more aggressive
-			if (/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(h)) {
+			if (/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(h) || o.wordContent) {
 				o.wordContent = true; // Mark the pasted contents as word specific content
 				//console.log('Word contents detected.');
 
+				// Process away some basic content
+				process([
+					/^\s*(&nbsp;)+/g,											// nbsp entities at the start of contents
+					/(&nbsp;|<br[^>]*>)+\s*$/g									// nbsp entities at the end of contents
+				]);
+
 				if (ed.getParam('paste_convert_middot_lists', true)) {
 					process([
 						[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'],			// Convert supportLists to a list item marker
@@ -436,9 +435,10 @@
 			// Insert a marker for the caret position
 			this._insert('<span id="_marker">&nbsp;</span>', 1);
 			marker = dom.get('_marker');
-			parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol');
+			parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td');
 
-			if (parentBlock) {
+			// If it's a parent block but not a table cell
+			if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) {
 				// Split parent block
 				marker = dom.split(parentBlock, marker);
 
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/js/pastetext.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/js/pastetext.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/js/pastetext.js	2009-06-30 22:05:14.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/js/pastetext.js	2009-11-04 18:51:20.000000000 +0100
@@ -19,7 +19,7 @@
 			}
 		}
 
-		tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, h);
+		tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
 		tinyMCEPopup.close();
 	},
 
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/js/pasteword.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/js/pasteword.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/js/pasteword.js	2009-06-30 22:05:14.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/js/pasteword.js	2009-11-04 18:51:20.000000000 +0100
@@ -13,7 +13,7 @@
 		css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
 		css = css.concat(tinymce.explode(ed.settings.content_css) || []);
 		tinymce.each(css, function(u) {
-			cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />';
+			cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
 		});
 
 		// Write content into iframe
@@ -32,7 +32,7 @@
 	insert : function() {
 		var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
 
-		tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, h);
+		tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
 		tinyMCEPopup.close();
 	},
 
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/langs/en.js	2009-06-23 13:11:28.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,10 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-paste_text_desc : 'Paste as Plain Text',
-paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
-paste_text_linebreaks : 'Keep linebreaks',
-paste_word_desc : 'Paste from Word',
-paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
-selectall_desc : 'Select All'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/langs/en.js	2009-06-23 13:11:12.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-preview_desc : 'Preview'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/langs/en.js	2009-06-23 13:11:18.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-print_desc : 'Print'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/langs/en.js	2009-06-23 13:11:06.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-save_desc : 'Save',
-cancel_desc : 'Cancel all changes'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/en.js	2009-06-23 13:11:24.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,21 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('',{
-searchreplace_search_desc : 'Find',
-searchreplace_searchnext_desc : 'Find again',
-searchreplace_replace_desc : 'Find/Replace',
-searchreplace_notfound : 'The search has been completed. The search string could not be found.',
-searchreplace_search_title : 'Find',
-searchreplace_replace_title : 'Find/Replace',
-searchreplace_allreplaced : 'All occurrences of the search string were replaced.',
-searchreplace_findwhat : 'Find what',
-searchreplace_replacewith : 'Replace with',
-searchreplace_direction : 'Direction',
-searchreplace_up : 'Up',
-searchreplace_down : 'Down',
-searchreplace_case : 'Match case',
-searchreplace_findnext : 'Find&nbsp;next',
-searchreplace_replace : 'Replace',
-searchreplace_replaceall : 'Replace&nbsp;all',
-searchreplace_cancel : 'Cancel'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/langs/en.js	2009-06-23 13:11:22.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,66 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('style',{
-title : 'Edit CSS Style',
-styleinfo_desc : 'Edit CSS Style',
-apply : 'Apply',
-text_tab : 'Text',
-background_tab : 'Background',
-block_tab : 'Block',
-box_tab : 'Box',
-border_tab : 'Border',
-list_tab : 'List',
-positioning_tab : 'Positioning',
-text_props : 'Text',
-text_font : 'Font',
-text_size : 'Size',
-text_weight : 'Weight',
-text_style : 'Style',
-text_variant : 'Variant',
-text_lineheight : 'Line height',
-text_case : 'Case',
-text_color : 'Color',
-text_decoration : 'Decoration',
-text_overline : 'overline',
-text_underline : 'underline',
-text_striketrough : 'strikethrough',
-text_blink : 'blink',
-text_none : 'none',
-background_color : 'Background color',
-background_image : 'Background image',
-background_repeat : 'Repeat',
-background_attachment : 'Attachment',
-background_hpos : 'Horizontal position',
-background_vpos : 'Vertical position',
-block_wordspacing : 'Word spacing',
-block_letterspacing : 'Letter spacing',
-block_vertical_alignment : 'Vertical alignment',
-block_text_align : 'Text align',
-block_text_indent : 'Text indent',
-block_whitespace : 'Whitespace',
-block_display : 'Display',
-box_width : 'Width',
-box_height : 'Height',
-box_float : 'Float',
-box_clear : 'Clear',
-padding : 'Padding',
-same : 'Same for all',
-top : 'Top',
-right : 'Right',
-bottom : 'Bottom',
-left : 'Left',
-margin : 'Margin',
-style : 'Style',
-width : 'Width',
-height : 'Height',
-color : 'Color',
-list_type : 'Type',
-bullet_image : 'Bullet image',
-position : 'Position',
-positioning_type : 'Type',
-visibility : 'Visibility',
-zindex : 'Z-index',
-overflow : 'Overflow',
-placement : 'Placement',
-clip : 'Clip'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js	2009-06-30 22:01:34.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js	2009-11-04 18:51:20.000000000 +0100
@@ -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 hay ningún carácter de nueva línea al final del fichero
+(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(!tinymce.isIE&&b.getParam("forced_root_block")){function e(){var f=b.getBody().lastChild;if(f&&f.nodeName=="TABLE"){b.dom.add(b.getBody(),"p",null,'<br mce_bogus="1" />')}}b.onKeyUp.add(e);b.onSetContent.add(e);b.onVisualAid.add(e);b.onPreProcess.add(function(f,h){var g=h.node.lastChild;if(g&&g.childNodes.length==1&&g.firstChild.nodeName=="BR"){f.dom.remove(g)}});e()}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 hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin_src.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin_src.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin_src.js	2009-06-30 22:01:34.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin_src.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 953 2008-11-04 10:16:50Z spocke $
+ * $Id: editor_plugin_src.js 1206 2009-08-19 12:30:52Z spocke $
  *
  * @author Moxiecode
  * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -55,6 +55,30 @@
 			}
 
 			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" />');
+					};
+
+					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 -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/js/table.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/js/table.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/js/table.js	2009-06-30 22:05:14.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/js/table.js	2009-11-04 18:51:20.000000000 +0100
@@ -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['frame'].options[formObj.elements['frame'].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;
@@ -322,7 +322,7 @@
 
 	// Update form
 	selectByValue(formObj, 'align', align);
-	selectByValue(formObj, 'frame', frame);
+	selectByValue(formObj, 'tframe', frame);
 	selectByValue(formObj, 'rules', rules);
 	selectByValue(formObj, 'class', className, true, true);
 	formObj.cols.value = cols;
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/langs/en.js	2009-06-23 13:11:16.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,79 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('table',{
-general_tab : 'General',
-advanced_tab : 'Advanced',
-general_props : 'General properties',
-advanced_props : 'Advanced properties',
-desc : 'Inserts a new table',
-row_before_desc : 'Insert row before',
-row_after_desc : 'Insert row after',
-delete_row_desc : 'Delete row',
-col_before_desc : 'Insert column before',
-col_after_desc : 'Insert column after',
-delete_col_desc : 'Remove column',
-rowtype : 'Row in table part',
-title : 'Insert/Modify table',
-width : 'Width',
-height : 'Height',
-cols : 'Columns',
-rows : 'Rows',
-cellspacing : 'Cellspacing',
-cellpadding : 'Cellpadding',
-border : 'Border',
-align : 'Alignment',
-align_default : 'Default',
-align_left : 'Left',
-align_right : 'Right',
-align_middle : 'Center',
-row_title : 'Table row properties',
-cell_title : 'Table cell properties',
-cell_type : 'Cell type',
-row_desc : 'Table row properties',
-cell_desc : 'Table cell properties',
-valign : 'Vertical alignment',
-align_top : 'Top',
-align_bottom : 'Bottom',
-props_desc : 'Table properties',
-bordercolor : 'Border color',
-bgcolor : 'Background color',
-merge_cells_title : 'Merge table cells',
-split_cells_desc : 'Split merged table cells',
-merge_cells_desc : 'Merge table cells',
-cut_row_desc : 'Cut table row',
-copy_row_desc : 'Copy table row',
-paste_row_before_desc : 'Paste table row before',
-paste_row_after_desc : 'Paste table row after',
-id : 'Id',
-style: 'Style',
-langdir : 'Language direction',
-langcode : 'Language code',
-mime : 'Target MIME type',
-ltr : 'Left to right',
-rtl : 'Right to left',
-bgimage : 'Background image',
-summary : 'Summary',
-td : "Data",
-th : "Header",
-cell_cell : 'Update current cell',
-cell_row : 'Update all cells in row',
-cell_all : 'Update all cells in table',
-row_row : 'Update current row',
-row_odd : 'Update odd rows in table',
-row_even : 'Update even rows in table',
-row_all : 'Update all rows in table',
-thead : 'Table Head',
-tbody : 'Table Body',
-tfoot : 'Table Foot',
-del : 'Delete table',
-scope : 'Scope',
-row : 'Row',
-col : 'Col',
-rowgroup : 'Row Group',
-colgroup : 'Col Group',
-col_limit : 'You\'ve exceeded the maximum number of columns of {$cols}.',
-row_limit : 'You\'ve exceeded the maximum number of rows of {$rows}.',
-cell_limit : 'You\'ve exceeded the maximum number of cells of {$cells}.',
-missing_scope: 'Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.',
-caption : 'Table caption'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/table.htm 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/table.htm
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/table.htm	2009-06-30 22:01:34.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/table.htm	2009-11-04 18:51:20.000000000 +0100
@@ -108,9 +108,9 @@
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="frame">{#table_dlg.frame}</label></td> 
+							<td class="column1"><label for="tframe">{#table_dlg.frame}</label></td> 
 							<td>
-								<select id="frame" name="frame" class="advfield"> 
+								<select id="tframe" name="tframe" class="advfield"> 
 										<option value="">{#not_set}</option>
 										<option value="void">{#table_dlg.rules_void}</option>
 										<option value="above">{#table_dlg.rules_above}</option> 
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/langs/en.js	2009-06-23 13:11:26.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,16 +1,2 @@
 // UK lang variables
-
-tinyMCE.addToLang('template',{
-title : 'Templates',
-label : 'Template',
-desc_label : 'Description',
-desc : 'Insert predefined template content',
-select : 'Select a template',
-preview : 'Preview',
-warning : 'Warning: Updating a template with a different one may cause data loss.',
-def_date_format : '%Y-%m-%d %H:%M:%S',
-months_long : new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"),
-months_short : new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"),
-day_long : new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"),
-day_short : new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
-});
+//Older tiny2 lang file. Can be deleted
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/langs/en.js	2009-06-23 13:11:08.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,8 +1 @@
-// UK lang variables
-
-/* Remember to namespace the language parameters lang_<your plugin>_<some name> */
-
-tinyMCE.addToLang('',{
-template_title : 'This is just a template popup',
-template_desc : 'This is just a template button'
-});
+// UK lang variables/* Remember to namespace the language parameters lang_<your plugin>_<some name> *//r//Older tiny2 lang file. Can be deleted
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/langs/en.js	2009-06-23 13:11:12.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1 @@
 // EN lang variables
-
-tinyMCE.addToLang('visualchars',{
-desc : 'Visual control characters on/off.'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/en.js 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/en.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/en.js	2009-06-23 13:11:30.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/en.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,42 +1 @@
 // UK lang variables
-
-tinyMCE.addToLang('xhtmlxtras',{
-cite_desc : 'Citation',
-abbr_desc : 'Abbreviation',
-acronym_desc : 'Acronym',
-del_desc : 'Deletion',
-ins_desc : 'Insertion',
-attribute_label_title : 'Title',
-attribute_label_id : 'ID',
-attribute_label_class : 'Class',
-attribute_label_style : 'Style',
-attribute_label_cite : 'Cite',
-attribute_label_datetime : 'Date/Time',
-attribute_label_langdir : 'Text Direction',
-attribute_option_ltr : 'Left to right',
-attribute_option_rtl : 'Right to left',
-attribute_label_langcode : 'Language',
-attribute_label_tabindex : 'TabIndex',
-attribute_label_accesskey : 'AccessKey',
-attribute_label_cite : 'Cite',
-attribute_events_tab : 'Events',
-attribute_attrib_tab : 'Attributes',
-general_tab : 'General',
-attrib_tab : 'Attributes',
-events_tab : 'Events',
-fieldset_general_tab : 'General Settings',
-fieldset_attrib_tab : 'Element Attributes',
-fieldset_events_tab : 'Element Events',
-title_ins_element : 'Insertion Element',
-title_del_element : 'Deletion Element',
-title_acronym_element : 'Acronym Element',
-title_abbr_element : 'Abbreviation Element',
-title_cite_element : 'Citation Element',
-remove : 'Remove',
-not_set : '--not set--',
-insert_date : 'Insert current date/time',
-option_ltr : 'Left to right',
-option_rtl : 'Right to left',
-attribs_desc : 'Insert/Edit Attributes',
-attribs_title : 'Insert/Edit Attributes'
-});
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/color_picker.htm 15/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/color_picker.htm
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/color_picker.htm	2009-06-30 22:01:34.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/color_picker.htm	2009-11-04 18:51:20.000000000 +0100
@@ -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 -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/js/link.js 15/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/js/link.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/js/link.js	2009-06-30 22:05:16.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/js/link.js	2009-11-04 18:51:20.000000000 +0100
@@ -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 -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js 15/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js	2009-06-30 22:01:34.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js	2009-11-04 18:51:20.000000000 +0100
@@ -1 +1 @@
-var tinymce={majorVersion:"3",minorVersion:"2.4.1",releaseDate:"2009-05-25",_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(|_dev|_src|_gzip|_jquery|_prototype).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;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(e.indexOf(":/")===-1&&e.indexOf("//")!==0){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}},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},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,[])},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|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(/<!\[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(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)},_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}if(!n.preventDefault){n.preventDefault=function(){n.returnValue=false}}if(!n.stopPropagation){n.stopPropagation=function(){n.cancelBubble=true}}}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)})}});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=="simple"){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_)/,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){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(l,k){var j,i=this;i._setup();k=k||{};k.format=k.format||"html";i.processObj=k;l=l.cloneNode(true);i.key=""+(parseInt(i.key)+1);if(!k.no_events){k.node=l;i.onPreProcess.dispatch(i,k)}i.writer.reset();i._serializeNode(l,k.getInner);k.content=i.writer.getContent();if(!k.no_events){i.onPostProcess.dispatch(i,k)}i._postProcess(k);k.node=null;return e.trim(k.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:/(<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>")}}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")}})})(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);if(document.domain&&j.hostname!=document.domain){f.relaxedDomain=document.domain}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){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}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"><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.auto_resize){z.onNodeChange.add(z.resizeToContent,z)}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},resizeToContent:function(){var q=this;o.setStyle(q.id+"_ifr","height",q.getBody().scrollHeight)},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("simple")});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 hay ningún carácter de nueva línea al final del fichero
+var tinymce={majorVersion:"3",minorVersion:"2.6",releaseDate:"2009-08-19",_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?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.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(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/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,l,k){if(!l){l=' type="text/javascript"'}l=l.replace(/src=\"([^\"]+)\"?/i,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>/gi,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(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|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)},_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.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).reverse(),function(o){var m=i.dom.getParent(o.parentNode,"table,p");if(m.nodeName!="TABLE"){if(d){i.dom.setOuterHTML(o,o.outerHTML)}i.dom.split(m,o)}})})}},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(k.importNode(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]]>");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);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[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()}})}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);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(!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.queryCommandSupported(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 hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_popup.js 15/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_popup.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_popup.js	2009-06-30 22:01:34.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_popup.js	2009-11-04 18:51:20.000000000 +0100
@@ -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("simple")},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 hay ningún carácter de nueva línea al final del fichero
+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 hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_src.js 15/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_src.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_src.js	2009-06-30 22:01:34.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_src.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,18 +1,23 @@
 var tinymce = {
 	majorVersion : '3',
-	minorVersion : '2.4.1',
-	releaseDate : '2009-05-25',
+	minorVersion : '2.6',
+	releaseDate : '2009-08-19',
 
 	_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
@@ -39,7 +44,7 @@
 		}
 
 		function getBase(n) {
-			if (n.src && /tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(n.src)) {
+			if (n.src && /tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(n.src)) {
 				if (/_(src|dev)\.js/g.test(n.src))
 					t.suffix = '_src';
 
@@ -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 = [];
 
@@ -167,11 +174,11 @@
 		return o;
 	},
 
+
 	trim : function(s) {
 		return (s ? '' + s : '').replace(/^\s*|\s*$/g, '');
 	},
 
-
 	create : function(s, p) {
 		var t = this, sp, ns, cn, scn, c, de = 0;
 
@@ -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)
@@ -483,11 +490,14 @@
 		URI : function(u, s) {
 			var t = this, o, a, b;
 
+			// Trim whitespace
+			u = tinymce.trim(u);
+
 			// Default settings
 			s = t.settings = s || {};
 
 			// Strange app protocol or local anchor
-			if (/^(mailto|tel|news|javascript|about):/i.test(u) || /^\s*#/.test(u)) {
+			if (/^(mailto|tel|news|javascript|about|data):/i.test(u) || /^\s*#/.test(u)) {
 				t.source = u;
 				return;
 			}
@@ -496,8 +506,8 @@
 			if (u.indexOf('/') === 0 && u.indexOf('//') !== 0)
 				u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u;
 
-			// Relative path
-			if (u.indexOf(':/') === -1 && u.indexOf('//') !== 0)
+			// Relative path http:// or protocol relative //path
+			if (!/^\w*:?\/\//.test(u))
 				u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u);
 
 			// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
@@ -701,8 +711,7 @@
 
 			return t.source;
 		}
-
-		});
+	});
 })();
 (function() {
 	var each = tinymce.each;
@@ -772,8 +781,7 @@
 
 			this.set(n, '', d, p, d);
 		}
-
-		});
+	});
 })();
 tinymce.create('static tinymce.util.JSON', {
 	serialize : function(o) {
@@ -860,6 +868,8 @@
 			if (o.content_type)
 				x.setRequestHeader('Content-Type', o.content_type);
 
+			x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+
 			x.send(o.data);
 
 			function ready() {
@@ -881,8 +891,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;
@@ -935,8 +944,7 @@
 				return new tinymce.util.JSONRequest().send(o);
 			}
 		}
-
-		});
+	});
 }());(function(tinymce) {
 	// Shorten names
 	var each = tinymce.each, is = tinymce.is;
@@ -1049,10 +1057,6 @@
 			};
 		},
 
-		is : function(n, patt) {
-			return tinymce.dom.Sizzle.matches(patt, n.nodeType ? [n] : n).length > 0;
-		},
-
 		getParent : function(n, f, r) {
 			return this.getParents(n, f, r, false);
 		},
@@ -1111,6 +1115,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;
@@ -1118,6 +1130,10 @@
 			return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);
 		},
 
+		is : function(n, patt) {
+			return tinymce.dom.Sizzle.matches(patt, n.nodeType ? [n] : n).length > 0;
+		},
+
 
 		add : function(p, n, a, h, c) {
 			var t = this;
@@ -1194,7 +1210,6 @@
 			});
 		},
 
-
 		setStyle : function(n, na, v) {
 			var t = this;
 
@@ -1364,7 +1379,6 @@
 			});
 		},
 
-
 		getAttrib : function(e, n, dv) {
 			var v, t = this;
 
@@ -1662,7 +1676,6 @@
 			});
 		},
 
-
 		addClass : function(e, c) {
 			return this.run(e, function(e) {
 				var o;
@@ -1721,7 +1734,6 @@
 			return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';
 		},
 
-
 		uniqueId : function(p) {
 			return (!p ? 'mce_' : p) + (this.counter++);
 		},
@@ -1862,7 +1874,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|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');
@@ -1874,14 +1886,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'));
 
@@ -1895,13 +1906,19 @@
 						return '<mce:script' + attribs + '>' + text + '</mce:script>';
 					});
 
-					h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g, function(v, attribs, text) {
+					// Wrap style elements
+					h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi, function(v, attribs, text) {
 						// Wrap text contents
 						if (text)
 							text = '<!--\n' + trim(text) + '\n-->';
 
 						return '<mce:style' + attribs + '>' + text + '</mce:style><style ' + attribs + ' mce_bogus="1">' + text + '</style>';
 					});
+
+					// Wrap noscript elements
+					h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) {
+						return '<mce:noscript' + attribs + '><!--' + t.encode(text).replace(/--/g, '&#45;&#45;') + '--></mce:noscript>';
+					});
 				}
 
 				h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->');
@@ -1969,25 +1986,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);
+
+				// Only set HTML on elements
+				if (e.nodeType == 1) {
+					d = d || e.ownerDocument || t.doc;
 
-					t.remove(e);
+					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);
 				}
 			});
 		},
@@ -2035,7 +2068,6 @@
 			}) : s;
 		},
 
-
 		insertAfter : function(n, r) {
 			var t = this;
 
@@ -2056,7 +2088,6 @@
 			});
 		},
 
-
 		isBlock : function(n) {
 			if (n.nodeType && n.nodeType !== 1)
 				return false;
@@ -2066,7 +2097,6 @@
 			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);
 		},
 
-
 		replace : function(n, o, k) {
 			var t = this;
 
@@ -2092,7 +2122,6 @@
 			});
 		},
 
-
 		findCommonAncestor : function(a, b) {
 			var ps = a, pe;
 
@@ -2292,24 +2321,7 @@
 				return n.replace(/[ \t\r\n]+|&nbsp;|&#160;/g, '') == '';
 			};
 
-			// WebKit has a bug where the setStartBefore/setStartAfter/setEndBefore/setEndAfter methods produces an exception on DOM detached nodes
-			// So we then need to use the setStart/setEnd method with and that needs to have the node index.
-			function nodeIndex(n) {
-				var i = 0;
-
-				while (n.previousSibling) {
-					i++;
-					n = n.previousSibling;
-				}
-
-				return i;
-			};
-
 			if (pe && e) {
-/*
-				// WebKit might fix the bug: https://bugs.webkit.org/show_bug.cgi?id=25571
-				// So then this code can be reintroduced
-
 				// Get before chunk
 				r.setStartBefore(pe);
 				r.setEndBefore(e);
@@ -2320,18 +2332,6 @@
 				r.setStartAfter(e);
 				r.setEndAfter(pe);
 				aft = r.extractContents();
-*/
-
-				// Get before chunk
-				r.setStart(pe.parentNode, nodeIndex(pe));
-				r.setEnd(e.parentNode, nodeIndex(e));
-				bef = r.extractContents();
-
-				// Get after chunk
-				r = t.createRng();
-				r.setStart(e.parentNode, nodeIndex(e) + 1);
-				r.setEnd(pe.parentNode, nodeIndex(pe) + 1);
-				aft = r.extractContents();
 
 				// Insert chunks and remove parent
 				pa = pe.parentNode;
@@ -2378,6 +2378,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);
@@ -2412,10 +2433,8 @@
 			return s;
 		}
 		*/
+	});
 
-		});
-
-	// Setup page DOM
 	tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});
 })(tinymce);
 (function(ns) {
@@ -4363,7 +4382,6 @@
 			this.events = [];
 		},
 
-
 		add : function(o, n, f, s) {
 			var cb, t = this, el = t.events, r;
 
@@ -4407,17 +4425,8 @@
 					if (!e.target)
 						e.target = e.srcElement;
 
-					if (!e.preventDefault) {
-						e.preventDefault = function() {
-							e.returnValue = false;
-						};
-					}
-
-					if (!e.stopPropagation) {
-						e.stopPropagation = function() {
-							e.cancelBubble = true;
-						};
-					}
+					// Patch in preventDefault, stopPropagation methods for W3C compatibility
+					tinymce.extend(e, t._stoppers);
 				}
 
 				if (!s)
@@ -4501,7 +4510,6 @@
 			}
 		},
 
-
 		cancel : function(e) {
 			if (!e)
 				return false;
@@ -4625,11 +4633,19 @@
 			t._add(win, 'load', function() {
 				t._pageInit(win);
 			});
-		}
+		},
 
-		});
+		_stoppers : {
+			preventDefault :  function() {
+				this.returnValue = false;
+			},
+
+			stopPropagation : function() {
+				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
@@ -4763,8 +4779,7 @@
 				dom.setStyle(b, 'zIndex', parseInt(t.getStyle('zIndex', 1) || 0) - 1);
 			}
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	function trimNl(s) {
@@ -4942,7 +4957,7 @@
 			sy = vp.y;
 
 			// Simple bookmark fast but not as persistent
-			if (si == 'simple')
+			if (si)
 				return {rng : r, scrollX : sx, scrollY : sy};
 
 			// Handle IE
@@ -5402,8 +5417,7 @@
 			if (!s)
 				tinymce.removeUnload(t.destroy);
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	tinymce.create('tinymce.dom.XMLWriter', {
@@ -5494,8 +5508,7 @@
 
 			return h;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	tinymce.create('tinymce.dom.StringWriter', {
@@ -5621,8 +5634,7 @@
 
 			return true;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	// Shorten names
@@ -5653,7 +5665,7 @@
 				valid_nodes : 0,
 				node_filter : 0,
 				attr_filter : 0,
-				invalid_attrs : /^(mce_|_moz_)/,
+				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',
@@ -5741,8 +5753,17 @@
 
 			if (s.fix_table_elements) {
 				t.onPreProcess.add(function(se, o) {
-					each(t.dom.select('p table', o.node), function(n) {
-						t.dom.split(t.dom.getParent(n, 'p'), n);
+					each(t.dom.select('p table', o.node).reverse(), function(n) {
+						var parent = t.dom.getParent(n.parentNode, 'table,p');
+
+						if (parent.nodeName != 'TABLE') {
+							// 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)
+								t.dom.setOuterHTML(n, n.outerHTML);
+
+							t.dom.split(parent, n);
+						}
 					});
 				});
 			}
@@ -6059,13 +6080,20 @@
 		},
 
 		serialize : function(n, o) {
-			var h, t = this;
+			var h, t = this, doc;
 
 			t._setup();
 			o = o || {};
 			o.format = o.format || 'html';
-			t.processObj = o;
 			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(doc.importNode(n));
+			}
+
 			t.key = '' + (parseInt(t.key) + 1);
 
 			// Pre process
@@ -6101,6 +6129,7 @@
 					content : h,
 					patterns : [
 						{pattern : /(<script[^>]*>)(.*?)(<\/script>)/g},
+						{pattern : /(<noscript[^>]*>)(.*?)(<\/noscript>)/g},
 						{pattern : /(<style[^>]*>)(.*?)(<\/style>)/g},
 						{pattern : /(<pre[^>]*>)(.*?)(<\/pre>)/g, encode : 1},
 						{pattern : /(<!--\[CDATA\[)(.*?)(\]\]-->)/g}
@@ -6150,12 +6179,14 @@
 				// 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>');
+
+				// Restore noscript elements
+				h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) {
+					return '<noscript' + attribs + '>' + t.dom.decode(text.replace(/<!--|-->/g, '')) + '</noscript>';
+				});
 			}
 
 			o.content = h;
@@ -6503,8 +6534,7 @@
 
 			return v;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var each = tinymce.each, Event = tinymce.dom.Event;
@@ -6776,8 +6806,7 @@
 				}
 			}
 		}
-
-		});
+	});
 
 	// Global script loader
 	tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
@@ -6881,12 +6910,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 = {};
 	},
 
@@ -6900,8 +6930,7 @@
 	get : function(n) {
 		return this.lookup[n];
 	}
-
-	});
+});
 
 tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
 	Separator : function(id, s) {
@@ -6912,8 +6941,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;
 
@@ -6941,8 +6969,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;
@@ -7040,8 +7067,7 @@
 
 			return m;
 		}
-
-		});
+	});
 })(tinymce);(function(tinymce) {
 	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element;
 
@@ -7368,8 +7394,7 @@
 
 			DOM.addClass(ro, 'mceLast');
 		}
-
-		});
+	});
 })(tinymce);(function(tinymce) {
 	var DOM = tinymce.DOM;
 
@@ -7401,8 +7426,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;
@@ -7412,11 +7436,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';
 		},
 
@@ -7652,9 +7682,9 @@
 			this.parent();
 
 			Event.clear(this.id + '_text');
+			Event.clear(this.id + '_open');
 		}
-
-		});
+	});
 })(tinymce);(function(tinymce) {
 	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
 
@@ -7782,15 +7812,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;
 		},
 
@@ -7869,8 +7900,7 @@
 				}
 			});
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
@@ -7935,8 +7965,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;
@@ -7954,6 +7983,7 @@
 			}, t.settings);
 
 			t.onShowMenu = new tinymce.util.Dispatcher(t);
+
 			t.onHideMenu = new tinymce.util.Dispatcher(t);
 
 			t.value = s.default_color;
@@ -8101,8 +8131,7 @@
 			Event.clear(this.id + '_more');
 			DOM.remove(this.id + '_menu');
 		}
-
-		});
+	});
 })(tinymce);
 tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 	renderHTML : function() {
@@ -8165,8 +8194,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;
 
@@ -8174,6 +8202,7 @@
 		items : [],
 		urls : {},
 		lookup : {},
+
 		onAdd : new Dispatcher(this),
 
 		get : function(n) {
@@ -8213,19 +8242,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() {
@@ -8239,10 +8271,6 @@
 			tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
 			tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL);
 
-			// User specified a document.domain value
-			if (document.domain && lo.hostname != document.domain)
-				tinymce.relaxedDomain = document.domain;
-
 			// Add before unload listener
 			// This was required since IE was leaking memory if you added and removed beforeunload listeners
 			// with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event
@@ -8294,10 +8322,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]) {
@@ -8466,6 +8490,8 @@
 
 			// Select another editor since the active one was removed
 			if (t.activeEditor == e) {
+				t._setActive(null);
+
 				each(t.editors, function(e) {
 					t._setActive(e);
 					return false; // Break
@@ -8590,13 +8616,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;
@@ -8609,53 +8633,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',
@@ -8702,10 +8763,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
@@ -8823,12 +8884,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() {
@@ -8836,7 +8892,6 @@
 
 			EditorManager.add(t);
 
-			// Create theme
 			if (s.theme) {
 				s.theme = s.theme.replace(/-/, '');
 				o = ThemeManager.get(s.theme);
@@ -8871,8 +8926,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
@@ -8943,6 +8998,10 @@
 			}
 
 
+			// User specified a document.domain value
+			if (document.domain && location.hostname != document.domain)
+				tinymce.relaxedDomain = document.domain;
+
 			// Resize editor
 			DOM.setStyles(o.sizeContainer || o.editorContainer, {
 				width : w,
@@ -8953,7 +9012,13 @@
 			if (h < 100)
 				h = 100;
 
-			t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + t.documentBaseURI.getURI() + '" />';
+			t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml">';
+
+			// We only need to override paths if we have to
+			// IE has a bug where it remove site absolute urls to relative ones if this is specified
+			if (s.document_base_url != tinymce.documentBaseURL)
+				t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
+
 			t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
 
 			if (tinymce.relaxedDomain)
@@ -9036,7 +9101,6 @@
 				DOM.show(b);
 			}
 
-			// Setup objects
 			t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), {
 				keep_values : true,
 				url_converter : t.convertURL,
@@ -9047,26 +9111,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
 			});
@@ -9098,9 +9149,6 @@
 			if (s.nowrap)
 				t.getBody().style.whiteSpace = "nowrap";
 
-			if (s.auto_resize)
-				t.onNodeChange.add(t.resizeToContent, t);
-
 			if (s.custom_elements) {
 				function handleCustom(ed, o) {
 					each(explode(s.custom_elements), function(v) {
@@ -9120,7 +9168,7 @@
 				t.onBeforeSetContent.add(handleCustom);
 				t.onPostProcess.add(function(ed, o) {
 					if (o.set)
-						handleCustom(ed, o)
+						handleCustom(ed, o);
 				});
 			}
 
@@ -9644,12 +9692,6 @@
 			return b;
 		},
 
-		resizeToContent : function() {
-			var t = this;
-
-			DOM.setStyle(t.id + "_ifr", 'height', t.getBody().scrollHeight);
-		},
-
 		load : function(o) {
 			var t = this, e = t.getElement(), h;
 
@@ -10479,8 +10521,7 @@
 
 			return s;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit;
@@ -11534,8 +11575,7 @@
 		hasRedo : function() {
 			return this.index < this.data.length - 1;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	// Shorten names
@@ -11548,6 +11588,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;
 
@@ -11746,7 +11797,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)) {
@@ -11961,7 +12012,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
@@ -12106,7 +12157,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
@@ -12340,7 +12430,7 @@
 				c.onPostRender.add(function(c, n) {
 					// Store bookmark on mousedown
 					Event.add(n, 'mousedown', function() {
-						ed.bookmark = ed.selection.getBookmark('simple');
+						ed.bookmark = ed.selection.getBookmark(1);
 					});
 
 					// Restore on focus, since it might be lost
@@ -12521,7 +12611,7 @@
 		setControlType : function(n, c) {
 			return this._cls[n.toLowerCase()] = c;
 		},
-
+	
 		destroy : function() {
 			each(this.controls, function(c) {
 				c.destroy();
@@ -12529,8 +12619,7 @@
 
 			this.controls = null;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera;
@@ -12641,8 +12730,7 @@
 		_decode : function(s) {
 			return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
 		}
-
-		});
+	});
 }(tinymce));(function(tinymce) {
 	tinymce.CommandManager = function() {
 		var execCommands = {}, queryStateCommands = {}, queryValueCommands = {};
@@ -12995,7 +13083,13 @@
 				if (!doc.queryCommandSupported(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 -aruN --binary 14/plugins/editors/tinymce/jscripts/tiny_mce/utils/form_utils.js 15/plugins/editors/tinymce/jscripts/tiny_mce/utils/form_utils.js
--- 14/plugins/editors/tinymce/jscripts/tiny_mce/utils/form_utils.js	2009-06-30 22:01:34.000000000 +0200
+++ 15/plugins/editors/tinymce/jscripts/tiny_mce/utils/form_utils.js	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1,5 @@
 /**
- * $Id: form_utils.js 996 2009-02-06 17:32:20Z spocke $
+ * $Id: form_utils.js 1184 2009-08-11 11:47:27Z spocke $
  *
  * 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 -aruN --binary 14/plugins/editors/tinymce/templates/index.html 15/plugins/editors/tinymce/templates/index.html
--- 14/plugins/editors/tinymce/templates/index.html	1970-01-01 01:00:00.000000000 +0100
+++ 15/plugins/editors/tinymce/templates/index.html	2009-11-04 18:56:08.000000000 +0100
@@ -0,0 +1,4 @@
+<html>
+<body bgcolor="#FFFFFF">
+</body>
+</html>
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/templates/layout1.html 15/plugins/editors/tinymce/templates/layout1.html
--- 14/plugins/editors/tinymce/templates/layout1.html	1970-01-01 01:00:00.000000000 +0100
+++ 15/plugins/editors/tinymce/templates/layout1.html	2009-11-04 18:56:08.000000000 +0100
@@ -0,0 +1,15 @@
+<h3>[Enter a title here]</h3>
+<table border="1">
+<thead>
+<tr>
+<td>Column 1</td>
+<td>Column 2</td>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>Username: [Enter a user name here]</td>
+<td>Staffid: [Enter a staff id here]</td>
+</tr>
+</tbody>
+</table>
diff -aruN --binary 14/plugins/editors/tinymce/templates/snippet1.html 15/plugins/editors/tinymce/templates/snippet1.html
--- 14/plugins/editors/tinymce/templates/snippet1.html	1970-01-01 01:00:00.000000000 +0100
+++ 15/plugins/editors/tinymce/templates/snippet1.html	2009-11-04 18:56:08.000000000 +0100
@@ -0,0 +1 @@
+Some <strong>text in bold</strong>
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/plugins/editors/tinymce/templates/template_list.js 15/plugins/editors/tinymce/templates/template_list.js
--- 14/plugins/editors/tinymce/templates/template_list.js	1970-01-01 01:00:00.000000000 +0100
+++ 15/plugins/editors/tinymce/templates/template_list.js	2009-11-04 18:56:08.000000000 +0100
@@ -0,0 +1,20 @@
+/**
+ * Tinymce template_list.js sample file
+ * @version tinymce 3.2.6
+ * @package		Joomla
+ * @copyright	Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.
+ * @license		GNU/GPL, see LICENSE.php
+ * Joomla! is free software. This version may have been modified pursuant
+ * to the GNU General Public License, and as distributed it includes or
+ * is derivative of works licensed under the GNU General Public License or
+ * other free or open source software licenses.
+ * See COPYRIGHT.php for copyright notices and details.
+ */
+
+var tinyMCETemplateList = [
+	// Name, URL, Description
+
+	["Simple snippet", "plugins/editors/tinymce/templates/snippet1.html", "Simple HTML snippet."],
+	["Layout", "plugins/editors/tinymce/templates/layout1.html", "HTMLLayout."]
+
+];
diff -aruN --binary 14/plugins/editors/tinymce.php 15/plugins/editors/tinymce.php
--- 14/plugins/editors/tinymce.php	2009-07-30 21:02:22.000000000 +0200
+++ 15/plugins/editors/tinymce.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: tinymce.php 12546 2009-07-23 11:03:33Z erdsiger $
+ * @version		$Id: tinymce.php 13338 2009-10-27 02:15:55Z ian $
  * @package		Joomla
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
  * @license		GNU/GPL, see LICENSE.php
@@ -50,10 +50,9 @@
 	 */
 	function onInit()
 	{
-		$mainframe = &JFactory::getApplication();
-
-		$language	=& JFactory::getLanguage();
-
+		$mainframe =&JFactory::getApplication();
+		$language =& JFactory::getLanguage();
+		JPlugin::loadLanguage('plg_editors_tinymce', JPATH_ADMINISTRATOR);
 		$mode = $this->params->get('mode','advanced');
 		$theme = array('simple' => 'simple','advanced' => 'advanced','extended' => 'advanced');
 		$skin = $this->params->get( 'skin', '0' );
@@ -72,17 +71,17 @@
 			default:
 				$skin = "skin : \"default\",";
 		}
-		$compressed			= $this->params->def( 'compressed', 0 );
+		$compressed			= $this->params->def('compressed', 0);
+		$cleanup_startup	= $this->params->def('cleanup_startup', 0);
+		$cleanup_save		= $this->params->def('cleanup_save', 2);
+		$entity_encoding	= $this->params->def('entity_encoding', 'raw');
 
-		$cleanup_startup	= $this->params->def( 'cleanup_startup', 0 );
-		$cleanup_save		= $this->params->def( 'cleanup_save', 2 );
-		$entity_encoding	= $this->params->def( 'entity_encoding', 'raw' );
-		if ( $cleanup_startup ) {
+		if ($cleanup_startup) {
 			$cleanup_startup = 'true';
 		} else {
 			$cleanup_startup = 'false';
 		}
-		switch ( $cleanup_save ) {
+		switch ($cleanup_save) {
 			case '0': /* Never clean up on save */
 				$cleanup = 'false';
 				break;
@@ -97,10 +96,10 @@
 				break;
 		}
 
-		$langMode			= $this->params->def( 'lang_mode', 0 );
-		$langPrefix			= $this->params->def( 'lang_code', 'en' );
+		$langMode	= $this->params->def('lang_mode', 0);
+		$langPrefix	= $this->params->def('lang_code', 'en');
 		if ($langMode) {
-			$langPrefix = substr( $language->getTag(), 0, strpos( $language->getTag(), '-' ) );
+			$langPrefix = substr($language->getTag(), 0, strpos( $language->getTag(), '-' ));
 		}
 		if ($language->isRTL()) {
 			$text_direction = 'rtl';
@@ -108,74 +107,90 @@
 			$text_direction = 'ltr';
 		}
 
-		$content_css		= $this->params->def( 'content_css', 1 );
-		$content_css_custom	= $this->params->def( 'content_css_custom', '' );
-		// loading of css file for `styles` dropdown
-		if ( $content_css_custom ) {
-			$content_css = 'content_css : "'. $content_css_custom .'", ';
-		}
-		else {
-			/*
-			 * Lets get the default template for the site application
-			 */
-			$db =& JFactory::getDBO();
-			$query = 'SELECT template'
-			. ' FROM #__templates_menu'
-			. ' WHERE client_id = 0'
-			. ' AND menuid = 0'
-			;
-			$db->setQuery( $query );
-			$template = $db->loadResult();
+		$use_content_css	= $this->params->def('content_css', 1);
+		$content_css_custom	= $this->params->def('content_css_custom', '');
 
-			if($content_css)
-			{
-				$file_path = JPATH_SITE .'/templates/'. $template .'/css/';
-			        // Try for site css
-			        $file_name = "template";
+		/*
+		 * Lets get the default template for the site application
+		 */
+		$db =& JFactory::getDBO();
+		$query = 'SELECT template'
+		. ' FROM #__templates_menu'
+		. ' WHERE client_id = 0'
+		. ' AND menuid = 0'
+		;
+		$db->setQuery( $query );
+		$template = $db->loadResult();
+
+		$content_css = '';
+
+		$templates_path = JPATH_SITE.DS.'templates';
+		// loading of css file for 'styles' dropdown
+		if ( $content_css_custom )
+		{
+			// If URL, just pass it to $content_css
+			if (strpos( $content_css_custom, 'http' ) !==false) {
+				$content_css = 'content_css : "'. $content_css_custom .'",';
+			// If it is not a URL, assume it is a file name in the current template folder
+			} else {
+				$content_css = 'content_css : "'. JURI::root() .'templates/'. $template . '/css/'. $content_css_custom .'",';
 
-			        if ($language->isRTL()) {
-					$file_name .= "_rtl.css";
-				} else {
-					$file_name .= ".css";
+				// Issue warning notice if the file is not found (but pass name to $content_css anyway to avoid TinyMCE error
+				if (!file_exists($templates_path.DS.$template.DS.'css'.DS.$content_css_custom)) {
+					$msg = sprintf (JText::_('CUSTOMCSSFILENOTPRESENT'), $content_css_custom);
+					JError::raiseNotice('SOME_ERROR_CODE', $msg);
 				}
+			}
+		}
+		else
+		{
+			// process when use_content_css is Yes and no custom file given
+			if($use_content_css) {
 
-				if ( file_exists( $file_path .DS. $file_name ) ) {
-					$content_css = 'content_css : "' . JURI::root() .'templates/'. $template . '/css/'.$file_name.', ' . JURI::root() .'templates/system/css/editor.css"';
+				// first check templates folder for default template
+				// if no editor.css file in templates folder, check system template folder
+				if (!file_exists($templates_path.DS.$template.DS.'css'.DS.'editor.css')) {
+					$template = 'system';
+
+					// if no editor.css file in system folder, show alert
+					if (!file_exists($templates_path.DS.'system'.DS.'css'.DS.'editor.css'))
+					{
+						JError::raiseNotice('SOME_ERROR_CODE', JText::_('TEMPLATECSSFILENOTPRESENT'));
+					} else {
+						$content_css = 'content_css : "' . JURI::root() .'templates/system/css/editor.css",';
+					}
 				} else {
-					$content_css = 'content_css : "' . JURI::root() .'templates/system/css/editor.css"';
+					$content_css = 'content_css : "' . JURI::root() .'templates/'. $template . '/css/editor.css",';
 				}
-			} else {
-				$content_css = '';
 			}
 		}
 
-		$relative_urls		= $this->params->def( 'relative_urls', '1' );
+		$relative_urls		= $this->params->def('relative_urls', '1');
 		if ( $relative_urls ) { // relative
 			$relative_urls = "true";
 		} else { // absolute
 			$relative_urls = "false";
 		}
 
-		$newlines = $this->params->def( 'newlines', 0 );
-		if ( $newlines ) { // br
-			$forcenewline = "force_br_newlines : \"true\", force_p_newlines : \"false\", forced_root_block : '',";
+		$newlines = $this->params->def('newlines', 0);
+		if ($newlines) { // br
+			$forcenewline = "force_br_newlines : true, force_p_newlines : false, forced_root_block : '',";
 		} else { // p
-			$forcenewline = "force_br_newlines : \"false\", force_p_newlines : \"true\", forced_root_block : 'p',";
+			$forcenewline = "force_br_newlines : false, force_p_newlines : true, forced_root_block : 'p',";
 		}
-		$invalid_elements	= $this->params->def( 'invalid_elements', 'script,applet,iframe' );
-		$extended_elements	= $this->params->def( 'extended_elements', '' );
-
+		$invalid_elements	= $this->params->def('invalid_elements', 'script,applet,iframe');
+		$extended_elements	= $this->params->def('extended_elements', '');
 
 		// theme_advanced_* settings
-		$toolbar = $this->params->def( 'toolbar', 'top' );
-		$toolbar_align	= $this->params->def( 'toolbar_align', 'left' );
-		$html_height = $this->params->def( 'html_height', '550' );
-		$html_width = $this->params->def( 'html_width', '750' );
+		$toolbar = $this->params->def('toolbar', 'top');
+		$toolbar_align	= $this->params->def('toolbar_align', 'left');
+		$html_height = $this->params->def('html_height', '550');
+		$html_width = $this->params->def('html_width', '750');
 		$element_path = '';
 		if ($this->params->get('element_path', 1)) {
-			$element_path = "theme_advanced_statusbar_location : \"bottom\", theme_advanced_path : true";
+			$element_path = 'theme_advanced_statusbar_location : "bottom", theme_advanced_path : true';
 		} else {
-			$element_path = "theme_advanced_statusbar_location : \"none\", theme_advanced_path : false";
+			$element_path = 'theme_advanced_statusbar_location : "none", theme_advanced_path : false';
 		}
 
 		$buttons1_add_before = $buttons1_add = array();
@@ -183,103 +198,105 @@
 		$buttons3_add_before = $buttons3_add = array();
 		$buttons4 = array();
 		$plugins 	= array();
-		if( $extended_elements != "" ) $elements = explode( ',', $extended_elements );
+		if($extended_elements != "") $elements = explode(',', $extended_elements);
 
 		//Initial values for buttons
-		array_push($buttons2_add_before,'cut','copy','paste');
-		array_push($buttons2_add,'|');
+		array_push($buttons4,'cut','copy','paste');
+		//array_push($buttons4,'|');
 
 		// Plugins
 
 		// fonts
 		$fonts =  $this->params->def( 'fonts', 1 );
-		if ( $fonts ) {
+		if ($fonts) {
 			$buttons1_add[]	= 'fontselect,fontsizeselect';
 		}
 
 		// paste
-		$paste =  $this->params->def( 'paste', 1 );
-		if ( $paste ) {
+		$paste =  $this->params->def('paste', 1);
+		if ($paste) {
 			$plugins[]	= 'paste';
-			$buttons2_add_before[]	= 'pastetext,pasteword,selectall';
+			$buttons4[]	= 'pastetext';
+			$buttons4[]	= 'pasteword';
+			$buttons4[]	= 'selectall,|';
 		}
 
 		// search & replace
-		$searchreplace 		=  $this->params->def( 'searchreplace', 1 );
-		if ( $searchreplace ) {
+		$searchreplace		=  $this->params->def('searchreplace', 1);
+		if ($searchreplace) {
 			$plugins[]	= 'searchreplace';
-			$buttons2_add_before[]	= '|,search,replace,|';
+			$buttons2_add_before[]	= 'search,replace,|';
 		}
 
 		// insert date and/or time plugin
-		$insertdate			= $this->params->def( 'insertdate', 1 );
-		$format_date		= $this->params->def( 'format_date', '%Y-%m-%d' );
-		$inserttime			= $this->params->def( 'inserttime', 1 );
-		$format_time		= $this->params->def( 'format_time', '%H:%M:%S' );
-		if ( $insertdate or $inserttime ) {
+		$insertdate			= $this->params->def('insertdate', 1);
+		$format_date		= $this->params->def('format_date', '%Y-%m-%d');
+		$inserttime			= $this->params->def('inserttime', 1);
+		$format_time		= $this->params->def('format_time', '%H:%M:%S');
+		if ($insertdate or $inserttime) {
 			$plugins[]	= 'insertdatetime';
-			if ( $insertdate ) {
+			if ($insertdate) {
 				$buttons2_add[]	= 'insertdate';
 			}
-			if ( $inserttime ) {
+			if ($inserttime) {
 				$buttons2_add[]	= 'inserttime';
 			}
 		}
 
 		// colors
-		$colors =  $this->params->def( 'colors', 1 );
-		if ( $colors ) {
+		$colors =  $this->params->def('colors', 1);
+		if ($colors) {
 			$buttons2_add[]	= 'forecolor,backcolor';
 		}
 
 		// table
-		$table = $this->params->def( 'table', 1 );
-		if ( $table ) {
+		$table = $this->params->def('table', 1);
+		if ($table) {
 			$plugins[]	= 'table';
 			$buttons3_add_before[]	= 'tablecontrols';
 		}
 
 		// emotions
-		$smilies = $this->params->def( 'smilies', 1 );
-		if ( $smilies ) {
+		$smilies = $this->params->def('smilies', 1);
+		if ($smilies) {
 			$plugins[]	= 'emotions';
 			$buttons3_add[]	= 'emotions';
 		}
 
-		//media plugin 
-		$media = $this->params->def( 'media', 1 );
-		if ( $media ) {
+		//media plugin
+		$media = $this->params->def('media', 1);
+		if ($media) {
 			$plugins[] = 'media';
 			$buttons3_add[] = 'media';
 		}
 
 		// horizontal line
-		$hr = $this->params->def( 'hr', 1 );
-		if ( $hr ) {
+		$hr = $this->params->def('hr', 1);
+		if ($hr) {
 			$plugins[]	= 'advhr';
-			$elements[] = 'hr[id|title|alt|class|width|size|noshade]';
+			$elements[] = 'hr[id|title|alt|class|width|size|noshade|style]';
 			$buttons3_add[]	= 'advhr';
 		} else {
 			$elements[] = 'hr[id|class|title|alt]';
 		}
 
 		// rtl/ltr buttons
-		$directionality	= $this->params->def( 'directionality', 1 );
-		if ( $directionality ) {
+		$directionality	= $this->params->def('directionality', 1);
+		if ($directionality) {
 			$plugins[] = 'directionality';
 			$buttons3_add[] = 'ltr,rtl';
 		}
 
 		// fullscreen
-		$fullscreen	= $this->params->def( 'fullscreen', 1 );
-		if ( $fullscreen ) {
+		$fullscreen	= $this->params->def('fullscreen', 1);
+		if ($fullscreen) {
 			$plugins[]	= 'fullscreen';
-			$buttons3_add[]	= 'fullscreen';
+			$buttons2_add[]	= 'fullscreen';
 		}
 
 		// layer
-		$layer = $this->params->def( 'layer', 1 );
-		if ( $layer ) {
+		$layer = $this->params->def('layer', 1);
+		if ($layer) {
 			$plugins[]	= 'layer';
 			$buttons4[]	= 'insertlayer';
 			$buttons4[]	= 'moveforward';
@@ -288,69 +305,76 @@
 		}
 
 		// style
-		$style			= $this->params->def( 'style', 1 );
-		if ( $style ) {
+		$style = $this->params->def('style', 1);
+		if ($style) {
 			$plugins[]	= 'style';
 			$buttons4[]	= 'styleprops';
 		}
 
 		// XHTMLxtras
-		$xhtmlxtras			= $this->params->def( 'xhtmlxtras', 1 );
-		if ( $xhtmlxtras ) {
+		$xhtmlxtras	= $this->params->def('xhtmlxtras', 1);
+		if ($xhtmlxtras) {
 			$plugins[]	= 'xhtmlxtras';
 			$buttons4[]	= 'cite,abbr,acronym,ins,del,attribs';
 		}
 
 		// visualchars
-		$visualchars = $this->params->def( 'visualchars', 1 );
-		if ( $template ) {
+		$visualchars = $this->params->def('visualchars', 1);
+		if ($visualchars) {
 			$plugins[]	= 'visualchars';
 			$buttons4[]	= 'visualchars';
 		}
 
-		// visualchars
-		$nonbreaking = $this->params->def( 'nonbreaking', 1 );
-		if ( $template ) {
+		// non-breaking
+		$nonbreaking = $this->params->def('nonbreaking', 1);
+		if ($nonbreaking) {
 			$plugins[]	= 'nonbreaking';
 			$buttons4[]	= 'nonbreaking';
 		}
 
+		// blockquote
+		$blockquote	= $this->params->def( 'blockquote', 1 );
+		if ( $blockquote ) {
+			$plugins[] = 'blockquote';
+			$buttons4[] = 'blockquote';
+		}
+
 		// template
-		$template = $this->params->def( 'template', 1 );
-		if ( $template ) {
+		$template = $this->params->def('template', 1);
+		if ($template) {
 			$plugins[]	= 'template';
 			$buttons4[]	= 'template';
 		}
 
 		// advimage
-		$advimage = $this->params->def( 'advimage', 1 );
-		if ( $advimage ) {
+		$advimage = $this->params->def('advimage', 1);
+		if ($advimage) {
 			$plugins[]	= 'advimage';
-			$elements[]	= 'img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]';
+			$elements[]	= 'img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]';
 		}
 
 		// advlink
-		$advlink 	= $this->params->def( 'advlink', 1 );
-		if ( $advlink ) {
+		$advlink 	= $this->params->def('advlink', 1);
+		if ($advlink) {
 			$plugins[]	= 'advlink';
-			$elements[]	= 'a[class|name|href|target|title|onclick|rel]';
+			$elements[]	= 'a[class|name|href|target|title|onclick|rel|style]';
 		}
 
 		// autosave
-		$autosave			= $this->params->def( 'autosave', 1 );
-		if ( $autosave ) {
+		$autosave = $this->params->def('autosave', 1);
+		if ($autosave) {
 			$plugins[]	= 'autosave';
 		}
 
 		// context menu
-		$contextmenu	= $this->params->def( 'contextmenu', 1 );
-		if ( $contextmenu ) {
+		$contextmenu = $this->params->def('contextmenu', 1);
+		if ($contextmenu) {
 			$plugins[]	= 'contextmenu';
 		}
 
 		// inline popups
-		$inlinepopups			= $this->params->def( 'inlinepopups', 1 );
-		if ( $inlinepopups ) {
+		$inlinepopups			= $this->params->def('inlinepopups', 1);
+		if ($inlinepopups) {
 			$plugins[]	= 'inlinepopups';
 			$dialog_type = "dialog_type : \"modal\",";
 		} else {
@@ -358,171 +382,191 @@
 		}
 
 		// Safari compatibility
-		$safari			= $this->params->def( 'safari', 0 );
-		if ( $safari ) {
+		$safari	= $this->params->def('safari', 0);
+		if ($safari) {
 			$plugins[]	= 'safari';
 		}
 
-		$custom_plugin = $this->params->def( 'custom_plugin', '' );
+		$custom_plugin = $this->params->def('custom_plugin', '');
 		if ($custom_plugin != "") {
 			$plugins[] = $custom_plugin;
 		}
 
-		$custom_button = $this->params->def( 'custom_button', '' );
+		$custom_button = $this->params->def('custom_button', '');
 		if ($custom_button != "") {
 			$buttons4[] = $custom_button;
 		}
 
 		// Prepare config variables
-		$buttons1_add_before 	= implode( ',', $buttons1_add_before );
-		$buttons2_add_before 	= implode( ',', $buttons2_add_before );
-		$buttons3_add_before 	= implode( ',', $buttons3_add_before );
-		$buttons1_add 	= implode( ',', $buttons1_add );
-		$buttons2_add 	= implode( ',', $buttons2_add );
-		$buttons3_add 	= implode( ',', $buttons3_add );
-		$buttons4 	= implode( ',', $buttons4 );
-		$plugins		= implode( ',', $plugins );
-		$elements 	= implode( ',', $elements );
+		$buttons1_add_before = implode(',', $buttons1_add_before);
+		$buttons2_add_before = implode(',', $buttons2_add_before);
+		$buttons3_add_before = implode(',', $buttons3_add_before);
+		$buttons1_add = implode(',', $buttons1_add);
+		$buttons2_add = implode(',', $buttons2_add);
+		$buttons3_add = implode(',', $buttons3_add);
+		$buttons4 = implode(',', $buttons4);
+		$plugins = implode(',', $plugins);
+		$elements = implode(',', $elements);
 
 		switch($mode) {
-		case 'simple': /* Simple mode*/
-			if ($compressed) {
-				$load = "\t<script type=\"text/javascript\" src=\"".JURI::root()."plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js\"></script>\n";
-				$load .= "\t<script type=\"text/javascript\">
+			case 'simple': /* Simple mode*/
+				if ($compressed) {
+					$load = "\t<script type=\"text/javascript\" src=\"".
+							JURI::root().
+							"plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js\"></script>\n";
+					$load .= "\t<script type=\"text/javascript\">
 					tinyMCE_GZ.init({
 					themes : \"$theme[$mode]\",
 					languages : \"". $langPrefix . "\"
 				});
 				</script>";
-			} else {
-				$load = "\t<script type=\"text/javascript\" src=\"".JURI::root()."plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>\n";
-			}
-			$return = $load .
+				} else {
+					$load = "\t<script type=\"text/javascript\" src=\"".
+							JURI::root().
+							"plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>\n";
+				}
+				$return = $load .
 				"\t<script type=\"text/javascript\">
 				tinyMCE.init({
-				// General
-				directionality: \"$text_direction\",
-				editor_selector : \"mce_editable\",
-				language : \"". $langPrefix . "\",
-				mode : \"specific_textareas\",
-				$skin
-				theme : \"$theme[$mode]\",
-				// Cleanup/Output
-				cleanup : $cleanup,
-				cleanup_on_startup : $cleanup_startup,
-				entity_encoding : \"$entity_encoding\",
-				$forcenewline
-				// URL
-				relative_urls : $relative_urls,
-				remove_script_host : false,
-				document_base_url : \"". JURI::root() ."\",
-				// Layout
-				$content_css
+					// General
+					directionality: \"$text_direction\",
+					editor_selector : \"mce_editable\",
+					language : \"". $langPrefix . "\",
+					mode : \"specific_textareas\",
+					$skin
+					theme : \"$theme[$mode]\",
+					// Cleanup/Output
+					inline_styles : true,
+					gecko_spellcheck : true,
+					cleanup : $cleanup,
+					cleanup_on_startup : $cleanup_startup,
+					entity_encoding : \"$entity_encoding\",
+					$forcenewline
+					// URL
+					relative_urls : $relative_urls,
+					remove_script_host : false,
+					// Layout
+					$content_css
+					document_base_url : \"". JURI::root() ."\",
 				});
 				</script>";
-		  break;
+				break;
 
-		case 'advanced': /* Advanced mode*/
-		  if ($compressed) {
-			$load = "\t<script type=\"text/javascript\" src=\"".JURI::root()."plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js\"></script>\n";
-			$load .= "\t<script type=\"text/javascript\">
-	      tinyMCE_GZ.init({
-				themes : \"$theme[$mode]\",
-				languages : \"". $langPrefix . "\"
-				});
+			case 'advanced': /* Advanced mode*/
+				if ($compressed) {
+					$load = "\t<script type=\"text/javascript\" src=\"".
+							JURI::root().
+							"plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js\"></script>\n";
+					$load .= "\t<script type=\"text/javascript\">
+						tinyMCE_GZ.init({
+						themes : \"$theme[$mode]\",
+						languages : \"". $langPrefix . "\"
+					});
 				</script>";
-		} else {
-				$load = "\t<script type=\"text/javascript\" src=\"".JURI::root()."plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>\n";
-			}
-			$return = $load .
+				} else {
+					$load = "\t<script type=\"text/javascript\" src=\"".
+							JURI::root().
+							"plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>\n";
+				}
+				$return = $load .
 				"\t<script type=\"text/javascript\">
 				tinyMCE.init({
-				// General
-				directionality: \"$text_direction\",
-				editor_selector : \"mce_editable\",
-				language : \"". $langPrefix . "\",
-				mode : \"specific_textareas\",
-				$skin
-				theme : \"$theme[$mode]\",
-				// Cleanup/Output
-				cleanup : $cleanup,
-				cleanup_on_startup : $cleanup_startup,
-				entity_encoding : \"$entity_encoding\",
-				extended_valid_elements : \"$elements\",
-				$forcenewline
-				invalid_elements : \"$invalid_elements\",
-				// URL
-				relative_urls : $relative_urls,
-				remove_script_host : false,
-				document_base_url : \"". JURI::root() ."\",
-				// Layout
-				$content_css,
-				// Advanced theme
-				theme_advanced_toolbar_location : \"$toolbar\",
-				theme_advanced_toolbar_align : \"$toolbar_align\",
-				theme_advanced_source_editor_height : \"$html_height\",
-				theme_advanced_source_editor_width : \"$html_width\",
-				$element_path
+					// General
+					directionality: \"$text_direction\",
+					editor_selector : \"mce_editable\",
+					language : \"". $langPrefix . "\",
+					mode : \"specific_textareas\",
+					$skin
+					theme : \"$theme[$mode]\",
+					// Cleanup/Output
+					inline_styles : true,
+					gecko_spellcheck : true,
+					cleanup : $cleanup,
+					cleanup_on_startup : $cleanup_startup,
+					entity_encoding : \"$entity_encoding\",
+					extended_valid_elements : \"$elements\",
+					$forcenewline
+					invalid_elements : \"$invalid_elements\",
+					// URL
+					relative_urls : $relative_urls,
+					remove_script_host : false,
+					document_base_url : \"". JURI::root() ."\",
+					// Layout
+					$content_css
+					// Advanced theme
+					theme_advanced_toolbar_location : \"$toolbar\",
+					theme_advanced_toolbar_align : \"$toolbar_align\",
+					theme_advanced_source_editor_height : \"$html_height\",
+					theme_advanced_source_editor_width : \"$html_width\",
+					$element_path
 				});
 				</script>";
-		  break;
+				break;
 
-		case 'extended': /* Extended mode*/
-		  if ($compressed) {
-		    $load = "\t<script type=\"text/javascript\" src=\"".JURI::root()."plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js\"></script>\n";
-				$load .= "\t<script type=\"text/javascript\">
-	      tinyMCE_GZ.init({
-				themes : \"$theme[$mode]\",
-				plugins : \"$plugins\",
-				languages : \"". $langPrefix . "\"
+			case 'extended': /* Extended mode*/
+				if ($compressed) {
+					$load = "\t<script type=\"text/javascript\" src=\"".
+							JURI::root().
+							"plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js\"></script>\n";
+				  	$load .= "\t<script type=\"text/javascript\">
+				tinyMCE_GZ.init({
+					themes : \"$theme[$mode]\",
+					plugins : \"$plugins\",
+					languages : \"". $langPrefix . "\"
 				});
 				</script>";
-			} else {
-				$load = "\t<script type=\"text/javascript\" src=\"".JURI::root()."plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>\n";
-			}
-			$return = $load .
+		  } else {
+				$load = "\t<script type=\"text/javascript\" src=\"".
+						JURI::root().
+						"plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>\n";
+		  }
+		  $return = $load .
 				"\t<script type=\"text/javascript\">
 				tinyMCE.init({
-				// General
-				$dialog_type
-				directionality: \"$text_direction\",
-				editor_selector : \"mce_editable\",
-				language : \"". $langPrefix . "\",
-				mode : \"specific_textareas\",
-				plugins : \"$plugins\",
-				$skin
-				theme : \"$theme[$mode]\",
-				// Cleanup/Output
-				cleanup : $cleanup,
-				cleanup_on_startup : $cleanup_startup,
-				entity_encoding : \"$entity_encoding\",
-				extended_valid_elements : \"$elements\",
-				$forcenewline
-				invalid_elements : \"$invalid_elements\",
-				// URL
-				relative_urls : $relative_urls,
-				remove_script_host : false,
-				document_base_url : \"". JURI::root() ."\",
-				// Layout
-				$content_css,
-				// Advanced theme
-				theme_advanced_toolbar_location : \"$toolbar\",
-				theme_advanced_toolbar_align : \"$toolbar_align\",
-				theme_advanced_source_editor_height : \"$html_height\",
-				theme_advanced_source_editor_width : \"$html_width\",
-				$element_path,
-				theme_advanced_buttons1_add_before : \"$buttons1_add_before\",
-				theme_advanced_buttons2_add_before : \"$buttons2_add_before\",
-				theme_advanced_buttons3_add_before : \"$buttons3_add_before\",
-				theme_advanced_buttons1_add : \"$buttons1_add\",
-				theme_advanced_buttons2_add : \"$buttons2_add\",
-				theme_advanced_buttons3_add : \"$buttons3_add\",
-				theme_advanced_buttons4 : \"$buttons4\",
-				plugin_insertdate_dateFormat : \"$format_date\",
-				plugin_insertdate_timeFormat : \"$format_time\",
-				fullscreen_settings : {
-				theme_advanced_path_location : \"top\"
-				}
+					// General
+					$dialog_type
+					directionality: \"$text_direction\",
+					editor_selector : \"mce_editable\",
+					language : \"". $langPrefix . "\",
+					mode : \"specific_textareas\",
+					plugins : \"$plugins\",
+					$skin
+					theme : \"$theme[$mode]\",
+					// Cleanup/Output
+					inline_styles : true,
+					gecko_spellcheck : true,
+					cleanup : $cleanup,
+					cleanup_on_startup : $cleanup_startup,
+					entity_encoding : \"$entity_encoding\",
+					extended_valid_elements : \"$elements\",
+					$forcenewline
+					invalid_elements : \"$invalid_elements\",
+					// URL
+					relative_urls : $relative_urls,
+					remove_script_host : false,
+					document_base_url : \"". JURI::root() ."\",
+					//Templates
+					template_external_list_url :  \"". JURI::root() ."plugins/editors/tinymce/templates/template_list.js\",
+					// Layout
+					$content_css
+					// Advanced theme
+					theme_advanced_toolbar_location : \"$toolbar\",
+					theme_advanced_toolbar_align : \"$toolbar_align\",
+					theme_advanced_source_editor_height : \"$html_height\",
+					theme_advanced_source_editor_width : \"$html_width\",
+					$element_path,
+					theme_advanced_buttons1_add_before : \"$buttons1_add_before\",
+					theme_advanced_buttons2_add_before : \"$buttons2_add_before\",
+					theme_advanced_buttons3_add_before : \"$buttons3_add_before\",
+					theme_advanced_buttons1_add : \"$buttons1_add\",
+					theme_advanced_buttons2_add : \"$buttons2_add\",
+					theme_advanced_buttons3_add : \"$buttons3_add\",
+					theme_advanced_buttons4 : \"$buttons4\",
+					plugin_insertdate_dateFormat : \"$format_date\",
+					plugin_insertdate_timeFormat : \"$format_time\",
+					fullscreen_settings : {
+						theme_advanced_path_location : \"top\"
+					}
 				});
 				</script>";
 		  break;
@@ -537,7 +581,7 @@
 	 * @param string 	The name of the editor
 	 */
 	function onGetContent( $editor ) {
-		return "tinyMCE.activeEditor.getContent();";
+		return 'tinyMCE.get(\''.$editor.'\').getContent();';
 	}
 
 	/**
@@ -545,8 +589,8 @@
 	 *
 	 * @param string 	The name of the editor
 	 */
-	function onSetContent( $editor, $html ) {
-		return "tinyMCE.activeEditor.setContent(".$html.");";
+	function onSetContent($editor, $html) {
+		return 'tinyMCE.get(\''.$editor.'\').setContent('.$html.');';
 	}
 
 	/**
@@ -554,8 +598,8 @@
 	 *
 	 * @param string 	The name of the editor
 	 */
-	function onSave( $editor ) {
-		return "tinyMCE.triggerSave();";
+	function onSave($editor) {
+ 		return 'if (tinyMCE.get("'.$editor.'").isHidden()) {tinyMCE.get("'.$editor.'").show()}; tinyMCE.get("'.$editor.'").save();';
 	}
 
 	/**
@@ -569,7 +613,7 @@
 	 * @param int The number of rows for the editor area
 	 * @param mixed Can be boolean or array.
 	 */
-	function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = true)
+	function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true)
 	{
 		// Only add "px" to width and height if they are not given as a percentage
 		if (is_numeric( $width )) {
@@ -580,19 +624,40 @@
 		}
 
 		$editor  = "<textarea id=\"$name\" name=\"$name\" cols=\"$col\" rows=\"$row\" style=\"width:{$width}; height:{$height};\" class=\"mce_editable\">$content</textarea>\n" .
-		$this->_displayButtons($name, $buttons) .
-		$this->_toogleButton($name);
+			$this->_displayButtons($name, $buttons) .
+			$this->_toogleButton($name);
 
 		return $editor;
 	}
 
 	function onGetInsertMethod($name)
 	{
-		$doc = & JFactory::getDocument();
+		$doc =& JFactory::getDocument();
+
+		$js= "
+			function isBrowserIE() {
+				return navigator.appName==\"Microsoft Internet Explorer\";
+			}
+
+			function jInsertEditorText( text, editor ) {
+				if (isBrowserIE()) {
+					if (window.parent.tinyMCE) {
+						window.parent.tinyMCE.selectedInstance.selection.moveToBookmark(window.parent.global_ie_bookmark);
+					}
+				}
+				tinyMCE.execInstanceCommand(editor, 'mceInsertContent',false,text);
+			}
+
+			var global_ie_bookmark = false;
+
+			function IeCursorFix() {
+				if (isBrowserIE()) {
+					tinyMCE.execCommand('mceInsertContent', false, '');
+					global_ie_bookmark = tinyMCE.activeEditor.selection.getBookmark(false);
+				}
+				return true;
+			}";
 
-		$js= "function jInsertEditorText( text, editor ) {
-			tinyMCE.execInstanceCommand(editor, 'mceInsertContent',false,text);
-		}";
 		$doc->addScriptDeclaration($js);
 
 		return true;
@@ -631,7 +696,7 @@
 				{
 					$modal		= ($button->get('modal')) ? 'class="modal-button"' : null;
 					$href		= ($button->get('link')) ? 'href="'.JURI::base().$button->get('link').'"' : null;
-					$onclick	= ($button->get('onclick')) ? 'onclick="'.$button->get('onclick').'"' : null;
+                    $onclick	= ($button->get('onclick')) ? 'onclick="'.$button->get('onclick').'"' : 'onclick="IeCursorFix(); return false;"';
 					$return .= "<div class=\"button2-left\"><div class=\"".$button->get('name')."\"><a ".$modal." title=\"".$button->get('text')."\" ".$href." ".$onclick." rel=\"".$button->get('options')."\">".$button->get('text')."</a></div></div>\n";
 				}
 			}
diff -aruN --binary 14/plugins/editors/tinymce.xml 15/plugins/editors/tinymce.xml
--- 14/plugins/editors/tinymce.xml	2009-07-23 04:25:36.000000000 +0200
+++ 15/plugins/editors/tinymce.xml	2009-11-04 18:51:20.000000000 +0100
@@ -1,198 +1,202 @@
-<?xml version="1.0" encoding="utf-8"?>
-<install version="1.5" type="plugin" group="editors" method="upgrade">
-	<name>Editor - TinyMCE 3</name>
-	<version>3.2.4.1</version>
-	<creationDate>2005-2009</creationDate>
-	<author>Moxiecode Systems AB</author>
-	<authorEmail>N/A</authorEmail>
-	<authorUrl>tinymce.moxiecode.com/</authorUrl>
-	<copyright>Moxiecode Systems AB</copyright>
-	<license>LGPL</license>
-	<description>DESCTINYMCE</description>
-  <files>
-    <filename plugin="tinymce3">tinymce3.php</filename>
-    <folder>tinymce3</folder>
-  </files>
-	<languages>
-		<language tag="en-GB">en-GB.plg_editors_tinymce3.ini</language>
-	</languages>
-	<params>
-		<param name="mode" type="list" default="advanced" label="Functionality" description="Select functionality">
-			<option value="simple">Simple</option>
-			<option value="advanced">Advanced</option>
-			<option value="extended">Extended</option>
-		</param>
-		<param name="skin" type="list" default="0" label="Skin" description="Select skin">
-			<option value="0">Default</option>
-			<option value="1">Office2007 Blue</option>
-			<option value="2">Office2007 Silver</option>
-			<option value="3">Office2007 Black</option>
-		</param>
- 		<param name="compressed" type="radio" default="0" label="Compressed Version" description="PARAMCOMPRESSEDVERSION">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
- 		<param name="@spacer" type="spacer" default="" label="" description="" />
- 		<param name="cleanup_startup" type="radio" default="0" label="Code Cleanup on startup" description="Cleans code on editor load">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
-    <param name="cleanup_save" type="radio" default="2" label="Code Cleanup on Save" description="Code Cleanup upon saving article">
-      <option value="0">Never</option>
-      <option value="1">Front Only</option>
-      <option value="2">Always</option>
-    </param>
-    <param name="entity_encoding" type="list" default="raw" label="Entity Encoding" description="Controls how entities get processed by editor">
-      <option value="named">named</option>
-      <option value="numeric">numeric</option>
-      <option value="raw">raw</option>
-    </param>
- 		<param name="@spacer" type="spacer" default="" label="" description="" />
-  		<param name="lang_mode" type="radio" default="0" label="Automatic Language Selection" description="DESCLANGMODE">
- 			<option value="0">No</option>
- 			<option value="1">Yes</option>
- 		</param>
- 		<param name="lang_code" type="text" default="en" size="2" label="Language Code" description="DESCLANGCODE"/>
- 		<param name="text_direction" type="list" default="ltr" label="Text Direction" description="Ability to change text direction">
- 			<option value="ltr">Left to Right</option>
- 			<option value="rtl">Right to Left</option>
- 		</param>
- 		<param name="@spacer" type="spacer" default="" label="" description="" />
-  	<param name="content_css" type="radio" default="1" label="Template CSS classes" description="PARAMTEMPLATECSS">
- 			<option value="0">No</option>
- 			<option value="1">Yes</option>
- 		</param>
- 		<param name="content_css_custom" type="text" size="30" default="" label="Custom CSS Classes" description="PARAMCUSTOMCSS"/>
- 		<param name="@spacer" type="spacer" default="" label="" description="" />
-  	<param name="relative_urls" type="list" default="1" label="Urls" description="URL behaviour">
- 			<option value="0">Absolute</option>
- 			<option value="1">Relative</option>
- 		</param>
- 		<param name="newlines" type="list" default="0" label="Newlines" description="Newlines will be made into the selected option">
- 			<option value="1">BR Elements</option>
- 			<option value="0">P Elements</option>
- 		</param>
- 		<param name="invalid_elements" type="textarea" rows="2" cols="30" default="script,applet,iframe" label="Prohibited Elements" description="Elements that will be cleaned from the text"/>
-  	<param name="extended_elements" type="textarea" rows="2" cols="30" default="" label="Extended Valid Elements" description="PARAMEXTVALIDELEMENTS"/>
-   	</params>
-   	<params group="advanced">
- 		<param name="toolbar" type="list" default="top" label="Toolbar" description="Position of the toolbar">
- 			<option value="top">Top</option>
- 			<option value="bottom">Bottom</option>
- 		</param>
- 		<param name="toolbar_align" type="list" default="left" label="Toolbar align" description="Alignment of the toolbar">
- 			<option value="left">Left</option>
- 			<option value="center">Center</option>
- 			<option value="right">Right</option>
- 		</param>
- 		<param name="html_height" type="text" default="550" label="HTML Height" description="PARAMHTMLHEIGHT"/>
- 		<param name="html_width" type="text" default="750" label="HTML Width" description="PARAMHTMLWIDTH"/>
- 		<param name="element_path" type="radio" default="1" label="Element Path" description="PARAMELEMENTPATH">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
- 		<param name="@spacer" type="spacer" default="Params Extended Mode" label="" description="" />
- 		<param name="fonts" type="radio" default="1" label="Fonts" description="PARAMFONTS">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="paste" type="radio" default="1" label="Paste" description="PARAMPASTE">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="searchreplace" type="radio" default="1" label="Search-Replace" description="PARAMSEARCHREPLACE">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="insertdate" type="radio" default="1" label="Insert Date" description="PARAMINSERTDATE">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
-  	<param name="format_date" type="text" default="%Y-%m-%d" label="Date format" description="Format of inserted Date. Only works in Advanced mode"/>
-		<param name="inserttime" type="radio" default="1" label="Insert Time" description="PARAMINSERTTIME">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
-  	<param name="format_time" type="text" default="%H:%M:%S" label="Time format" description="Format of inserted Time. Only works in Advanced mode"/>
- 		<param name="colors" type="radio" default="1" label="Colors" description="PARAMCOLORS">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="table" type="radio" default="1" label="Table" description="PARAMTABLE">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="smilies" type="radio" default="1" label="Smilies" description="PARAMSMILIES">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="media" type="radio" default="1" label="Media" description="PARAMMEDIA">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="hr" type="radio" default="1" label="Horizontal Rule" description="Show/Hide the Horizontal Rule button">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="directionality" type="radio" default="1" label="Directionality" description="PARAMDIRECTIONALITY">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="fullscreen" type="radio" default="1" label="Fullscreen" description="PARAMFULLSCREEN">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="style" type="radio" default="1" label="Style" description="PARAMSTYLE">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="layer" type="radio" default="1" label="Layer" description="PARAMLAYER">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="xhtmlxtras" type="radio" default="1" label="XHTMLxtras" description="PARAMXHTMLXTRAS">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="visualchars" type="radio" default="1" label="Visualchars" description="Possibility to see invisible characters">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="nonbreaking" type="radio" default="1" label="Nonbreaking" description="Insert nonbreaking space entities">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="template" type="radio" default="1" label="Template" description="PARAMTEMPLATE">
- 			<option value="0">Hide</option>
- 			<option value="1">Show</option>
- 		</param>
- 		<param name="@spacer" type="spacer" default="" label="" description="" />
- 		<param name="advimage" type="radio" default="1" label="Advanced image" description="Turn on/off a more advanced image dialog">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
- 		<param name="advlink" type="radio" default="1" label="Advanced link" description="Turn on/off a more advanced link dialog">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
- 		<param name="autosave" type="radio" default="1" label="Save Warning" description="Save warning - gives warning if you cancel without saving changes">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
- 		<param name="contextmenu" type="radio" default="1" label="Context menu" description="Turn on/off Context menu">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
- 		<param name="inlinepopups" type="radio" default="1" label="Inline popups" description="All dialogs to open as floating DIV layers instead of popup windows. This option can be very useful in order to get around popup blockers.">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
- 		<param name="safari" type="radio" default="0" label="Safari compatibility" description="Turn on/off Safari compatibility plugin">
- 			<option value="0">Off</option>
- 			<option value="1">On</option>
- 		</param>
- 		<param name="@spacer" type="spacer" default="" label="" description="" />
- 		<param name="custom_plugin" type="text" default="" label="Custom plugin" description="Add custom plugin(s)"/>
- 		<param name="custom_button" type="text" default="" label="Custom button" description="Add custom button(s)"/>
-   	</params>
-</install>
+<?xml version="1.0" encoding="utf-8"?>
+<install version="1.5" type="plugin" group="editors" method="upgrade">
+	<name>Editor - TinyMCE 3</name>
+	<version>3.2.6</version>
+	<creationDate>2005-2009</creationDate>
+	<author>Moxiecode Systems AB</author>
+	<authorEmail>N/A</authorEmail>
+	<authorUrl>tinymce.moxiecode.com/</authorUrl>
+	<copyright>Moxiecode Systems AB</copyright>
+	<license>LGPL</license>
+	<description>DESCTINYMCE</description>
+	<files>
+		<filename plugin="tinymce3">tinymce.php</filename>
+		<folder>tinymce</folder>
+	</files>
+	<languages>
+		<language tag="en-GB">en-GB.plg_editors_tinymce.ini</language>
+	</languages>
+	<params>
+		<param name="mode" type="list" default="advanced" label="Functionality" description="Select functionality">
+			<option value="simple">Simple</option>
+			<option value="advanced">Advanced</option>
+			<option value="extended">Extended</option>
+		</param>
+		<param name="skin" type="list" default="0" label="Skin" description="Select skin">
+			<option value="0">Default</option>
+			<option value="1">Office2007 Blue</option>
+			<option value="2">Office2007 Silver</option>
+			<option value="3">Office2007 Black</option>
+		</param>
+		<param name="compressed" type="radio" default="0" label="Compressed Version" description="PARAMCOMPRESSEDVERSION">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="@spacer" type="spacer" default="" label="" description="" />
+		<param name="cleanup_startup" type="radio" default="0" label="Code Cleanup on startup" description="Cleans code on editor load">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="cleanup_save" type="radio" default="2" label="Code Cleanup on Save" description="PARAMCODECLEANUPONSAVE">
+			<option value="0">Never</option>
+			<option value="1">Front Only</option>
+			<option value="2">Always</option>
+		</param>
+		<param name="entity_encoding" type="list" default="raw" label="Entity Encoding" description="PARAMENTITYENCODING">
+			<option value="named">named</option>
+			<option value="numeric">numeric</option>
+			<option value="raw">raw</option>
+		</param>
+		<param name="@spacer" type="spacer" default="" label="" description="" />
+		<param name="lang_mode" type="radio" default="0" label="Automatic Language Selection" description="DESCLANGMODE">
+			<option value="0">No</option>
+			<option value="1">Yes</option>
+		</param>
+		<param name="lang_code" type="text" default="en" size="2" label="Language Code" description="DESCLANGCODE"/>
+		<param name="text_direction" type="list" default="ltr" label="Text Direction" description="Ability to change text direction">
+			<option value="ltr">Left to Right</option>
+			<option value="rtl">Right to Left</option>
+		</param>
+		<param name="@spacer" type="spacer" default="" label="" description="" />
+		<param name="content_css" type="radio" default="1" label="Template CSS classes" description="PARAMTEMPLATECSS">
+			<option value="0">No</option>
+			<option value="1">Yes</option>
+		</param>
+		<param name="content_css_custom" type="text" size="30" default="" label="Custom CSS Classes" description="PARAMCUSTOMCSS"/>
+		<param name="@spacer" type="spacer" default="" label="" description="" />
+		<param name="relative_urls" type="list" default="1" label="Urls" description="URL behaviour">
+			<option value="0">Absolute</option>
+			<option value="1">Relative</option>
+		</param>
+		<param name="newlines" type="list" default="0" label="Newlines" description="Newlines will be made into the selected option">
+			<option value="1">BR Elements</option>
+			<option value="0">P Elements</option>
+		</param>
+		<param name="invalid_elements" type="textarea" rows="2" cols="30" default="script,applet,iframe" label="Prohibited Elements" description="Elements that will be cleaned from the text"/>
+		<param name="extended_elements" type="textarea" rows="2" cols="30" default="" label="Extended Valid Elements" description="PARAMEXTVALIDELEMENTS"/>
+	</params>
+	<params group="advanced">
+		<param name="toolbar" type="list" default="top" label="Toolbar" description="Position of the toolbar">
+			<option value="top">Top</option>
+			<option value="bottom">Bottom</option>
+		</param>
+		<param name="toolbar_align" type="list" default="left" label="Toolbar align" description="Alignment of the toolbar">
+			<option value="left">Left</option>
+			<option value="center">Center</option>
+			<option value="right">Right</option>
+		</param>
+		<param name="html_height" type="text" default="550" label="HTML Height" description="PARAMHTMLHEIGHT"/>
+		<param name="html_width" type="text" default="750" label="HTML Width" description="PARAMHTMLWIDTH"/>
+		<param name="element_path" type="radio" default="1" label="Element Path" description="PARAMELEMENTPATH">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="@spacer" type="spacer" default="Params Extended Mode" label="" description="" />
+		<param name="fonts" type="radio" default="1" label="Fonts" description="PARAMFONTS">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="paste" type="radio" default="1" label="Paste" description="PARAMPASTE">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="searchreplace" type="radio" default="1" label="Search-Replace" description="PARAMSEARCHREPLACE">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="insertdate" type="radio" default="1" label="Insert Date" description="PARAMINSERTDATE">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="format_date" type="text" default="%Y-%m-%d" label="Date format" description="Format of inserted Date. Only works in Advanced mode"/>
+		<param name="inserttime" type="radio" default="1" label="Insert Time" description="PARAMINSERTTIME">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="format_time" type="text" default="%H:%M:%S" label="Time format" description="Format of inserted Time. Only works in Advanced mode"/>
+		<param name="colors" type="radio" default="1" label="Colors" description="PARAMCOLORS">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="table" type="radio" default="1" label="Table" description="PARAMTABLE">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="smilies" type="radio" default="1" label="Smilies" description="PARAMSMILIES">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="media" type="radio" default="1" label="Media" description="PARAMMEDIA">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="hr" type="radio" default="1" label="Horizontal Rule" description="Show/Hide the Horizontal Rule button">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="directionality" type="radio" default="1" label="Directionality" description="PARAMDIRECTIONALITY">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="fullscreen" type="radio" default="1" label="Fullscreen" description="PARAMFULLSCREEN">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="style" type="radio" default="1" label="Style" description="PARAMSTYLE">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="layer" type="radio" default="1" label="Layer" description="PARAMLAYER">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="xhtmlxtras" type="radio" default="1" label="XHTMLxtras" description="PARAMXHTMLXTRAS">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="visualchars" type="radio" default="1" label="Visualchars" description="Possibility to see invisible characters">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="nonbreaking" type="radio" default="1" label="Nonbreaking" description="Insert nonbreaking space entities">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="blockquote" type="radio" default="1" label="Blockquote" description="PARAMBLOCKQUOTE">
+		<option value="0">Hide</option>
+		<option value="1">Show</option>
+		</param>
+		<param name="template" type="radio" default="1" label="Template" description="PARAMTEMPLATE">
+			<option value="0">Hide</option>
+			<option value="1">Show</option>
+		</param>
+		<param name="@spacer" type="spacer" default="" label="" description="" />
+		<param name="advimage" type="radio" default="1" label="Advanced image" description="Turn on/off a more advanced image dialog">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="advlink" type="radio" default="1" label="Advanced link" description="Turn on/off a more advanced link dialog">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="autosave" type="radio" default="1" label="Save Warning" description="Save warning - gives warning if you cancel without saving changes">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="contextmenu" type="radio" default="1" label="Context menu" description="Turn on/off Context menu">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="inlinepopups" type="radio" default="1" label="Inline popups" description="All dialogs to open as floating DIV layers instead of popup windows. This option can be very useful in order to get around popup blockers.">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="safari" type="radio" default="0" label="Safari compatibility" description="Turn on/off Safari compatibility plugin">
+			<option value="0">Off</option>
+			<option value="1">On</option>
+		</param>
+		<param name="@spacer" type="spacer" default="" label="" description="" />
+		<param name="custom_plugin" type="text" default="" label="Custom plugin" description="Add custom plugin(s)"/>
+		<param name="custom_button" type="text" default="" label="Custom button" description="Add custom button(s)"/>
+	</params>
+</install>
diff -aruN --binary 14/plugins/search/content.php 15/plugins/search/content.php
--- 14/plugins/search/content.php	2009-05-29 14:52:00.000000000 +0200
+++ 15/plugins/search/content.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version		$Id: content.php 11371 2008-12-30 01:31:50Z ian $
+ * @version		$Id: content.php 12697 2009-09-12 02:10:36Z ian $
  * @package		Joomla
  * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
  * @license		GNU/GPL, see LICENSE.php
@@ -178,7 +178,7 @@
 	{
 		$query = 'SELECT id, a.title AS title, a.created AS created, a.metadesc, a.metakey, '
 		. ' CONCAT(a.introtext, a.fulltext) AS text,'
-		. ' "2" as browsernav, "'. $db->Quote(JText::_('Uncategorised Content')) .'" AS section'
+		. ' "2" as browsernav, "'. $db->getEscaped(JText::_('Uncategorised Content')) .'" AS section'
 		. ' FROM #__content AS a'
 		. ' WHERE ('.$where.')'
 		. ' AND a.state = 1'
diff -aruN --binary 14/plugins/system/legacy/adminmenus.php 15/plugins/system/legacy/adminmenus.php
--- 14/plugins/system/legacy/adminmenus.php	2009-05-29 14:51:58.000000000 +0200
+++ 15/plugins/system/legacy/adminmenus.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: adminmenus.php 10381 2008-06-01 03:35:53Z pasamio $
+* @version		$Id: adminmenus.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla.Legacy
 * @subpackage	1.5
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
@@ -310,7 +310,7 @@
 			if ( is_dir( $i_f ) && $file <> 'CVS' && $file <> '.svn') {
 				$folders[] = JHTML::_('select.option',  $ff_ );
 				mosAdminMenus::ReadImages( $i_f, $ff_, $folders, $images );
-			} else if ( eregi( "bmp|gif|jpg|png", $file ) && is_file( $i_f ) ) {
+			} else if ( preg_match( "#bmp|gif|jpg|png#i", $file ) && is_file( $i_f ) ) {
 				// leading / we don't need
 				$imageFile = substr( $ff, 1 );
 				$images[$folderPath][] = JHTML::_('select.option',  $imageFile, $file );
@@ -413,4 +413,4 @@
 	{
 		JError::raiseNotice( 0, 'mosAdminMenus::menuItem method deprecated' );
 	}
-}
\ No hay ningún carácter de nueva línea al final del fichero
+}
diff -aruN --binary 14/plugins/system/sef.php 15/plugins/system/sef.php
--- 14/plugins/system/sef.php	2009-05-29 14:51:58.000000000 +0200
+++ 15/plugins/system/sef.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: sef.php 11658 2009-03-08 20:09:39Z willebil $
+* @version		$Id: sef.php 13376 2009-10-29 01:44:22Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -53,7 +53,22 @@
 		//Replace src links
       	$base   = JURI::base(true).'/';
 		$buffer = JResponse::getBody();
+		
+		// pull out contents of editor to prevent URL changes inside edit area
+		$editor =& JFactory::getEditor();
+		$regex = '#'.$editor->_tagForSEF['start'].'(.*)'.$editor->_tagForSEF['end'].'#Us';
+		preg_match_all($regex, $buffer, $editContents, PREG_PATTERN_ORDER);
+
+		// create an array to hold the placeholder text (in case there are more than one editor areas)
+		$placeholders = array();
+		for ($i = 0; $i < count($editContents[0]); $i++) {
+			$placeholders[] = $editor->_tagForSEF['start'].$i.$editor->_tagForSEF['end'];
+		}
+		
+		// replace editor contents with placeholder text
+		$buffer 	= str_replace($editContents[0], $placeholders, $buffer);
 
+		// do the SEF substitutions
        	$regex  = '#href="index.php\?([^"]*)#m';
       	$buffer = preg_replace_callback( $regex, array('plgSystemSEF', 'route'), $buffer );
 
@@ -83,6 +98,9 @@
 		$regex = 	'#(<object\s+[^>]*)data\s*=\s*"(?!/|'.$protocols.'|\#|\')([^"]*)"#m';
 		$buffer 	= preg_replace($regex, '$1data="' . $base . '$2"$3', $buffer);
 		
+		// restore the editor contents
+		$buffer 	= str_replace($placeholders, $editContents[0], $buffer);
+		
 		JResponse::setBody($buffer);
 		return true;
 	}
diff -aruN --binary 14/plugins/xmlrpc/joomla.php 15/plugins/xmlrpc/joomla.php
--- 14/plugins/xmlrpc/joomla.php	2009-05-29 14:52:00.000000000 +0200
+++ 15/plugins/xmlrpc/joomla.php	2009-11-04 18:51:20.000000000 +0100
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version		$Id: joomla.php 10381 2008-06-01 03:35:53Z pasamio $
+* @version		$Id: joomla.php 12694 2009-09-11 21:03:02Z ian $
 * @package		Joomla
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
@@ -102,10 +102,10 @@
 		foreach ($results as $i=>$rows)
 		{
 			foreach ($rows as $j=>$row) {
-				$results[$i][$j]->href = eregi('^(http|https)://', $row->href) ? $row->href : JURI::root().'/'.$row->href;
+				$results[$i][$j]->href = preg_match('#^(http|https)://#i', $row->href) ? $row->href : JURI::root().'/'.$row->href;
 				$results[$i][$j]->text = SearchHelper::prepareSearchContent( $row->text, 200, $searchword);
 			}
 		}
 		return $results;
 	}
-}
\ No hay ningún carácter de nueva línea al final del fichero
+}
diff -aruN --binary 14/templates/beez/css/layout.css 15/templates/beez/css/layout.css
--- 14/templates/beez/css/layout.css	2009-05-29 14:53:22.000000000 +0200
+++ 15/templates/beez/css/layout.css	2009-11-04 18:51:20.000000000 +0100
@@ -1,5 +1,5 @@
 /**
- * @version $Id: layout.css 10387 2008-06-03 10:59:16Z pasamio $
+ * @version $Id: layout.css 13293 2009-10-24 00:43:16Z ian $
  * @author Design & Accessible Team ( Angie Radtke  )
  * @package Joomla
  * @subpackage Accessible-Template-Beez
@@ -1464,4 +1464,10 @@
 background:#f5f5f5;
 padding:5px;
 border:solid 1px #eee
+}
+
+/* image link default alignment */
+
+a img {
+vertical-align: bottom;
 }
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/templates/beez/index.php 15/templates/beez/index.php
--- 14/templates/beez/index.php	2009-05-29 14:53:22.000000000 +0200
+++ 15/templates/beez/index.php	2009-11-04 18:51:20.000000000 +0100
@@ -21,27 +21,27 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
 <head>
 	<jdoc:include type="head" />
-	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/beez/css/template.css" type="text/css" />
-	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/beez/css/position.css" type="text/css" media="screen,projection" />
-	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/beez/css/layout.css" type="text/css" media="screen,projection" />
-	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/beez/css/print.css" type="text/css" media="Print" />
-	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/beez/css/general.css" type="text/css" />
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/template.css" type="text/css" />
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/position.css" type="text/css" media="screen,projection" />
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/layout.css" type="text/css" media="screen,projection" />
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/print.css" type="text/css" media="Print" />
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/general.css" type="text/css" />
 	<?php if($this->direction == 'rtl') : ?>
-	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/beez/css/template_rtl.css" type="text/css" />
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/template_rtl.css" type="text/css" />
 	<?php endif; ?>
 	<!--[if lte IE 6]>
-		<link href="<?php echo $this->baseurl ?>/templates/beez/css/ieonly.css" rel="stylesheet" type="text/css" />
+		<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/ieonly.css" rel="stylesheet" type="text/css" />
 	<![endif]-->
 	<!--[if IE 7]>
-		<link href="<?php echo $this->baseurl ?>/templates/beez/css/ie7only.css" rel="stylesheet" type="text/css" />
+		<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/ie7only.css" rel="stylesheet" type="text/css" />
 	<![endif]-->
-	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/beez/javascript/md_stylechanger.js"></script>
+	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/javascript/md_stylechanger.js"></script>
 </head>
 <body>
 	<div id="all">
 		<div id="header">
 			<h1 id="logo">
-				<img src="<?php echo $this->baseurl ?>/templates/beez/images/logo.gif" border="0" alt="<?php echo JText::_('Logo Beez, Three little Bees'); ?>" width="300" height="97" />
+				<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/images/logo.gif" border="0" alt="<?php echo JText::_('Logo Beez, Three little Bees'); ?>" width="300" height="97" />
 				<span class="header1"><?php echo JText::_('Joomla Accessible Template'); ?></span>
 			</h1>
 
@@ -136,4 +136,4 @@
 	<jdoc:include type="modules" name="debug" />
 
 </body>
-</html>
\ No hay ningún carácter de nueva línea al final del fichero
+</html>
diff -aruN --binary 14/templates/ja_purity/css/template.css 15/templates/ja_purity/css/template.css
--- 14/templates/ja_purity/css/template.css	2009-05-29 14:53:30.000000000 +0200
+++ 15/templates/ja_purity/css/template.css	2009-11-05 17:21:34.000000000 +0100
@@ -8,7 +8,7 @@
 body {
 	color: #000000;
 	background: #FFFFFF;
-	font-family: Arial, Helvetica, sans-serif;
+	font-family: Tahoma, Arial, Helvetica, sans-serif;
 	line-height: 150%;
 }
 
@@ -954,9 +954,9 @@
 }
 
 h1.logo a {
-	width: 208px;
+	width: 350px;
 	display: block;
-	background: url(../images/logo.png) no-repeat;
+	background: url(../images/logo.gif) no-repeat;
 	height: 80px;
 	position: relative;
 	z-index: 100;
diff -aruN --binary 14/templates/ja_purity/html/com_content/category/blog_item.php 15/templates/ja_purity/html/com_content/category/blog_item.php
--- 14/templates/ja_purity/html/com_content/category/blog_item.php	2009-05-29 15:22:48.000000000 +0200
+++ 15/templates/ja_purity/html/com_content/category/blog_item.php	2009-11-04 18:51:20.000000000 +0100
@@ -44,8 +44,8 @@
 
 <?php if (($this->item->params->get('show_author')) && ($this->item->author != "")) : ?>
 	<span class="createby">
-		<?php JText::printf(($this->item->created_by_alias 
-			? $this->escape($this->item->created_by_alias) 
+		<?php JText::printf(($this->item->created_by_alias
+			? $this->escape($this->item->created_by_alias)
 			: $this->escape($this->item->author)) ); ?>
 	</span>
 <?php endif; ?>
@@ -128,11 +128,15 @@
 
 <?php if ($this->item->params->get('show_readmore') && $this->item->readmore) : ?>
 	<a href="<?php echo $this->item->readmore_link; ?>" title="<?php echo $this->escape($this->item->title); ?>" class="readon<?php echo $this->escape($this->item->params->get('pageclass_sfx')); ?>">
-			<?php if ($this->item->readmore_register) : ?>
-				<?php echo JText::_('Register to read more...'); ?>
-			<?php else : ?>
-				<?php echo JText::_('Read more...'); ?>
-			<?php endif; ?>
+			<?php
+				if ($this->item->readmore_register) :
+					echo JText::_('Register to read more...');
+				elseif ($readmore = $this->item->params->get('readmore')) :
+					echo $readmore ;
+				else :
+					echo JText::sprintf('Read more...');
+				endif;
+			?>
 	</a>
 <?php endif; ?>
 
diff -aruN --binary 14/templates/ja_purity/index.php 15/templates/ja_purity/index.php
--- 14/templates/ja_purity/index.php	2009-05-29 14:53:30.000000000 +0200
+++ 15/templates/ja_purity/index.php	2009-11-04 18:51:20.000000000 +0100
@@ -64,7 +64,7 @@
 <link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/styles/elements/<?php echo $tmpTools->getParam('theme_elements'); ?>/style.css" type="text/css" />
 <?php endif; ?>
 
-<!--[if gte IE 7.0]>
+<!--[if IE 7.0]>
 <style type="text/css">
 .clearfix {display: inline-block;}
 </style>
diff -aruN --binary 14/templates/ja_purity/ja_templatetools.php 15/templates/ja_purity/ja_templatetools.php
--- 14/templates/ja_purity/ja_templatetools.php	2009-06-18 10:03:34.000000000 +0200
+++ 15/templates/ja_purity/ja_templatetools.php	2009-11-04 18:51:20.000000000 +0100
@@ -180,7 +180,7 @@
 
 		//read all files from the  directory, checks if are images and ads them to a list (see below how to display flash banners)
 		while ($file = $imgs->read()) {
-			if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
+			if (preg_match("#gif#i", $file) || preg_match("#jpg#i", $file) || preg_match("#png#i", $file))
 				$imglist[] = $file;
 		}
 		closedir($imgs->handle);
diff -aruN --binary 14/templates/system/component.php 15/templates/system/component.php
--- 14/templates/system/component.php	2009-05-29 14:53:16.000000000 +0200
+++ 15/templates/system/component.php	2009-11-04 18:51:20.000000000 +0100
@@ -17,10 +17,24 @@
 <head>
 	<jdoc:include type="head" />
 	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
-	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/template.css" type="text/css" />
+	<?php
+	$db = & JFactory::getDbo();
+		$query	= 'SELECT template'
+				. ' FROM #__templates_menu'
+				. ' WHERE client_id = 0 AND menuid = 0';
 
-<?php if($this->direction == 'rtl') : ?>
-	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template_rtl.css" type="text/css" />
+		$db->setQuery($query);
+		$template = $db->loadResult();
+
+ if($this->direction == 'rtl' && !file_exists(JPATH_THEMES.DS.$template.DS.'css/template_rtl.css') || !file_exists(JPATH_THEMES.DS.$template.DS.'css/template.css')) : ?>
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/template_rtl.css" type="text/css" />
+<?php elseif($this->direction == 'rtl' ) : ?>
+<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $template; ?>/css/template.css" type="text/css" />
+<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $template; ?>/css/template_rtl.css" type="text/css" />
+<?php elseif($this->direction == 'ltr' && !file_exists(JPATH_THEMES.DS.$template.DS.'css/template.css')) : ?>
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/template.css" type="text/css" />
+<?php elseif($this->direction == 'ltr' ) : ?>
+<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $template; ?>/css/template.css" type="text/css" />
 <?php endif; ?>
 </head>
 <body class="contentpane">
diff -aruN --binary 14/templates/system/css/error_rtl.css 15/templates/system/css/error_rtl.css
--- 14/templates/system/css/error_rtl.css	1970-01-01 01:00:00.000000000 +0100
+++ 15/templates/system/css/error_rtl.css	2009-11-04 18:56:08.000000000 +0100
@@ -0,0 +1,17 @@
+/**
+ * CSS Document for error page
+ * @version $Id: error_rtl.css 10387 2009-10-28 10:59:16Z infograf $
+ * @package Joomla
+ * @copyright Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.
+ * @license GNU/GPL, see LICENSE.php
+ * Joomla! is free software and parts of it may contain or be derived from the
+ * GNU General Public License or other free or open source software licenses.
+ * See COPYRIGHT.php for copyright notices and details.
+ */
+
+
+body { 	direction:rtl;}
+
+#errorboxbody {	text-align: right;}
+
+#techinfo {	text-align: right;}
diff -aruN --binary 14/templates/system/css/general.css 15/templates/system/css/general.css
--- 14/templates/system/css/general.css	2009-05-29 14:53:16.000000000 +0200
+++ 15/templates/system/css/general.css	2009-11-04 18:51:20.000000000 +0100
@@ -136,6 +136,10 @@
 	text-align: center;
 }
 
+.img_caption  {
+text-align: center!important;
+}
+
 /* Calendar */
 a img.calendar {
 	width: 16px;
diff -aruN --binary 14/templates/system/css/template.css 15/templates/system/css/template.css
--- 14/templates/system/css/template.css	1970-01-01 01:00:00.000000000 +0100
+++ 15/templates/system/css/template.css	2009-11-04 18:56:08.000000000 +0100
@@ -0,0 +1,76 @@
+/**
+ * CSS Document for the system template.css
+ * @version $Id: template.css
+ * @package Joomla
+ * @copyright Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.
+ * @license GNU/GPL, see LICENSE.php
+ * Joomla! is free software and parts of it may contain or be derived from the
+ * GNU General Public License or other free or open source software licenses.
+ * See COPYRIGHT.php for copyright notices and details.
+ */
+
+/* Based on work by Eric Meyer, and Blueprint CSS which is licensed under the GNU/GPL */
+
+
+
+/* CSS Reset */
+html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
+body {line-height:1.5;}
+table {border-collapse:separate;border-spacing:0;}
+caption, th, td {text-align:left;font-weight:normal;}
+table, td, th {vertical-align:middle;}
+blockquote:before, blockquote:after, q:before, q:after {content:"";}
+blockquote, q {quotes:"" "";}
+a img {border:none;}
+
+/* Typography */
+body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
+h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
+h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
+h2 {font-size:2em;margin-bottom:0.75em;}
+h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
+h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
+h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
+h6 {font-size:1em;font-weight:bold;}
+h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
+p {margin:0 0 1.5em;}
+p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
+p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
+a:focus, a:hover {color:#000;}
+a {color:#009;text-decoration:underline;}
+blockquote {margin:1.5em;color:#666;font-style:italic;}
+strong {font-weight:bold;}
+em, dfn {font-style:italic;}
+dfn {font-weight:bold;}
+sup, sub {line-height:0;}
+abbr, acronym {border-bottom:1px dotted #666;}
+address {margin:0 0 1.5em;font-style:italic;}
+del {color:#666;}
+pre {margin:1.5em 0;white-space:pre;}
+pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
+li ul, li ol {margin:0 1.5em;}
+ul, ol {margin:0 1.5em 1.5em 1.5em;}
+ul {list-style-type:disc;}
+ol {list-style-type:decimal;}
+dl {margin:0 0 1.5em 0;}
+dl dt {font-weight:bold;}
+dd {margin-left:1.5em;}
+table {margin-bottom:1.4em;width:100%;}
+th {font-weight:bold;}
+thead th {background:#c3d9ff;}
+th, td, caption {padding:4px 10px 4px 5px;}
+tr.even td {background:#e5ecf9;}
+tfoot {font-style:italic;}
+caption {background:#eee;}
+.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
+.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
+.hide {display:none;}
+.quiet {color:#666;}
+.loud {color:#000;}
+.highlight {background:#ff0;}
+.added {background:#060;color:#fff;}
+.removed {background:#900;color:#fff;}
+.first {margin-left:0;padding-left:0;}
+.last {margin-right:0;padding-right:0;}
+.top {margin-top:0;padding-top:0;}
+.bottom {margin-bottom:0;padding-bottom:0;}
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/templates/system/css/template_rtl.css 15/templates/system/css/template_rtl.css
--- 14/templates/system/css/template_rtl.css	1970-01-01 01:00:00.000000000 +0100
+++ 15/templates/system/css/template_rtl.css	2009-11-04 18:56:08.000000000 +0100
@@ -0,0 +1,78 @@
+/**
+ * CSS Document for the system template_rtl.css
+ * @version $Id: template_rtl.css
+ * @package Joomla
+ * @copyright Copyright (C) 2005 - 2009 Open Source Matters. All rights reserved.
+ * @license GNU/GPL, see LICENSE.php
+ * Joomla! is free software and parts of it may contain or be derived from the
+ * GNU General Public License or other free or open source software licenses.
+ * See COPYRIGHT.php for copyright notices and details.
+ */
+
+/* Based on work by Eric Meyer, and Blueprint CSS which is licenced under the GNU/GPL*/
+
+/* RTL */
+html {direction: rtl;}
+body{direction: rtl;}
+
+/* CSS Reset */
+html, body, div, span, object, table, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
+body {line-height:1.5;}
+table {border-collapse:separate;border-spacing:0;}
+caption, th, td {font-weight:normal;}
+table, td, th {vertical-align:middle;}
+blockquote:before, blockquote:after, q:before, q:after {content:"";}
+blockquote, q {quotes:"" "";}
+a img {border:none;}
+
+/* Typography */
+body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
+h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
+h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
+h2 {font-size:2em;margin-bottom:0.75em;}
+h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
+h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
+h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
+h6 {font-size:1em;font-weight:bold;}
+h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
+p {margin:0 0 1.5em;}
+p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
+p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
+a:focus, a:hover {color:#000;}
+a {color:#009;text-decoration:underline;}
+blockquote {margin:1.5em;color:#666;font-style:italic;}
+strong {font-weight:bold;}
+em, dfn {font-style:italic;}
+dfn {font-weight:bold;}
+sup, sub {line-height:0;}
+abbr, acronym {border-bottom:1px dotted #666;}
+address {margin:0 0 1.5em;font-style:italic;}
+del {color:#666;}
+pre {margin:1.5em 0;white-space:pre;}
+pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
+li ul, li ol {margin:0 1.5em;}
+ul, ol {margin:0 1.5em 1.5em 1.5em;}
+ul {list-style-type:disc;}
+ol {list-style-type:decimal;}
+dl {margin:0 0 1.5em 0;}
+dl dt {font-weight:bold;}
+dd {margin-left:1.5em;}
+table {margin-bottom:1.4em;width:100%;}
+th {font-weight:bold;}
+thead th {background:#c3d9ff;}
+th, td, caption {padding:4px 10px 4px 5px;}
+tr.even td {background:#e5ecf9;}
+tfoot {font-style:italic;}
+caption {background:#eee;}
+.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
+.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
+.hide {display:none;}
+.quiet {color:#666;}
+.loud {color:#000;}
+.highlight {background:#ff0;}
+.added {background:#060;color:#fff;}
+.removed {background:#900;color:#fff;}
+.first {margin-left:0;padding-left:0;}
+.last {margin-right:0;padding-right:0;}
+.top {margin-top:0;padding-top:0;}
+.bottom {margin-bottom:0;padding-bottom:0;}
\ No hay ningún carácter de nueva línea al final del fichero
diff -aruN --binary 14/templates/system/error.php 15/templates/system/error.php
--- 14/templates/system/error.php	2009-05-29 14:53:16.000000000 +0200
+++ 15/templates/system/error.php	2009-11-04 18:51:20.000000000 +0100
@@ -17,6 +17,9 @@
 <head>
 	<title><?php echo $this->error->code ?> - <?php echo $this->title; ?></title>
 	<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/system/css/error.css" type="text/css" />
+	<?php if($this->direction == 'rtl') : ?>
+	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/error_rtl.css" type="text/css" />
+	<?php endif; ?>
 </head>
 <body>
 	<div align="center">
