[pLog-svn] r6006 - in plog/trunk: . bin-devel class/action class/action/admin class/dao class/dao/status class/dao/userdata class/data class/data/forms class/database class/gallery/dao class/locale class/mail class/net class/summary/action class/summary/data class/summary/mail class/template class/test/tests/dao class/test/tests/locale class/test/tests/mail/phpmailer config imgs/admin js/tinymce js/tinymce/plugins/fullscreen/css js/tinymce/plugins/inlinepopups js/tinymce/plugins/inlinepopups/langs js/tinymce/plugins/table js/tinymce/plugins/table/images js/tinymce/plugins/table/langs js/tinymce/themes/advanced js/tinymce/themes/advanced/css js/tinymce/themes/advanced/images js/tinymce/themes/advanced/jscripts js/tinymce/themes/advanced/langs js/tinymce/themes/simple js/tinymce/themes/simple/css js/tinymce/utils locale locale/admin templates/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Tue Oct 23 06:05:56 EDT 2007


Author: mark
Date: 2007-10-23 06:05:55 -0400 (Tue, 23 Oct 2007)
New Revision: 6006

Added:
   plog/trunk/imgs/admin/icon_link-16.png
   plog/trunk/js/tinymce/themes/advanced/css/colorpicker.css
   plog/trunk/js/tinymce/themes/advanced/images/colors.jpg
   plog/trunk/locale/admin/locale_hu_HU.php
   plog/trunk/locale/locale_hu_HU.php
   plog/trunk/wizard
Removed:
   plog/trunk/js/tinymce/plugins/fullscreen/css/content.css
   plog/trunk/js/tinymce/plugins/inlinepopups/langs/en.js
   plog/trunk/wizard.php
Modified:
   plog/trunk/bin-devel/build-diff.sh
   plog/trunk/bin-devel/build-svn.sh
   plog/trunk/bin-devel/build-svn2.sh
   plog/trunk/class/action/action.class.php
   plog/trunk/class/action/admin/adminaddpostaction.class.php
   plog/trunk/class/action/admin/adminnewpostaction.class.php
   plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php
   plog/trunk/class/action/admin/adminupdatepostaction.class.php
   plog/trunk/class/dao/articlecategories.class.php
   plog/trunk/class/dao/articlenotifications.class.php
   plog/trunk/class/dao/articles.class.php
   plog/trunk/class/dao/status/genericstatuslist.class.php
   plog/trunk/class/dao/userdata/baseuserdataprovider.class.php
   plog/trunk/class/dao/userdata/joomlauserdataprovider.class.php
   plog/trunk/class/dao/userpermissions.class.php
   plog/trunk/class/data/forms/formvalidator.class.php
   plog/trunk/class/data/kses.class.php
   plog/trunk/class/data/textfilter.class.php
   plog/trunk/class/database/ltdb.class.php
   plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
   plog/trunk/class/locale/locale.class.php
   plog/trunk/class/mail/emailmessage.class.php
   plog/trunk/class/net/request.class.php
   plog/trunk/class/summary/action/blogprofileaction.class.php
   plog/trunk/class/summary/action/dofinishregister.class.php
   plog/trunk/class/summary/data/summarytools.class.php
   plog/trunk/class/summary/mail/confirmemailmessage.class.php
   plog/trunk/class/template/template.class.php
   plog/trunk/class/test/tests/dao/searchengine_test.class.php
   plog/trunk/class/test/tests/locale/locale_test.class.php
   plog/trunk/class/test/tests/mail/phpmailer/phpmailer_test.class.php
   plog/trunk/config/userdata.properties.php
   plog/trunk/js/tinymce/plugins/inlinepopups/editor_plugin_src.js
   plog/trunk/js/tinymce/plugins/table/images/buttons.gif
   plog/trunk/js/tinymce/plugins/table/images/table_delete_col.gif
   plog/trunk/js/tinymce/plugins/table/images/table_delete_row.gif
   plog/trunk/js/tinymce/plugins/table/langs/en.js
   plog/trunk/js/tinymce/plugins/table/table.htm
   plog/trunk/js/tinymce/themes/advanced/about.htm
   plog/trunk/js/tinymce/themes/advanced/color_picker.htm
   plog/trunk/js/tinymce/themes/advanced/css/editor_content.css
   plog/trunk/js/tinymce/themes/advanced/css/editor_ui.css
   plog/trunk/js/tinymce/themes/advanced/editor_template.js
   plog/trunk/js/tinymce/themes/advanced/editor_template_src.js
   plog/trunk/js/tinymce/themes/advanced/image.htm
   plog/trunk/js/tinymce/themes/advanced/jscripts/color_picker.js
   plog/trunk/js/tinymce/themes/advanced/jscripts/link.js
   plog/trunk/js/tinymce/themes/advanced/jscripts/source_editor.js
   plog/trunk/js/tinymce/themes/advanced/langs/en.js
   plog/trunk/js/tinymce/themes/advanced/link.htm
   plog/trunk/js/tinymce/themes/advanced/source_editor.htm
   plog/trunk/js/tinymce/themes/simple/css/editor_content.css
   plog/trunk/js/tinymce/themes/simple/editor_template_src.js
   plog/trunk/js/tinymce/tiny_mce-plog.js
   plog/trunk/js/tinymce/tiny_mce.js
   plog/trunk/js/tinymce/tiny_mce_popup.js
   plog/trunk/js/tinymce/tiny_mce_src.js
   plog/trunk/js/tinymce/utils/editable_selects.js
   plog/trunk/js/tinymce/utils/form_utils.js
   plog/trunk/js/tinymce/utils/mclayer.js
   plog/trunk/js/tinymce/utils/mctabs.js
   plog/trunk/js/tinymce/utils/validate.js
   plog/trunk/locale/admin/locale_ca_ES.php
   plog/trunk/locale/admin/locale_de_DE.php
   plog/trunk/locale/admin/locale_en_UK.php
   plog/trunk/locale/admin/locale_es_ES.php
   plog/trunk/locale/admin/locale_fr_FR.php
   plog/trunk/locale/admin/locale_gl_ES.php
   plog/trunk/locale/admin/locale_it_IT.php
   plog/trunk/locale/admin/locale_nl_NL.php
   plog/trunk/locale/admin/locale_ru_RU.php
   plog/trunk/locale/admin/locale_tt_RU.php
   plog/trunk/locale/admin/locale_zh_CN.php
   plog/trunk/locale/admin/locale_zh_TW.php
   plog/trunk/templates/admin/editarticlecategories_table.template
   plog/trunk/templates/admin/globalsettings_summary.template
Log:
Merge from LifeType 1.2 development branches rev. 5800:5900

Modified: plog/trunk/bin-devel/build-diff.sh
===================================================================
--- plog/trunk/bin-devel/build-diff.sh	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/bin-devel/build-diff.sh	2007-10-23 10:05:55 UTC (rev 6006)
@@ -72,6 +72,9 @@
 	cp $WORKFOLDER/$i $DESTFOLDER/$FOLDER
 done
 
+echo Error about wizard not existing is okay if it wasn't changed
+mv $DESTFOLDER/wizard $DESTFOLDER/wizard.php
+
 # finally, update the version.php file
 echo "Updating the version.php file..."
 VERNAME=`basename ${BRANCH2}`

Modified: plog/trunk/bin-devel/build-svn.sh
===================================================================
--- plog/trunk/bin-devel/build-svn.sh	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/bin-devel/build-svn.sh	2007-10-23 10:05:55 UTC (rev 6006)
@@ -125,6 +125,9 @@
 cp -f $WORKDIR/release/userdata.properties.php.dist $WORKDIR/config/userdata.properties.php
 rm -rf $WORKDIR/dist
 
+# regular users want to use the wizard
+mv $WORKDIR/wizard $WORKDIR/wizard.php
+
 # finally, update the version.php file
 message "Updating the version.php file..."
 VERNAME=`basename ${SVNTAG}`

Modified: plog/trunk/bin-devel/build-svn2.sh
===================================================================
--- plog/trunk/bin-devel/build-svn2.sh	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/bin-devel/build-svn2.sh	2007-10-23 10:05:55 UTC (rev 6006)
@@ -96,6 +96,9 @@
 cp -f $WORKDIR/release/config.properties.php.dist $WORKDIR/config/config.properties.php
 rm -rf $WORKDIR/dist
 
+# regular users want to use the wizard
+mv $WORKDIR/wizard $WORKDIR/wizard.php
+
 # finally, update the version.php file
 message "Updating the version.php file..."
 echo "<?php" > $WORKDIR/version.php

Modified: plog/trunk/class/action/action.class.php
===================================================================
--- plog/trunk/class/action/action.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/action/action.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -163,7 +163,7 @@
 			// use the FormValidator object to validate the data
 			$validationOk =  $this->_form->validate( $this->_request );
 			
-			// if something went wrong... let's do somethinga about it :)
+			// if something went wrong... let's do something about it :)
 			if( !$validationOk ) {
 				$this->validationErrorProcessing();
 			}
@@ -317,7 +317,6 @@
 					$this->_view->setValue( "$fieldName", $fieldValue );
 				}
 			}
-			
 			return true;
 		}
 		

Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -206,7 +206,7 @@
                         
 
                     	// get the links from the text of the post
-        				$postLinks = StringUtils::getLinks( stripslashes($article->getText()));
+        				$postLinks = StringUtils::getLinks( $article->getText());
 
 		                // get the real trackback links from trackbackUrls
 		                $trackbackLinks = Array();

Modified: plog/trunk/class/action/admin/adminnewpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewpostaction.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/action/admin/adminnewpostaction.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -46,8 +46,14 @@
         	// initialize the view
         	$this->_view = new AdminNewPostView( $this->_blogInfo );
             $this->_view->setValue( "sendNotification", $blogSettings->getValue( "default_send_notification" ));
+
+			// default global article category id
+			$config =& Config::getConfig();
+			$this->_view->setValue( "globalArticleCategoryId", $config->getValue( "default_global_article_category_id", 0 ));
+
             $this->setCommonData();
 
+
             // better to return true if everything fine
             return true;
         }

Modified: plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -125,10 +125,7 @@
 		
 		function _fetchCommonData()
 		{
-			if( ini_get( "magic_quotes_gpc" ))
-				$this->_postText = stripslashes($this->_request->getValue( "postText" ));
-			else
-				$this->_postText = $this->_request->getValue( "postText" );
+            $this->_postText = $this->_request->getValue( "postText" );
 			
 			// check if javascript code is allowed in posts
 			$config =& Config::getConfig();

Modified: plog/trunk/class/action/admin/adminupdatepostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatepostaction.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/action/admin/adminupdatepostaction.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -93,11 +93,8 @@
             }
 
              // if we got it, update some fields
-            $post->setTopic( stripslashes($this->_postTopic));
-            $postText = $this->_postText;
-            $post->setText( stripslashes($postText));
             $post->setTopic( $this->_postTopic );
-            $post->setText( $postText );
+            $post->setText( $this->_postText );
             $post->setCategoryIds( $this->_postCategories );
             $post->setStatus( $this->_postStatus );
             $post->setDateObject( $this->_postTimestamp );
@@ -171,8 +168,7 @@
                 // when a post is "published"
 			if( $post->getStatus() == POST_STATUS_PUBLISHED ) {
 				// get the links from the text of the post
-                $postLinks = StringUtils::getLinks(
-                    stripslashes($post->getText()));
+                $postLinks = StringUtils::getLinks($post->getText());
 
                 // get the real trackback links from trackbackUrls
                 $trackbackLinks = Array();

Modified: plog/trunk/class/dao/articlecategories.class.php
===================================================================
--- plog/trunk/class/dao/articlecategories.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/dao/articlecategories.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -177,8 +177,8 @@
             $result = Array();
             if( $onlyInMainPage && $categories ) {
             	foreach( $categories as $category )
-            		if( $category->getInMainPage())
-            			$result[] = $categories;
+            		if( $category->isInMainPage())
+            			$result[] = $category;
             }
             else
             	$result = $categories;

Modified: plog/trunk/class/dao/articlenotifications.class.php
===================================================================
--- plog/trunk/class/dao/articlenotifications.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/dao/articlenotifications.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -131,6 +131,8 @@
          	// create a new template service
          	$ts = new TemplateService();
             $messageTemplate = $ts->Template( EMAILNOTIFIER_TEMPLATE, "misc" );
+			// do not remove blank spaces, or else emails will look kind of weird
+			$messageTemplate->forceDisableTrimWhitespace = true;
             // add these two useful objects
 			$rg = $blogInfo->getBlogRequestGenerator();
 			// disable the xhtml mode, as some email clients cannot deal with it

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/dao/articles.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -634,14 +634,12 @@
             $numPostsPerDayQuery = "SELECT date
                                     FROM {$prefix}articles 
                                     WHERE status = 1 
-                                    AND blog_id = $blogId";
+                                    AND blog_id = $blogId
+                                    AND MONTH(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $month 
+                                    AND YEAR(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $year";
+
             if( !$blogSettings->getValue( "show_future_posts_in_calendar" )) {
-                $numPostsPerDayQuery .= " AND MONTH(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $month ";
-                $numPostsPerDayQuery .= " AND YEAR(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $year ";
                 $numPostsPerDayQuery .= " AND date <= NOW()";
-            } else {
-                $numPostsPerDayQuery .= " AND MONTH(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $month ";
-                $numPostsPerDayQuery .= " AND YEAR(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $year ";
             }
 
             $result = $this->Execute( $numPostsPerDayQuery );

Modified: plog/trunk/class/dao/status/genericstatuslist.class.php
===================================================================
--- plog/trunk/class/dao/status/genericstatuslist.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/dao/status/genericstatuslist.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -40,6 +40,8 @@
                     $statusList[ "$constant" ] = $value;
                 }
             }
+
+			asort( $statusList );
 			
             return $statusList;
         }

Modified: plog/trunk/class/dao/userdata/baseuserdataprovider.class.php
===================================================================
--- plog/trunk/class/dao/userdata/baseuserdataprovider.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/dao/userdata/baseuserdataprovider.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -98,7 +98,7 @@
 
             // check if the user is the owner of any blog
             $prefix = $this->getPrefix();
-            $owner = "SELECT * FROM {$prefix}blogs WHERE owner_id = ".$userid;			
+            $owner = "SELECT * FROM {$prefix}blogs WHERE owner_id = '".Db::qstr( $userid )."'";
 			if( $status != BLOG_STATUS_ALL ) 
 				$owner .= " AND status = '".LtDb::qstr( $status )."'";
            

Modified: plog/trunk/class/dao/userdata/joomlauserdataprovider.class.php
===================================================================
--- plog/trunk/class/dao/userdata/joomlauserdataprovider.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/dao/userdata/joomlauserdataprovider.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -45,7 +45,7 @@
             //phpbb2_users table is created upon installation, we can use it for joomla too
             //but better parameterize its name
             $this->_joomlaauxtable="joomla_users";
-
+            
             $this->_dbc =& Db::getNewDb( $host, $user, $pass, $db );                     
             
             //Oddly, there have been problems in reading Joomla! db in utf-8
@@ -67,15 +67,31 @@
          */
         function authenticateUser( $user, $pass )
         {
-	        $query = "SELECT * FROM ".$this->_joomladbprefix."users".
+        	$providerConfig = $this->getProviderConfiguration();
+        	if( $providerConfig->getValue( "useNewJoomlaAuth" )) {
+        		$query = "SELECT * FROM ".$this->_joomladbprefix."users".
 	        			" WHERE username = '".$user."'".
+	        			" AND block=".JOOMLA_USER_IS_ACTIVE;
+        		$result = $this->_dbc->Execute( $query );
+				if( !$result ) {
+	        		return false; // no such user
+				}
+				$row = $result->FetchRow();
+        		list($hash, $salt) = explode(':', $row['password']);
+				$cryptpass = md5($pass.$salt);
+				if ($hash != $cryptpass) {
+					return false; // password don;t match
+				}
+        	}
+        	else {
+        		$query = "SELECT * FROM ".$this->_joomladbprefix."users".
+	        			" WHERE username = '".$user."'".
 	        			" AND password = '".md5($pass)."'".
 	        			" AND block=".JOOMLA_USER_IS_ACTIVE;
-	        			
-	        $result = $this->_dbc->Execute( $query );
-	        	        
-	        if( !$result ){
-	        	return false;
+        		$result = $this->_dbc->Execute( $query );
+	        	if( !$result ){
+	        		return false;
+        		}
         	}
 	        	
             $ret = ($result->RecordCount() == 1);
@@ -98,16 +114,34 @@
         function getUserInfo( $user, $pass )
         {
         	//Query Joomla db
-	        $query = "SELECT * FROM ".$this->_joomladbprefix."users".
+        	$providerConfig = $this->getProviderConfiguration();
+        	if( $providerConfig->getValue( "useNewJoomlaAuth" )) {
+        		$query = "SELECT * FROM ".$this->_joomladbprefix."users".
 	        			" WHERE username = '".$user."'".
-	        			" AND password = '".md5($pass)."';".
-	                  
-	        $result = $this->_dbc->Execute( $query );
-	        
-	        if( !$result )
-	        	return false;
-	        	
-	        $row = $result->FetchRow();
+	        			" AND block=".JOOMLA_USER_IS_ACTIVE;
+        		$result = $this->_dbc->Execute( $query );
+				if( !$result ) { 
+	        		return false; // no such user
+				}
+				$row = $result->FetchRow();
+        		list($hash, $salt) = explode(':', $row['password']);
+				$cryptpass = md5($pass.$salt);
+				if ($hash != $cryptpass) {
+					return false; // password don;t match
+				}
+        	}
+        	else {
+        		$query = "SELECT * FROM ".$this->_joomladbprefix."users".
+	        			" WHERE username = '".$user."'".
+	        			" AND password = '".md5($pass)."'".
+	        			" AND block=".JOOMLA_USER_IS_ACTIVE;
+        		$result = $this->_dbc->Execute( $query );
+	        	if( !$result ) {
+	        		return false;
+	        	}
+	        	$row = $result->FetchRow();
+        	}
+        		        	
             $result->Close();
             
             $userid=$row["id"];

Modified: plog/trunk/class/dao/userpermissions.class.php
===================================================================
--- plog/trunk/class/dao/userpermissions.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/dao/userpermissions.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -223,8 +223,42 @@
 		 */
 		function getUsersWithPermission( $permId, $page = -1, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
 		{
-			// tbd
+			$query = "SELECT user_id FROM ".$this->getPrefix()."users_permissions WHERE permission_id = '".Db::qstr( $permId )."'";
+			
+			$result = $this->Execute( $query );
+			
+			if( !$result ) 
+				return( Array());
+				
+			$users = Array();
+			lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
+			$users = new Users();
+			while( $row = $result->FetchRow()) {
+				// we'll get them one by one so that we can make proper usage of the cache
+				$results[] = $users->getUserInfoFromId( $row["user_id"] );
+			}
+			
+			return( $results );
 		}        
+		
+		/**
+		 * Returns all users who have the given permission, identified by its name
+		 *
+		 * @param permName
+		 * @param page
+		 * @param itemsPerPage
+		 * Return an Array of UserInfo objects or an empty array if no users have this
+		 * permission.
+		 */
+		function getUsersWithPermissionByName( $permName, $page = -1, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
+		{
+			$perms = new Permissions();
+			$perm = $perms->getPermissionByName( $permName );
+			if( !$perm )
+				return Array();
+				
+			return( $this->getUsersWithPermission( $perm->getId(), $page, $itemsPerPage ));
+		}		
 
         /**
          * @private

Modified: plog/trunk/class/data/forms/formvalidator.class.php
===================================================================
--- plog/trunk/class/data/forms/formvalidator.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/data/forms/formvalidator.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -93,7 +93,7 @@
 			$validationResult = false;
 			$finalValidationResult = true;
 			
-			foreach( $this->_fieldValidators as $fieldName => $fieldValidationArrayInfo ) {			
+			foreach( $this->_fieldValidators as $fieldName => $fieldValidationArrayInfo ) {
 				// get the validator object
 				$fieldValidatorClass = $fieldValidationArrayInfo["validator"];
 				// and whether we should use it always or only when the field has a non-empty value

Modified: plog/trunk/class/data/kses.class.php
===================================================================
--- plog/trunk/class/data/kses.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/data/kses.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -76,10 +76,6 @@
 
 		function Parse($string = "")
 		{
-			if (get_magic_quotes_gpc())
-			{
-  				$string = stripslashes($string);
-			}
 			$string = $this->_no_null($string);
 			$string = $this->_js_entities($string);	
 			$string = $this->_normalize_entities($string);

Modified: plog/trunk/class/data/textfilter.class.php
===================================================================
--- plog/trunk/class/data/textfilter.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/data/textfilter.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -27,7 +27,6 @@
 
 		var $htmlAllowedTags;
 		var $removeJavaScript;
-		var $_smileys;
 
         /**
          * Constructor.
@@ -42,7 +41,6 @@
             
 			$config =& Config::getConfig();
 			$this->htmlAllowedTags = $config->getValue( "html_allowed_tags_in_comments" );
-			$this->_smileys = $config->getValue( "smileys" );
 		}
 
 		/**
@@ -561,6 +559,18 @@
 		}
 
 
+        function recursiveStripSlashes($obj){
+            foreach($obj as $key => $value){
+                if(is_array($value)){
+                    $obj[$key] = Textfilter::recursiveStripSlashes($value);
+                }
+                else{
+                    $obj[$key] = stripslashes($value);
+                }
+            }
+            return $obj;
+        }
+            
         
 		/**
 		 * @private

Modified: plog/trunk/class/database/ltdb.class.php
===================================================================
--- plog/trunk/class/database/ltdb.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/database/ltdb.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -147,8 +147,7 @@
 
 		/**
 		 * Prepares a string for an SQL query by escaping apostrophe
-		 * characters. If the PHP configuration setting 'magic_quotes_gpc'
-		 * is set to ON, it will first strip the added slashes. Apostrophe
+		 * characters. Apostrophe
 		 * characters are doubled, conforming with the ANSI SQL standard.
 		 * The SQL parser makes sure that the escape token is not entered
 		 * in the database so there is no need to modify the data when it
@@ -159,18 +158,8 @@
 		 * @access public
 		 */
 		function qstr($string) {
-
- 			if (get_magic_quotes_gpc()) {
-				$string = stripslashes($string);
-				//$string = stripslashes($string);
-		                $string = str_replace('\\\\', '\\', $string);
-                		$string = str_replace("\\'", "'", $string);
-         		        $string = str_replace('\\"', '"', $string);
- 			}
- 
 			$string = str_replace("\\", "\\\\", $string);
  			$string = str_replace("'", "''", $string);
-
 			return $string;
 		}
     }

Modified: plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresourcestorage.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/gallery/dao/galleryresourcestorage.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -37,6 +37,9 @@
 			if( $resourcesStorageFolder[strlen($resourcesStorageFolder)-1] != '/')
 				$resourcesStorageFolder .= "/";
 				
+			// if relative path, like e.g. "./gallery/"...
+			if (strpos($resourcesStorageFolder,'.') === 0)
+			    $resourcesStorageFolder = rtrim( PLOG_CLASS_PATH ,'/').ltrim($resourcesStorageFolder,'.');			
 			
 			return $resourcesStorageFolder;
 		}

Modified: plog/trunk/class/locale/locale.class.php
===================================================================
--- plog/trunk/class/locale/locale.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/locale/locale.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -492,7 +492,15 @@
 				$format = $this->_dateFormat;
 				
             // Get the unix time stamp 
-            $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+			if( strtolower(get_class( $timeStamp )) == "timestamp") {
+            	$time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+			}
+			else {
+				// we can assume it's a unix timestamp
+				$time = $timeStamp;
+				$timeStamp = new Timestamp( $time );
+			}
+			
             $timeZoneSec = date("Z", $time);
             if ( $blog ) {
                 //
@@ -663,7 +671,14 @@
 				$format = $this->_dateFormat;
 				
             // Get the unix time stamp 
-            $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+			if( strtolower(get_class( $timeStamp )) == "timestamp") {
+            	$time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+			}
+			else {
+				// we can assume it's a unix timestamp
+				$time = $timeStamp;
+				$timeStamp = new Timestamp( $time );
+			}
             $timeZoneSec = date("Z", $time);
             if ( $blog ) {
                 //

Modified: plog/trunk/class/mail/emailmessage.class.php
===================================================================
--- plog/trunk/class/mail/emailmessage.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/mail/emailmessage.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -50,6 +50,17 @@
         	array_push( $this->_toAddrs, rtrim($to) );
         }
 
+		/**
+		 * Resets the current list of destinations and adds this new one as the only one. 
+		 *
+         * @param to Destination address.
+		 */
+		function setTo( $to )
+		{
+			$this->_toAddrs = Array();
+			$this->addTo( $to );
+		}
+
         /**
          * Adds a Cc:
          *
@@ -60,6 +71,17 @@
         	array_push( $this->_ccAddrs, rtrim($cc) );
         }
 
+		/**
+		 * Resets the current list of Cc destinations and adds this new one as the only one. 
+		 *
+         * @param to Destination address.
+		 */
+		function setCc( $to )
+		{
+			$this->_ccAddrs = Array();
+			$this->addCc( $to );
+		}
+
         /**
          * Adds a Bcc address
          *
@@ -70,6 +92,17 @@
         	array_push( $this->_bccAddrs, rtrim($bcc) );
         }
 
+		/**
+		 * Resets the current list of Bcc destinations and adds this new one as the only one. 
+		 *
+         * @param to Destination address.
+		 */
+		function setBcc( $to )
+		{
+			$this->_bccAddrs = Array();
+			$this->addBcc( $to );
+		}
+
         /**
          * Sets the from address
          *

Modified: plog/trunk/class/net/request.class.php
===================================================================
--- plog/trunk/class/net/request.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/net/request.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,15 +1,7 @@
 <?php
-
-    
 	
+	lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
 
-    if ( !defined("CHECK_CONFIG_REQUEST_MODE") )
-        define( "CHECK_CONFIG_REQUEST_MODE", 0 );
-    if ( !defined("NORMAL_REQUEST_MODE") )
-        define( "NORMAL_REQUEST_MODE", 1 );
-    if ( !defined("SEARCH_ENGINE_FRIENDLY_MODE") )
-        define( "SEARCH_ENGINE_FRIENDLY_MODE", 2);
-
     /**
      * \ingroup Net
      *
@@ -31,16 +23,16 @@
         /**
          * Initializes the request object
          *
-         * @param values An associative array that will be used to initialize the object
+         * @param values An associative array that will be
+         *               used to initialize the object
          */
     	function Request( $values = null )
         {
-        	if( $values == null )
-        		$this->Properties();
-            else
-            	$this->Properties( $values );
-				
-			$this->_stripSlashes = true;
+            if(get_magic_quotes_gpc()){
+                $values = Textfilter::recursiveStripSlashes($values);
+            }
+            
+            $this->Properties( $values );
 
         }
 
@@ -117,4 +109,4 @@
 				return( false );
 		}
     }
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/summary/action/blogprofileaction.class.php
===================================================================
--- plog/trunk/class/summary/action/blogprofileaction.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/summary/action/blogprofileaction.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -22,7 +22,7 @@
             
             // data validation
             $this->registerFieldValidator( "blogId", new IntegerValidator());
-			$view = new SummaryView( "error" );
+			$view = new SummaryView( "summaryerror" );
 			$view->setValue( "message", $this->_locale->tr("error_incorrect_blog_id"));
 			$this->setValidationErrorView( $view );
         }
@@ -53,7 +53,7 @@
 			
 			// if there was no blog or the status was incorrect, let's not show it!
 			if( !$blogInfo || $blogInfo->getStatus() != BLOG_STATUS_ACTIVE ) {
-				$this->_view = new SummaryView( "error" );
+				$this->_view = new SummaryView( "summaryerror" );
 				$this->_view->setValue( "message", $this->_locale->tr("error_incorrect_blog_id"));
 				return false;
 			}

Modified: plog/trunk/class/summary/action/dofinishregister.class.php
===================================================================
--- plog/trunk/class/summary/action/dofinishregister.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/summary/action/dofinishregister.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -39,7 +39,7 @@
         function perform()
         {
             $this->_view = new SummaryView( "registererror" );
-            $this->need_confirm = $this->_config->getValue("need_email_confirm_registration");	        
+            $this->need_confirm = $this->_config->getValue("need_email_confirm_registration");
 	        
             $userId = $this->createUser();
             if( !$userId )
@@ -233,10 +233,43 @@
 
 			// post-blog create hook
 			$this->postBlogCreateHook( $blogInfo );
-
+			
             return true;
         }
 
+		/**
+		 * Sends a notification message to all site admins to inform them
+		 * that a new blog has just been created
+		 *
+		 * @private
+		 */
+		function notifyNewBlog( $blog )
+		{
+			// find all users who have the update_site_blog permission, as they are the only
+			// ones who are able to do anything about this registration, i.e. delete the blog
+			$userPerms = new UserPermissions();
+			$users = $userPerms->getUsersWithPermissionByName( "update_site_blog" );
+			
+			// laod the default locale
+			$locale =& Locales::getLocale();
+
+			// build up the message, as much as we can			
+			$config =& Config::getConfig();
+            $message = new EmailMessage();
+            $message->setFrom( $config->getValue( "post_notification_source_address" ));
+            $message->setSubject( $locale->tr("notification_subject" ));
+            $message->setCharset( $locale->getCharset());
+			$url = $this->_blogInfo->getBlogRequestGenerator();
+			$body = $locale->pr( "new_blog_admin_notification_text", $this->_blogInfo->getBlog(), $url->blogLink());
+            $message->setBody( $body );
+			
+	        $service = new EmailService();
+			foreach( $users as $user ) {
+            	$message->setTo( $user->getEmail());
+	            $service->sendMessage( $message );
+			}
+		}
+
         /**
          * finished registaration
 		 *
@@ -255,6 +288,12 @@
                 $this->_view->setValue( "blog", $this->_blogInfo );
             }
 
+			// notify admins if needed to inform that a new blog has been created
+			$config =& Config::getConfig();
+			if( $config->getValue( "notify_new_blogs", false )) {
+				$this->notifyNewBlog( $this->_blogInfo );
+			}
+
             $this->setCommonData();
             return true;
         }

Modified: plog/trunk/class/summary/data/summarytools.class.php
===================================================================
--- plog/trunk/class/summary/data/summarytools.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/summary/data/summarytools.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -26,6 +26,7 @@
 			// prepare the template
             $templateService = new TemplateService();
             $template = $templateService->Template( "resetpasswordemail", "summary" );
+			$template->forceDisableTrimWhitespace = true;
             $template->assign( "locale", $this->_locale );
 			$template->assign( "reseturl", $url );
 			

Modified: plog/trunk/class/summary/mail/confirmemailmessage.class.php
===================================================================
--- plog/trunk/class/summary/mail/confirmemailmessage.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/summary/mail/confirmemailmessage.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -44,6 +44,7 @@
         // create a new template service
         $ts = new TemplateService();
         $messageTemplate = $ts->Template( $templateid,$templateFolder );
+		$messageTemplate->forceDisableTrimWhitespace = true;
         $messageTemplate->assign("username",$this->username);
         $messageTemplate->assign("activeCode",$this->activeCode);
         $messageTemplate->assign("activeLink",$this->activeLink);

Modified: plog/trunk/class/template/template.class.php
===================================================================
--- plog/trunk/class/template/template.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/template/template.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -59,6 +59,12 @@
 
 		// whether to use the template load order settings
 		var $useTemplateLoadOrder = false;
+		
+		/**
+		 * Do not load the trim_whitespace plugin
+		 * @public
+		 */
+		var $forceDisableTrimWhitespace;
 
         /**
          * Constructor. 
@@ -74,8 +80,11 @@
             $config =& Config::getConfig();
             $this->cache_dir    = $config->getValue( 'temp_folder' );
 
-            $this->_templateFile = $templateFile;            
+            $this->_templateFile = $templateFile;
 
+			// we want to load the plugin by default...
+            $this->forceDisableTrimWhitespace = false;
+
             // enable the security settings
             $this->php_handling = false;
             	
@@ -191,6 +200,16 @@
             return $this->_templateFile;
         }
 
+		/**
+		 * Load all the required smarty filters
+		 */
+		function loadFilters()
+		{
+			$config =& Config::getConfig();
+			if( $config->getValue( 'trim_whitespace_output' ) && !$this->forceDisableTrimWhitespace )
+				$this->load_filter( 'output', 'trimwhitespace' );
+		}
+
         /**
          * Renders the template and returns the contents as an string
          *
@@ -198,6 +217,7 @@
          */
         function fetch()
         {
+			$this->loadFilters();
             return Smarty::fetch( $this->getTemplateFile());
         }
 
@@ -208,6 +228,7 @@
          */
         function display()
         {
+			$this->loadFilters();	
             return Smarty::display( $this->getTemplateFile());
         }
         

Modified: plog/trunk/class/test/tests/dao/searchengine_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/searchengine_test.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/test/tests/dao/searchengine_test.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -42,7 +42,7 @@
 		function tearDown()
 		{
 			TestTools::deleteDaoTestData(
-				Array( $this->user, $this->blog, $this->cat, $this->art1, $this->art2 )
+                Array( $this->art1, $this->art2, $this->cat, $this->blog, $this->user)
 			);
 		}
 		

Modified: plog/trunk/class/test/tests/locale/locale_test.class.php
===================================================================
--- plog/trunk/class/test/tests/locale/locale_test.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/test/tests/locale/locale_test.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -99,16 +99,19 @@
 		 */
 		function testFormatDateGMT()
 		{
-			$d = new Timestamp( "20070205230000" );			
+			$d = new Timestamp( "20070205120000" );
 			
+			$diff = $this->l->formatDate( new Timestamp(), "%O" );
+            $diff = $diff / 100;
+
 			$this->assertEquals( "Mon", $this->l->formatDateGMT( $d, "%a" ));
 			$this->assertEquals( "Monday", $this->l->formatDateGMT( $d, "%A" ));
 			$this->assertEquals( "Feb", $this->l->formatDateGMT( $d, "%b" ));
 			$this->assertEquals( "February", $this->l->formatDateGMT( $d, "%B" ));
 			$this->assertEquals( "05", $this->l->formatDateGMT( $d, "%d" ));
 			$this->assertEquals( "5", $this->l->formatDateGMT( $d, "%j" ));
-			$this->assertEquals( "21", $this->l->formatDateGMT( $d, "%H" ));
-			$this->assertEquals( "9", $this->l->formatDateGMT( $d, "%I" ));
+			$this->assertEquals( 12-$diff, $this->l->formatDateGMT( $d, "%H" ));
+			$this->assertEquals( "5", $this->l->formatDateGMT( $d, "%I" ));
 			$this->assertEquals( "pm", $this->l->formatDateGMT( $d, "%p" ));			
 			$this->assertEquals( "PM", $this->l->formatDateGMT( $d, "%P" ));						
 			$this->assertEquals( "00", $this->l->formatDateGMT( $d, "%M" ));			
@@ -124,7 +127,7 @@
 			$this->assertEquals( "Feb ", $this->l->formatDateGMT( $d, "%b " ));
 			$this->assertEquals( "Feb 5", $this->l->formatDateGMT( $d, "%b %j" ));
 			$this->assertEquals( "05/02/2007", $this->l->formatDateGMT( $d, "%d/%m/%Y" ));
-			$this->assertEquals( "05 February, 2007 21:00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));								
+			$this->assertEquals( "05 February, 2007 ".(12-$diff).":00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));								
 		}		
 	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/test/tests/mail/phpmailer/phpmailer_test.class.php
===================================================================
--- plog/trunk/class/test/tests/mail/phpmailer/phpmailer_test.class.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/class/test/tests/mail/phpmailer/phpmailer_test.class.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -84,7 +84,8 @@
         $this->Mail->SMTPAuth = false;
         $this->Mail->Username = "";
         $this->Mail->Password = "";
-        $this->Mail->PluginDir = $INCLUDE_DIR;
+            // need to set PluginDir if we use lt_include()
+        $this->Mail->PluginDir  = PLOG_CLASS_PATH."class/mail/phpmailer/";
 		$this->Mail->AddReplyTo("no_reply at phpmailer.sf.net", "Reply Guy");
         $this->Mail->Sender = "unit_test at phpmailer.sf.net";
 		// set the language or else we'll get silly errors

Modified: plog/trunk/config/userdata.properties.php
===================================================================
--- plog/trunk/config/userdata.properties.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/config/userdata.properties.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -6,7 +6,7 @@
 ####
 
 #
-# Default user data provider, plog's own one
+# Default user data provider, LifeType's own one
 #
 $config = Array( 
   "provider" => "LifeTypeUserDataProvider",
@@ -109,6 +109,7 @@
   "user" => "joomla_db_user",
   "password" => "joomla_db_pass",
   "prefix" => "jos_",
+  "useNewJoomlaAuth" => true,	// This is needed for Joomla 1.0.13 and higher
 
   // This string gets appended to the username and results
   // in "Username's Weblog"

Copied: plog/trunk/imgs/admin/icon_link-16.png (from rev 5900, plog/branches/lifetype-1.2/imgs/admin/icon_link-16.png)
===================================================================
(Binary files differ)

Deleted: plog/trunk/js/tinymce/plugins/fullscreen/css/content.css
===================================================================
--- plog/trunk/js/tinymce/plugins/fullscreen/css/content.css	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/plugins/fullscreen/css/content.css	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,3 +0,0 @@
-.mceItemFullScreenHidden {
-	display: none !important;
-}

Modified: plog/trunk/js/tinymce/plugins/inlinepopups/editor_plugin_src.js
===================================================================
--- plog/trunk/js/tinymce/plugins/inlinepopups/editor_plugin_src.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/plugins/inlinepopups/editor_plugin_src.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * $Id: editor_plugin_src.js 268 2007-04-28 15:52:59Z spocke $
  *
  * Moxiecode DHTML Windows script.
  *
@@ -88,14 +88,19 @@
 
 TinyMCE_Engine.prototype.closeWindow = function(win) {
 	var gotit = false, n, w;
+
 	for (n in mcWindows.windows) {
 		w = mcWindows.windows[n];
-		if (typeof(w) == 'function') continue;
+
+		if (typeof(w) == 'function')
+			continue;
+
 		if (win.name == w.id + '_iframe') {
 			w.close();
 			gotit = true;
 		}
 	}
+
 	if (!gotit)
 		this.orgCloseWindow(win);
 

Deleted: plog/trunk/js/tinymce/plugins/inlinepopups/langs/en.js
===================================================================
--- plog/trunk/js/tinymce/plugins/inlinepopups/langs/en.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/plugins/inlinepopups/langs/en.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1 +0,0 @@
-

Modified: plog/trunk/js/tinymce/plugins/table/images/buttons.gif
===================================================================
(Binary files differ)

Modified: plog/trunk/js/tinymce/plugins/table/images/table_delete_col.gif
===================================================================
(Binary files differ)

Modified: plog/trunk/js/tinymce/plugins/table/images/table_delete_row.gif
===================================================================
(Binary files differ)

Modified: plog/trunk/js/tinymce/plugins/table/langs/en.js
===================================================================
--- plog/trunk/js/tinymce/plugins/table/langs/en.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/plugins/table/langs/en.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -38,7 +38,7 @@
 bordercolor : 'Border color',
 bgcolor : 'Background color',
 merge_cells_title : 'Merge table cells',
-split_cells_desc : 'Split 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',

Modified: plog/trunk/js/tinymce/plugins/table/table.htm
===================================================================
--- plog/trunk/js/tinymce/plugins/table/table.htm	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/plugins/table/table.htm	2007-10-23 10:05:55 UTC (rev 6006)
@@ -62,7 +62,7 @@
 							  </tr>
 							  <tr>
 								<td class="column1"><label for="caption">{$lang_table_caption}</label></td> 
-								<td><input id="caption" name="caption" type="checkbox" value="true" /></td> 
+								<td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td> 
 							  </tr>
 							</table>
 				</fieldset>

Modified: plog/trunk/js/tinymce/themes/advanced/about.htm
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/about.htm	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/about.htm	2007-10-23 10:05:55 UTC (rev 6006)
@@ -21,7 +21,7 @@
 				<p>Version: {$tinymce_version} ({$tinymce_releasedate})</p>
 				<p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
 				by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
-				<p>Copyright &copy; 2003-2006, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
+				<p>Copyright &copy; 2003-2007, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
 				<p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
 
 				<div id="buttoncontainer"></div>

Modified: plog/trunk/js/tinymce/themes/advanced/color_picker.htm
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/color_picker.htm	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/color_picker.htm	2007-10-23 10:05:55 UTC (rev 6006)
@@ -2,12 +2,73 @@
 <head>
 	<title>{$lang_theme_colorpicker_title}</title>
 	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
 	<script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
+	<link href="css/colorpicker.css" rel="stylesheet" type="text/css" />
 	<base target="_self" />
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 3px; display: none">
-	<div align="center">
-	   <script language="javascript" type="text/javascript">renderColorMap();</script>
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+	<div class="tabs">
+		<ul>
+			<li id="picker_tab" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{$lang_color_picker_tab}</a></span></li>
+			<li id="rgb_tab"><span><a href="#" onclick="generateWebColors();mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{$lang_web_colors_tab}</a></span></li>
+			<li id="named_tab"><span><a  href="#" onclick="generateNamedColors();javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{$lang_named_colors_tab}</a></span></li>
+		</ul>
 	</div>
+
+	<div class="panel_wrapper">
+		<div id="picker_panel" class="panel current">
+			<fieldset>
+				<legend>{$lang_color_picker}</legend>
+				<div id="picker">
+					<img id="colorpicker" src="images/colors.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;" />
+
+					<div id="light">
+						<!-- Will be filled with divs -->
+					</div>
+
+					<br style="clear: both" />
+				</div>
+			</fieldset>
+		</div>
+
+		<div id="rgb_panel" class="panel">
+			<fieldset>
+				<legend>{$lang_web_colors}</legend>
+				<div id="webcolors">
+					<!-- Gets filled with web safe colors-->
+				</div>
+
+				<br style="clear: both" />
+			</fieldset>
+		</div>
+
+		<div id="named_panel" class="panel">
+			<fieldset>
+				<legend>{$lang_named_colors}</legend>
+				<div id="namedcolors">
+					<!-- Gets filled with named colors-->
+				</div>
+
+				<br style="clear: both" />
+
+				<div id="colornamecontainer">
+					{$lang_color_name} <span id="colorname"></span>
+				</div>
+			</fieldset>
+		</div>
+	</div>
+
+	<div class="mceActionPanel">
+		<div style="float: left">
+			<input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" onclick="insertAction();" />
+		</div>
+
+		<div id="preview"></div>
+
+		<div id="previewblock">
+			<label for="color">{$lang_color}</label> <input id="color" type="text" size="8" maxlength="8" class="text" />
+		</div>
+	</div>
 </body>
 </html>

Copied: plog/trunk/js/tinymce/themes/advanced/css/colorpicker.css (from rev 5900, plog/branches/lifetype-1.2/js/tinymce/themes/advanced/css/colorpicker.css)
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/css/colorpicker.css	                        (rev 0)
+++ plog/trunk/js/tinymce/themes/advanced/css/colorpicker.css	2007-10-23 10:05:55 UTC (rev 6006)
@@ -0,0 +1,53 @@
+/* Colorpicker dialog specific CSS */
+
+#preview {
+	float: right;
+	width: 50px;
+	height: 14px;
+	line-height: 1px;
+	border: 1px solid black;
+	margin-left: 5px;
+}
+
+#colorpicker {
+	float: left;
+	cursor: crosshair;
+}
+
+#light {
+	border: 1px solid gray;
+	margin-left: 5px;
+	float: left;
+	width: 15px;
+	cursor: crosshair;
+}
+
+#light div {
+	overflow: hidden;
+}
+
+#previewblock {
+	float: right;
+	padding-left: 10px;
+	height: 20px;
+}
+
+.panel_wrapper div.current {
+	height: 175px;
+}
+
+#namedcolors {
+	width: 150px;
+}
+
+#namedcolors a {
+	display: block;
+	float: left;
+	width: 10px; height: 10px;
+	margin: 1px 1px 0 0;
+	overflow: hidden;
+}
+
+#colornamecontainer {
+	margin-top: 5px;
+}
\ No newline at end of file

Modified: plog/trunk/js/tinymce/themes/advanced/css/editor_content.css
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/css/editor_content.css	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/css/editor_content.css	2007-10-23 10:05:55 UTC (rev 6006)
@@ -3,7 +3,7 @@
 
 body, td, pre {
 	font-family: Verdana, Arial, Helvetica, sans-serif;
-	font-size: 13px;
+	font-size: 10px;
 }
 
 body {

Modified: plog/trunk/js/tinymce/themes/advanced/css/editor_ui.css
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/css/editor_ui.css	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/css/editor_ui.css	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,97 +1,97 @@
 /* This file contains the CSS data for the editor UI of TinyMCE instances */
 
-.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0;  margin: 0;  padding: 0;  background: transparent;}
+.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0; margin: 0; padding: 0; background: transparent;}
 .mceSeparatorLine {border: 0; padding: 0; margin-left: 4px; margin-right: 2px;}
 .mceSelectList {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 7pt !important; font-weight: normal; margin-top: 3px; padding: 0; display: inline; vertical-align: top; background-color: #F0F0EE;}
 .mceLabel, .mceLabelDisabled {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt;}
 .mceLabel {color: #000000;}
-.mceLabelDisabled {cursor: text;  color: #999999;}
-.mceEditor {background: #F0F0EE;  border: 1px solid #cccccc;  padding: 0;  margin: 0;}
-.mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;  background: #FFFFFF;  padding: 0;  margin: 0;  }
-.mceToolbarTop, .mceToolbarBottom {background: #F0F0EE;  line-height: 1px;  font-size: 1px;}
+.mceLabelDisabled {cursor: text; color: #999999;}
+.mceEditor {background: #F0F0EE; border: 1px solid #cccccc; padding: 0; margin: 0;}
+.mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; background: #FFFFFF; padding: 0; margin: 0; }
+.mceToolbarTop, .mceToolbarBottom {background: #F0F0EE; line-height: 1px; font-size: 1px;}
 .mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;}
 .mceToolbarBottom {border-top: 1px solid #cccccc;}
-.mceToolbarContainer {position: relative;  left: 0;  top: 0;  display: block;}
+.mceToolbarContainer {display: block; position: relative; left: 0; top: 0; width: 100%;}
 .mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;}
-.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;  font-size: 9pt;  padding: 2px;  line-height: 16px;  overflow: visible;}
+.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; padding: 2px; line-height: 16px; overflow: visible;}
 .mceStatusbarTop {border-bottom: 1px solid #cccccc;}
 .mceStatusbarBottom {border-top: 1px solid #cccccc;}
 .mceStatusbar {border-bottom: 1px solid #cccccc;}
-.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none;  font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;  font-size: 9pt;  color: #000000;}
+.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none; font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; color: #000000;}
 .mcePathItem:hover {text-decoration: underline;}
 .mceStatusbarPathText {float: left;}
-.mceStatusbarResize {float: right;  background-image: url('../images/statusbar_resize.gif');  background-repeat: no-repeat;  width: 11px;  height: 20px;  cursor: se-resize;}
-.mceResizeBox {width: 10px;  height: 10px;  display: none;  border: 1px dotted gray;  margin: 0;  padding: 0;}
+.mceStatusbarResize {float: right; background-image: url('../images/statusbar_resize.gif'); background-repeat: no-repeat; width: 11px; height: 20px; cursor: se-resize;}
+.mceResizeBox {width: 10px; height: 10px; display: none; border: 1px dotted gray; margin: 0; padding: 0;}
 .mceEditorIframe {border: 0;}
 
 /* Button CSS rules */
 
-a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px;  height: 20px;  cursor: default;  margin-top: 1px;  margin-left: 1px;}
+a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px; height: 20px; cursor: default; margin-top: 1px; margin-left: 1px;}
 a.mceButtonDisabled img {border: 0 !important;}
 a.mceButtonNormal img, a.mceButtonSelected img {border: 1px solid #F0F0EE !important;}
-a.mceButtonSelected img {border: 1px solid #6779AA !important;  background-color: #D4D5D8;}
-a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important;  cursor: default;  background-color: #B6BDD2;}
-a.mceButtonDisabled img {-moz-opacity:0.3;  opacity: 0.3;  border: 1px solid #F0F0EE !important;  cursor: default;}
-a.mceTiledButton img {background-image: url('../images/buttons.gif');  background-repeat: no-repeat;}
+a.mceButtonSelected img {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important; cursor: default; background-color: #B6BDD2;}
+a.mceButtonDisabled img {-moz-opacity:0.3; opacity: 0.3; border: 1px solid #F0F0EE !important; cursor: default;}
+a.mceTiledButton img {background-image: url('../images/buttons.gif'); background-repeat: no-repeat;}
 
 /* Menu button CSS rules */
 
-span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE;  margin-left: 1px;}
-span.mceMenuButtonSelected img {border: 1px solid #6779AA;  background-color: #B6BDD2;}
-span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE;  background-color: transparent;}
-span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0;  margin-left: 0;}
-span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A;  background-color: #B6BDD2;}
+span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE; margin-left: 1px;}
+span.mceMenuButtonSelected img {border: 1px solid #6779AA; background-color: #B6BDD2;}
+span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE; background-color: transparent;}
+span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0; margin-left: 0;}
+span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A; background-color: #B6BDD2;}
 span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {border-left: 0;}
-span.mceMenuButtonFocus img {border: 1px solid gray;  border-right: 0;  margin-left: 1px;  background-color: #F5F4F2;}
-span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray;  border-left: 1px solid #F5F4F2;  margin-left: 0;}
-span.mceMenuHover img {border: 1px solid #0A246A;  background-color: #B6BDD2;}
-span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A;  background-color: #B6BDD2;  border-left: 0;}
+span.mceMenuButtonFocus img {border: 1px solid gray; border-right: 0; margin-left: 1px; background-color: #F5F4F2;}
+span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray; border-left: 1px solid #F5F4F2; margin-left: 0;}
+span.mceMenuHover img {border: 1px solid #0A246A; background-color: #B6BDD2;}
+span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A; background-color: #B6BDD2; border-left: 0;}
 
 /* Menu */
 
-.mceMenu {position: absolute;  left: 0;  top: 0;  display: none;  z-index: 100;  background-color: white;  border: 1px solid gray;  font-weight: normal;}
-.mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block;  width: 100%;  text-decoration: none;  background-color: white;  font-family: Tahoma, Verdana, Arial, Helvetica;  font-size: 11px;  line-height: 20px;  color: black;}
-.mceMenu a:hover {background-color: #B6BDD2;  color: black;  text-decoration: none !important;}
-.mceMenu span {padding-left: 10px;  padding-right: 10px;  display: block;  line-height: 20px;}
-.mceMenuSeparator {border-bottom: 1px solid gray;  background-color: gray;  height: 1px;}
+.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 1000; background-color: white; border: 1px solid gray; font-weight: normal;}
+.mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block; width: 100%; text-decoration: none; background-color: white; font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 11px; line-height: 20px; color: black;}
+.mceMenu a:hover {background-color: #B6BDD2; color: black; text-decoration: none !important;}
+.mceMenu span {padding-left: 10px; padding-right: 10px; display: block; line-height: 20px;}
+.mceMenuSeparator {border-bottom: 1px solid gray; background-color: gray; height: 1px;}
 .mceMenuTitle span {padding-left: 5px;}
-.mceMenuTitle {background-color: #DDDDDD;  font-weight: bold;}
+.mceMenuTitle {background-color: #DDDDDD; font-weight: bold;}
 .mceMenuDisabled {color: gray;}
-span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif');  background-repeat: no-repeat;  background-position: 5px 8px;  padding-left: 20px;}
+span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif'); background-repeat: no-repeat; background-position: 5px 8px; padding-left: 20px;}
 span.mceMenuCheckItem {padding-left: 20px;}
-span.mceMenuLine {display: block;  position: absolute;  left: 0;  top: -1px;  background-color: #F5F4F2;  width: 30px;  height: 1px;  overflow: hidden;  padding-left: 0;  padding-right: 0;}
-.mceColors table, .mceColors td {margin: 0;  padding: 2px;}
-a.mceMoreColors {width: 130px;  margin: 0;  padding: 0;  margin-left: 3px;  margin-bottom: 3px;  text-align: center;  border: 1px solid white;}
-.mceColorPreview {position: absolute;  left: 0;  top: 0;  margin-left: 3px;  margin-top: 15px;  width: 16px;  height: 4px;  background-color: red;}
+span.mceMenuLine {display: block; position: absolute; left: 0; top: -1px; background-color: #F5F4F2; width: 30px; height: 1px; overflow: hidden; padding-left: 0; padding-right: 0;}
+.mceColors table, .mceColors td {margin: 0; padding: 2px;}
+a.mceMoreColors {width: auto; padding: 0; margin: 0 3px 3px 3px; text-align: center; border: 1px solid white; text-decoration: none !important;}
+.mceColorPreview {position: absolute; overflow:hidden; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;}
 a.mceMoreColors:hover {border: 1px solid #0A246A;}
-.mceColors td a {width: 9px;  height: 9px;  overflow: hidden;  border: 1px solid #808080;}
+.mceColors td a {width: 9px; height: 9px; overflow: hidden; border: 1px solid #808080;}
 
 /* MSIE 6 specific rules */
 
-* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important;  margin-top: 2px;  margin-bottom: 1px;}
-* html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);  border: 0 !important;}
+* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;}
+* html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;}
 * html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
-* html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important;  cursor: default;}
-* html a.mceButtonSelected {border: 1px solid #6779AA !important;  background-color: #D4D5D8;}
-* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important;  background-color: #B6BDD2;  cursor: default;}
+* html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;}
+* html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;}
 * html .mceSelectList {margin-top: 2px;}
-* html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative;  left: 0;  top: 0;}
-* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative;  top: 1px;}
-* html a.mceMoreColors {width: 132px;}
-* html .mceColors td a {width: 10px;  height: 10px;}
-* html .mceColorPreview {margin-left: 2px;  margin-top: 14px;}
+* html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;}
+* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative; top: 1px;}
+* html a.mceMoreColors {width: auto;}
+* html .mceColors td a {width: 10px; height: 10px;}
+* html .mceColorPreview {margin-left: 2px; margin-top: 14px;}
 
 /* MSIE 7 specific rules */
 
-*:first-child+html a.mceButtonNormal img, *:first-child+html a.mceButtonSelected img, *:first-child+html a.mceButtonDisabled img {border: 0 !important;  margin-top: 2px;  margin-bottom: 1px;}
-*:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);  border: 0 !important;}
+*:first-child+html a.mceButtonNormal img, *:first-child+html a.mceButtonSelected img, *:first-child+html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;}
+*:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;}
 *:first-child+html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
-*:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important;  cursor: default;}
-*:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important;  background-color: #D4D5D8;}
-*:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important;  background-color: #B6BDD2;  cursor: default;}
+*:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;}
+*:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+*:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;}
 *:first-child+html .mceSelectList {margin-top: 2px;}
-*:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative;  left: 0;  top: 0;}
-*:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative;  top: 1px;}
-*:first-child+html a.mceMoreColors {width: 132px;}
-*:first-child+html .mceColors td a {width: 10px;  height: 10px;}
-*:first-child+html .mceColorPreview {margin: 0; padding-left: 4px;  margin-top: 14px; width: 14px;}
+*:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;}
+*:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative; top: 1px;}
+*:first-child+html a.mceMoreColors {width: 137px;}
+*:first-child+html .mceColors td a {width: 10px; height: 10px;}
+*:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;}

Modified: plog/trunk/js/tinymce/themes/advanced/editor_template.js
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/editor_template.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/editor_template.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1 +1 @@
-tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_AdvancedTheme={_defColors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",_autoImportCSSClasses:true,_resizer:{},_buttons:[['bold','{$lang_bold_img}','lang_bold_desc','Bold'],['italic','{$lang_italic_img}','lang_italic_desc','Italic'],['underline','{$lang_underline_img}','lang_underline_desc','Underline'],['strikethrough','strikethrough.gif','lang_striketrough_desc','Strikethrough'],['justifyleft','justifyleft.gif','lang_justifyleft_desc','JustifyLeft'],['justifycenter','justifycenter.gif','lang_justifycenter_desc','JustifyCenter'],['justifyright','justifyright.gif','lang_justifyright_desc','JustifyRight'],['justifyfull','justifyfull.gif','lang_justifyfull_desc','JustifyFull'],['bullist','b
 ullist.gif','lang_bullist_desc','InsertUnorderedList'],['numlist','numlist.gif','lang_numlist_desc','InsertOrderedList'],['outdent','outdent.gif','lang_outdent_desc','Outdent'],['indent','indent.gif','lang_indent_desc','Indent'],['cut','cut.gif','lang_cut_desc','Cut'],['copy','copy.gif','lang_copy_desc','Copy'],['paste','paste.gif','lang_paste_desc','Paste'],['undo','undo.gif','lang_undo_desc','Undo'],['redo','redo.gif','lang_redo_desc','Redo'],['link','link.gif','lang_link_desc','mceLink',true],['unlink','unlink.gif','lang_unlink_desc','unlink'],['image','image.gif','lang_image_desc','mceImage',true],['cleanup','cleanup.gif','lang_cleanup_desc','mceCleanup'],['help','help.gif','lang_help_desc','mceHelp'],['code','code.gif','lang_theme_code_desc','mceCodeEditor'],['hr','hr.gif','lang_theme_hr_desc','inserthorizontalrule'],['removeformat','removeformat.gif','lang_theme_removeformat_desc','removeformat'],['sub','sub.gif','lang_theme_sub_desc','subscript'],['sup','sup.gif','lan
 g_theme_sup_desc','superscript'],['forecolor','forecolor.gif','lang_theme_forecolor_desc','forecolor',true],['backcolor','backcolor.gif','lang_theme_backcolor_desc','HiliteColor',true],['charmap','charmap.gif','lang_theme_charmap_desc','mceCharMap'],['visualaid','visualaid.gif','lang_theme_visualaid_desc','mceToggleVisualAid'],['anchor','anchor.gif','lang_theme_anchor_desc','mceInsertAnchor'],['newdocument','newdocument.gif','lang_newdocument_desc','mceNewDocument']],_buttonMap:'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props
 ,split_cells,delete_table',getControlHTML:function(button_name){var i,x,but;for(i=0;i<TinyMCE_AdvancedTheme._buttons.length;i++){but=TinyMCE_AdvancedTheme._buttons[i];if(but[0]==button_name&&(button_name=="forecolor"||button_name=="backcolor"))return tinyMCE.getMenuButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3]+"Menu",but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null));if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null))}switch(button_name){case"formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',
 ');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}'],['div','{$lang_theme_div}'],['blockquote','{$lang_theme_blockquote}'],['code','{$lang_theme_code}'],['dt','{$lang_theme_dt}'],['dd','{$lang_theme_dd}'],['samp','{$lang_theme_samp}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0])html+='<option value="&lt;'+lookup[x][0]+'&gt;">'+lookup[x][1]+'</option>'}}html+='</select>';return html;case"styleselect":return'<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\'
 ,\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case"fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier
 ;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>'}}fontHTML+='</select>';return fontHTML;case"fontsizeselect":return'<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+'<option value="0">{$lang_theme_font_size}</option>'+'<option value="1">1 (8 pt)</option>'+'<option value="2">2 (10 pt)</option>'+'<option va
 lue="3">3 (12 pt)</option>'+'<option value="4">4 (14 pt)</option>'+'<option value="5">5 (18 pt)</option>'+'<option value="6">6 (24 pt)</option>'+'<option value="7">7 (36 pt)</option>'+'</select>';case"|":case"separator":return'<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />';case"spacer":return'<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';case"rowseparator":return'<br />'}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return true;case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text}e
 lse selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElem
 ent,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);")}action="update"}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class'])}else{tinyMCE.openWindow(template,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"})}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",al
 ign="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return true;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h)}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyM
 CE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:""}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);")}action="update"}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal
 ['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout'])}else tinyMCE.openWindow(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"forecolor":var fcp=new TinyMCE_Layer(editor_id+'_fcPreview',false),p,img,elm;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!fcp.exists()){fcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=fcp.getElement();elm._editor_id=editor_id;elm._command="forecolor";elm._switchId=editor_id+"_forecolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor
 _id+"_forecolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));fcp.moveTo(p.absLeft,p.absTop);fcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).foreColor;fcp.show();return false;case"forecolorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_fcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_text_colors','forecolor'));tinyMCE.switchClass(editor_id+'_forecolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_forecolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"HiliteColor":var bcp=new TinyMCE_Layer(editor_id+'_bcPreview',false),p,img;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!bcp.exists()){bcp.create('div','mceColorPreview',document.getElemen
 tById(editor_id+'_toolbar'));elm=bcp.getElement();elm._editor_id=editor_id;elm._command="HiliteColor";elm._switchId=editor_id+"_backcolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_backcolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));bcp.moveTo(p.absLeft,p.absTop);bcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).backColor;bcp.show();return false;case"HiliteColorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_bcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_background_colors','HiliteColor'));tinyMCE.switchClass(edit
 or_id+'_backcolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_backcolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=190;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:inputColor})}else{var savedVal=tinyMCE.lastColorPickerValue;var elm=savedVal['document
 '].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();')}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case"mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['h
 eight']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true}return false},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array(),skip;for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true}}if(!skip){outArray[outArray.length]=in_array[i]}}return outArray}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i]}return in_array}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var pa
 th=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&#160;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>'}TinyMCE_AdvancedTheme._autoImportCSSClasses=false}switch(layoutManager){case"SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_t
 oolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='<a href="#" accesskey="q" title="'+tinyMCE.getLang("lang_toolbar_focus")+'"';if(!tinyMCE.getParam("accessibility_focus"))toolbarHTML+=' onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"';toolbarHTML+='></a>';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tiny
 MCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23}}toolbarHTML+='<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"></a>';template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';if(toolbarLocation=="top"){template['html']+='<tr><td class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap"><span id="'+editorId+'_toolbar" class="mceToolba
 rContainer">'+toolbarHTML+'</span></td></tr>'}if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom"){template['html']+='<tr><td class="mceToolbarBottom" align="'+toolbarAlign+'" height="1"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>'}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=el
 m;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='</tbody></table>';break;case"RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor")template['html']+='<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==con
 tainers.length-1){pathClass="mceStatusbarBottom"}else if(i==0){pathClass="mceStatusbar"}else{deltaHeight-=2}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);curContainer=removeFromArray(curContainer,tinyMCE.getParam("theme_advanced_disable","",true,','));for(var j=0;j<curContainer.length;j++)curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>'}}template['html']+='</tbody></table>';break;case"CustomLayout":var customLayout=t
 inyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);")}break}if(resizing)template['html']+='<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template},initInstance:function(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true))}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink')},_handleMenuEvent:function(e){var te=tinyMCE.isMSIE?window.event.srcElement:e.target;tinyMCE._menuBut
 tonEvent(e.type=="mouseover"?"over":"out",document.getElementById(te._switchId));if(e.type=="click")tinyMCE.execInstanceCommand(te._editor_id,te._command)},_hideMenus:function(id){var fcml=new TinyMCE_Layer(id+'_fcMenu'),bcml=new TinyMCE_Layer(id+'_bcMenu');if(fcml.exists()&&fcml.isVisible()){tinyMCE.switchClass(id+'_forecolor','mceMenuButton');fcml.hide()}if(bcml.exists()&&bcml.isVisible()){tinyMCE.switchClass(id+'_backcolor','mceMenuButton');bcml.hide()}},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){var alignNode,breakOut,classNode;function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i<select_elm.options.length;i++){var ov=""+select_elm.options[i].value;if(first_index&&ov.toLowerCase().indexOf(value.toLowerCase())==0){select_elm.selectedIndex=i;return true}if(ov==value){select_elm.selectedIndex=i;return true}}}return false};function 
 getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):""};if(node==null)return;var pathElm=document.getElementById(editor_id+"_path");var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();TinyMCE_AdvancedTheme._hideMenus(editor_id);if(pathElm){var parentNode=node;var path=new Array();while(parentNode!=null){if(parentNode.nodeName.toUpperCase()=="BODY"){break}if(parentNode.nodeType==1&&tinyMCE.getAttrib(parentNode,"class").indexOf('mceItemHidden')==-1){path[path.length]=parentNode}parentNode=parentNode.parentNode}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName.indexOf("html:")==0)nodeName=nodeName.substring(5);if(nodeName=="b"){nodeName="strong"}if(nodeName=="i"){nodeName="em"}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeSty
 le(tinyMCE.parseStyle(st));nodeData+="style: "+st+" "}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+face+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+size+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+color+" "}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" "}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+src+" "}if(path[i].nodeName=='A'&&getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+href+" "}className=tinyM
 CE.getAttrib(path[i],"class");if((nodeName=="img"||nodeName=="span")&&className.indexOf('mceItem')!=-1){nodeName=className.replace(/mceItem([a-z]+)/gi,'$1').toLowerCase();nodeData=path[i].getAttribute('title')}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+anchor;nodeData=""}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+='<a title="'+nodeData+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" target="_self" class="mcePathItem">'+nodeName+'</a>';if(i>0){html+=" &raquo; "}}pathElm.innerHTML='<a href="#" accesskey="x"></a>'+tinyMCE.getLang('lang_theme_path')+": "+html+'&#160;'}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal
 ');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchCl
 ass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal')}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled')}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_
 undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode)!=null);selectElm.selectedIndex=index}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");else selectByValue(selectElm,"")}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="")}else{var elm
 =tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"")}else selectByValue(selectElm,"")}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size)}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"")}else selectByValue(selectElm,"0")}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align'))continue;switch(alignNode.getAttribute('a
 lign').toLowerCase()){case"left":tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case"right":tinyMCE.switchClass(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case"middle":case"center":tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case"justify":tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break}}while(!breakOut&&(alignNode=alignNode.parentNode)!=null);var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');if(!setup_content){var ar=new Array("Bold","_bold","Italic","_italic","Strikethrough","_strikethrough","superscript","_sup","subscript","_sub");for(var i=0;i<ar.length;i+=2){if(inst.queryCommandState(ar[i]))tinyMCE.switchClass(editor_id+ar[i+1],'mceButtonSelected')}if(inst.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.no
 deName!="A"))tinyMCE.switchClass(editor_id+'_underline','mceButtonSelected')}do{switch(node.nodeName){case"UL":tinyMCE.switchClass(editor_id+'_bullist','mceButtonSelected');break;case"OL":tinyMCE.switchClass(editor_id+'_numlist','mceButtonSelected');break;case"HR":tinyMCE.switchClass(editor_id+'_hr','mceButtonSelected');break;case"IMG":if(getAttrib(node,'name').indexOf('mce_')!=0&&tinyMCE.getAttrib(node,'class').indexOf('mceItem')==-1){tinyMCE.switchClass(editor_id+'_image','mceButtonSelected')}break}}while((node=node.parentNode)!=null)},_setupCSSClasses:function(editor_id){var i,selectElm;if(!TinyMCE_AdvancedTheme._autoImportCSSClasses)return;selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(i=0;i<csses.length;i++)selectElm.options[selectElm.options.length]=new Option(csses[i],csses[i])}if(csses!=null&&csses.length>0)selectElm.setAttribu
 te('cssImported','true')}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)
 tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGecko){iw-=2;ih-=2}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px"}}inst.useCSS=false},_resizeEventHandler:function(e){var resizer=TinyMCE_AdvancedTheme._resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case"mousemove":var w,h;w=resizer.width+dx;h=resizer.height+dy;w=w<1?1:w;h=h<1?1:h;if(resizer.horizontal)resizeBox.style.width=w+"px";resizeBox.style.height=h+"px";break;case"mouseup":TinyMCE_AdvancedTheme._setResizing(e,
 editorId,false);TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires)}break}},_setResizing:function(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_AdvancedTheme._resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.heig
 ht=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_AdvancedTheme._resizeEventHandler);resizer.eventHandlers=true}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true)}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE&&!tinyMCE.isOpera?"block":"table";tinyMCE.execCommand('mceResetDesignMode')}},_getColorHTML:fun
 ction(id,n,cm){var i,h,cl;h='<span class="mceMenuLine"></span>';cl=tinyMCE.getParam(n,TinyMCE_AdvancedTheme._defColors).split(',');h+='<table class="mceColors"><tr>';for(i=0;i<cl.length;i++){c='tinyMCE.execInstanceCommand(\''+id+'\', \''+cm+'\', false, \'#'+cl[i]+'\');';h+='<td><a href="javascript:'+c+'" style="background-color: #'+cl[i]+'" onclick="'+c+';return false;"></a></td>';if((i+1)%8==0)h+='</tr><tr>'}h+='</tr></table>';return h},_insertImage:function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!tinyMCE.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html)}else{if(!tinyMCE.img
 Element&&tinyMCE.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="'+tinyMCE.uniqueURL+'" />');else tinyMCE.selectedInstance.contentDocument.execCommand("insertimage",false,tinyMCE.uniqueURL);tinyMCE.imgElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"img","src",tinyMCE.uniqueURL)}}if(tinyMCE.imgElement){var needsRepaint=false;var msrc=src;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(tinyMCE.getParam('convert_urls'))msrc=src;if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=tinyMCE.imgElement.getAttribute("width")||height!=tinyMCE.imgElement.getAttribute("height")||ali
 gn!=tinyMCE.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(tinyMCE.imgElement,'src',src);tinyMCE.setAttrib(tinyMCE.imgElement,'mce_src',msrc);tinyMCE.setAttrib(tinyMCE.imgElement,'alt',alt);tinyMCE.setAttrib(tinyMCE.imgElement,'title',title);tinyMCE.setAttrib(tinyMCE.imgElement,'align',align);tinyMCE.setAttrib(tinyMCE.imgElement,'border',border,true);tinyMCE.setAttrib(tinyMCE.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'width',width,true);tinyMCE.setAttrib(tinyMCE.imgElement,'height',height,true);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseout',onmouseout);if(width&&width!="")tinyMCE.imgElement.style.pixelWidth=width;if(height&&height!="")tinyMCE.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint()}tinyMCE.execCommand('mceEndUndoLevel')},_insertLink:function(href,target,ti
 tle,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(tinyMCE.selectedInstance&&tinyMCE.selectedElement&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){var doc=tinyMCE.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true}var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(linkElement,'href',thref);tinyMCE.setAttrib(linkElement,'mce_href',mhref);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));tinyMCE.selectedElement.parentNode.replaceChild(linkElement,tinyMCE.selectedElement)}return}if(!tinyMCE.linkElem
 ent&&tinyMCE.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="'+tinyMCE.uniqueURL+'">'+tinyMCE.selectedInstance.selection.getSelectedHTML()+'</a>')}else tinyMCE.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i<elementArray.length;i++){var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(elementArray[i],'href',thref);tinyMCE.setAttrib(elementArray[i],'mce_href',mhref);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick
 );tinyMCE.setAttrib(elementArray[i],'class',style_class)}tinyMCE.linkElement=elementArray[0]}if(tinyMCE.linkElement){var mhref=href;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(tinyMCE.linkElement,'href',href);tinyMCE.setAttrib(tinyMCE.linkElement,'mce_href',mhref);tinyMCE.setAttrib(tinyMCE.linkElement,'target',target);tinyMCE.setAttrib(tinyMCE.linkElement,'title',title);tinyMCE.setAttrib(tinyMCE.linkElement,'onclick',onclick);tinyMCE.setAttrib(tinyMCE.linkElement,'class',style_class)}tinyMCE.execCommand('mceEndUndoLevel')}};tinyMCE.addTheme("advanced",TinyMCE_AdvancedTheme);tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
\ No newline at end of file
+tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_AdvancedTheme={_defColors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",_autoImportCSSClasses:true,_resizer:{},_buttons:[['bold','{$lang_bold_img}','lang_bold_desc','Bold'],['italic','{$lang_italic_img}','lang_italic_desc','Italic'],['underline','{$lang_underline_img}','lang_underline_desc','Underline'],['strikethrough','strikethrough.gif','lang_striketrough_desc','Strikethrough'],['justifyleft','justifyleft.gif','lang_justifyleft_desc','JustifyLeft'],['justifycenter','justifycenter.gif','lang_justifycenter_desc','JustifyCenter'],['justifyright','justifyright.gif','lang_justifyright_desc','JustifyRight'],['justifyfull','justifyfull.gif','lang_justifyfull_desc','JustifyFull'],['bullist','b
 ullist.gif','lang_bullist_desc','InsertUnorderedList'],['numlist','numlist.gif','lang_numlist_desc','InsertOrderedList'],['outdent','outdent.gif','lang_outdent_desc','Outdent'],['indent','indent.gif','lang_indent_desc','Indent'],['cut','cut.gif','lang_cut_desc','Cut'],['copy','copy.gif','lang_copy_desc','Copy'],['paste','paste.gif','lang_paste_desc','Paste'],['undo','undo.gif','lang_undo_desc','Undo'],['redo','redo.gif','lang_redo_desc','Redo'],['link','link.gif','lang_link_desc','mceLink',true],['unlink','unlink.gif','lang_unlink_desc','unlink'],['image','image.gif','lang_image_desc','mceImage',true],['cleanup','cleanup.gif','lang_cleanup_desc','mceCleanup'],['help','help.gif','lang_help_desc','mceHelp'],['code','code.gif','lang_theme_code_desc','mceCodeEditor'],['hr','hr.gif','lang_theme_hr_desc','inserthorizontalrule'],['removeformat','removeformat.gif','lang_theme_removeformat_desc','removeformat'],['sub','sub.gif','lang_theme_sub_desc','subscript'],['sup','sup.gif','lan
 g_theme_sup_desc','superscript'],['forecolor','forecolor.gif','lang_theme_forecolor_desc','forecolor',true],['forecolorpicker','forecolor.gif','lang_theme_forecolor_desc','forecolorpicker',true],['backcolor','backcolor.gif','lang_theme_backcolor_desc','HiliteColor',true],['backcolorpicker','backcolor.gif','lang_theme_backcolor_desc','backcolorpicker',true],['charmap','charmap.gif','lang_theme_charmap_desc','mceCharMap'],['visualaid','visualaid.gif','lang_theme_visualaid_desc','mceToggleVisualAid'],['anchor','anchor.gif','lang_theme_anchor_desc','mceInsertAnchor'],['newdocument','newdocument.gif','lang_newdocument_desc','mceNewDocument']],_buttonMap:'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,ins
 erttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',getControlHTML:function(button_name){var i,x,but;for(i=0;i<TinyMCE_AdvancedTheme._buttons.length;i++){but=TinyMCE_AdvancedTheme._buttons[i];if(but[0]==button_name&&(button_name=="forecolor"||button_name=="backcolor"))return tinyMCE.getMenuButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3]+"Menu",but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null));if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null))}switch(button_name){case"formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false
 ,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}'],['div','{$lang_theme_div}'],['blockquote','{$lang_theme_blockquote}'],['code','{$lang_theme_code}'],['dt','{$lang_theme_dt}'],['dd','{$lang_theme_dd}'],['samp','{$lang_theme_samp}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0])html+='<option value="&lt;'+lookup[x][0]+'&gt;">'+lookup[x][1]+'</option>'}}html+='</select>';return html;case"styleselect":return'<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSC
 lasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case"fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,
 times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>'}}fontHTML+='</select>';return fontHTML;case"fontsizeselect":return'<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedI
 ndex].value);" class="mceSelectList">'+'<option value="0">{$lang_theme_font_size}</option>'+'<option value="1">1 (8 pt)</option>'+'<option value="2">2 (10 pt)</option>'+'<option value="3">3 (12 pt)</option>'+'<option value="4">4 (14 pt)</option>'+'<option value="5">5 (18 pt)</option>'+'<option value="6">6 (24 pt)</option>'+'<option value="7">7 (36 pt)</option>'+'</select>';case"|":case"separator":return'<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" alt="" />';case"spacer":return'<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" alt="" />';case"rowseparator":return'<br />'}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes
 "});return true;case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkEl
 ement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);")}action="update"}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class'])}else{tinyMCE.openWindow(template,{href:
 href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"})}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return true;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h)}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttri
 b(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:""}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);")}action="update"}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, 
 width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout'])}else tinyMCE.openWindow(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"forecolor":var fcp=new TinyMCE_Layer(editor_id+'_fcPreview',false),p,img,elm;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!fcp.exists()){fcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=fcp.getElement();elm._editor_id=editor_id;elm._command="forecolor";elm._switchId=editor_id+"_forecolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyM
 CE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_forecolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));fcp.moveTo(p.absLeft,p.absTop);fcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).foreColor;fcp.show();return false;case"forecolorpicker":this._pickColor(editor_id,'forecolor');return true;case"forecolorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_fcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_text_colors','forecolor'));tinyMCE.switchClass(editor_id+'_forecolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_forecolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.is
 Opera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"HiliteColor":var bcp=new TinyMCE_Layer(editor_id+'_bcPreview',false),p,img;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!bcp.exists()){bcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=bcp.getElement();elm._editor_id=editor_id;elm._command="HiliteColor";elm._switchId=editor_id+"_backcolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_backcolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));bcp.moveTo(p.absLeft,p.absTop);bcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).backColor;bcp.show();return false;case"HiliteColorMenu":
 TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_bcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_background_colors','HiliteColor'));tinyMCE.switchClass(editor_id+'_backcolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_backcolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"backcolorpicker":this._pickColor(editor_id,'HiliteColor');return true;case"mceColorPicker":if(user_interface){var template=[];if(!value['callback']&&!value['color'])value['color']=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=380;template['height']=250;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_c
 olorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:value['color']})}else{var savedVal=tinyMCE.lastColorPickerValue,elm;if(savedVal['callback']){savedVal['callback'](value);return true}elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();')}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case"mceCharMap":var template=new Array();templa
 te['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_newdocument'))))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true}return false},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var 
 outArray=new Array(),skip;for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true}}if(!skip){outArray[outArray.length]=in_array[i]}}return outArray}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i]}return in_array}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&#160;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_
 theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>'}TinyMCE_AdvancedTheme._autoImportCSSClasses=false}switch(layoutManager){case"SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separ
 ator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='<a href="#" accesskey="q" title="'+tinyMCE.getLang("lang_toolbar_focus")+'"';if(!tinyMCE.getParam("accessibility_focus"))toolbarHTML+=' onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"';toolbarHTML+='></a>';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23}}toolbarHTML+
 ='<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"></a>';template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';if(toolbarLocation=="top")template['html']+='<tr><td dir="ltr" class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>';if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom")template['html']+='<tr><td dir="ltr" class="mceToolbarBottom" align="'+toolbarAlign+'" height="1"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>';if(toolbarLocation=="external
 "){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='</tbody></table>';break;case"RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",
 ");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor")template['html']+='<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom"}else if(i==0){pathClass="mceStatusbar"}else{deltaHeight-=2}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_c
 lass",defaultContainerCSS);curContainer=removeFromArray(curContainer,tinyMCE.getParam("theme_advanced_disable","",true,','));for(var j=0;j<curContainer.length;j++)curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>'}}template['html']+='</tbody></table>';break;case"CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);")}break}if(resizing)template['html']+='<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);if(!template['delta_width'])template['delta_width']=0;if(!template['delta_height'])template['delta_height']=deltaHeight;return template},initInstance:fu
 nction(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true))}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink')},removeInstance:function(inst){new TinyMCE_Layer(inst.editorId+'_fcMenu').remove();new TinyMCE_Layer(inst.editorId+'_bcMenu').remove()},hideInstance:function(inst){TinyMCE_AdvancedTheme._hideMenus(inst.editorId)},_handleMenuEvent:function(e){var te=tinyMCE.isMSIE?window.event.srcElement:e.target;tinyMCE._menuButtonEvent(e.type=="mouseover"?"over":"out",document.getElementById(te._switchId));if(e.type=="click")tinyMCE.execInstanceCommand(te._editor_id,te._command)},_hideMenus:function(id){var fcml=new TinyMCE_Layer(id+'_fcMenu'),bcml=new TinyMCE_L
 ayer(id+'_bcMenu');if(fcml.exists()&&fcml.isVisible()){tinyMCE.switchClass(id+'_forecolor','mceMenuButton');fcml.hide()}if(bcml.exists()&&bcml.isVisible()){tinyMCE.switchClass(id+'_backcolor','mceMenuButton');bcml.hide()}},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){var alignNode,breakOut,classNode;function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i<select_elm.options.length;i++){var ov=""+select_elm.options[i].value;if(first_index&&ov.toLowerCase().indexOf(value.toLowerCase())==0){select_elm.selectedIndex=i;return true}if(ov==value){select_elm.selectedIndex=i;return true}}}return false};if(node==null)return;var pathElm=document.getElementById(editor_id+"_path");var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();TinyMCE_AdvancedTheme._hideMenus(editor_id);if(pathElm){var parentNode=node;var path=new Array();while(par
 entNode!=null){if(parentNode.nodeName.toUpperCase()=="BODY"){break}if(parentNode.nodeType==1&&tinyMCE.getAttrib(parentNode,"class").indexOf('mceItemHidden')==-1){path[path.length]=parentNode}parentNode=parentNode.parentNode}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName.indexOf("html:")==0)nodeName=nodeName.substring(5);if(nodeName=="b"){nodeName="strong"}if(nodeName=="i"){nodeName="em"}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+tinyMCE.xmlEncode(st)+" "}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+tinyMCE.xmlEncode(face)+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="
 size: "+tinyMCE.xmlEncode(size)+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+tinyMCE.xmlEncode(color)+" "}if(tinyMCE.getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" "}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(tinyMCE.getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+tinyMCE.xmlEncode(src)+" "}if(path[i].nodeName=='A'&&tinyMCE.getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+tinyMCE.xmlEncode(href)+" "}className=tinyMCE.getAttrib(path[i],"class");if((nodeName=="img"||nodeName=="span")&&className.indexOf('mceItem')!=-1){nodeName=className.replace(/mceItem([a-z]+)/gi,'$1').toLowerCase();nodeData=path[i]
 .getAttribute('title')}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+tinyMCE.xmlEncode(anchor);nodeData=""}if(tinyMCE.getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+='<a title="'+nodeData+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" target="_self" class="mcePathItem">'+nodeName+'</a>';if(i>0){html+=" &raquo; "}}pathElm.innerHTML='<a href="#" accesskey="x"></a>'+tinyMCE.getLang('lang_theme_path')+": "+html+'&#160;'}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor
 _id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchClass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_ancho
 r','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal')}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled')}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);classNo
 de=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode)!=null);selectElm.selectedIndex=index}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");else selectByValue(selectElm,"")}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="")}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(se
 lectElm,family,family!=""))selectByValue(selectElm,"")}else selectByValue(selectElm,"")}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size)}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"")}else selectByValue(selectElm,"0")}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align'))continue;switch(alignNode.getAttribute('align').toLowerCase()){case"left":tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case"right":tinyMCE.switchClass(editor_id
 +'_justifyright','mceButtonSelected');breakOut=true;break;case"middle":case"center":tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case"justify":tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break}}while(!breakOut&&(alignNode=alignNode.parentNode)!=null);var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');if(!setup_content){var ar=new Array("Bold","_bold","Italic","_italic","Strikethrough","_strikethrough","superscript","_sup","subscript","_sub");for(var i=0;i<ar.length;i+=2){if(inst.queryCommandState(ar[i]))tinyMCE.switchClass(editor_id+ar[i+1],'mceButtonSelected')}if(inst.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A"))tinyMCE.switchClass(editor_id+'_underline','mceButtonSelected')}do{switch(node.nodeName){case"UL":tinyMCE.switchClass(editor_id+'_bullist','mceButt
 onSelected');break;case"OL":tinyMCE.switchClass(editor_id+'_numlist','mceButtonSelected');break;case"HR":tinyMCE.switchClass(editor_id+'_hr','mceButtonSelected');break;case"IMG":if(tinyMCE.getAttrib(node,'name').indexOf('mce_')!=0&&tinyMCE.getAttrib(node,'class').indexOf('mceItem')==-1){tinyMCE.switchClass(editor_id+'_image','mceButtonSelected')}break}}while((node=node.parentNode)!=null)},_setupCSSClasses:function(editor_id){var i,selectElm;if(!TinyMCE_AdvancedTheme._autoImportCSSClasses)return;selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(i=0;i<csses.length;i++)selectElm.options[selectElm.options.length]=new Option(csses[i],csses[i])}if(csses!=null&&csses.length>0)selectElm.setAttribute('cssImported','true')}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expir
 es.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGec
 ko){iw-=2;ih-=2}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px"}}inst.useCSS=false},_resizeEventHandler:function(e){var resizer=TinyMCE_AdvancedTheme._resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case"mousemove":var w,h;w=resizer.width+dx;h=resizer.height+dy;w=w<1?1:w;h=h<1?1:h;if(resizer.horizontal)resizeBox.style.width=w+"px";resizeBox.style.height=h+"px";break;case"mouseup":TinyMCE_AdvancedTheme._setResizing(e,editorId,false);TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);if(tinyMCE.getP
 aram("theme_advanced_resizing_use_cookie",true)){var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires)}break}},_setResizing:function(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_AdvancedTheme._resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";r
 esizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_AdvancedTheme._resizeEventHandler);resizer.eventHandlers=true}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true)}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE&&!tinyMCE.isOpera?"block":"table";tinyMCE.execCommand('mceResetDesignMode')}},_getColorHTML:function(id,n,cm){var i,h,cl;h='<span class="mceMenuLine"></span>';cl=tinyMCE.getParam(n,TinyMCE_AdvancedTheme._defColors).split(',');h+='<table class="mce
 Colors"><tr>';for(i=0;i<cl.length;i++){c='tinyMCE.execInstanceCommand(\''+id+'\', \''+cm+'\', false, \'#'+cl[i]+'\');';h+='<td><a href="javascript:'+c+'" style="background-color: #'+cl[i]+'" onclick="'+c+';return false;"></a></td>';if((i+1)%8==0)h+='</tr><tr>'}h+='</tr></table>';if(tinyMCE.getParam("theme_advanced_more_colors",true))h+='<a href="javascript:void(0);" onclick="TinyMCE_AdvancedTheme._pickColor(\''+id+'\',\''+cm+'\');" class="mceMoreColors">'+tinyMCE.getLang('lang_more_colors')+'</a>';return h},_pickColor:function(id,cm){var inputColor,inst=tinyMCE.selectedInstance;if(cm=='forecolor'&&inst)inputColor=inst.foreColor;if((cm=='backcolor'||cm=='HiliteColor')&&inst)inputColor=inst.backColor;tinyMCE.execCommand('mceColorPicker',true,{color:inputColor,callback:function(c){tinyMCE.execInstanceCommand(id,cm,false,c)}})},_insertImage:function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand("mceInsertContent",false,tinyMCE.
 createTagHTML('img',{src:tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src),mce_src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout}))},_insertLink:function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(tinyMCE.selectedInstance&&tinyMCE.selectedElement&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){var doc=tinyMCE.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true}var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(linkElement,'href',thref);tinyMCE.setAttrib(linkElement,'mce_href',mhref);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',ti
 tle);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));tinyMCE.selectedElement.parentNode.replaceChild(linkElement,tinyMCE.selectedElement)}return}if(!tinyMCE.linkElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="'+tinyMCE.uniqueURL+'">'+tinyMCE.selectedInstance.selection.getSelectedHTML()+'</a>')}else tinyMCE.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i<elementArray.length;i++){var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");mhref=t
 inyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(elementArray[i],'href',thref);tinyMCE.setAttrib(elementArray[i],'mce_href',mhref);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class)}tinyMCE.linkElement=elementArray[0]}if(tinyMCE.linkElement){var mhref=href;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(tinyMCE.linkElement,'href',href);tinyMCE.setAttrib(tinyMCE.linkElement,'mce_href',mhref);tinyMCE.setAttrib(tinyMCE.linkElement,'target',target);tinyMCE.setAttrib(tinyMCE.linkElement,'title',title);tinyMCE.setAttrib(tinyMCE.linkElement,'onclick',onclick);tinyMCE.setAttrib(tinyMCE.linkElement,'class',style_class)}tinyMCE.execCommand('mceEndUndoLevel')}};tinyMCE.addTheme("advanced",TinyMCE_AdvancedTheme);tinyMC
 E.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
\ No newline at end of file

Modified: plog/trunk/js/tinymce/themes/advanced/editor_template_src.js
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/editor_template_src.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/editor_template_src.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,8 +1,8 @@
 /**
- * $Id: editor_template_src.js 129 2006-10-23 09:45:17Z spocke $
+ * $Id: editor_template_src.js 296 2007-08-21 10:36:35Z spocke $
  *
  * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 /* Import theme specific language pack */
@@ -43,7 +43,9 @@
 		['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'],
 		['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'],
 		['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true],
+		['forecolorpicker', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolorpicker', true],
 		['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true],
+		['backcolorpicker', 'backcolor.gif', 'lang_theme_backcolor_desc', 'backcolorpicker', true],
 		['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'],
 		['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'],
 		['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'],
@@ -112,7 +114,7 @@
 			case "fontselect":
 				var fontHTML = '<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';
 				var iFonts = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
-				var nFonts = 'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
+				var nFonts = 'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
 				var fonts = tinyMCE.getParam("theme_advanced_fonts", nFonts).split(';');
 				for (i=0; i<fonts.length; i++) {
 					if (fonts[i] != '') {
@@ -138,10 +140,10 @@
 
 			case "|":
 			case "separator":
-				return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />';
+				return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" alt="" />';
 
 			case "spacer":
-				return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';
+				return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" alt="" />';
 
 			case "rowseparator":
 				return '<br />';
@@ -356,6 +358,10 @@
 
 				return false;
 
+			case "forecolorpicker":
+				this._pickColor(editor_id, 'forecolor');
+				return true;
+
 			case "forecolorMenu":
 				TinyMCE_AdvancedTheme._hideMenus(editor_id);
 
@@ -420,15 +426,21 @@
 
 				ml.show();
 			return true;
+	
+			case "backcolorpicker":
+				this._pickColor(editor_id, 'HiliteColor');
+				return true;
 
 			case "mceColorPicker":
 				if (user_interface) {
-					var template = new Array();
-					var inputColor = value['document'].getElementById(value['element_id']).value;
+					var template = [];
+	
+					if (!value['callback'] && !value['color'])
+						value['color'] = value['document'].getElementById(value['element_id']).value;
 
 					template['file'] = 'color_picker.htm';
-					template['width'] = 220;
-					template['height'] = 190;
+					template['width'] = 380;
+					template['height'] = 250;
 					template['close_previous'] = "no";
 
 					template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0);
@@ -438,10 +450,16 @@
 						value['store_selection'] = true;
 
 					tinyMCE.lastColorPickerValue = value;
-					tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : inputColor});
+					tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : value['color']});
 				} else {
-					var savedVal = tinyMCE.lastColorPickerValue;
-					var elm = savedVal['document'].getElementById(savedVal['element_id']);
+					var savedVal = tinyMCE.lastColorPickerValue, elm;
+
+					if (savedVal['callback']) {
+						savedVal['callback'](value);
+						return true;
+					}
+
+					elm = savedVal['document'].getElementById(savedVal['element_id']);
 					elm.value = value;
 
 					if (elm.onchange != null && elm.onchange != '')
@@ -486,7 +504,7 @@
 				return true;
 
 			case "mceNewDocument":
-				if (confirm(tinyMCE.getLang('lang_newdocument')))
+				if (confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_newdocument'))))
 					tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, ' ');
 
 				return true;
@@ -599,9 +617,8 @@
 				// Setup template html
 				template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';
 
-				if (toolbarLocation == "top") {
-					template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
-				}
+				if (toolbarLocation == "top")
+					template['html'] += '<tr><td dir="ltr" class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
 
 				if (statusbarLocation == "top") {
 					template['html'] += '<tr><td class="mceStatusbarTop" height="1">' + statusbarHTML + '</td></tr>';
@@ -610,9 +627,8 @@
 
 				template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';
 
-				if (toolbarLocation == "bottom") {
-					template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
-				}
+				if (toolbarLocation == "bottom")
+					template['html'] += '<tr><td dir="ltr" class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
 
 				// External toolbar changes
 				if (toolbarLocation == "external") {
@@ -713,9 +729,14 @@
 			template['html'] += '<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';
 
 		template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML);
-		template['delta_width'] = 0;
-		template['delta_height'] = deltaHeight;
 
+		// Set to default values
+		if (!template['delta_width'])
+			template['delta_width'] = 0;
+
+		if (!template['delta_height'])
+			template['delta_height'] = deltaHeight;
+
 		return template;
 	},
 
@@ -732,6 +753,15 @@
 		inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink');
 	},
 
+	removeInstance : function(inst) {
+		new TinyMCE_Layer(inst.editorId + '_fcMenu').remove();
+		new TinyMCE_Layer(inst.editorId + '_bcMenu').remove();
+	},
+
+	hideInstance : function(inst) {
+		TinyMCE_AdvancedTheme._hideMenus(inst.editorId);
+	},
+
 	_handleMenuEvent : function(e) {
 		var te = tinyMCE.isMSIE ? window.event.srcElement : e.target;
 		tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId));
@@ -782,10 +812,6 @@
 			return false;
 		};
 
-		function getAttrib(elm, name) {
-			return elm.getAttribute(name) ? elm.getAttribute(name) : "";
-		};
-
 		// No node provided
 		if (node == null)
 			return;
@@ -839,7 +865,7 @@
 					var st = tinyMCE.getAttrib(path[i], "style");
 					if (st != "") {
 						st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st));
-						nodeData += "style: " + st + " ";
+						nodeData += "style: " + tinyMCE.xmlEncode(st) + " ";
 					}
 				}
 
@@ -849,18 +875,18 @@
 
 					var face = tinyMCE.getAttrib(path[i], "face");
 					if (face != "")
-						nodeData += "font: " + face + " ";
+						nodeData += "font: " + tinyMCE.xmlEncode(face) + " ";
 
 					var size = tinyMCE.getAttrib(path[i], "size");
 					if (size != "")
-						nodeData += "size: " + size + " ";
+						nodeData += "size: " + tinyMCE.xmlEncode(size) + " ";
 
 					var color = tinyMCE.getAttrib(path[i], "color");
 					if (color != "")
-						nodeData += "color: " + color + " ";
+						nodeData += "color: " + tinyMCE.xmlEncode(color) + " ";
 				}
 
-				if (getAttrib(path[i], 'id') != "") {
+				if (tinyMCE.getAttrib(path[i], 'id') != "") {
 					nodeData += "id: " + path[i].getAttribute('id') + " ";
 				}
 
@@ -868,22 +894,22 @@
 				if (className != "" && className.indexOf('mceItem') == -1)
 					nodeData += "class: " + className + " ";
 
-				if (getAttrib(path[i], 'src') != "") {
+				if (tinyMCE.getAttrib(path[i], 'src') != "") {
 					var src = tinyMCE.getAttrib(path[i], "mce_src");
 
 					if (src == "")
 						 src = tinyMCE.getAttrib(path[i], "src");
 
-					nodeData += "src: " + src + " ";
+					nodeData += "src: " + tinyMCE.xmlEncode(src) + " ";
 				}
 
-				if (path[i].nodeName == 'A' && getAttrib(path[i], 'href') != "") {
+				if (path[i].nodeName == 'A' && tinyMCE.getAttrib(path[i], 'href') != "") {
 					var href = tinyMCE.getAttrib(path[i], "mce_href");
 
 					if (href == "")
 						 href = tinyMCE.getAttrib(path[i], "href");
 
-					nodeData += "href: " + href + " ";
+					nodeData += "href: " + tinyMCE.xmlEncode(href) + " ";
 				}
 
 				className = tinyMCE.getAttrib(path[i], "class");
@@ -894,11 +920,11 @@
 
 				if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
 					nodeName = "a";
-					nodeName += "#" + anchor;
+					nodeName += "#" + tinyMCE.xmlEncode(anchor);
 					nodeData = "";
 				}
 
-				if (getAttrib(path[i], 'name').indexOf("mce_") != 0) {
+				if (tinyMCE.getAttrib(path[i], 'name').indexOf("mce_") != 0) {
 					var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
 					if (className != "" && className.indexOf('mceItem') == -1) {
 						nodeName += "." + className;
@@ -1124,7 +1150,7 @@
 				break;
 
 				case "IMG":
-				if (getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
+				if (tinyMCE.getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
 					tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected');
 				}
 				break;
@@ -1371,86 +1397,42 @@
 		}
 
 		h += '</tr></table>';
-		/*
-		h += '<a href="" class="mceMoreColors">More colors</a>';
-		*/
 
+		if (tinyMCE.getParam("theme_advanced_more_colors", true))
+			h += '<a href="javascript:void(0);" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>';
+
 		return h;
 	},
 
-	_insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
-		tinyMCE.execCommand('mceBeginUndoLevel');
+	_pickColor : function(id, cm) {
+		var inputColor, inst = tinyMCE.selectedInstance;
 
-		if (src == "")
-			return;
+		if (cm == 'forecolor' && inst)
+			inputColor = inst.foreColor;
 
-		if (!tinyMCE.imgElement && tinyMCE.isSafari) {
-			var html = "";
+		if ((cm == 'backcolor' || cm == 'HiliteColor') && inst)
+			inputColor = inst.backColor;
 
-			html += '<img src="' + src + '" alt="' + alt + '"';
-			html += ' border="' + border + '" hspace="' + hspace + '"';
-			html += ' vspace="' + vspace + '" width="' + width + '"';
-			html += ' height="' + height + '" align="' + align + '" title="' + title + '" onmouseover="' + onmouseover + '" onmouseout="' + onmouseout + '" />';
+		tinyMCE.execCommand('mceColorPicker', true, {color : inputColor, callback : function(c) {
+			tinyMCE.execInstanceCommand(id, cm, false, c);
+		}});
+	},
 
-			tinyMCE.execCommand("mceInsertContent", false, html);
-		} else {
-			if (!tinyMCE.imgElement && tinyMCE.selectedInstance) {
-				if (tinyMCE.isSafari)
-					tinyMCE.execCommand("mceInsertContent", false, '<img src="' + tinyMCE.uniqueURL + '" />');
-				else
-					tinyMCE.selectedInstance.contentDocument.execCommand("insertimage", false, tinyMCE.uniqueURL);
-
-				tinyMCE.imgElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "img", "src", tinyMCE.uniqueURL);
-			}
-		}
-
-		if (tinyMCE.imgElement) {
-			var needsRepaint = false;
-			var msrc = src;
-
-			src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, tinyMCE.imgElement);");
-
-			if (tinyMCE.getParam('convert_urls'))
-				msrc = src;
-
-			if (onmouseover && onmouseover != "")
-				onmouseover = "this.src='" + eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, tinyMCE.imgElement);") + "';";
-
-			if (onmouseout && onmouseout != "")
-				onmouseout = "this.src='" + eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, tinyMCE.imgElement);") + "';";
-
-			// Use alt as title if it's undefined
-			if (typeof(title) == "undefined")
-				title = alt;
-
-			if (width != tinyMCE.imgElement.getAttribute("width") || height != tinyMCE.imgElement.getAttribute("height") || align != tinyMCE.imgElement.getAttribute("align"))
-				needsRepaint = true;
-
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'src', src);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'mce_src', msrc);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'alt', alt);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'title', title);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'align', align);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'border', border, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'hspace', hspace, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'vspace', vspace, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'width', width, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'height', height, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseover', onmouseover);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseout', onmouseout);
-
-			// Fix for bug #989846 - Image resize bug
-			if (width && width != "")
-				tinyMCE.imgElement.style.pixelWidth = width;
-
-			if (height && height != "")
-				tinyMCE.imgElement.style.pixelHeight = height;
-
-			if (needsRepaint)
-				tinyMCE.selectedInstance.repaint();
-		}
-
-		tinyMCE.execCommand('mceEndUndoLevel');
+	_insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
+		tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', {
+			src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src), // Force absolute
+			mce_src : src,
+			alt : alt,
+			border : border,
+			hspace : hspace,
+			vspace : vspace,
+			width : width,
+			height : height,
+			align : align,
+			title : title,
+			onmouseover : onmouseover,
+			onmouseout : onmouseout
+		}));
 	},
 
 	_insertLink : function(href, target, title, onclick, style_class) {

Modified: plog/trunk/js/tinymce/themes/advanced/image.htm
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/image.htm	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/image.htm	2007-10-23 10:05:55 UTC (rev 6006)
@@ -22,7 +22,7 @@
             <td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
             <td><table border="0" cellspacing="0" cellpadding="0">
                 <tr>
-                  <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();"></td>
+                  <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td>
                   <td id="srcbrowsercontainer">&nbsp;</td>
                 </tr>
               </table></td>
@@ -47,7 +47,7 @@
 		  <!-- /Image list -->
           <tr>
             <td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
-            <td><input id="alt" name="alt" type="text" value="" style="width: 200px"></td>
+            <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
           </tr>
           <tr>
             <td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
@@ -66,21 +66,21 @@
           </tr>
           <tr>
             <td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
-            <td><input id="width" name="width" type="text" value="" size="3" maxlength="3">
+            <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
               x
-              <input id="height" name="height" type="text" value="" size="3" maxlength="3"></td>
+              <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
           </tr>
           <tr>
             <td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
-            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3"></td>
+            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td>
           </tr>
           <tr>
             <td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
-            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3"></td>
+            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td>
           </tr>
           <tr>
             <td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
-            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3"></td>
+            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td>
           </tr>
         </table>
 		</div>

Copied: plog/trunk/js/tinymce/themes/advanced/images/colors.jpg (from rev 5900, plog/branches/lifetype-1.2/js/tinymce/themes/advanced/images/colors.jpg)
===================================================================
(Binary files differ)

Modified: plog/trunk/js/tinymce/themes/advanced/jscripts/color_picker.js
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/jscripts/color_picker.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/jscripts/color_picker.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,20 +1,5 @@
-function init() {
-	if (tinyMCE.isMSIE)
-		tinyMCEPopup.resizeToInnerSize();
-}
+var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
 
-function selectColor() {
-	var color = document.getElementById("selectedColorBox").value;
-
-	tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);
-	tinyMCEPopup.close();
-}
-
-function showColor(color) {
-	document.getElementById("selectedColor").style.backgroundColor = color;
-	document.getElementById("selectedColorBox").value = color;
-}
-
 var colors = new Array(
 	"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
 	"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
@@ -45,9 +30,71 @@
 	"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
 );
 
+var named = {
+	'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
+	'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown',
+	'#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue',
+	'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod',
+	'#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen',
+	'#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue',
+	'#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue',
+	'#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen',
+	'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey',
+	'#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory',
+	'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue',
+	'#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen',
+	'#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey',
+	'#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
+	'#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue',
+	'#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin',
+	'#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid',
+	'#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff',
+	'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue',
+	'#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver',
+	'#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen',
+	'#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
+	'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen'
+};
+
+function init() {
+	var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color'));
+
+	if (tinyMCE.isMSIE)
+		tinyMCEPopup.resizeToInnerSize();
+
+	generatePicker();
+
+	if (inputColor) {
+		changeFinalColor(inputColor);
+
+		col = convertHexToRGB(inputColor);
+
+		if (col)
+			updateLight(col.r, col.g, col.b);
+	}
+}
+
+function insertAction() {
+	var color = document.getElementById("color").value;
+
+	tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);
+	tinyMCEPopup.close();
+}
+
+function showColor(color, name) {
+	if (name)
+		document.getElementById("colorname").innerHTML = name;
+
+	document.getElementById("preview").style.backgroundColor = color;
+	document.getElementById("color").value = color;
+}
+
 function convertRGBToHex(col) {
 	var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
 
+	if (!col)
+		return col;
+
 	var rgb = col.replace(re, "$1,$2,$3").split(',');
 	if (rgb.length == 3) {
 		r = parseInt(rgb[0]).toString(16);
@@ -72,37 +119,122 @@
 		g = parseInt(col.substring(2, 4), 16);
 		b = parseInt(col.substring(4, 6), 16);
 
-		return "rgb(" + r + "," + g + "," + b + ")";
+		return {r : r, g : g, b : b};
 	}
 
-	return col;
+	return null;
 }
 
-function renderColorMap() {
-	var html = "";
-	var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color'));
+function generatePicker() {
+	var el = document.getElementById('light'), h = '', i;
 
-	html += '<table border="0" cellspacing="1" cellpadding="0">'
+	for (i = 0; i < detail; i++){
+		h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
+		+ ' onclick="changeFinalColor(this.style.backgroundColor)"'
+		+ ' onmousedown="isMouseDown = true; return false;"'
+		+ ' onmouseup="isMouseDown = false;"'
+		+ ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
+		+ ' onmouseover="isMouseOver = true;"'
+		+ ' onmouseout="isMouseOver = false;"'
+		+ '></div>';
+	}
+
+	el.innerHTML = h;
+}
+
+function generateWebColors() {
+	var el = document.getElementById('webcolors'), h = '', i;
+
+	if (el.className == 'generated')
+		return;
+
+	h += '<table border="0" cellspacing="1" cellpadding="0">'
 		+ '<tr>';
-	for (var i=0; i<colors.length; i++) {
-		html += '<td bgcolor="' + colors[i] + '">'
-			+ '<a href="javascript:selectColor();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');">'
+
+	for (i=0; i<colors.length; i++) {
+		h += '<td bgcolor="' + colors[i] + '">'
+			+ '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');">'
 			+ '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] +  '" alt="' + colors[i] +  '" /></a></td>';
 		if ((i+1) % 18 == 0)
-			html += '</tr><tr>';
+			h += '</tr><tr>';
 	}
-	html += '<tr><td colspan="18">'
-		+ '<table width="100%" border="0" cellspacing="0" cellpadding="0">'
-		+ '<tr><td>'
-		+ '<img id="selectedColor" style="background-color:' + tinyMCE.getWindowArg('input_color') + '" border="0" src="images/spacer.gif" width="80" height="16" />'
-		+ '</td><td align="right">'
-		+ '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" value="' + inputColor + '" />'
-		+ '</td></tr>'
-		+ '</table>'
-		+ '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>'
-		+ '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" onclick="tinyMCEPopup.close();" id="cancel" /></div>'
-		+ '</td></tr>'
-		+ '</table>';
 
-	document.write(html);
-}
\ No newline at end of file
+	h += '</table>';
+
+	el.innerHTML = h;
+	el.className = 'generated';
+}
+
+function generateNamedColors() {
+	var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
+
+	if (el.className == 'generated')
+		return;
+
+	for (n in named) {
+		v = named[n];
+		h += '<a href="javascript:insertAction();" onmouseover="showColor(\'' + n +  '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>'
+	}
+
+	el.innerHTML = h;
+	el.className = 'generated';
+}
+
+function dechex(n) {
+	return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);
+}
+
+function computeColor(e) {
+	var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB;
+
+	x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
+	y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
+
+	partWidth = document.getElementById('colorpicker').width / 6;
+	partDetail = detail / 2;
+	imHeight = document.getElementById('colorpicker').height;
+
+	r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
+	g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255	+ (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
+	b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);
+
+	coef = (imHeight - y) / imHeight;
+	r = 128 + (r - 128) * coef;
+	g = 128 + (g - 128) * coef;
+	b = 128 + (b - 128) * coef;
+
+	changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));
+	updateLight(r, g, b);
+}
+
+function updateLight(r, g, b) {
+	var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;
+
+	for (i=0; i<detail; i++) {
+		if ((i>=0) && (i<partDetail)) {
+			finalCoef = i / partDetail;
+			finalR = dechex(255 - (255 - r) * finalCoef);
+			finalG = dechex(255 - (255 - g) * finalCoef);
+			finalB = dechex(255 - (255 - b) * finalCoef);
+		} else {
+			finalCoef = 2 - i / partDetail;
+			finalR = dechex(r * finalCoef);
+			finalG = dechex(g * finalCoef);
+			finalB = dechex(b * finalCoef);
+		}
+
+		color = finalR + finalG + finalB;
+
+		document.getElementById('gs' + i).style.backgroundColor = '#'+color;
+	}
+}
+
+function changeFinalColor(color) {
+	if (color.indexOf('#') == -1)
+		color = convertRGBToHex(color);
+
+	document.getElementById('preview').style.backgroundColor = color;
+	document.getElementById('color').value = color;
+}
+
+window.focus();
\ No newline at end of file

Modified: plog/trunk/js/tinymce/themes/advanced/jscripts/link.js
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/jscripts/link.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/jscripts/link.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -50,6 +50,14 @@
 	}
 }
 
+function checkPrefix(n) {
+	if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCE.getLang('lang_is_email')))
+		n.value = 'mailto:' + n.value;
+
+	if (/^\s*www./i.test(n.value) && confirm(tinyMCE.getLang('lang_is_external')))
+		n.value = 'http://' + n.value;
+}
+
 function insertLink() {
 	var href = document.forms[0].href.value;
 	var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value;
@@ -57,10 +65,6 @@
 	var style_class = document.forms[0].styleSelect ? document.forms[0].styleSelect.value : "";
 	var dummy;
 
-	// Make anchors absolute
-	if (href.charAt(0) == '#')
-		href = tinyMCE.settings['document_base_url'] + href;
-
 	if (target == '_self')
 		target = '';
 

Modified: plog/trunk/js/tinymce/themes/advanced/jscripts/source_editor.js
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/jscripts/source_editor.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/jscripts/source_editor.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -25,7 +25,7 @@
 
 	s.wrap = val;
 
-	if (tinyMCE.isGecko) {
+	if (tinyMCE.isGecko || tinyMCE.isOpera) {
 		var v = s.value;
 		var n = s.cloneNode(false);
 		n.setAttribute("wrap", val);
@@ -47,14 +47,13 @@
 	var el = document.getElementById('htmlSource');
 
 	if (!tinyMCE.isMSIE) {
-		 wHeight = self.innerHeight-80;
-		 wWidth = self.innerWidth-16;
+		 wHeight = self.innerHeight - 60;
+		 wWidth = self.innerWidth - 16;
 	} else {
-		 wHeight = document.body.clientHeight - 80;
+		 wHeight = document.body.clientHeight - 60;
 		 wWidth = document.body.clientWidth - 16;
 	}
 
 	el.style.height = Math.abs(wHeight) + 'px';
 	el.style.width  = Math.abs(wWidth) + 'px';
 }
-

Modified: plog/trunk/js/tinymce/themes/advanced/langs/en.js
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/langs/en.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/langs/en.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -78,5 +78,16 @@
 not_set : '-- Not set --',
 close : 'Close',
 toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
-invalid_data : 'Error: Invalid values entered, these are marked in red.'
+invalid_data : 'Error: Invalid values entered, these are marked in red.',
+more_colors : 'More colors',
+color_picker_tab : 'Picker',
+color_picker : 'Color picker',
+web_colors_tab : 'Palette',
+web_colors : 'Palette colors',
+named_colors_tab : 'Named',
+named_colors : 'Named colors',
+color : 'Color:',
+color_name : 'Name:',
+is_email : 'The URL you entered seems to be an email address, do you want to add the required mailto: prefix?',
+is_external : 'The URL you entered seems to external link, do you want to add the required http:// prefix?'
 });

Modified: plog/trunk/js/tinymce/themes/advanced/link.htm
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/link.htm	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/link.htm	2007-10-23 10:05:55 UTC (rev 6006)
@@ -4,6 +4,7 @@
 	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
 	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
 	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
 	<script language="javascript" type="text/javascript" src="jscripts/link.js"></script>
 	<base target="_self" />
 </head>
@@ -23,7 +24,7 @@
             <td nowrap="nowrap"><label for="href">{$lang_insert_link_url}</label></td>
             <td><table border="0" cellspacing="0" cellpadding="0"> 
 				  <tr> 
-					<td><input id="href" name="href" type="text" value="" style="width: 200px" /></td> 
+					<td><input id="href" name="href" type="text" value="" style="width: 200px" onchange="checkPrefix(this);" /></td> 
 					<td id="hrefbrowsercontainer">&nbsp;</td>
 				  </tr> 
 				</table></td>

Modified: plog/trunk/js/tinymce/themes/advanced/source_editor.htm
===================================================================
--- plog/trunk/js/tinymce/themes/advanced/source_editor.htm	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/advanced/source_editor.htm	2007-10-23 10:05:55 UTC (rev 6006)
@@ -16,7 +16,7 @@
 
 		<br style="clear: both" />
 
-		<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px" dir="ltr" wrap="off"></textarea>
+		<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px" dir="ltr" wrap="off"></textarea>
 
 		<div class="mceActionPanel">
 			<div style="float: left">

Modified: plog/trunk/js/tinymce/themes/simple/css/editor_content.css
===================================================================
--- plog/trunk/js/tinymce/themes/simple/css/editor_content.css	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/simple/css/editor_content.css	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,6 +1,6 @@
 body, td, pre {
 	font-family: Verdana, Arial, Helvetica, sans-serif;
-	font-size: 13px;
+	font-size: 10px;
 }
 
 body {

Modified: plog/trunk/js/tinymce/themes/simple/editor_template_src.js
===================================================================
--- plog/trunk/js/tinymce/themes/simple/editor_template_src.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/themes/simple/editor_template_src.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,8 +1,8 @@
 /**
- * $Id: editor_template_src.js 114 2006-10-17 09:29:32Z spocke $
+ * $Id: editor_template_src.js 162 2007-01-03 16:16:52Z spocke $
  *
  * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 var TinyMCE_SimpleTheme = {

Modified: plog/trunk/js/tinymce/tiny_mce-plog.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce-plog.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/tiny_mce-plog.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -7,13 +7,11 @@
     fix_list_elements : true,
 	remove_script_host : false,
 	force_p_newlines : true,
+    hide_selects_on_submit: false,
 	cleanup_on_startup : true,	
-	theme_advanced_buttons1 : "fontsizeselect,fontselect,forecolor,backcolor,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull",
-	theme_advanced_buttons2 : "bullist,numlist,indent,outdent,separator,link,unlink,image,insertresource,insertvideo,insertaudio,emotions,separator,hr,insertdate,inserttime,separator,fullscreen,separator,code,more",
-	theme_advanced_buttons3 : "",
-	fullscreen_settings : {
-                theme_advanced_buttons3 : "tablecontrols"
-        },	
+    theme_advanced_buttons1: "fontsizeselect,fontselect,forecolor,backcolor,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,cleanup,removeformat",
+    theme_advanced_buttons2: "bullist,numlist,indent,outdent,separator,undo,redo,separator,link,unlink,image,insertresource,insertvideo,insertaudio,emotions,separator,hr,charmap,insertdate,inserttime,separator,fullscreen,separator,code,more",
+    theme_advanced_buttons3: "",
 	theme_advanced_toolbar_location : "top",
 	theme_advanced_toolbar_align : "left",
 	theme_advanced_path_location : "bottom",
@@ -21,7 +19,7 @@
 	theme_advanced_resize_horizontal : false,
 	convert_fonts_to_spans: true,
     remove_linebreaks: false,
-	extended_valid_elements : "a[class|name|id|href|target|title|onclick|rel],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
+	extended_valid_elements : "a[class|name|id|href|target|title|onclick|rel],img[class|src|border|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
 	verify_html : true,
 	valid_elements : ""
 	+"a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name"

Modified: plog/trunk/js/tinymce/tiny_mce.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/tiny_mce.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1 +1 @@
-function TinyMCE_Engine(){var ua;this.majorVersion="2";this.minorVersion="1.0";this.releaseDate="2007-02-13";this.instances=new Array();this.switchClassCache=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.pendingFiles=new Array();this.loadingIndex=0;this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.log=new Array();this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isMSIE7=this.isMSIE&&(ua.indexOf('MSIE 7')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=ua.indexOf('Opera')!=-1;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=new Array();this.themes=new Array();this.m
 enus=new Array();this.loadedPlugins=new Array();this.buttonMap=new Array();this.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false}this.isIE=this.isMSIE;this.isRealIE=this.isMSIE&&!this.isOpera;this.idCounter=0};TinyMCE_Engine.prototype={init:function(settings){var theme,nl,baseHREF="",i;if(this.isMSIE5_0)return;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');nl=document.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)baseHREF=nl[i].href}for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_dev.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1||src.indexOf('_dev')!=-1)?'_src':'';tinyMCE.gzipMode=src.indexOf('_gzip')!=-1;src
 =src.substring(0,src.lastIndexOf('/'));if(settings.exec_mode=="src"||settings.exec_mode=="normal")tinyMCE.srcMode=settings.exec_mode=="src"?'_src':'';if(baseHREF!=""&&src.indexOf('://')==-1)tinyMCE.baseURL=baseHREF+src;else tinyMCE.baseURL=src;break}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL}this._def("mode","none");this._def("theme","advanced");this._def("plugins","",true);this._def("language","en");this._def("docs_language",this.settings['language']);this._def("elements","");this._def("textarea_trigger","mce_editable");this._def("editor_selector","");this._def("editor_deselector
 ","mceNoEditor");this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[i
 d|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");this._def("extended_valid_elements","");this._def("invalid_elements","");this._def("encoding","");this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));this._def("sa
 ve_callback","");this._def("debug",false);this._def("force_br_newlines",false);this._def("force_p_newlines",true);this._def("add_form_submit_trigger",true);this._def("relative_urls",true);this._def("remove_script_host",true);this._def("focus_alert",true);this._def("document_base_url",this.documentURL);this._def("visual",true);this._def("visual_table_class","mceVisualAid");this._def("setupcontent_callback","");this._def("fix_content_duplication",true);this._def("custom_undo_redo",true);this._def("custom_undo_redo_levels",-1);this._def("custom_undo_redo_keyboard_shortcuts",true);this._def("custom_undo_redo_restore_selection",true);this._def("custom_undo_redo_global",false);this._def("verify_html",true);this._def("apply_source_formatting",false);this._def("directionality","ltr");this._def("cleanup_on_startup",false);this._def("inline_styles",false);this._def("convert_newlines_to_brs",false);this._def("auto_reset_designmode",true);this._def("entities","39,#39,160,nbsp,161,iexcl,
 162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Del
 ta,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,883
 6,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",true);this._def("entity_encoding","named");this._def("cleanup_callback","");this._def("add_unload_trigger",true);this._def("ask",false);this._def("nowrap",false);this._def("auto_resize",false);this._def("auto_focus",false);this._def("cleanup",true);this._def("remove_linebreaks",true);this._def("button_tile_map",false);this._def("submit_patch",true);this._def("browsers","msie,safari,gecko,opera",true);this._def("dialog_type","window");this._def("accessibility_warnings",
 true);this._def("accessibility_focus",true);this._def("merge_styles_invalid_parents","");this._def("force_hex_style_colors",true);this._def("trim_span_elements",true);this._def("convert_fonts_to_spans",false);this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",true);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",'');this._def("gecko_spellcheck",false);this._def("hide_selects_on_submit",true);if(this.isMSIE&&!this.
 isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings['browsers'].indexOf('msie')==-1)return;if(this.isGecko&&this.settings['browsers'].indexOf('gecko')==-1)return;if(this.isSafari&&this.settings['browsers'].indexOf('safari')==-1)return;if(this.isOpera&&this.settings['browsers'].indexOf('opera')==-1)return;baseHREF=tinyMCE.settings['document_base_url'];var h=document.location.href;var p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings['document_base_url']=baseHREF;tinyMCE.settings['document_base_prefix']=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';t
 his.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.uniqueURL='javascript:void(091039730);';this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';this.callbacks=new Array('onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup','removeInstance');this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("popups_css",false)){va
 r cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath}else{if(this.settings.editor_css!='')this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg)}if(this.configs.length==0
 ){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMCE.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings['theme']+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings['language']+'.js');this.loadCSS(this.settings['editor_css']);var p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(var i=0;i<p.length;i++){if(p[i].charAt(0)!='-')this.loadScript(tinyMCE.baseURL+'/plugins/'+p[i]+'/editor_plugin'+tinyMCE.srcMode+'.js')}}if(tinyMCE.getParam('entity_encoding')=='named'){settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');f
 or(var i=0;i<entities.length;i+=2)settings['cleanup_entities']['c'+entities[i]]=entities[i+1]}settings['index']=this.configs.length;this.configs[this.configs.length]=settings;this.loadNextScript();if(this.isIE&&!this.isOpera){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}this.xmlEncodeAposRe=new RegExp('[<>&"\']','g');this.xmlEncodeRe=new RegExp('[<>&"]','g');},_addUnloadEvents:function(){if(tinyMCE.isIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n
 ,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substring(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return}if(tinyMCE.settings.strict_loading_mode)this.pendingFiles[this.pendingFiles.length]=url;else document.write('<sc'+'ript language="javascrip
 t" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex<this.pendingFiles.length){se=d.createElementNS('http://www.w3.org/1999/xhtml','script');se.setAttribute('language','javascript');se.setAttribute('type','text/javascript');se.setAttribute('src',this.pendingFiles[this.loadingIndex++]);d.getElementsByTagName("head")[0].appendChild(se)}else this.loadingIndex=-1;},loadCSS:function(url){var ar=url.replace(/\s+/,'').split(',');var lflen=0,csslen=0;var skip=false;var x=0,i=0,nl,le;for(x=0,csslen=ar.length;x<csslen;x++){if(ar[x]!=null&&ar[x]!='null'&&ar[x].length>0){for(i=0,lflen=this.loadedFiles.length;i<lflen;i++){if(this.loadedFiles[i]==ar[x]){skip=true;break}}if(!skip){if(tinyMCE.settings.strict_loading_mode){nl=document.getElementsByTagName("head");le=document.createElement('link');le.setAttribute('href',ar[x]);le.setAtt
 ribute('rel','stylesheet');le.setAttribute('type','text/css');nl[0].appendChild(le)}else document.write('<link href="'+ar[x]+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',');var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x<csslen;x++){css_file=css_ary[x];if(css_file!=null&&css_file!='null'&&css_file.length>0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings['convert_on_click']||(!elm.g
 etAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm'])))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instanc
 es=t;n=[];t=tinyMCE.undoLevels;for(i=0;i<t.length;i++){if(t[i]!=ti)n.push(t[i])}tinyMCE.undoLevels=n;tinyMCE.undoIndex=n.length;tinyMCE.dispatchCallback(ti,'remove_instance_callback','removeInstance',ti);return ti},removeMCEControl:function(editor_id){var inst=tinyMCE.getInstanceById(editor_id),h,re,ot,tn;if(inst){inst.switchSettings();editor_id=inst.editorId;h=tinyMCE.getContent(editor_id);this.removeInstance(inst);tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;re=document.getElementById(editor_id+"_parent");ot=inst.oldTargetElement;tn=ot.nodeName.toLowerCase();if(tn=="textarea"||tn=="input"){re.parentNode.removeChild(re);ot.style.display="inline";ot.value=h}else{ot.innerHTML=h;ot.style.display='block';re.parentNode.insertBefore(ot,re);re.parentNode.removeChild(re)}}},triggerSave:function(skip_cleanup,skip_callback){var inst,n;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;for(n in tinyMCE.instan
 ces){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.triggerSave(skip_cleanup,skip_callback)}},resetForm:function(form_index){var i,inst,n,formObj=document.forms[form_index];for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name)inst.getBody().innerHTML=inst.startContent}}},execInstanceCommand:function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id),r;if(inst){r=inst.selection.getRng();if(typeof(focus)=="undefined")focus=true;if(focus&&(!r||!r.item))inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();inst.select();tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isIE&&window.event!=null)tinyMCE.cancelEvent(window.event)}},execCommand:function(command,user_interface,value){var inst=tinyMCE.selectedInstance;u
 ser_interface=user_interface?user_interface:false;value=value?value:null;if(inst)inst.switchSettings();switch(command){case"Undo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex>0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value['element'],value['document']),value['
 element'],value['document']);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case"mceToggleEditor":var inst=tinyMCE.getInstanceById(value),pe,te;if(inst){pe=document.getElementById(inst.editorId+'_parent');te=inst.oldTargetElement;if(typeof(inst.enabled)=='undefined')inst.enabled=true;inst.enabled=!inst.enabled;if(!inst.enabled){pe.style.display='none';te.value=inst.getHTML();te.style.display=inst.oldTargetDisplay;tinyMCE.dispatchCallback(inst,'hide_instance_callback','hideInstance',inst)}else{pe.style.display='block';te.style.display='none';inst.setHTML(te.value);inst.useCSS=false;tinyMCE.dispatchCallback(inst,'show_instance_callback','showInstance',inst)}}else tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceResetDesignMode":if(!tinyMCE.isIE){for(var n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].getDoc().designMode="on"}catch(e){}}}return}if(inst){i
 nst.execCommand(command,user_interface,value)}else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert'])},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings['area_width'];ah=""+tinyMCE.settings['area_height'];if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.se
 tAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i;var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/&lt;/g,'<');content=content.replace(/&gt;/g,'>');content=content.replace(/&quot;/g,'"');content=content.replace(/&amp;/g,'&')}tinyMCE.selectedInstance=inst;inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getP
 aram("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings['theme']+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings['content_css']);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'<h'+i+'>');inst.addShortcut('ctrl','7','','FormatBlock',false,'<p>');inst.addShortcut('ctrl','8','','FormatBlock',false,'<div>');inst.addShortcut('ctrl','9','','FormatBlock',false,'<address>');if(tinyMCE.isGecko){inst.addShortcut('c
 trl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings['base_href']);if(tinyMCE.settings['convert_newlines_to_brs']){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_new
 lines"])doc.styleSheets[0].addRule("p","margin: 0;");var body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.isGecko&&tinyMCE.settings['remove_lt_gt'])content=content.replace(new RegExp('&lt;&gt;','g'),"");if(tinyMCE.settings['cleanup_on_startup'])tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}')}else tinyMCE._setHTML(inst.getDoc(),content)}tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.dispatchCall
 back(inst,'setupcontent_callback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody()
 .innerHTML);inst.undoRedo.add({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},removeTinyMCEFormElements:function(form_obj){var i,elementId;if(!tinyMCE.getParam('hide_se
 lects_on_submit'))return;if(typeof(form_obj)=="undefined"||form_obj==null)return;if(form_obj.nodeName!="FORM"){if(form_obj.form)form_obj=form_obj.form;else form_obj=tinyMCE.getParentElement(form_obj,"form")}if(form_obj==null)return;for(i=0;i<form_obj.elements.length;i++){elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true}},handleEvent:function(e){var inst=tinyMCE.selectedInstance;if(typeof(tinyMCE)=="undefined")return true;if(tinyMCE.executeCallback(tinyMCE.selectedInstance,'handle_event_callback','handleEvent',e))return false;switch(e.type){case"beforedeactivate":case"blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');tinyMCE.hideMenus();return;case"drop":case"beforepaste":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.setBaseHREF(null);if(tinyMCE.isRealIE){var ife=tinyMCE.selectedInstance.iframeElement;if(ife.style.height.in
 dexOf('%')!=-1){ife._oldHeight=ife.style.height;ife.style.height=ife.clientHeight}}window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();",1);return;case"submit":tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:e.target);tinyMCE.triggerSave();tinyMCE.isNotDirty=true;return;case"reset":var formObj=tinyMCE.isIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10)}return;case"keypress":if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId){tinyMCE.instances[e.target.editorId].select()}else{if(e.target.ownerDocument.editorId)tinyMCE.instances[e.target.ownerDocument.editorId].select()}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if((tinyMCE.isGecko||tinyMCE.isOpera||tinyMCE.isSafari)&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(TinyMCE
 _ForceParagraphs._insertPara(tinyMCE.selectedInstance,e)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if((tinyMCE.isGecko&&!tinyMCE.isSafari)&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if(tinyMCE.isIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tiny
 MCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false)}return false;break;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE
 .handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;"}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break}}if(tinyMCE.isIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false)}}}if(e.keyCode==17)return true;if(tinyMCE.isGecko){if(!posKey&&e.type=="keyup"&&!e.ctrlKey||(e.ctrlKey&&(e.keyCode==86||e.keyCode==88)))tinyMCE.execCommand("mceSt
 artTyping")}else{if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping")}if(e.type=="keydown"&&(posKey||e.ctrlKey)&&inst)inst.undoBookmark=inst.selection.getBookmark();if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;case"mousedown":case"mouseup":case"click":case"dblclick":case"focus":tinyMCE.hideMenus();if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();tinyMCE.selectedInstance.isFocused=true}var targetBody=tinyMCE.getParentElement(e.target,"html");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody().parentNode==targetBody){inst.select();tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedEl
 ement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break}}if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark&&(e.type=="mouseup"||e.type=="dblclick"))tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark();if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.instances[e.target.editorId].select();return false;break}},getButtonHTML:function(id,lang,img,cmd,ui,val){var h='',m,x,io='';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.isRealIE)io='onmouseover="tinyMCE.lastHover = this;"';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=this.buttonM
 ap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" title="{$'+lang+'}" />';h+='</a>'}else{h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" />';h+='</a>'}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_
 map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: '+x+'px 0" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}else{if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+
 id+'" dir="ltr" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i<a.length;i++)this.buttonMap[a[i]]=i},submitPatch:function(){tinyMCE.removeTinyMCEFormElem
 ents(this);tinyMCE.triggerSave();tinyMCE.isNotDirty=true;this.mceOldSubmit()},onLoad:function(){var r;if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){window.setTimeout('tinyMCE.onLoad();',1);return}if(tinyMCE.isRealIE&&window.event.type=="readystatechange"&&document.readyState!="complete")return true;if(tinyMCE.isLoaded)return true;tinyMCE.isLoaded=true;if(tinyMCE.isRealIE&&document.body){r=document.body.createTextRange();r.collapse(true);r.select()}tinyMCE.dispatchCallback(null,'onpageload','onPageLoad');for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var selector=tinyMCE.getParam("editor_selector");var deselector=tinyMCE.getParam("editor_deselector");var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE_Engine.prototype.handleEvent);tinyMCE.addEvent(form,"rese
 t",TinyMCE_Engine.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE_Engine.prototype.submitPatch}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case"exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"class")))continue;if(trigger=="false")continue;if((tinyMCE.settings['ask']||tinyMCE.settings['convert_on_click'])&&element){elementRefAr[elementRefAr.length]=element;continue}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i])}break;case"specific_textareas":case"textareas":var nodeList=document.getElementsByTagName("textarea");for(va
 r i=0;i<nodeList.length;i++){var elm=nodeList.item(i);var trigger=elm.getAttribute(tinyMCE.settings['textarea_trigger']);if(selector!=''&&!new RegExp('\\b'+selector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if(selector!='')trigger=selector!=""?"true":"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm}break}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']||tinyMCE.settings['convert_on_click']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});if(element.nodeName!="TEXTAREA"&&element.nodeName!="INPUT")tinyMCE.addEvent(element,"click",function(e){window.setTimeout(function(){TinyMCE_Engi
 ne.prototype.confirmAdd(e,settings)},10)});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});tinyMCE.addEvent(element,"click",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});}}else tinyMCE.addMCEControl(element,elementId)}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selection.selectNode(inst.getBody(),true,true);inst.contentWindow.focus()},100)}tinyMCE.dispatchCallback(null,'oninit','onInit')}},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.isTinyMCE_Control},getParam:function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!
 =null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i]}value=outArray}return value},getLang:function(name,default_value,parse_entities,va){var v=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name],n;if(parse_entities)v=tinyMCE.entityDecode(v);if(va){for(n in va)v=this.replaceVar(v,n,va[n])}return v},entityDecode:function(s){var e=document.createElement("div");e.innerHTML=s;return e.firstChild.nodeValue},addToLang:function(prefix,ar){for(var key in ar){if(typeof(ar[key])=='function')continue;tinyMCELang[(key.indexOf('lang_')==-1?'lang_':'')+(prefix!=''?(prefix+"_"):'')+key]=ar[key]}this.loadNextScript();},triggerNodeChange:function(focus,setup_content){var elm,inst,editorId,undoIndex=-1,undoLevels=-1,doc,anySelection=false,st;if(tinyMCE.selectedInstance){inst=tinyMCE.selectedInstance;elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedEle
 ment:inst.getFocusElement();editorId=inst.editorId;st=inst.selection.getSelectedText();if(tinyMCE.settings.auto_resize)inst.resizeToContent();if(setup_content&&tinyMCE.isGecko&&inst.isHidden())elm=inst.getBody();inst.switchSettings();if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(st&&st.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,type,content){var pl,po,i;var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");po=tinyMCE.themes[tinyMCE.s
 ettings['theme']];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i<pl.length;i++){po=tinyMCE.plugins[pl[i]];if(po&&po.cleanup)content=po.cleanup(type,content,inst)}return content},setContent:function(h){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,h);tinyMCE.selectedInstance.repaint()}},importThemeLanguagePack:function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js')},importPluginLanguagePack:function(name){var b=tinyMCE.baseURL+'/plugins/'+name;if(this.plugins[name])b=this.plugins[name].baseURL;tinyMCE.loadScript(b+'/langs/'+tinyMCE.settings['language']+'.js')},applyTemplate:function(h,as){return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}','gi'),function(m,s){if(s.indexOf('lang_')==0&&tinyMCELang[s])return tinyMCELang[s];if(as&&as[s])return as[s];if(tinyMCE.settings[s])return tinyMCE.se
 ttings[s];if(m=='themeurl')return tinyMCE.themeURL;return m})},replaceVar:function(h,r,v){return h.replace(new RegExp('{\\\$'+r+'}','g'),v)},openWindow:function(template,args){var html,width,height,x,y,resizable,scrollbars,url;args=!args?{}:args;args['mce_template_file']=template['file'];args['mce_width']=template['width'];args['mce_height']=template['height'];tinyMCE.windowArgs=args;html=template['html'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;if(tinyMCE.isIE)height+=40;else height+=20;x=parseInt(screen.width/ 2.0) - (width /2.0);y=parseInt(screen.height/ 2.0) - (height /2.0);resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];for(var name in args){if(typeof(args[name])==
 'function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]))}if(html){html=tinyMCE.replaceVar(html,"css",this.settings['popups_css']);html=tinyMCE.applyTemplate(html,args);var win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus()}else{if((tinyMCE.isRealIE)&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){height+=10;var features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features)}else{var modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template['close_previous']!="no")try{tinyMCE.lastWindow.close()}catch(ex){
 }var win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return}if(template['close_previous']!="no")tinyMCE.lastWindow=win;eval('try { win.resizeTo(width, height); } catch(e) { }');if(tinyMCE.isGecko){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24)}win.focus()}}},closeWindow:function(win){win.close()},getVisualAidClass:function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i]}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)cl
 assName+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,inst);var tableElement=null;switch(el.nodeName){case"TABLE":var oldW=el.style.width;var oldH=el.style.height;var bo=tinyMCE.getAttrib(el,"border");bo=bo==""||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(var y=0;y<el.rows.length;y++){for(var x=0;x<el.rows[y].cells.length;x++){var cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn)}}break;case"A":var anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!=''&&state){el.title=anchorName;tinyMCE.addCSSClass(el,'mceItemAnchor')}else if(anchorName!=''&&!state)el.className='';break}if(deep&&el.hasChild
 Nodes()){for(var i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst,true)}},fixGeckoBaseHREFBug:function(m,e,h){var xsrc,xhref;if(tinyMCE.isGecko){if(m==1){h=h.replace(/\ssrc=/gi," mce_tsrc=");h=h.replace(/\shref=/gi," mce_thref=");return h}else{if(!new RegExp('(src|href)=','g').test(h))return h;tinyMCE.selectElements(e,'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK',function(n){xsrc=tinyMCE.getAttrib(n,"mce_tsrc");xhref=tinyMCE.getAttrib(n,"mce_thref");if(xsrc!=""){try{n.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],xsrc)}catch(e){}n.removeAttribute("mce_tsrc")}if(xhref!=""){try{n.href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],xhref)}catch(e){}n.removeAttribute("mce_thref")}return false});tinyMCE.selectNodes(e,function(n){if(n.nodeType==3||n.nodeType==8){n.nodeValue=n.nodeValue.replace(/\smce_tsrc=/gi," src=");n.nodeValue=n.nodeValue.replace(/\smce_thref=/gi," href=")}retur
 n false})}}return h},_setHTML:function(doc,html_content){html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content)}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content)}if(tinyMCE.isIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName=="P")node.outerHTML=node.innerHTML}}var html=doc.body.innerHTML;tinyMCE.setInnerHTML(doc.body,html)}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc)},getEditorId:function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId},getInstanceById:function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var n in tinyMCE.instances){var instance=tinyMCE.instances[n];if(!tinyMCE.isInstance(instance))continue;if(instance.formTargetElementId==e
 ditor_id){inst=instance;break}}}return inst},queryInstanceCommandValue:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false},queryInstanceCommandState:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null},setWindowArg:function(n,v){this.windowArgs[n]=v},getWindowArg:function(n,d){return(typeof(this.windowArgs[n])=="undefined")?d:this.windowArgs[n]},getCSSClasses:function(editor_id,doc){var inst=tinyMCE.getInstanceById(editor_id);if(inst&&inst.cssClasses.length>0)return inst.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;break}doc=instance.getDoc()}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc()}if(doc){var sty
 les=doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x<styles.length;x++){var csses=null;eval("try {var csses = tinyMCE.isIE ? doc.styleSheets("+x+").rules : styles["+x+"].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i<csses.length;i++){var selectorText=csses[i].selectorText;if(selectorText){var rules=selectorText.split(',');for(var c=0;c<rules.length;c++){var rule=rules[c];while(rule.indexOf(' ')==0)rule=rule.substring(1);if(rule.indexOf(' ')!=-1||rule.indexOf(':')!=-1||rule.indexOf('mceItem')!=-1)continue;if(rule.indexOf(tinyMCE.settings['visual_table_class'])!=-1||rule.indexOf('mceEditable')!=-1||rule.indexOf('mceNonEditable')!=-1)continue;if(rule.indexOf('.')!=-1){var cssClass=rule.substring(rule.indexOf('.')+1);var addClass=true;for(var p=0;p<inst.cssClasses.length&&addClass;p++){if(inst.cssClasses[p]==cssClass)addClass=false}if(addClass)inst.cssClasses[inst.cssClasses.length]=cssClass}}}}}}}return inst.cssClasses},regexpReplace:function(in_s
 tr,reg_exp,replace_str,opts){if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str)},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s},getControlHTML:function(c){var i,l,n,o,v,rtl=tinyMCE.getLang('lang_dir')=='rtl';l=tinyMCE.plugins;for(n in l){o=l[n];if(o.getControlHTML&&(v=o.getControlHTML(c))!=''){if(rtl)return'<span dir="rtl">'+tinyMCE.replaceVar(v,"pluginurl",o.baseURL)+'</span>';return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}}o=tinyMCE.themes[tinyMCE.settings['theme']];if(o.getControlHTML&&(v=o.getControlHTML(c))!=''){if(rtl)return'<span dir="rtl">'+v+'</span>';return v}return''},evalFunc:function(f,idx,a,o){o=!o?window:o;f=typeof(f)=='function'?f:o[f];return f.apply(o,Array.prototype.slice.call(a,idx))},dispatchCallback:function(i,p,n){re
 turn this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.executeCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!=''&&(v=tinyMCE.evalFunc(l,3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i<l.length;i++){o=tinyMCE.plugins[l[i]];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}}l=tinyMCE.themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},xmlEncode:function(s,skip_apos){return s?(''+s).replace(!skip_apos?this.xmlEncodeAposRe:this.xmlEncodeRe,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'\'':return'&#39;';case'<':return'&lt;';case'>':return'&gt;'}return c}):s},extend:function(p,np){var o={};o.parent=p;for(n in p)o[n]=p[n];for(n in np)o[n]=np[n];return o
 },hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,to,fu,p,x,fn,fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.settings=s;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=new Array();this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cssClasses=[];this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,en
 tities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans});t=this.settings['theme'];if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;to={};for(i=0;i<fn.length;i++){if((fu=window['TinyMCE_'+t+"_"+fn[i]]))to[fn[i]]=fu}tinyMCE.addTheme(t,to)}this.plugins=new Array();p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){pn=p[i];if(pn.charAt(0)=='-')pn=pn.substring(1);if(!tinyMCE.hasPlugin(pn)){fn=tinyMCE.callbacks;to={};for(x=0;x<fn.length;x++){if((fu=window['TinyMCE_'+pn+"_"+fn[x]]))to[fn[x]]=fu}tinyMCE.addPlugin(pn,to)}this.plugins[this.plugins.length]=pn}}};TinyMCE_Control.prototype={selection:null,settings:null,cleanup:null,getData:function(na){var o=this.data[na];if(!o)o=this.data[na]={};return o},hasPlugin:function(n){var i;for(i=0;i<this.plug
 ins.length;i++){if(this.plugins[i]==n)return true}return false},addPlugin:function(n,p){if(!this.hasPlugin(n)){tinyMCE.addPlugin(n,p);this.plugins[this.plugins.length]=n}},repaint:function(){var s,b,ex;if(tinyMCE.isRealIE)return;try{s=this.selection;b=s.getBookmark(true);this.getBody().style.display='none';this.getDoc().execCommand('selectall',false,null);this.getSel().collapseToStart();this.getBody().style.display='block';s.moveToBookmark(b)}catch(ex){}},switchSettings:function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index']}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:this.getDoc().body},getDoc:function(){return this
 .contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentElement(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.inde
 xOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i<scl.length;i++){if(sc.alt==scl[i].alt&&sc.ctrl==scl[i].ctrl&&sc.shift==scl[i].shift&&sc.charCode==scl[i].charCode&&sc.keyCode==scl[i].keyCode){return false}}scl[scl.length]=sc;return true},handleShortcut:function(e){var i,s,o;if(!e.altKey&&!e.ctrlKey)return false;s=this.shortcuts;for(i=0;i<s.length;i++){o=s[i];if(o.alt==e.altKey&&o.ctrl==e.ctrlKey&&(o.keyCode==e.keyCode||o.charCode==e.charCode)){if(o.cmd&&(e.type=="keydown"||(e.type=="keypress"&&!tinyMCE.isOpera)))tinyMCE.execCommand(o.cmd,o.ui,o.val);tinyMCE.cancelEvent(e);return true}}return false},autoResetDesignMode:function(){if(!tinyMCE.isIE&&this.isHidden()&&tinyMCE.getParam('auto_reset_designmode'))eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}')},isHidden:function(){var s;if(tinyMCE.isIE)return false;s=this.getSel();return(!s||!s.rangeCount||s.rangeCount==0)},isDirty:function(){return tinyMCE.t
 rim(this.startContent)!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty},_mergeElements:function(scmd,pa,ch,override){if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return}var st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));var stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));var className=tinyMCE.getAttrib(pa,"class");className=tinyMCE.getAttrib(ch,"class");if(override){for(var n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n]}}else{for(var n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n]}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style")},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b)}catch(ex){}try{d.execCommand("styleWithCSS",false,b)}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d
 .execCommand('enableInlineTableEditing',false,"false")}catch(ex){}if(!tinyMCE.getParam("object_resizing"))try{d.execCommand('enableObjectResizing',false,"false")}catch(ex){}},execCommand:function(command,user_interface,value){var doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(!tinyMCE.isIE&&!this.useCSS){this._setUseCSS(false);this.useCSS=true}this.contentDocument=doc;if(!/mceStartTyping|mceEndTyping/.test(command)){if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return}if(focusElm&&focusElm.nodeName=="IMG"){var align=focusElm.getAttribute('align');var img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left')img.removeAttribute('align');else img.setAttribute('align','left');va
 r div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.removeAttribute('align');var div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div)}else{var div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm)}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right')img.removeAttribute('align');else img.setAttribute('align','right');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChang
 e();return}}if(tinyMCE.settings['force_br_newlines']){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break}if(alignValue!=""){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"Inser
 tUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case"FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(!this.cleanup.isValid(value))return true;if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'<p>');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.
 selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMCE.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){value.outerHTML=value.innerHTML}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML))}tinyMCE.triggerNodeChange();break;case"mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"mceSetStyleInfo":case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=val
 ue['name'];var svalue=value['value']==null?'':value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings['merge_styles_invalid_parents']!=''?new RegExp(tinyMCE.settings['merge_styles_invalid_parents'],"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.
 style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}else{this._setUseCSS(false);doc.execCommand("FontName",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','')}if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true))}sp
 anElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);fo
 r(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(var x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm)}elm.parentNode.removeChild(elm)}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"FontName":if(value==null){var s=this.getSel();if(tinyMCE.isGecko&&s.isCollapsed){var f=tinyMCE.getParentElement(this.getFocusElement(),"font");if(f!=null)this.selection.selectNode(f,false)}this.getDoc().execCommand("RemoveFormat",false,null);if(f!=null&&tinyMCE.isGecko){var r=this.getRng().cloneRange();r.collapse(true);s.removeAllRanges();s.addRange(r)}}else this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)
 window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"forecolor":value=value==null?this.foreColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.foreColor=value;this.getDoc().execCommand('forecolor',false,value);break;case"HiliteColor":value=value==null?this.backColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.backColor=value;if(tinyMCE.isGecko){this._setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this._setUseCSS(false)}else this.getDoc().execCommand('BackColor',false,value);break;case"Cut":case"Copy":case"Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Cur
 rently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_clipboard_msg'))))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return}else tinyMCE.triggerNodeChange();break;case"mceSetContent":if(!value)value="";value=tinyMCE.storeAwayURLs(value);value=tinyMCE._customCleanup(this,"insert_to_editor",value);if(this.getBody().nodeName=='BODY')tinyMCE._setHTML(doc,value);else this.getBody().innerHTML=value;tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,doc,this.settings,this.getBody(),false,false,false,true));tinyMCE.convertAllRelativeURLs(this.getBody());tinyMCE._removeInternal(this.getBody());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);return true;case"mceCleanup":var b=this.selectio
 n.getBookmark();tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.convertAllRelativeURLs(doc.body);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this.repaint();this.selection.moveToBookmark(b);tinyMCE.triggerNodeChange();break;case"mceReplaceContent":if(!value)value='';this.getWin().focus();var selectedText="";if(tinyMCE.isIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value)}tinyMCE.triggerNodeChange();break;case"mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="
 undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange()}}break;case"mceSetCSSClass":this.execCommand("mceSetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyM
 CE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{var el=document.createElement("div");el.innerH
 TML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value)}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.createRange(),tmpRng=null;var c=value.indexOf('<!--')!=-1;if(c)value=tinyMCE.uniqueTag+value;if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);if(c){var e=this.getDoc().getElementById('mceTMPElement');e.parentNode.removeChild(e
 )}}tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange();break;case"mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo.typingUndoIndex==-1){this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;tinyMCE.typingUndoIndex=tinyMCE.undoIndex;this.execCommand('mceAddUndoLevel')}break;case"mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.undoRedo.typingUndoIndex=-1}tinyMCE.typingUndoIndex=-1;break;case"mceBeginUndoLevel":this.undoRedoLevel=false;break;case"mceEndUndoLevel":this.undoRedoLevel=true;this.execCommand('mceAddUndoLevel');break;case"mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedoLevel){if(this.undoRedo.add())tinyMCE.triggerNodeChange(false)}break;case"Undo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");this.undoRedo.undo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,va
 lue);break;case"Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");this.undoRedo.redo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style")}}while(n!=null&&(n=n.parentNode)!=null)}break;case"RemoveFormat":case"removeformat":var text=this.selection.getSelectedText();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return}if(tinyMCE.isIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null)}catch(e){}this.execCommand("mceSetStyleInfo"
 ,false,{command:"removeformat"})}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange()}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel")},queryCommandValue:function(c){try{return this.getDoc().queryCommandValue(c)}catch(e){return null}},queryCommandState:function(c){return this.getDoc().queryCommandState(c)},_onAdd:function(replace_element,form_element_name,target_document){var hc,th,to,editorTemplate;th=this.settings['theme'];to=tinyMCE.themes[th];var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.
 themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false}if(to.getEditorTemplate)editorTemplate=to.getEditorTemplate(this.settings,this.editorId);var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+editorTemplate['html'];html=tinyMCE.replaceVar(html,"editor_id",this.editorId);this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.styl
 e.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;this.settings['width_style']=""+this.settings['width'];this.settings['height_style']=""+this.settings['height'];if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";else this.settings['width_style']+='px';if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";else this.settings['height_style']+='px';if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";this.settings['width_style']="100%"}if((""+replace_element.style.height).inde
 xOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";this.settings['height_style']="100%"}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName!="TEXTAREA"&&replace_element.nodeName!="INPUT"){this.oldTargetElement=replace_element;if(tinyMCE.settings['debug']){hc='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>'}else{hc='<input type="hidden" id="'+form_element_name+'" name="'+form_element_name+'" />';this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="n
 one"}html+='</span>';if(tinyMCE.isGecko)html=hc+html;else html+=hc;if(tinyMCE.isGecko){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug']){this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none"}if(tinyMCE.isGecko){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isIE){if(tElm&&(tElm.nodeName=="SPAN"||tElm.nodeName=="span")){tElm=tinyMCE._createIFrame(tElm,targ
 etDoc);dynamicIFrame=true}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName=="SPAN")tElm=tinyMCE._createIFrame(tElm,targetDoc,targetDoc.parentWindow);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window}this.getDoc().designMode="on"}var doc=this.contentDocument;if(dynamicIFrame){var html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings['base_href']+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{if(!this.isHidden())t
 his.getDoc().designMode="on";doc.open();doc.write(html);doc.close()}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm"}}if(tinyMCE.isIE)window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\""+this.editorId+"\"]);",1);var parentElm=this.targetDoc.getElementById(this.editorId+'_parent');this.formElement=tinyMCE.isGecko?parentElm.previousSibling:parentElm.nextSibling;tinyMCE.setupContent(this.editorId,true);return true},setBaseHREF:function(u){var h,b,d,nl;d=this.getDoc();nl=d.getElementsByTagName("base");b=nl.length>0?nl[0]:null;if(!b){nl=d.getElementsByTagName("head");h=nl.length>0?nl[0]:null;b=d.createElement("base");b.setAttribute('href',u);h.appendChild(b)}else{if(u==""||u==null)b.parentNode.removeChild(b);else b.setAttribute('href',u)}},getHTML:function(r){var h,d=this.getDoc(),b=this.getBody();if(r)return b.innerHTML;h=tinyMCE._cleanupHTML(this,d,this.settings,b,false,true,false,true);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertS
 pansToFonts(d);return h},setHTML:function(h){this.execCommand('mceSetContent',false,h);this.repaint()},getFocusElement:function(){return this.selection.getFocusElement()},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},triggerSave:function(skip_cleanup,skip_callback){var e,nl=[],i,s;this.switchSettings();s=tinyMCE.settings;if(tinyMCE.isRealIE){e=this.iframeElement;do{if(e.style&&e.style.display=='none'){e.style.display='block';nl[nl.length]={elm:e,type:'style'}}if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){e.className=s.display_tab_class;nl[nl.length]={elm:e,type:'class'}}}while((e=e.parentNode)!=null)}tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(this.getDoc(),this.getBody().innerHTML);if(this.settings['cleanup']==false){tinyMCE.handleVisualAid(this.getBody(),tr
 ue,false,this);tinyMCE._setEventsEnabled(this.getBody(),true)}tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);var htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,true);htm=tinyMCE._customCleanup(this,"submit_content",htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(this.formTargetElementId,htm,this.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(this.formElement)this.formElement.value=htm;if(tinyMCE.isSafari&&this.formElement)this.formElement.innerText=htm;for(i=0;i<nl.length;i++){if(nl[i].type=='style')nl[i].elm.style.di
 splay='none';else nl[i].elm.className=s.hidden_tab_class}}};TinyMCE_Engine.prototype.cleanupHTMLCode=function(s){s=s.replace(new RegExp('<p \\/>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<p>\\s*<\\/p>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<br>\\s*<\\/br>','gi'),'<br />');s=s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>','gi'),'<$1$2$3></$1$2>');s=s.replace(new RegExp('\\s+></','gi'),'></');s=s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>','gi'),'<$1$2 />');if(tinyMCE.isIE)s=s.replace(new RegExp('<p><hr \\/><\\/p>','gi'),"<hr>");if(tinyMCE.isIE)s=s.replace(/<!(\s*)\/>/g,'');return s};TinyMCE_Engine.prototype.parseStyle=function(str){var ar=new Array();if(str==null)return ar;var st=str.split(';');tinyMCE.clearArray(ar);for(var i=0;i<st.length;i++){if(st[i]=='')continue;var re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');var pa=st[i].replace(re,'$1||$
 2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1]}return ar};TinyMCE_Engine.prototype.compressStyle=function(ar,pr,sf,res){var box=new Array();box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(var i=0;i<box.length;i++){if(box[i]==null)return;for(var a=0;a<box.length;a++){if(box[a]!=box[i])return}}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null};TinyMCE_Engine.prototype.serializeStyle=function(ar){var str="";tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");tinyMCE.compressStyle(ar,"border","-style","border-style");tinyMCE.compressStyle(ar,"padding","","padding");tinyMCE.compressStyle(ar,"margin","","margin");for(var key in ar){var val=ar[key];if(typeof(val)=='function')continue;if(key.indexOf('mso-')==0)continue;if(val!=null&&val!=''){
 val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val.indexOf('url(')!=-1&&tinyMCE.getParam('convert_urls')){var m=new RegExp("url\\('(.*?)'\\)").exec(val);if(m.length>1)val="url('"+eval(tinyMCE.getParam('urlconverter_callback')+"(m[1], null, true);")+"')"}if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val,true);val=val.replace(/\"/g,'\'');if(val!="url('')")str+=key.toLowerCase()+": "+val+"; "}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str};TinyMCE_Engine.prototype.convertRGBToHex=function(s,k){if(s.toLowerCase().indexOf('rgb')!=-1){var re=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");var rgb=s.replace(re,"$1,$2,$3,$4,$5").split(',');if(rgb.length==5){r=parseInt(rgb[1]).toString(16);g=parseInt(rgb[2]).toString(16);b=parseInt(rgb[3]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;if(k)s=rgb[
 0]+s+rgb[4]}}return s};TinyMCE_Engine.prototype.convertHexToRGB=function(s){if(s.indexOf('#')!=-1){s=s.replace(new RegExp('[^0-9A-F]','gi'),'');return"rgb("+parseInt(s.substring(0,2),16)+","+parseInt(s.substring(2,4),16)+","+parseInt(s.substring(4,6),16)+")"}return s};TinyMCE_Engine.prototype.convertSpansToFonts=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var s=tinyMCE.selectElements(doc,'span,font');for(var i=0;i<s.length;i++){var size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();var fSize=0;for(var x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize=''}var fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!=""){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily=''}var fColor=s[i].style.color;if(fColor!=null&&fColor!=""){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color=''}}};TinyMCE_Engine.prototype.conver
 tFontsToSpans=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;var s=tinyMCE.selectElements(doc,'span,font');for(var i=0;i<s.length;i++){var fSize,fFace,fColor;fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!=""){fSize=parseInt(fSize);if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1]}s[i].removeAttribute('size')}if(fFace!=""){s[i].style.fontFamily=fFace;s[i].removeAttribute('face')}if(fColor!=""){s[i].style.color=fColor;s[i].removeAttribute('color')}}};TinyMCE_Engine.prototype.cleanupAnchors=function(doc){var i,cn,x,an=doc.getElementsByTagName("a");for(i=an.length-1;i>=0;i--){if(tinyMCE.getAttrib(an[i],"name")!=""&&tinyMCE.getAttrib(an[i],"h
 ref")==""){cn=an[i].childNodes;for(x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i])}}};TinyMCE_Engine.prototype.getContent=function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.getInstanceById(editor_id).select();if(tinyMCE.selectedInstance)return tinyMCE.selectedInstance.getHTML();return null};TinyMCE_Engine.prototype._fixListElements=function(d){var nl,x,a=['ol','ul'],i,n,p,r=new RegExp('^(OL|UL)$'),np;for(x=0;x<a.length;x++){nl=d.getElementsByTagName(a[x]);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=tinyMCE.prevNode(n,'LI');if(!np){np=d.createElement('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild)}else np.appendChild(n)}}}};TinyMCE_Engine.prototype._fixTables=function(d){var nl,i,n,p,np,x,t;nl=d.getElementsByTagName('table');for(i=0;i<nl.length;i++){n=nl[i];if((p=tinyMCE.getParentElement(n,'p,h1,h2,h3,h4,h5,h6'))!=null){np=p.cloneNode(false);np.removeAttribute('id');t=n;while((n=n.nextSibling))np.a
 ppendChild(n);tinyMCE.insertAfter(np,p);tinyMCE.insertAfter(t,p)}}};TinyMCE_Engine.prototype._cleanupHTML=function(inst,doc,config,elm,visual,on_save,on_submit,inn){var h,d,t1,t2,t3,t4,t5,c,s,nb;if(!tinyMCE.getParam('cleanup'))return elm.innerHTML;on_save=typeof(on_save)=='undefined'?false:on_save;c=inst.cleanup;s=inst.settings;d=c.settings.debug;if(d)t1=new Date().getTime();if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);if(tinyMCE.getParam("fix_list_elements"))tinyMCE._fixListElements(doc);if(tinyMCE.getParam("fix_table_elements"))tinyMCE._fixTables(doc);tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);if(d)t2=new Date().getTime();c.settings.on_save=on_save;c.idCount=0;c.serializationId++;c.serializedNodes=new Array();c.sourceIndex=-1;if(s.cleanup_serializer=="xml")h=c.serializeNodeAsXML(elm,inn);else h=c.serializeNodeAsHTML(elm,inn);if(d)t3=new Date().getTime();nb=tinyMCE.getParam('entity_encoding')=
 ='numeric'?'&#160;':'&nbsp;';h=h.replace(/<\/?(body|head|html)[^>]*>/gi,'');h=h.replace(new RegExp(' (rowspan="1"|colspan="1")','g'),'');h=h.replace(/<p><hr \/><\/p>/g,'<hr />');h=h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,'<hr />');h=h.replace(/<td>\s*<br \/>\s*<\/td>/g,'<td>'+nb+'</td>');h=h.replace(/<p>\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<br \/>$/,'');h=h.replace(/<br \/><\/p>/g,'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(new RegExp('<a>(.*?)<\\/a>','g'),'$1');h=h.replace(/<p([^>]*)>\s*<\/p>/g,'<p$1>'+nb+'</p>');if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))h='';if(s.preformatted){h=h.replace(/^<pre>/,'');h=h.replace(/<\/pre>$/,'');h='<pre>'+h+'</pre>'}if(tinyMCE.isGecko){h=h.replace(/<o:p _moz-userdefined="" \/>
 /g,'');h=h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,'<td$1>'+nb+'</td>')}if(s.force_br_newlines)h=h.replace(/<p>(&nbsp;|&#160;)<\/p>/g,'<br />');h=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",h);if(on_save){h=h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|'+s.visual_table_class+')','g'),'');h=h.replace(new RegExp(' ?class=""','g'),'')}if(s.remove_linebreaks&&!c.settings.indent)h=h.replace(/\n|\r/g,' ');if(d)t4=new Date().getTime();if(on_save&&c.settings.indent)h=c.formatHTML(h);if(on_submit&&(s.encoding=="xml"||s.encoding=="html"))h=c.xmlEncode(h);if(d)t5=new Date().getTime();if(c.settings.debug)tinyMCE.debug("Cleanup in ms: Pre="+(t2-t1)+", Serialize: "+(t3-t2)+", Post: "+(t4-t3)+", Format: "+(t5-t4)+", Sum: "+(t5-t1)+".");return h};function TinyMCE_Cleanup(){this.isIE=(navigator.appName=="Microsoft Internet Explorer");this.rules=tinyMCE.clearArray(new Array());this.settings={indent_elements:'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,o
 bject',newline_before_elements:'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td',newline_after_elements:'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',newline_before_after_elements:'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',indent_char:'\t',indent_levels:1,entity_encoding:'raw',valid_elements:'*[*]',entities:'',url_converter:'',invalid_elements:'',verify_html:false};this.vElements=tinyMCE.clearArray(new Array());this.vElementsRe='';this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;this.codeElementsRe=/^(SCRIPT|STYLE)$/;this.serializationId=0;this.mceAttribs={href:'mce_href',src:'mce_src',type:'mce_type'}}TinyMCE_Cleanup.prototype={init:function(s){var n,a,i,ir,or,st;for(n in s)this.settings[n]=s[n];s=this.settings;this.inRe=this._arrayToRe(s.indent_elements.split(','),'','^<(',')[^>]*');this.ouRe=this._arrayToRe(s.indent_elements.split(','),'','^<\\/(',')[^>]*')
 ;this.nlBeforeRe=this._arrayToRe(s.newline_before_elements.split(','),'gi','<(',')([^>]*)>');this.nlAfterRe=this._arrayToRe(s.newline_after_elements.split(','),'gi','<(',')([^>]*)>');this.nlBeforeAfterRe=this._arrayToRe(s.newline_before_after_elements.split(','),'gi','<(\\/?)(',')([^>]*)>');this.serializedNodes=[];if(s.invalid_elements!='')this.iveRe=this._arrayToRe(s.invalid_elements.toUpperCase().split(','),'g','^(',')$');else this.iveRe=null;st='';for(i=0;i<s.indent_levels;i++)st+=s.indent_char;this.inStr=st;if(!s.verify_html){s.valid_elements='*[*]';s.extended_valid_elements=''}this.fillStr=s.entity_encoding=="named"?"&nbsp;":"&#160;";this.idCount=0;this.xmlEncodeRe=new RegExp('[\u007F-\uFFFF<>&"]','g');this.xmlEncodeAposRe=new RegExp('[\u007F-\uFFFF<>&"\']','g')},addRuleStr:function(s){var r=this.parseRuleStr(s);var n;for(n in r){if(r[n])this.rules[n]=r[n]}this.vElements=tinyMCE.clearArray(new Array());for(n in this.rules){if(this.rules[n])this.vElements[this.vElements.
 length]=this.rules[n].tag}this.vElementsRe=this._arrayToRe(this.vElements,'')},isValid:function(n){this._setupRules();if(!n)return true;n=n.replace(/[^a-z0-9]+/gi,'').toUpperCase();return!tinyMCE.getParam('cleanup')||this.vElementsRe.test(n)},addChildRemoveRuleStr:function(s){var x,y,p,i,t,tn,ta,cl,r;if(!s)return;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r="^(";cl=this.split(/\|/,p[1]);for(i=0;i<cl.length;i++){if(cl[i]=='%istrict')r+=tinyMCE.inlineStrict;else if(cl[i]=='%itrans')r+=tinyMCE.inlineTransitional;else if(cl[i]=='%istrict_na')r+=tinyMCE.inlineStrict.substring(2);else if(cl[i]=='%itrans_na')r+=tinyMCE.inlineTransitional.substring(2);else if(cl[i]=='%btrans')r+=tinyMCE.blockElms;else if(cl[i]=='%strict')r+=tinyMCE.blockStrict;else r+=(cl[i].charAt(0)!='#'?cl[i].toUpperCase():cl[i]);r+=(i!=cl.length-1?'|':'')}r+=')$';if(this.
 childRules==null)this.childRules=tinyMCE.clearArray(new Array());this.childRules[tn[y]]=new RegExp(r);if(p.length>1)this.childRules[tn[y]].wrapTag=p[2]}}},parseRuleStr:function(s){var ta,p,r,a,i,x,px,t,tn,y,av,or=tinyMCE.clearArray(new Array()),dv;if(s==null||s.length==0)return or;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];if(s.length==0)continue;p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r={};r.tag=tn[y];r.forceAttribs=null;r.defaultAttribs=null;r.validAttribValues=null;px=r.tag.charAt(0);r.forceOpen=px=='+';r.removeEmpty=px=='-';r.fill=px=='#';r.tag=r.tag.replace(/\+|-|#/g,'');r.oTagName=tn[0].replace(/\+|-|#/g,'').toLowerCase();r.isWild=new RegExp('\\*|\\?|\\+','g').test(r.tag);r.validRe=new RegExp(this._wildcardToRe('^'+r.tag+'$'));if(p.length>1){r.vAttribsRe='^(';a=this.split(/\|/,p[1]);for(i=0;i<a.length;i++){t=a[i];if(t.charAt(0)=='!'){a[i]=t=t.substring(1);if(!r.reqAtt
 ribsRe)r.reqAttribsRe='\\s+('+t;else r.reqAttribsRe+='|'+t}av=new RegExp('(=|:|<)(.*?)$').exec(t);t=t.replace(new RegExp('(=|:|<).*?$'),'');if(av&&av.length>0){if(av[0].charAt(0)==':'){if(!r.forceAttribs)r.forceAttribs=tinyMCE.clearArray(new Array());r.forceAttribs[t.toLowerCase()]=av[0].substring(1)}else if(av[0].charAt(0)=='='){if(!r.defaultAttribs)r.defaultAttribs=tinyMCE.clearArray(new Array());dv=av[0].substring(1);r.defaultAttribs[t.toLowerCase()]=dv==""?"mce_empty":dv}else if(av[0].charAt(0)=='<'){if(!r.validAttribValues)r.validAttribValues=tinyMCE.clearArray(new Array());r.validAttribValues[t.toLowerCase()]=this._arrayToRe(this.split('?',av[0].substring(1)),'i')}}r.vAttribsRe+=''+t.toLowerCase()+(i!=a.length-1?'|':'');a[i]=t.toLowerCase()}if(r.reqAttribsRe)r.reqAttribsRe=new RegExp(r.reqAttribsRe+')=\"','g');r.vAttribsRe+=')$';r.vAttribsRe=this._wildcardToRe(r.vAttribsRe);r.vAttribsReIsWild=new RegExp('\\*|\\?|\\+','g').test(r.vAttribsRe);r.vAttribsRe=new RegExp(r.vA
 ttribsRe);r.vAttribs=a.reverse();}else{r.vAttribsRe='';r.vAttribs=tinyMCE.clearArray(new Array());r.vAttribsReIsWild=false}or[r.tag]=r}}return or},serializeNodeAsXML:function(n){var s,b;if(!this.xmlDoc){if(this.isIE){try{this.xmlDoc=new ActiveXObject('MSXML2.DOMDocument')}catch(e){}if(!this.xmlDoc)try{this.xmlDoc=new ActiveXObject('Microsoft.XmlDom')}catch(e){}}else this.xmlDoc=document.implementation.createDocument('','',null);if(!this.xmlDoc)alert("Error XML Parser could not be found.")}if(this.xmlDoc.firstChild)this.xmlDoc.removeChild(this.xmlDoc.firstChild);b=this.xmlDoc.createElement("html");b=this.xmlDoc.appendChild(b);this._convertToXML(n,b);if(this.isIE)return this.xmlDoc.xml;else return new XMLSerializer().serializeToString(this.xmlDoc)},_convertToXML:function(n,xn){var xd,el,i,l,cn,at,no,hc=false;if(tinyMCE.isRealIE&&this._isDuplicate(n))return;xd=this.xmlDoc;switch(n.nodeType){case 1:hc=n.hasChildNodes();el=xd.createElement(n.nodeName.toLowerCase());at=n.attribute
 s;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&no.nodeValue)el.setAttribute(no.nodeName.toLowerCase(),no.nodeValue)}if(!hc&&!this.closeElementsRe.test(n.nodeName))el.appendChild(xd.createTextNode(""));xn=xn.appendChild(el);break;case 3:xn.appendChild(xd.createTextNode(n.nodeValue));return;case 8:xn.appendChild(xd.createComment(n.nodeValue));return}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)this._convertToXML(cn[i],xn)}},serializeNodeAsHTML:function(n,inn){var en,no,h='',i,l,t,st,r,cn,va=false,f=false,at,hc,cr,nn;this._setupRules();if(tinyMCE.isRealIE&&this._isDuplicate(n))return'';if(n.parentNode&&this.childRules!=null){cr=this.childRules[n.parentNode.nodeName];if(typeof(cr)!="undefined"&&!cr.test(n.nodeName)){st=true;t=null}}switch(n.nodeType){case 1:hc=n.hasChildNodes();if(st)break;if((tinyMCE.isRealIE)&&n.nodeName.indexOf('/')!=-1)break;nn=n.nodeName;if(this.settings.convert_fonts_to_spans){if(this.settings.on_save&&nn=='FONT')nn='SPAN';if(!this.settings.
 on_save&&nn=='SPAN')nn='FONT'}if(this.vElementsRe.test(nn)&&(!this.iveRe||!this.iveRe.test(nn))&&!inn){va=true;r=this.rules[nn];if(!r){at=this.rules;for(no in at){if(at[no]&&at[no].validRe.test(nn)){r=at[no];break}}}en=r.isWild?nn.toLowerCase():r.oTagName;f=r.fill;if(r.removeEmpty&&!hc)return"";t='<'+en;if(r.vAttribsReIsWild){at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&r.vAttribsRe.test(no.nodeName))t+=this._serializeAttribute(n,r,no.nodeName)}}else{for(i=r.vAttribs.length-1;i>-1;i--)t+=this._serializeAttribute(n,r,r.vAttribs[i])}if(!this.settings.on_save){at=this.mceAttribs;for(no in at){if(at[no])t+=this._serializeAttribute(n,r,at[no])}}if(r.reqAttribsRe&&!t.match(r.reqAttribsRe))t=null;if(t!=null&&this.closeElementsRe.test(nn))return t+' />';if(t!=null)h+=t+'>';if(this.isIE&&this.codeElementsRe.test(nn))h+=n.innerHTML}break;case 3:if(st)break;if(n.parentNode&&this.codeElementsRe.test(n.parentNode.nodeName))return this.isIE?'':n.nodeValue;return t
 his.xmlEncode(n.nodeValue);case 8:if(st)break;return"<!--"+this._trimComment(n.nodeValue)+"-->"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)h+=this.serializeNodeAsHTML(cn[i])}if(f&&!hc)h+=this.fillStr;if(t!=null&&va)h+='</'+en+'>';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttribs[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&/^(src|href|longdesc)$/.test(an))av=this._urlConverter(this,n,av);if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av,1);return" "+an+"="+'"'+av+'"'}r
 eturn""},formatHTML:function(h){var s=this.settings,p='',i=0,li=0,o='',l;h=h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(/<br\s*\/>/gi,'\n');return'<pre'+b+'>'+c+'</pre>'});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s,skip_apos){var cl=this,re=!skip_apos?this.xmlEncodeAposRe:this.xmlEncodeRe;this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s,skip_apos);case"named":return s.replace(re,function(c,b){b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(re,function(c,b){return b?'&#'+c.c
 harCodeAt(0)+';':c})}return s},split:function(re,s){var c=s.split(re);var i,l,o=new Array();for(i=0,l=c.length;i<l;i++){if(c[i]!='')o[i]=c[i]}return o},_trimComment:function(s){s=s.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");s=s.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");return s},_getAttrib:function(e,n,d){var v,ex,nn;if(typeof(d)=="undefined")d="";if(!e||e.nodeType!=1)return d;try{v=e.getAttribute(n,0)}catch(ex){v=e.getAttribute(n,2)}if(n=="class"&&!v)v=e.className;if(this.isIE){if(n=="http-equiv")v=e.httpEquiv;nn=e.nodeName;if(nn=="FORM"&&n=="enctype"&&v=="application/x-www-form-urlencoded")v="";if(nn=="INPUT"&&n=="size"&&v=="20")v="";if(nn=="INPUT"&&n=="maxlength"&&v=="2147483647")v=""}if(n=='style'&&v){if(!tinyMCE.isOpera)v=e.style.cssText;v=tinyMCE.serializeStyle(tinyMCE.parseStyle(v))}if(this.settings.on_save&&n.indexOf('on')!=-1&&this.settings.on_save&&v&&v!="")v=tinyMCE.cleanupEventStr(v);return(v&&v!="")?''+v:d},_urlConverter:function(c,n,v){if(
 !c.settings.on_save)return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v);else if(tinyMCE.getParam('convert_urls')){if(!this.urlConverter)this.urlConverter=eval(tinyMCE.settings.urlconverter_callback);return this.urlConverter(v,n,true)}return v},_arrayToRe:function(a,op,be,af){var i,r;op=typeof(op)=="undefined"?"gi":op;be=typeof(be)=="undefined"?"^(":be;af=typeof(af)=="undefined"?")$":af;r=be;for(i=0;i<a.length;i++)r+=this._wildcardToRe(a[i])+(i!=a.length-1?"|":"");r+=af;return new RegExp(r,op)},_wildcardToRe:function(s){s=s.replace(/\?/g,'(\\S?)');s=s.replace(/\+/g,'(\\S+)');s=s.replace(/\*/g,'(\\S*)');return s},_setupEntities:function(){var n,a,i,s=this.settings;if(!this.entitiesDone){if(s.entity_encoding=="named"){n=tinyMCE.clearArray(new Array());a=this.split(',',s.entities);for(i=0;i<a.length;i+=2)n[a[i]]=a[i+1];this.entities=n}this.entitiesDone=true}},_setupRules:function(){var s=this.settings;if(!this.rulesDone){this.addRuleStr(s.valid_elements);th
 is.addRuleStr(s.extended_valid_elements);this.addChildRemoveRuleStr(s.valid_child_elements);this.rulesDone=true}},_isDuplicate:function(n){var i;if(!this.settings.fix_content_duplication)return false;if(tinyMCE.isRealIE&&n.nodeType==1){if(n.mce_serialized==this.serializationId)return true;n.setAttribute('mce_serialized',this.serializationId)}else{for(i=0;i<this.serializedNodes.length;i++){if(this.serializedNodes[i]==n)return true}this.serializedNodes[this.serializedNodes.length]=n}return false}};TinyMCE_Engine.prototype.createTagHTML=function(tn,a,h){var o='',f=tinyMCE.xmlEncode;o='<'+tn;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)o+=' '+f(n)+'="'+f(''+a[n])+'"'}}o+=!h?' />':'>'+h+'</'+tn+'>';return o};TinyMCE_Engine.prototype.createTag=function(d,tn,a,h){var o=d.createElement(tn);if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o};TinyMCE_Engine.prototype.getElementByAttributeValue=function(n,e,a,
 v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]};TinyMCE_Engine.prototype.getElementsByAttributeValue=function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=new Array();for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i]}return o};TinyMCE_Engine.prototype.isBlockElement=function(n){return n!=null&&n.nodeType==1&&this.blockRegExp.test(n.nodeName)};TinyMCE_Engine.prototype.getParentBlockElement=function(n,r){return this.getParentNode(n,function(n){return tinyMCE.isBlockElement(n)},r);return null};TinyMCE_Engine.prototype.insertAfter=function(n,r){if(r.nextSibling)r.parentNode.insertBefore(n,r.nextSibling);else r.parentNode.appendChild(n)};TinyMCE_Engine.prototype.setInnerHTML=function(e,h){var i,nl,n;if(tinyMCE.isGecko){h=h.replace(/<embed([^>]*)>/gi,'<tmpembed$1>');h=h.replace(/<em([^>]*)>/gi,'<i$1>');h=h.replace(/<tmpembed([^>]*)>/gi,'<embed$1>');h=h.replace(/<strong([^>]*)>/gi,'<b$1>');h=h.replace(/<\/strong>/gi
 ,'</b>');h=h.replace(/<\/em>/gi,'</i>')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}};TinyMCE_Engine.prototype.getOuterHTML=function(e){if(tinyMCE.isIE)return e.outerHTML;var d=e.ownerDocument.createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML};TinyMCE_Engine.prototype.setOuterHTML=function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;fo
 r(i=0,nl=t.childNodes;i<nl.length;i++)e.parentNode.insertBefore(nl[i].cloneNode(true),e);e.parentNode.removeChild(e)}};TinyMCE_Engine.prototype._getElementById=function(id,d){var e,i,j,f;if(typeof(d)=="undefined")d=document;e=d.getElementById(id);if(!e){f=d.forms;for(i=0;i<f.length;i++){for(j=0;j<f[i].elements.length;j++){if(f[i].elements[j].name==id){e=f[i].elements[j];break}}}}return e};TinyMCE_Engine.prototype.getNodeTree=function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn)},na?na:new Array())};TinyMCE_Engine.prototype.getParentElement=function(n,na,f,r){var re=na?new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$'):0,v;if(f&&typeof(f)=='string')return this.getParentElement(n,na,function(no){return tinyMCE.getAttrib(no,f)!=''});return this.getParentNode(n,function(n){return((n.nodeType==1&&!re)||(re&&re.test(n.nodeName)))&&(!f||f(n))},r)};TinyMCE_Engine.prototype.getParentNode=function(n,f,r){while(n){if(n==r)retur
 n null;if(f(n))return n;n=n.parentNode}return null};TinyMCE_Engine.prototype.getAttrib=function(elm,name,dv){var v;if(typeof(dv)=="undefined")dv="";if(!elm||elm.nodeType!=1)return dv;try{v=elm.getAttribute(name,0)}catch(ex){v=elm.getAttribute(name,2)}if(name=="class"&&!v)v=elm.className;if(tinyMCE.isGecko&&name=="src"&&elm.src!=null&&elm.src!="")v=elm.src;if(tinyMCE.isGecko&&name=="href"&&elm.href!=null&&elm.href!="")v=elm.href;if(name=="http-equiv"&&tinyMCE.isIE)v=elm.httpEquiv;if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!="")?v:dv};TinyMCE_Engine.prototype.setAttrib=function(el,name,va,fix){if(typeof(va)=="number"&&va!=null)va=""+va;if(fix){if(va==null)va="";va=va.replace(/[^0-9%]/g,'')}if(name=="style")el.style.cssText=va;if(name=="class")el.className=va;if(va!=null&&va!=""&&va!=-1)el.setAttribute(name,va);else el.removeAttribute(name)};TinyMCE_Engine.prototype.setStyleAttrib=function(e,n,v){e.style[n]=v;if(tinyMCE.isIE&&v==null||v==''){v=tinyMCE.ser
 ializeStyle(tinyMCE.parseStyle(e.style.cssText));e.style.cssText=v;e.setAttribute("style",v)}};TinyMCE_Engine.prototype.switchClass=function(ei,c){var e;if(tinyMCE.switchClassCache[ei])e=tinyMCE.switchClassCache[ei];else e=tinyMCE.switchClassCache[ei]=document.getElementById(ei);if(e){if(tinyMCE.settings.button_tile_map&&e.className&&e.className.indexOf('mceTiledButton')==0)c='mceTiledButton '+c;e.className=c}};TinyMCE_Engine.prototype.getAbsPosition=function(n,cn){var l=0,t=0;while(n&&n!=cn){l+=n.offsetLeft;t+=n.offsetTop;n=n.offsetParent}return{absLeft:l,absTop:t}};TinyMCE_Engine.prototype.prevNode=function(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null};TinyMCE_Engine.prototype.nextNode=function(e,n){var a=n.split(','),i;while((e=e.nextSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null};TinyMCE_Engine.prototype.selectElements=function(n,na,f){var i,a=[],nl,x;for(
 x=0,na=na.split(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a};TinyMCE_Engine.prototype.selectNodes=function(n,f,a){var i;if(!a)a=new Array();if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a)}return a};TinyMCE_Engine.prototype.addCSSClass=function(e,c,b){var o=this.removeCSSClass(e,c);return e.className=b?c+(o!=''?(' '+o):''):(o!=''?(o+' '):'')+c};TinyMCE_Engine.prototype.removeCSSClass=function(e,c){c=e.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)"),' ');return e.className=c!=' '?c:''};TinyMCE_Engine.prototype.hasCSSClass=function(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className)};TinyMCE_Engine.prototype.renameElement=function(e,n,d){var ne,i,ar;d=typeof(d)=="undefined"?tinyMCE.selectedInstance.getDoc():d;if(e){ne=d.createElement(n);ar=e.attributes;for(i=ar.length-1;i>-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setA
 ttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i<ar.length;i++)ne.appendChild(ar[i].cloneNode(true));e.parentNode.replaceChild(ne,e)}};TinyMCE_Engine.prototype.getViewPort=function(w){var d=w.document,m=d.compatMode=='CSS1Compat',b=d.body,de=d.documentElement;return{left:w.pageXOffset||(m?de.scrollLeft:b.scrollLeft),top:w.pageYOffset||(m?de.scrollTop:b.scrollTop),width:w.innerWidth||(m?de.clientWidth:b.clientWidth),height:w.innerHeight||(m?de.clientHeight:b.clientHeight)}};TinyMCE_Engine.prototype.getStyle=function(n,na,d){if(!n)return false;if(tinyMCE.isGecko&&n.ownerDocument.defaultView){try{return n.ownerDocument.defaultView.getComputedStyle(n,null).getPropertyValue(na)}catch(n){return null}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase()});if(n.currentStyle)return n.currentStyle[na];return false};TinyMCE_Engine.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');i
 f(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break}pos=i;urlParts['host']=url_str.substring(lastPos,pos);urlParts['port']="";lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos)}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos)}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos)}}return urlParts};TinyMCE_Engine.prototype.serializeURL=function(up){var o="";if(up['protocol'])o+=up['protocol']+"://";if(up['host'])o+=up['host'];if(up['port'])o+=":"+up['port'];if(up['pa
 th'])o+=up['path'];if(up['query'])o+="?"+up['query'];if(up['anchor'])o+="#"+up['anchor'];return o};TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var baseURL=this.parseURL(base_url);var targetURL=this.parseURL(url_to_relative);var strTok1;var strTok2;var breakPoint=0;var outPath="";var forceSlash=false;if(targetURL.path=="")targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(breakPoint==1)return targetURL.path;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPat
 h+="/"+strTok2[i];else outPath+=strTok2[i]}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==""&&forceSlash?"/":outPath;var fileName=baseURL.path;var pos;if((pos=fileName.lastIndexOf('/'))!=-1)fileName=fileName.substring(pos+1);if(fileName==targetURL.path&&targetURL.anchor!="")targetURL.path="";if(targetURL.path==""&&!targetURL.anchor)targetURL.path=fileName!=""?fileName:"/";return this.serializeURL(targetURL)};TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=this.parseURL(base_url),baseURLParts,relURLParts;var relURL=this.parseURL(relative_url);if(relative_url==""||relative_url.indexOf('://')!=-1||/^(mailto:|javascript:|#|\/)/.test(relative_url))return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.lengt
 h]=baseURLParts[i]}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue}if(numBack>0){numBack--;continue}newRelURLParts[newRelURLParts.length]=relURLParts[i]}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)};TinyMCE_Engine.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!
 =-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(on_save&&tinyMCE.getParam('relative_urls')){var curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(curl.charAt(0)=='/')curl=tinyMCE.settings['document_base_prefix']+curl;var urlParts=tinyMCE.parseURL(curl);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],curl)}if(!tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return
 "#"+urlParts['anchor']}if(tinyMCE.getParam('remove_script_host')){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url};TinyMCE_Engine.prototype.convertAllRelativeURLs=function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;i<elms.length;i++){src=tinyMCE.getAttrib(elms[i],'src');msrc=tinyMCE.getAttrib(elms[i],'mce_src');if(msrc!="")src=msrc;if(src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src)}}elms=body.getElementsByTagName("a");for(i=0;i<elms.length;i++){href=tinyMCE.getAttrib(elms[i],'href');mhref=tinyMCE.getAttrib(elms[i],'mce_href');if(mhref!="")href=mhref;if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href)}}};TinyMCE_Engine.prototype.clearArray=function(a){var n;for(n in a)a[n]=null;retu
 rn a};TinyMCE_Engine.prototype.explode=function(d,s){var ar=s.split(d),oar=new Array(),i;for(i=0;i<ar.length;i++){if(ar[i]!="")oar[oar.length]=ar[i]}return oar};TinyMCE_Engine.prototype._setEventsEnabled=function(node,state){var evs,x,y,elms,i,event;var events=['onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];evs=tinyMCE.settings['event_elements'].split(',');for(y=0;y<evs.length;y++){elms=node.getElementsByTagName(evs[y]);for(i=0;i<elms.length;i++){event="";for(x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!=''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event)}}}}};TinyMCE_Engine.prototype._eventPatch=function(editor_id){var n,inst,win,e;if(typeof(tinyMCE)=="undefined")return true;try{if(tinyMCE.se
 lectedInstance){win=tinyMCE.selectedInstance.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.select();win=inst.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}}catch(ex){}};TinyMCE_Engine.prototype.findEvent=function(e){var n,inst;if(e)return e;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(tinyMCE.isInstance(inst)&&inst.getWin().event)return inst.getWin().event}return null};TinyMCE_Engine.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true)};TinyMCE_Engine.prototype.addEventHandlers=function(inst){this.setEventHandlers(inst,1)};TinyMCE_Engine.prototype.setEventHandlers=function(inst,s){var doc=inst.getDoc(),ie,ot,i,f=s?tinyMCE.addEvent:tinyMCE.removeEvent;ie=['keypress','keyup','keydown','click','mouseup','mo
 usedown','controlselect','dblclick'];ot=['keypress','keyup','keydown','click','mouseup','mousedown','focus','blur','dragdrop'];inst.switchSettings();if(tinyMCE.isIE){for(i=0;i<ie.length;i++)f(doc,ie[i],TinyMCE_Engine.prototype._eventPatch)}else{for(i=0;i<ot.length;i++)f(doc,ot[i],tinyMCE.handleEvent);try{doc.designMode="On"}catch(e){}}};TinyMCE_Engine.prototype.onMouseMove=function(){var inst,lh;if(tinyMCE.lastHover){lh=tinyMCE.lastHover;if(lh.className.indexOf('mceMenu')!=-1)tinyMCE._menuButtonEvent('out',lh);else lh.className=lh.className;tinyMCE.lastHover=null}if(!tinyMCE.hasMouseMoved){inst=tinyMCE.selectedInstance;if(inst.isFocused){inst.undoBookmark=inst.selection.getBookmark();tinyMCE.hasMouseMoved=true}}};TinyMCE_Engine.prototype.cancelEvent=function(e){if(!e)return false;if(tinyMCE.isIE){e.returnValue=false;e.cancelBubble=true}else{e.preventDefault();e.stopPropagation&&e.stopPropagation()}return false};TinyMCE_Engine.prototype.addEvent=function(o,n,h){if(n!='unload'
 ){function clean(){var ex;try{tinyMCE.removeEvent(o,n,h);tinyMCE.removeEvent(window,'unload',clean);o=n=h=null}catch(ex){}}tinyMCE.addEvent(window,'unload',clean)}if(o.attachEvent)o.attachEvent("on"+n,h);else o.addEventListener(n,h,false)};TinyMCE_Engine.prototype.removeEvent=function(o,n,h){if(o.detachEvent)o.detachEvent("on"+n,h);else o.removeEventListener(n,h,false)};TinyMCE_Engine.prototype.addSelectAccessibility=function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w}return false};TinyMCE_Engine.prototype.accessibleEventHandler=function(e){var win=this._win;e=tinyMCE.isIE?win.event:e;var elm=tinyMCE.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null}return true}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;e
 lm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false}return true};TinyMCE_Engine.prototype._resetIframeHeight=function(){var ife;if(tinyMCE.isRealIE){ife=tinyMCE.selectedInstance.iframeElement;if(ife._oldHeight){ife.style.height=ife._oldHeight;ife.height=ife._oldHeight}}};function TinyMCE_Selection(inst){this.instance=inst};TinyMCE_Selection.prototype={getSelectedHTML:function(){var inst=this.instance;var e,r=this.getRng(),h;if(!r)return null;e=document.createElement("body");if(r.cloneContents)e.appendChild(r.cloneContents());else if(typeof(r.item)!='undefined'||typeof(r.htmlText)!='undefined')e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();h=tinyMCE._cleanupHTML(inst,inst.contentDocument,inst.settings,e,e,false,true,false);return h},getSelectedText:function(){var inst=this.instance;var d,r,s,t;if(tinyMCE.isIE){d=inst.getDoc();if(d.selection.type=="Text"){r=d.selection.createRange();t=r.text}else t=''}else{s=this.getSel();if(
 s&&s.toString)t=s.toString();else t=''}return t},getBookmark:function(simple){var inst=this.instance;var rng=this.getRng();var doc=inst.getDoc(),b=inst.getBody();var sp,le,s,e,nl,i,si,ei,w;var trng,sx,sy,xx=-999999999,vp=inst.getViewPort();sx=vp.left;sy=vp.top;if(tinyMCE.isSafari||tinyMCE.isOpera||simple)return{rng:rng,scrollX:sx,scrollY:sy};if(tinyMCE.isIE){if(rng.item){e=rng.item(0);nl=b.getElementsByTagName(e.nodeName);for(i=0;i<nl.length;i++){if(e==nl[i]){sp=i;break}}return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy}}else{trng=doc.body.createTextRange();trng.moveToElementText(inst.getBody());trng.collapse(true);bp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(true);sp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(false);le=Math.abs(trng.move('character',xx))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy}}}if(tinyMCE.isGecko){s=this.getSel();e=this.getFocusElement();if(!s)return null;if(e&&e.nodeName=='IMG'){ret
 urn{start:-1,end:-1,index:sp,scrollX:sx,scrollY:sy}}if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=this._getPosText(b,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+s.anchorOffset,end:e.end+s.focusOffset,scrollX:sx,scrollY:sy}}else{e=this._getPosText(b,rng.startContainer,rng.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+rng.startOffset,end:e.end+rng.endOffset,scrollX:sx,scrollY:sy}}}return null},moveToBookmark:function(bookmark){var inst=this.instance;var rng,nl,i,ex,b=inst.getBody(),sd;var doc=inst.getDoc();var win=inst.getWin();var sel=this.getSel();if(!bookmark)return false;if(tinyMCE.isSafari){sel.setBaseAndExtent(bookmark.rng.startContainer,bookmark.rng.startOffset,bookmark.rng.endContainer,bookmark.rng.endOffset);return true}if(tinyMCE.isRealIE){if(bookmark.rng){try{bookmark.rng.select()}catch(ex){}return true}win.focus();if(bookmark.tag){rng=b.createControlRange();nl=b.getElementsByTagName(bo
 okmark.tag);if(nl.length>bookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(!sel)return false;if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode()
 )!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null},selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAnd
 Extent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node)}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length)}else rng.collapse(to_start)}sel.removeAllRanges();sel.addRange(rng)}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeft<vp.left||pos.absLeft>vp.left+vp.width||pos.absTop<vp.top||pos.absTop>vp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContaine
 rWin();cvp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeft<cvp.left||p.absLeft>cvp.left+cvp.width||p.absTop<cvp.top||p.absTop>cvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;if(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();if(s.rangeCount>0)return s.getRangeAt(0);return null},isCollapsed:function(){var r=this.getRng();if(r.item)return false;return r.boundingWidth==0||this.getSel().isCollapsed},collapse:function(b){var r=this.getRng(),s=this.getSel();if(r.select){r.collapse(b);r.select()}else{if(b)s.
 collapseToStart();else s.collapseToEnd()}},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(
 tinyMCE.typingUndoIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i<this.undoLevels.length-1;i++)this.undoLevels[i]=this.undoLevels[i+1];this.undoLevels.length--;this.undoIndex--;}b=inst.undoBookmark;if(!b)b=inst.selection.getBookmark();this.undoIndex++;this.undoLevels[this.undoIndex]={content:newHTML,bookmark:b};ul=tinyMCE.undoLevels;for(i=tinyMCE.undoIndex+1;i<ul.length;i++){ur=ul[i].undoRedo;if(ur.undoIndex==ur.undoLevels.length-1)ur.undoIndex--;ur.undoLevels.length--}tinyMCE.undoLevels[tinyMCE.undoIndex++]=inst;tinyMCE.undoLevels.length=tinyMCE.undoIndex;this.undoLevels.length=this.undoIndex+1;return true}return false},undo:function(){var
  inst=this.instance;if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.is
 Opera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents;function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()==""}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false}return true}rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;startNode=direct?sel.anchorNode:sel.focusNode;startOffset=direct?sel.anchorOffset:sel.focusOffset;endNode=direct?sel.focusNode:sel.anchorNode;endOffset=direct?sel.focusOffset:sel.
 anchorOffset;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;startBlock=inst.getParentBlockElement(startNode);endBlock=inst.getParentBlockElement(endNode);if(startBlock&&new RegExp('absolute|relative|static','gi').test(startBlock.style.position))startBlock=null;if(endBlock&&new RegExp('absolute|relative|static','gi').test(endBlock.style.position))endBlock=null;if(startBlock!=null){blockName=startBlock.nodeName;if(blockName=="TD"||blockName=="TABLE"||(blockName=="DIV"&&new RegExp('left|right','gi').test(startBlock.style.cssFloat)))blockName="P"}if(tinyMCE.getParentElement(startBlock,"OL,UL",null,body)!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);paraAfter=(endBlock!=null&&endBlock.node
 Name==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");startChop=startNode;endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();if(!tinyMCE.isSafari)sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.set
 EndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();if(tinyMCE.isOpera){paraBefore.normalize();rngBefore.insertNode(paraBefore);paraAfter.normalize();rngBefore.insertNode(paraAfter)}else{paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore)}}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true}if(startChop.nodeName==
 blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.par
 entNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_handleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re);var w=parseInt(re.offsetWidth);var h=
 parseInt(re.offsetHeight);var e=this.getElement();var ew=parseInt(e.offsetWidth);var eh=parseInt(e.offsetHeight);var x,y;switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2);break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){var el=this.getElement();if(el){el.style.display='block';this.updateBlocker()}},hide:function(){var el=this.
 getElement();if(el){el.style.display='none';this.updateBlocker()}},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=this.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(this.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.bod
 y.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.element=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)},remove:function(){var e=this.getElement(),b=this.getBlocker();if(e)e.parentNode.removeChild(e);if(b)b.parentNode.removeChild(b)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=new Array();this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:
 'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=new Array()},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='<span class="mceMenuLine"></span>';h+='<table border="0" cellpadding="0" cellspacing="0">';for(i=0;i<m.length;i++){t=tinyMCE.xmlEncode(m[i].text);c=m[i].class_name?' class="'+m[i].class_name+'"':'';switch(m[i].type){case'separator':h+='<tr class="'+s.separator_class+'"><td>';break;case'title':h+='<tr class="'+s.title_class+'"><td><span'+c+'>'+t+'</spa
 n>';break;case'disabled':h+='<tr class="'+s.disabled_class+'"><td><span'+c+'>'+t+'</span>';break;default:h+='<tr><td><a href="'+tinyMCE.xmlEncode(m[i].js)+'" onmousedown="'+tinyMCE.xmlEncode(m[i].js)+';return tinyMCE.cancelEvent(event);" onclick="return tinyMCE.cancelEvent(event);" onmouseup="return tinyMCE.cancelEvent(event);"><span'+c+'>'+t+'</span></a>'}h+='</td></tr>'}h+='</table>';e.innerHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});if(!Function.prototype.call){Function.prototype.call=function(){var a=arguments,s=a[0],i,as='',r,o;for(i=1;i<a.length;i++)as+=(i>1?',':'')+'a['+i+']';o=s._fu;s._fu=this;r=eval('s._fu('+as+')');s._fu=o;return r}};TinyMCE_Engine.prototype.debug=function(){var m="",a,i,l=tinyMCE.log.length;for(i=
 0,a=this.debug.arguments;i<a.length;i++){m+=a[i];if(i<a.length-1)m+=', '}if(l<1000)tinyMCE.log[l]="[debug] "+m};
\ No newline at end of file
+function TinyMCE_Engine(){var ua;this.majorVersion="2";this.minorVersion="1.2";this.releaseDate="2007-08-21";this.instances=[];this.switchClassCache=[];this.windowArgs=[];this.loadedFiles=[];this.pendingFiles=[];this.loadingIndex=0;this.configs=[];this.currentConfig=0;this.eventHandlers=[];this.log=[];this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.settings=[];ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isMSIE7=this.isMSIE&&(ua.indexOf('MSIE 7')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=window['opera']&&opera.buildNumber?true:false;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=[];this.themes=[];this.menus=[];this.loadedPlugins=[];this.buttonMap=[];thi
 s.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false}this.isIE=this.isMSIE;this.isRealIE=this.isMSIE&&!this.isOpera;this.idCounter=0};TinyMCE_Engine.prototype={init:function(settings){var theme,nl,baseHREF="",i,cssPath,entities,h,p,src,elements=[],head;if(this.isMSIE5_0)return;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){head=document.getElementsByTagName('head')[0];if(head){for(i=0,nl=head.getElementsByTagName('script');i<nl.length;i++)elements.push(nl[i])}for(i=0,nl=document.getElementsByTagName('script');i<nl.length;i++)elements.push(nl[i]);nl=document.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)baseHREF=nl[i].href}for(i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_dev.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip")!=-1)){src=elements
 [i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1||src.indexOf('_dev')!=-1)?'_src':'';tinyMCE.gzipMode=src.indexOf('_gzip')!=-1;src=src.substring(0,src.lastIndexOf('/'));if(settings.exec_mode=="src"||settings.exec_mode=="normal")tinyMCE.srcMode=settings.exec_mode=="src"?'_src':'';if(baseHREF!==''&&src.indexOf('://')==-1)tinyMCE.baseURL=baseHREF+src;else tinyMCE.baseURL=src;break}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL}this._def("mode","none");this._def("theme","advanced");this._def("plugins","",true);this._def("language","en");this._def("docs_language",this.settings.language);th
 is._def("elements","");this._def("textarea_trigger","mce_editable");this._def("editor_selector","");this._def("editor_deselector","mceNoEditor");this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],t
 foot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");this._def("extended_valid_elements","");this._def("invalid_elements","");this._def("encoding","");
 this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));this._def("save_callback","");this._def("force_br_newlines",false);this._def("force_p_newlines",true);this._def("add_form_submit_trigger",true);this._def("relative_urls",true);this._def("remove_script_host",true);this._def("focus_alert",true);this._def("document_base_url",this.documentURL);this._def("visual",true);this._def("visual_table_class","mceVisualAid");this._def("setupcontent_callback","");this._def("fix_content_duplication",true);this._def("custom_undo_redo",true);this._def("custom_undo_redo_levels",-1);this._def("custom_undo_redo_keyboard_shortcuts",true);this._def("custom_undo_redo_restore_selection",true);this._def("custom_undo_redo_global",false);this._def("verify_html",true);this._def("apply_source_formatting",false);this._def("directionality","ltr");this._def("cleanup_on_startup",false);this._def("inline_styles",false);this._def("convert_newlines_
 to_brs",false);this._def("auto_reset_designmode",true);this._def("entities","39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,25
 0,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747
 ,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",true);this._def("entity_encoding","named");this._def("cleanup_callback","");this._def("add_unload_trigger",true);this._def("ask",false);this._def("nowrap",false);this._def("auto_resize",false);this._def("auto_focus",false);this._def("cleanup",true);this._def("remove_linebreaks",true);this._def("button_tile_map",false);this._def("submit_patch",true);this._def("browsers
 ","msie,safari,gecko,opera",true);this._def("dialog_type","window");this._def("accessibility_warnings",true);this._def("accessibility_focus",true);this._def("merge_styles_invalid_parents","");this._def("force_hex_style_colors",true);this._def("trim_span_elements",true);this._def("convert_fonts_to_spans",false);this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",true);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",
 '');this._def("gecko_spellcheck",false);this._def("hide_selects_on_submit",true);this._def("forced_root_block",false);this._def("remove_trailing_nbsp",false);this._def("save_on_tinymce_forms",false);if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings.browsers.indexOf('msie')==-1)return;if(this.isGecko&&this.settings.browsers.indexOf('gecko')==-1)return;if(this.isSafari&&this.settings.browsers.indexOf('safari')==-1)return;if(this.isOpera&&this.settings.browsers.indexOf('opera')==-1)return;baseHREF=tinyMCE.settings.document_base_url;h=document.location.href;p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings.document_base_url=baseHREF;tinyMCE.settings.document_base_prefix=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings.base_href=baseHREF.substring(0,baseHREF.last
 IndexOf('/'))+"/";theme=this.settings.theme;this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';this.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=[13,45,36,35,33,34,37,38,39,40];this.uniqueURL='javascript:void(091039730);';this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';this.callbacks=['onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup','removeInstance'];thi
 s.settings.theme_href=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings.force_br_newlines=false;if(tinyMCE.getParam("popups_css",false)){cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.popups_css=this.documentBasePath+"/"+cssPath;else this.settings.popups_css=cssPath}else this.settings.popups_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.editor_css=this.documentBasePath+"/"+cssPath;else this.settings.editor_css=cssPath}else{if(this.settings.editor_css!=='')this.settings.editor_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(this.configs.length==0){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMC
 E.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings.theme+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings.language+'.js');this.loadCSS(this.settings.editor_css);p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){if(p[i].charAt(0)!='-')this.loadScript(tinyMCE.baseURL+'/plugins/'+p[i]+'/editor_plugin'+tinyMCE.srcMode+'.js')}}if(tinyMCE.getParam('entity_encoding')=='named'){settings.cleanup_entities=[];entities=tinyMCE.getParam('entities','',true,',');for(i=0;i<entities.length;i+=2)settings.cleanup_entities['c'+entities[i]]=entities[i+1]}settings.index=this.configs.length;this.configs[this.configs.length]=settings;this.loadNextScript();if(this.isI
 E&&!this.isOpera){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}this.xmlEncodeRe=new RegExp('[<>&"]','g')},_addUnloadEvents:function(){var st=tinyMCE.settings.add_unload_trigger;if(tinyMCE.isIE){if(st){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(st)tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substri
 ng(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return}if(tinyMCE.settings.strict_loading_mode)this.pendingFiles[this.pendingFiles.length]=url;else document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex<this.pendingFiles.length){se=d.createElementNS('http://www.w3.org/1999/xht
 ml','script');se.setAttribute('language','javascript');se.setAttribute('type','text/javascript');se.setAttribute('src',this.pendingFiles[this.loadingIndex++]);d.getElementsByTagName("head")[0].appendChild(se)}else this.loadingIndex=-1;},loadCSS:function(url){var ar=url.replace(/\s+/,'').split(',');var lflen=0,csslen=0,skip=false;var x=0,i=0,nl,le;for(x=0,csslen=ar.length;x<csslen;x++){if(ar[x]!=null&&ar[x]!='null'&&ar[x].length>0){for(i=0,lflen=this.loadedFiles.length;i<lflen;i++){if(this.loadedFiles[i]==ar[x]){skip=true;break}}if(!skip){if(tinyMCE.settings.strict_loading_mode){nl=document.getElementsByTagName("head");le=document.createElement('link');le.setAttribute('href',ar[x]);le.setAttribute('rel','stylesheet');le.setAttribute('type','text/css');nl[0].appendChild(le)}else document.write('<link href="'+ar[x]+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',')
 ;var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x<csslen;x++){css_file=css_ary[x];if(css_file!=null&&css_file!='null'&&css_file.length>0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings.convert_on_click||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang.lang_edit_confirm)))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement,n,inst,doc;formElement=document.getElementById(form_element_name);for(n in tinyMCE.instances){
 inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instances=t;n=[];t=tinyMCE.undoLevels;for(i=0;i<t.length;i++){if(t[i]!=ti)n.push(t[i])}tinyMCE.undoLevels=n;tinyMCE.undoIndex=n.length;tinyMCE.dispatchCallback(ti,'remove_instance_callback','removeInstance',ti);return ti},removeMCEControl:function(editor_id){var inst=tinyMCE.getInstanceById(
 editor_id),h,re,ot,tn,n;if(inst){inst.switchSettings();editor_id=inst.editorId;h=tinyMCE.getContent(editor_id);this.removeInstance(inst);tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;tinyMCE.selectedInstance=tinyMCE.instances[n];break}re=document.getElementById(editor_id+"_parent");ot=inst.oldTargetElement;tn=ot.nodeName.toLowerCase();if(tn=="textarea"||tn=="input"){re.parentNode.removeChild(re);ot.style.display="inline";ot.value=h}else{ot.innerHTML=h;ot.style.display='block';re.parentNode.insertBefore(ot,re);re.parentNode.removeChild(re)}}},triggerSave:function(skip_cleanup,skip_callback){var inst,n;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.triggerSave(skip
 _cleanup,skip_callback)}},resetForm:function(form_index){var i,inst,n,formObj=document.forms[form_index];for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name)inst.getBody().innerHTML=inst.startContent}}},execInstanceCommand:function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id),r;if(inst){r=inst.selection.getRng();if(typeof(focus)=="undefined")focus=true;if(focus&&(!r||!r.item))inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();inst.select();tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isIE&&window.event!=null)tinyMCE.cancelEvent(window.event)}},execCommand:function(command,user_interface,value){var inst=tinyMCE.selectedInstance,n,pe,te;user_interface=user_interface?user_interface:false;value=value?value:null;if(inst)i
 nst.switchSettings();switch(command){case"Undo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex>0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value.element,value.document),value.element,value.document);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCE
 Control(value);return;case"mceToggleEditor":inst=tinyMCE.getInstanceById(value);if(inst){pe=document.getElementById(inst.editorId+'_parent');te=inst.oldTargetElement;if(typeof(inst.enabled)=='undefined')inst.enabled=true;inst.enabled=!inst.enabled;if(!inst.enabled){pe.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')te.value=inst.getHTML();else te.innerHTML=inst.getHTML();te.style.display=inst.oldTargetDisplay;tinyMCE.dispatchCallback(inst,'hide_instance_callback','hideInstance',inst)}else{pe.style.display='block';te.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')inst.setHTML(te.value);else inst.setHTML(te.innerHTML);inst.useCSS=false;tinyMCE.dispatchCallback(inst,'show_instance_callback','showInstance',inst)}}else tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceResetDesignMode":if(tinyMCE.isGecko){for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].g
 etDoc().designMode="off";tinyMCE.instances[n].getDoc().designMode="on";tinyMCE.instances[n].useCSS=false}catch(e){}}}return}if(inst){inst.execCommand(command,user_interface,value)}else if(tinyMCE.settings.focus_alert)alert(tinyMCELang.lang_focus_alert)},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings.area_width;ah=""+tinyMCE.settings.area_height;if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMa
 rgin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings.auto_resize)iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings.default_document);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i,doc=inst.getDoc(),head=doc.getElementsByTagName('head').item(0);var content=inst.startContent,contentElement,body;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/&lt;/g,'<');content=content.replace(/&gt;/g,'>');content=content.replace(/&quot;
 /g,'"');content=content.replace(/&amp;/g,'&')}tinyMCE.selectedInstance=inst;inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head||!doc.body){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings.theme+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings.content_css);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'<h'+i+'>');inst.addShortcut('ctrl','7','','FormatBlock',false,'<p>');inst.addShortcut('ctrl','8',''
 ,'FormatBlock',false,'<div>');inst.addShortcut('ctrl','9','','FormatBlock',false,'<address>');if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings.nowrap)doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings.directionality;doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings.base_href);if(tinyMCE.settings.convert_newlines_to_brs){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSS
 Classes(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings.force_br_newlines)doc.styleSheets[0].addRule("p","margin: 0;");body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){contentElement=inst.getDoc().createElement("body");doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings.cleanup_on_startup)tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings.cleanup_on_startup){tinyMCE._setHTML(inst.getDoc(),content);try{tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,inst.contentDocument,this.settings,inst.getBody()))}catch(e){}}else tinyMCE._setHTML(inst.getDoc(),content)}tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings.visual,inst);tinyMCE.dispatchCallback(inst,'setupcontent_cal
 lback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.a
 dd({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},removeTinyMCEFormElements:function(form_obj){var i,elementId;if(!tinyMCE.getParam('hide_selects_on_submit'))return;if
 (typeof(form_obj)=="undefined"||form_obj==null)return;if(form_obj.nodeName!="FORM"){if(form_obj.form)form_obj=form_obj.form;else form_obj=tinyMCE.getParentElement(form_obj,"form")}if(form_obj==null)return;for(i=0;i<form_obj.elements.length;i++){elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true}},handleEvent:function(e){var inst=tinyMCE.selectedInstance,i,elm,keys;if(typeof(tinyMCE)=="undefined")return true;if(tinyMCE.executeCallback(tinyMCE.selectedInstance,'handle_event_callback','handleEvent',e))return false;switch(e.type){case"beforedeactivate":case"blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');tinyMCE.hideMenus();return;case"drop":case"beforepaste":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.setBaseHREF(null);if(tinyMCE.isRealIE){var ife=tinyMCE.selectedInstance.iframeElement;if(ife.style.height.indexOf('%')!=-1){
 ife._oldHeight=ife.style.height;ife.style.height=ife.clientHeight}}window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings.base_href);tinyMCE._resetIframeHeight();",1);return;case"submit":tinyMCE.formSubmit(tinyMCE.isMSIE?window.event.srcElement:e.target);return;case"reset":var formObj=tinyMCE.isIE?window.event.srcElement:e.target;for(i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10)}return;case"keypress":if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId){tinyMCE.instances[e.target.editorId].select()}else{if(e.target.ownerDocument.editorId)tinyMCE.instances[e.target.ownerDocument.editorId].select()}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if((tinyMCE.isGecko||tinyMCE.isOpera||tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&e.keyCode==13&&!e.shiftKey){if(TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance,e)){tinyMCE.execCommand("mceAddUn
 doLevel");return tinyMCE.cancelEvent(e)}}if((tinyMCE.isGecko&&!tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if(tinyMCE.isIE&&tinyMCE.settings.force_br_newlines&&e.keyCode==13){if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img"
 );tinyMCE.triggerNodeChange(false)}return false;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;inst._fixRootBlocks();if(inst.settings.remove_trailing_nbsp)inst._fixTrailingNbsp();if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.s
 electedInstance.getBody(),true,tinyMCE.settings.visual,tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;"}}}keys=tinyMCE.posKeyCodes;var posKey=false;for(i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break}}if(tinyMCE.isIE&&tinyMCE.settings.custom_undo_redo){keys=[8,46];for(i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false)}}}if(e.keyCode==17)return true;if(tinyMCE.isGecko){if(!posKey&&e.type=="keyup"&&!e.ctrlKey||(e.ctrlKey&&(e.keyCode==86||e.keyCode==88)))tinyMCE.execCommand("mceStartTyping")}else{if(!posKey&&e.type=="keyup")tinyMCE.execComm
 and("mceStartTyping")}if(e.type=="keydown"&&(posKey||e.ctrlKey)&&inst)inst.undoBookmark=inst.selection.getBookmark();if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;case"mousedown":case"mouseup":case"click":case"dblclick":case"focus":tinyMCE.hideMenus();if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();tinyMCE.selectedInstance.isFocused=true}var targetBody=tinyMCE.getParentElement(e.target,"html");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody().parentNode==targetBody){inst.select();tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.se
 lectedElement,"img");break}}if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark&&(e.type=="mouseup"||e.type=="dblclick"))tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark();if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.instances[e.target.editorId].select();return false}},getButtonHTML:function(id,lang,img,cmd,ui,val){var h='',m,x,io='';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.isRealIE)io='onmouseover="tinyMCE.lastHover = this;"';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=this.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang'
 )==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" alt="{$'+lang+'}" title="{$'+lang+'}" />';h+='</a>'}else{h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceButtonNormal" target="_self">';h+='<img src="'+img+'" alt="{$'+lang+'}" title="{$'+lang+'}" />';h+='</a>'}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOp
 era)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: '+x+'px 0" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}else{if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButto
 n" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i<a.length;i++)this.buttonMap[a[i]]=i},formSubmit:function(f,p){var n,inst,found=false;if(f.form)f=f.form;if(tinyMCE.getParam(
 'save_on_tinymce_forms')){for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.formElement){if(f==inst.formElement.form){found=true;inst.isNotDirty=true}}}}else found=true;if(found){tinyMCE.removeTinyMCEFormElements(f);tinyMCE.triggerSave()}if(f.mceOldSubmit&&p)f.mceOldSubmit()},submitPatch:function(){tinyMCE.formSubmit(this,true)},onLoad:function(){var r,i,c,mode,trigger,elements,element,settings,elementId,elm;var selector,deselector,elementRefAr,form;if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){window.setTimeout('tinyMCE.onLoad();',1);return}if(tinyMCE.isRealIE&&window.event.type=="readystatechange"&&document.readyState!="complete")return true;if(tinyMCE.isLoaded)return true;tinyMCE.isLoaded=true;if(tinyMCE.isRealIE&&document.body&&window.location.href!=window.top.location.href){r=document.body.createTextRange();r.collapse(true);r.select()}tinyMCE.dispatchCallback(null,'onpageload','onPageLoad');for(c=0;c<ti
 nyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];selector=tinyMCE.getParam("editor_selector");deselector=tinyMCE.getParam("editor_deselector");elementRefAr=[];if(document.forms&&tinyMCE.settings.add_form_submit_trigger&&!tinyMCE.submitTriggers){for(i=0;i<document.forms.length;i++){form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE_Engine.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE_Engine.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings.submit_patch){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE_Engine.prototype.submitPatch}catch(e){}}}}mode=tinyMCE.settings.mode;switch(mode){case"exact":elements=tinyMCE.getParam('elements','',true,',');for(i=0;i<elements.length;i++){element=tinyMCE._getElementById(elements[i]);trigger=element?element.getAttribute(tinyMCE.settings.textarea_trigger):"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"class")))continue;if(trigger=="false")continue;if((ti
 nyMCE.settings.ask||tinyMCE.settings.convert_on_click)&&element){elementRefAr[elementRefAr.length]=element;continue}if(element)tinyMCE.addMCEControl(element,elements[i])}break;case"specific_textareas":case"textareas":elements=document.getElementsByTagName("textarea");for(i=0;i<elements.length;i++){elm=elements.item(i);trigger=elm.getAttribute(tinyMCE.settings.textarea_trigger);if(selector!==''&&!new RegExp('\\b'+selector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if(selector!=='')trigger=selector!==''?"true":"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm}break}for(i=0;i<elementRefAr.length;i++){element=elementRefAr[i];elementId=element.name?element.name:element.id;if(tinyMCE.settings.ask||tinyMCE.settings.convert_on_click){if(tinyMCE.isGecko){settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",f
 unction(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});if(element.nodeName!="TEXTAREA"&&element.nodeName!="INPUT")tinyMCE.addEvent(element,"click",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});}else{settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});tinyMCE.addEvent(element,"click",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});}}else tinyMCE.addMCEControl(element,elementId)}if(tinyMCE.settings.auto_focus){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings.auto_focus);inst.selection.selectNode(inst.getBody(),true,true);inst.contentWindow.focus()},100)}tinyMCE.dispatchCallback(null,'oninit','onInit')}},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.isTinyMCE_Control},getParam:function(name,default_value,strip_whitespace,split_chr){var i,outArray,value=(typeo
 f(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);outArray=[];for(i=0;i<value.length;i++){if(value[i]&&value[i]!=='')outArray[outArray.length]=value[i]}value=outArray}return value},getLang:function(name,default_value,parse_entities,va){var v=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name],n;if(parse_entities)v=tinyMCE.entityDecode(v);if(va){for(n in va)v=this.replaceVar(v,n,va[n])}return v},entityDecode:function(s){var e=document.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue},addToLang:function(prefix,ar){var k;for(k in ar){if(typeof(ar[k])=='function')continue;tinyMCELang[(k.indexOf('lang_')==-1?'lang_':'')+(prefix!==''?(prefix+"_"):'')+k]=ar[k]}this.loadNextScript()},triggerNodeChange:functio
 n(focus,setup_content){var elm,inst,editorId,undoIndex=-1,undoLevels=-1,doc,anySelection=false,st;if(tinyMCE.selectedInstance){inst=tinyMCE.selectedInstance;elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();editorId=inst.editorId;st=inst.selection.getSelectedText();if(tinyMCE.settings.auto_resize)inst.resizeToContent();if(setup_content&&tinyMCE.isGecko&&inst.isHidden())elm=inst.getBody();inst.switchSettings();if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(st&&st.length>0);if(tinyMCE.settings.custom_undo_redo){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,t
 ype,content){var pl,po,i,customCleanup;customCleanup=tinyMCE.settings.cleanup_callback;if(customCleanup!='')content=tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback,window)(type,content,inst);po=tinyMCE.themes[tinyMCE.settings.theme];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i<pl.length;i++){po=tinyMCE.plugins[pl[i]];if(po&&po.cleanup)content=po.cleanup(type,content,inst)}return content},setContent:function(h){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,h);tinyMCE.selectedInstance.repaint()}},importThemeLanguagePack:function(name){if(typeof(name)=="undefined")name=tinyMCE.settings.theme;tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings.language+'.js')},importPluginLanguagePack:function(name){var b=tinyMCE.baseURL+'/plugins/'+name;if(this.plugins[name])b=this.plugins[name].baseURL;tinyMCE.loadScript(b+'/langs/'+tinyMCE.settings.language+'.js')},applyTemplate:func
 tion(h,ag){return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}','gi'),function(m,s){if(s.indexOf('lang_')==0&&tinyMCELang[s])return tinyMCELang[s];if(ag&&ag[s])return ag[s];if(tinyMCE.settings[s])return tinyMCE.settings[s];if(m=='themeurl')return tinyMCE.themeURL;return m})},replaceVar:function(h,r,v){return h.replace(new RegExp('{\\\$'+r+'}','g'),v)},openWindow:function(template,args){var html,width,height,x,y,resizable,scrollbars,url,name,win,modal,features;args=!args?{}:args;args.mce_template_file=template.file;args.mce_width=template.width;args.mce_height=template.height;tinyMCE.windowArgs=args;html=template.html;if(!(width=parseInt(template.width)))width=320;if(!(height=parseInt(template.height)))height=200;if(tinyMCE.isIE)height+=40;else height+=20;x=parseInt(screen.width/ 2.0) - (width /2.0);y=parseInt(screen.height/ 2.0) - (height /2.0);resizable=(args&&args.resizable)?args.resizable:"no";scrollbars=(args&&args.scrollbars)?args.scrollbars:"no";if(template.file.charAt(
 0)!='/'&&template.file.indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template.file;else url=template.file;for(name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]))}if(html){html=tinyMCE.replaceVar(html,"css",this.settings.popups_css);html=tinyMCE.applyTemplate(html,args);win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang.lang_popup_blocked);return}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus()}else{if((tinyMCE.isRealIE)&&resizable!='yes'&&tinyMCE.settings.dialog_type=="modal"){height+=10;features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features)}els
 e{modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template.close_previous!="no")try{tinyMCE.lastWindow.close()}catch(ex){}win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang.lang_popup_blocked);return}if(template.close_previous!="no")tinyMCE.lastWindow=win;try{win.resizeTo(width,height)}catch(e){}if(tinyMCE.isGecko){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24)}win.focus()}}},closeWindow:function(win){win.close()},getVisualAidClass:function(class_name,state){var i,classNames,ar,className,aidClass=tinyMCE.settings.visual_table_class;if(typeof(state)=="undefined")state=tinyMCE.settings.visual;classNames=[];ar=class_name.split(' ');for(i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!=='')classNames[classN
 ames.length]=ar[i]}if(state)classNames[classNames.length]=aidClass;className="";for(i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){var i,x,y,tableElement,anchorName,oldW,oldH,bo,cn;if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,inst);tableElement=null;switch(el.nodeName){case"TABLE":oldW=el.style.width;oldH=el.style.height;bo=tinyMCE.getAttrib(el,"border");bo=bo==''||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(y=0;y<el.rows.length;y++){for(x=0;x<el.rows[y].cells.length;x++){cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn)}}break;case"A":anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!==''&
 &state){el.title=anchorName;tinyMCE.addCSSClass(el,'mceItemAnchor')}else if(anchorName!==''&&!state)el.className='';break}if(deep&&el.hasChildNodes()){for(i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst,true)}},fixGeckoBaseHREFBug:function(m,e,h){var xsrc,xhref;if(tinyMCE.isGecko){if(m==1){h=h.replace(/\ssrc=/gi," mce_tsrc=");h=h.replace(/\shref=/gi," mce_thref=");return h}else{if(!new RegExp('(src|href)=','g').test(h))return h;tinyMCE.selectElements(e,'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK',function(n){xsrc=tinyMCE.getAttrib(n,"mce_tsrc");xhref=tinyMCE.getAttrib(n,"mce_thref");if(xsrc!==''){try{n.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,xsrc)}catch(e){}n.removeAttribute("mce_tsrc")}if(xhref!==''){try{n.href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,xhref)}catch(e){}n.removeAttribute("mce_thref")}return false});tinyMCE.selectNodes(e,function(n){if(n.nodeType==3||n.
 nodeType==8){n.nodeValue=n.nodeValue.replace(/\smce_tsrc=/gi," src=");n.nodeValue=n.nodeValue.replace(/\smce_thref=/gi," href=")}return false})}}return h},_setHTML:function(doc,html_content){var i,html,paras,node;html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content)}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content)}if(tinyMCE.isIE&&tinyMCE.settings.fix_content_duplication){paras=doc.getElementsByTagName("P");for(i=0;i<paras.length;i++){node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName=="P")node.outerHTML=node.innerHTML}}html=doc.body.innerHTML;tinyMCE.setInnerHTML(doc.body,html)}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc)},getEditorId:function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId},getInstanceById:function(editor_id){var inst=this.instances[editor_id],n;if(!inst){for
 (n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.formTargetElementId==editor_id)return inst}}else return inst;return null},queryInstanceCommandValue:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false},queryInstanceCommandState:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null},setWindowArg:function(n,v){this.windowArgs[n]=v},getWindowArg:function(n,d){return(typeof(this.windowArgs[n])=="undefined")?d:this.windowArgs[n]},getCSSClasses:function(editor_id,doc){var i,c,x,rule,styles,rules,csses,selectorText,inst=tinyMCE.getInstanceById(editor_id);var cssClass,addClass,p;if(!inst)inst=tinyMCE.selectedInstance;if(!inst)return[];if(!doc)doc=inst.getDoc();if(inst&&inst.cssClasses.length>0)return inst.cssClasses;if(!doc)return;styles=doc.styleSheets;if(styles&&styles.length>0){
 for(x=0;x<styles.length;x++){csses=null;try{csses=tinyMCE.isIE?doc.styleSheets(x).rules:styles[x].cssRules}catch(e){}if(!csses)return[];for(i=0;i<csses.length;i++){selectorText=csses[i].selectorText;if(selectorText){rules=selectorText.split(',');for(c=0;c<rules.length;c++){rule=rules[c];while(rule.indexOf(' ')==0)rule=rule.substring(1);if(rule.indexOf(' ')!=-1||rule.indexOf(':')!=-1||rule.indexOf('mceItem')!=-1)continue;if(rule.indexOf(tinyMCE.settings.visual_table_class)!=-1||rule.indexOf('mceEditable')!=-1||rule.indexOf('mceNonEditable')!=-1)continue;if(rule.indexOf('.')!=-1){cssClass=rule.substring(rule.indexOf('.')+1);addClass=true;for(p=0;p<inst.cssClasses.length&&addClass;p++){if(inst.cssClasses[p]==cssClass)addClass=false}if(addClass)inst.cssClasses[inst.cssClasses.length]=cssClass}}}}}}return inst.cssClasses},regexpReplace:function(in_str,reg_exp,replace_str,opts){var re;if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';re=new RegExp(reg_exp,opts);r
 eturn in_str.replace(re,replace_str)},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s},getControlHTML:function(c){var i,l,n,o,v,rtl=tinyMCE.getLang('lang_dir')=='rtl';l=tinyMCE.plugins;for(n in l){o=l[n];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)return'<span dir="rtl">'+tinyMCE.replaceVar(v,"pluginurl",o.baseURL)+'</span>';return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}}o=tinyMCE.themes[tinyMCE.settings.theme];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)return'<span dir="rtl">'+v+'</span>';return v}return''},evalFunc:function(f,idx,a,o){o=!o?window:o;f=typeof(f)=='function'?f:o[f];return f.apply(o,Array.prototype.slice.call(a,idx))},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.exec
 uteCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!==''&&(v=tinyMCE.evalFunc(l,3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i<l.length;i++){o=tinyMCE.plugins[l[i]];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}}l=tinyMCE.themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},resolveDots:function(s,o){var i;if(typeof(s)=='string'){for(i=0,s=s.split('.');i<s.length;i++)o=o[s[i]]}else o=s;return o},xmlEncode:function(s){return s?(''+s).replace(this.xmlEncodeRe,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'<':return'&lt;';case'>':return'&gt;'}return c}):s},add:function(c,m){var n;for(n in m){if(m.hasOwnProperty(n))c.prototype[n]=m[n]}},extend:function(p,np){var o={},n;o.parent=p;for(n in p){if(p.hasOwnProperty(n))o[n]=p
 [n]}for(n in np){if(np.hasOwnProperty(n))o[n]=np[n]}return o},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,tos,fu,p,x,fn,fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.enabled=true;this.settings=s;this.settings.theme=tinyMCE.getParam("theme","default");this.settings.width=tinyMCE.getParam("width",-1);this.settings.height=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=[];this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cssClasses=[];this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_
 valid_elements,valid_child_elements:s.valid_child_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans});t=this.settings.theme;if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;tos={};for(i=0;i<fn.length;i++){if((fu=window['TinyMCE_'+t+"_"+fn[i]]))tos[fn[i]]=fu}tinyMCE.addTheme(t,tos)}this.plugins=[];p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){pn=p[i];if(pn.charAt(0)=='-')pn=pn.substring(1);if(!tinyMCE.hasPlugin(pn)){fn=tinyMCE.callbacks;tos={};for(x=0;x<fn.length;x++){if((fu=window['TinyMCE_'+pn+"_"+fn[x]]))tos[fn[x]]=fu}tinyMCE.addPlugin(pn,tos)}this.plugins[this.plugins.length]=pn}}};TinyMCE_Control.prototype={selection:null,settings:null,cleanup:null,getData:function(na){var o=this.data[na];if(!o)o=this.data[na]={};re
 turn o},hasPlugin:function(n){var i;for(i=0;i<this.plugins.length;i++){if(this.plugins[i]==n)return true}return false},addPlugin:function(n,p){if(!this.hasPlugin(n)){tinyMCE.addPlugin(n,p);this.plugins[this.plugins.length]=n}},repaint:function(){var s,b,ex;if(tinyMCE.isRealIE)return;try{s=this.selection;b=s.getBookmark(true);this.getBody().style.display='none';this.getDoc().execCommand('selectall',false,null);this.getSel().collapseToStart();this.getBody().style.display='block';s.moveToBookmark(b)}catch(ex){}},switchSettings:function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings.index){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings.index}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:
 this.getDoc().body},getDoc:function(){return this.contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentElement(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('
 alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i<scl.length;i++){if(sc.alt==scl[i].alt&&sc.ctrl==scl[i].ctrl&&sc.shift==scl[i].shift&&sc.charCode==scl[i].charCode&&sc.keyCode==scl[i].keyCode){return false}}scl[scl.length]=sc;return true},handleShortcut:function(e){var i,s,o;if(!e.altKey&&!e.ctrlKey)return false;s=this.shortcuts;for(i=0;i<s.length;i++){o=s[i];if(o.alt==e.altKey&&o.ctrl==e.ctrlKey&&(o.keyCode==e.keyCode||o.charCode==e.charCode)){if(o.cmd&&(e.type=="keydown"||(e.type=="keypress"&&!tinyMCE.isOpera)))tinyMCE.execCommand(o.cmd,o.ui,o.val);tinyMCE.cancelEvent(e);return true}}return false},autoResetDesignMode:function(){if(!tinyMCE.isIE&&this.isHidden()&&tinyMCE.getParam('auto_reset_designmode'))eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}')},isHidden:function(){var s;if(tinyMCE.isIE)return false;s=this.getSel();return(!s||!s.rangeCount||s.ra
 ngeCount==0)},isDirty:function(){return tinyMCE.trim(this.startContent)!=tinyMCE.trim(this.getBody().innerHTML)&&!this.isNotDirty},_mergeElements:function(scmd,pa,ch,override){var st,stc,className,n;if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return}st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));className=tinyMCE.getAttrib(pa,"class");className=tinyMCE.getAttrib(ch,"class");if(override){for(n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n]}}else{for(n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n]}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style")},_fixRootBlocks:function(){var rb,b,ne,be,nx,bm;rb=tinyMCE.getParam('forced_root_block');if(!rb)return;b=this.getBody();ne=b.firstChild;while(ne){
 nx=ne.nextSibling;if((ne.nodeType==3&&ne.nodeValue.replace(/\s+/g,'')!='')||(ne.nodeType==1&&!tinyMCE.blockRegExp.test(ne.nodeName))){if(!bm)bm=this.selection.getBookmark();if(!be){be=this.getDoc().createElement(rb);be.appendChild(ne.cloneNode(true));b.replaceChild(be,ne)}else{be.appendChild(ne.cloneNode(true));b.removeChild(ne)}}else be=null;ne=nx}if(bm)this.selection.moveToBookmark(bm)},_fixTrailingNbsp:function(){var s=this.selection,e=s.getFocusElement(),bm,v;if(e&&tinyMCE.blockRegExp.test(e.nodeName)&&e.firstChild){v=e.firstChild.nodeValue;if(v&&v.length>1&&/(^\u00a0|\u00a0$)/.test(v)){e.firstChild.nodeValue=v.replace(/(^\u00a0|\u00a0$)/,'');s.selectNode(e.firstChild,true,false,false);}}},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b)}catch(ex){}try{d.execCommand("styleWithCSS",false,b)}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d.execCommand('enableInlineTableEditing',false,"false")}catch(ex){}if(!tinyMCE.getParam("obje
 ct_resizing"))try{d.execCommand('enableObjectResizing',false,"false")}catch(ex){}},execCommand:function(command,user_interface,value){var i,x,z,align,img,div,doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(!tinyMCE.isIE&&!this.useCSS){this._setUseCSS(false);this.useCSS=true}this.contentDocument=doc;if(!/mceStartTyping|mceEndTyping/.test(command)){if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return}if(focusElm&&focusElm.nodeName=="IMG"){align=focusElm.getAttribute('align');img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left'){img.setAttribute('align','');img.removeAttribute('align')}else img.setAttribute('align','left');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&
 &div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.setAttribute('align','');img.removeAttribute('align');div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div)}else{div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm)}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right'){img.setAttribute('align','');img.removeAttribute('align')}else img.setAttribute('align','right');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();ret
 urn}}if(tinyMCE.settings.force_br_newlines){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break}if(alignValue!==''){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyFull":case"JustifyRight":var el=tinyMCE.getParentNode(focusElm,function(n){return tinyMCE.getAttrib(n,'align')});if(el){el.setAttribute('align','');el.removeAttribute('align')}else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();return tr
 ue;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"InsertUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case"FormatBlock":if(value==null||value==''){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(!this.cleanup.isValid(value))return true;if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|cod
 e|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'<p>');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMCE.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){value.outerHTML=value.innerHTML}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML))}tinyMCE.triggerNodeChange();break;case"mceSelectNodeDepth":var parentNode=this.getFocusElement();for(i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=pare
 ntNode.parentNode;continue}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"mceSetStyleInfo":case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value.command;var sname=value.name;var svalue=value.value==null?'':value.value;var wrapper=value.wrapper?value.wrapper:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings.merge_styles_invalid_parents!==''?new RegExp(tinyMCE.settings.merge_styles_invalid_parents,"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table|i
 mg','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,[],1);for(z=0;z<ch.length;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}else{this._setUseCSS(false);doc.execCommand("FontName",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,
 svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','')}if(elm.hasChildNodes()){for(i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true))}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,[],1);for(z=0;z<ch.length;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.
 length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i],isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm)}elm.parentNode.removeChild(elm)}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"FontName":if(value==null){var s=this.getSel();if(tinyMCE.isGecko&&s.isCollapsed){var f=tinyMCE.getParentElement(this.getFocusElement(),"font");if(f!=null)this.selection.selectNode(f,fal
 se)}this.getDoc().execCommand("RemoveFormat",false,null);if(f!=null&&tinyMCE.isGecko){var r=this.getRng().cloneRange();r.collapse(true);s.removeAllRanges();s.addRange(r)}}else this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"forecolor":value=value==null?this.foreColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.foreColor=value;this.getDoc().execCommand('forecolor',false,value);break;case"HiliteColor":value=value==null?this.backColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.backColor=value;if(tinyMCE.isGecko||tinyMCE.isOpera){this._setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this._setUseCSS(fal
 se)}else this.getDoc().execCommand('BackColor',false,value);break;case"Cut":case"Copy":case"Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Currently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_clipboard_msg'))))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return}else tinyMCE.triggerNodeChange();break;case"mceSetContent":if(!value)value="";value=tinyMCE.storeAwayURLs(value);value=tinyMCE._customCleanup(this,"insert_to_editor",value);if(this.getBody().nodeName=='BODY')tinyMCE._setHTML(doc,value);else this.getBody().innerHTML=value;tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,doc,this.settings,this.getBody(),false,false,false,true));tinyMCE.convertAllRelativeURLs(this.getBody());tinyMCE._removeInt
 ernal(this.getBody());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this._addBogusBR();return true;case"mceCleanup":var b=this.selection.getBookmark();tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.convertAllRelativeURLs(doc.body);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this._addBogusBR();this.repaint();this.selection.moveToBookmark(b);tinyMCE.triggerNodeChange();break;case"mceReplaceContent":if(!value)value='';this.getWin().focus();var selectedText="";if(tinyMCE.isIE){var rng=doc.selection.createRange();selectedText=rng.text}else 
 selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value)}this._addBogusBR();tinyMCE.triggerNodeChange();break;case"mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value.targets)=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value.targets;var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value.name,value.value);tinyMCE.triggerNodeChange()}}break;case"mceSetCSSClass":this.execCommand("mceSetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getB
 ody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getS
 el();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{value=doc.createTextNode(tinyMCE.entityDecode(value))}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.
 createRange(),tmpRng=null;var c=value.indexOf('<!--')!=-1;if(c)value=tinyMCE.uniqueTag+value;if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);if(c){var e=this.getDoc().getElementById('mceTMPElement');e.parentNode.removeChild(e)}}tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange();break;case"mceStartTyping":if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex==-1){this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;tinyMCE.typingUndoIndex=tinyMCE.undoIndex;this.execCommand('mceAddUndoLevel')}break;case"mceEndTyping":if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.undoRedo.typingUndoIndex=-1}tinyMCE.typingUndoIndex=-1;break;case"mceBeginUndoLevel":this.undoRedoLevel=false;break;case"mceEndUndoLevel":this.undoRedoLevel=true;this.execCommand('mceAddUndoLevel');break;case"mceAddUndoLevel":if(tinyMCE.settings.custom_undo_redo&&this.undoRedoLevel){if(this.undoRedo.add(
 ))tinyMCE.triggerNodeChange(false)}break;case"Undo":if(tinyMCE.settings.custom_undo_redo){tinyMCE.execCommand("mceEndTyping");this.undoRedo.undo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"Redo":if(tinyMCE.settings.custom_undo_redo){tinyMCE.execCommand("mceEndTyping");this.undoRedo.redo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style")}}while(n!=null&&(n=n.parentNode)!=null)}break;case"RemoveFormat":case"removeformat":var text=this.selection.getSelectedTex
 t();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return}if(tinyMCE.isIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null)}catch(e){}this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange()}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel")},queryCommandValue:function(c){try{return this.getDoc().queryCommandValue(c)}catch(e){return null}},queryCommandState:function(c){return this.getDoc().queryCommandState(c)},_ad
 dBogusBR:function(){var b=this.getBody();if(tinyMCE.isGecko&&!b.hasChildNodes())b.innerHTML='<br _moz_editor_bogus_node="TRUE" />'},_onAdd:function(replace_element,form_element_name,target_document){var hc,th,tos,editorTemplate,targetDoc,deltaWidth,deltaHeight,html,rng,fragment;var dynamicIFrame,tElm,doc,parentElm;th=this.settings.theme;tos=tinyMCE.themes[th];targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings.theme;this.settings.themeurl=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false}if(tos.getEditorTemplate)editorTemplate=tos.getEditorTemplate(this.settings,this.editorId);deltaWidth=editorTemplate.delta_width?editorTemplate.delta_width:0;deltaHeight=editorTemplate.delta_height?editorTemplate.delta_height:0;html='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+editorTemplate.html;html=tinyMCE.replaceVar(html,"editor_id",th
 is.editorId);if(!this.settings.default_document)this.settings.default_document=tinyMCE.baseURL+"/blank.htm";this.settings.old_width=this.settings.width;this.settings.old_height=this.settings.height;if(this.settings.width==-1)this.settings.width=replace_element.offsetWidth;if(this.settings.height==-1)this.settings.height=replace_element.offsetHeight;if(this.settings.width==0)this.settings.width=replace_element.style.width;if(this.settings.height==0)this.settings.height=replace_element.style.height;if(this.settings.width==0)this.settings.width=320;if(this.settings.height==0)this.settings.height=240;this.settings.area_width=parseInt(this.settings.width);this.settings.area_height=parseInt(this.settings.height);this.settings.area_width+=deltaWidth;this.settings.area_height+=deltaHeight;this.settings.width_style=""+this.settings.width;this.settings.height_style=""+this.settings.height;if((""+this.settings.width).indexOf('%')!=-1)this.settings.area_width="100%";else this.settings.w
 idth_style+='px';if((""+this.settings.height).indexOf('%')!=-1)this.settings.area_height="100%";else this.settings.height_style+='px';if((""+replace_element.style.width).indexOf('%')!=-1){this.settings.width=replace_element.style.width;this.settings.area_width="100%";this.settings.width_style="100%"}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings.height=replace_element.style.height;this.settings.area_height="100%";this.settings.height_style="100%"}html=tinyMCE.applyTemplate(html);this.settings.width=this.settings.old_width;this.settings.height=this.settings.old_height;this.visualAid=this.settings.visual;this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName!="TEXTAREA"&&replace_element.nodeName!="INPUT"){this.oldTargetElement=replace_element;hc='<input type="hidden" id="'+form_
 element_name+'" name="'+form_element_name+'" />';this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none";html+='</span>';if(tinyMCE.isGecko)html=hc+html;else html+=hc;if(tinyMCE.isGecko){rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}else{html+='</span>';this.oldTargetElement=replace_element;this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none";if(tinyMCE.isGecko){rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}dynamicIFrame=false;tElm=targetDoc.getElementById(this.editorId
 );if(!tinyMCE.isIE){if(tElm&&(tElm.nodeName=="SPAN"||tElm.nodeName=="span")){tElm=tinyMCE._createIFrame(tElm,targetDoc);dynamicIFrame=true}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName=="SPAN")tElm=tinyMCE._createIFrame(tElm,targetDoc,targetDoc.parentWindow);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window}this.getDoc().designMode="on"}doc=this.contentDocument;if(dynamicIFrame){html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings.base_href+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="t
 ext/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{if(!this.isHidden())this.getDoc().designMode="on";doc.open();doc.write(html);doc.close()}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm"}}if(tinyMCE.isIE)window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\""+this.editorId+"\"]);",1);parentElm=this.targetDoc.getElementById(this.editorId+'_parent');this.formElement=tinyMCE.isGecko?parentElm.previousSibling:parentElm.nextSibling;tinyMCE.setupContent(this.editorId,true);return true},setBaseHREF:function(u){var h,b,d,nl;d=this.getDoc();nl=d.getElementsByTagName("base");b=nl.length>0?nl[0]:null;if(!b){nl=d.getElementsByTagName("head");h=nl.length>0?nl[0]:null;b=d.createElement("base");b.setAttribute('href',u);h.appendChild(b)}else{if(u==''||u==null)b.parentNode.removeChild(b);else b.setAttribute('href',u)}},getHTML:function(r){var h,d=this.getDoc(),b=this.getBody();if(r)return b.innerHTML;h=tinyMCE._cleanupHTML(this,d,thi
 s.settings,b,false,true,false,true);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(d);return h},setHTML:function(h){this.execCommand('mceSetContent',false,h);this.repaint()},getFocusElement:function(){return this.selection.getFocusElement()},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},triggerSave:function(skip_cleanup,skip_callback){var e,nl=[],i,s,content,htm;if(!this.enabled)return;this.switchSettings();s=tinyMCE.settings;if(tinyMCE.isRealIE){e=this.iframeElement;do{if(e.style&&e.style.display=='none'){e.style.display='block';nl[nl.length]={elm:e,type:'style'}}if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){e.className=s.display_tab_class;nl[nl.length]={elm:e,type:'class'}}}while((e=e.parentNode)!=null)}tinyMCE.settings.preformatted=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tin
 yMCE._setHTML(this.getDoc(),this.getBody().innerHTML);if(this.settings.cleanup==false){tinyMCE.handleVisualAid(this.getBody(),true,false,this);tinyMCE._setEventsEnabled(this.getBody(),true)}tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,true);htm=tinyMCE._customCleanup(this,"submit_content",htm);if(!skip_callback&&tinyMCE.settings.save_callback!=='')content=tinyMCE.resolveDots(tinyMCE.settings.save_callback,window)(this.formTargetElementId,htm,this.getBody());if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(this.formElement)this.formElement.value=htm;if
 (tinyMCE.isSafari&&this.formElement)this.formElement.innerText=htm;for(i=0;i<nl.length;i++){if(nl[i].type=='style')nl[i].elm.style.display='none';else nl[i].elm.className=s.hidden_tab_class}}};tinyMCE.add(TinyMCE_Engine,{cleanupHTMLCode:function(s){s=s.replace(new RegExp('<p \\/>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<p>\\s*<\\/p>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<br>\\s*<\\/br>','gi'),'<br />');s=s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>','gi'),'<$1$2$3></$1$2>');s=s.replace(new RegExp('\\s+></','gi'),'></');s=s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>','gi'),'<$1$2 />');if(tinyMCE.isIE)s=s.replace(new RegExp('<p><hr \\/><\\/p>','gi'),"<hr>");if(tinyMCE.isIE)s=s.replace(/<!(\s*)\/>/g,'');return s},parseStyle:function(str){var ar=[],st,i,re,pa;if(str==null)return ar;st=str.split(';');tinyMCE.clearArray(ar);for(i=0;i<st.length;
 i++){if(st[i]=='')continue;re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1]}return ar},compressStyle:function(ar,pr,sf,res){var box=[],i,a;box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(i=0;i<box.length;i++){if(box[i]==null)return;if(i&&box[i]!=box[i-1])return}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null},serializeStyle:function(ar){var str="",key,val,m;tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");tinyMCE.compressStyle(ar,"border","-style","border-style");tinyMCE.compressStyle(ar,"padding","","padding");tinyMCE.compressStyle(ar,"margin","","margin");for(key in ar){val=ar[key];if(typeof(val)=='function')continue;if(key.indexOf('mso-')==0)continue;if(val!=n
 ull&&val!==''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val.indexOf('url(')!=-1&&tinyMCE.getParam('convert_urls')){m=new RegExp("url\\('(.*?)'\\)").exec(val);if(m.length>1)val="url('"+eval(tinyMCE.getParam('urlconverter_callback')+"(m[1], null, true);")+"')"}if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val,true);val=val.replace(/\"/g,'\'');if(val!="url('')")str+=key.toLowerCase()+": "+val+"; "}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str},convertRGBToHex:function(s,k){var re,rgb;if(s.toLowerCase().indexOf('rgb')!=-1){re=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");rgb=s.replace(re,"$1,$2,$3,$4,$5").split(',');if(rgb.length==5){r=parseInt(rgb[1]).toString(16);g=parseInt(rgb[2]).toString(16);b=parseInt(rgb[3]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;if(k)s=rgb[0]+s+rgb[4]
 }}return s},convertHexToRGB:function(s){if(s.indexOf('#')!=-1){s=s.replace(new RegExp('[^0-9A-F]','gi'),'');return"rgb("+parseInt(s.substring(0,2),16)+","+parseInt(s.substring(2,4),16)+","+parseInt(s.substring(4,6),16)+")"}return s},convertSpansToFonts:function(doc){var s,i,size,fSize,x,fFace,fColor,sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');s=tinyMCE.selectElements(doc,'span,font');for(i=0;i<s.length;i++){size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();fSize=0;for(x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize=''}fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!==''){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily=''}fColor=s[i].style.color;if(fColor!=null&&fColor!==''){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color=''}}},convertFontsToSpans:function(doc){var fsClasses,s,i,fSize,fFace,fColor,sizes=tinyMCE.get
 Param('font_size_style_values').replace(/\s+/,'').split(',');fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!=='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;s=tinyMCE.selectElements(doc,'span,font');for(i=0;i<s.length;i++){fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!==''){fSize=parseInt(fSize);if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1]}s[i].removeAttribute('size')}if(fFace!==''){s[i].style.fontFamily=fFace;s[i].removeAttribute('face')}if(fColor!==''){s[i].style.color=fColor;s[i].removeAttribute('color')}}},cleanupAnchors:function(doc){var i,cn,x,an=doc.getElementsByTagName("a");for(i=an.length-1;i>=0;i--){if(tinyMCE.getAttrib(an[i],"name")!==''&&tinyMCE.getAttrib(an[i],"href")==''){cn=an[i].childNodes;for(x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i])}}},getContent
 :function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.getInstanceById(editor_id).select();if(tinyMCE.selectedInstance)return tinyMCE.selectedInstance.getHTML();return null},_fixListElements:function(d){var nl,x,a=['ol','ul'],i,n,p,r=new RegExp('^(OL|UL)$'),np;for(x=0;x<a.length;x++){nl=d.getElementsByTagName(a[x]);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=tinyMCE.prevNode(n,'LI');if(!np){np=d.createElement('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild)}else np.appendChild(n)}}}},_fixTables:function(d){var nl,i,n,p,np,x,t;nl=d.getElementsByTagName('table');for(i=0;i<nl.length;i++){n=nl[i];if((p=tinyMCE.getParentElement(n,'p,h1,h2,h3,h4,h5,h6'))!=null){np=p.cloneNode(false);np.removeAttribute('id');t=n;while((n=n.nextSibling))np.appendChild(n);tinyMCE.insertAfter(np,p);tinyMCE.insertAfter(t,p)}}},_cleanupHTML:function(inst,doc,config,elm,visual,on_save,on_submit,inn){var h,d,t1,t2,t3,t4,t5,c,s,nb;if(!tinyM
 CE.getParam('cleanup'))return elm.innerHTML;on_save=typeof(on_save)=='undefined'?false:on_save;c=inst.cleanup;s=inst.settings;d=c.settings.debug;if(d)t1=new Date().getTime();inst._fixRootBlocks();if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);if(tinyMCE.getParam("fix_list_elements"))tinyMCE._fixListElements(doc);if(tinyMCE.getParam("fix_table_elements"))tinyMCE._fixTables(doc);tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);if(d)t2=new Date().getTime();c.settings.on_save=on_save;c.idCount=0;c.serializationId++;c.serializedNodes=[];c.sourceIndex=-1;if(s.cleanup_serializer=="xml")h=c.serializeNodeAsXML(elm,inn);else h=c.serializeNodeAsHTML(elm,inn);if(d)t3=new Date().getTime();nb=tinyMCE.getParam('entity_encoding')=='numeric'?'&#160;':'&nbsp;';h=h.replace(/<\/?(body|head|html)[^>]*>/gi,'');h=h.replace(new RegExp(' (rowspan="1"|colspan="1")','g'),'');h=h.replace(/<p><hr \/><\/p>/g,'<hr />');h=h.replace(/
 <p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,'<hr />');h=h.replace(/<td>\s*<br \/>\s*<\/td>/g,'<td>'+nb+'</td>');h=h.replace(/<p>\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<br \/>$/,'');h=h.replace(/<br \/><\/p>/g,'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(new RegExp('<a>(.*?)<\\/a>','g'),'$1');h=h.replace(/<p([^>]*)>\s*<\/p>/g,'<p$1>'+nb+'</p>');if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))h='';if(s.preformatted){h=h.replace(/^<pre>/,'');h=h.replace(/<\/pre>$/,'');h='<pre>'+h+'</pre>'}if(tinyMCE.isGecko){h=h.replace(/<br \/>\s*<\/li>/g,'</li>');h=h.replace(/&nbsp;\s*<\/(dd|dt)>/g,'</$1>');h=h.replace(/<o:p _moz-userdefined="" \/>/g,'');h=h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,'<td$1>'+nb+'</td>')}if(s.force_br_newlines)h=h.repl
 ace(/<p>(&nbsp;|&#160;)<\/p>/g,'<br />');h=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",h);if(on_save){h=h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|'+s.visual_table_class+')','g'),'');h=h.replace(new RegExp(' ?class=""','g'),'')}if(s.remove_linebreaks&&!c.settings.indent)h=h.replace(/\n|\r/g,' ');if(d)t4=new Date().getTime();if(on_save&&c.settings.indent)h=c.formatHTML(h);if(on_submit&&(s.encoding=="xml"||s.encoding=="html"))h=c.xmlEncode(h);if(d)t5=new Date().getTime();if(c.settings.debug)tinyMCE.debug("Cleanup in ms: Pre="+(t2-t1)+", Serialize: "+(t3-t2)+", Post: "+(t4-t3)+", Format: "+(t5-t4)+", Sum: "+(t5-t1)+".");return h}});function TinyMCE_Cleanup(){this.isIE=(navigator.appName=="Microsoft Internet Explorer");this.rules=tinyMCE.clearArray([]);this.settings={indent_elements:'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',newline_before_elements:'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,scri
 pt,td',newline_after_elements:'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',newline_before_after_elements:'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',indent_char:'\t',indent_levels:1,entity_encoding:'raw',valid_elements:'*[*]',entities:'',url_converter:'',invalid_elements:'',verify_html:false};this.vElements=tinyMCE.clearArray([]);this.vElementsRe='';this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;this.codeElementsRe=/^(SCRIPT|STYLE)$/;this.serializationId=0;this.mceAttribs={href:'mce_href',src:'mce_src',type:'mce_type'}}TinyMCE_Cleanup.prototype={init:function(s){var n,a,i,ir,or,st;for(n in s)this.settings[n]=s[n];s=this.settings;this.inRe=this._arrayToRe(s.indent_elements.split(','),'','^<(',')[^>]*');this.ouRe=this._arrayToRe(s.indent_elements.split(','),'','^<\\/(',')[^>]*');this.nlBeforeRe=this._arrayToRe(s.newline_before_elements.split(','),'gi','<(',')([^>]*)>');this.nlAfterRe=this._arrayTo
 Re(s.newline_after_elements.split(','),'gi','<(',')([^>]*)>');this.nlBeforeAfterRe=this._arrayToRe(s.newline_before_after_elements.split(','),'gi','<(\\/?)(',')([^>]*)>');this.serializedNodes=[];this.serializationId=0;if(s.invalid_elements!=='')this.iveRe=this._arrayToRe(s.invalid_elements.toUpperCase().split(','),'g','^(',')$');else this.iveRe=null;st='';for(i=0;i<s.indent_levels;i++)st+=s.indent_char;this.inStr=st;if(!s.verify_html){s.valid_elements='*[*]';s.extended_valid_elements=''}this.fillStr=s.entity_encoding=="named"?"&nbsp;":"&#160;";this.idCount=0;this.xmlEncodeRe=new RegExp('[\u007F-\uFFFF<>&"]','g')},addRuleStr:function(s){var r=this.parseRuleStr(s),n;for(n in r){if(r[n])this.rules[n]=r[n]}this.vElements=tinyMCE.clearArray([]);for(n in this.rules){if(this.rules[n])this.vElements[this.vElements.length]=this.rules[n].tag}this.vElementsRe=this._arrayToRe(this.vElements,'')},isValid:function(n){if(!this.rulesDone)this._setupRules();if(!n)return true;n=n.replace(/[^a
 -z0-9]+/gi,'').toUpperCase();return!tinyMCE.getParam('cleanup')||this.vElementsRe.test(n)},addChildRemoveRuleStr:function(s){var x,y,p,i,t,tn,ta,cl,r;if(!s)return;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r="^(";cl=this.split(/\|/,p[1]);for(i=0;i<cl.length;i++){if(cl[i]=='%istrict')r+=tinyMCE.inlineStrict;else if(cl[i]=='%itrans')r+=tinyMCE.inlineTransitional;else if(cl[i]=='%istrict_na')r+=tinyMCE.inlineStrict.substring(2);else if(cl[i]=='%itrans_na')r+=tinyMCE.inlineTransitional.substring(2);else if(cl[i]=='%btrans')r+=tinyMCE.blockElms;else if(cl[i]=='%strict')r+=tinyMCE.blockStrict;else r+=(cl[i].charAt(0)!='#'?cl[i].toUpperCase():cl[i]);r+=(i!=cl.length-1?'|':'')}r+=')$';if(this.childRules==null)this.childRules=tinyMCE.clearArray([]);this.childRules[tn[y]]=new RegExp(r);if(p.length>1)this.childRules[tn[y]].wrapTag=p[2]}}},parseR
 uleStr:function(s){var ta,p,r,a,i,x,px,t,tn,y,av,or=tinyMCE.clearArray([]),dv;if(s==null||s.length==0)return or;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];if(s.length==0)continue;p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r={};r.tag=tn[y];r.forceAttribs=null;r.defaultAttribs=null;r.validAttribValues=null;px=r.tag.charAt(0);r.forceOpen=px=='+';r.removeEmpty=px=='-';r.fill=px=='#';r.tag=r.tag.replace(/\+|-|#/g,'');r.oTagName=tn[0].replace(/\+|-|#/g,'').toLowerCase();r.isWild=new RegExp('\\*|\\?|\\+','g').test(r.tag);r.validRe=new RegExp(this._wildcardToRe('^'+r.tag+'$'));if(p.length>1){r.vAttribsRe='^(';a=this.split(/\|/,p[1]);for(i=0;i<a.length;i++){t=a[i];if(t.charAt(0)=='!'){a[i]=t=t.substring(1);if(!r.reqAttribsRe)r.reqAttribsRe='\\s+('+t;else r.reqAttribsRe+='|'+t}av=new RegExp('(=|:|<)(.*?)$').exec(t);t=t.replace(new RegExp('(=|:|<).*?$'),'');if(av&&av.length>0){if(av[0].c
 harAt(0)==':'){if(!r.forceAttribs)r.forceAttribs=tinyMCE.clearArray([]);r.forceAttribs[t.toLowerCase()]=av[0].substring(1)}else if(av[0].charAt(0)=='='){if(!r.defaultAttribs)r.defaultAttribs=tinyMCE.clearArray([]);dv=av[0].substring(1);r.defaultAttribs[t.toLowerCase()]=dv==''?"mce_empty":dv}else if(av[0].charAt(0)=='<'){if(!r.validAttribValues)r.validAttribValues=tinyMCE.clearArray([]);r.validAttribValues[t.toLowerCase()]=this._arrayToRe(this.split('?',av[0].substring(1)),'i')}}r.vAttribsRe+=''+t.toLowerCase()+(i!=a.length-1?'|':'');a[i]=t.toLowerCase()}if(r.reqAttribsRe)r.reqAttribsRe=new RegExp(r.reqAttribsRe+')=\"','g');r.vAttribsRe+=')$';r.vAttribsRe=this._wildcardToRe(r.vAttribsRe);r.vAttribsReIsWild=new RegExp('\\*|\\?|\\+','g').test(r.vAttribsRe);r.vAttribsRe=new RegExp(r.vAttribsRe);r.vAttribs=a.reverse();}else{r.vAttribsRe='';r.vAttribs=tinyMCE.clearArray([]);r.vAttribsReIsWild=false}or[r.tag]=r}}return or},serializeNodeAsXML:function(n){var s,b;if(!this.xmlDoc){if(
 this.isIE){try{this.xmlDoc=new ActiveXObject('MSXML2.DOMDocument')}catch(e){}if(!this.xmlDoc)try{this.xmlDoc=new ActiveXObject('Microsoft.XmlDom')}catch(e){}}else this.xmlDoc=document.implementation.createDocument('','',null);if(!this.xmlDoc)alert("Error XML Parser could not be found.")}if(this.xmlDoc.firstChild)this.xmlDoc.removeChild(this.xmlDoc.firstChild);b=this.xmlDoc.createElement("html");b=this.xmlDoc.appendChild(b);this._convertToXML(n,b);if(this.isIE)return this.xmlDoc.xml;else return new XMLSerializer().serializeToString(this.xmlDoc)},_convertToXML:function(n,xn){var xd,el,i,l,cn,at,no,hc=false;if(tinyMCE.isRealIE&&this._isDuplicate(n))return;xd=this.xmlDoc;switch(n.nodeType){case 1:hc=n.hasChildNodes();el=xd.createElement(n.nodeName.toLowerCase());at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&no.nodeValue)el.setAttribute(no.nodeName.toLowerCase(),no.nodeValue)}if(!hc&&!this.closeElementsRe.test(n.nodeName))el.appendChild(xd.createTextNode("
 "));xn=xn.appendChild(el);break;case 3:xn.appendChild(xd.createTextNode(n.nodeValue));return;case 8:xn.appendChild(xd.createComment(n.nodeValue));return}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)this._convertToXML(cn[i],xn)}},serializeNodeAsHTML:function(n,inn){var en,no,h='',i,l,t,st,r,cn,va=false,f=false,at,hc,cr,nn;if(!this.rulesDone)this._setupRules();if(tinyMCE.isRealIE&&this._isDuplicate(n))return'';if(n.parentNode&&this.childRules!=null){cr=this.childRules[n.parentNode.nodeName];if(typeof(cr)!="undefined"&&!cr.test(n.nodeName)){st=true;t=null}}switch(n.nodeType){case 1:hc=n.hasChildNodes();if(st)break;nn=n.nodeName;if(tinyMCE.isRealIE){if(n.nodeName.indexOf('/')!=-1)break;if(n.scopeName&&n.scopeName!='HTML')nn=n.scopeName.toUpperCase()+':'+nn.toUpperCase()}else if(tinyMCE.isOpera&&nn.indexOf(':')>0)nn=nn.toUpperCase();if(this.settings.convert_fonts_to_spans){if(this.settings.on_save&&nn=='FONT')nn='SPAN';if(!this.settings.on_save&&nn=='SPAN')nn='FONT'}if(this
 .vElementsRe.test(nn)&&(!this.iveRe||!this.iveRe.test(nn))&&!inn){va=true;r=this.rules[nn];if(!r){at=this.rules;for(no in at){if(at[no]&&at[no].validRe.test(nn)){r=at[no];break}}}en=r.isWild?nn.toLowerCase():r.oTagName;f=r.fill;if(r.removeEmpty&&!hc)return"";t='<'+en;if(r.vAttribsReIsWild){at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&r.vAttribsRe.test(no.nodeName))t+=this._serializeAttribute(n,r,no.nodeName)}}else{for(i=r.vAttribs.length-1;i>-1;i--)t+=this._serializeAttribute(n,r,r.vAttribs[i])}if(!this.settings.on_save){at=this.mceAttribs;for(no in at){if(at[no])t+=this._serializeAttribute(n,r,at[no])}}if(r.reqAttribsRe&&!t.match(r.reqAttribsRe))t=null;if(t!=null&&this.closeElementsRe.test(nn))return t+' />';if(t!=null)h+=t+'>';if(this.isIE&&this.codeElementsRe.test(nn))h+=n.innerHTML}break;case 3:if(st)break;if(n.parentNode&&this.codeElementsRe.test(n.parentNode.nodeName))return this.isIE?'':n.nodeValue;return this.xmlEncode(n.nodeValue);case 8:if(
 st)break;return"<!--"+this._trimComment(n.nodeValue)+"-->"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)h+=this.serializeNodeAsHTML(cn[i])}if(f&&!hc)h+=this.fillStr;if(t!=null&&va)h+='</'+en+'>';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttribs[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&/^(src|href|longdesc)$/.test(an))av=this._urlConverter(this,n,av);if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av,1);return" "+an+"="+'"'+av+'"'}return""},formatHTML:function(h){var s
 =this.settings,p='',i=0,li=0,o='',l;h=h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(/<br\s*\/>/gi,'\n');return'<pre'+b+'>'+c+'</pre>'});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s){var cl=this,re=this.xmlEncodeRe;if(!this.entitiesDone)this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s);case"named":return s.replace(re,function(c){var b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(re,function(c){return'&#'+c.charCodeAt(0)+';'})}return s},split:function(re,s){var i,l,o=[],c=s.spl
 it(re);for(i=0,l=c.length;i<l;i++){if(c[i]!=='')o[i]=c[i]}return o},_trimComment:function(s){s=s.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");s=s.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");return s},_getAttrib:function(e,n,d){var v,ex,nn;if(typeof(d)=="undefined")d="";if(!e||e.nodeType!=1)return d;try{v=e.getAttribute(n,0)}catch(ex){v=e.getAttribute(n,2)}if(n=="class"&&!v)v=e.className;if(this.isIE){if(n=="http-equiv")v=e.httpEquiv;nn=e.nodeName;if(nn=="FORM"&&n=="enctype"&&v=="application/x-www-form-urlencoded")v="";if(nn=="INPUT"&&n=="size"&&v=="20")v="";if(nn=="INPUT"&&n=="maxlength"&&v=="2147483647")v="";if(n=="width"||n=="height")v=e.getAttribute(n,2)}if(n=='style'&&v){if(!tinyMCE.isOpera)v=e.style.cssText;v=tinyMCE.serializeStyle(tinyMCE.parseStyle(v))}if(this.settings.on_save&&n.indexOf('on')!=-1&&this.settings.on_save&&v&&v!=='')v=tinyMCE.cleanupEventStr(v);return(v&&v!=='')?''+v:d},_urlConverter:function(c,n,v){if(!c.settings.on_save)return tinyMC
 E.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v);else if(tinyMCE.getParam('convert_urls')){if(!this.urlConverter)this.urlConverter=eval(tinyMCE.settings.urlconverter_callback);return this.urlConverter(v,n,true)}return v},_arrayToRe:function(a,op,be,af){var i,r;op=typeof(op)=="undefined"?"gi":op;be=typeof(be)=="undefined"?"^(":be;af=typeof(af)=="undefined"?")$":af;r=be;for(i=0;i<a.length;i++)r+=this._wildcardToRe(a[i])+(i!=a.length-1?"|":"");r+=af;return new RegExp(r,op)},_wildcardToRe:function(s){s=s.replace(/\?/g,'(\\S?)');s=s.replace(/\+/g,'(\\S+)');s=s.replace(/\*/g,'(\\S*)');return s},_setupEntities:function(){var n,a,i,s=this.settings;if(s.entity_encoding=="named"){n=tinyMCE.clearArray([]);a=this.split(',',s.entities);for(i=0;i<a.length;i+=2)n[a[i]]=a[i+1];this.entities=n}this.entitiesDone=true},_setupRules:function(){var s=this.settings;this.addRuleStr(s.valid_elements);this.addRuleStr(s.extended_valid_elements);this.addChildRemoveRuleStr(s.valid_child_elem
 ents);this.rulesDone=true},_isDuplicate:function(n){var i,l,sn;if(!this.settings.fix_content_duplication)return false;if(tinyMCE.isRealIE&&n.nodeType==1){if(n.mce_serialized==this.serializationId)return true;n.setAttribute('mce_serialized',this.serializationId)}else{sn=this.serializedNodes;for(i=0,l=sn.length;i<l;i++){if(sn[i]==n)return true}sn.push(n)}return false}};tinyMCE.add(TinyMCE_Engine,{createTagHTML:function(tn,a,h){var o='',f=tinyMCE.xmlEncode,n;o='<'+tn;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)o+=' '+f(n)+'="'+f(''+a[n])+'"'}}o+=!h?' />':'>'+h+'</'+tn+'>';return o},createTag:function(d,tn,a,h){var o=d.createElement(tn),n;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o},getElementByAttributeValue:function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]},getElementsByAttributeValue:function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=[];for(i=0;i<nl
 .length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i]}return o},isBlockElement:function(n){return n!=null&&n.nodeType==1&&this.blockRegExp.test(n.nodeName)},getParentBlockElement:function(n,r){return this.getParentNode(n,function(n){return tinyMCE.isBlockElement(n)},r);return null},insertAfter:function(n,r){if(r.nextSibling)r.parentNode.insertBefore(n,r.nextSibling);else r.parentNode.appendChild(n)},setInnerHTML:function(e,h){var i,nl,n;if(tinyMCE.isGecko){h=h.replace(/<embed([^>]*)>/gi,'<tmpembed$1>');h=h.replace(/<em([^>]*)>/gi,'<i$1>');h=h.replace(/<tmpembed([^>]*)>/gi,'<embed$1>');h=h.replace(/<strong([^>]*)>/gi,'<b$1>');h=h.replace(/<\/strong>/gi,'</b>');h=h.replace(/<\/em>/gi,'</i>')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>'
 );e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}},getOuterHTML:function(e){var d;if(tinyMCE.isIE)return e.outerHTML;d=e.ownerDocument.createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML},setOuterHTML:function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;for(i=0,nl=t.childNodes;i<nl.length;i++)e.parentNode.insertBefore(nl[i].cloneNode(true),e);e.parentNode.removeChild(e)}},_getElementById:function(id,d){var e,i,j,f;if(typeof(d)=="undefined")d=document;e=d.getElementById(id);if(!e){f=d.forms;for(i=0;i<f.length;i++){for(j=0;j<f[i].elements.length;j++){if(f[i].elements[j].name==id){e=f[i].elements[j];break}}}
 }return e},getNodeTree:function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn)},na?na:[])},getParentElement:function(n,na,f,r){var re=na?new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$'):0,v;if(f&&typeof(f)=='string')return this.getParentElement(n,na,function(no){return tinyMCE.getAttrib(no,f)!==''});return this.getParentNode(n,function(n){return((n.nodeType==1&&!re)||(re&&re.test(n.nodeName)))&&(!f||f(n))},r)},getParentNode:function(n,f,r){while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode}return null},getAttrib:function(elm,name,dv){var v;if(typeof(dv)=="undefined")dv="";if(!elm||elm.nodeType!=1)return dv;try{v=elm.getAttribute(name,0)}catch(ex){v=elm.getAttribute(name,2)}if(name=="class"&&!v)v=elm.className;if(tinyMCE.isGecko){if(name=="src"&&elm.src!=null&&elm.src!=='')v=elm.src;if(name=="href"&&elm.href!=null&&elm.href!=='')v=elm.href}else if(tinyMCE.isIE){switch(name){case"http-equiv":v=elm.httpEquiv;b
 reak;case"width":case"height":v=elm.getAttribute(name,2);break}}if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!=='')?v:dv},setAttrib:function(el,name,va,fix){if(typeof(va)=="number"&&va!=null)va=""+va;if(fix){if(va==null)va="";va=va.replace(/[^0-9%]/g,'')}if(name=="style")el.style.cssText=va;if(name=="class")el.className=va;if(va!=null&&va!==''&&va!=-1)el.setAttribute(name,va);else el.removeAttribute(name)},setStyleAttrib:function(e,n,v){e.style[n]=v;if(tinyMCE.isIE&&v==null||v==''){v=tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));e.style.cssText=v;e.setAttribute("style",v)}},switchClass:function(ei,c){var e;if(tinyMCE.switchClassCache[ei])e=tinyMCE.switchClassCache[ei];else e=tinyMCE.switchClassCache[ei]=document.getElementById(ei);if(e){if(tinyMCE.settings.button_tile_map&&e.className&&e.className.indexOf('mceTiledButton')==0)c='mceTiledButton '+c;e.className=c}},getAbsPosition:function(n,cn){var l=0,t=0;while(n&&n!=cn){l+=n.offsetLeft;t+=n
 .offsetTop;n=n.offsetParent}return{absLeft:l,absTop:t}},prevNode:function(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null},nextNode:function(e,n){var a=n.split(','),i;while((e=e.nextSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null},selectElements:function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.split(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a},selectNodes:function(n,f,a){var i;if(!a)a=[];if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a)}return a},addCSSClass:function(e,c,b){var o=this.removeCSSClass(e,c);return e.className=b?c+(o!==''?(' '+o):''):(o!==''?(o+' '):'')+c},removeCSSClass:function(e,c){c=e.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)"),' ');return e.className=c!=' '?c:''},hasCSSClass:function(n,c){return new
  RegExp('\\b'+c+'\\b','g').test(n.className)},renameElement:function(e,n,d){var ne,i,ar;d=typeof(d)=="undefined"?tinyMCE.selectedInstance.getDoc():d;if(e){ne=d.createElement(n);ar=e.attributes;for(i=ar.length-1;i>-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i<ar.length;i++)ne.appendChild(ar[i].cloneNode(true));e.parentNode.replaceChild(ne,e)}},getViewPort:function(w){var d=w.document,m=d.compatMode=='CSS1Compat',b=d.body,de=d.documentElement;return{left:w.pageXOffset||(m?de.scrollLeft:b.scrollLeft),top:w.pageYOffset||(m?de.scrollTop:b.scrollTop),width:w.innerWidth||(m?de.clientWidth:b.clientWidth),height:w.innerHeight||(m?de.clientHeight:b.clientHeight)}},getStyle:function(n,na,d){if(!n)return false;if(tinyMCE.isGecko&&n.ownerDocument.defaultView){try{return n.ownerDocument.defaultView.getComputedStyle(n,null).getPropertyValue(na)}catch(n){return null}}na=na.replace(/-(\D)/g,function(a,b){re
 turn b.toUpperCase()});if(n.currentStyle)return n.currentStyle[na];return false}});tinyMCE.add(TinyMCE_Engine,{parseURL:function(url_str){var urlParts=[],i,pos,lastPos,chr;if(url_str){pos=url_str.indexOf('://');if(pos!=-1){urlParts.protocol=url_str.substring(0,pos);lastPos=pos+3}for(i=lastPos;i<url_str.length;i++){chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break}pos=i;urlParts.host=url_str.substring(lastPos,pos);urlParts.port="";lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts.port=url_str.substring(lastPos+1,pos)}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts.path=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts.query=url_str.substring(lastPos+1,pos)}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts.anchor=url_str.substring(lastPos+1,pos)}}retur
 n urlParts},serializeURL:function(up){var o="";if(up.protocol)o+=up.protocol+"://";if(up.host)o+=up.host;if(up.port)o+=":"+up.port;if(up.path)o+=up.path;if(up.query)o+="?"+up.query;if(up.anchor)o+="#"+up.anchor;return o},convertAbsoluteURLToRelativeURL:function(base_url,url_to_relative){var baseURL=this.parseURL(base_url),targetURL=this.parseURL(url_to_relative);var i,strTok1,strTok2,breakPoint=0,outPath="",forceSlash=false;var fileName,pos;if(targetURL.path=='')targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(strTok1.length<strTok2.length){for(i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(breakPoint==1)return targetURL.path;for(i=0;i<(strTok1.length-(breakPoint-1));i++)out
 Path+="../";for(i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i]}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==''&&forceSlash?"/":outPath;fileName=baseURL.path;if((pos=fileName.lastIndexOf('/'))!=-1)fileName=fileName.substring(pos+1);if(fileName==targetURL.path&&targetURL.anchor!=='')targetURL.path="";if(targetURL.path==''&&!targetURL.anchor)targetURL.path=fileName!==''?fileName:"/";return this.serializeURL(targetURL)},convertRelativeToAbsoluteURL:function(base_url,relative_url){var baseURL=this.parseURL(base_url),baseURLParts,relURLParts,newRelURLParts,numBack,relURL=this.parseURL(relative_url),i;var len,absPath,start,end,newBaseURLParts;if(relative_url==''||relative_url.indexOf('://')!=-1||/^(mailto:|javascript:|#|\/)/.test(relative_url))return relative_url;baseURLParts=baseURL.path.split('/');relURLParts=relURL.path.split('/');newBaseURLParts=[];for(i=baseURLParts.length-1;
 i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i]}baseURLParts=newBaseURLParts.reverse();newRelURLParts=[];numBack=0;for(i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue}if(numBack>0){numBack--;continue}newRelURLParts[newRelURLParts.length]=relURLParts[i]}relURLParts=newRelURLParts.reverse();len=baseURLParts.length-numBack;absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');start="";end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)},convertURL:function(url,node,on_save){var dl=document.location,start,portPart,urlParts,baseUrlParts,tmpUrlParts,curl;var prot=dl.protocol,host=dl.hostname,port=dl.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(u
 rl,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||/^[ \t\r\n\+]*[#\?]/.test(url))return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings.base_href+url;if(on_save&&tinyMCE.getParam('relative_urls')){curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(curl.charAt(0)=='/')curl=tinyMCE.settings.document_base_prefix+curl;urlParts=tinyMCE.parseURL(curl);tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings.document_base_url);if(urlParts.host==tmpUrlParts.host&&(urlParts.port==tmpUrlParts.port))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url,curl)}if(!tinyMCE.getParam('relative_urls')){urlParts=tinyMCE.parseURL(url);baseUrlParts=tinyMCE.parseURL(tinyMCE.settings.base_href);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(urlParts.anchor&&urlParts.path==baseUrlParts.path)return"#"+urlParts.anchor}if(tinyMCE.getParam('
 remove_script_host')){start="";portPart="";if(port!=='')portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url},convertAllRelativeURLs:function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;i<elms.length;i++){src=tinyMCE.getAttrib(elms[i],'src');msrc=tinyMCE.getAttrib(elms[i],'mce_src');if(msrc!=='')src=msrc;if(src!==''){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,src);elms[i].setAttribute("src",src)}}elms=body.getElementsByTagName("a");for(i=0;i<elms.length;i++){href=tinyMCE.getAttrib(elms[i],'href');mhref=tinyMCE.getAttrib(elms[i],'mce_href');if(mhref!=='')href=mhref;if(href&&href!==''){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,href);elms[i].setAttribute("href",href)}}}});tinyMCE.add(TinyMCE_Engine,{clearArray:function(a){var n;for(n in a)a[n]=null;return a},explode:function(d,s){var ar=s.split(d),oar=[],i;for(i=0;i<ar.l
 ength;i++){if(ar[i]!=='')oar[oar.length]=ar[i]}return oar}});tinyMCE.add(TinyMCE_Engine,{_setEventsEnabled:function(node,state){var evs,x,y,elms,i,event;var events=['onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];evs=tinyMCE.settings.event_elements.split(',');for(y=0;y<evs.length;y++){elms=node.getElementsByTagName(evs[y]);for(i=0;i<elms.length;i++){event="";for(x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!==''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event)}}}}},_eventPatch:function(editor_id){var n,inst,win,e;if(typeof(tinyMCE)=="undefined")return true;try{if(tinyMCE.selectedInstance){win=tinyMCE.selectedInstance.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;Tiny
 MCE_Engine.prototype.handleEvent(e);return}}for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.select();win=inst.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}}catch(ex){}},findEvent:function(e){var n,inst;if(e)return e;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(tinyMCE.isInstance(inst)&&inst.getWin().event)return inst.getWin().event}return null},unloadHandler:function(){tinyMCE.triggerSave(true,true)},addEventHandlers:function(inst){this.setEventHandlers(inst,1)},setEventHandlers:function(inst,s){var doc=inst.getDoc(),ie,ot,i,f=s?tinyMCE.addEvent:tinyMCE.removeEvent;ie=['keypress','keyup','keydown','click','mouseup','mousedown','controlselect','dblclick'];ot=['keypress','keyup','keydown','click','mouseup','mousedown','focus','blur','dragdrop'];inst.switchSettings();if(tinyMCE.isIE){for(i=0;i<ie.length;i++)f(doc,ie[i],TinyMCE_Engine.prototy
 pe._eventPatch)}else{for(i=0;i<ot.length;i++)f(doc,ot[i],tinyMCE.handleEvent);try{doc.designMode="On"}catch(e){}}},onMouseMove:function(){var inst,lh;if(tinyMCE.lastHover){lh=tinyMCE.lastHover;if(lh.className.indexOf('mceMenu')!=-1)tinyMCE._menuButtonEvent('out',lh);else lh.className=lh.className;tinyMCE.lastHover=null}if(!tinyMCE.hasMouseMoved){inst=tinyMCE.selectedInstance;if(inst.isFocused){inst.undoBookmark=inst.selection.getBookmark();tinyMCE.hasMouseMoved=true}}},cancelEvent:function(e){if(!e)return false;if(tinyMCE.isIE){e.returnValue=false;e.cancelBubble=true}else{e.preventDefault();e.stopPropagation&&e.stopPropagation()}return false},addEvent:function(o,n,h){if(n!='unload'){function clean(){var ex;try{tinyMCE.removeEvent(o,n,h);tinyMCE.removeEvent(window,'unload',clean);o=n=h=null}catch(ex){}}tinyMCE.addEvent(window,'unload',clean)}if(o.attachEvent)o.attachEvent("on"+n,h);else o.addEventListener(n,h,false)},removeEvent:function(o,n,h){if(o.detachEvent)o.detachEvent(
 "on"+n,h);else o.removeEventListener(n,h,false)},addSelectAccessibility:function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w}return false},accessibleEventHandler:function(e){var elm,win=this._win;e=tinyMCE.isIE?win.event:e;elm=tinyMCE.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null}return true}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false}return true},_resetIframeHeight:function(){var ife;if(tinyMCE.isRealIE){ife=tinyMCE.selectedInstance.iframeElement;if(ife._oldHeight){ife.style.height=ife._oldHeight;ife.height=ife._oldHeight}}}});function TinyMCE_Selection(inst){this.instance=inst};TinyMCE_Selection.prototype={getSelectedHTML:function
 (){var inst=this.instance,e,r=this.getRng(),h;if(!r)return null;e=document.createElement("body");if(r.cloneContents)e.appendChild(r.cloneContents());else if(typeof(r.item)!='undefined'||typeof(r.htmlText)!='undefined')e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();h=tinyMCE._cleanupHTML(inst,inst.contentDocument,inst.settings,e,e,false,true,false);return h},getSelectedText:function(){var inst=this.instance,d,r,s,t;if(tinyMCE.isIE){d=inst.getDoc();if(d.selection.type=="Text"){r=d.selection.createRange();t=r.text}else t=''}else{s=this.getSel();if(s&&s.toString)t=s.toString();else t=''}return t},getBookmark:function(simple){var inst=this.instance,rng=this.getRng(),doc=inst.getDoc(),b=inst.getBody();var trng,sx,sy,xx=-999999999,vp=inst.getViewPort();var sp,le,s,e,nl,i,si,ei,w;sx=vp.left;sy=vp.top;if(simple)return{rng:rng,scrollX:sx,scrollY:sy};if(tinyMCE.isRealIE){if(rng.item){e=rng.item(0);nl=b.getElementsByTagName(e.nodeName);for(i=0;i<nl.lengt
 h;i++){if(e==nl[i]){sp=i;break}}return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy}}else{trng=doc.body.createTextRange();trng.moveToElementText(inst.getBody());trng.collapse(true);bp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(true);sp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(false);le=Math.abs(trng.move('character',xx))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy}}}else{s=this.getSel();e=this.getFocusElement();if(!s)return null;if(e&&e.nodeName=='IMG'){return{start:-1,end:-1,index:sp,scrollX:sx,scrollY:sy}}if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=this._getPosText(b,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+s.anchorOffset,end:e.end+s.focusOffset,scrollX:sx,scrollY:sy}}else{e=this._getPosText(b,rng.startContainer,rng.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+rng.startOffset,end:e.end+rng.endOffset,scrollX:sx,scrollY:s
 y}}}return null},moveToBookmark:function(bookmark){var inst=this.instance,rng,nl,i,ex,b=inst.getBody(),sd;var doc=inst.getDoc(),win=inst.getWin(),sel=this.getSel();if(!bookmark)return false;if(tinyMCE.isSafari&&bookmark.rng){sel.setBaseAndExtent(bookmark.rng.startContainer,bookmark.rng.startOffset,bookmark.rng.endContainer,bookmark.rng.endOffset);return true}if(tinyMCE.isRealIE){if(bookmark.rng){try{bookmark.rng.select()}catch(ex){}return true}win.focus();if(bookmark.tag){rng=b.createControlRange();nl=b.getElementsByTagName(bookmark.tag);if(nl.length>bookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(!sel)return fal
 se;if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);if(!tinyMCE.isOpera)win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null
 },selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,[],3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node)}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.s
 etEnd(node,node.nodeValue.length)}else rng.collapse(to_start)}sel.removeAllRanges();sel.addRange(rng)}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeft<vp.left||pos.absLeft>vp.left+vp.width||pos.absTop<vp.top||pos.absTop>vp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContainerWin();cvp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeft<cvp.left||p.absLeft>cvp.left+cvp.width||p.absTop<cvp.top||p.absTop>cvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;i
 f(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();if(s.rangeCount>0)return s.getRangeAt(0);return null},isCollapsed:function(){var r=this.getRng();if(r.item)return false;return r.boundingWidth==0||this.getSel().isCollapsed},collapse:function(b){var r=this.getRng(),s=this.getSel();if(r.select){r.collapse(b);r.select()}else{if(b)s.collapseToStart();else s.collapseToEnd()}},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if
 (rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(tinyMCE.typingUndoIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){inst.isNotDirty=false;tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings.custom_undo_redo_levels;if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i<this.undoLevels.length-1;i++)
 this.undoLevels[i]=this.undoLevels[i+1];this.undoLevels.length--;this.undoIndex--;}b=inst.undoBookmark;if(!b)b=inst.selection.getBookmark();this.undoIndex++;this.undoLevels[this.undoIndex]={content:newHTML,bookmark:b};ul=tinyMCE.undoLevels;for(i=tinyMCE.undoIndex+1;i<ul.length;i++){ur=ul[i].undoRedo;if(ur.undoIndex==ur.undoLevels.length-1)ur.undoIndex--;ur.undoLevels.length--}tinyMCE.undoLevels[tinyMCE.undoIndex++]=inst;tinyMCE.undoLevels.length=tinyMCE.undoIndex;this.undoLevels.length=this.undoIndex+1;return true}return false},undo:function(){var inst=this.instance;if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(i
 nst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.isOpera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents,i;function isEmpty(para){var nodes;function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()==''}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;nodes=tinyMCE.getNodeTree(para,[],3)
 ;for(i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false}return true}rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;startNode=direct?sel.anchorNode:sel.focusNode;startOffset=direct?sel.anchorOffset:sel.focusOffset;endNode=direct?sel.focusNode:sel.anchorNode;endOffset=direct?sel.focusOffset:sel.anchorOffset;startNode=startNode.nodeName=="HTML"?doc.body:startNode;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;startBlock=inst.getParentBlockElement(startNode);endBlock=inst.getParentBlockElement(endNode);if(startBlock&&(startBlock.nodeName=='CAPTION'||/absolute|relative|static/gi.test(startBlock.style.position)))startBlock=null;if(endBlock&&(endBlock.n
 odeName=='CAPTION'||/absolute|relative|static/gi.test(endBlock.style.position)))endBlock=null;if(startBlock!=null){blockName=startBlock.nodeName;if(/(TD|TABLE|TH|CAPTION)/.test(blockName)||(blockName=="DIV"&&/left|right/gi.test(startBlock.style.cssFloat)))blockName="P"}if(tinyMCE.getParentElement(startBlock,"OL,UL",null,body)!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");startChop=startNode;endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;d
 o{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();if(!tinyMCE.isSafari)sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.in
 nerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();if(tinyMCE.isOpera){paraBefore.normalize();rngBefore.insertNode(paraBefore);paraAfter.normalize();rngBefore.insertNode(paraAfter)}else{paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore)}}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=c
 ontents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_ha
 ndleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re),e=this.getElement(),x,y;var w=parseInt(re.offsetWidth),h=parseInt(re.offsetHeight);var ew=parseInt(e.offsetWidth),eh=parseInt(e.offsetHeight);switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2)
 ;break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){var el=this.getElement();if(el){el.style.display='block';this.updateBlocker()}},hide:function(){var el=this.getElement();if(el){el.style.display='none';this.updateBlocker()}},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=th
 is.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(this.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.e
 lement=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)},remove:function(){var e=this.getElement(),b=this.getBlocker();if(e)e.parentNode.removeChild(e);if(b)b.parentNode.removeChild(b)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=[];this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=[]},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separ
 ator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='<span class="mceMenuLine"></span>';h+='<table border="0" cellpadding="0" cellspacing="0">';for(i=0;i<m.length;i++){t=tinyMCE.xmlEncode(m[i].text);c=m[i].class_name?' class="'+m[i].class_name+'"':'';switch(m[i].type){case'separator':h+='<tr class="'+s.separator_class+'"><td>';break;case'title':h+='<tr class="'+s.title_class+'"><td><span'+c+'>'+t+'</span>';break;case'disabled':h+='<tr class="'+s.disabled_class+'"><td><span'+c+'>'+t+'</span>';break;default:h+='<tr><td><a href="'+tinyMCE.xmlEncode(m[i].js)+'" onmousedown="'+tinyMCE.xmlEncode(m[i].js)+';return tinyMCE.cancelEvent(event);" onclick="return tinyMCE.cancelEvent(event);" onmouseup="return tinyMCE.cancelEvent(event);"><span'+c+'>'+t+'</span></a>'}h+='</td></tr>'}h+='</table>';e.inn
 erHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});tinyMCE.add(TinyMCE_Engine,{debug:function(){var m="",a,i,l=tinyMCE.log.length;for(i=0,a=this.debug.arguments;i<a.length;i++){m+=a[i];if(i<a.length-1)m+=', '}if(l<1000)tinyMCE.log[l]="[debug] "+m}});
\ No newline at end of file

Modified: plog/trunk/js/tinymce/tiny_mce_popup.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce_popup.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/tiny_mce_popup.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -31,7 +31,7 @@
 
 	init : function() {
 		var win = window.opener ? window.opener : window.dialogArguments, c;
-		var inst;
+		var inst, re, title, divElm;
 
 		if (!win)
 			win = this.findWin(window);
@@ -61,18 +61,18 @@
 			inst.selectionBookmark = inst.selection.getBookmark(true);
 
 		// Setup dir
-		if (tinyMCELang['lang_dir'])
-			document.dir = tinyMCELang['lang_dir'];
+		if (tinyMCELang.lang_dir)
+			document.dir = tinyMCELang.lang_dir;
 
 		// Setup title
-		var re = new RegExp('{|\\\$|}', 'g');
-		var title = document.title.replace(re, "");
-		if (typeof tinyMCELang[title] != "undefined") {
-			var divElm = document.createElement("div");
+		re = new RegExp('{|\\\$|}', 'g');
+		title = document.title.replace(re, "");
+		if (typeof(tinyMCELang[title]) != "undefined") {
+			divElm = document.createElement("div");
 			divElm.innerHTML = tinyMCELang[title];
 			document.title = divElm.innerHTML;
 
-			if (tinyMCE.setWindowTitle != null)
+			if (typeof(tinyMCE.setWindowTitle) != 'undefined')
 				tinyMCE.setWindowTitle(window, divElm.innerHTML);
 		}
 
@@ -98,7 +98,7 @@
 		if (tinyMCE.getWindowArg('mce_replacevariables', true))
 			body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
 
-		dir = tinyMCE.selectedInstance.settings['directionality'];
+		dir = tinyMCE.selectedInstance.settings.directionality;
 		if (dir == "rtl" && document.forms && document.forms.length > 0) {
 			elms = document.forms[0].elements;
 			for (i=0; i<elms.length; i++) {
@@ -111,7 +111,7 @@
 			body.style.display = 'block';
 
 		// Execute real onload (Opera fix)
-		if (tinyMCEPopup.onLoadEval != "")
+		if (tinyMCEPopup.onLoadEval !== '')
 			eval(tinyMCEPopup.onLoadEval);
 	},
 
@@ -123,6 +123,8 @@
 	},
 
 	resizeToInnerSize : function() {
+		var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy;
+
 		// Netscape 7.1 workaround
 		if (this.isWindow && tinyMCE.isNS71) {
 			window.resizeBy(0, 10);
@@ -130,9 +132,8 @@
 		}
 
 		if (this.isWindow) {
-			var doc = document;
-			var body = doc.body;
-			var oldMargin, wrapper, iframe, nodes, dx, dy;
+			doc = document;
+			body = doc.body;
 
 			if (body.style.display == 'none')
 				body.style.display = 'block';
@@ -149,7 +150,7 @@
 
 			// Wrap body elements
 			nodes = doc.body.childNodes;
-			for (var i=nodes.length-1; i>=0; i--) {
+			for (i=nodes.length-1; i>=0; i--) {
 				if (wrapper.hasChildNodes())
 					wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
 				else
@@ -164,7 +165,7 @@
 			// Create iframe
 			iframe = document.createElement("iframe");
 			iframe.id = "mcWinIframe";
-			iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
+			iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document;
 			iframe.width = "100%";
 			iframe.height = "100%";
 			iframe.style.margin = '0';
@@ -191,6 +192,7 @@
 	resizeToContent : function() {
 		var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
 		var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
+		var elm, width, height, x, y, dx, dy;
 
 		if (isOpera)
 			return;
@@ -198,11 +200,11 @@
 		if (isMSIE) {
 			try { window.resizeTo(10, 10); } catch (e) {}
 
-			var elm = document.body;
-			var width = elm.offsetWidth;
-			var height = elm.offsetHeight;
-			var dx = (elm.scrollWidth - width) + 4;
-			var dy = elm.scrollHeight - height;
+			elm = document.body;
+			width = elm.offsetWidth;
+			height = elm.offsetHeight;
+			dx = (elm.scrollWidth - width) + 4;
+			dy = elm.scrollHeight - height;
 
 			try { window.resizeBy(dx, dy); } catch (e) {}
 		} else {
@@ -211,8 +213,8 @@
 				window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
 				window.sizeToContent();
 				window.scrollTo(0, 0);
-				var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
-				var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
+				x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
+				y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
 				window.moveTo(x, y);
 			}
 		}
@@ -223,8 +225,10 @@
 	},
 
 	restoreSelection : function() {
+		var inst;
+
 		if (this.storeSelection) {
-			var inst = tinyMCE.selectedInstance;
+			inst = tinyMCE.selectedInstance;
 
 			inst.getWin().focus();
 
@@ -272,9 +276,11 @@
 	},
 
 	importClass : function(c) {
+		var n;
+
 		window[c] = function() {};
 
-		for (var n in window.opener[c].prototype)
+		for (n in window.opener[c].prototype)
 			window[c].prototype[n] = window.opener[c].prototype[n];
 
 		window[c].constructor = window.opener[c].constructor;

Modified: plog/trunk/js/tinymce/tiny_mce_src.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce_src.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/tiny_mce_src.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -5,22 +5,23 @@
 	var ua;
 
 	this.majorVersion = "2";
-	this.minorVersion = "1.0";
-	this.releaseDate = "2007-02-13";
+	this.minorVersion = "1.2";
+	this.releaseDate = "2007-08-21";
 
-	this.instances = new Array();
-	this.switchClassCache = new Array();
-	this.windowArgs = new Array();
-	this.loadedFiles = new Array();
-	this.pendingFiles = new Array();
+	this.instances = [];
+	this.switchClassCache = [];
+	this.windowArgs = [];
+	this.loadedFiles = [];
+	this.pendingFiles = [];
 	this.loadingIndex = 0;
-	this.configs = new Array();
+	this.configs = [];
 	this.currentConfig = 0;
-	this.eventHandlers = new Array();
-	this.log = new Array();
+	this.eventHandlers = [];
+	this.log = [];
 	this.undoLevels = [];
 	this.undoIndex = 0;
 	this.typingUndoIndex = -1;
+	this.settings = [];
 
 	// Browser check
 	ua = navigator.userAgent;
@@ -28,18 +29,18 @@
 	this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1);
 	this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
 	this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1);
-	this.isGecko = ua.indexOf('Gecko') != -1;
+	this.isGecko = ua.indexOf('Gecko') != -1; // Will also be true on Safari
 	this.isSafari = ua.indexOf('Safari') != -1;
-	this.isOpera = ua.indexOf('Opera') != -1;
+	this.isOpera = window['opera'] && opera.buildNumber ? true : false;
 	this.isMac = ua.indexOf('Mac') != -1;
 	this.isNS7 = ua.indexOf('Netscape/7') != -1;
 	this.isNS71 = ua.indexOf('Netscape/7.1') != -1;
 	this.dialogCounter = 0;
-	this.plugins = new Array();
-	this.themes = new Array();
-	this.menus = new Array();
-	this.loadedPlugins = new Array();
-	this.buttonMap = new Array();
+	this.plugins = [];
+	this.themes = [];
+	this.menus = [];
+	this.loadedPlugins = [];
+	this.buttonMap = [];
 	this.isLoaded = false;
 
 	// Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those
@@ -58,7 +59,7 @@
 
 TinyMCE_Engine.prototype = {
 	init : function(settings) {
-		var theme, nl, baseHREF = "", i;
+		var theme, nl, baseHREF = "", i, cssPath, entities, h, p, src, elements = [], head;
 
 		// IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry.
 		if (this.isMSIE5_0)
@@ -72,8 +73,18 @@
 
 		// Get script base path
 		if (!tinyMCE.baseURL) {
-			var elements = document.getElementsByTagName('script');
+			// Search through head
+			head = document.getElementsByTagName('head')[0];
 
+			if (head) {
+				for (i=0, nl = head.getElementsByTagName('script'); i<nl.length; i++)
+					elements.push(nl[i]);
+			}
+
+			// Search through rest of document
+			for (i=0, nl = document.getElementsByTagName('script'); i<nl.length; i++)
+				elements.push(nl[i]);
+
 			// If base element found, add that infront of baseURL
 			nl = document.getElementsByTagName('base');
 			for (i=0; i<nl.length; i++) {
@@ -81,9 +92,9 @@
 					baseHREF = nl[i].href;
 			}
 
-			for (var i=0; i<elements.length; i++) {
+			for (i=0; i<elements.length; i++) {
 				if (elements[i].src && (elements[i].src.indexOf("tiny_mce.js") != -1 || elements[i].src.indexOf("tiny_mce_dev.js") != -1 || elements[i].src.indexOf("tiny_mce_src.js") != -1 || elements[i].src.indexOf("tiny_mce_gzip") != -1)) {
-					var src = elements[i].src;
+					src = elements[i].src;
 
 					tinyMCE.srcMode = (src.indexOf('_src') != -1 || src.indexOf('_dev') != -1) ? '_src' : '';
 					tinyMCE.gzipMode = src.indexOf('_gzip') != -1;
@@ -93,7 +104,7 @@
 						tinyMCE.srcMode = settings.exec_mode == "src" ? '_src' : '';
 
 					// Force it absolute if page has a base href
-					if (baseHREF != "" && src.indexOf('://') == -1)
+					if (baseHREF !== '' && src.indexOf('://') == -1)
 						tinyMCE.baseURL = baseHREF + src;
 					else
 						tinyMCE.baseURL = src;
@@ -121,7 +132,7 @@
 		this._def("theme", "advanced");
 		this._def("plugins", "", true);
 		this._def("language", "en");
-		this._def("docs_language", this.settings['language']);
+		this._def("docs_language", this.settings.language);
 		this._def("elements", "");
 		this._def("textarea_trigger", "mce_editable");
 		this._def("editor_selector", "");
@@ -132,7 +143,6 @@
 		this._def("encoding", "");
 		this._def("urlconverter_callback", tinyMCE.getParam("urlconvertor_callback", "TinyMCE_Engine.prototype.convertURL"));
 		this._def("save_callback", "");
-		this._def("debug", false);
 		this._def("force_br_newlines", false);
 		this._def("force_p_newlines", true);
 		this._def("add_form_submit_trigger", true);
@@ -193,31 +203,34 @@
 		this._def("display_tab_class", '');
 		this._def("gecko_spellcheck", false);
 		this._def("hide_selects_on_submit", true);
+		this._def("forced_root_block", false);
+		this._def("remove_trailing_nbsp", false);
+		this._def("save_on_tinymce_forms", false);
 
 		// Force strict loading mode to false on non Gecko browsers
 		if (this.isMSIE && !this.isOpera)
 			this.settings.strict_loading_mode = false;
 
 		// Browser check IE
-		if (this.isMSIE && this.settings['browsers'].indexOf('msie') == -1)
+		if (this.isMSIE && this.settings.browsers.indexOf('msie') == -1)
 			return;
 
 		// Browser check Gecko
-		if (this.isGecko && this.settings['browsers'].indexOf('gecko') == -1)
+		if (this.isGecko && this.settings.browsers.indexOf('gecko') == -1)
 			return;
 
 		// Browser check Safari
-		if (this.isSafari && this.settings['browsers'].indexOf('safari') == -1)
+		if (this.isSafari && this.settings.browsers.indexOf('safari') == -1)
 			return;
 
 		// Browser check Opera
-		if (this.isOpera && this.settings['browsers'].indexOf('opera') == -1)
+		if (this.isOpera && this.settings.browsers.indexOf('opera') == -1)
 			return;
 
 		// If not super absolute make it so
-		baseHREF = tinyMCE.settings['document_base_url'];
-		var h = document.location.href;
-		var p = h.indexOf('://');
+		baseHREF = tinyMCE.settings.document_base_url;
+		h = document.location.href;
+		p = h.indexOf('://');
 		if (p > 0 && document.location.protocol != "file:") {
 			p = h.indexOf('/', p + 3);
 			h = h.substring(0, p);
@@ -225,68 +238,56 @@
 			if (baseHREF.indexOf('://') == -1)
 				baseHREF = h + baseHREF;
 
-			tinyMCE.settings['document_base_url'] = baseHREF;
-			tinyMCE.settings['document_base_prefix'] = h;
+			tinyMCE.settings.document_base_url = baseHREF;
+			tinyMCE.settings.document_base_prefix = h;
 		}
 
 		// Trim away query part
 		if (baseHREF.indexOf('?') != -1)
 			baseHREF = baseHREF.substring(0, baseHREF.indexOf('?'));
 
-		this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";
+		this.settings.base_href = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";
 
-		theme = this.settings['theme'];
+		theme = this.settings.theme;
 		this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';
 		this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';
-		this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
+		this.blockElms = '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';
 		this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i");
-		this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
+		this.posKeyCodes = [13,45,36,35,33,34,37,38,39,40];
 		this.uniqueURL = 'javascript:void(091039730);'; // Make unique URL non real URL
 		this.uniqueTag = '<div id="mceTMPElement" style="display: none">TMP</div>';
-		this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance');
+		this.callbacks = ['onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance'];
 
 		// Theme url
-		this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme;
+		this.settings.theme_href = tinyMCE.baseURL + "/themes/" + theme;
 
 		if (!tinyMCE.isIE || tinyMCE.isOpera)
-			this.settings['force_br_newlines'] = false;
+			this.settings.force_br_newlines = false;
 
 		if (tinyMCE.getParam("popups_css", false)) {
-			var cssPath = tinyMCE.getParam("popups_css", "");
+			cssPath = tinyMCE.getParam("popups_css", "");
 
 			// Is relative
 			if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/')
-				this.settings['popups_css'] = this.documentBasePath + "/" + cssPath;
+				this.settings.popups_css = this.documentBasePath + "/" + cssPath;
 			else
-				this.settings['popups_css'] = cssPath;
+				this.settings.popups_css = cssPath;
 		} else
-			this.settings['popups_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css";
+			this.settings.popups_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css";
 
 		if (tinyMCE.getParam("editor_css", false)) {
-			var cssPath = tinyMCE.getParam("editor_css", "");
+			cssPath = tinyMCE.getParam("editor_css", "");
 
 			// Is relative
 			if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/')
-				this.settings['editor_css'] = this.documentBasePath + "/" + cssPath;
+				this.settings.editor_css = this.documentBasePath + "/" + cssPath;
 			else
-				this.settings['editor_css'] = cssPath;
+				this.settings.editor_css = cssPath;
 		} else {
-			if (this.settings.editor_css != '')
-				this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
+			if (this.settings.editor_css !== '')
+				this.settings.editor_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
 		}
 
-		if (tinyMCE.settings['debug']) {
-			var msg = "Debug: \n";
-
-			msg += "baseURL: " + this.baseURL + "\n";
-			msg += "documentBasePath: " + this.documentBasePath + "\n";
-			msg += "content_css: " + this.settings['content_css'] + "\n";
-			msg += "popups_css: " + this.settings['popups_css'] + "\n";
-			msg += "editor_css: " + this.settings['editor_css'] + "\n";
-
-			alert(msg);
-		}
-
 		// Only do this once
 		if (this.configs.length == 0) {
 			if (typeof(TinyMCECompressed) == "undefined") {
@@ -304,14 +305,14 @@
 			}
 		}
 
-		this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings['theme'] + '/editor_template' + tinyMCE.srcMode + '.js');
-		this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings['language'] +  '.js');
-		this.loadCSS(this.settings['editor_css']);
+		this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings.theme + '/editor_template' + tinyMCE.srcMode + '.js');
+		this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings.language +  '.js');
+		this.loadCSS(this.settings.editor_css);
 
 		// Add plugins
-		var p = tinyMCE.getParam('plugins', '', true, ',');
+		p = tinyMCE.getParam('plugins', '', true, ',');
 		if (p.length > 0) {
-			for (var i=0; i<p.length; i++) {
+			for (i=0; i<p.length; i++) {
 				if (p[i].charAt(0) != '-')
 					this.loadScript(tinyMCE.baseURL + '/plugins/' + p[i] + '/editor_plugin' + tinyMCE.srcMode + '.js');
 			}
@@ -319,14 +320,14 @@
 
 		// Setup entities
 		if (tinyMCE.getParam('entity_encoding') == 'named') {
-			settings['cleanup_entities'] = new Array();
-			var entities = tinyMCE.getParam('entities', '', true, ',');
-			for (var i=0; i<entities.length; i+=2)
-				settings['cleanup_entities']['c' + entities[i]] = entities[i+1];
+			settings.cleanup_entities = [];
+			entities = tinyMCE.getParam('entities', '', true, ',');
+			for (i=0; i<entities.length; i+=2)
+				settings.cleanup_entities['c' + entities[i]] = entities[i+1];
 		}
 
 		// Save away this config
-		settings['index'] = this.configs.length;
+		settings.index = this.configs.length;
 		this.configs[this.configs.length] = settings;
 
 		// Start loading first one in chain
@@ -337,23 +338,24 @@
 			try {
 				document.execCommand('BackgroundImageCache', false, true);
 			} catch (e) {
+				// Ignore
 			}
 		}
 
 		// Setup XML encoding regexps
-		this.xmlEncodeAposRe = new RegExp('[<>&"\']', 'g');
 		this.xmlEncodeRe = new RegExp('[<>&"]', 'g');
-//		this.xmlEncodeEnts = {'&':'&amp;','"':'&quot;',"'":'&#39;','<':'&lt;','>':'&gt;'};
 	},
 
 	_addUnloadEvents : function() {
+		var st = tinyMCE.settings.add_unload_trigger;
+
 		if (tinyMCE.isIE) {
-			if (tinyMCE.settings['add_unload_trigger']) {
+			if (st) {
 				tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler);
 				tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler);
 			}
 		} else {
-			if (tinyMCE.settings['add_unload_trigger'])
+			if (st)
 				tinyMCE.addEvent(window, "unload", function () {tinyMCE.triggerSave(true, true);});
 		}
 	},
@@ -449,8 +451,7 @@
 
 	loadCSS : function(url) {
 		var ar = url.replace(/\s+/, '').split(',');
-		var lflen = 0, csslen = 0;
-		var skip = false;
+		var lflen = 0, csslen = 0, skip = false;
 		var x = 0, i = 0, nl, le;
 
 		for (x = 0,csslen = ar.length; x<csslen; x++) {
@@ -514,25 +515,28 @@
 
 		tinyMCE.settings = settings;
 
-		if (tinyMCE.settings['convert_on_click'] || (!elm.getAttribute('mce_noask') && confirm(tinyMCELang['lang_edit_confirm'])))
+		if (tinyMCE.settings.convert_on_click || (!elm.getAttribute('mce_noask') && confirm(tinyMCELang.lang_edit_confirm)))
 			tinyMCE.addMCEControl(elm, elementId);
 
 		elm.setAttribute('mce_noask', 'true');
 	},
 
 	updateContent : function(form_element_name) {
+		var formElement, n, inst, doc;
+
 		// Find MCE instance linked to given form element and copy it's value
-		var formElement = document.getElementById(form_element_name);
-		for (var n in tinyMCE.instances) {
-			var inst = tinyMCE.instances[n];
+		formElement = document.getElementById(form_element_name);
+		for (n in tinyMCE.instances) {
+			inst = tinyMCE.instances[n];
+
 			if (!tinyMCE.isInstance(inst))
 				continue;
 
 			inst.switchSettings();
 
 			if (inst.formElement == formElement) {
-				var doc = inst.getDoc();
-		
+				doc = inst.getDoc();
+
 				tinyMCE._setHTML(doc, inst.formElement.value);
 
 				if (!tinyMCE.isIE)
@@ -583,7 +587,7 @@
 	},
 
 	removeMCEControl : function(editor_id) {
-		var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn;
+		var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn, n;
 
 		if (inst) {
 			inst.switchSettings();
@@ -596,6 +600,18 @@
 			tinyMCE.selectedElement = null;
 			tinyMCE.selectedInstance = null;
 
+			tinyMCE.selectedElement = null;
+			tinyMCE.selectedInstance = null;
+
+			// Try finding an instance
+			for (n in tinyMCE.instances) {
+				if (!tinyMCE.isInstance(tinyMCE.instances[n]))
+					continue;
+
+				tinyMCE.selectedInstance = tinyMCE.instances[n];
+				break;
+			}
+
 			// Remove element
 			re = document.getElementById(editor_id + "_parent");
 			ot = inst.oldTargetElement;
@@ -681,7 +697,7 @@
 	},
 
 	execCommand : function(command, user_interface, value) {
-		var inst = tinyMCE.selectedInstance;
+		var inst = tinyMCE.selectedInstance, n, pe, te;
 
 		// Default input
 		user_interface = user_interface ? user_interface : false;
@@ -721,7 +737,8 @@
 				return true;
 
 			case 'mceFocus':
-				var inst = tinyMCE.getInstanceById(value);
+				inst = tinyMCE.getInstanceById(value);
+
 				if (inst)
 					inst.getWin().focus();
 			return;
@@ -732,7 +749,7 @@
 				return;
 
 			case "mceAddFrameControl":
-				tinyMCE.addMCEControl(tinyMCE._getElementById(value['element'], value['document']), value['element'], value['document']);
+				tinyMCE.addMCEControl(tinyMCE._getElementById(value.element, value.document), value.element, value.document);
 				return;
 
 			case "mceRemoveControl":
@@ -741,7 +758,7 @@
 				return;
 
 			case "mceToggleEditor":
-				var inst = tinyMCE.getInstanceById(value), pe, te;
+				inst = tinyMCE.getInstanceById(value);
 
 				if (inst) {
 					pe = document.getElementById(inst.editorId + '_parent');
@@ -754,13 +771,23 @@
 
 					if (!inst.enabled) {
 						pe.style.display = 'none';
-						te.value = inst.getHTML();
+
+						if (te.nodeName == 'TEXTAREA' || te.nodeName == 'INPUT')
+							te.value = inst.getHTML();
+						else
+							te.innerHTML = inst.getHTML();
+
 						te.style.display = inst.oldTargetDisplay;
 						tinyMCE.dispatchCallback(inst, 'hide_instance_callback', 'hideInstance', inst);
 					} else {
 						pe.style.display = 'block';
 						te.style.display = 'none';
-						inst.setHTML(te.value);
+
+						if (te.nodeName == 'TEXTAREA' || te.nodeName == 'INPUT')
+							inst.setHTML(te.value);
+						else
+							inst.setHTML(te.innerHTML);
+
 						inst.useCSS = false;
 						tinyMCE.dispatchCallback(inst, 'show_instance_callback', 'showInstance', inst);
 					}
@@ -771,13 +798,15 @@
 
 			case "mceResetDesignMode":
 				// Resets the designmode state of the editors in Gecko
-				if (!tinyMCE.isIE) {
-					for (var n in tinyMCE.instances) {
+				if (tinyMCE.isGecko) {
+					for (n in tinyMCE.instances) {
 						if (!tinyMCE.isInstance(tinyMCE.instances[n]))
 							continue;
 
 						try {
+							tinyMCE.instances[n].getDoc().designMode = "off";
 							tinyMCE.instances[n].getDoc().designMode = "on";
+							tinyMCE.instances[n].useCSS = false;
 						} catch (e) {
 							// Ignore any errors
 						}
@@ -789,8 +818,8 @@
 
 		if (inst) {
 			inst.execCommand(command, user_interface, value);
-		} else if (tinyMCE.settings['focus_alert'])
-			alert(tinyMCELang['lang_focus_alert']);
+		} else if (tinyMCE.settings.focus_alert)
+			alert(tinyMCELang.lang_focus_alert);
 	},
 
 	_createIFrame : function(replace_element, doc, win) {
@@ -805,8 +834,8 @@
 
 		iframe = doc.createElement("iframe");
 
-		aw = "" + tinyMCE.settings['area_width'];
-		ah = "" + tinyMCE.settings['area_height'];
+		aw = "" + tinyMCE.settings.area_width;
+		ah = "" + tinyMCE.settings.area_height;
 
 		if (aw.indexOf('%') == -1) {
 			aw = parseInt(aw);
@@ -834,12 +863,12 @@
 		iframe.setAttribute("allowtransparency", "true");
 		iframe.className = 'mceEditorIframe';
 
-		if (tinyMCE.settings["auto_resize"])
+		if (tinyMCE.settings.auto_resize)
 			iframe.setAttribute("scrolling", "no");
 
 		// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
 		if (tinyMCE.isRealIE)
-			iframe.setAttribute("src", this.settings['default_document']);
+			iframe.setAttribute("src", this.settings.default_document);
 
 		iframe.style.width = aw;
 		iframe.style.height = ah;
@@ -861,10 +890,8 @@
 	},
 
 	setupContent : function(editor_id) {
-		var inst = tinyMCE.instances[editor_id], i;
-		var doc = inst.getDoc();
-		var head = doc.getElementsByTagName('head').item(0);
-		var content = inst.startContent;
+		var inst = tinyMCE.instances[editor_id], i, doc = inst.getDoc(), head = doc.getElementsByTagName('head').item(0);
+		var content = inst.startContent, contentElement, body;
 
 		// HTML values get XML encoded in strict mode
 		if (tinyMCE.settings.strict_loading_mode) {
@@ -886,14 +913,15 @@
 			return;
 		}
 
-		if (!head) {
+		// Wait for it to load
+		if (!head || !doc.body) {
 			window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 10);
 			return;
 		}
 
 		// Import theme specific content CSS the user specific
-		tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/themes/" + inst.settings['theme'] + "/css/editor_content.css");
-		tinyMCE.importCSS(inst.getDoc(), inst.settings['content_css']);
+		tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/themes/" + inst.settings.theme + "/css/editor_content.css");
+		tinyMCE.importCSS(inst.getDoc(), inst.settings.content_css);
 		tinyMCE.dispatchCallback(inst, 'init_instance_callback', 'initInstance', inst);
 
 		// Setup keyboard shortcuts
@@ -921,20 +949,20 @@
 		if (tinyMCE.getParam("convert_fonts_to_spans"))
 			inst.getBody().setAttribute('id', 'mceSpanFonts');
 
-		if (tinyMCE.settings['nowrap'])
+		if (tinyMCE.settings.nowrap)
 			doc.body.style.whiteSpace = "nowrap";
 
-		doc.body.dir = this.settings['directionality'];
+		doc.body.dir = this.settings.directionality;
 		doc.editorId = editor_id;
 
 		// Add on document element in Mozilla
 		if (!tinyMCE.isIE)
 			doc.documentElement.editorId = editor_id;
 
-		inst.setBaseHREF(tinyMCE.settings['base_href']);
+		inst.setBaseHREF(tinyMCE.settings.base_href);
 
 		// Replace new line characters to BRs
-		if (tinyMCE.settings['convert_newlines_to_brs']) {
+		if (tinyMCE.settings.convert_newlines_to_brs) {
 			content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
 			content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
 			content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
@@ -951,10 +979,10 @@
 			// Ugly!!!
 			window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500);
 
-			if (tinyMCE.settings["force_br_newlines"])
+			if (tinyMCE.settings.force_br_newlines)
 				doc.styleSheets[0].addRule("p", "margin: 0;");
 
-			var body = inst.getBody();
+			body = inst.getBody();
 			body.editorId = editor_id;
 		}
 
@@ -962,27 +990,27 @@
 
 		// Fix for bug #958637
 		if (!tinyMCE.isIE) {
-			var contentElement = inst.getDoc().createElement("body");
-			var doc = inst.getDoc();
+			contentElement = inst.getDoc().createElement("body");
+			doc = inst.getDoc();
 
 			contentElement.innerHTML = content;
 
-			// Remove weridness!
-			if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt'])
-				content = content.replace(new RegExp('&lt;&gt;', 'g'), "");
-
-			if (tinyMCE.settings['cleanup_on_startup'])
+			if (tinyMCE.settings.cleanup_on_startup)
 				tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement));
 			else
 				tinyMCE.setInnerHTML(inst.getBody(), content);
 
 			tinyMCE.convertAllRelativeURLs(inst.getBody());
 		} else {
-			if (tinyMCE.settings['cleanup_on_startup']) {
+			if (tinyMCE.settings.cleanup_on_startup) {
 				tinyMCE._setHTML(inst.getDoc(), content);
 
 				// Produces permission denied error in MSIE 5.5
-				eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}');
+				try {
+					tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));
+				} catch(e) {
+					// Ignore
+				}
 			} else
 				tinyMCE._setHTML(inst.getDoc(), content);
 		}
@@ -990,7 +1018,7 @@
 		// Fix for bug #957681
 		//inst.getDoc().designMode = inst.getDoc().designMode;
 
-		tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual'], inst);
+		tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings.visual, inst);
 		tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc());
 
 		// Re-add design mode on mozilla
@@ -1106,7 +1134,7 @@
 	},
 
 	handleEvent : function(e) {
-		var inst = tinyMCE.selectedInstance;
+		var inst = tinyMCE.selectedInstance, i, elm, keys;
 
 		// Remove odd, error
 		if (typeof(tinyMCE) == "undefined")
@@ -1149,19 +1177,17 @@
 					}
 				}
 
-				window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();", 1);
+				window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings.base_href);tinyMCE._resetIframeHeight();", 1);
 				return;
 
 			case "submit":
-				tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target);
-				tinyMCE.triggerSave();
-				tinyMCE.isNotDirty = true;
+				tinyMCE.formSubmit(tinyMCE.isMSIE ? window.event.srcElement : e.target);
 				return;
 
 			case "reset":
 				var formObj = tinyMCE.isIE ? window.event.srcElement : e.target;
 
-				for (var i=0; i<document.forms.length; i++) {
+				for (i=0; i<document.forms.length; i++) {
 					if (document.forms[i] == formObj)
 						window.setTimeout('tinyMCE.resetForm(' + i + ');', 10);
 				}
@@ -1183,7 +1209,7 @@
 					tinyMCE.selectedInstance.switchSettings();
 
 				// Insert P element
-				if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && e.keyCode == 13 && !e.shiftKey) {
+				if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings.force_p_newlines && e.keyCode == 13 && !e.shiftKey) {
 					// Insert P element instead of BR
 					if (TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance, e)) {
 						// Cancel event
@@ -1193,7 +1219,7 @@
 				}
 
 				// Handle backspace
-				if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
+				if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings.force_p_newlines && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
 					// Insert P element instead of BR
 					if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
 						// Cancel event
@@ -1203,7 +1229,7 @@
 				}
 
 				// Return key pressed
-				if (tinyMCE.isIE && tinyMCE.settings['force_br_newlines'] && e.keyCode == 13) {
+				if (tinyMCE.isIE && tinyMCE.settings.force_br_newlines && e.keyCode == 13) {
 					if (e.target.editorId)
 						tinyMCE.instances[e.target.editorId].select();
 
@@ -1238,7 +1264,6 @@
 				}
 
 				return false;
-			break;
 
 			case "keyup":
 			case "keydown":
@@ -1248,16 +1273,21 @@
 				if (inst && inst.handleShortcut(e))
 					return false;
 
+				inst._fixRootBlocks();
+
+				if (inst.settings.remove_trailing_nbsp)
+					inst._fixTrailingNbsp();
+
 				if (e.target.editorId)
 					tinyMCE.instances[e.target.editorId].select();
 
 				if (tinyMCE.selectedInstance)
 					tinyMCE.selectedInstance.switchSettings();
 
-				var inst = tinyMCE.selectedInstance;
+				inst = tinyMCE.selectedInstance;
 
 				// Handle backspace
-				if (tinyMCE.isGecko && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
+				if (tinyMCE.isGecko && tinyMCE.settings.force_p_newlines && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
 					// Insert P element instead of BR
 					if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
 						// Cancel event
@@ -1269,14 +1299,14 @@
 
 				tinyMCE.selectedElement = null;
 				tinyMCE.selectedNode = null;
-				var elm = tinyMCE.selectedInstance.getFocusElement();
+				elm = tinyMCE.selectedInstance.getFocusElement();
 				tinyMCE.linkElement = tinyMCE.getParentElement(elm, "a");
 				tinyMCE.imgElement = tinyMCE.getParentElement(elm, "img");
 				tinyMCE.selectedElement = elm;
 
 				// Update visualaids on tabs
 				if (tinyMCE.isGecko && e.type == "keyup" && e.keyCode == 9)
-					tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
+					tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings.visual, tinyMCE.selectedInstance);
 
 				// Fix empty elements on return/enter, check where enter occured
 				if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13)
@@ -1284,7 +1314,7 @@
 
 				// Fix empty elements on return/enter
 				if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) {
-					var elm = tinyMCE.enterKeyElement;
+					elm = tinyMCE.enterKeyElement;
 					if (elm) {
 						var re = new RegExp('^HR|IMG|BR$','g'); // Skip these
 						var dre = new RegExp('^H[1-6]$','g'); // Add double on these
@@ -1299,9 +1329,9 @@
 				}
 
 				// Check if it's a position key
-				var keys = tinyMCE.posKeyCodes;
+				keys = tinyMCE.posKeyCodes;
 				var posKey = false;
-				for (var i=0; i<keys.length; i++) {
+				for (i=0; i<keys.length; i++) {
 					if (keys[i] == e.keyCode) {
 						posKey = true;
 						break;
@@ -1309,10 +1339,10 @@
 				}
 
 				// MSIE custom key handling
-				if (tinyMCE.isIE && tinyMCE.settings['custom_undo_redo']) {
-					var keys = new Array(8,46); // Backspace,Delete
+				if (tinyMCE.isIE && tinyMCE.settings.custom_undo_redo) {
+					keys = [8, 46]; // Backspace,Delete
 
-					for (var i=0; i<keys.length; i++) {
+					for (i=0; i<keys.length; i++) {
 						if (keys[i] == e.keyCode) {
 							if (e.type == "keyup")
 								tinyMCE.triggerNodeChange(false);
@@ -1369,7 +1399,7 @@
 					if (!tinyMCE.isInstance(tinyMCE.instances[instanceName]))
 						continue;
 
-					var inst = tinyMCE.instances[instanceName];
+					inst = tinyMCE.instances[instanceName];
 
 					// Reset design mode if lost (on everything just in case)
 					inst.autoResetDesignMode();
@@ -1403,7 +1433,6 @@
 					tinyMCE.instances[e.target.editorId].select();
 
 				return false;
-			break;
 		}
 	},
 
@@ -1429,12 +1458,12 @@
 			// Tiled button
 			x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
 			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceTiledButton mceButtonNormal" target="_self">';
-			h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
+			h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" alt="{$'+lang+'}" title="{$' + lang + '}" />';
 			h += '</a>';
 		} else {
 			// Normal button
 			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceButtonNormal" target="_self">';
-			h += '<img src="' + img + '" title="{$' + lang + '}" />';
+			h += '<img src="' + img + '" alt="{$'+lang+'}" title="{$' + lang + '}" />';
 			h += '</a>';
 		}
 
@@ -1500,15 +1529,48 @@
 			this.buttonMap[a[i]] = i;
 	},
 
+	formSubmit : function(f, p) {
+		var n, inst, found = false;
+
+		if (f.form)
+			f = f.form;
+
+		// Is it a form that has a TinyMCE instance
+		if (tinyMCE.getParam('save_on_tinymce_forms')) {
+			for (n in tinyMCE.instances) {
+				inst = tinyMCE.instances[n];
+
+				if (!tinyMCE.isInstance(inst))
+					continue;
+
+				if (inst.formElement) {
+					if (f == inst.formElement.form) {
+						found = true;
+						inst.isNotDirty = true;
+					}
+				}
+			}
+		} else
+			found  = true;
+
+		// Is valid
+		if (found) {
+			tinyMCE.removeTinyMCEFormElements(f);
+			tinyMCE.triggerSave();
+		}
+
+		// Is it patched
+		if (f.mceOldSubmit && p)
+			f.mceOldSubmit();
+	},
+
 	submitPatch : function() {
-		tinyMCE.removeTinyMCEFormElements(this);
-		tinyMCE.triggerSave();
-		tinyMCE.isNotDirty = true;
-		this.mceOldSubmit();
+		tinyMCE.formSubmit(this, true);
 	},
 
 	onLoad : function() {
-		var r;
+		var r, i, c, mode, trigger, elements, element, settings, elementId, elm;
+		var selector, deselector, elementRefAr, form;
 
 		// Wait for everything to be loaded first
 		if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) {
@@ -1527,7 +1589,7 @@
 		// IE produces JS error if TinyMCE is placed in a frame
 		// It seems to have something to do with the selection not beeing
 		// correctly initialized in IE so this hack solves the problem
-		if (tinyMCE.isRealIE && document.body) {
+		if (tinyMCE.isRealIE && document.body && window.location.href != window.top.location.href) {
 			r = document.body.createTextRange();
 			r.collapse(true);
 			r.select();
@@ -1535,24 +1597,24 @@
 
 		tinyMCE.dispatchCallback(null, 'onpageload', 'onPageLoad');
 
-		for (var c=0; c<tinyMCE.configs.length; c++) {
+		for (c=0; c<tinyMCE.configs.length; c++) {
 			tinyMCE.settings = tinyMCE.configs[c];
 
-			var selector = tinyMCE.getParam("editor_selector");
-			var deselector = tinyMCE.getParam("editor_deselector");
-			var elementRefAr = new Array();
+			selector = tinyMCE.getParam("editor_selector");
+			deselector = tinyMCE.getParam("editor_deselector");
+			elementRefAr = [];
 
 			// Add submit triggers
-			if (document.forms && tinyMCE.settings['add_form_submit_trigger'] && !tinyMCE.submitTriggers) {
-				for (var i=0; i<document.forms.length; i++) {
-					var form = document.forms[i];
+			if (document.forms && tinyMCE.settings.add_form_submit_trigger && !tinyMCE.submitTriggers) {
+				for (i=0; i<document.forms.length; i++) {
+					form = document.forms[i];
 
 					tinyMCE.addEvent(form, "submit", TinyMCE_Engine.prototype.handleEvent);
 					tinyMCE.addEvent(form, "reset", TinyMCE_Engine.prototype.handleEvent);
 					tinyMCE.submitTriggers = true; // Do it only once
 
 					// Patch the form.submit function
-					if (tinyMCE.settings['submit_patch']) {
+					if (tinyMCE.settings.submit_patch) {
 						try {
 							form.mceOldSubmit = form.submit;
 							form.submit = TinyMCE_Engine.prototype.submitPatch;
@@ -1564,14 +1626,14 @@
 			}
 
 			// Add editor instances based on mode
-			var mode = tinyMCE.settings['mode'];
+			mode = tinyMCE.settings.mode;
 			switch (mode) {
 				case "exact":
-					var elements = tinyMCE.getParam('elements', '', true, ',');
+					elements = tinyMCE.getParam('elements', '', true, ',');
 
-					for (var i=0; i<elements.length; i++) {
-						var element = tinyMCE._getElementById(elements[i]);
-						var trigger = element ? element.getAttribute(tinyMCE.settings['textarea_trigger']) : "";
+					for (i=0; i<elements.length; i++) {
+						element = tinyMCE._getElementById(elements[i]);
+						trigger = element ? element.getAttribute(tinyMCE.settings.textarea_trigger) : "";
 
 						if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(element, "class")))
 							continue;
@@ -1579,31 +1641,29 @@
 						if (trigger == "false")
 							continue;
 
-						if ((tinyMCE.settings['ask'] || tinyMCE.settings['convert_on_click']) && element) {
+						if ((tinyMCE.settings.ask || tinyMCE.settings.convert_on_click) && element) {
 							elementRefAr[elementRefAr.length] = element;
 							continue;
 						}
 
 						if (element)
 							tinyMCE.addMCEControl(element, elements[i]);
-						else if (tinyMCE.settings['debug'])
-							alert("Error: Could not find element by id or name: " + elements[i]);
 					}
 				break;
 
 				case "specific_textareas":
 				case "textareas":
-					var nodeList = document.getElementsByTagName("textarea");
+					elements = document.getElementsByTagName("textarea");
 
-					for (var i=0; i<nodeList.length; i++) {
-						var elm = nodeList.item(i);
-						var trigger = elm.getAttribute(tinyMCE.settings['textarea_trigger']);
+					for (i=0; i<elements.length; i++) {
+						elm = elements.item(i);
+						trigger = elm.getAttribute(tinyMCE.settings.textarea_trigger);
 
-						if (selector != '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
+						if (selector !== '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
 							continue;
 
-						if (selector != '')
-							trigger = selector != "" ? "true" : "";
+						if (selector !== '')
+							trigger = selector !== '' ? "true" : "";
 
 						if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
 							continue;
@@ -1614,14 +1674,14 @@
 				break;
 			}
 
-			for (var i=0; i<elementRefAr.length; i++) {
-				var element = elementRefAr[i];
-				var elementId = element.name ? element.name : element.id;
+			for (i=0; i<elementRefAr.length; i++) {
+				element = elementRefAr[i];
+				elementId = element.name ? element.name : element.id;
 
-				if (tinyMCE.settings['ask'] || tinyMCE.settings['convert_on_click']) {
+				if (tinyMCE.settings.ask || tinyMCE.settings.convert_on_click) {
 					// Focus breaks in Mozilla
 					if (tinyMCE.isGecko) {
-						var settings = tinyMCE.settings;
+						settings = tinyMCE.settings;
 
 						tinyMCE.addEvent(element, "focus", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
 
@@ -1629,7 +1689,7 @@
 							tinyMCE.addEvent(element, "click", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
 						// tinyMCE.addEvent(element, "mouseover", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
 					} else {
-						var settings = tinyMCE.settings;
+						settings = tinyMCE.settings;
 
 						tinyMCE.addEvent(element, "focus", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });
 						tinyMCE.addEvent(element, "click", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });
@@ -1640,9 +1700,9 @@
 			}
 
 			// Handle auto focus
-			if (tinyMCE.settings['auto_focus']) {
+			if (tinyMCE.settings.auto_focus) {
 				window.setTimeout(function () {
-					var inst = tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);
+					var inst = tinyMCE.getInstanceById(tinyMCE.settings.auto_focus);
 					inst.selection.selectNode(inst.getBody(), true, true);
 					inst.contentWindow.focus();
 				}, 100);
@@ -1657,7 +1717,7 @@
 	},
 
 	getParam : function(name, default_value, strip_whitespace, split_chr) {
-		var value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
+		var i, outArray, value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
 
 		// Fix bool values
 		if (value == "true" || value == "false")
@@ -1668,10 +1728,10 @@
 
 		if (typeof(split_chr) != "undefined" && split_chr != null) {
 			value = value.split(split_chr);
-			var outArray = new Array();
+			outArray = [];
 
-			for (var i=0; i<value.length; i++) {
-				if (value[i] && value[i] != "")
+			for (i=0; i<value.length; i++) {
+				if (value[i] && value[i] !== '')
 					outArray[outArray.length] = value[i];
 			}
 
@@ -1700,21 +1760,20 @@
 
 		e.innerHTML = s;
 
-		return e.firstChild.nodeValue;
+		return !e.firstChild ? s : e.firstChild.nodeValue;
 	},
 
 	addToLang : function(prefix, ar) {
-		for (var key in ar) {
-			if (typeof(ar[key]) == 'function')
+		var k;
+
+		for (k in ar) {
+			if (typeof(ar[k]) == 'function')
 				continue;
 
-			tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = ar[key];
+			tinyMCELang[(k.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix !== '' ? (prefix + "_") : '') + k] = ar[k];
 		}
 
 		this.loadNextScript();
-
-	//	for (var key in ar)
-	//		tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = "|" + ar[key] + "|";
 	},
 
 	triggerNodeChange : function(focus, setup_content) {
@@ -1743,7 +1802,7 @@
 			if (tinyMCE.selectedElement)
 				anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (st && st.length > 0);
 
-			if (tinyMCE.settings['custom_undo_redo']) {
+			if (tinyMCE.settings.custom_undo_redo) {
 				undoIndex = inst.undoRedo.undoIndex;
 				undoLevels = inst.undoRedo.undoLevels.length;
 			}
@@ -1756,15 +1815,15 @@
 	},
 
 	_customCleanup : function(inst, type, content) {
-		var pl, po, i;
+		var pl, po, i, customCleanup;
 
 		// Call custom cleanup
-		var customCleanup = tinyMCE.settings['cleanup_callback'];
-		if (customCleanup != "" && eval("typeof(" + customCleanup + ")") != "undefined")
-			content = eval(customCleanup + "(type, content, inst);");
+		customCleanup = tinyMCE.settings.cleanup_callback;
+		if (customCleanup != '')
+			content = tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback, window)(type, content, inst);
 
 		// Trigger theme cleanup
-		po = tinyMCE.themes[tinyMCE.settings['theme']];
+		po = tinyMCE.themes[tinyMCE.settings.theme];
 		if (po && po.cleanup)
 			content = po.cleanup(type, content, inst);
 
@@ -1789,9 +1848,9 @@
 
 	importThemeLanguagePack : function(name) {
 		if (typeof(name) == "undefined")
-			name = tinyMCE.settings['theme'];
+			name = tinyMCE.settings.theme;
 
-		tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings['language'] + '.js');
+		tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings.language + '.js');
 	},
 
 	importPluginLanguagePack : function(name) {
@@ -1800,16 +1859,16 @@
 		if (this.plugins[name])
 			b = this.plugins[name].baseURL;
 
-		tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings['language'] +  '.js');
+		tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings.language +  '.js');
 	},
 
-	applyTemplate : function(h, as) {
+	applyTemplate : function(h, ag) {
 		return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}', 'gi'), function(m, s) {
 			if (s.indexOf('lang_') == 0 && tinyMCELang[s])
 				return tinyMCELang[s];
 
-			if (as && as[s])
-				return as[s];
+			if (ag && ag[s])
+				return ag[s];
 
 			if (tinyMCE.settings[s])
 				return tinyMCE.settings[s];
@@ -1826,20 +1885,20 @@
 	},
 
 	openWindow : function(template, args) {
-		var html, width, height, x, y, resizable, scrollbars, url;
+		var html, width, height, x, y, resizable, scrollbars, url, name, win, modal, features;
 
 		args = !args ? {} : args;
 
-		args['mce_template_file'] = template['file'];
-		args['mce_width'] = template['width'];
-		args['mce_height'] = template['height'];
+		args.mce_template_file = template.file;
+		args.mce_width = template.width;
+		args.mce_height = template.height;
 		tinyMCE.windowArgs = args;
 
-		html = template['html'];
-		if (!(width = parseInt(template['width'])))
+		html = template.html;
+		if (!(width = parseInt(template.width)))
 			width = 320;
 
-		if (!(height = parseInt(template['height'])))
+		if (!(height = parseInt(template.height)))
 			height = 200;
 
 		// Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!!
@@ -1851,16 +1910,16 @@
 		x = parseInt(screen.width / 2.0) - (width / 2.0);
 		y = parseInt(screen.height / 2.0) - (height / 2.0);
 
-		resizable = (args && args['resizable']) ? args['resizable'] : "no";
-		scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";
+		resizable = (args && args.resizable) ? args.resizable : "no";
+		scrollbars = (args && args.scrollbars) ? args.scrollbars : "no";
 
-		if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)
-			url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];
+		if (template.file.charAt(0) != '/' && template.file.indexOf('://') == -1)
+			url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template.file;
 		else
-			url = template['file'];
+			url = template.file;
 
 		// Replace all args as variables in URL
-		for (var name in args) {
+		for (name in args) {
 			if (typeof(args[name]) == 'function')
 				continue;
 
@@ -1868,12 +1927,12 @@
 		}
 
 		if (html) {
-			html = tinyMCE.replaceVar(html, "css", this.settings['popups_css']);
+			html = tinyMCE.replaceVar(html, "css", this.settings.popups_css);
 			html = tinyMCE.applyTemplate(html, args);
 
-			var win = window.open("", "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,minimizable=" + resizable + ",modal=yes,width=" + width + ",height=" + height + ",resizable=" + resizable);
+			win = window.open("", "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,minimizable=" + resizable + ",modal=yes,width=" + width + ",height=" + height + ",resizable=" + resizable);
 			if (win == null) {
-				alert(tinyMCELang['lang_popup_blocked']);
+				alert(tinyMCELang.lang_popup_blocked);
 				return;
 			}
 
@@ -1882,34 +1941,35 @@
 			win.resizeTo(width, height);
 			win.focus();
 		} else {
-			if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") {
+			if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings.dialog_type == "modal") {
 				height += 10;
 
-				var features = "resizable:" + resizable 
-					+ ";scroll:"
-					+ scrollbars + ";status:yes;center:yes;help:no;dialogWidth:"
-					+ width + "px;dialogHeight:" + height + "px;";
+				features = "resizable:" + resizable + ";scroll:" + scrollbars + ";status:yes;center:yes;help:no;dialogWidth:" + width + "px;dialogHeight:" + height + "px;";
 
 				window.showModalDialog(url, window, features);
 			} else {
-				var modal = (resizable == "yes") ? "no" : "yes";
+				modal = (resizable == "yes") ? "no" : "yes";
 
 				if (tinyMCE.isGecko && tinyMCE.isMac)
 					modal = "no";
 
-				if (template['close_previous'] != "no")
+				if (template.close_previous != "no")
 					try {tinyMCE.lastWindow.close();} catch (ex) {}
 
-				var win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable);
+				win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable);
 				if (win == null) {
-					alert(tinyMCELang['lang_popup_blocked']);
+					alert(tinyMCELang.lang_popup_blocked);
 					return;
 				}
 
-				if (template['close_previous'] != "no")
+				if (template.close_previous != "no")
 					tinyMCE.lastWindow = win;
 
-				eval('try { win.resizeTo(width, height); } catch(e) { }');
+				try {
+					win.resizeTo(width, height);
+				} catch(e) {
+					// Ignore
+				}
 
 				// Make it bigger if statusbar is forced
 				if (tinyMCE.isGecko) {
@@ -1927,19 +1987,19 @@
 	},
 
 	getVisualAidClass : function(class_name, state) {
-		var aidClass = tinyMCE.settings['visual_table_class'];
+		var i, classNames, ar, className, aidClass = tinyMCE.settings.visual_table_class;
 
 		if (typeof(state) == "undefined")
-			state = tinyMCE.settings['visual'];
+			state = tinyMCE.settings.visual;
 
 		// Split
-		var classNames = new Array();
-		var ar = class_name.split(' ');
-		for (var i=0; i<ar.length; i++) {
+		classNames = [];
+		ar = class_name.split(' ');
+		for (i=0; i<ar.length; i++) {
 			if (ar[i] == aidClass)
 				ar[i] = "";
 
-			if (ar[i] != "")
+			if (ar[i] !== '')
 				classNames[classNames.length] = ar[i];
 		}
 
@@ -1947,8 +2007,8 @@
 			classNames[classNames.length] = aidClass;
 
 		// Glue
-		var className = "";
-		for (var i=0; i<classNames.length; i++) {
+		className = "";
+		for (i=0; i<classNames.length; i++) {
 			if (i > 0)
 				className += " ";
 
@@ -1959,30 +2019,32 @@
 	},
 
 	handleVisualAid : function(el, deep, state, inst, skip_dispatch) {
+		var i, x, y, tableElement, anchorName, oldW, oldH, bo, cn;
+
 		if (!el)
 			return;
 
 		if (!skip_dispatch)
 			tinyMCE.dispatchCallback(inst, 'handle_visual_aid_callback', 'handleVisualAid', el, deep, state, inst);
 
-		var tableElement = null;
+		tableElement = null;
 
 		switch (el.nodeName) {
 			case "TABLE":
-				var oldW = el.style.width;
-				var oldH = el.style.height;
-				var bo = tinyMCE.getAttrib(el, "border");
+				oldW = el.style.width;
+				oldH = el.style.height;
+				bo = tinyMCE.getAttrib(el, "border");
 
-				bo = bo == "" || bo == "0" ? true : false;
+				bo = bo == '' || bo == "0" ? true : false;
 
 				tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo));
 
 				el.style.width = oldW;
 				el.style.height = oldH;
 
-				for (var y=0; y<el.rows.length; y++) {
-					for (var x=0; x<el.rows[y].cells.length; x++) {
-						var cn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], "class"), state && bo);
+				for (y=0; y<el.rows.length; y++) {
+					for (x=0; x<el.rows[y].cells.length; x++) {
+						cn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], "class"), state && bo);
 						tinyMCE.setAttrib(el.rows[y].cells[x], "class", cn);
 					}
 				}
@@ -1990,56 +2052,23 @@
 				break;
 
 			case "A":
-				var anchorName = tinyMCE.getAttrib(el, "name");
+				anchorName = tinyMCE.getAttrib(el, "name");
 
-				if (anchorName != '' && state) {
+				if (anchorName !== '' && state) {
 					el.title = anchorName;
 					tinyMCE.addCSSClass(el, 'mceItemAnchor');
-				} else if (anchorName != '' && !state)
+				} else if (anchorName !== '' && !state)
 					el.className = '';
 
 				break;
 		}
 
 		if (deep && el.hasChildNodes()) {
-			for (var i=0; i<el.childNodes.length; i++)
+			for (i=0; i<el.childNodes.length; i++)
 				tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst, true);
 		}
 	},
 
-	/*
-	applyClassesToFonts : function(doc, size) {
-		var f = doc.getElementsByTagName("font");
-		for (var i=0; i<f.length; i++) {
-			var s = tinyMCE.getAttrib(f[i], "size");
-
-			if (s != "")
-				tinyMCE.setAttrib(f[i], 'class', "mceItemFont" + s);
-		}
-
-		if (typeof(size) != "undefined") {
-			var css = "";
-
-			for (var x=0; x<doc.styleSheets.length; x++) {
-				for (var i=0; i<doc.styleSheets[x].rules.length; i++) {
-					if (doc.styleSheets[x].rules[i].selectorText == '#mceSpanFonts .mceItemFont' + size) {
-						css = doc.styleSheets[x].rules[i].style.cssText;
-						break;
-					}
-				}
-
-				if (css != "")
-					break;
-			}
-
-			if (doc.styleSheets[0].rules[0].selectorText == "FONT")
-				doc.styleSheets[0].removeRule(0);
-
-			doc.styleSheets[0].addRule("FONT", css, 0);
-		}
-	},
-	*/
-
 	fixGeckoBaseHREFBug : function(m, e, h) {
 		var xsrc, xhref;
 
@@ -2059,9 +2088,9 @@
 					xsrc = tinyMCE.getAttrib(n, "mce_tsrc");
 					xhref = tinyMCE.getAttrib(n, "mce_thref");
 
-					if (xsrc != "") {
+					if (xsrc !== '') {
 						try {
-							n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc);
+							n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, xsrc);
 						} catch (e) {
 							// Ignore, Firefox cast exception if local file wasn't found
 						}
@@ -2069,9 +2098,9 @@
 						n.removeAttribute("mce_tsrc");
 					}
 
-					if (xhref != "") {
+					if (xhref !== '') {
 						try {
-							n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref);
+							n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, xhref);
 						} catch (e) {
 							// Ignore, Firefox cast exception if local file wasn't found
 						}
@@ -2098,6 +2127,8 @@
 	},
 
 	_setHTML : function(doc, html_content) {
+		var i, html, paras, node;
+
 		// Force closed anchors open
 		//html_content = html_content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
 
@@ -2112,11 +2143,12 @@
 		}
 
 		// Content duplication bug fix
-		if (tinyMCE.isIE && tinyMCE.settings['fix_content_duplication']) {
+		if (tinyMCE.isIE && tinyMCE.settings.fix_content_duplication) {
 			// Remove P elements in P elements
-			var paras = doc.getElementsByTagName("P");
-			for (var i=0; i<paras.length; i++) {
-				var node = paras[i];
+			paras = doc.getElementsByTagName("P");
+			for (i=0; i<paras.length; i++) {
+				node = paras[i];
+
 				while ((node = node.parentNode) != null) {
 					if (node.nodeName == "P")
 						node.outerHTML = node.innerHTML;
@@ -2124,26 +2156,8 @@
 			}
 
 			// Content duplication bug fix (Seems to be word crap)
-			var html = doc.body.innerHTML;
-/*
-			if (html.indexOf('="mso') != -1) {
-				for (var i=0; i<doc.body.all.length; i++) {
-					var el = doc.body.all[i];
-					el.removeAttribute("className","",0);
-					el.removeAttribute("style","",0);
-				}
+			html = doc.body.innerHTML;
 
-				html = doc.body.innerHTML;
-				html = tinyMCE.regexpReplace(html, "<o:p><\/o:p>", "<br />");
-				html = tinyMCE.regexpReplace(html, "<o:p>&nbsp;<\/o:p>", "");
-				html = tinyMCE.regexpReplace(html, "<st1:.*?>", "");
-				html = tinyMCE.regexpReplace(html, "<p><\/p>", "");
-				html = tinyMCE.regexpReplace(html, "<p><\/p>\r\n<p><\/p>", "");
-				html = tinyMCE.regexpReplace(html, "<p>&nbsp;<\/p>", "<br />");
-				html = tinyMCE.regexpReplace(html, "<p>\s*(<p>\s*)?", "<p>");
-				html = tinyMCE.regexpReplace(html, "<\/p>\s*(<\/p>\s*)?", "</p>");
-			}*/
-
 			// Always set the htmlText output
 			tinyMCE.setInnerHTML(doc.body, html);
 		}
@@ -2156,6 +2170,7 @@
 
 	getEditorId : function(form_element) {
 		var inst = this.getInstanceById(form_element);
+
 		if (!inst)
 			return null;
 
@@ -2163,25 +2178,27 @@
 	},
 
 	getInstanceById : function(editor_id) {
-		var inst = this.instances[editor_id];
+		var inst = this.instances[editor_id], n;
+
 		if (!inst) {
-			for (var n in tinyMCE.instances) {
-				var instance = tinyMCE.instances[n];
-				if (!tinyMCE.isInstance(instance))
+			for (n in tinyMCE.instances) {
+				inst = tinyMCE.instances[n];
+
+				if (!tinyMCE.isInstance(inst))
 					continue;
 
-				if (instance.formTargetElementId == editor_id) {
-					inst = instance;
-					break;
-				}
+				if (inst.formTargetElementId == editor_id)
+					return inst;
 			}
-		}
+		} else
+			return inst;
 
-		return inst;
+		return null;
 	},
 
 	queryInstanceCommandValue : function(editor_id, command) {
 		var inst = tinyMCE.getInstanceById(editor_id);
+
 		if (inst)
 			return inst.queryCommandValue(command);
 
@@ -2190,6 +2207,7 @@
 
 	queryInstanceCommandState : function(editor_id, command) {
 		var inst = tinyMCE.getInstanceById(editor_id);
+
 		if (inst)
 			return inst.queryCommandState(command);
 
@@ -2205,76 +2223,72 @@
 	},
 
 	getCSSClasses : function(editor_id, doc) {
-		var inst = tinyMCE.getInstanceById(editor_id);
+		var i, c, x, rule, styles, rules, csses, selectorText, inst = tinyMCE.getInstanceById(editor_id);
+		var cssClass, addClass, p;
 
+		if (!inst)
+			inst = tinyMCE.selectedInstance;
+
+		if (!inst)
+			return [];
+
+		if (!doc)
+			doc = inst.getDoc();
+
 		// Is cached, use that
 		if (inst && inst.cssClasses.length > 0)
 			return inst.cssClasses;
 
-		if (typeof(editor_id) == "undefined" && typeof(doc) == "undefined") {
-			var instance;
+		if (!doc)
+			return;
 
-			for (var instanceName in tinyMCE.instances) {
-				instance = tinyMCE.instances[instanceName];
-				if (!tinyMCE.isInstance(instance))
-					continue;
+		styles = doc.styleSheets;
 
-				break;
-			}
+		if (styles && styles.length > 0) {
+			for (x=0; x<styles.length; x++) {
+				csses = null;
 
-			doc = instance.getDoc();
-		}
+				try {
+					csses = tinyMCE.isIE ? doc.styleSheets(x).rules : styles[x].cssRules;
+				} catch(e) {
+					// Just ignore any errors I know this is ugly!!
+				}
+	
+				if (!csses)
+					return [];
 
-		if (typeof(doc) == "undefined") {
-			var instance = tinyMCE.getInstanceById(editor_id);
-			doc = instance.getDoc();
-		}
+				for (i=0; i<csses.length; i++) {
+					selectorText = csses[i].selectorText;
 
-		if (doc) {
-			var styles = doc.styleSheets;
+					// Can be multiple rules per selector
+					if (selectorText) {
+						rules = selectorText.split(',');
+						for (c=0; c<rules.length; c++) {
+							rule = rules[c];
 
-			if (styles && styles.length > 0) {
-				for (var x=0; x<styles.length; x++) {
-					var csses = null;
+							// Strip spaces between selectors
+							while (rule.indexOf(' ') == 0)
+								rule = rule.substring(1);
 
-					// Just ignore any errors
-					eval("try {var csses = tinyMCE.isIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}");
-					if (!csses)
-						return new Array();
+							// Invalid rule
+							if (rule.indexOf(' ') != -1 || rule.indexOf(':') != -1 || rule.indexOf('mceItem') != -1)
+								continue;
 
-					for (var i=0; i<csses.length; i++) {
-						var selectorText = csses[i].selectorText;
+							if (rule.indexOf(tinyMCE.settings.visual_table_class) != -1 || rule.indexOf('mceEditable') != -1 || rule.indexOf('mceNonEditable') != -1)
+								continue;
 
-						// Can be multiple rules per selector
-						if (selectorText) {
-							var rules = selectorText.split(',');
-							for (var c=0; c<rules.length; c++) {
-								var rule = rules[c];
+							// Is class rule
+							if (rule.indexOf('.') != -1) {
+								cssClass = rule.substring(rule.indexOf('.') + 1);
+								addClass = true;
 
-								// Strip spaces between selectors
-								while (rule.indexOf(' ') == 0)
-									rule = rule.substring(1);
+								for (p=0; p<inst.cssClasses.length && addClass; p++) {
+									if (inst.cssClasses[p] == cssClass)
+										addClass = false;
+								}
 
-								// Invalid rule
-								if (rule.indexOf(' ') != -1 || rule.indexOf(':') != -1 || rule.indexOf('mceItem') != -1)
-									continue;
-
-								if (rule.indexOf(tinyMCE.settings['visual_table_class']) != -1 || rule.indexOf('mceEditable') != -1 || rule.indexOf('mceNonEditable') != -1)
-									continue;
-
-								// Is class rule
-								if (rule.indexOf('.') != -1) {
-									var cssClass = rule.substring(rule.indexOf('.') + 1);
-									var addClass = true;
-
-									for (var p=0; p<inst.cssClasses.length && addClass; p++) {
-										if (inst.cssClasses[p] == cssClass)
-											addClass = false;
-									}
-
-									if (addClass)
-										inst.cssClasses[inst.cssClasses.length] = cssClass;
-								}
+								if (addClass)
+									inst.cssClasses[inst.cssClasses.length] = cssClass;
 							}
 						}
 					}
@@ -2286,13 +2300,16 @@
 	},
 
 	regexpReplace : function(in_str, reg_exp, replace_str, opts) {
+		var re;
+
 		if (in_str == null)
 			return in_str;
 
 		if (typeof(opts) == "undefined")
 			opts = 'g';
 
-		var re = new RegExp(reg_exp, opts);
+		re = new RegExp(reg_exp, opts);
+
 		return in_str.replace(re, replace_str);
 	},
 
@@ -2316,7 +2333,7 @@
 		for (n in l) {
 			o = l[n];
 
-			if (o.getControlHTML && (v = o.getControlHTML(c)) != '') {
+			if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') {
 				if (rtl)
 					return '<span dir="rtl">' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + '</span>';
 
@@ -2324,8 +2341,8 @@
 			}
 		}
 
-		o = tinyMCE.themes[tinyMCE.settings['theme']];
-		if (o.getControlHTML && (v = o.getControlHTML(c)) != '') {
+		o = tinyMCE.themes[tinyMCE.settings.theme];
+		if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') {
 			if (rtl)
 				return '<span dir="rtl">' + v + '</span>';
 
@@ -2361,7 +2378,7 @@
 
 		l = tinyMCE.getParam(p, '');
 
-		if (l != '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0)
+		if (l !== '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0)
 			return true;
 
 		if (ins != null) {
@@ -2384,8 +2401,20 @@
 		return false;
 	},
 
-	xmlEncode : function(s, skip_apos) {
-		return s ? ('' + s).replace(!skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe, function (c, b) {
+	resolveDots : function(s, o) {
+		var i;
+
+		if (typeof(s) == 'string') {
+			for (i=0, s=s.split('.'); i<s.length; i++)
+				o = o[s[i]];
+		} else
+			o = s;
+
+		return o;
+	},
+
+	xmlEncode : function(s) {
+		return s ? ('' + s).replace(this.xmlEncodeRe, function (c, b) {
 			switch (c) {
 				case '&':
 					return '&amp;';
@@ -2393,9 +2422,6 @@
 				case '"':
 					return '&quot;';
 
-				case '\'':
-					return '&#39;'; // &apos; is not working in MSIE
-
 				case '<':
 					return '&lt;';
 
@@ -2407,16 +2433,29 @@
 		}) : s;
 	},
 
+	add : function(c, m) {
+		var n;
+
+		for (n in m) {
+			if (m.hasOwnProperty(n))
+				c.prototype[n] = m[n];
+		}
+	},
+
 	extend : function(p, np) {
-		var o = {};
+		var o = {}, n;
 
 		o.parent = p;
 
-		for (n in p)
-			o[n] = p[n];
+		for (n in p) {
+			if (p.hasOwnProperty(n))
+				o[n] = p[n];
+		}
 
-		for (n in np)
-			o[n] = np[n];
+		for (n in np) {
+			if (np.hasOwnProperty(n))
+				o[n] = np[n];
+		}
 
 		return o;
 	},
@@ -2445,20 +2484,21 @@
 /* file:jscripts/tiny_mce/classes/TinyMCE_Control.class.js */
 
 function TinyMCE_Control(settings) {
-	var t, i, to, fu, p, x, fn, fu, pn, s = settings;
+	var t, i, tos, fu, p, x, fn, fu, pn, s = settings;
 
 	this.undoRedoLevel = true;
 	this.isTinyMCE_Control = true;
 
 	// Default settings
+	this.enabled = true;
 	this.settings = s;
-	this.settings['theme'] = tinyMCE.getParam("theme", "default");
-	this.settings['width'] = tinyMCE.getParam("width", -1);
-	this.settings['height'] = tinyMCE.getParam("height", -1);
+	this.settings.theme = tinyMCE.getParam("theme", "default");
+	this.settings.width = tinyMCE.getParam("width", -1);
+	this.settings.height = tinyMCE.getParam("height", -1);
 	this.selection = new TinyMCE_Selection(this);
 	this.undoRedo = new TinyMCE_UndoRedo(this);
 	this.cleanup = new TinyMCE_Cleanup();
-	this.shortcuts = new Array();
+	this.shortcuts = [];
 	this.hasMouseMoved = false;
 	this.foreColor = this.backColor = "#999999";
 	this.data = {};
@@ -2479,21 +2519,21 @@
 	});
 
 	// Wrap old theme
-	t = this.settings['theme'];
+	t = this.settings.theme;
 	if (!tinyMCE.hasTheme(t)) {
 		fn = tinyMCE.callbacks;
-		to = {};
+		tos = {};
 
 		for (i=0; i<fn.length; i++) {
 			if ((fu = window['TinyMCE_' + t + "_" + fn[i]]))
-				to[fn[i]] = fu;
+				tos[fn[i]] = fu;
 		}
 
-		tinyMCE.addTheme(t, to);
+		tinyMCE.addTheme(t, tos);
 	}
 
 	// Wrap old plugins
-	this.plugins = new Array();
+	this.plugins = [];
 	p = tinyMCE.getParam('plugins', '', true, ',');
 	if (p.length > 0) {
 		for (i=0; i<p.length; i++) {
@@ -2504,14 +2544,14 @@
 
 			if (!tinyMCE.hasPlugin(pn)) {
 				fn = tinyMCE.callbacks;
-				to = {};
+				tos = {};
 
 				for (x=0; x<fn.length; x++) {
 					if ((fu = window['TinyMCE_' + pn + "_" + fn[x]]))
-						to[fn[x]] = fu;
+						tos[fn[x]] = fu;
 				}
 
-				tinyMCE.addPlugin(pn, to);
+				tinyMCE.addPlugin(pn, tos);
 			}
 
 			this.plugins[this.plugins.length] = pn; 
@@ -2573,9 +2613,9 @@
 	},
 
 	switchSettings : function() {
-		if (tinyMCE.configs.length > 1 && tinyMCE.currentConfig != this.settings['index']) {
+		if (tinyMCE.configs.length > 1 && tinyMCE.currentConfig != this.settings.index) {
 			tinyMCE.settings = this.settings;
-			tinyMCE.currentConfig = this.settings['index'];
+			tinyMCE.currentConfig = this.settings.index;
 		}
 	},
 
@@ -2709,10 +2749,12 @@
 
 	isDirty : function() {
 		// Is content modified and not in a submit procedure
-		return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;
+		return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !this.isNotDirty;
 	},
 
 	_mergeElements : function(scmd, pa, ch, override) {
+		var st, stc, className, n;
+
 		if (scmd == "removeformat") {
 			pa.className = "";
 			pa.style.cssText = "";
@@ -2721,22 +2763,22 @@
 			return;
 		}
 
-		var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style"));
-		var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
-		var className = tinyMCE.getAttrib(pa, "class");
+		st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style"));
+		stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
+		className = tinyMCE.getAttrib(pa, "class");
 
 		// Removed class adding due to bug #1478272
 		className = tinyMCE.getAttrib(ch, "class");
 
 		if (override) {
-			for (var n in st) {
+			for (n in st) {
 				if (typeof(st[n]) == 'function')
 					continue;
 
 				stc[n] = st[n];
 			}
 		} else {
-			for (var n in stc) {
+			for (n in stc) {
 				if (typeof(stc[n]) == 'function')
 					continue;
 
@@ -2752,6 +2794,55 @@
 		ch.removeAttribute("style");
 	},
 
+	_fixRootBlocks : function() {
+		var rb, b, ne, be, nx, bm;
+
+		rb = tinyMCE.getParam('forced_root_block');
+		if (!rb)
+			return;
+
+		b = this.getBody();
+		ne = b.firstChild;
+
+		while (ne) {
+			nx = ne.nextSibling;
+
+			// If text node or inline element wrap it in a block element
+			if ((ne.nodeType == 3 && ne.nodeValue.replace(/\s+/g, '') != '') || (ne.nodeType == 1 && !tinyMCE.blockRegExp.test(ne.nodeName))) {
+				if (!bm)
+					bm = this.selection.getBookmark();
+
+				if (!be) {
+					be = this.getDoc().createElement(rb);
+					be.appendChild(ne.cloneNode(true));
+					b.replaceChild(be, ne);
+				} else {
+					be.appendChild(ne.cloneNode(true));
+					b.removeChild(ne);
+				}
+			} else
+				be = null;
+
+			ne = nx;
+		}
+
+		if (bm)
+			this.selection.moveToBookmark(bm);
+	},
+
+	_fixTrailingNbsp : function() {
+		var s = this.selection, e = s.getFocusElement(), bm, v;
+
+		if (e && tinyMCE.blockRegExp.test(e.nodeName) && e.firstChild) {
+			v = e.firstChild.nodeValue;
+
+			if (v && v.length > 1 && /(^\u00a0|\u00a0$)/.test(v)) {
+				e.firstChild.nodeValue = v.replace(/(^\u00a0|\u00a0$)/, '');
+				s.selectNode(e.firstChild, true, false, false); // Select and collapse
+			}
+		}
+	},
+
 	_setUseCSS : function(b) {
 		var d = this.getDoc();
 
@@ -2766,7 +2857,7 @@
 	},
 
 	execCommand : function(command, user_interface, value) {
-		var doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement();
+		var i, x, z, align, img, div, doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement();
 
 		// Is not a undo specific command
 		if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command))
@@ -2789,18 +2880,19 @@
 
 		// Fix align on images
 		if (focusElm && focusElm.nodeName == "IMG") {
-			var align = focusElm.getAttribute('align');
-			var img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm;
+			align = focusElm.getAttribute('align');
+			img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm;
 
 			switch (command) {
 				case "JustifyLeft":
-					if (align == 'left')
+					if (align == 'left') {
+						img.setAttribute('align', ''); // Needed for IE
 						img.removeAttribute('align');
-					else
+					} else
 						img.setAttribute('align', 'left');
 
 					// Remove the div
-					var div = focusElm.parentNode;
+					div = focusElm.parentNode;
 					if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
 						div.parentNode.replaceChild(img, div);
 
@@ -2810,17 +2902,18 @@
 					return;
 
 				case "JustifyCenter":
+					img.setAttribute('align', ''); // Needed for IE
 					img.removeAttribute('align');
 
 					// Is centered
-					var div = tinyMCE.getParentElement(focusElm, "div");
+					div = tinyMCE.getParentElement(focusElm, "div");
 					if (div && div.style.textAlign == "center") {
 						// Remove div
 						if (div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
 							div.parentNode.replaceChild(img, div);
 					} else {
 						// Add div
-						var div = this.getDoc().createElement("div");
+						div = this.getDoc().createElement("div");
 						div.style.textAlign = 'center';
 						div.appendChild(img);
 						focusElm.parentNode.replaceChild(div, focusElm);
@@ -2832,13 +2925,14 @@
 					return;
 
 				case "JustifyRight":
-					if (align == 'right')
+					if (align == 'right') {
+						img.setAttribute('align', ''); // Needed for IE
 						img.removeAttribute('align');
-					else
+					} else
 						img.setAttribute('align', 'right');
 
 					// Remove the div
-					var div = focusElm.parentNode;
+					div = focusElm.parentNode;
 					if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
 						div.parentNode.replaceChild(img, div);
 
@@ -2849,7 +2943,7 @@
 			}
 		}
 
-		if (tinyMCE.settings['force_br_newlines']) {
+		if (tinyMCE.settings.force_br_newlines) {
 			var alignValue = "";
 
 			if (doc.selection.type != "Control") {
@@ -2871,7 +2965,7 @@
 							break;
 				}
 
-				if (alignValue != "") {
+				if (alignValue !== '') {
 					var rng = doc.selection.createRange();
 
 					if ((divElm = tinyMCE.getParentElement(rng.parentElement(), "div")) != null)
@@ -2890,6 +2984,22 @@
 				this.repaint();
 				return true;
 
+			case "JustifyLeft":
+			case "JustifyCenter":
+			case "JustifyFull":
+			case "JustifyRight":
+				var el = tinyMCE.getParentNode(focusElm, function(n) {return tinyMCE.getAttrib(n, 'align');});
+
+				if (el) {
+					el.setAttribute('align', ''); // Needed for IE
+					el.removeAttribute('align');
+				} else
+					this.getDoc().execCommand(command, user_interface, value);
+
+				tinyMCE.triggerNodeChange();
+
+				return true;
+
 			case "unlink":
 				// Unlink if caret is inside link
 				if (tinyMCE.isGecko && this.getSel().isCollapsed) {
@@ -2925,7 +3035,7 @@
 				break;
 
 			case "FormatBlock":
-				if (value == null || value == "") {
+				if (value == null || value == '') {
 					var elm = tinyMCE.getParentElement(this.getFocusElement(), "p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");
 
 					if (elm)
@@ -2970,7 +3080,7 @@
 
 			case "mceSelectNodeDepth":
 				var parentNode = this.getFocusElement();
-				for (var i=0; parentNode; i++) {
+				for (i=0; parentNode; i++) {
 					if (parentNode.nodeName.toLowerCase() == "body")
 						break;
 
@@ -2996,14 +3106,14 @@
 			case "SetStyleInfo":
 				var rng = this.getRng();
 				var sel = this.getSel();
-				var scmd = value['command'];
-				var sname = value['name'];
-				var svalue = value['value'] == null ? '' : value['value'];
+				var scmd = value.command;
+				var sname = value.name;
+				var svalue = value.value == null ? '' : value.value;
 				//var svalue = value['value'] == null ? '' : value['value'];
-				var wrapper = value['wrapper'] ? value['wrapper'] : "span";
+				var wrapper = value.wrapper ? value.wrapper : "span";
 				var parentElm = null;
 				var invalidRe = new RegExp("^BODY|HTML$", "g");
-				var invalidParentsRe = tinyMCE.settings['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null;
+				var invalidParentsRe = tinyMCE.settings.merge_styles_invalid_parents !== '' ? new RegExp(tinyMCE.settings.merge_styles_invalid_parents, "gi") : null;
 
 				// Whole element selected check
 				if (tinyMCE.isIE) {
@@ -3022,7 +3132,7 @@
 					}
 				} else {
 					var felm = this.getFocusElement();
-					if (sel.isCollapsed || (new RegExp('td|tr|tbody|table', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode))
+					if (sel.isCollapsed || (new RegExp('td|tr|tbody|table|img', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode))
 						parentElm = felm;
 				}
 
@@ -3040,8 +3150,8 @@
 					}
 
 					// Remove style/attribs from all children
-					var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1);
-					for (var z=0; z<ch.length; z++) {
+					var ch = tinyMCE.getNodeTree(parentElm, [], 1);
+					for (z=0; z<ch.length; z++) {
 						if (ch[z] == parentElm)
 							continue;
 
@@ -3062,7 +3172,7 @@
 					var elementArray = tinyMCE.getElementsByAttributeValue(this.getBody(), "font", "face", "#mce_temp_font#");
 
 					// Change them all
-					for (var x=0; x<elementArray.length; x++) {
+					for (x=0; x<elementArray.length; x++) {
 						elm = elementArray[x];
 						if (elm) {
 							var spanElm = doc.createElement(wrapper);
@@ -3079,7 +3189,7 @@
 							}
 
 							if (elm.hasChildNodes()) {
-								for (var i=0; i<elm.childNodes.length; i++)
+								for (i=0; i<elm.childNodes.length; i++)
 									spanElm.appendChild(elm.childNodes[i].cloneNode(true));
 							}
 
@@ -3087,8 +3197,8 @@
 							elm.parentNode.replaceChild(spanElm, elm);
 
 							// Remove style/attribs from all children
-							var ch = tinyMCE.getNodeTree(spanElm, new Array(), 1);
-							for (var z=0; z<ch.length; z++) {
+							var ch = tinyMCE.getNodeTree(spanElm, [], 1);
+							for (z=0; z<ch.length; z++) {
 								if (ch[z] == spanElm)
 									continue;
 
@@ -3109,7 +3219,7 @@
 
 				// Cleaup wrappers
 				var nodes = doc.getElementsByTagName(wrapper);
-				for (var i=nodes.length-1; i>=0; i--) {
+				for (i=nodes.length-1; i>=0; i--) {
 					var elm = nodes[i];
 					var isNew = tinyMCE.getAttrib(elm, "mce_new") == "true";
 
@@ -3132,9 +3242,8 @@
 
 				// Remove empty wrappers
 				var nodes = doc.getElementsByTagName(wrapper);
-				for (var i=nodes.length-1; i>=0; i--) {
-					var elm = nodes[i];
-					var isEmpty = true;
+				for (i=nodes.length-1; i>=0; i--) {
+					var elm = nodes[i], isEmpty = true;
 
 					// Check if it has any attribs
 					var tmp = doc.createElement("body");
@@ -3144,7 +3253,7 @@
 					tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), '');
 					//tinyMCE.debug(tmp.innerHTML);
 					if (new RegExp('<span>', 'gi').test(tmp.innerHTML)) {
-						for (var x=0; x<elm.childNodes.length; x++) {
+						for (x=0; x<elm.childNodes.length; x++) {
 							if (elm.parentNode != null)
 								elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true), elm);
 						}
@@ -3214,7 +3323,7 @@
 				value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
 				this.backColor = value;
 
-				if (tinyMCE.isGecko) {
+				if (tinyMCE.isGecko || tinyMCE.isOpera) {
 					this._setUseCSS(true);
 					this.getDoc().execCommand('hilitecolor', false, value);
 					this._setUseCSS(false);
@@ -3269,6 +3378,8 @@
 
 				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
 				tinyMCE._setEventsEnabled(this.getBody(), false);
+				this._addBogusBR();
+
 				return true;
 
 			case "mceCleanup":
@@ -3283,6 +3394,7 @@
 
 				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
 				tinyMCE._setEventsEnabled(this.getBody(), false);
+				this._addBogusBR();
 				this.repaint();
 				this.selection.moveToBookmark(b);
 				tinyMCE.triggerNodeChange();
@@ -3308,16 +3420,17 @@
 					tinyMCE.execCommand('mceInsertContent', false, value);
 				}
 
+				this._addBogusBR();
 				tinyMCE.triggerNodeChange();
 			break;
 
 			case "mceSetAttribute":
 				if (typeof(value) == 'object') {
-					var targetElms = (typeof(value['targets']) == "undefined") ? "p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address" : value['targets'];
+					var targetElms = (typeof(value.targets) == "undefined") ? "p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address" : value.targets;
 					var targetNode = tinyMCE.getParentElement(this.getFocusElement(), targetElms);
 
 					if (targetNode) {
-						targetNode.setAttribute(value['name'], value['value']);
+						targetNode.setAttribute(value.name, value.value);
 						tinyMCE.triggerNodeChange();
 					}
 				}
@@ -3412,10 +3525,7 @@
 							value = rng.createContextualFragment(value);
 					} else {
 						// Setup text node
-						var el = document.createElement("div");
-						el.innerHTML = value;
-						value = el.firstChild.nodeValue;
-						value = doc.createTextNode(value);
+						value = doc.createTextNode(tinyMCE.entityDecode(value));
 					}
 
 					// Insert plain text in Safari
@@ -3485,7 +3595,7 @@
 			break;
 
 			case "mceStartTyping":
-				if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex == -1) {
+				if (tinyMCE.settings.custom_undo_redo && this.undoRedo.typingUndoIndex == -1) {
 					this.undoRedo.typingUndoIndex = this.undoRedo.undoIndex;
 					tinyMCE.typingUndoIndex = tinyMCE.undoIndex;
 					this.execCommand('mceAddUndoLevel');
@@ -3493,7 +3603,7 @@
 				break;
 
 			case "mceEndTyping":
-				if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex != -1) {
+				if (tinyMCE.settings.custom_undo_redo && this.undoRedo.typingUndoIndex != -1) {
 					this.execCommand('mceAddUndoLevel');
 					this.undoRedo.typingUndoIndex = -1;
 				}
@@ -3511,14 +3621,14 @@
 				break;
 
 			case "mceAddUndoLevel":
-				if (tinyMCE.settings['custom_undo_redo'] && this.undoRedoLevel) {
+				if (tinyMCE.settings.custom_undo_redo && this.undoRedoLevel) {
 					if (this.undoRedo.add())
 						tinyMCE.triggerNodeChange(false);
 				}
 				break;
 
 			case "Undo":
-				if (tinyMCE.settings['custom_undo_redo']) {
+				if (tinyMCE.settings.custom_undo_redo) {
 					tinyMCE.execCommand("mceEndTyping");
 					this.undoRedo.undo();
 					tinyMCE.triggerNodeChange();
@@ -3527,7 +3637,7 @@
 				break;
 
 			case "Redo":
-				if (tinyMCE.settings['custom_undo_redo']) {
+				if (tinyMCE.settings.custom_undo_redo) {
 					tinyMCE.execCommand("mceEndTyping");
 					this.undoRedo.redo();
 					tinyMCE.triggerNodeChange();
@@ -3613,96 +3723,105 @@
 		return this.getDoc().queryCommandState(c);
 	},
 
+	_addBogusBR : function() {
+		var b = this.getBody();
+
+		if (tinyMCE.isGecko && !b.hasChildNodes())
+			b.innerHTML = '<br _moz_editor_bogus_node="TRUE" />';
+	},
+
 	_onAdd : function(replace_element, form_element_name, target_document) {
-		var hc, th, to, editorTemplate;
+		var hc, th, tos, editorTemplate, targetDoc, deltaWidth, deltaHeight, html, rng, fragment;
+		var dynamicIFrame, tElm, doc, parentElm;
 
-		th = this.settings['theme'];
-		to = tinyMCE.themes[th];
+		th = this.settings.theme;
+		tos = tinyMCE.themes[th];
 
-		var targetDoc = target_document ? target_document : document;
+		targetDoc = target_document ? target_document : document;
 
 		this.targetDoc = targetDoc;
 
-		tinyMCE.themeURL = tinyMCE.baseURL + "/themes/" + this.settings['theme'];
-		this.settings['themeurl'] = tinyMCE.themeURL;
+		tinyMCE.themeURL = tinyMCE.baseURL + "/themes/" + this.settings.theme;
+		this.settings.themeurl = tinyMCE.themeURL;
 
 		if (!replace_element) {
 			alert("Error: Could not find the target element.");
 			return false;
 		}
 
-		if (to.getEditorTemplate)
-			editorTemplate = to.getEditorTemplate(this.settings, this.editorId);
+		if (tos.getEditorTemplate)
+			editorTemplate = tos.getEditorTemplate(this.settings, this.editorId);
 
-		var deltaWidth = editorTemplate['delta_width'] ? editorTemplate['delta_width'] : 0;
-		var deltaHeight = editorTemplate['delta_height'] ? editorTemplate['delta_height'] : 0;
-		var html = '<span id="' + this.editorId + '_parent" class="mceEditorContainer">' + editorTemplate['html'];
+		deltaWidth = editorTemplate.delta_width ? editorTemplate.delta_width : 0;
+		deltaHeight = editorTemplate.delta_height ? editorTemplate.delta_height : 0;
+		html = '<span id="' + this.editorId + '_parent" class="mceEditorContainer">' + editorTemplate.html;
 
 		html = tinyMCE.replaceVar(html, "editor_id", this.editorId);
-		this.settings['default_document'] = tinyMCE.baseURL + "/blank.htm";
 
-		this.settings['old_width'] = this.settings['width'];
-		this.settings['old_height'] = this.settings['height'];
+		if (!this.settings.default_document)
+			this.settings.default_document = tinyMCE.baseURL + "/blank.htm";
 
+		this.settings.old_width = this.settings.width;
+		this.settings.old_height = this.settings.height;
+
 		// Set default width, height
-		if (this.settings['width'] == -1)
-			this.settings['width'] = replace_element.offsetWidth;
+		if (this.settings.width == -1)
+			this.settings.width = replace_element.offsetWidth;
 
-		if (this.settings['height'] == -1)
-			this.settings['height'] = replace_element.offsetHeight;
+		if (this.settings.height == -1)
+			this.settings.height = replace_element.offsetHeight;
 
 		// Try the style width
-		if (this.settings['width'] == 0)
-			this.settings['width'] = replace_element.style.width;
+		if (this.settings.width == 0)
+			this.settings.width = replace_element.style.width;
 
 		// Try the style height
-		if (this.settings['height'] == 0)
-			this.settings['height'] = replace_element.style.height; 
+		if (this.settings.height == 0)
+			this.settings.height = replace_element.style.height; 
 
 		// If no width/height then default to 320x240, better than nothing
-		if (this.settings['width'] == 0)
-			this.settings['width'] = 320;
+		if (this.settings.width == 0)
+			this.settings.width = 320;
 
-		if (this.settings['height'] == 0)
-			this.settings['height'] = 240;
+		if (this.settings.height == 0)
+			this.settings.height = 240;
 
-		this.settings['area_width'] = parseInt(this.settings['width']);
-		this.settings['area_height'] = parseInt(this.settings['height']);
-		this.settings['area_width'] += deltaWidth;
-		this.settings['area_height'] += deltaHeight;
+		this.settings.area_width = parseInt(this.settings.width);
+		this.settings.area_height = parseInt(this.settings.height);
+		this.settings.area_width += deltaWidth;
+		this.settings.area_height += deltaHeight;
+		this.settings.width_style = "" + this.settings.width;
+		this.settings.height_style = "" + this.settings.height;
 
-		this.settings['width_style'] = "" + this.settings['width'];
-		this.settings['height_style'] = "" + this.settings['height'];
-
 		// Special % handling
-		if (("" + this.settings['width']).indexOf('%') != -1)
-			this.settings['area_width'] = "100%";
+		if (("" + this.settings.width).indexOf('%') != -1)
+			this.settings.area_width = "100%";
 		else
-			this.settings['width_style'] += 'px';
+			this.settings.width_style += 'px';
 
-		if (("" + this.settings['height']).indexOf('%') != -1)
-			this.settings['area_height'] = "100%";
+		if (("" + this.settings.height).indexOf('%') != -1)
+			this.settings.area_height = "100%";
 		else
-			this.settings['height_style'] += 'px';
+			this.settings.height_style += 'px';
 
 		if (("" + replace_element.style.width).indexOf('%') != -1) {
-			this.settings['width'] = replace_element.style.width;
-			this.settings['area_width'] = "100%";
-			this.settings['width_style'] = "100%";
+			this.settings.width = replace_element.style.width;
+			this.settings.area_width = "100%";
+			this.settings.width_style = "100%";
 		}
 
 		if (("" + replace_element.style.height).indexOf('%') != -1) {
-			this.settings['height'] = replace_element.style.height;
-			this.settings['area_height'] = "100%";
-			this.settings['height_style'] = "100%";
+			this.settings.height = replace_element.style.height;
+			this.settings.area_height = "100%";
+			this.settings.height_style = "100%";
 		}
 
 		html = tinyMCE.applyTemplate(html);
 
-		this.settings['width'] = this.settings['old_width'];
-		this.settings['height'] = this.settings['old_height'];
+		this.settings.width = this.settings.old_width;
+		this.settings.height = this.settings.old_height;
 
-		this.visualAid = this.settings['visual'];
+		this.visualAid = this.settings.visual;
 		this.formTargetElementId = form_element_name;
 
 		// Get replace_element contents
@@ -3716,13 +3835,9 @@
 			this.oldTargetElement = replace_element;
 
 			// Debug mode
-			if (tinyMCE.settings['debug']) {
-				hc = '<textarea wrap="off" id="' + form_element_name + '" name="' + form_element_name + '" cols="100" rows="15"></textarea>';
-			} else {
-				hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />';
-				this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline');
-				this.oldTargetElement.style.display = "none";
-			}
+			hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />';
+			this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline');
+			this.oldTargetElement.style.display = "none";
 
 			html += '</span>';
 
@@ -3733,10 +3848,10 @@
 
 			// Output HTML and set editable
 			if (tinyMCE.isGecko) {
-				var rng = replace_element.ownerDocument.createRange();
+				rng = replace_element.ownerDocument.createRange();
 				rng.setStartBefore(replace_element);
 
-				var fragment = rng.createContextualFragment(html);
+				fragment = rng.createContextualFragment(html);
 				tinyMCE.insertAfter(fragment, replace_element);
 			} else
 				replace_element.insertAdjacentHTML("beforeBegin", html);
@@ -3746,25 +3861,23 @@
 			// Just hide the textarea element
 			this.oldTargetElement = replace_element;
 
-			if (!tinyMCE.settings['debug']) {
-				this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline');
-				this.oldTargetElement.style.display = "none";
-			}
+			this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline');
+			this.oldTargetElement.style.display = "none";
 
 			// Output HTML and set editable
 			if (tinyMCE.isGecko) {
-				var rng = replace_element.ownerDocument.createRange();
+				rng = replace_element.ownerDocument.createRange();
 				rng.setStartBefore(replace_element);
 
-				var fragment = rng.createContextualFragment(html);
+				fragment = rng.createContextualFragment(html);
 				tinyMCE.insertAfter(fragment, replace_element);
 			} else
 				replace_element.insertAdjacentHTML("beforeBegin", html);
 		}
 
 		// Setup iframe
-		var dynamicIFrame = false;
-		var tElm = targetDoc.getElementById(this.editorId);
+		dynamicIFrame = false;
+		tElm = targetDoc.getElementById(this.editorId);
 
 		if (!tinyMCE.isIE) {
 			// Node case is preserved in XML strict mode
@@ -3801,9 +3914,9 @@
 		}
 
 		// Setup base HTML
-		var doc = this.contentDocument;
+		doc = this.contentDocument;
 		if (dynamicIFrame) {
-			var html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings['base_href'] + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';
+			html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings.base_href + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';
 
 			try {
 				if (!this.isHidden())
@@ -3824,7 +3937,7 @@
 			window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1);
 
 		// Setup element references
-		var parentElm = this.targetDoc.getElementById(this.editorId + '_parent');
+		parentElm = this.targetDoc.getElementById(this.editorId + '_parent');
 		this.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling;
 
 		tinyMCE.setupContent(this.editorId, true);
@@ -3847,7 +3960,7 @@
 			b.setAttribute('href', u);
 			h.appendChild(b);
 		} else {
-			if (u == "" || u == null)
+			if (u == '' || u == null)
 				b.parentNode.removeChild(b);
 			else
 				b.setAttribute('href', u);
@@ -3886,8 +3999,11 @@
 	},
 
 	triggerSave : function(skip_cleanup, skip_callback) {
-		var e, nl = [], i, s;
+		var e, nl = [], i, s, content, htm;
 
+		if (!this.enabled)
+			return;
+
 		this.switchSettings();
 		s = tinyMCE.settings;
 
@@ -3908,7 +4024,7 @@
 			} while ((e = e.parentNode) != null)
 		}
 
-		tinyMCE.settings['preformatted'] = false;
+		tinyMCE.settings.preformatted = false;
 
 		// Default to false
 		if (typeof(skip_cleanup) == "undefined")
@@ -3921,17 +4037,17 @@
 		tinyMCE._setHTML(this.getDoc(), this.getBody().innerHTML);
 
 		// Remove visual aids when cleanup is disabled
-		if (this.settings['cleanup'] == false) {
+		if (this.settings.cleanup == false) {
 			tinyMCE.handleVisualAid(this.getBody(), true, false, this);
 			tinyMCE._setEventsEnabled(this.getBody(), true);
 		}
 
 		tinyMCE._customCleanup(this, "submit_content_dom", this.contentWindow.document.body);
-		var htm = skip_cleanup ? this.getBody().innerHTML : tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true);
+		htm = skip_cleanup ? this.getBody().innerHTML : tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true);
 		htm = tinyMCE._customCleanup(this, "submit_content", htm);
 
-		if (!skip_callback && tinyMCE.settings['save_callback'] != "")
-			var content = eval(tinyMCE.settings['save_callback'] + "(this.formTargetElementId,htm,this.getBody());");
+		if (!skip_callback && tinyMCE.settings.save_callback !== '')
+			content = tinyMCE.resolveDots(tinyMCE.settings.save_callback, window)(this.formTargetElementId,htm,this.getBody());
 
 		// Use callback content if available
 		if ((typeof(content) != "undefined") && content != null)
@@ -3963,444 +4079,439 @@
 
 /* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */
 
-TinyMCE_Engine.prototype.cleanupHTMLCode = function(s) {
-	s = s.replace(new RegExp('<p \\/>', 'gi'), '<p>&nbsp;</p>');
-	s = s.replace(new RegExp('<p>\\s*<\\/p>', 'gi'), '<p>&nbsp;</p>');
+tinyMCE.add(TinyMCE_Engine, {
+	cleanupHTMLCode : function(s) {
+		s = s.replace(new RegExp('<p \\/>', 'gi'), '<p>&nbsp;</p>');
+		s = s.replace(new RegExp('<p>\\s*<\\/p>', 'gi'), '<p>&nbsp;</p>');
 
-	// Fix close BR elements
-	s = s.replace(new RegExp('<br>\\s*<\\/br>', 'gi'), '<br />');
+		// Fix close BR elements
+		s = s.replace(new RegExp('<br>\\s*<\\/br>', 'gi'), '<br />');
 
-	// Open closed tags like <b/> to <b></b>
-	s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3></$1$2>');
+		// Open closed tags like <b/> to <b></b>
+		s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3></$1$2>');
 
-	// Remove trailing space <b > to <b>
-	s = s.replace(new RegExp('\\s+></', 'gi'), '></');
+		// Remove trailing space <b > to <b>
+		s = s.replace(new RegExp('\\s+></', 'gi'), '></');
 
-	// Close tags <img></img> to <img/>
-	s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />');
+		// Close tags <img></img> to <img/>
+		s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />');
 
-	// Weird MSIE bug, <p><hr /></p> breaks runtime?
-	if (tinyMCE.isIE)
-		s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>");
+		// Weird MSIE bug, <p><hr /></p> breaks runtime?
+		if (tinyMCE.isIE)
+			s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>");
 
-	// Weird tags will make IE error #bug: 1538495
-	if (tinyMCE.isIE)
-		s = s.replace(/<!(\s*)\/>/g, '');
+		// Weird tags will make IE error #bug: 1538495
+		if (tinyMCE.isIE)
+			s = s.replace(/<!(\s*)\/>/g, '');
 
-	// Convert relative anchors to absolute URLs ex: #something to file.htm#something
-	// Removed: Since local document anchors should never be forced absolute example edit.php?id=something
-	//if (tinyMCE.getParam('convert_urls'))
-	//	s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#");
+		// Convert relative anchors to absolute URLs ex: #something to file.htm#something
+		// Removed: Since local document anchors should never be forced absolute example edit.php?id=something
+		//if (tinyMCE.getParam('convert_urls'))
+		//	s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings.document_base_url + "#");
 
-	return s;
-};
+		return s;
+	},
 
-TinyMCE_Engine.prototype.parseStyle = function(str) {
-	var ar = new Array();
+	parseStyle : function(str) {
+		var ar = [], st, i, re, pa;
 
-	if (str == null)
-		return ar;
+		if (str == null)
+			return ar;
 
-	var st = str.split(';');
+		st = str.split(';');
 
-	tinyMCE.clearArray(ar);
+		tinyMCE.clearArray(ar);
 
-	for (var i=0; i<st.length; i++) {
-		if (st[i] == '')
-			continue;
+		for (i=0; i<st.length; i++) {
+			if (st[i] == '')
+				continue;
 
-		var re = new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');
-		var pa = st[i].replace(re, '$1||$2').split('||');
-//tinyMCE.debug(str, pa[0] + "=" + pa[1], st[i].replace(re, '$1||$2'));
-		if (pa.length == 2)
-			ar[pa[0].toLowerCase()] = pa[1];
-	}
+			re = new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');
+			pa = st[i].replace(re, '$1||$2').split('||');
+	//tinyMCE.debug(str, pa[0] + "=" + pa[1], st[i].replace(re, '$1||$2'));
+			if (pa.length == 2)
+				ar[pa[0].toLowerCase()] = pa[1];
+		}
 
-	return ar;
-};
+		return ar;
+	},
 
-TinyMCE_Engine.prototype.compressStyle = function(ar, pr, sf, res) {
-	var box = new Array();
+	compressStyle : function(ar, pr, sf, res) {
+		var box = [], i, a;
 
-	box[0] = ar[pr + '-top' + sf];
-	box[1] = ar[pr + '-left' + sf];
-	box[2] = ar[pr + '-right' + sf];
-	box[3] = ar[pr + '-bottom' + sf];
+		box[0] = ar[pr + '-top' + sf];
+		box[1] = ar[pr + '-left' + sf];
+		box[2] = ar[pr + '-right' + sf];
+		box[3] = ar[pr + '-bottom' + sf];
 
-	for (var i=0; i<box.length; i++) {
-		if (box[i] == null)
-			return;
+		for (i=0; i<box.length; i++) {
+			if (box[i] == null)
+				return;
 
-		for (var a=0; a<box.length; a++) {
-			if (box[a] != box[i])
+			if (i && box[i] != box[i-1])
 				return;
 		}
-	}
 
-	// They are all the same
-	ar[res] = box[0];
-	ar[pr + '-top' + sf] = null;
-	ar[pr + '-left' + sf] = null;
-	ar[pr + '-right' + sf] = null;
-	ar[pr + '-bottom' + sf] = null;
-};
+		// They are all the same
+		ar[res] = box[0];
+		ar[pr + '-top' + sf] = null;
+		ar[pr + '-left' + sf] = null;
+		ar[pr + '-right' + sf] = null;
+		ar[pr + '-bottom' + sf] = null;
+	},
 
-TinyMCE_Engine.prototype.serializeStyle = function(ar) {
-	var str = "";
+	serializeStyle : function(ar) {
+		var str = "", key, val, m;
 
-	// Compress box
-	tinyMCE.compressStyle(ar, "border", "", "border");
-	tinyMCE.compressStyle(ar, "border", "-width", "border-width");
-	tinyMCE.compressStyle(ar, "border", "-color", "border-color");
-	tinyMCE.compressStyle(ar, "border", "-style", "border-style");
-	tinyMCE.compressStyle(ar, "padding", "", "padding");
-	tinyMCE.compressStyle(ar, "margin", "", "margin");
+		// Compress box
+		tinyMCE.compressStyle(ar, "border", "", "border");
+		tinyMCE.compressStyle(ar, "border", "-width", "border-width");
+		tinyMCE.compressStyle(ar, "border", "-color", "border-color");
+		tinyMCE.compressStyle(ar, "border", "-style", "border-style");
+		tinyMCE.compressStyle(ar, "padding", "", "padding");
+		tinyMCE.compressStyle(ar, "margin", "", "margin");
 
-	for (var key in ar) {
-		var val = ar[key];
+		for (key in ar) {
+			val = ar[key];
 
-		if (typeof(val) == 'function')
-			continue;
+			if (typeof(val) == 'function')
+				continue;
 
-		if (key.indexOf('mso-') == 0)
-			continue;
+			if (key.indexOf('mso-') == 0)
+				continue;
 
-		if (val != null && val != '') {
-			val = '' + val; // Force string
+			if (val != null && val !== '') {
+				val = '' + val; // Force string
 
-			// Fix style URL
-			val = val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)", 'gi'), "url('$1')");
+				// Fix style URL
+				val = val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)", 'gi'), "url('$1')");
 
-			// Convert URL
-			if (val.indexOf('url(') != -1 && tinyMCE.getParam('convert_urls')) {
-				var m = new RegExp("url\\('(.*?)'\\)").exec(val);
+				// Convert URL
+				if (val.indexOf('url(') != -1 && tinyMCE.getParam('convert_urls')) {
+					m = new RegExp("url\\('(.*?)'\\)").exec(val);
 
-				if (m.length > 1)
-					val = "url('" + eval(tinyMCE.getParam('urlconverter_callback') + "(m[1], null, true);") + "')";
-			}
+					if (m.length > 1)
+						val = "url('" + eval(tinyMCE.getParam('urlconverter_callback') + "(m[1], null, true);") + "')";
+				}
 
-			// Force HEX colors
-			if (tinyMCE.getParam("force_hex_style_colors"))
-				val = tinyMCE.convertRGBToHex(val, true);
+				// Force HEX colors
+				if (tinyMCE.getParam("force_hex_style_colors"))
+					val = tinyMCE.convertRGBToHex(val, true);
 
-			val = val.replace(/\"/g, '\'');
+				val = val.replace(/\"/g, '\'');
 
-			if (val != "url('')")
-				str += key.toLowerCase() + ": " + val + "; ";
+				if (val != "url('')")
+					str += key.toLowerCase() + ": " + val + "; ";
+			}
 		}
-	}
 
-	if (new RegExp('; $').test(str))
-		str = str.substring(0, str.length - 2);
+		if (new RegExp('; $').test(str))
+			str = str.substring(0, str.length - 2);
 
-	return str;
-};
+		return str;
+	},
 
-TinyMCE_Engine.prototype.convertRGBToHex = function(s, k) {
-	if (s.toLowerCase().indexOf('rgb') != -1) {
-		var re = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi");
-		var rgb = s.replace(re, "$1,$2,$3,$4,$5").split(',');
-		if (rgb.length == 5) {
-			r = parseInt(rgb[1]).toString(16);
-			g = parseInt(rgb[2]).toString(16);
-			b = parseInt(rgb[3]).toString(16);
+	convertRGBToHex : function(s, k) {
+		var re, rgb;
 
-			r = r.length == 1 ? '0' + r : r;
-			g = g.length == 1 ? '0' + g : g;
-			b = b.length == 1 ? '0' + b : b;
+		if (s.toLowerCase().indexOf('rgb') != -1) {
+			re = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi");
+			rgb = s.replace(re, "$1,$2,$3,$4,$5").split(',');
 
-			s = "#" + r + g + b;
+			if (rgb.length == 5) {
+				r = parseInt(rgb[1]).toString(16);
+				g = parseInt(rgb[2]).toString(16);
+				b = parseInt(rgb[3]).toString(16);
 
-			if (k)
-				s = rgb[0] + s + rgb[4];
+				r = r.length == 1 ? '0' + r : r;
+				g = g.length == 1 ? '0' + g : g;
+				b = b.length == 1 ? '0' + b : b;
+
+				s = "#" + r + g + b;
+
+				if (k)
+					s = rgb[0] + s + rgb[4];
+			}
 		}
-	}
 
-	return s;
-};
+		return s;
+	},
 
-TinyMCE_Engine.prototype.convertHexToRGB = function(s) {
-	if (s.indexOf('#') != -1) {
-		s = s.replace(new RegExp('[^0-9A-F]', 'gi'), '');
-		return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")";
-	}
+	convertHexToRGB : function(s) {
+		if (s.indexOf('#') != -1) {
+			s = s.replace(new RegExp('[^0-9A-F]', 'gi'), '');
+			return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")";
+		}
 
-	return s;
-};
+		return s;
+	},
 
-TinyMCE_Engine.prototype.convertSpansToFonts = function(doc) {
-	var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
+	convertSpansToFonts : function(doc) {
+		var s, i, size, fSize, x, fFace, fColor, sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
 
-	/*var h = doc.body.innerHTML;
-	h = h.replace(/<span/gi, '<font');
-	h = h.replace(/<\/span/gi, '</font');
-	tinyMCE.setInnerHTML(doc.body, h);*/
+		s = tinyMCE.selectElements(doc, 'span,font');
+		for (i=0; i<s.length; i++) {
+			size = tinyMCE.trim(s[i].style.fontSize).toLowerCase();
+			fSize = 0;
 
-	var s = tinyMCE.selectElements(doc, 'span,font');
-	for (var i=0; i<s.length; i++) {
-		var size = tinyMCE.trim(s[i].style.fontSize).toLowerCase();
-		var fSize = 0;
+			for (x=0; x<sizes.length; x++) {
+				if (sizes[x] == size) {
+					fSize = x + 1;
+					break;
+				}
+			}
 
-		for (var x=0; x<sizes.length; x++) {
-			if (sizes[x] == size) {
-				fSize = x + 1;
-				break;
+			if (fSize > 0) {
+				tinyMCE.setAttrib(s[i], 'size', fSize);
+				s[i].style.fontSize = '';
 			}
-		}
 
-		if (fSize > 0) {
-			tinyMCE.setAttrib(s[i], 'size', fSize);
-			s[i].style.fontSize = '';
-		}
+			fFace = s[i].style.fontFamily;
+			if (fFace != null && fFace !== '') {
+				tinyMCE.setAttrib(s[i], 'face', fFace);
+				s[i].style.fontFamily = '';
+			}
 
-		var fFace = s[i].style.fontFamily;
-		if (fFace != null && fFace != "") {
-			tinyMCE.setAttrib(s[i], 'face', fFace);
-			s[i].style.fontFamily = '';
+			fColor = s[i].style.color;
+			if (fColor != null && fColor !== '') {
+				tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor));
+				s[i].style.color = '';
+			}
 		}
+	},
 
-		var fColor = s[i].style.color;
-		if (fColor != null && fColor != "") {
-			tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor));
-			s[i].style.color = '';
-		}
-	}
-};
+	convertFontsToSpans : function(doc) {
+		var fsClasses, s, i, fSize, fFace, fColor, sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
 
-TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) {
-	var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
+		fsClasses = tinyMCE.getParam('font_size_classes');
+		if (fsClasses !== '')
+			fsClasses = fsClasses.replace(/\s+/, '').split(',');
+		else
+			fsClasses = null;
 
-/*	var h = doc.body.innerHTML;
-	h = h.replace(/<font/gi, '<span');
-	h = h.replace(/<\/font/gi, '</span');
-	tinyMCE.setInnerHTML(doc.body, h);*/
+		s = tinyMCE.selectElements(doc, 'span,font');
+		for (i=0; i<s.length; i++) {
+			fSize = tinyMCE.getAttrib(s[i], 'size');
+			fFace = tinyMCE.getAttrib(s[i], 'face');
+			fColor = tinyMCE.getAttrib(s[i], 'color');
 
-	var fsClasses = tinyMCE.getParam('font_size_classes');
-	if (fsClasses != '')
-		fsClasses = fsClasses.replace(/\s+/, '').split(',');
-	else
-		fsClasses = null;
+			if (fSize !== '') {
+				fSize = parseInt(fSize);
 
-	var s = tinyMCE.selectElements(doc, 'span,font');
-	for (var i=0; i<s.length; i++) {
-		var fSize, fFace, fColor;
+				if (fSize > 0 && fSize < 8) {
+					if (fsClasses != null)
+						tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]);
+					else
+						s[i].style.fontSize = sizes[fSize-1];
+				}
 
-		fSize = tinyMCE.getAttrib(s[i], 'size');
-		fFace = tinyMCE.getAttrib(s[i], 'face');
-		fColor = tinyMCE.getAttrib(s[i], 'color');
+				s[i].removeAttribute('size');
+			}
 
-		if (fSize != "") {
-			fSize = parseInt(fSize);
+			if (fFace !== '') {
+				s[i].style.fontFamily = fFace;
+				s[i].removeAttribute('face');
+			}
 
-			if (fSize > 0 && fSize < 8) {
-				if (fsClasses != null)
-					tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]);
-				else
-					s[i].style.fontSize = sizes[fSize-1];
+			if (fColor !== '') {
+				s[i].style.color = fColor;
+				s[i].removeAttribute('color');
 			}
-
-			s[i].removeAttribute('size');
 		}
+	},
 
-		if (fFace != "") {
-			s[i].style.fontFamily = fFace;
-			s[i].removeAttribute('face');
-		}
+	cleanupAnchors : function(doc) {
+		var i, cn, x, an = doc.getElementsByTagName("a");
 
-		if (fColor != "") {
-			s[i].style.color = fColor;
-			s[i].removeAttribute('color');
-		}
-	}
-};
+		// Loops backwards due to bug #1467987
+		for (i=an.length-1; i>=0; i--) {
+			if (tinyMCE.getAttrib(an[i], "name") !== '' && tinyMCE.getAttrib(an[i], "href") == '') {
+				cn = an[i].childNodes;
 
-TinyMCE_Engine.prototype.cleanupAnchors = function(doc) {
-	var i, cn, x, an = doc.getElementsByTagName("a");
-
-	// Loops backwards due to bug #1467987
-	for (i=an.length-1; i>=0; i--) {
-		if (tinyMCE.getAttrib(an[i], "name") != "" && tinyMCE.getAttrib(an[i], "href") == "") {
-			cn = an[i].childNodes;
-
-			for (x=cn.length-1; x>=0; x--)
-				tinyMCE.insertAfter(cn[x], an[i]);
+				for (x=cn.length-1; x>=0; x--)
+					tinyMCE.insertAfter(cn[x], an[i]);
+			}
 		}
-	}
-};
+	},
 
-TinyMCE_Engine.prototype.getContent = function(editor_id) {
-	if (typeof(editor_id) != "undefined")
-		 tinyMCE.getInstanceById(editor_id).select();
+	getContent : function(editor_id) {
+		if (typeof(editor_id) != "undefined")
+			 tinyMCE.getInstanceById(editor_id).select();
 
-	if (tinyMCE.selectedInstance)
-		return tinyMCE.selectedInstance.getHTML();
+		if (tinyMCE.selectedInstance)
+			return tinyMCE.selectedInstance.getHTML();
 
-	return null;
-};
+		return null;
+	},
 
-TinyMCE_Engine.prototype._fixListElements = function(d) {
-	var nl, x, a = ['ol', 'ul'], i, n, p, r = new RegExp('^(OL|UL)$'), np;
+	_fixListElements : function(d) {
+		var nl, x, a = ['ol', 'ul'], i, n, p, r = new RegExp('^(OL|UL)$'), np;
 
-	for (x=0; x<a.length; x++) {
-		nl = d.getElementsByTagName(a[x]);
+		for (x=0; x<a.length; x++) {
+			nl = d.getElementsByTagName(a[x]);
 
-		for (i=0; i<nl.length; i++) {
-			n = nl[i];
-			p = n.parentNode;
+			for (i=0; i<nl.length; i++) {
+				n = nl[i];
+				p = n.parentNode;
 
-			if (r.test(p.nodeName)) {
-				np = tinyMCE.prevNode(n, 'LI');
+				if (r.test(p.nodeName)) {
+					np = tinyMCE.prevNode(n, 'LI');
 
-				if (!np) {
-					np = d.createElement('li');
-					np.innerHTML = '&nbsp;';
-					np.appendChild(n);
-					p.insertBefore(np, p.firstChild);
-				} else
-					np.appendChild(n);
+					if (!np) {
+						np = d.createElement('li');
+						np.innerHTML = '&nbsp;';
+						np.appendChild(n);
+						p.insertBefore(np, p.firstChild);
+					} else
+						np.appendChild(n);
+				}
 			}
 		}
-	}
-};
+	},
 
-TinyMCE_Engine.prototype._fixTables = function(d) {
-	var nl, i, n, p, np, x, t;
+	_fixTables : function(d) {
+		var nl, i, n, p, np, x, t;
 
-	nl = d.getElementsByTagName('table');
-	for (i=0; i<nl.length; i++) {
-		n = nl[i];
+		nl = d.getElementsByTagName('table');
+		for (i=0; i<nl.length; i++) {
+			n = nl[i];
 
-		if ((p = tinyMCE.getParentElement(n, 'p,h1,h2,h3,h4,h5,h6')) != null) {
-			np = p.cloneNode(false);
-			np.removeAttribute('id');
+			if ((p = tinyMCE.getParentElement(n, 'p,h1,h2,h3,h4,h5,h6')) != null) {
+				np = p.cloneNode(false);
+				np.removeAttribute('id');
 
-			t = n;
+				t = n;
 
-			while ((n = n.nextSibling))
-				np.appendChild(n);
+				while ((n = n.nextSibling))
+					np.appendChild(n);
 
-			tinyMCE.insertAfter(np, p);
-			tinyMCE.insertAfter(t, p);
+				tinyMCE.insertAfter(np, p);
+				tinyMCE.insertAfter(t, p);
+			}
 		}
-	}
-};
+	},
 
-TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, on_save, on_submit, inn) {
-	var h, d, t1, t2, t3, t4, t5, c, s, nb;
+	_cleanupHTML : function(inst, doc, config, elm, visual, on_save, on_submit, inn) {
+		var h, d, t1, t2, t3, t4, t5, c, s, nb;
 
-	if (!tinyMCE.getParam('cleanup'))
-		return elm.innerHTML;
+		if (!tinyMCE.getParam('cleanup'))
+			return elm.innerHTML;
 
-	on_save = typeof(on_save) == 'undefined' ? false : on_save;
+		on_save = typeof(on_save) == 'undefined' ? false : on_save;
 
-	c = inst.cleanup;
-	s = inst.settings;
-	d = c.settings.debug;
+		c = inst.cleanup;
+		s = inst.settings;
+		d = c.settings.debug;
 
-	if (d)
-		t1 = new Date().getTime();
+		if (d)
+			t1 = new Date().getTime();
 
-	if (tinyMCE.getParam("convert_fonts_to_spans"))
-		tinyMCE.convertFontsToSpans(doc);
+		inst._fixRootBlocks();
 
-	if (tinyMCE.getParam("fix_list_elements"))
-		tinyMCE._fixListElements(doc);
+		if (tinyMCE.getParam("convert_fonts_to_spans"))
+			tinyMCE.convertFontsToSpans(doc);
 
-	if (tinyMCE.getParam("fix_table_elements"))
-		tinyMCE._fixTables(doc);
+		if (tinyMCE.getParam("fix_list_elements"))
+			tinyMCE._fixListElements(doc);
 
-	// Call custom cleanup code
-	tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body);
+		if (tinyMCE.getParam("fix_table_elements"))
+			tinyMCE._fixTables(doc);
 
-	if (d)
-		t2 = new Date().getTime();
+		// Call custom cleanup code
+		tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body);
 
-	c.settings.on_save = on_save;
-	//for (var i=0; i<100; i++)
+		if (d)
+			t2 = new Date().getTime();
 
-	c.idCount = 0;
-	c.serializationId++;
-	c.serializedNodes = new Array();
-	c.sourceIndex = -1;
+		c.settings.on_save = on_save;
 
-	if (s.cleanup_serializer == "xml")
-		h = c.serializeNodeAsXML(elm, inn);
-	else
-		h = c.serializeNodeAsHTML(elm, inn);
+		c.idCount = 0;
+		c.serializationId++; // Unique ID needed for the content duplication bug
+		c.serializedNodes = [];
+		c.sourceIndex = -1;
 
-	if (d)
-		t3 = new Date().getTime();
+		if (s.cleanup_serializer == "xml")
+			h = c.serializeNodeAsXML(elm, inn);
+		else
+			h = c.serializeNodeAsHTML(elm, inn);
 
-	// Post processing
-	nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? '&#160;' : '&nbsp;';
-	h = h.replace(/<\/?(body|head|html)[^>]*>/gi, '');
-	h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), '');
-	h = h.replace(/<p><hr \/><\/p>/g, '<hr />');
-	h = h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g, '<hr />');
-	h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>');
-	h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
-	h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko
-	h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko
-	h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g, '<p>' + nb + '</p>');
-	h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
-	h = h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g, '<p>' + nb + '</p>');
-	h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1');
-	h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>');
+		if (d)
+			t3 = new Date().getTime();
 
-	// Clean body
-	if (/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))
-		h = '';
+		// Post processing
+		nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? '&#160;' : '&nbsp;';
+		h = h.replace(/<\/?(body|head|html)[^>]*>/gi, '');
+		h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), '');
+		h = h.replace(/<p><hr \/><\/p>/g, '<hr />');
+		h = h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g, '<hr />');
+		h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>');
+		h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
+		h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko
+		h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko
+		h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g, '<p>' + nb + '</p>');
+		h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
+		h = h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g, '<p>' + nb + '</p>');
+		h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1');
+		h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>');
 
-	// If preformatted
-	if (s.preformatted) {
-		h = h.replace(/^<pre>/, '');
-		h = h.replace(/<\/pre>$/, '');
-		h = '<pre>' + h + '</pre>';
-	}
+		// Clean body
+		if (/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))
+			h = '';
 
-	// Gecko specific processing
-	if (tinyMCE.isGecko) {
-		h = h.replace(/<o:p _moz-userdefined="" \/>/g, '');
-		h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>');
-	}
+		// If preformatted
+		if (s.preformatted) {
+			h = h.replace(/^<pre>/, '');
+			h = h.replace(/<\/pre>$/, '');
+			h = '<pre>' + h + '</pre>';
+		}
 
-	if (s.force_br_newlines)
-		h = h.replace(/<p>(&nbsp;|&#160;)<\/p>/g, '<br />');
+		// Gecko specific processing
+		if (tinyMCE.isGecko) {
+			// Makes no sence but FF generates it!!
+			h = h.replace(/<br \/>\s*<\/li>/g, '</li>');
+			h = h.replace(/&nbsp;\s*<\/(dd|dt)>/g, '</$1>');
+			h = h.replace(/<o:p _moz-userdefined="" \/>/g, '');
+			h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>');
+		}
 
-	// Call custom cleanup code
-	h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h);
+		if (s.force_br_newlines)
+			h = h.replace(/<p>(&nbsp;|&#160;)<\/p>/g, '<br />');
 
-	// Remove internal classes
-	if (on_save) {
-		h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), '');
-		h = h.replace(new RegExp(' ?class=""', 'g'), '');
-	}
+		// Call custom cleanup code
+		h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h);
 
-	if (s.remove_linebreaks && !c.settings.indent)
-		h = h.replace(/\n|\r/g, ' ');
+		// Remove internal classes
+		if (on_save) {
+			h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), '');
+			h = h.replace(new RegExp(' ?class=""', 'g'), '');
+		}
 
-	if (d)
-		t4 = new Date().getTime();
+		if (s.remove_linebreaks && !c.settings.indent)
+			h = h.replace(/\n|\r/g, ' ');
 
-	if (on_save && c.settings.indent)
-		h = c.formatHTML(h);
+		if (d)
+			t4 = new Date().getTime();
 
-	// If encoding (not recommended option)
-	if (on_submit && (s.encoding == "xml" || s.encoding == "html"))
-		h = c.xmlEncode(h);
+		if (on_save && c.settings.indent)
+			h = c.formatHTML(h);
 
-	if (d)
-		t5 = new Date().getTime();
+		// If encoding (not recommended option)
+		if (on_submit && (s.encoding == "xml" || s.encoding == "html"))
+			h = c.xmlEncode(h);
 
-	if (c.settings.debug)
-		tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + ".");
+		if (d)
+			t5 = new Date().getTime();
 
-	return h;
-};
+		if (c.settings.debug)
+			tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + ".");
 
+		return h;
+	}
+});
+
 function TinyMCE_Cleanup() {
 	this.isIE = (navigator.appName == "Microsoft Internet Explorer");
-	this.rules = tinyMCE.clearArray(new Array());
+	this.rules = tinyMCE.clearArray([]);
 
 	// Default config
 	this.settings = {
@@ -4418,7 +4529,7 @@
 		verify_html : false
 	};
 
-	this.vElements = tinyMCE.clearArray(new Array());
+	this.vElements = tinyMCE.clearArray([]);
 	this.vElementsRe = '';
 	this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;
 	this.codeElementsRe = /^(SCRIPT|STYLE)$/;
@@ -4447,8 +4558,9 @@
 		this.nlAfterRe = this._arrayToRe(s.newline_after_elements.split(','), 'gi', '<(',  ')([^>]*)>');
 		this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>');
 		this.serializedNodes = [];
+		this.serializationId = 0;
 
-		if (s.invalid_elements != '')
+		if (s.invalid_elements !== '')
 			this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$');
 		else
 			this.iveRe = null;
@@ -4469,19 +4581,17 @@
 		this.fillStr = s.entity_encoding == "named" ? "&nbsp;" : "&#160;";
 		this.idCount = 0;
 		this.xmlEncodeRe = new RegExp('[\u007F-\uFFFF<>&"]', 'g');
-		this.xmlEncodeAposRe = new RegExp('[\u007F-\uFFFF<>&"\']', 'g');
 	},
 
 	addRuleStr : function(s) {
-		var r = this.parseRuleStr(s);
-		var n;
+		var r = this.parseRuleStr(s), n;
 
 		for (n in r) {
 			if (r[n])
 				this.rules[n] = r[n];
 		}
 
-		this.vElements = tinyMCE.clearArray(new Array());
+		this.vElements = tinyMCE.clearArray([]);
 
 		for (n in this.rules) {
 			if (this.rules[n])
@@ -4492,7 +4602,8 @@
 	},
 
 	isValid : function(n) {
-		this._setupRules(); // Will initialize cleanup rules
+		if (!this.rulesDone)
+			this._setupRules(); // Will initialize cleanup rules
 
 		// Empty is true since it removes formatting
 		if (!n)
@@ -4548,9 +4659,9 @@
 				}
 
 				r += ')$';
-//tinyMCE.debug(t + "=" + r);
+
 				if (this.childRules == null)
-					this.childRules = tinyMCE.clearArray(new Array());
+					this.childRules = tinyMCE.clearArray([]);
 
 				this.childRules[tn[y]] = new RegExp(r);
 
@@ -4561,7 +4672,7 @@
 	},
 
 	parseRuleStr : function(s) {
-		var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray(new Array()), dv;
+		var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray([]), dv;
 
 		if (s == null || s.length == 0)
 			return or;
@@ -4621,19 +4732,19 @@
 						if (av && av.length > 0) {
 							if (av[0].charAt(0) == ':') {
 								if (!r.forceAttribs)
-									r.forceAttribs = tinyMCE.clearArray(new Array());
+									r.forceAttribs = tinyMCE.clearArray([]);
 
 								r.forceAttribs[t.toLowerCase()] = av[0].substring(1);
 							} else if (av[0].charAt(0) == '=') {
 								if (!r.defaultAttribs)
-									r.defaultAttribs = tinyMCE.clearArray(new Array());
+									r.defaultAttribs = tinyMCE.clearArray([]);
 
 								dv = av[0].substring(1);
 
-								r.defaultAttribs[t.toLowerCase()] = dv == "" ? "mce_empty" : dv;
+								r.defaultAttribs[t.toLowerCase()] = dv == '' ? "mce_empty" : dv;
 							} else if (av[0].charAt(0) == '<') {
 								if (!r.validAttribValues)
-									r.validAttribValues = tinyMCE.clearArray(new Array());
+									r.validAttribValues = tinyMCE.clearArray([]);
 
 								r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), 'i');
 							}
@@ -4656,7 +4767,7 @@
 					//tinyMCE.debug(r.tag, r.oTagName, r.vAttribsRe, r.vAttribsReWC);
 				} else {
 					r.vAttribsRe = '';
-					r.vAttribs = tinyMCE.clearArray(new Array());
+					r.vAttribs = tinyMCE.clearArray([]);
 					r.vAttribsReIsWild = false;
 				}
 
@@ -4745,7 +4856,8 @@
 	serializeNodeAsHTML : function(n, inn) {
 		var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr, nn;
 
-		this._setupRules(); // Will initialize cleanup rules
+		if (!this.rulesDone)
+			this._setupRules(); // Will initialize cleanup rules
 
 		if (tinyMCE.isRealIE && this._isDuplicate(n))
 			return '';
@@ -4767,12 +4879,19 @@
 				if (st)
 					break;
 
-				// MSIE sometimes produces <//tag>
-				if ((tinyMCE.isRealIE) && n.nodeName.indexOf('/') != -1)
-					break;
-
 				nn = n.nodeName;
 
+				if (tinyMCE.isRealIE) {
+					// MSIE sometimes produces <//tag>
+					if (n.nodeName.indexOf('/') != -1)
+						break;
+
+					// MSIE has it's NS in a separate attrib
+					if (n.scopeName && n.scopeName != 'HTML')
+						nn = n.scopeName.toUpperCase() + ':' + nn.toUpperCase();
+				} else if (tinyMCE.isOpera && nn.indexOf(':') > 0)
+					nn = nn.toUpperCase();
+
 				// Convert fonts to spans
 				if (this.settings.convert_fonts_to_spans) {
 					// On get content FONT -> SPAN
@@ -4959,25 +5078,26 @@
 		return o;
 	},
 
-	xmlEncode : function(s, skip_apos) {
-		var cl = this, re = !skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe;
+	xmlEncode : function(s) {
+		var cl = this, re = this.xmlEncodeRe;
 
-		this._setupEntities(); // Will intialize lookup table
+		if (!this.entitiesDone)
+			this._setupEntities(); // Will intialize lookup table
 
 		switch (this.settings.entity_encoding) {
 			case "raw":
-				return tinyMCE.xmlEncode(s, skip_apos);
+				return tinyMCE.xmlEncode(s);
 
 			case "named":
-				return s.replace(re, function (c, b) {
-					b = cl.entities[c.charCodeAt(0)];
+				return s.replace(re, function (c) {
+					var b = cl.entities[c.charCodeAt(0)];
 
 					return b ? '&' + b + ';' : c;
 				});
 
 			case "numeric":
-				return s.replace(re, function (c, b) {
-					return b ? '&#' + c.charCodeAt(0) + ';' : c;
+				return s.replace(re, function (c) {
+					return '&#' + c.charCodeAt(0) + ';';
 				});
 		}
 
@@ -4985,11 +5105,10 @@
 	},
 
 	split : function(re, s) {
-		var c = s.split(re);
-		var i, l, o = new Array();
+		var i, l, o = [], c = s.split(re);
 
 		for (i=0, l=c.length; i<l; i++) {
-			if (c[i] != '')
+			if (c[i] !== '')
 				o[i] = c[i];
 		}
 
@@ -5038,6 +5157,10 @@
 
 			if (nn == "INPUT" && n == "maxlength" && v == "2147483647")
 				v = "";
+
+			// Images
+			if (n == "width" || n == "height")
+				v = e.getAttribute(n, 2);
 		}
 
 		if (n == 'style' && v) {
@@ -5047,10 +5170,10 @@
 			v = tinyMCE.serializeStyle(tinyMCE.parseStyle(v));
 		}
 
-		if (this.settings.on_save && n.indexOf('on') != -1 && this.settings.on_save && v && v != "")
+		if (this.settings.on_save && n.indexOf('on') != -1 && this.settings.on_save && v && v !== '')
 			v = tinyMCE.cleanupEventStr(v);
 
-		return (v && v != "") ? '' + v : d;
+		return (v && v !== '') ? '' + v : d;
 	},
 
 	_urlConverter : function(c, n, v) {
@@ -5095,35 +5218,31 @@
 		var n, a, i, s = this.settings;
 
 		// Setup entities
-		if (!this.entitiesDone) {
-			if (s.entity_encoding == "named") {
-				n = tinyMCE.clearArray(new Array());
-				a = this.split(',', s.entities);
-				for (i=0; i<a.length; i+=2)
-					n[a[i]] = a[i+1];
+		if (s.entity_encoding == "named") {
+			n = tinyMCE.clearArray([]);
+			a = this.split(',', s.entities);
+			for (i=0; i<a.length; i+=2)
+				n[a[i]] = a[i+1];
 
-				this.entities = n;
-			}
+			this.entities = n;
+		}
 
-			this.entitiesDone = true;
-		}
+		this.entitiesDone = true;
 	},
 
 	_setupRules : function() {
 		var s = this.settings;
 
 		// Setup default rule
-		if (!this.rulesDone) {
-			this.addRuleStr(s.valid_elements);
-			this.addRuleStr(s.extended_valid_elements);
-			this.addChildRemoveRuleStr(s.valid_child_elements);
+		this.addRuleStr(s.valid_elements);
+		this.addRuleStr(s.extended_valid_elements);
+		this.addChildRemoveRuleStr(s.valid_child_elements);
 
-			this.rulesDone = true;
-		}
+		this.rulesDone = true;
 	},
 
 	_isDuplicate : function(n) {
-		var i;
+		var i, l, sn;
 
 		if (!this.settings.fix_content_duplication)
 			return false;
@@ -5135,13 +5254,15 @@
 
 			n.setAttribute('mce_serialized', this.serializationId);
 		} else {
+			sn = this.serializedNodes;
+
 			// Search lookup table for text nodes  and comments
-			for (i=0; i<this.serializedNodes.length; i++) {
-				if (this.serializedNodes[i] == n)
+			for (i=0, l = sn.length; i<l; i++) {
+				if (sn[i] == n)
 					return true;
 			}
 
-			this.serializedNodes[this.serializedNodes.length] = n;
+			sn.push(n);
 		}
 
 		return false;
@@ -5151,1037 +5272,1056 @@
 
 /* file:jscripts/tiny_mce/classes/TinyMCE_DOMUtils.class.js */
 
-TinyMCE_Engine.prototype.createTagHTML = function(tn, a, h) {
-	var o = '', f = tinyMCE.xmlEncode;
+tinyMCE.add(TinyMCE_Engine, {
+	createTagHTML : function(tn, a, h) {
+		var o = '', f = tinyMCE.xmlEncode, n;
 
-	o = '<' + tn;
+		o = '<' + tn;
 
-	if (a) {
-		for (n in a) {
-			if (typeof(a[n]) != 'function' && a[n] != null)
-				o += ' ' + f(n) + '="' + f('' + a[n]) + '"';
+		if (a) {
+			for (n in a) {
+				if (typeof(a[n]) != 'function' && a[n] != null)
+					o += ' ' + f(n) + '="' + f('' + a[n]) + '"';
+			}
 		}
-	}
 
-	o += !h ? ' />' : '>' + h + '</' + tn + '>';
+		o += !h ? ' />' : '>' + h + '</' + tn + '>';
 
-	return o;
-};
+		return o;
+	},
 
-TinyMCE_Engine.prototype.createTag = function(d, tn, a, h) {
-	var o = d.createElement(tn);
+	createTag : function(d, tn, a, h) {
+		var o = d.createElement(tn), n;
 
-	if (a) {
-		for (n in a) {
-			if (typeof(a[n]) != 'function' && a[n] != null)
-				tinyMCE.setAttrib(o, n, a[n]);
+		if (a) {
+			for (n in a) {
+				if (typeof(a[n]) != 'function' && a[n] != null)
+					tinyMCE.setAttrib(o, n, a[n]);
+			}
 		}
-	}
 
-	if (h)
-		o.innerHTML = h;
+		if (h)
+			o.innerHTML = h;
 
-	return o;
-};
+		return o;
+	},
 
-TinyMCE_Engine.prototype.getElementByAttributeValue = function(n, e, a, v) {
-	return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0];
-};
+	getElementByAttributeValue : function(n, e, a, v) {
+		return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0];
+	},
 
-TinyMCE_Engine.prototype.getElementsByAttributeValue = function(n, e, a, v) {
-	var i, nl = n.getElementsByTagName(e), o = new Array();
+	getElementsByAttributeValue : function(n, e, a, v) {
+		var i, nl = n.getElementsByTagName(e), o = [];
 
-	for (i=0; i<nl.length; i++) {
-		if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)
-			o[o.length] = nl[i];
-	}
+		for (i=0; i<nl.length; i++) {
+			if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)
+				o[o.length] = nl[i];
+		}
 
-	return o;
-};
+		return o;
+	},
 
-TinyMCE_Engine.prototype.isBlockElement = function(n) {
-	return n != null && n.nodeType == 1 && this.blockRegExp.test(n.nodeName);
-};
+	isBlockElement : function(n) {
+		return n != null && n.nodeType == 1 && this.blockRegExp.test(n.nodeName);
+	},
 
-TinyMCE_Engine.prototype.getParentBlockElement = function(n, r) {
-	return this.getParentNode(n, function(n) {
-		return tinyMCE.isBlockElement(n);
-	}, r);
+	getParentBlockElement : function(n, r) {
+		return this.getParentNode(n, function(n) {
+			return tinyMCE.isBlockElement(n);
+		}, r);
 
-	return null;
-};
+		return null;
+	},
 
-TinyMCE_Engine.prototype.insertAfter = function(n, r){
-	if (r.nextSibling)
-		r.parentNode.insertBefore(n, r.nextSibling);
-	else
-		r.parentNode.appendChild(n);
-};
+	insertAfter : function(n, r){
+		if (r.nextSibling)
+			r.parentNode.insertBefore(n, r.nextSibling);
+		else
+			r.parentNode.appendChild(n);
+	},
 
-TinyMCE_Engine.prototype.setInnerHTML = function(e, h) {
-	var i, nl, n;
+	setInnerHTML : function(e, h) {
+		var i, nl, n;
 
-	// Convert all strong/em to b/i in Gecko
-	if (tinyMCE.isGecko) {
-		h = h.replace(/<embed([^>]*)>/gi, '<tmpembed$1>');
-		h = h.replace(/<em([^>]*)>/gi, '<i$1>');
-		h = h.replace(/<tmpembed([^>]*)>/gi, '<embed$1>');
-		h = h.replace(/<strong([^>]*)>/gi, '<b$1>');
-		h = h.replace(/<\/strong>/gi, '</b>');
-		h = h.replace(/<\/em>/gi, '</i>');
-	}
+		// Convert all strong/em to b/i in Gecko
+		if (tinyMCE.isGecko) {
+			h = h.replace(/<embed([^>]*)>/gi, '<tmpembed$1>');
+			h = h.replace(/<em([^>]*)>/gi, '<i$1>');
+			h = h.replace(/<tmpembed([^>]*)>/gi, '<embed$1>');
+			h = h.replace(/<strong([^>]*)>/gi, '<b$1>');
+			h = h.replace(/<\/strong>/gi, '</b>');
+			h = h.replace(/<\/em>/gi, '</i>');
+		}
 
-	if (tinyMCE.isRealIE) {
-		// Since MSIE handles invalid HTML better that valid XHTML we
-		// need to make some things invalid. <hr /> gets converted to <hr>.
-		h = h.replace(/\s\/>/g, '>');
+		if (tinyMCE.isRealIE) {
+			// Since MSIE handles invalid HTML better that valid XHTML we
+			// need to make some things invalid. <hr /> gets converted to <hr>.
+			h = h.replace(/\s\/>/g, '>');
 
-		// Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones
-		h = h.replace(/<p([^>]*)>\u00A0?<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
-		h = h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
-		h = h.replace(/<p([^>]*)>\s+<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
+			// Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones
+			h = h.replace(/<p([^>]*)>\u00A0?<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
+			h = h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
+			h = h.replace(/<p([^>]*)>\s+<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
 
-		// Remove first comment
-		e.innerHTML = tinyMCE.uniqueTag + h;
-		e.firstChild.removeNode(true);
+			// Remove first comment
+			e.innerHTML = tinyMCE.uniqueTag + h;
+			e.firstChild.removeNode(true);
 
-		// Remove weird auto generated empty paragraphs unless it's supposed to be there
-		nl = e.getElementsByTagName("p");
-		for (i=nl.length-1; i>=0; i--) {
-			n = nl[i];
+			// Remove weird auto generated empty paragraphs unless it's supposed to be there
+			nl = e.getElementsByTagName("p");
+			for (i=nl.length-1; i>=0; i--) {
+				n = nl[i];
 
-			if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep)
-				n.parentNode.removeChild(n);
+				if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep)
+					n.parentNode.removeChild(n);
+			}
+		} else {
+			h = this.fixGeckoBaseHREFBug(1, e, h);
+			e.innerHTML = h;
+			this.fixGeckoBaseHREFBug(2, e, h);
 		}
-	} else {
-		h = this.fixGeckoBaseHREFBug(1, e, h);
-		e.innerHTML = h;
-		this.fixGeckoBaseHREFBug(2, e, h);
-	}
-};
+	},
 
-TinyMCE_Engine.prototype.getOuterHTML = function(e) {
-	if (tinyMCE.isIE)
-		return e.outerHTML;
+	getOuterHTML : function(e) {
+		var d;
 
-	var d = e.ownerDocument.createElement("body");
-	d.appendChild(e.cloneNode(true));
-	return d.innerHTML;
-};
+		if (tinyMCE.isIE)
+			return e.outerHTML;
 
-TinyMCE_Engine.prototype.setOuterHTML = function(e, h, d) {
-	var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t;
+		d = e.ownerDocument.createElement("body");
+		d.appendChild(e.cloneNode(true));
 
-	if (tinyMCE.isIE && e.nodeType == 1)
-		e.outerHTML = h;
-	else {
-		t = d.createElement("body");
-		t.innerHTML = h;
+		return d.innerHTML;
+	},
 
-		for (i=0, nl=t.childNodes; i<nl.length; i++)
-			e.parentNode.insertBefore(nl[i].cloneNode(true), e);
+	setOuterHTML : function(e, h, d) {
+		var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t;
 
-		e.parentNode.removeChild(e);
-	}
-};
+		if (tinyMCE.isIE && e.nodeType == 1)
+			e.outerHTML = h;
+		else {
+			t = d.createElement("body");
+			t.innerHTML = h;
 
-TinyMCE_Engine.prototype._getElementById = function(id, d) {
-	var e, i, j, f;
+			for (i=0, nl=t.childNodes; i<nl.length; i++)
+				e.parentNode.insertBefore(nl[i].cloneNode(true), e);
 
-	if (typeof(d) == "undefined")
-		d = document;
+			e.parentNode.removeChild(e);
+		}
+	},
 
-	e = d.getElementById(id);
-	if (!e) {
-		f = d.forms;
+	_getElementById : function(id, d) {
+		var e, i, j, f;
 
-		for (i=0; i<f.length; i++) {
-			for (j=0; j<f[i].elements.length; j++) {
-				if (f[i].elements[j].name == id) {
-					e = f[i].elements[j];
-					break;
+		if (typeof(d) == "undefined")
+			d = document;
+
+		e = d.getElementById(id);
+		if (!e) {
+			f = d.forms;
+
+			for (i=0; i<f.length; i++) {
+				for (j=0; j<f[i].elements.length; j++) {
+					if (f[i].elements[j].name == id) {
+						e = f[i].elements[j];
+						break;
+					}
 				}
 			}
 		}
-	}
 
-	return e;
-};
+		return e;
+	},
 
-TinyMCE_Engine.prototype.getNodeTree = function(n, na, t, nn) {
-	return this.selectNodes(n, function(n) {
-		return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
-	}, na ? na : new Array());
-};
+	getNodeTree : function(n, na, t, nn) {
+		return this.selectNodes(n, function(n) {
+			return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
+		}, na ? na : []);
+	},
 
-TinyMCE_Engine.prototype.getParentElement = function(n, na, f, r) {
-	var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v;
+	getParentElement : function(n, na, f, r) {
+		var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v;
 
-	// Compatiblity with old scripts where f param was a attribute string
-	if (f && typeof(f) == 'string')
-		return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) != '';});
+		// Compatiblity with old scripts where f param was a attribute string
+		if (f && typeof(f) == 'string')
+			return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) !== '';});
 
-	return this.getParentNode(n, function(n) {
-		return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n));
-	}, r);
-};
+		return this.getParentNode(n, function(n) {
+			return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n));
+		}, r);
+	},
 
-TinyMCE_Engine.prototype.getParentNode = function(n, f, r) {
-	while (n) {
-		if (n == r)
-			return null;
+	getParentNode : function(n, f, r) {
+		while (n) {
+			if (n == r)
+				return null;
 
-		if (f(n))
-			return n;
+			if (f(n))
+				return n;
 
-		n = n.parentNode;
-	}
+			n = n.parentNode;
+		}
 
-	return null;
-};
+		return null;
+	},
 
-TinyMCE_Engine.prototype.getAttrib = function(elm, name, dv) {
-	var v;
+	getAttrib : function(elm, name, dv) {
+		var v;
 
-	if (typeof(dv) == "undefined")
-		dv = "";
+		if (typeof(dv) == "undefined")
+			dv = "";
 
-	// Not a element
-	if (!elm || elm.nodeType != 1)
-		return dv;
+		// Not a element
+		if (!elm || elm.nodeType != 1)
+			return dv;
 
-	try {
-		v = elm.getAttribute(name, 0);
-	} catch (ex) {
-		// IE 7 may cast exception on invalid attributes
-		v = elm.getAttribute(name, 2);
-	}
+		try {
+			v = elm.getAttribute(name, 0);
+		} catch (ex) {
+			// IE 7 may cast exception on invalid attributes
+			v = elm.getAttribute(name, 2);
+		}
 
-	// Try className for class attrib
-	if (name == "class" && !v)
-		v = elm.className;
+		// Try className for class attrib
+		if (name == "class" && !v)
+			v = elm.className;
 
-	// Workaround for a issue with Firefox 1.5rc2+
-	if (tinyMCE.isGecko && name == "src" && elm.src != null && elm.src != "")
-		v = elm.src;
+		// Workaround for a issue with Firefox 1.5rc2+
+		if (tinyMCE.isGecko) {
+			if (name == "src" && elm.src != null && elm.src !== '')
+				v = elm.src;
 
-	// Workaround for a issue with Firefox 1.5rc2+
-	if (tinyMCE.isGecko && name == "href" && elm.href != null && elm.href != "")
-		v = elm.href;
+			// Workaround for a issue with Firefox 1.5rc2+
+			if (name == "href" && elm.href != null && elm.href !== '')
+				v = elm.href;
+		} else if (tinyMCE.isIE) {
+			switch (name) {
+				case "http-equiv":
+					v = elm.httpEquiv;
+					break;
 
-	if (name == "http-equiv" && tinyMCE.isIE)
-		v = elm.httpEquiv;
+				case "width":
+				case "height":
+					v = elm.getAttribute(name, 2);
+					break;
+			}
+		}
 
-	if (name == "style" && !tinyMCE.isOpera)
-		v = elm.style.cssText;
+		if (name == "style" && !tinyMCE.isOpera)
+			v = elm.style.cssText;
 
-	return (v && v != "") ? v : dv;
-};
+		return (v && v !== '') ? v : dv;
+	},
 
-TinyMCE_Engine.prototype.setAttrib = function(el, name, va, fix) {
-	if (typeof(va) == "number" && va != null)
-		va = "" + va;
+	setAttrib : function(el, name, va, fix) {
+		if (typeof(va) == "number" && va != null)
+			va = "" + va;
 
-	if (fix) {
-		if (va == null)
-			va = "";
+		if (fix) {
+			if (va == null)
+				va = "";
 
-		va = va.replace(/[^0-9%]/g, '');
-	}
+			va = va.replace(/[^0-9%]/g, '');
+		}
 
-	if (name == "style")
-		el.style.cssText = va;
+		if (name == "style")
+			el.style.cssText = va;
 
-	if (name == "class")
-		el.className = va;
+		if (name == "class")
+			el.className = va;
 
-	if (va != null && va != "" && va != -1)
-		el.setAttribute(name, va);
-	else
-		el.removeAttribute(name);
-};
+		if (va != null && va !== '' && va != -1)
+			el.setAttribute(name, va);
+		else
+			el.removeAttribute(name);
+	},
 
-TinyMCE_Engine.prototype.setStyleAttrib = function(e, n, v) {
-	e.style[n] = v;
+	setStyleAttrib : function(e, n, v) {
+		e.style[n] = v;
 
-	// Style attrib deleted in IE
-	if (tinyMCE.isIE && v == null || v == '') {
-		v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));
-		e.style.cssText = v;
-		e.setAttribute("style", v);
-	}
-};
+		// Style attrib deleted in IE
+		if (tinyMCE.isIE && v == null || v == '') {
+			v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));
+			e.style.cssText = v;
+			e.setAttribute("style", v);
+		}
+	},
 
-TinyMCE_Engine.prototype.switchClass = function(ei, c) {
-	var e;
+	switchClass : function(ei, c) {
+		var e;
 
-	if (tinyMCE.switchClassCache[ei])
-		e = tinyMCE.switchClassCache[ei];
-	else
-		e = tinyMCE.switchClassCache[ei] = document.getElementById(ei);
+		if (tinyMCE.switchClassCache[ei])
+			e = tinyMCE.switchClassCache[ei];
+		else
+			e = tinyMCE.switchClassCache[ei] = document.getElementById(ei);
 
-	if (e) {
-		// Keep tile mode
-		if (tinyMCE.settings.button_tile_map && e.className && e.className.indexOf('mceTiledButton') == 0)
-			c = 'mceTiledButton ' + c;
+		if (e) {
+			// Keep tile mode
+			if (tinyMCE.settings.button_tile_map && e.className && e.className.indexOf('mceTiledButton') == 0)
+				c = 'mceTiledButton ' + c;
 
-		e.className = c;
-	}
-};
+			e.className = c;
+		}
+	},
 
-TinyMCE_Engine.prototype.getAbsPosition = function(n, cn) {
-	var l = 0, t = 0;
+	getAbsPosition : function(n, cn) {
+		var l = 0, t = 0;
 
-	while (n && n != cn) {
-		l += n.offsetLeft;
-		t += n.offsetTop;
-		n = n.offsetParent;
-	}
+		while (n && n != cn) {
+			l += n.offsetLeft;
+			t += n.offsetTop;
+			n = n.offsetParent;
+		}
 
-	return {absLeft : l, absTop : t};
-};
+		return {absLeft : l, absTop : t};
+	},
 
-TinyMCE_Engine.prototype.prevNode = function(e, n) {
-	var a = n.split(','), i;
+	prevNode : function(e, n) {
+		var a = n.split(','), i;
 
-	while ((e = e.previousSibling) != null) {
-		for (i=0; i<a.length; i++) {
-			if (e.nodeName == a[i])
-				return e;
+		while ((e = e.previousSibling) != null) {
+			for (i=0; i<a.length; i++) {
+				if (e.nodeName == a[i])
+					return e;
+			}
 		}
-	}
 
-	return null;
-};
+		return null;
+	},
 
-TinyMCE_Engine.prototype.nextNode = function(e, n) {
-	var a = n.split(','), i;
+	nextNode : function(e, n) {
+		var a = n.split(','), i;
 
-	while ((e = e.nextSibling) != null) {
-		for (i=0; i<a.length; i++) {
-			if (e.nodeName == a[i])
-				return e;
+		while ((e = e.nextSibling) != null) {
+			for (i=0; i<a.length; i++) {
+				if (e.nodeName == a[i])
+					return e;
+			}
 		}
-	}
 
-	return null;
-};
+		return null;
+	},
 
-TinyMCE_Engine.prototype.selectElements = function(n, na, f) {
-	var i, a = [], nl, x;
+	selectElements : function(n, na, f) {
+		var i, a = [], nl, x;
 
-	for (x=0, na = na.split(','); x<na.length; x++)
-		for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
-			(!f || f(nl[i])) && a.push(nl[i]);
+		for (x=0, na = na.split(','); x<na.length; x++)
+			for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
+				(!f || f(nl[i])) && a.push(nl[i]);
 
-	return a;
-};
+		return a;
+	},
 
-TinyMCE_Engine.prototype.selectNodes = function(n, f, a) {
-	var i;
+	selectNodes : function(n, f, a) {
+		var i;
 
-	if (!a)
-		a = new Array();
+		if (!a)
+			a = [];
 
-	if (f(n))
-		a[a.length] = n;
+		if (f(n))
+			a[a.length] = n;
 
-	if (n.hasChildNodes()) {
-		for (i=0; i<n.childNodes.length; i++)
-			tinyMCE.selectNodes(n.childNodes[i], f, a);
-	}
+		if (n.hasChildNodes()) {
+			for (i=0; i<n.childNodes.length; i++)
+				tinyMCE.selectNodes(n.childNodes[i], f, a);
+		}
 
-	return a;
-};
+		return a;
+	},
 
-TinyMCE_Engine.prototype.addCSSClass = function(e, c, b) {
-	var o = this.removeCSSClass(e, c);
-	return e.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
-};
+	addCSSClass : function(e, c, b) {
+		var o = this.removeCSSClass(e, c);
+		return e.className = b ? c + (o !== '' ? (' ' + o) : '') : (o !== '' ? (o + ' ') : '') + c;
+	},
 
-TinyMCE_Engine.prototype.removeCSSClass = function(e, c) {
-	c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
-	return e.className = c != ' ' ? c : '';
-};
+	removeCSSClass : function(e, c) {
+		c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
+		return e.className = c != ' ' ? c : '';
+	},
 
-TinyMCE_Engine.prototype.hasCSSClass = function(n, c) {
-	return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
-};
+	hasCSSClass : function(n, c) {
+		return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
+	},
 
-TinyMCE_Engine.prototype.renameElement = function(e, n, d) {
-	var ne, i, ar;
+	renameElement : function(e, n, d) {
+		var ne, i, ar;
 
-	d = typeof(d) == "undefined" ? tinyMCE.selectedInstance.getDoc() : d;
+		d = typeof(d) == "undefined" ? tinyMCE.selectedInstance.getDoc() : d;
 
-	if (e) {
-		ne = d.createElement(n);
+		if (e) {
+			ne = d.createElement(n);
 
-		ar = e.attributes;
-		for (i=ar.length-1; i>-1; i--) {
-			if (ar[i].specified && ar[i].nodeValue)
-				ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue);
+			ar = e.attributes;
+			for (i=ar.length-1; i>-1; i--) {
+				if (ar[i].specified && ar[i].nodeValue)
+					ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue);
+			}
+
+			ar = e.childNodes;
+			for (i=0; i<ar.length; i++)
+				ne.appendChild(ar[i].cloneNode(true));
+
+			e.parentNode.replaceChild(ne, e);
 		}
+	},
 
-		ar = e.childNodes;
-		for (i=0; i<ar.length; i++)
-			ne.appendChild(ar[i].cloneNode(true));
+	getViewPort : function(w) {
+		var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement;
 
-		e.parentNode.replaceChild(ne, e);
-	}
-};
+		return {
+			left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft),
+			top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop),
+			width : w.innerWidth || (m ? de.clientWidth : b.clientWidth),
+			height : w.innerHeight || (m ? de.clientHeight : b.clientHeight)
+		};
+	},
 
-TinyMCE_Engine.prototype.getViewPort = function(w) {
-	var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement;
+	getStyle : function(n, na, d) {
+		if (!n)
+			return false;
 
-	return {
-		left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft),
-		top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop),
-		width : w.innerWidth || (m ? de.clientWidth : b.clientWidth),
-		height : w.innerHeight || (m ? de.clientHeight : b.clientHeight)
-	};
-};
+		// Gecko
+		if (tinyMCE.isGecko && n.ownerDocument.defaultView) {
+			try {
+				return n.ownerDocument.defaultView.getComputedStyle(n, null).getPropertyValue(na);
+			} catch (n) {
+				// Old safari might fail
+				return null;
+			}
+		}
 
-TinyMCE_Engine.prototype.getStyle = function(n, na, d) {
-	if (!n)
+		// Camelcase it, if needed
+		na = na.replace(/-(\D)/g, function(a, b){
+			return b.toUpperCase();
+		});
+
+		// IE & Opera
+		if (n.currentStyle)
+			return n.currentStyle[na];
+
 		return false;
-
-	// Gecko
-	if (tinyMCE.isGecko && n.ownerDocument.defaultView) {
-		try {
-			return n.ownerDocument.defaultView.getComputedStyle(n, null).getPropertyValue(na);
-		} catch (n) {
-			// Old safari might fail
-			return null;
-		}
 	}
 
-	// Camelcase it, if needed
-	na = na.replace(/-(\D)/g, function(a, b){
-		return b.toUpperCase();
 	});
 
-	// IE & Opera
-	if (n.currentStyle)
-		return n.currentStyle[na];
-
-	return false;
-};
-
 /* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */
 
-TinyMCE_Engine.prototype.parseURL = function(url_str) {
-	var urlParts = new Array();
+tinyMCE.add(TinyMCE_Engine, {
+	parseURL : function(url_str) {
+		var urlParts = [], i, pos, lastPos, chr;
 
-	if (url_str) {
-		var pos, lastPos;
+		if (url_str) {
+			// Parse protocol part
+			pos = url_str.indexOf('://');
+			if (pos != -1) {
+				urlParts.protocol = url_str.substring(0, pos);
+				lastPos = pos + 3;
+			}
 
-		// Parse protocol part
-		pos = url_str.indexOf('://');
-		if (pos != -1) {
-			urlParts['protocol'] = url_str.substring(0, pos);
-			lastPos = pos + 3;
-		}
+			// Find port or path start
+			for (i=lastPos; i<url_str.length; i++) {
+				chr = url_str.charAt(i);
 
-		// Find port or path start
-		for (var i=lastPos; i<url_str.length; i++) {
-			var chr = url_str.charAt(i);
+				if (chr == ':')
+					break;
 
-			if (chr == ':')
-				break;
+				if (chr == '/')
+					break;
+			}
+			pos = i;
 
-			if (chr == '/')
-				break;
-		}
-		pos = i;
+			// Get host
+			urlParts.host = url_str.substring(lastPos, pos);
 
-		// Get host
-		urlParts['host'] = url_str.substring(lastPos, pos);
+			// Get port
+			urlParts.port = "";
+			lastPos = pos;
+			if (url_str.charAt(pos) == ':') {
+				pos = url_str.indexOf('/', lastPos);
+				urlParts.port = url_str.substring(lastPos+1, pos);
+			}
 
-		// Get port
-		urlParts['port'] = "";
-		lastPos = pos;
-		if (url_str.charAt(pos) == ':') {
-			pos = url_str.indexOf('/', lastPos);
-			urlParts['port'] = url_str.substring(lastPos+1, pos);
-		}
+			// Get path
+			lastPos = pos;
+			pos = url_str.indexOf('?', lastPos);
 
-		// Get path
-		lastPos = pos;
-		pos = url_str.indexOf('?', lastPos);
+			if (pos == -1)
+				pos = url_str.indexOf('#', lastPos);
 
-		if (pos == -1)
-			pos = url_str.indexOf('#', lastPos);
+			if (pos == -1)
+				pos = url_str.length;
 
-		if (pos == -1)
-			pos = url_str.length;
+			urlParts.path = url_str.substring(lastPos, pos);
 
-		urlParts['path'] = url_str.substring(lastPos, pos);
+			// Get query
+			lastPos = pos;
+			if (url_str.charAt(pos) == '?') {
+				pos = url_str.indexOf('#');
+				pos = (pos == -1) ? url_str.length : pos;
+				urlParts.query = url_str.substring(lastPos+1, pos);
+			}
 
-		// Get query
-		lastPos = pos;
-		if (url_str.charAt(pos) == '?') {
-			pos = url_str.indexOf('#');
-			pos = (pos == -1) ? url_str.length : pos;
-			urlParts['query'] = url_str.substring(lastPos+1, pos);
+			// Get anchor
+			lastPos = pos;
+			if (url_str.charAt(pos) == '#') {
+				pos = url_str.length;
+				urlParts.anchor = url_str.substring(lastPos+1, pos);
+			}
 		}
 
-		// Get anchor
-		lastPos = pos;
-		if (url_str.charAt(pos) == '#') {
-			pos = url_str.length;
-			urlParts['anchor'] = url_str.substring(lastPos+1, pos);
-		}
-	}
+		return urlParts;
+	},
 
-	return urlParts;
-};
+	serializeURL : function(up) {
+		var o = "";
 
-TinyMCE_Engine.prototype.serializeURL = function(up) {
-	var o = "";
+		if (up.protocol)
+			o += up.protocol + "://";
 
-	if (up['protocol'])
-		o += up['protocol'] + "://";
+		if (up.host)
+			o += up.host;
 
-	if (up['host'])
-		o += up['host'];
+		if (up.port)
+			o += ":" + up.port;
 
-	if (up['port'])
-		o += ":" + up['port'];
+		if (up.path)
+			o += up.path;
 
-	if (up['path'])
-		o += up['path'];
+		if (up.query)
+			o += "?" + up.query;
 
-	if (up['query'])
-		o += "?" + up['query'];
+		if (up.anchor)
+			o += "#" + up.anchor;
 
-	if (up['anchor'])
-		o += "#" + up['anchor'];
+		return o;
+	},
 
-	return o;
-};
+	convertAbsoluteURLToRelativeURL : function(base_url, url_to_relative) {
+		var baseURL = this.parseURL(base_url), targetURL = this.parseURL(url_to_relative);
+		var i, strTok1, strTok2, breakPoint = 0, outPath = "", forceSlash = false;
+		var fileName, pos;
 
-TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL = function(base_url, url_to_relative) {
-	var baseURL = this.parseURL(base_url);
-	var targetURL = this.parseURL(url_to_relative);
-	var strTok1;
-	var strTok2;
-	var breakPoint = 0;
-	var outPath = "";
-	var forceSlash = false;
+		if (targetURL.path == '')
+			targetURL.path = "/";
+		else
+			forceSlash = true;
 
-	if (targetURL.path == "")
-		targetURL.path = "/";
-	else
-		forceSlash = true;
+		// Crop away last path part
+		base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/'));
+		strTok1 = base_url.split('/');
+		strTok2 = targetURL.path.split('/');
 
-	// Crop away last path part
-	base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/'));
-	strTok1 = base_url.split('/');
-	strTok2 = targetURL.path.split('/');
-
-	if (strTok1.length >= strTok2.length) {
-		for (var i=0; i<strTok1.length; i++) {
-			if (i >= strTok2.length || strTok1[i] != strTok2[i]) {
-				breakPoint = i + 1;
-				break;
+		if (strTok1.length >= strTok2.length) {
+			for (i=0; i<strTok1.length; i++) {
+				if (i >= strTok2.length || strTok1[i] != strTok2[i]) {
+					breakPoint = i + 1;
+					break;
+				}
 			}
 		}
-	}
 
-	if (strTok1.length < strTok2.length) {
-		for (var i=0; i<strTok2.length; i++) {
-			if (i >= strTok1.length || strTok1[i] != strTok2[i]) {
-				breakPoint = i + 1;
-				break;
+		if (strTok1.length < strTok2.length) {
+			for (i=0; i<strTok2.length; i++) {
+				if (i >= strTok1.length || strTok1[i] != strTok2[i]) {
+					breakPoint = i + 1;
+					break;
+				}
 			}
 		}
-	}
 
-	if (breakPoint == 1)
-		return targetURL.path;
+		if (breakPoint == 1)
+			return targetURL.path;
 
-	for (var i=0; i<(strTok1.length-(breakPoint-1)); i++)
-		outPath += "../";
+		for (i=0; i<(strTok1.length-(breakPoint-1)); i++)
+			outPath += "../";
 
-	for (var i=breakPoint-1; i<strTok2.length; i++) {
-		if (i != (breakPoint-1))
-			outPath += "/" + strTok2[i];
-		else
-			outPath += strTok2[i];
-	}
+		for (i=breakPoint-1; i<strTok2.length; i++) {
+			if (i != (breakPoint-1))
+				outPath += "/" + strTok2[i];
+			else
+				outPath += strTok2[i];
+		}
 
-	targetURL.protocol = null;
-	targetURL.host = null;
-	targetURL.port = null;
-	targetURL.path = outPath == "" && forceSlash ? "/" : outPath;
+		targetURL.protocol = null;
+		targetURL.host = null;
+		targetURL.port = null;
+		targetURL.path = outPath == '' && forceSlash ? "/" : outPath;
 
-	// Remove document prefix from local anchors
-	var fileName = baseURL.path;
-	var pos;
+		// Remove document prefix from local anchors
+		fileName = baseURL.path;
 
-	if ((pos = fileName.lastIndexOf('/')) != -1)
-		fileName = fileName.substring(pos + 1);
+		if ((pos = fileName.lastIndexOf('/')) != -1)
+			fileName = fileName.substring(pos + 1);
 
-	// Is local anchor
-	if (fileName == targetURL.path && targetURL.anchor != "")
-		targetURL.path = "";
+		// Is local anchor
+		if (fileName == targetURL.path && targetURL.anchor !== '')
+			targetURL.path = "";
 
-	// If empty and not local anchor force filename or slash
-	if (targetURL.path == "" && !targetURL.anchor)
-		targetURL.path = fileName != "" ? fileName : "/";
+		// If empty and not local anchor force filename or slash
+		if (targetURL.path == '' && !targetURL.anchor)
+			targetURL.path = fileName !== '' ? fileName : "/";
 
-	return this.serializeURL(targetURL);
-};
+		return this.serializeURL(targetURL);
+	},
 
-TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL = function(base_url, relative_url) {
-	var baseURL = this.parseURL(base_url), baseURLParts, relURLParts;
-	var relURL = this.parseURL(relative_url);
+	convertRelativeToAbsoluteURL : function(base_url, relative_url) {
+		var baseURL = this.parseURL(base_url), baseURLParts, relURLParts, newRelURLParts, numBack, relURL = this.parseURL(relative_url), i;
+		var len, absPath, start, end, newBaseURLParts;
 
-	if (relative_url == "" || relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url))
-		return relative_url;
+		if (relative_url == '' || relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url))
+			return relative_url;
 
-	// Split parts
-	baseURLParts = baseURL['path'].split('/');
-	relURLParts = relURL['path'].split('/');
+		// Split parts
+		baseURLParts = baseURL.path.split('/');
+		relURLParts = relURL.path.split('/');
 
-	// Remove empty chunks
-	var newBaseURLParts = new Array();
-	for (var i=baseURLParts.length-1; i>=0; i--) {
-		if (baseURLParts[i].length == 0)
-			continue;
+		// Remove empty chunks
+		newBaseURLParts = [];
+		for (i=baseURLParts.length-1; i>=0; i--) {
+			if (baseURLParts[i].length == 0)
+				continue;
 
-		newBaseURLParts[newBaseURLParts.length] = baseURLParts[i];
-	}
-	baseURLParts = newBaseURLParts.reverse();
+			newBaseURLParts[newBaseURLParts.length] = baseURLParts[i];
+		}
+		baseURLParts = newBaseURLParts.reverse();
 
-	// Merge relURLParts chunks
-	var newRelURLParts = new Array();
-	var numBack = 0;
-	for (var i=relURLParts.length-1; i>=0; i--) {
-		if (relURLParts[i].length == 0 || relURLParts[i] == ".")
-			continue;
+		// Merge relURLParts chunks
+		newRelURLParts = [];
+		numBack = 0;
+		for (i=relURLParts.length-1; i>=0; i--) {
+			if (relURLParts[i].length == 0 || relURLParts[i] == ".")
+				continue;
 
-		if (relURLParts[i] == '..') {
-			numBack++;
-			continue;
-		}
+			if (relURLParts[i] == '..') {
+				numBack++;
+				continue;
+			}
 
-		if (numBack > 0) {
-			numBack--;
-			continue;
+			if (numBack > 0) {
+				numBack--;
+				continue;
+			}
+
+			newRelURLParts[newRelURLParts.length] = relURLParts[i];
 		}
 
-		newRelURLParts[newRelURLParts.length] = relURLParts[i];
-	}
+		relURLParts = newRelURLParts.reverse();
 
-	relURLParts = newRelURLParts.reverse();
+		// Remove end from absolute path
+		len = baseURLParts.length-numBack;
+		absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/');
+		start = "";
+		end = "";
 
-	// Remove end from absolute path
-	var len = baseURLParts.length-numBack;
-	var absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/');
-	var start = "", end = "";
+		// Build output URL
+		relURL.protocol = baseURL.protocol;
+		relURL.host = baseURL.host;
+		relURL.port = baseURL.port;
 
-	// Build output URL
-	relURL.protocol = baseURL.protocol;
-	relURL.host = baseURL.host;
-	relURL.port = baseURL.port;
+		// Re-add trailing slash if it's removed
+		if (relURL.path.charAt(relURL.path.length-1) == "/")
+			absPath += "/";
 
-	// Re-add trailing slash if it's removed
-	if (relURL.path.charAt(relURL.path.length-1) == "/")
-		absPath += "/";
+		relURL.path = absPath;
 
-	relURL.path = absPath;
+		return this.serializeURL(relURL);
+	},
 
-	return this.serializeURL(relURL);
-};
+	convertURL : function(url, node, on_save) {
+		var dl = document.location, start, portPart, urlParts, baseUrlParts, tmpUrlParts, curl;
+		var prot = dl.protocol, host = dl.hostname, port = dl.port;
 
-TinyMCE_Engine.prototype.convertURL = function(url, node, on_save) {
-	var prot = document.location.protocol;
-	var host = document.location.hostname;
-	var port = document.location.port;
+		// Pass through file protocol
+		if (prot == "file:")
+			return url;
 
-	// Pass through file protocol
-	if (prot == "file:")
-		return url;
+		// Something is wrong, remove weirdness
+		url = tinyMCE.regexpReplace(url, '(http|https):///', '/');
 
-	// Something is wrong, remove weirdness
-	url = tinyMCE.regexpReplace(url, '(http|https):///', '/');
+		// Mailto link or anchor (Pass through)
+		if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || /^[ \t\r\n\+]*[#\?]/.test(url))
+			return url;
 
-	// Mailto link or anchor (Pass through)
-	if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0) == "#")
-		return url;
+		// Fix relative/Mozilla
+		if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')
+			return tinyMCE.settings.base_href + url;
 
-	// Fix relative/Mozilla
-	if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')
-		return tinyMCE.settings['base_href'] + url;
+		// Handle relative URLs
+		if (on_save && tinyMCE.getParam('relative_urls')) {
+			curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url);
+			if (curl.charAt(0) == '/')
+				curl = tinyMCE.settings.document_base_prefix + curl;
 
-	// Handle relative URLs
-	if (on_save && tinyMCE.getParam('relative_urls')) {
-		var curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], url);
-		if (curl.charAt(0) == '/')
-			curl = tinyMCE.settings['document_base_prefix'] + curl;
+			urlParts = tinyMCE.parseURL(curl);
+			tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings.document_base_url);
 
-		var urlParts = tinyMCE.parseURL(curl);
-		var tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings['document_base_url']);
+			// Force relative
+			if (urlParts.host == tmpUrlParts.host && (urlParts.port == tmpUrlParts.port))
+				return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url, curl);
+		}
 
-		// Force relative
-		if (urlParts['host'] == tmpUrlParts['host'] && (urlParts['port'] == tmpUrlParts['port']))
-			return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'], curl);
-	}
+		// Handle absolute URLs
+		if (!tinyMCE.getParam('relative_urls')) {
+			urlParts = tinyMCE.parseURL(url);
+			baseUrlParts = tinyMCE.parseURL(tinyMCE.settings.base_href);
 
-	// Handle absolute URLs
-	if (!tinyMCE.getParam('relative_urls')) {
-		var urlParts = tinyMCE.parseURL(url);
-		var baseUrlParts = tinyMCE.parseURL(tinyMCE.settings['base_href']);
+			// Force absolute URLs from relative URLs
+			url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url);
 
-		// Force absolute URLs from relative URLs
-		url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], url);
+			// If anchor and path is the same page
+			if (urlParts.anchor && urlParts.path == baseUrlParts.path)
+				return "#" + urlParts.anchor;
+		}
 
-		// If anchor and path is the same page
-		if (urlParts['anchor'] && urlParts['path'] == baseUrlParts['path'])
-			return "#" + urlParts['anchor'];
-	}
+		// Remove current domain
+		if (tinyMCE.getParam('remove_script_host')) {
+			start = "";
+			portPart = "";
 
-	// Remove current domain
-	if (tinyMCE.getParam('remove_script_host')) {
-		var start = "", portPart = "";
+			if (port !== '')
+				portPart = ":" + port;
 
-		if (port != "")
-			portPart = ":" + port;
+			start = prot + "//" + host + portPart + "/";
 
-		start = prot + "//" + host + portPart + "/";
+			if (url.indexOf(start) == 0)
+				url = url.substring(start.length-1);
+		}
 
-		if (url.indexOf(start) == 0)
-			url = url.substring(start.length-1);
-	}
+		return url;
+	},
 
-	return url;
-};
+	convertAllRelativeURLs : function(body) {
+		var i, elms, src, href, mhref, msrc;
 
-TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) {
-	var i, elms, src, href, mhref, msrc;
+		// Convert all image URL:s to absolute URL
+		elms = body.getElementsByTagName("img");
+		for (i=0; i<elms.length; i++) {
+			src = tinyMCE.getAttrib(elms[i], 'src');
 
-	// Convert all image URL:s to absolute URL
-	elms = body.getElementsByTagName("img");
-	for (i=0; i<elms.length; i++) {
-		src = tinyMCE.getAttrib(elms[i], 'src');
+			msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
+			if (msrc !== '')
+				src = msrc;
 
-		msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
-		if (msrc != "")
-			src = msrc;
-
-		if (src != "") {
-			src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src);
-			elms[i].setAttribute("src", src);
+			if (src !== '') {
+				src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, src);
+				elms[i].setAttribute("src", src);
+			}
 		}
-	}
 
-	// Convert all link URL:s to absolute URL
-	elms = body.getElementsByTagName("a");
-	for (i=0; i<elms.length; i++) {
-		href = tinyMCE.getAttrib(elms[i], 'href');
+		// Convert all link URL:s to absolute URL
+		elms = body.getElementsByTagName("a");
+		for (i=0; i<elms.length; i++) {
+			href = tinyMCE.getAttrib(elms[i], 'href');
 
-		mhref = tinyMCE.getAttrib(elms[i], 'mce_href');
-		if (mhref != "")
-			href = mhref;
+			mhref = tinyMCE.getAttrib(elms[i], 'mce_href');
+			if (mhref !== '')
+				href = mhref;
 
-		if (href && href != "") {
-			href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], href);
-			elms[i].setAttribute("href", href);
+			if (href && href !== '') {
+				href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, href);
+				elms[i].setAttribute("href", href);
+			}
 		}
 	}
-};
 
+	});
+
 /* file:jscripts/tiny_mce/classes/TinyMCE_Array.class.js */
 
-TinyMCE_Engine.prototype.clearArray = function(a) {
-	var n;
+tinyMCE.add(TinyMCE_Engine, {
+	clearArray : function(a) {
+		var n;
 
-	for (n in a)
-		a[n] = null;
+		for (n in a)
+			a[n] = null;
 
-	return a;
-};
+		return a;
+	},
 
-TinyMCE_Engine.prototype.explode = function(d, s) {
-	var ar = s.split(d), oar = new Array(), i;
+	explode : function(d, s) {
+		var ar = s.split(d), oar = [], i;
 
-	for (i = 0; i<ar.length; i++) {
-		if (ar[i] != "")
-			oar[oar.length] = ar[i];
+		for (i = 0; i<ar.length; i++) {
+			if (ar[i] !== '')
+				oar[oar.length] = ar[i];
+		}
+
+		return oar;
 	}
+});
 
-	return oar;
-};
-
 /* file:jscripts/tiny_mce/classes/TinyMCE_Event.class.js */
 
-TinyMCE_Engine.prototype._setEventsEnabled = function(node, state) {
-	var evs, x, y, elms, i, event;
-	var events = ['onfocus','onblur','onclick','ondblclick',
-				'onmousedown','onmouseup','onmouseover','onmousemove',
-				'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];
+tinyMCE.add(TinyMCE_Engine, {
+	_setEventsEnabled : function(node, state) {
+		var evs, x, y, elms, i, event;
+		var events = ['onfocus','onblur','onclick','ondblclick',
+					'onmousedown','onmouseup','onmouseover','onmousemove',
+					'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];
 
-	evs = tinyMCE.settings['event_elements'].split(',');
-	for (y=0; y<evs.length; y++){
-		elms = node.getElementsByTagName(evs[y]);
-		for (i=0; i<elms.length; i++) {
-			event = "";
+		evs = tinyMCE.settings.event_elements.split(',');
+		for (y=0; y<evs.length; y++){
+			elms = node.getElementsByTagName(evs[y]);
+			for (i=0; i<elms.length; i++) {
+				event = "";
 
-			for (x=0; x<events.length; x++) {
-				if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {
-					event = tinyMCE.cleanupEventStr("" + event);
+				for (x=0; x<events.length; x++) {
+					if ((event = tinyMCE.getAttrib(elms[i], events[x])) !== '') {
+						event = tinyMCE.cleanupEventStr("" + event);
 
-					if (!state)
-						event = "return true;" + event;
-					else
-						event = event.replace(/^return true;/gi, '');
+						if (!state)
+							event = "return true;" + event;
+						else
+							event = event.replace(/^return true;/gi, '');
 
-					elms[i].removeAttribute(events[x]);
-					elms[i].setAttribute(events[x], event);
+						elms[i].removeAttribute(events[x]);
+						elms[i].setAttribute(events[x], event);
+					}
 				}
 			}
 		}
-	}
-};
+	},
 
-TinyMCE_Engine.prototype._eventPatch = function(editor_id) {
-	var n, inst, win, e;
+	_eventPatch : function(editor_id) {
+		var n, inst, win, e;
 
-	// Remove odd, error
-	if (typeof(tinyMCE) == "undefined")
-		return true;
+		// Remove odd, error
+		if (typeof(tinyMCE) == "undefined")
+			return true;
 
-	try {
-		// Try selected instance first
-		if (tinyMCE.selectedInstance) {
-			win = tinyMCE.selectedInstance.getWin();
+		try {
+			// Try selected instance first
+			if (tinyMCE.selectedInstance) {
+				win = tinyMCE.selectedInstance.getWin();
 
-			if (win && win.event) {
-				e = win.event;
+				if (win && win.event) {
+					e = win.event;
 
-				if (!e.target)
-					e.target = e.srcElement;
+					if (!e.target)
+						e.target = e.srcElement;
 
-				TinyMCE_Engine.prototype.handleEvent(e);
-				return;
+					TinyMCE_Engine.prototype.handleEvent(e);
+					return;
+				}
 			}
-		}
 
-		// Search for it
-		for (n in tinyMCE.instances) {
-			inst = tinyMCE.instances[n];
+			// Search for it
+			for (n in tinyMCE.instances) {
+				inst = tinyMCE.instances[n];
 
-			if (!tinyMCE.isInstance(inst))
-				continue;
+				if (!tinyMCE.isInstance(inst))
+					continue;
 
-			inst.select();
-			win = inst.getWin();
+				inst.select();
+				win = inst.getWin();
 
-			if (win && win.event) {
-				e = win.event;
+				if (win && win.event) {
+					e = win.event;
 
-				if (!e.target)
-					e.target = e.srcElement;
+					if (!e.target)
+						e.target = e.srcElement;
 
-				TinyMCE_Engine.prototype.handleEvent(e);
-				return;
+					TinyMCE_Engine.prototype.handleEvent(e);
+					return;
+				}
 			}
+		} catch (ex) {
+			// Ignore error if iframe is pointing to external URL
 		}
-	} catch (ex) {
-		// Ignore error if iframe is pointing to external URL
-	}
-};
+	},
 
-TinyMCE_Engine.prototype.findEvent = function(e) {
-	var n, inst;
+	findEvent : function(e) {
+		var n, inst;
 
-	if (e)
-		return e;
+		if (e)
+			return e;
 
-	for (n in tinyMCE.instances) {
-		inst = tinyMCE.instances[n];
+		for (n in tinyMCE.instances) {
+			inst = tinyMCE.instances[n];
 
-		if (tinyMCE.isInstance(inst) && inst.getWin().event)
-			return inst.getWin().event;
-	}
+			if (tinyMCE.isInstance(inst) && inst.getWin().event)
+				return inst.getWin().event;
+		}
 
-	return null;
-};
+		return null;
+	},
 
-TinyMCE_Engine.prototype.unloadHandler = function() {
-	tinyMCE.triggerSave(true, true);
-};
+	unloadHandler : function() {
+		tinyMCE.triggerSave(true, true);
+	},
 
-TinyMCE_Engine.prototype.addEventHandlers = function(inst) {
-	this.setEventHandlers(inst, 1);
-};
+	addEventHandlers : function(inst) {
+		this.setEventHandlers(inst, 1);
+	},
 
-TinyMCE_Engine.prototype.setEventHandlers = function(inst, s) {
-	var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent;
+	setEventHandlers : function(inst, s) {
+		var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent;
 
-	ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick'];
-	ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop'];
+		ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick'];
+		ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop'];
 
-	inst.switchSettings();
+		inst.switchSettings();
 
-	if (tinyMCE.isIE) {
-		for (i=0; i<ie.length; i++)
-			f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch);
-	} else {
-		for (i=0; i<ot.length; i++)
-			f(doc, ot[i], tinyMCE.handleEvent);
+		if (tinyMCE.isIE) {
+			for (i=0; i<ie.length; i++)
+				f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch);
+		} else {
+			for (i=0; i<ot.length; i++)
+				f(doc, ot[i], tinyMCE.handleEvent);
 
-		// Force designmode
-		try {
-			doc.designMode = "On";
-		} catch (e) {
-			// Ignore
+			// Force designmode
+			try {
+				doc.designMode = "On";
+			} catch (e) {
+				// Ignore
+			}
 		}
-	}
-};
+	},
 
-TinyMCE_Engine.prototype.onMouseMove = function() {
-	var inst, lh;
+	onMouseMove : function() {
+		var inst, lh;
 
-	// Fix for IE7 bug where it's not restoring hover on anchors correctly
-	if (tinyMCE.lastHover) {
-		lh = tinyMCE.lastHover;
+		// Fix for IE7 bug where it's not restoring hover on anchors correctly
+		if (tinyMCE.lastHover) {
+			lh = tinyMCE.lastHover;
 
-		// Call out on menus and refresh class on normal buttons
-		if (lh.className.indexOf('mceMenu') != -1)
-			tinyMCE._menuButtonEvent('out', lh);
-		else
-			lh.className = lh.className;
+			// Call out on menus and refresh class on normal buttons
+			if (lh.className.indexOf('mceMenu') != -1)
+				tinyMCE._menuButtonEvent('out', lh);
+			else
+				lh.className = lh.className;
 
-		tinyMCE.lastHover = null;
-	}
+			tinyMCE.lastHover = null;
+		}
 
-	if (!tinyMCE.hasMouseMoved) {
-		inst = tinyMCE.selectedInstance;
+		if (!tinyMCE.hasMouseMoved) {
+			inst = tinyMCE.selectedInstance;
 
-		// Workaround for bug #1437457 (Odd MSIE bug)
-		if (inst.isFocused) {
-			inst.undoBookmark = inst.selection.getBookmark();
-			tinyMCE.hasMouseMoved = true;
+			// Workaround for bug #1437457 (Odd MSIE bug)
+			if (inst.isFocused) {
+				inst.undoBookmark = inst.selection.getBookmark();
+				tinyMCE.hasMouseMoved = true;
+			}
 		}
-	}
 
-//	tinyMCE.cancelEvent(inst.getWin().event);
-//	return false;
-};
+	//	tinyMCE.cancelEvent(inst.getWin().event);
+	//	return false;
+	},
 
-TinyMCE_Engine.prototype.cancelEvent = function(e) {
-	if (!e)
-		return false;
+	cancelEvent : function(e) {
+		if (!e)
+			return false;
 
-	if (tinyMCE.isIE) {
-		e.returnValue = false;
-		e.cancelBubble = true;
-	} else {
-		e.preventDefault();
-		e.stopPropagation && e.stopPropagation();
-	}
+		if (tinyMCE.isIE) {
+			e.returnValue = false;
+			e.cancelBubble = true;
+		} else {
+			e.preventDefault();
+			e.stopPropagation && e.stopPropagation();
+		}
 
-	return false;
-};
+		return false;
+	},
 
-TinyMCE_Engine.prototype.addEvent = function(o, n, h) {
-	// Add cleanup for all non unload events
-	if (n != 'unload') {
-		function clean() {
-			var ex;
+	addEvent : function(o, n, h) {
+		// Add cleanup for all non unload events
+		if (n != 'unload') {
+			function clean() {
+				var ex;
 
-			try {
-				tinyMCE.removeEvent(o, n, h);
-				tinyMCE.removeEvent(window, 'unload', clean);
-				o = n = h = null;
-			} catch (ex) {
-				// IE may produce access denied exception on unload
+				try {
+					tinyMCE.removeEvent(o, n, h);
+					tinyMCE.removeEvent(window, 'unload', clean);
+					o = n = h = null;
+				} catch (ex) {
+					// IE may produce access denied exception on unload
+				}
 			}
+
+			// Add memory cleaner
+			tinyMCE.addEvent(window, 'unload', clean);
 		}
 
-		// Add memory cleaner
-		tinyMCE.addEvent(window, 'unload', clean);
-	}
+		if (o.attachEvent)
+			o.attachEvent("on" + n, h);
+		else
+			o.addEventListener(n, h, false);
+	},
 
-	if (o.attachEvent)
-		o.attachEvent("on" + n, h);
-	else
-		o.addEventListener(n, h, false);
-};
+	removeEvent : function(o, n, h) {
+		if (o.detachEvent)
+			o.detachEvent("on" + n, h);
+		else
+			o.removeEventListener(n, h, false);
+	},
 
-TinyMCE_Engine.prototype.removeEvent = function(o, n, h) {
-	if (o.detachEvent)
-		o.detachEvent("on" + n, h);
-	else
-		o.removeEventListener(n, h, false);
-};
+	addSelectAccessibility : function(e, s, w) {
+		// Add event handlers 
+		if (!s._isAccessible) {
+			s.onkeydown = tinyMCE.accessibleEventHandler;
+			s.onblur = tinyMCE.accessibleEventHandler;
+			s._isAccessible = true;
+			s._win = w;
+		}
 
-TinyMCE_Engine.prototype.addSelectAccessibility = function(e, s, w) {
-	// Add event handlers 
-	if (!s._isAccessible) {
-		s.onkeydown = tinyMCE.accessibleEventHandler;
-		s.onblur = tinyMCE.accessibleEventHandler;
-		s._isAccessible = true;
-		s._win = w;
-	}
+		return false;
+	},
 
-	return false;
-};
+	accessibleEventHandler : function(e) {
+		var elm, win = this._win;
 
-TinyMCE_Engine.prototype.accessibleEventHandler = function(e) {
-	var win = this._win;
-	e = tinyMCE.isIE ? win.event : e;
-	var elm = tinyMCE.isIE ? e.srcElement : e.target;
+		e = tinyMCE.isIE ? win.event : e;
+		elm = tinyMCE.isIE ? e.srcElement : e.target;
 
-	// Unpiggyback onchange on blur
-	if (e.type == "blur") {
-		if (elm.oldonchange) {
+		// Unpiggyback onchange on blur
+		if (e.type == "blur") {
+			if (elm.oldonchange) {
+				elm.onchange = elm.oldonchange;
+				elm.oldonchange = null;
+			}
+
+			return true;
+		}
+
+		// Piggyback onchange
+		if (elm.nodeName == "SELECT" && !elm.oldonchange) {
+			elm.oldonchange = elm.onchange;
+			elm.onchange = null;
+		}
+
+		// Execute onchange and remove piggyback
+		if (e.keyCode == 13 || e.keyCode == 32) {
 			elm.onchange = elm.oldonchange;
+			elm.onchange();
 			elm.oldonchange = null;
+
+			tinyMCE.cancelEvent(e);
+			return false;
 		}
 
 		return true;
-	}
+	},
 
-	// Piggyback onchange
-	if (elm.nodeName == "SELECT" && !elm.oldonchange) {
-		elm.oldonchange = elm.onchange;
-		elm.onchange = null;
-	}
+	_resetIframeHeight : function() {
+		var ife;
 
-	// Execute onchange and remove piggyback
-	if (e.keyCode == 13 || e.keyCode == 32) {
-		elm.onchange = elm.oldonchange;
-		elm.onchange();
-		elm.oldonchange = null;
+		if (tinyMCE.isRealIE) {
+			ife = tinyMCE.selectedInstance.iframeElement;
 
-		tinyMCE.cancelEvent(e);
-		return false;
-	}
+	/*		if (ife._oldWidth) {
+				ife.style.width = ife._oldWidth;
+				ife.width = ife._oldWidth;
+			}*/
 
-	return true;
-};
-
-TinyMCE_Engine.prototype._resetIframeHeight = function() {
-	var ife;
-
-	if (tinyMCE.isRealIE) {
-		ife = tinyMCE.selectedInstance.iframeElement;
-
-/*		if (ife._oldWidth) {
-			ife.style.width = ife._oldWidth;
-			ife.width = ife._oldWidth;
-		}*/
-
-		if (ife._oldHeight) {
-			ife.style.height = ife._oldHeight;
-			ife.height = ife._oldHeight;
+			if (ife._oldHeight) {
+				ife.style.height = ife._oldHeight;
+				ife.height = ife._oldHeight;
+			}
 		}
 	}
-};
 
+	});
+
 /* file:jscripts/tiny_mce/classes/TinyMCE_Selection.class.js */
 
 function TinyMCE_Selection(inst) {
@@ -6190,8 +6330,7 @@
 
 TinyMCE_Selection.prototype = {
 	getSelectedHTML : function() {
-		var inst = this.instance;
-		var e, r = this.getRng(), h;
+		var inst = this.instance, e, r = this.getRng(), h;
 
 		if (!r)
 			return null;
@@ -6215,8 +6354,7 @@
 	},
 
 	getSelectedText : function() {
-		var inst = this.instance;
-		var d, r, s, t;
+		var inst = this.instance, d, r, s, t;
 
 		if (tinyMCE.isIE) {
 			d = inst.getDoc();
@@ -6239,19 +6377,17 @@
 	},
 
 	getBookmark : function(simple) {
-		var inst = this.instance;
-		var rng = this.getRng();
-		var doc = inst.getDoc(), b = inst.getBody();
+		var inst = this.instance, rng = this.getRng(), doc = inst.getDoc(), b = inst.getBody();
+		var trng, sx, sy, xx = -999999999, vp = inst.getViewPort();
 		var sp, le, s, e, nl, i, si, ei, w;
-		var trng, sx, sy, xx = -999999999, vp = inst.getViewPort();
 
 		sx = vp.left;
 		sy = vp.top;
 
-		if (tinyMCE.isSafari || tinyMCE.isOpera || simple)
+		if (simple)
 			return {rng : rng, scrollX : sx, scrollY : sy};
 
-		if (tinyMCE.isIE) {
+		if (tinyMCE.isRealIE) {
 			if (rng.item) {
 				e = rng.item(0);
 
@@ -6290,9 +6426,7 @@
 					scrollY : sy
 				};
 			}
-		}
-
-		if (tinyMCE.isGecko) {
+		} else {
 			s = this.getSel();
 			e = this.getFocusElement();
 
@@ -6349,16 +6483,13 @@
 	},
 
 	moveToBookmark : function(bookmark) {
-		var inst = this.instance;
-		var rng, nl, i, ex, b = inst.getBody(), sd;
-		var doc = inst.getDoc();
-		var win = inst.getWin();
-		var sel = this.getSel();
+		var inst = this.instance, rng, nl, i, ex, b = inst.getBody(), sd;
+		var doc = inst.getDoc(), win = inst.getWin(), sel = this.getSel();
 
 		if (!bookmark)
 			return false;
 
-		if (tinyMCE.isSafari) {
+		if (tinyMCE.isSafari && bookmark.rng) {
 			sel.setBaseAndExtent(bookmark.rng.startContainer, bookmark.rng.startOffset, bookmark.rng.endContainer, bookmark.rng.endOffset);
 			return true;
 		}
@@ -6428,7 +6559,9 @@
 					rng.setEnd(sd.endNode, sd.endOffset);
 					sel.removeAllRanges();
 					sel.addRange(rng);
-					win.focus();
+
+					if (!tinyMCE.isOpera)
+						win.focus();
 				} catch (ex) {
 					// Ignore
 				}
@@ -6549,7 +6682,7 @@
 
 			if (select_text_node) {
 				// Find first textnode in tree
-				nodes = tinyMCE.getNodeTree(node, new Array(), 3);
+				nodes = tinyMCE.getNodeTree(node, [], 3);
 				if (nodes.length > 0)
 					rng.selectNodeContents(nodes[0]);
 				else
@@ -6706,7 +6839,7 @@
 
 function TinyMCE_UndoRedo(inst) {
 	this.instance = inst;
-	this.undoLevels = new Array();
+	this.undoLevels = [];
 	this.undoIndex = 0;
 	this.typingUndoIndex = -1;
 	this.undoRedo = true;
@@ -6732,10 +6865,13 @@
 		if (this.undoLevels[this.undoIndex] && newHTML != this.undoLevels[this.undoIndex].content) {
 			//tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex].content);
 
+			// Is dirty again
+			inst.isNotDirty = false;
+
 			tinyMCE.dispatchCallback(inst, 'onchange_callback', 'onChange', inst);
 
 			// Time to compress
-			customUndoLevels = tinyMCE.settings['custom_undo_redo_levels'];
+			customUndoLevels = tinyMCE.settings.custom_undo_redo_levels;
 			if (customUndoLevels != -1 && this.undoLevels.length > customUndoLevels) {
 				for (i=0; i<this.undoLevels.length-1; i++)
 					this.undoLevels[i] = this.undoLevels[i+1];
@@ -6822,11 +6958,13 @@
 		var doc = inst.getDoc(), sel = inst.getSel(), body = inst.getBody(), win = inst.contentWindow, rng = sel.getRangeAt(0);
 		var rootElm = doc.documentElement, blockName = "P", startNode, endNode, startBlock, endBlock;
 		var rngBefore, rngAfter, direct, startNode, startOffset, endNode, endOffset, b = tinyMCE.isOpera ? inst.selection.getBookmark() : null;
-		var paraBefore, paraAfter, startChop, endChop, contents;
+		var paraBefore, paraAfter, startChop, endChop, contents, i;
 
 		function isEmpty(para) {
+			var nodes;
+
 			function isEmptyHTML(html) {
-				return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == "";
+				return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == '';
 			}
 
 			// Check for images
@@ -6842,8 +6980,8 @@
 				return false;
 
 			// Check all textnodes
-			var nodes = tinyMCE.getNodeTree(para, new Array(), 3);
-			for (var i=0; i<nodes.length; i++) {
+			nodes = tinyMCE.getNodeTree(para, [], 3);
+			for (i=0; i<nodes.length; i++) {
 				if (!isEmptyHTML(nodes[i].nodeValue))
 					return false;
 			}
@@ -6873,6 +7011,7 @@
 		endNode = direct ? sel.focusNode : sel.anchorNode;
 		endOffset = direct ? sel.focusOffset : sel.anchorOffset;
 
+		startNode = startNode.nodeName == "HTML" ? doc.body : startNode; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes
 		startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode;
 		endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode;
 
@@ -6881,10 +7020,10 @@
 		endBlock = inst.getParentBlockElement(endNode);
 
 		// If absolute force paragraph generation within
-		if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position))
+		if (startBlock && (startBlock.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(startBlock.style.position)))
 			startBlock = null;
 
-		if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position))
+		if (endBlock && (endBlock.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(endBlock.style.position)))
 			endBlock = null;
 
 		// Use current block name
@@ -6892,7 +7031,7 @@
 			blockName = startBlock.nodeName;
 
 			// Use P instead
-			if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat)))
+			if (/(TD|TABLE|TH|CAPTION)/.test(blockName) || (blockName == "DIV" && /left|right/gi.test(startBlock.style.cssFloat)))
 				blockName = "P";
 		}
 
@@ -7031,7 +7170,7 @@
 
 		if (contents.firstChild && contents.firstChild.nodeName == blockName) {
 	/*		var nodes = contents.firstChild.childNodes;
-			for (var i=0; i<nodes.length; i++) {
+			for (i=0; i<nodes.length; i++) {
 				//tinyMCE.debug(nodes[i].nodeName);
 				if (nodes[i].nodeName != "BODY")
 					paraAfter.appendChild(nodes[i]);
@@ -7126,13 +7265,9 @@
 
 TinyMCE_Layer.prototype = {
 	moveRelativeTo : function(re, p) {
-		var rep = this.getAbsPosition(re);
-		var w = parseInt(re.offsetWidth);
-		var h = parseInt(re.offsetHeight);
-		var e = this.getElement();
-		var ew = parseInt(e.offsetWidth);
-		var eh = parseInt(e.offsetHeight);
-		var x, y;
+		var rep = this.getAbsPosition(re), e = this.getElement(), x, y;
+		var w = parseInt(re.offsetWidth), h = parseInt(re.offsetHeight);
+		var ew = parseInt(e.offsetWidth), eh = parseInt(e.offsetHeight);
 
 		switch (p) {
 			case "tl":
@@ -7342,7 +7477,7 @@
 	TinyMCE_Layer.call(this, id, true);
 
 	this.id = id;
-	this.items = new Array();
+	this.items = [];
 	this.needsUpdate = true;
 };
 
@@ -7366,7 +7501,7 @@
 	},
 
 	clear : function() {
-		this.items = new Array();
+		this.items = [];
 	},
 
 	addTitle : function(t) {
@@ -7456,37 +7591,22 @@
 
 	});
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Compatibility.class.js */
+/* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */
 
-if (!Function.prototype.call) {
-	Function.prototype.call = function() {
-		var a = arguments, s = a[0], i, as = '', r, o;
+tinyMCE.add(TinyMCE_Engine, {
+	debug : function() {
+		var m = "", a, i, l = tinyMCE.log.length;
 
-		for (i=1; i<a.length; i++)
-			as += (i > 1 ? ',' : '') + 'a[' + i + ']';
+		for (i=0, a = this.debug.arguments; i<a.length; i++) {
+			m += a[i];
 
-		o = s._fu;
-		s._fu = this;
-		r = eval('s._fu(' + as + ')');
-		s._fu = o;
+			if (i<a.length-1)
+				m += ', ';
+		}
 
-		return r;
-	};
-};
-
-/* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */
-
-TinyMCE_Engine.prototype.debug = function() {
-	var m = "", a, i, l = tinyMCE.log.length;
-
-	for (i=0, a = this.debug.arguments; i<a.length; i++) {
-		m += a[i];
-
-		if (i<a.length-1)
-			m += ', ';
+		if (l < 1000)
+			tinyMCE.log[l] = "[debug] " + m;
 	}
 
-	if (l < 1000)
-		tinyMCE.log[l] = "[debug] " + m;
-};
+	});
 

Modified: plog/trunk/js/tinymce/utils/editable_selects.js
===================================================================
--- plog/trunk/js/tinymce/utils/editable_selects.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/utils/editable_selects.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,10 +1,10 @@
 /**
- * $Id: editable_selects.js 18 2006-06-29 14:11:23Z spocke $
+ * $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $
  *
  * Makes select boxes editable.
  *
  * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 var TinyMCE_EditableSelects = {

Modified: plog/trunk/js/tinymce/utils/form_utils.js
===================================================================
--- plog/trunk/js/tinymce/utils/form_utils.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/utils/form_utils.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,10 +1,10 @@
 /**
- * $Id: form_utils.js 43 2006-08-08 16:10:07Z spocke $
+ * $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $
  *
  * Various form utilitiy functions.
  *
  * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");

Modified: plog/trunk/js/tinymce/utils/mclayer.js
===================================================================
--- plog/trunk/js/tinymce/utils/mclayer.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/utils/mclayer.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,10 +1,10 @@
 /**
- * $Id: mclayer.js 18 2006-06-29 14:11:23Z spocke $
+ * $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $
  *
  * Moxiecode floating layer script.
  *
  * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 function MCLayer(id) {

Modified: plog/trunk/js/tinymce/utils/mctabs.js
===================================================================
--- plog/trunk/js/tinymce/utils/mctabs.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/utils/mctabs.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,10 +1,10 @@
 /**
- * $Id: mctabs.js 18 2006-06-29 14:11:23Z spocke $
+ * $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $
  *
  * Moxiecode DHTML Tabs script.
  *
  * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 function MCTabs() {

Modified: plog/trunk/js/tinymce/utils/validate.js
===================================================================
--- plog/trunk/js/tinymce/utils/validate.js	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/js/tinymce/utils/validate.js	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,10 +1,10 @@
 /**
- * $Id: validate.js 65 2006-08-24 15:54:55Z spocke $
+ * $Id: validate.js 162 2007-01-03 16:16:52Z spocke $
  *
  * Various form validation methods.
  *
  * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 /**

Modified: plog/trunk/locale/admin/locale_ca_ES.php
===================================================================
--- plog/trunk/locale/admin/locale_ca_ES.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_ca_ES.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1213,4 +1213,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/admin/locale_de_DE.php
===================================================================
--- plog/trunk/locale/admin/locale_de_DE.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_de_DE.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1197,4 +1197,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>

Modified: plog/trunk/locale/admin/locale_en_UK.php
===================================================================
--- plog/trunk/locale/admin/locale_en_UK.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_en_UK.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1174,8 +1174,15 @@
 
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
-$messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is advisable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
 
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
+
 /// new strings in LT 1.3 ///
 // friend management
 $messages['friendManagement'] = 'Friends';

Modified: plog/trunk/locale/admin/locale_es_ES.php
===================================================================
--- plog/trunk/locale/admin/locale_es_ES.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_es_ES.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1204,4 +1204,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/admin/locale_fr_FR.php
===================================================================
--- plog/trunk/locale/admin/locale_fr_FR.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_fr_FR.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -996,4 +996,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/admin/locale_gl_ES.php
===================================================================
--- plog/trunk/locale/admin/locale_gl_ES.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_gl_ES.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1213,4 +1213,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>
\ No newline at end of file

Copied: plog/trunk/locale/admin/locale_hu_HU.php (from rev 5900, plog/branches/lifetype-1.2/locale/admin/locale_hu_HU.php)
===================================================================
--- plog/trunk/locale/admin/locale_hu_HU.php	                        (rev 0)
+++ plog/trunk/locale/admin/locale_hu_HU.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -0,0 +1,1202 @@
+<?php
+
+/////////////////                                          //////////////////
+///////////////// STRINGS FOR THE ADMINISTRATION INTERFACE //////////////////
+/////////////////                                          //////////////////
+
+// login page
+$messages['login'] = 'Login';
+$messages['welcome_message'] = 'Welcome to LifeType';
+$messages['error_incorrect_username_or_password'] = 'Sorry, Incorrect username or password.';
+$messages['error_dont_belong_to_any_blog'] = 'Sorry, you do not belong to any blog yet.';
+$messages['logout_message'] = 'You have been successfully logged out.';
+$messages['logout_message_2'] = 'Click <a href="%1$s">here</a> to go to %2$s.';
+$messages['error_access_forbidden'] = 'Access is forbidden. You must authenticate first here.';
+$messages['username'] = 'Username';
+$messages['password'] = 'Password';
+
+// dashboard
+$messages['dashboard'] = 'Dashboard';
+$messages['recent_articles'] = 'Most Recent Articles';
+$messages['recent_comments'] = 'Most Recent Comments';
+$messages['recent_trackbacks'] = 'Most Recent Trackbacks';
+$messages['blog_statistics'] = 'Blog Statistics';
+$messages['total_posts'] = 'Total Posts';
+$messages['total_comments'] = 'Total Comments';
+$messages['total_trackbacks'] = 'Total Trackbacks';
+$messages['total_viewed'] = 'Total Viewed Posts';
+$messages['in'] = 'In';
+
+// menu options
+$messages['newPost'] = 'New Post';
+$messages['Manage'] = 'Manage';
+$messages['managePosts'] = 'Manage Posts';
+$messages['editPosts'] = 'Posts';
+$messages['editArticleCategories'] = 'Categories';
+$messages['newArticleCategory'] = 'New Category';
+$messages['manageLinks'] = 'Manage Links';
+$messages['editLinks'] = 'Links';
+$messages['newLink'] = 'New Link';
+$messages['editLink'] = 'Edit Link';
+$messages['editLinkCategories'] = 'Link Categories';
+$messages['newLinkCategory'] = 'New Link Category';
+$messages['editLinkCategory'] = 'Edit Link Category';
+$messages['manageCustomFields'] = 'Manage Custom Fields';
+$messages['blogCustomFields'] = 'Custom Fields';
+$messages['newCustomField'] = 'New Custom Field';
+$messages['resourceCenter'] = 'Resource Centre';
+$messages['resources'] = 'Resources';
+$messages['newResourceAlbum'] = 'New Album';
+$messages['newResource'] = 'New Resource';
+$messages['controlCenter'] = 'Control Centre';
+$messages['manageSettings'] = 'Settings';
+$messages['blogSettings'] = 'Blog Settings';
+$messages['userSettings'] = 'User Settings';
+$messages['pluginCenter'] = 'Plugin Centre';
+$messages['Stats'] = 'Statistics';
+$messages['manageBlogUsers'] = 'Manage Blog Users';
+$messages['newBlogUser'] = 'New Blog User';
+$messages['showBlogUsers'] = 'Blog Users';
+$messages['manageBlogTemplates'] = 'Blog Templates';
+$messages['newBlogTemplate'] = 'New Blog Template';
+$messages['blogTemplates'] = 'Blog Templates';
+$messages['adminSettings'] = 'Administration';
+$messages['Users'] = 'Users';
+$messages['createUser'] = 'Create User';
+$messages['editSiteUsers'] = 'Site Users';
+$messages['Blogs'] = 'Manage Blogs';
+$messages['createBlog'] = 'Create Blog';
+$messages['editSiteBlogs'] = 'Blogs';
+$messages['Locales'] = 'Manage Locales';
+$messages['newLocale'] = 'New Locale';
+$messages['siteLocales'] = 'Site Locales';
+$messages['Templates'] = 'Manage Templates';
+$messages['newTemplate'] = 'New Template';
+$messages['siteTemplates'] = 'Site Templates';
+$messages['GlobalSettings'] = 'Global Settings';
+$messages['editSiteSettings'] = 'General';
+$messages['summarySettings'] = 'Summary';
+$messages['templateSettings'] = 'Templates';
+$messages['urlSettings'] = 'URLs';
+$messages['emailSettings'] = 'Email';
+$messages['uploadSettings'] = 'Uploads';
+$messages['helpersSettings'] = 'External Helpers';
+$messages['interfacesSettings'] = 'Interfaces';
+$messages['securitySettings'] = 'Security';
+$messages['bayesianSettings'] = 'Bayesian Filter';
+$messages['resourcesSettings'] = 'Resources';
+$messages['searchSettings'] = 'Search';
+$messages['cleanUpSection'] = 'Clean Up';
+$messages['cleanUp'] = 'Clean Up';
+$messages['editResourceAlbum'] = 'Edit Album';
+$messages['resourceInfo'] = 'Edit Resource';
+$messages['editBlog'] = 'Edit Blog';
+$messages['Logout'] = 'Logout';
+
+// new post
+$messages['topic'] = 'Topic';
+$messages['topic_help'] = 'Title of the post.';
+$messages['text'] = 'Text';
+$messages['text_help'] = 'Text of the post. This part will always appear in the front page.';
+$messages['extended_text'] = 'Extended Text';
+$messages['extended_text_help'] = 'Extended text of the post. This part can optionally appear only in the post page or in the main page. See the blog settings for more information.';
+$messages['trackback_urls'] = 'Real Trackback Urls';
+$messages['trackback_urls_help'] = 'If the article you want to send the trackback to does not support Trackback Auto-Discover mechanism, you may put its real trackback url here and use a new line for each url.';
+$messages['post_slug'] = 'Slug';
+$messages['post_slug_help'] = 'The slug will be used to generate nice permanent links.';
+$messages['date'] = 'Date';
+$messages['post_date_help'] = 'Date when this post is going to be published.';
+$messages['status'] = 'Status';
+$messages['post_status_help'] = 'Select one of these status.';
+$messages['post_status_published'] = 'Published';
+$messages['post_status_draft'] = 'Draft';
+$messages['post_status_deleted'] = 'Deleted';
+$messages['post_categories_help'] = 'Select one or more categories.';
+$messages['post_comments_enabled_help'] = 'Enable comments';
+$messages['send_notification_help'] = 'Notification of new comments.';
+$messages['send_trackback_pings_help'] = 'Send trackbacks';
+$messages['send_xmlrpc_pings_help'] = 'Send XMLRPC pings';
+$messages['save_draft_and_continue'] = 'Save draft';
+$messages['preview'] = 'Preview';
+$messages['add_post'] = 'Blog this!';
+$messages['error_saving_draft'] = 'There was an error saving the draft';
+$messages['draft_saved_ok'] = 'Draft article %s saved successfully';
+$messages['error_sending_request'] = 'There was an error sending the request';
+$messages['error_no_category_selected'] = 'Please select at least one category';
+$messages['error_missing_post_topic'] = 'Please type a post topic';
+$messages['error_missing_post_text'] = 'Please type some text for the post';
+$messages['error_adding_post'] = 'There was an error adding the post';
+$messages['post_added_not_published'] = 'Post added successfully but not published';
+$messages['post_added_ok'] = 'Post added successfully.';
+$messages['send_notifications_ok'] = 'A notification will be sent every time there is a new comment or trackback.';
+$messages['bookmarklet'] = "Bookmarklet";
+$messages['bookmarklet_help'] = "Drag this link to your toolbar or right-click it and choose Add to Favorites or Bookmark.";
+$messages['blogit_to_lifetype'] = "Blog It to LifeType!";
+$messages['original_post'] = "(Original Post)";
+
+// send trackbacks
+$messages['error_sending_trackbacks'] = 'There was an error sending the following trackbacks';
+$messages['send_trackbacks_help'] = 'Please select those URLs where you would like to send the trackback ping. Please make sure that the sites support trackback.';
+$messages['send_trackbacks'] = 'Send trackbacks';
+$messages['ping_selected'] = 'Ping selected';
+$messages['trackbacks_sent_ok'] = 'Trackbacks successfully sent to the selected URLs';
+
+// posts page
+$messages['show_by'] = 'Show By';
+$messages['author'] = 'Author';
+$messages['post_status_all'] = 'All';
+$messages['author_all'] = 'All';
+$messages['search_terms'] = 'Search terms';
+$messages['show'] = 'Show';
+$messages['delete'] = 'Delete';
+$messages['actions'] = 'Actions';
+$messages['all'] = 'All';
+$messages['category_all'] = 'All';
+$messages['error_incorrect_article_id'] = 'Incorrect article identifier';
+$messages['error_deleting_article'] = 'There was an error deleting post "%s"';
+$messages['article_deleted_ok'] = 'Post "%s" deleted successfully';
+$messages['articles_deleted_ok'] = '%s posts deleted successfully';
+$messages['error_deleting_article2'] = 'There was an error deleting the post with identifier "%s"';
+
+// edit post page
+$messages['update'] = 'Update';
+$messages['editPost'] = 'Edit Post';
+$messages['post_updated_ok'] = 'Post "%s" updated successfully.';
+$messages['error_updating_post'] = 'There was an error updating the post';
+$messages['notification_added'] = 'You will receive notifications of new comments or trackbacks';
+$messages['notification_removed'] = 'No notifications about new comments or trackbacks will be sent';
+
+// post comments
+$messages['url'] = 'URL';
+$messages['comment_status_all'] = 'All';
+$messages['comment_status_spam'] = 'Spam';
+$messages['comment_status_nonspam'] = 'No Spam';
+$messages['error_fetching_comments'] = 'There was an error while fetching the article comments';
+$messages['error_deleting_comments'] = 'There was an error removing the comments or there was no comment selected';
+$messages['comment_deleted_ok'] = 'Comment "%s" deleted successfully';
+$messages['comments_deleted_ok'] = '%s comments deleted successfully';
+$messages['error_deleting_comment'] = 'There was an error deleting comment "%s"';
+$messages['error_deleting_comment2'] = 'There was an error deleting comment with identifier %s';
+$messages['editComments'] = 'Comments';
+$messages['mark_as_spam'] = 'Mark as spam';
+$messages['mark_as_no_spam'] = 'Mark as no spam';
+$messages['error_incorrect_comment_id'] = 'The comment identifier is not correct';
+$messages['error_marking_comment_as_spam'] = 'There was an error marking the comment as spam';
+$messages['comment_marked_as_spam_ok'] = 'The comment was marked as spam successfully';
+$messages['error_marking_comment_as_nonspam'] = 'There was an error marking the comment as no spam';
+$messages['comment_marked_as_nonspam_ok'] = 'The comment was marked as no spam successfully';
+
+
+// post trackbacks
+$messages['blog'] = 'Blog';
+$messages['excerpt'] = 'Excerpt';
+$messages['error_fetching_trackbacks'] = 'There was an error while fetching the trackbacks';
+$messages['error_deleting_trackbacks'] = 'There was an error deleting the trackbacks or there were no items selected';
+$messages['error_deleting_trackback'] = 'There was an error while deleting trackback "%s"';
+$messages['error_deleting_trackback2'] = 'There was an error while deleting trackback with identifier "%s"';
+$messages['trackback_deleted_ok'] = 'Trackback "%s" deleted successfully';
+$messages['trackbacks_deleted_ok'] = '%s trackbacks deleted successfully';
+$messages['editTrackbacks'] = 'Trackbacks';
+
+// post statistics
+$messages['referrer'] = 'Referrer';
+$messages['hits'] = 'Hits';
+$messages['error_no_items_selected'] = 'No items were selected to remove';
+$messages['error_deleting_referrer'] = 'There was an error deleting referrer "%s"';
+$messages['error_deleting_referrer2'] = 'There was an error deleting referrer with identifier "%s"';
+$messages['referrer_deleted_ok'] = 'Referrer "%s" deleted successfully';
+$messages['referrers_deleted_ok'] = '%s referrers deleted successfully';
+
+// categories
+$messages['posts'] = 'Posts';
+$messages['show_in_main_page'] = 'Show in front page';
+$messages['error_category_has_articles'] = 'Category "%s" is used by some articles. Please edit the articles first and then remove the category';
+$messages['category_deleted_ok'] = 'Category "%s" deleted successfully';
+$messages['categories_deleted_ok'] = '%s categories deleted successfully';
+$messages['error_deleting_category'] = 'There was an error deleting category "%s"';
+$messages['error_deleting_category2'] = 'There was an error deleting category with identifier "%s"';
+$messages['yes'] = 'Yes';
+$messages['no'] = 'No';
+
+// new category
+$messages['name'] = 'Name';
+$messages['category_name_help'] = 'Name that will be used to display the category.';
+$messages['description'] = 'Description';
+$messages['category_description_help'] = 'Longer description for this category.';
+$messages['show_in_main_page_help'] = 'Whether posts under this category should be shown in the main page, or only when this particular category is browsed.';
+$messages['error_empty_name'] = 'You must provide a name';
+$messages['error_empty_description'] = 'You must provide a description';
+$messages['error_adding_article_category'] = 'There was an error adding the new category. Please check the data and try again';
+$messages['category_added_ok'] = 'Category "%s" was successfully added to the blog';
+$messages['add'] = 'Add';
+$messages['reset'] = 'Reset';
+
+// update category
+$messages['error_updating_article_category'] = 'There was an error updating the article category';
+$messages['article_category_updated_ok'] = 'Category "%s" was updated successfully';
+
+// links
+$messages['feed'] = 'Feed';
+$messages['error_no_links_selected'] = 'The link identifier was incorrect or no items were selected to remove';
+$messages['error_incorrect_link_id'] = 'The link identifier was not correct';
+$messages['error_removing_link'] = 'There was an error removing link "%s"';
+$messages['error_removing_link2'] = 'There was an error removing link with identifier "%s"';
+$messages['link_deleted_ok'] = 'Link "%s" was deleted successfully';
+$messages['links_deleted_ok'] = '%s links deleted successfully';
+
+// new link
+$messages['link_name_help'] = 'Name given to this link.';
+$messages['link_url_help'] = 'Address where this link points. Example: http://www.domainname.com/ (NOTE: http:// must be included!)';
+$messages['link_description_help'] = 'Brief description of this link.';
+$messages['link_feed_help'] = 'A link to any of the RSS or Atom feeds of this link can also be provided.';
+$messages['link_category_help'] = 'Choose one of the available link categories.';
+$messages['error_adding_link'] = 'There was an error adding the link. Please check the data and try again';
+$messages['error_invalid_url'] = 'The address is not correct';
+$messages['link_added_ok'] = 'Link "%s" was successfully added';
+$messages['bookmarkit_to_lifetype'] = "Bookmark It to LifeType!";
+
+// update link
+$messages['error_updating_link'] = 'There was an error updating the link. Please check the data and try again';
+$messages['error_fetching_link'] = 'There was an error fetching the link';
+$messages['link_updated_ok'] = 'Link "%s" was updated successfully';
+
+// link categories
+$messages['error_invalid_link_category_id'] = 'The link category identifier was not correct or there was no link category selected';
+$messages['error_links_in_link_category'] = 'Link category "%s" is used by some links. Modify the links first and try again';
+$messages['error_removing_link_category'] = 'There was an error removing link category "%s"';
+$messages['link_category_deleted_ok'] = 'Link category "%s" deleted successfully';
+$messages['link_categories_deleted_ok'] = '%s link categories deleted successfully';
+$messages['error_removing_link_category2'] = 'There was an error removing link category with identifier "%s"';
+
+// new link category
+$messages['link_category_name_help'] = 'Name given to this link category.';
+$messages['error_adding_link_category'] = 'There was an error adding the new link category';
+$messages['link_category_added_ok'] = 'Link category "%s" was successfully added';
+
+// edit link category
+$messages['error_updating_link_category'] = 'There was an error updating the link category. Please check the data and try again';
+$messages['link_category_updated_ok'] = 'Link category "%s" updated successfully';
+$messages['error_fetching_link_category'] = 'There was an error fetching the link category';
+
+// custom fields
+$messages['type'] = 'Type';
+$messages['hidden'] = 'Hidden';
+$messages['fields_deleted_ok'] = '%s custom fields deleted successfully';
+$messages['field_deleted_ok'] = 'Custom field "%s" deleted successfully';
+$messages['error_deleting_field'] = 'There was an error deleting custom field "%s"';
+$messages['error_deleting_field2'] = 'There was an error deleting custom field with identifier "%s"';
+$messages['error_incorrect_field_id'] = 'The custom field identifier was not valid';
+
+// new custom field
+$messages['field_name_help'] = 'Identifier that will be used to refer to the value of this field in posts.';
+$messages['field_description_help'] = 'Brief description of this field that will be shown when adding or editing posts.';
+$messages['field_type_help'] = 'Select one of the available field types.';
+$messages['field_hidden_help'] = 'If a field is hidden, it will not be shown when adding a or editing a post. This feature is mainly used by plugins.';
+$messages['error_adding_custom_field'] = 'There was an error adding the custom field. Please check the data and try again';
+$messages['custom_field_added_ok'] = 'Custom field "%s" added successfully';
+$messages['text_field'] = 'Text field';
+$messages['text_area'] = 'Text box';
+$messages['checkbox'] = 'Checkbox';
+$messages['date_field'] = 'Date chooser';
+
+// edit custom field
+$messages['error_fetching_custom_field'] = 'There was an error fetching the custom field';
+$messages['error_updating_custom_field'] = 'There was an error updating the custom field. Please check the data and try again';
+$messages['custom_field_updated_ok'] = 'Custom field "%s" updated successfully';
+
+// resources
+$messages['root_album'] = 'Root album';
+$messages['num_resources'] = 'Number of resources';
+$messages['total_size'] = 'Total size';
+$messages['album'] = 'Album';
+$messages['error_incorrect_album_id'] = 'The album identifier is not correct';
+$messages['error_base_storage_folder_missing_or_unreadable'] = 'It was not possible for LifeType to create the necessary folders where resources are going to be installed. This might be due to several reasons, such as your PHP installation running with safe mode enabled or your user not having enough permissions to do so. You may still try to carry out the operation manually, by creating the following folders: <br/><br/>%s<br/><br/>If these folders already exist please make sure that they can be read and written by the user running the web server.';
+$messages['items_deleted_ok'] = '%s items deleted successfully';
+$messages['error_album_has_children'] = 'Album "%s" has children. Please empty the album first and then try again.';
+$messages['item_deleted_ok'] = 'Item "%s"deleted successfully';
+$messages['error_deleting_album'] = 'There was an error deleting album "%s"';
+$messages['error_deleting_album2'] = 'There was an error deleting album with identifier "%s"';
+$messages['error_deleting_resource'] = 'There was an error deleting resource "%s"';
+$messages['error_deleting_resource2'] = 'There was an error deleting resource with identifier "%s"';
+$messages['error_no_resources_selected'] = 'No items were selected to delete';
+$messages['resource_deleted_ok'] = 'Resource "%s" was deleted successfully';
+$messages['album_deleted_ok'] = 'Album "%s" was deleted successfully';
+$messages['add_resource'] = 'Add resource';
+$messages['add_resource_preview'] = 'Add preview';
+$messages['add_resource_medium'] = 'Add medium preview';
+$messages['add_album'] = 'Add album';
+
+// new album
+$messages['album_name_help'] = 'Short name for the new album.';
+$messages['parent'] = 'Parent';
+$messages['no_parent'] = 'No parent';
+$messages['parent_album_help'] = 'Use this to have albums within albums and better organize your files.';
+$messages['album_description_help'] = 'Longer description of the contents of this album.';
+$messages['error_adding_album'] = 'There was an error adding the new album. Please check the data and try again';
+$messages['album_added_ok'] = 'Album "%s" successfully added';
+
+// edit album
+$messages['error_incorrect_album_id'] = 'The album identifier is not correct';
+$messages['error_fetching_album'] = 'There was an error fetching the album';
+$messages['error_updating_album'] = 'There was an error updating the album. Please check the data and try again';
+$messages['album_updated_ok'] = 'Album "%s" updated successfully';
+$messages['show_album_help'] = 'If disabled, the album will not be shown in the list of albums available in this blog.';
+
+// new resource
+$messages['file'] = 'File';
+$messages['resource_file_help'] = 'File that will be added to the current blog. Use the "Add field" link to upload more than one file at the same time.';
+$messages['add_field'] = 'Add field';
+$messages['resource_description_help'] = 'Longer description of the contents of this file.';
+$messages['resource_album_help'] = 'Select the album to which this file will be added.';
+$messages['error_no_resource_uploaded'] = 'There was no file selected to upload';
+$messages['resource_added_ok'] = 'Resource "%s" added successfully';
+$messages['error_resource_forbidden_extension'] = 'The file was not added because it is of a forbidden type';
+$messages['error_resource_too_big'] = 'The file was not added because it is too big';
+$messages['error_uploads_disabled'] = 'The file was not added because uploads have been disabled';
+$messages['error_quota_exceeded'] = 'The file was not added because resource quota has been exceeded';
+$messages['error_adding_resource'] = 'There was an error adding the resource file';
+
+// edit resource
+$messages['editResource'] = 'Edit Resource';
+$messages['resource_information_help'] = 'Below is some information about this resource file.';
+$messages['information'] = 'Information';
+$messages['thumbnail_format'] = 'Thumbnail format';
+$messages['regenerate_preview'] = 'Regenerate preview';
+$messages['error_fetching_resource'] = 'There was an error fetching the resource';
+$messages['error_updating_resource'] = 'There was an error updating the resource';
+$messages['resource_updated_ok'] = 'Resource "%s" updated successfully';
+
+// blog settings
+$messages['blog_link'] = 'Blog link';
+$messages['blog_link_help'] = 'Permanent link to this blog';
+$messages['blog_name_help'] = 'Title for this blog';
+$messages['blog_description_help'] = 'Longer description about the contents of this blog.';
+$messages['language'] = 'Language';
+$messages['blog_language_help'] = 'Language used to display the texts of this blog, both in the public and administration side.';
+$messages['max_main_page_items'] = 'Number of items in the main page';
+$messages['max_main_page_items_help'] = 'Number of posts that should be displayed at all times in the main page of the blog.';
+$messages['max_recent_items'] = 'Number of recent items';
+$messages['max_recent_items_help'] = 'Maximum number of posts that will be shown as recent in the front page.';
+$messages['template'] = 'Template';
+$messages['choose'] = 'Choose';
+$messages['blog_template_help'] = 'Template that will be used to display the contents of the blog. This list includes global templates plus all the templates installed only for this blog.';
+$messages['use_read_more'] = 'Use "more..." link in posts';
+$messages['use_read_more_help'] = 'If enabled, only the text typed in the "Text" textbox will be shown in the main page. In order to display the "Extended text", a "more..." link will be added to each post.';
+$messages['enable_wysiwyg'] = 'Enable the visual editor of posts';
+$messages['enable_wysiwyg_help'] = 'Enables a more powerful, visual editor of HTML mark up. The editor only works in Internet Explorer 5.5 or higher or Mozilla 1.3 or higher.';
+$messages['enable_comments'] = 'Enable comments';
+$messages['enable_comments_help'] = 'Enable comments for all posts.';
+$messages['show_future_posts'] = 'Show future posts in the calendar';
+$messages['show_future_posts_help'] = 'Whether posts which have a date in the future should appear in the calendar and visible to users.';
+$messages['comments_order'] = 'Comments order';
+$messages['comments_order_help'] = 'Order in which comments should be displayed in the front page.';
+$messages['articles_order'] = 'Articles order';
+$messages['articles_order_help'] = 'Order in which articles should be displayed.';
+$messages['oldest_first'] = 'Oldest first';
+$messages['newest_first'] = 'Newest first';
+$messages['categories_order'] = 'Categories order';
+$messages['categories_order_help'] = 'Order in which categories should be displayed in the front page.';
+$messages['most_recent_updated_first'] = 'Most recently updated first';
+$messages['alphabetical_order'] = 'Alphabetical order';
+$messages['reverse_alphabetical_order'] = 'Reverse alphabetical order';
+$messages['most_articles_first'] = 'Most articles first';
+$messages['link_categories_order'] = 'Link categories order';
+$messages['link_categories_order_help'] = 'Order in which link categories should appear in the front page.';
+$messages['most_links_first'] = 'Most links first';
+$messages['most_links_last'] = 'Most links last';
+$messages['time_offset'] = 'Time offset';
+$messages['time_offset_help'] = 'Time difference in hours that will be dynamically added to each date and time in the blog.';
+$messages['close'] = 'Close';
+$messages['select'] = 'Select';
+$messages['error_updating_settings'] = 'There was an error updating the blog settings. Please check the data and try again';
+$messages['error_invalid_number'] = 'The number is not correct';
+$messages['error_incorrect_time_offset'] = 'The time offset is not valid';
+$messages['blog_settings_updated_ok'] = 'Blog settings updated successfully';
+$messages['hours'] = 'Hours';
+
+// user settings
+$messages['username_help'] = 'Public username. It cannot be changed.';
+$messages['full_name'] = 'Full name';
+$messages['full_name_help'] = 'Complete full name';
+$messages['password_help'] = 'Type and confirm a new password, or leave empty for no change.';
+$messages['confirm_password'] = 'Confirm password';
+$messages['email'] = 'Email';
+$messages['email_help'] = 'Email address where notifications will be sent.';
+$messages['bio'] = 'Your bio';
+$messages['bio_help'] = 'A longer description of yourself can be provided here.';
+$messages['picture'] = 'Picture';
+$messages['user_picture_help'] = 'Please select a picture from the ones uploaded to this blog as your personal picture.';
+$messages['error_invalid_password'] = 'The password is not correct. Please make sure that it is not too short';
+$messages['error_passwords_dont_match'] = 'Sorry, passwords do not match';
+$messages['error_updating_user_settings'] = 'There was an error updating your user settings. Please check the data and try again';
+$messages['user_settings_updated_ok'] = 'User settings updated successfully';
+$messages['resource'] = 'Resource';
+
+// plugin centre
+$messages['identifier'] = 'Identifier';
+$messages['error_plugins_disabled'] = 'Sorry, Plugins are disabled.';
+
+// blog users
+$messages['revoke_permissions'] = 'Revoke permissions';
+$messages['error_no_users_selected'] = 'There were no users selected';
+$messages['user_removed_from_blog_ok'] = 'User "%s" does not have permissions to access this blog any more';
+$messages['users_removed_from_blog_ok'] = '%s users do not have access to this blog any more';
+$messages['error_removing_user_from_blog'] = 'There was an error removing access to this blog from user "%s"';
+$messages['error_removing_user_from_blog2'] = 'There was an error removing access to this blog from user whose identifier is "%s"';
+
+// new blog user
+$messages['new_blog_username_help'] = 'Username of the user to whom you would like to give access to this blog. New users will only have access to the "Manage" and "Resources" sections.';
+$messages['send_notification'] = 'Send notification';
+$messages['send_user_notification_help'] = 'Send an email notification to this user.';
+$messages['notification_text'] = 'Notification Text';
+$messages['notification_text_help'] = 'Text that will be included in the notification message.';
+$messages['error_adding_user'] = 'There was an error granting access to the user. Please check the data and try again';
+$messages['error_empty_text'] = 'You must provide some text';
+$messages['error_adding_user'] = 'There was an error adding the user. Please check the data and try again';
+$messages['error_invalid_user'] = 'The user "%s" is not valid or does not exist';
+$messages['user_added_to_blog_ok'] = 'User "%s" has been given access to this blog successfully';
+
+// blog templates
+$messages['error_no_templates_selected'] = 'There were no templates selected';
+$messages['error_template_is_current'] = 'Template "%s" cannot be deleted because it is the current one';
+$messages['error_removing_template'] = 'There was an error deleting template "%s"';
+$messages['template_removed_ok'] = 'Template "%s" deleted successfully';
+$messages['templates_removed_ok'] = '%s templates deleted successfully';
+
+// new blog template
+$messages['template_installed_ok'] = 'Template "%s" added successfully';
+$messages['error_installing_template'] = 'There was an error installing template "%s"';
+$messages['error_missing_base_files'] = 'Some of the template files are missing';
+$messages['error_add_template_disabled'] = 'New templates cannot be added because this feature has been disabled in this site';
+$messages['error_must_upload_file'] = 'There was no template package uploaded';
+$messages['error_uploads_disabled'] = 'Uploads have been disabled in this site';
+$messages['error_no_new_templates_found'] = 'No new templates were found';
+$messages['error_template_not_inside_folder'] = 'The files used in the template set must be inside a folder with the same name as the template set';
+$messages['error_missing_base_files'] = 'Some of the basic template files are missing';
+$messages['error_unpacking'] = 'There was an error unpacking the file';
+$messages['error_forbidden_extensions'] = 'The template set included files with forbidden extensions';
+$messages['error_creating_working_folder'] = 'There was an error creating a temporary folder to unpack the files';
+$messages['error_checking_template'] = 'There was an error checking the template: %s';
+$messages['template_package'] = 'Template package';
+$messages['blog_template_package_help']  = 'Use this form to upload a new template set, which will only be available to your blog. If it is not possible to upload a template package using this form, upload the template set manually and place it in <b>%s</b>, which is the folder where your blog templates are stored and click the "<b>Scan templates</b>" button. LifeType will scan the folder and will automatically add any new template it can find.';
+$messages['scan_templates'] = 'Scan Templates';
+
+// site users
+$messages['user_status_active'] = 'Active';
+$messages['user_status_disabled'] = 'Disabled';
+$messages['user_status_all'] = 'All';
+$messages['user_status_unconfirmed'] = 'Unconfirmed';
+$messages['error_invalid_user2'] = 'User with identifier "%s" does not exist';
+$messages['error_deleting_user'] = 'There was an error disabling user "%s"';
+$messages['user_deleted_ok'] = 'User "%s" disabled successfully';
+$messages['users_deleted_ok'] = '%s users disabled successfully';
+
+// create user
+$messages['user_added_ok'] = 'User "%s" added successfully';
+$messages['user_status_help'] = 'Current status for this user';
+$messages['user_blog_help'] = 'Blog to which this user will be initially assigned.';
+$messages['none'] = 'None';
+
+// edit user
+$messages['error_invalid_user'] = 'The user identifier is not correct or the user does not exist';
+$messages['error_updating_user'] = 'There was an error updating the user settings. Please check the data and try again';
+$messages['blogs'] = 'Blogs';
+$messages['user_blogs_help'] = 'Blogs which this user currently owns or where this user has access.';
+$messages['site_admin'] = 'Administrator';
+$messages['site_admin_help'] = 'Whether this user has administrator privileges and is allowed to see the "Administration" area and perform administrative tasks.';
+$messages['user_updated_ok'] = 'User "%s" updated successfully';
+
+// site blogs
+$messages['blog_status_all'] = 'All';
+$messages['blog_status_active'] = 'Active';
+$messages['blog_status_disabled'] = 'Disabled';
+$messages['blog_status_unconfirmed'] = 'Unconfirmed';
+$messages['owner'] = 'Owner';
+$messages['quota'] = 'Quota';
+$messages['bytes'] = 'bytes';
+$messages['error_no_blogs_selected'] = 'No blogs were selected to disable';
+$messages['error_blog_is_default_blog'] = 'Blog "%s" cannot be deleted because it is set as the default blog';
+$messages['blog_deleted_ok'] = 'Blog "%s" disabled successfully';
+$messages['blogs_deleted_ok'] = '%s blogs deleted successfully';
+$messages['error_deleting_blog'] = 'There was an error disabling blog "%s"';
+$messages['error_deleting_blog2'] = 'There was an error disabling blog with identifier "%s"';
+
+// create blog
+$messages['error_adding_blog'] = 'There was an error adding the blog. Please check the data and try again';
+$messages['blog_added_ok'] = 'Blog "%s" successfully added';
+
+// edit blog
+$messages['blog_status_help'] = 'Blog status';
+$messages['blog_owner_help'] = 'User who will be set as the owner, with full control on the blog settings.';
+$messages['users'] = 'Users';
+$messages['blog_quota_help'] = 'Resource quota in bytes. Set as 0 for unlimited or leave empty to make the blog use the global quota.';
+$messages['edit_blog_settings_updated_ok'] = 'Blog "%s" updated successfully';
+$messages['error_updating_blog_settings'] = 'There was an error updating blog "%s"';
+$messages['error_incorrect_blog_owner'] = 'The user selected as blog owner is not correct';
+$messages['error_fetching_blog'] = 'There was an error fetching the blog';
+$messages['error_updating_blog_settings2'] = 'There was an error updating the blog. Please check the data and try again';
+$messages['add_or_remove'] = 'Add or remove users';
+
+// site locales
+$messages['locale'] = 'Locale';
+$messages['locale_encoding'] = 'Encoding';
+$messages['locale_deleted_ok'] = 'Locale "%s" deleted successfully';
+$messages['error_no_locales_selected'] = 'There were no locales selected to remove';
+$messages['error_deleting_only_locale'] = 'The locale cannot be deleted because is is the only one left in the system';
+$messages['locales_deleted_ok']= '%s locales deleted successfully';
+$messages['error_deleting_locale'] = 'There was an error deleting locale "%s"';
+$messages['error_locale_is_default'] = 'Locale "%s" cannot be deleted because it is the default locale for new blogs';
+
+// add locale
+$messages['error_invalid_locale_file'] = 'The locale file is not valid';
+$messages['error_no_new_locales_found'] = 'No new locale files were found';
+$messages['locale_added_ok'] = 'Locale "%s" added successfully';
+$messages['error_saving_locale'] = 'There was an error saving the new locale';
+$messages['scan_locales'] = 'Scan Locales';
+$messages['add_locale_help'] = 'Use this form to upload a new locale file. If it is not possible to upload files using this form, upload the locale file manually and place it in <b>./locales/</b>, which is the folder where locale files are stored and click the "<b>Scan Locales</b>" button. LifeType will scan the folder and will automatically add any new locale file can find.';
+
+// site templates
+$messages['error_template_is_default'] = 'Template "%s" cannot be deleted because it is the default one for new blogs';
+
+// add template
+$messages['global_template_package_help'] = 'Use this form to upload a new template set, which will be available to all blogs in the site. If it is not possible to upload a template package using this form, upload the template set manually and place it in <b>%s</b>, which is the folder where globally available templates are stored and click the "<b>Scan templates</b>" button. LifeType will scan the folder and will automatically add any new template it can find.';
+
+// global settings
+$messages['site_config_saved_ok'] = 'Site settings saved successfully';
+$messages['error_saving_site_config'] = 'There was an error saving the site settings';
+/// general settings
+$messages['help_comments_enabled'] = 'Enable comments for new blogs by default. [Default = Yes]';
+$messages['help_beautify_comments_text'] = 'If enabled, comments posted by users will be formatted by adding paragraphs and auto-linking all URLs. [Default = Yes]';
+$messages['help_temp_folder'] = 'Folder that LifeType can use to write its temporary data such as compiled templates, etc. Use a folder outside the web server tree for increased security. [Default = ./tmp]';
+$messages['help_base_url'] = 'Base URL where this blog is installed.';
+$messages['help_subdomains_enabled'] = 'Enable subdomains. Please see the documentation for more information regarding subdomains. [Default = No]';
+$messages['help_include_blog_id_in_url'] = 'Meaningful only when subdomains are enabled and "normal" URLs are enabled, forces internally-generated URLs not to have the "blogId" parameter. Do not change unless you know what you are doing. [Default = Yes]';
+$messages['help_script_name'] = 'Set this if you need to rename index.php to something else. [Default = index.php]';
+$messages['help_show_posts_max'] = 'Maximum number of posts shown in the main page. Only meaningful for new blogs. [Default = 15]';
+$messages['help_recent_posts_max'] = 'Maximum number of recent posts shown in the main page. Only meaningful for new blogs. [Default = 10]';
+$messages['help_save_drafts_via_xmlhttprequest_enabled'] = 'Whether the feature that allows to save drafts via Javascript and XmlHttpRequest is enabled. [Default = Yes]';
+$messages['help_locale_folder'] = 'Folder where the locale files are stored. [Default = ./locale]';
+$messages['help_default_locale'] = 'Default language settings for new blogs. [Default = en_UK]';
+$messages['help_default_blog_id'] = 'Default blog that will be shown if no other is specified. [Default = 1]';
+$messages['help_default_time_offset'] = 'Default time offset for new blogs. [Default = 0]';
+$messages['help_html_allowed_tags_in_comments'] = 'Space-separated list of the HTML tags that are allowed in comments. [Default = &lt;a&gt;&lt;i&gt;&lt;br&gt;&lt;br/&gt;&lt;b&gt;]';
+$messages['help_referer_tracker_enabled'] = 'Enable the feature to save referrers to the database. Set to "No" for higher performance. [Default = Yes]';
+$messages['help_show_more_enabled'] = 'Enable the "more..." feature by default for new blogs. [Default = Yes]';
+$messages['help_update_article_reads'] = 'Enable the update of the counter of times that an article has been read is updated or not. Set to "No" for higher performance. [Default = Yes]';
+$messages['help_update_cached_article_reads'] = 'Enable the update of the counter of times that an article has been read is updated, even when caching has been turned on. [Default = Yes]';
+$messages['help_xmlrpc_ping_enabled'] = 'Enable sending XMLRPC pings to sites that support this feature. [Default = Yes]';
+$messages['help_send_xmlrpc_pings_enabled_by_default'] = 'Enable sending XMLRPC pings by default when posting or updating an article. [Default = Yes]';
+$messages['help_xmlrpc_ping_hosts'] = 'URL pointing to the XMLRPC interface of sites that support the XMLRPC ping specification. Put each URL in one new line. [Default = http://rpc.weblogs.com/RPC2]';
+$messages['help_trackback_server_enabled'] = 'Enable incoming trackbacks. [Default = Yes]';
+$messages['help_htmlarea_enabled'] = 'Enable the WYSIWYG post editor by default in new blogs. [Default = Yes]';
+$messages['help_plugin_manager_enabled'] = 'Enable plugins. [Default = Yes]';
+$messages['help_minimum_password_length'] = 'Minimum length for passwords. [Default = 4]';
+$messages['help_xhtml_converter_enabled'] = 'If enabled, LifeType will try to convert all HTML code into proper XHTML code. [Default = Yes]';
+$messages['help_xhtml_converter_aggressive_mode_enabled'] = 'If enabled, LifeType will try even harder to generate XHTML out of HTML code, but it will be more prone to errors. [Default = No]';
+$messages['help_session_save_path'] = 'Please use this setting to change the folder where LifeType stores its session data, via the PHP function session_save_path() Please make sure that the folder is writable by the web server. Leave empty to use PHP\'s default session folder. [Default = (empty)]';
+// summary settings
+$messages['help_summary_page_show_max'] = 'Number of items that will be shown in the summary page. This setting control all lists in the summary page (recent articles, most active blogs, etc). [Default = 10]';
+$messages['help_summary_items_per_page'] = 'Number of blogs per page in the "Blogs List" section. [Default = 25]';
+$messages['help_forbidden_usernames'] = 'List of usernames separated by a blank space that are not allowed to be registered. [Default = admin www blog ftp]';
+$messages['help_force_one_blog_per_email_account'] = 'Restrict to only one blog per email account. [Default = No]';
+$messages['help_summary_show_agreement'] = 'Show an agreement text and make users accept it before proceeding to the registration process. [Default = Yes]';
+$messages['help_need_email_confirm_registration'] = 'Force users to confirm their registration by clicking a link embedded in an email sent to their account. [Default = Yes]';
+$messages['help_summary_disable_registration'] = 'Disable users registration of new blogs in this site. [Default = No]';
+// templates
+$messages['help_template_folder'] = 'Folder where templates are stored. [Default = ./templates]';
+$messages['help_default_template'] = 'Default template for new blogs. [Default = standard]';
+$messages['help_users_can_add_templates'] = 'Allow users to upload their own custom templates. [Default = Yes]';
+$messages['help_template_compile_check'] = 'If enabled, Smarty will check every time if template files have changed and if so, use the new version. Set this to disabled for higher performance. [Default = Yes]';
+$messages['help_template_cache_enabled'] = 'Enable the template cache. If enabled, the cached version of a page will be used whenever possible. No data will need to be fetched from the database and templates will not need to be recompiled. [Default = Yes]';
+$messages['help_template_cache_lifetime'] = 'Lifetime in seconds of the cache. Set to -1 to force the cache to never expire. If set to 0, the cache will be disabled but it is recommended to set template_cache_enabled to "No" in order to disable the cache. [Default = -1]';
+$messages['help_template_http_cache_enabled'] = 'Enable support for HTTP conditional requests. If enabled, LifeType will take the "If-Modified-Since" HTTP header into account and send only content if strictly needed. Enable this to save bandwidth [Default = Yes]';
+$messages['help_allow_php_code_in_templates'] = 'Allows to embed native PHP code in Smarty templates inside {php}...{/php} blocks. [Default = No]';
+// urls
+$messages['help_request_format_mode'] = 'Select one of the available URL format. If using custom URLs, make sure to configure the settings below. [Default = Plain]';
+$messages['plain'] = 'Plain';
+$messages['search_engine_friendly'] = 'Search engine friendly';
+$messages['custom_url_format'] = 'Custom URLs';
+$messages['help_permalink_format'] = 'Format for permalinks when using custom URLs. [Default = /blog/{blogname}/{catname}/{year}/{month}/{day}/{postname}$]';
+$messages['help_category_link_format'] = 'Format for links to categories when using custom URLs. [Default = /blog/{blogname}/{catname}$]';
+$messages['help_blog_link_format'] = 'Format for links to blogs when using custom URLs. [Default = /blog/{blogname}$]';
+$messages['help_archive_link_format'] = 'Format for links to archives when using custom URLs. [Default = /blog/{blogname}/archives/{year}/?{month}/?{day}]';
+$messages['help_user_posts_link_format'] = 'Format for articles posted by a certain user when using custom URLs. [Default = /blog/{blogname}/user/{username}$]';
+$messages['help_post_trackbacks_link_format'] = 'Format for links to the trackbacks page when using custom URLs. [Default = /blog/{blogname}/post/trackbacks/{postname}$]';
+$messages['help_template_link_format'] = 'Format for links to custom static template pages when using custom URLs. [Default = /blog/{blogname}/page/{templatename}$]';
+$messages['help_album_link_format'] = 'Format for links to resource albums when using custom URLs. [Default = /blog/{blogname}/album/{albumname}$]';
+$messages['help_resource_link_format'] = 'Format for links to resource pages with files when using custom URLs. [Default = /blog/{blogname}/resource/{albumname}/{resourcename}$]';
+$messages['help_resource_preview_link_format'] = 'Format for links to resource previews when using custom URLs. [Default = /blog/{blogname}/resource/{albumname}/preview/{resourcename}$]';
+$messages['help_resource_medium_size_preview_link_format'] = 'Format for links to medium-sized resource previews when using custom URLs. [Default = /blog/{blogname}/resource/{albumname}/preview-med/{resourcename}$]';
+$messages['help_resource_download_link_format'] = 'Format for links to files when using custom URLs. [Default = /blog/{blogname}/resource/{albumname}/download/{resourcename}$]';
+// email
+$messages['help_check_email_address_validity'] = 'When checking email addresses, perform some basic checks to see whether an MX record exists in the given domain and if so, if the email address is actually a valid mailbox. [Default = No]';
+$messages['help_email_service_enabled'] = 'Enable outgoing emails [Default = Yes]';
+$messages['help_post_notification_source_address'] = 'Email address that will appear in the "From:" field when sending emails from LifeType. [Default = noreply at your.host.com]';
+$messages['help_email_service_type'] = 'Which system to use in order to send emails. [Default = PHP]';
+$messages['help_smtp_host'] = 'If using SMTP as the email sending system, set this to the SMTP server that will be used to send out the messages. [Default = (empty)]';
+$messages['help_smtp_port'] = 'If the SMTP server is running in a port other than 25, configure this value. [Default = (empty)]';
+$messages['help_smtp_use_authentication'] = 'Enable this if the SMTP server requires basic authentication.  [Default = No]';
+$messages['help_smtp_username'] = 'If the SMTP server requires authentication, set this to the right username. [Default = (empty)]';
+$messages['help_smtp_password'] = 'If the SMTP server requires authentication, set this to the password of the username above. [Default = (empty)]';
+// helpers
+$messages['help_path_to_tar'] = 'Path to the "tar" tool, needed to unpack template sets in .tar.gz or tar.bz2 formats. [Default = /bin/tar]';
+$messages['help_path_to_gzip'] = 'Path to the "gzip" tool, needed to unpack template sets in .tar.gz format. [Default = /bin/gzip]';
+$messages['help_path_to_bz2'] = 'Path to the "bzip2" tool, needed to unpack template sets in .tar.bz2 format. [Default = /usr/bin/bzip2]';
+$messages['help_path_to_unzip'] = 'Path to the "unzip" tool, needed to unpack template sets in .zip format. [Default = /usr/bin/unzip]';
+$messages['help_unzip_use_native_version'] = 'Use a bundled PHP native version to unpack .zip files. [Default = No]';
+// uploads
+$messages['help_uploads_enabled'] = 'Whether users are allowed to upload files. This affects the resources section and the upload of custom templates and locales. [Default = Yes]';
+$messages['help_maximum_file_upload_size'] = 'Maximum file size allowed in bytes. This limit will never be higher than PHP\'s own limit. [Default = 2000000]';
+$messages['help_upload_forbidden_files'] = 'Space-separated list of file types not allowed to be uploaded. Usage of \'*\' and \'?\' is allowed. [Default = *.php *.php3 *.php4 *.phtml]';
+// interfaces
+$messages['help_xmlrpc_api_enabled'] = 'Enable XMLRPC access to blogs. [Default = Yes]';
+$messages['help_rdf_enabled'] = 'Enable the syndication of contents via Atom or RSS. [Default = Yes]';
+$messages['help_default_rss_profile'] = 'Default version of RSS or Atom used to syndicate contents unless otherwise specified. [Default = RSS 1.0]';
+// security
+$messages['help_security_pipeline_enabled'] = 'Enable the security pipeline and all related filters. This also affects plugins that register new filters. [Default = Yes]';
+$messages['help_maximum_comment_size'] = 'Maximum size in bytes that a comment can have, set to 0 to disable this feature. [Default = 0]';
+// bayesian filter
+$messages['help_bayesian_filter_enabled'] = 'Enable the Bayesian filter for improved automatic spam filtering. [Default = Yes]';
+$messages['help_bayesian_filter_spam_probability_treshold'] = 'Maximum threshold before which a comment can be considered spam. [Default = 0.9]';
+$messages['help_bayesian_filter_nonspam_probability_treshold'] = 'Minimum threshold after which a post can be considered non-spam. [Default = 0.2]';
+$messages['help_bayesian_filter_min_length_token'] = 'Minimum length of a token in order for it to be considered meaningful for the Bayesian filter. [Default = 3]';
+$messages['help_bayesian_filter_max_length_token'] = 'Maximum length of a token in order for it to be considered meaningful for the Bayesian filter. [Default = 100]';
+$messages['help_bayesian_filter_number_significant_tokens'] = 'Number of significant tokens. [Default = 15]';
+$messages['help_bayesian_filter_spam_comments_action'] = 'What to do with comments that are considered spam. Set to "Throw away" only when your filter has been properly trained. [Default = Keep]';
+$messages['keep_spam_comments'] = 'Keep in the database marked as "Spam"';
+$messages['throw_away_spam_comments'] = 'Throw them away (do not save them)';
+// resources
+$messages['help_resources_enabled'] = 'Enable resources. [Default = Yes]';
+$messages['help_resources_folder'] = 'Relative path to the folder where resource files (pictures, videos etc.) will be kept. [Default = ./gallery]';
+$messages['help_thumbnail_method'] = 'Method used to generate thumbnails. If using PHP, support for GD is required. [Default = PHP]';
+$messages['help_path_to_convert'] = 'Path to the "convert" tool from the ImageMagick package. Mandatory if the thumbnail method is "ImageMagick". [Default = /usr/bin/convert]';
+$messages['help_thumbnail_format'] = 'Format in which thumbnails are saved. [Default = Same as image]';
+$messages['help_thumbnail_height'] = 'Default height for small thumbnails. [Default = 120]';
+$messages['help_thumbnail_width'] = 'Default width for small thumbnails. [Default = 120]';
+$messages['help_medium_size_thumbnail_height'] = 'Default height for medium thumbnails. [Default = 480]';
+$messages['help_medium_size_thumbnail_width'] = 'Default width for medium thumbnails. [Default = 640]';
+$messages['help_thumbnails_keep_aspect_ratio'] = 'Keep the aspect ratio when generating thumbnails. Might generate thumbnails bigger than the sizes specified above but quality is better. [Default = Yes]';
+$messages['help_thumbnail_generator_force_use_gd1'] = 'Force LifeType to use GD1-only functions. [Default = No]';
+$messages['help_thumbnail_generator_user_smoothing_algorithm'] = 'Algorithm used to smooth thumbnails. Only used when the thumbnail method is GD. [Default = PHP Imagecopyresampled]';
+$messages['help_resources_quota'] = 'Global resource quota for blogs in bytes (i.e. 5242880 Bytes = 5MB), or set to 0 for unlimited quota. [Default = 0]';
+$messages['help_resource_server_http_cache_enabled'] = 'Enable support for the "If-Modified-Since" header and HTTP conditional requests. Enable for increased bandwidth savings. [Default = No]';
+$messages['help_resource_server_http_cache_lifetime'] = 'Time in seconds that clients should use the cached version of resources. [Default = 86400]';
+$messages['same_as_image'] = 'Same as original image';
+// search
+$messages['help_search_engine_enabled'] = 'Enable the search engine. [Default = Yes]';
+$messages['help_search_in_custom_fields'] = 'Search in custom fields. [Default = Yes]';
+$messages['help_search_in_comments'] = 'Search in comments. [Default = Yes]';
+
+// cleanup
+$messages['purge'] = 'Purge';
+$messages['cleanup_spam'] = 'Purge Spam';
+$messages['cleanup_spam_help'] = 'This will remove all comments that have been marked as spam by users. It will not be possible to recover them once they have been removed.';
+$messages['spam_comments_purged_ok'] = 'Spam comments purged successfully';
+$messages['cleanup_posts'] = 'Purge Posts';
+$messages['cleanup_posts_help'] = 'This will remove all posts that have been deleted by users (marked as "Deleted") It will not be possible to recover them once they have been removed.';
+$messages['posts_purged_ok'] = 'Posts purged successfully';
+$messages['purging_error'] = 'There was a failure while purging the data';
+
+/// summary ///
+// front page
+$messages['summary'] = 'Summary';
+$messages['register'] = 'Register';
+$messages['summary_welcome'] = 'Welcome!';
+$messages['summary_most_active_blogs'] = 'Most Active Blogs';
+$messages['summary_most_commented_articles'] = 'Most Commented Articles';
+$messages['summary_most_read_articles'] = 'Most Read articles';
+$messages['password_forgotten'] = 'Forgot your password?';
+$messages['summary_newest_blogs'] = 'Newest Blogs';
+$messages['summary_latest_posts'] = 'Latest Posts';
+$messages['summary_search_blogs'] = 'Search Blogs';
+
+// blog list
+$messages['updated'] = 'Updated';
+$messages['total_reads'] = 'total';
+
+// blog profile
+$messages['blog'] = 'Blog';
+$messages['latest_posts'] = 'Latest posts';
+
+// registration
+$messages['register_step0_title'] = 'Service terms acceptance';
+$messages['agreement'] = 'Agreement'; 
+$messages['decline'] = 'Decline';
+$messages['accept'] = 'Accept';
+$messages['read_service_agreement'] = 'Please read the terms of this service and click the "Accept" button if you agree';
+$messages['register_step1_title'] = 'Create a user [1/4]';
+$messages['register_step1_help'] = 'First you need to create a new user in order to get a blog. This user will be the owner of the blog and will have access to all its functionalities.';
+$messages['register_next'] = 'Next';
+$messages['register_back'] = 'Back';
+$messages['register_step2_title'] = 'Create a blog [2/4]';
+$messages['register_blog_name_help'] = 'Name for your new blog';
+$messages['register_step3_title'] = 'Choose a Template [3/4]';
+$messages['step1'] = 'Step 1';
+$messages['step2'] = 'Step 2';
+$messages['step3'] = 'Step 3';
+$messages['register_step3_help'] = 'Please select one of the available templates as the default one for your blog. If you do not like it later on, it can always be changed.';
+$messages['error_must_choose_template'] = 'Please select one template';
+$messages['select_template'] = 'Select template';
+$messages['register_step5_title'] = 'Congratulations! [4/4]';
+$messages['finish'] = 'Finish';
+$messages['register_need_confirmation'] = 'An email message including the confirmation has been sent to your email address, please click the link as soon as you receive the message to start blogging!';
+$messages['register_step5_help'] = 'Congratulations, your new user and blog have been successfully created!';
+$messages['register_blog_link'] = 'If you would like to take a look at your new blog, you can go there now: <a href="%2$s">%1$s</a>';
+$messages['register_blog_admin_link'] = 'If you prefer to start posting right away, please click to go to the <a href="admin.php">administration interface</a>';
+$messages['register_error'] = 'There was an error during the process';
+$messages['error_registration_disabled'] = 'Sorry, registration of new blogs in this site has been disabled';
+// registration article topic and text
+$messages['register_default_article_topic'] = 'Congratulations!';
+$messages['register_default_article_text'] = 'If you can read this post, it means that the registration process was successful and that you can start blogging';
+$messages['register_default_category'] = 'General';
+// confirmation email
+$messages['register_confirmation_email_text'] = 'Please click the link below in order to activate your blog:
+
+%s
+
+Have a nice day';
+$messages['error_invalid_activation_code'] = 'Sorry, the confirmation code is not valid';
+$messages['blog_activated_ok'] = 'Congratulations, your new user and blog have been successfully validated!';
+// forgot your password?
+$messages['reset_password'] = 'Reset your password';
+$messages['reset_password_username_help'] = 'Name of the user whose password you would like to reset.';
+$messages['reset_password_email_help'] = 'Email address which was used to register this user.';
+$messages['reset_password_help'] = 'Use this form to reset the password of your user, should you not remember it. Please type the name of the user whose password you would like to reset, as well as the email address that was used to register this user.';
+$messages['error_resetting_password'] = 'There was an error resetting the password. Please check the data and try again';
+$messages['reset_password_error_incorrect_email_address'] = 'The email address is not correct or it is not the email address used to register this user';
+$messages['password_reset_message_sent_ok'] = 'An email message with a link has been sent to your email address. Please click the link in order to reset your password';
+$messages['error_incorrect_request'] = 'The parameters in the URL are not correct';
+$messages['change_password'] = 'Set new password';
+$messages['change_password_help'] = 'Please type and confirm your new password.';
+$messages['new_password'] = 'New password';
+$messages['new_password_help'] = 'Type here your new password.';
+$messages['password_updated_ok'] = 'Your password has been successfully updated';
+
+// Suggested by BCSE, some useful messages that not available in official locale
+$messages['upgrade_information'] = 'This page looks plain and un-styled because you\'re using a non-standard compliant browser. To see it in its best form, please <a href="http://www.webstandards.org/upgrade/" title="The Web Standards Project\'s Browser Upgrade initiative">upgrade</a> to a browser that supports web standards. It\'s free and painless.';
+$messages['jump_to_navigation'] = 'Jump to Navigation.';
+$messages['comment_email_never_display'] = 'Line and paragraph breaks automatic, e-mail address never displayed.';
+$messages['comment_html_allowed'] = '<acronym title="Hypertext Markup Language">HTML</acronym> allowed: &lt;<acronym title="Hyperlink">a</acronym> href=&quot;&quot; title=&quot;&quot; rel=&quot;&quot;&gt; &lt;<acronym title="Acronym Description">acronym</acronym> title=&quot;&quot;&gt; &lt;<acronym title="Quote">blockquote</acronym> cite=&quot;&quot;&gt; &lt;<acronym title="Strike">del</acronym>&gt; &lt;<acronym title="Italic">em</acronym>&gt; &lt;<acronym title="Underline">ins</acronym>&gt; &lt;<acronym title="Bold">strong</acronym>&gt;';
+$messages['trackback_uri'] = 'The <acronym title="Uniform Resource Identifier">URI</acronym> to trackback this entry is: ';
+
+$messages['xmlrpc_ping_ok'] = 'XMLRPC Ping sent successfully: ';
+$messages['error_sending_xmlrpc_ping'] = 'There was an error sending the XMLRPC ping to: ';
+$messages['error_sending_xmlrpc_ping_message'] = 'There was an error sending the XMLRPC ping: ';
+
+//
+// new strings for 1.1
+//
+$messages['error_incorrect_trackback_id'] = 'The trackback identifier is not correct';
+$messages['error_marking_trackback_as_spam'] = 'There was an error marking the trackback as spam';
+$messages['trackback_marked_as_spam_ok'] = 'The trackback was marked as successfully as spam';
+$messages['error_marking_trackback_as_nonspam'] = 'There was an error marking the trackback as non-spam';
+$messages['trackback_marked_as_nonspam_ok'] = 'The trackback was marked successfully as non-spam';
+$messages['upload_here'] = 'Upload here';
+$messages['reply_string'] = 'Re: ';
+$messages['cleanup_users'] = 'Purge Users';
+$messages['cleanup_users_help'] = 'This will remove all users that have been disabled by administrator (marked as "Disabled"). It will also remove any blogs that user own including everything in that blog. If user has permission to post in other blog, all posts made by them will be deleted as well.  It will not be possible to recover once users have been removed.';
+$messages['users_purged_ok'] = 'Users purged successfully';
+$messages['cleanup_blogs'] = 'Purge Blogs';
+$messages['cleanup_blogs_help'] = 'This will remove all blogs that have been disabled by administrator (marked as "Disabled"). It will remove everything in that blog.  It will not be possible to recover once blogs have been removed.';
+$messages['blogs_purged_ok'] = 'Blogs purged successfully';
+$messages['help_use_http_accept_language_detection'] = 'Most web browsers such as Mozilla Firefox, Safari or Internet Explorer send at least one language code the user <i>should</i> understand. If this feature is activated, LifeType tries to serve the user with the requested language if it\'s available. [Default = No]';
+
+$messages['error_invalid_blog_category'] = 'Invalid blog category';
+$messages['error_adding_blog_category'] = 'There was an error adding the blog category';
+$messages['newBlogCategory'] = 'New Blog Category';
+$messages['editBlogCategories'] = 'Blog Categories';
+$messages['blog_category_added_ok'] = 'Blog category added successfully';
+$messages['error_blog_category_has_blogs'] = 'The blog category "%s" has some blogs assigned to it. Please remove the blogs from the category and then try again.';
+$messages['error_deleting_blog_category'] = 'There was an error deleting blog category "%s"';
+$messages['blog_category_deleted_ok'] = 'Blog category "%s" was deleted successfully';
+$messages['blog_categories_deleted_ok'] = '%s blog categories deleted successfully';
+$messages['error_deleting_blog_category2'] = 'There was an error removing the blog category with id %s';
+$messages['blog_category'] = 'Blog Category';
+$messages['blog_category_help'] = 'Global blog category assigned to this blog.';
+
+$messages['help_use_captcha_auth'] = 'Use a CAPTCHA mechanism in the registration process to prevent automatic registration by robotic scripts. [ Default = No ]';
+$messages['help_skip_dashboard'] = 'The dashboard page will not be shown anymore and instead users will be taken to the first blog to which they belong right away. [ Default = No ]';
+
+$messages['manageGlobalArticleCategory'] = 'Global Article Categories';
+$messages['newGlobalArticleCategory'] = 'New Global Article Category';
+$messages['editGlobalArticleCategories'] = 'Global Article Categories';
+$messages['global_category_name_help'] = 'Name of the new global article category.';
+$messages['global_category_description_help'] = 'Description of the new global article category.';
+$messages['error_incorrect_global_category_id'] = 'Invalid global article category';
+$messages['global_category_deleted_ok'] = 'Article category "%s" deleted successfully';
+$messages['global_category_added_ok'] = 'Global category "%s" added successfully';
+$messages['error_deleting_global_category2'] = 'There was an error removing article category with id = %s';
+
+$messages['help_page_suffix_format'] = 'Suffix that will be appended to URLs that support paging. [ Default = /page/{page} ]';
+
+$messages['help_final_size_thumbnail_width'] = 'Final width of uploaded images. Leave empty or as zero to store the full size image. [ Default = 0 ]';
+$messages['help_final_size_thumbnail_height'] = 'Final height of uploaded images. Leave empty or as zero to store the full size image. [ Default = 0 ]';
+$messages['error_comment_too_big'] = 'The comment is too big';
+$messages['error_you_have_been_blocked'] = 'Blocked: this request was not completed.';
+$messages['created'] = 'Created';
+$messages['view'] = 'View';
+$messages['editUser'] = 'Edit User';
+$messages['help_urlize_word_separator'] = 'Character that will be used as the word separator when generating URLs pointing to LifeType pages. This will also be used when generating hostnames from blog names if support for subdomains is activated. [ Default = - ]';
+$messages['help_summary_template_cache_lifetime'] = 'Life time in seconds of the summary cached pages. If set to something else than \'0\' the summary pages will be kept for as long as indicated here insted of being refreshed every time data changes. [ Default = 0 ]';
+$messages['register_default_album_name'] = 'General';
+$messages['register_default_album_description'] = 'Use this album to upload new pictures.';
+$messages['show_in_summary'] = 'Show in Summary';
+$messages['show_in_summary_help'] = 'Include this blog in the summary page of this site.';
+
+$messages['saving_message'] = 'Saving ...';
+$messages['show_option_panel'] = 'Show Options';
+$messages['hide_option_panel'] = 'Hide Options';
+
+$messages['quick_launches'] = 'Quick Launches';
+
+$messages['confirmation_message_resent_ok'] = 'Confirmation message resent successfully.';
+
+$messages['goto_blog_page'] = 'Go to %s';
+
+$messages['help_num_blogs_per_user'] = 'Number of blogs that an owner can create through the administration interface.';
+
+$messages['massive_change_option'] = 'Bulk Edit Options';
+$messages['show_massive_change_option'] = 'Show Bulk Edit Options';
+$messages['hide_massive_change_option'] = 'Hide Bulk Edit Options';
+$messages['change_status'] = 'Change Status';
+$messages['change_category'] = 'Change Category';
+$messages['error_updating_comment_no_comment'] = 'There was an error updating the comment. Comment #%s could not be found';
+$messages['error_updating_comment_wrong_blog'] = 'There was an error updating the comment. Comment (%s) is not posted on this blog.';
+$messages['error_updating_comment'] = 'There was an error updating (%s)';
+$messages['error_updating_comment_already_updated'] = 'No change made to (%s)';
+$messages['comment_updated_ok'] = 'Comment successfully updated.';
+$messages['comments_updated_ok'] = '%s comments successfully updated.';
+
+$messages['error_post_status'] = 'Please select post status.';
+$messages['error_comment_status'] = 'Please select comment status.';
+$messages['admin_mode'] = 'Admin Mode';
+$messages['administrate_user_blog'] = 'Administrate this blog';
+$messages['trackbacks_updated_ok'] = '%s trackbacks updated successfully';
+$messages['trackback_updated_ok'] = 'Trackback updated successfully';
+$messages['error_trackback_status'] = 'Please select a valid status';
+$messages['select'] = 'Select';
+$messages['remove_selected'] = 'Remove Selected';
+
+$messages['notification_subject'] = 'LifeType Notification System';
+$messages['error_no_trackback_links_sent'] = 'Warning: No Trackbacks were sent.';
+
+$messages['help_http_cache_lifetime'] = 'Lifetime in seconds of the client side cache (browsers will not return to the server for this long, and pages will be served from the local cache.  This greatly speeds up the browsing experience, but will delay post and comment visibility. [Default = 1800]';
+
+$messages['trackbacks_no_trackback'] = 'Sending a trackback to the following URL failed: ';
+
+$messages['error_comment_spam_throw_away'] = 'You cannot post this message. Anti-spam filter has blocked it.';
+$messages['error_comment_spam_keep'] = 'The anti-spam filter has put your comment in the moderation queue and it will have to be approved by the blog owner.';
+
+$messages['blog_categories'] = 'Blog Categories';
+$messages['global_article_categories'] = 'Global Article Categories';
+
+$messages['help_force_posturl_unique'] = 'Force all post URLs within a blog to be unique.  This is only needed if you are changing the URLs and are removing the date portions of the URL. [ Default = no ]';
+
+$messages['default_send_notification'] = 'Default Send Notification';
+
+$messages['enable_pull_down_menu'] = 'Pull Down Menu';
+$messages['enable_pull_down_menu_help'] = 'Enable the pull down menu.';
+
+$messages['change_album'] = 'Change Album';
+
+$messages['warning_autosave_message'] = '<img src="imgs/admin/icon_warning-16.png" alt="Error" class="InfoIcon"/><p class="ErrorText">You seem to have left here without saving your post. If so, you may <a href="#" onclick="restoreAutoSave();">click here to restore it</a> or <a href="#" onclick="eraseAutoSave();">delete it</a>.</p>';
+
+$messages['check_username'] = 'Check User Name';
+$messages['check_username_ok'] = 'The user name is available!';
+$messages['error_username_exist'] = 'Sorry! The user name is not available, please try others.';
+
+$messages['error_rule_email_dns_server_temp_fail'] = 'Temporary failure - try again later.';
+$messages['error_rule_email_dns_server_unreachable'] = 'Email server unreachable.';
+$messages['error_rule_email_dns_not_permitted'] = 'E-mail not permitted.';
+
+$messages['blog_users_help'] = 'Users who have access to this blog.';
+
+$messages['summary_welcome_paragraph'] = 'This message is only a placeholder and should be edited when customizing this page for your service. This message is currently stored in the en_UK locale file but you may also edit the template templates/summary/index.template and place your text there.';
+
+$messages['first_day_of_week'] = 0;
+$messages['first_day_of_week_label'] = 'First Day of Week';
+$messages['first_day_of_week_help'] = 'First Day of Week in calendar.';
+
+$messages['help_subdomains_base_url'] = 'When subdomains are enabled, this base URL is used instead of base_url. Use {blogname} to get the blog name, {username} to get the name of the user owner of the blog and {blogdomain} to allow the user to specify any subdomain in order to generate a link to a blog. (e.g. http://{blogname}.yourdomain.com)';
+
+$messages['registration_default_subject'] = 'LifeType registration confirmation';
+
+$messages['error_invalid_subdomain'] = 'The subdomain name is not valid or it is not unique';
+$messages['register_blog_domain_help'] = 'Name and subdomain that you would like to use for your new blog.';
+$messages['domain'] = 'Domain';
+$messages['help_subdomains_available_domains'] = 'Enter a space delimited set of main domains allowed.  The user will be presented with a dropdown list of these values, and can add any subdomain he wants.  This is only used if you enabled subdomains and used {blogdomain} in the subdomain_base_url above. Use a \'?\' if you want to allow any domain.';
+$messages['subdomains_any_domain'] = '<- Multi-domain enabled. Type in the full domain.';
+$messages['error_updating_blog_subdomain'] = 'There was an error updating the subdomain.  Please check the data and try again.';
+$messages['error_updating_blog_main_domain'] = 'There was an error updating the main domain setting. This probably means the site administrator has configured something incorrectly.';
+
+$messages['monthsshort'] = Array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
+$messages['weekdaysshort'] = Array( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' );
+
+$messages['search_type'] = 'Search in';
+$messages['posts'] = 'Posts';
+$messages['blogs'] = 'Blogs';
+$messages['resources'] = 'Resources';
+$messages['upload_in_progress'] = 'Uploading. Please wait...';
+$messages['error_incorrect_username'] = 'The username is not correct, it is already in use or it is too long (maximum 15 characters)';
+
+$messages['Miscellaneous'] = 'Miscellaneous';
+$messages['Plugins'] = 'Plugins';
+
+$messages['auth_img'] = 'Authentication code';
+$messages['auth_img_help'] = 'Please type the code you see in the image below.';
+
+$messages['global_category'] = 'Global category';
+$messages['global_article_category_help'] = 'Site wide category for this post.';
+
+$messages['password_reset_subject'] = 'LifeType Password Request';
+
+//
+// new strings for LifeType 1.2
+//
+$messages['auth'] = 'Auth';
+$messages['authenticated'] = 'Authenticated';
+$messages['dropdown_list_field'] = 'Drop-down list';
+$messages['values'] = 'Field values';
+$messages['field_values'] = 'Values that will be shown as options in this field. The first one will be used as the default option.';
+
+$messages['permission_added_ok'] = 'Permission added successfullly';
+$messages['core_perm'] = 'Core Permission';
+$messages['admin_only'] = 'Admin Only';
+$messages['permissionsList'] = 'Permissions';
+$messages['newPermission'] = 'New Permission';
+$messages['permission_name_help'] = 'Unique name for the permission';
+$messages['permission_description_help'] = 'Description given for the permission';
+$messages['core_perm_help'] = 'If this permission is part of the core permissions, it will not be possible to delete it';
+$messages['admin_only_help'] = 'Whether this permission can only be assigned by administrator users';
+$messages['error_adding_new_permission'] = 'There was an error adding the new permission, please check your data';
+$messages['error_incorrect_permission_id'] = 'The permission identifier was not correct';
+$messages['error_permission_cannot_be_deleted'] = 'Permission "%s" cannot be deleted because either it has been granted to at least one user or it is a core permission.';
+$messages['error_deleting_permission'] = 'There was an error deleting permission "%s"';
+$messages['permission_deleted_ok'] = 'Permission "%s" was deleted successfully';
+$messages['permissions_deleted_ok'] = '%s permissions successfully deleted';
+$messages['error_deleting_permission2'] = 'There was an error deleting permission with identifier "%s"';
+
+$messages['help_hard_show_posts_max'] = 'Maximum upper limit for articles shown in blog pages. If users set a custom value over this limit, it will be ignored and the value specified here will be used. [ Default = 50 ]';
+$messages['help_hard_recent_posts_max'] = 'Maximum upper limit for recent articles shown in blog pages. If users set a custom value over this limit, it will be ignored and the value specified here will be used [ Default = 25 ]';
+
+$messages['error_permission_required'] = 'You don\'t have enough permissions to perform the requested action';
+$messages['user_permissions_updated_ok'] = 'User permissions updated successfully';
+
+// blog permissions
+$messages['add_album_desc'] = 'Add new albums';
+$messages['add_blog_template_desc'] = 'Add new blog templates';
+$messages['add_blog_user_desc'] = 'Add new blog users';
+$messages['add_category_desc'] = 'Add new categories';
+$messages['add_custom_field_desc'] = 'Add new custom fields';
+$messages['add_link_desc'] = 'Add new links';
+$messages['add_link_category_desc'] = 'Add new link categories';
+$messages['add_post_desc'] = 'Add new posts';
+$messages['add_resource_desc'] = 'Add new resources';
+$messages['blog_access_desc'] = 'Allow access to this blog';
+$messages['update_album_desc'] = 'Update existing albums';
+$messages['update_blog_desc'] = 'Update the blog settings';
+$messages['update_blog_template_desc'] = 'Update a blog template';
+$messages['update_blog_user_desc'] = 'Update user permissions';
+$messages['update_category_desc'] = 'Updating existing categories';
+$messages['update_comment_desc'] = 'Update existing comments';
+$messages['update_custom_field_desc'] = 'Update existing custom fields';
+$messages['update_link_desc'] = 'Update existing links';
+$messages['update_link_category_desc'] = 'Update existing link categories';
+$messages['update_post_desc'] = 'Update existing posts';
+$messages['update_resource_desc'] = 'Update existing resources';
+$messages['update_trackback_desc'] = 'Update existing trackbacks';
+$messages['view_blog_templates_desc'] = 'View the blog templates';
+$messages['view_blog_users_desc'] = 'View the blog users';
+$messages['view_categories_desc'] = 'View the blog categories';
+$messages['view_comments_desc'] = 'View the blog comments';
+$messages['view_custom_fields_desc'] = 'View the blog custom fields';
+$messages['view_links_desc'] = 'View the blog links';
+$messages['view_link_categories_desc'] = 'View the blog link categories';
+$messages['view_posts_desc'] = 'View the blog posts';
+$messages['view_resources_desc'] = 'View the blog resources';
+$messages['view_trackbacks_desc'] = 'View the blog trackbacks';
+$messages['login_perm_desc'] = 'User is allowed to log in';
+// admin permissions
+$messages['add_blog_category_desc'] = 'User can add blog categories';
+$messages['add_global_article_category_desc'] = 'User can add global article categories';
+$messages['add_locale_desc'] = 'User can add new locales';
+$messages['add_permission_desc'] = 'User can add new permissions';
+$messages['add_site_blog_desc'] = 'User can add new blogs';
+$messages['add_template_desc'] = 'User can add new templates';
+$messages['add_user_desc'] = 'User can add new users';
+$messages['edit_blog_admin_mode_desc'] = 'User can administrate other blogs (admin mode)';
+$messages['purge_data_desc'] = 'User can purge data';
+$messages['update_blog_category_desc'] = 'User can update and delete blog categories';
+$messages['update_global_article_category_desc'] = 'User can update and delete global article categories';
+$messages['update_global_settings_desc'] = 'User can update the site settings';
+$messages['update_locale_desc'] = 'User can update and delete locales';
+$messages['update_permission_desc'] = 'User can update and delete permissions';
+$messages['update_plugin_settings_desc'] = 'User can update plugin settings';
+$messages['update_site_blog_desc'] = 'User can update and delete blogs';
+$messages['update_template_desc'] = 'User can update and delete templates';
+$messages['update_user_desc'] = 'User can update and delete users';
+$messages['view_blog_categories'] = 'User can view the blog categories';
+$messages['view_global_article_categories_desc'] = 'User can view the global article categories';
+$messages['view_global_settings_desc'] = 'User can view the site settings';
+$messages['view_locales_desc'] = 'User can view the locales';
+$messages['view_permissions_desc'] = 'User can view the permissions';
+$messages['view_plugins_desc'] = 'User can view the installed plugins';
+$messages['view_site_blogs_desc'] = 'User can view the site blogs';
+$messages['view_templates_desc'] = 'User can view the templates';
+$messages['view_users_desc'] = 'User can view the users';
+$messages['update_blog_stats_desc'] = 'User can delete referrers';
+$messages['manage_admin_plugins_desc'] = 'Manage the admin-only features of plugins';
+
+$messages['summary_welcome_msg'] = 'Welcome, %s!';
+$messages['summary_go_to_admin'] = 'Go to admin interface';
+
+$messages['error_can_only_update_own_articles'] = 'Your permissions allow you only to modify your own articles.';
+$messages['update_all_user_articles_desc'] = 'Allow to modify other users\' articles';
+$messages['error_can_only_view_own_articles'] = 'Your permissions allow you only to see your own articles.';
+$messages['view_all_user_articles_desc'] = 'Allow to view other users\' articles';
+$messages['error_fetching_permission'] = 'There was an error loading the permission';
+$messages['editPermission'] = 'Edit Permission';
+$messages['error_updating_permission'] = 'There was an error updating the permission';
+$messages['permission_updated_ok'] = 'Permission updated succesfully';
+$messages['error_adding_permission'] = 'There was an error adding the permission';
+$messages['error_cannot_login'] = 'Sorry, you are not allowed to log in';
+$messages['admin_user_permissions_help'] = 'Site-wide permissions granted to this user';
+
+$messages['permissions'] = 'Permissions';
+$messages['blog_user_permissions_help'] = 'Permissions assigned to this user in this blog';
+$messages['pluginSettings'] = 'Plugin Settings';
+$messages['user_can_override'] = 'Users can override';
+$messages['user_cannot_override'] = 'Users cannot override';
+$messages['global_plugin_settings_saved_ok'] = 'Global plugin settings saved successfully';
+$messages['error_updating_global_plugin_settings'] = 'There was an error saving the the global plugin settings';
+$messages['error_incorrect_value'] = 'The value is not correct';
+$messages['parameter'] = 'Parameter';
+$messages['value'] = 'Value';
+$messages['override'] = 'Override';
+$messages['editCustomField'] = 'Edit Custom Field';
+$messages['view_blog_stats_desc'] = 'View the blog statistics';
+$messages['manage_plugins_desc'] = 'Manage blog plugins';
+
+$messages['error_global_category_has_articles'] = 'The global article category cannot be deleted because it still has articles';
+$messages['error_adding_global_article_category'] = 'There was an error adding the global article category';
+
+$messages['temp_folder_reset_ok'] = 'The temporary folder was successfully cleaned up';
+$messages['cleanup_temp_help'] = 'This will trigger a clean up of the temporary folder, forcing the data cache and the template cache to be reset for all blogs.';
+$messages['cleanup_temp'] = 'Purge temporary folder';
+
+$messages['comment_only_auth_users'] = 'Only authenticated users can comment';
+$messages['comment_only_auth_users_help'] = 'Only those users who have logged in with a valid user name and password will be allowed to write comments';
+$messages['show_comments_max'] = 'Comments per page';
+$messages['show_comments_max_help'] = 'Maximum number of comments per page [ Default = 20 ]';
+$messages['hard_show_comments_max_help'] = 'Hard limit for the number of comments per page [ Default = 50 ]';
+
+$messages['error_resource_not_whitelisted_extension'] = 'This file is not one of the allowed types.';
+$messages['help_upload_allowed_files'] = 'Space-separated list of file types that are allowed to be uploaded. Usage of \'*\' and \'?\' is allowed. If both upload_forbidden_file and this option are set, the whitelist (upload_allowed_files) takes precedence over the blacklist [Default = None]';
+
+$messages['help_template_load_order'] = 'Defines in which order template files are searched and loaded. If using \'Load default templates first\', LifeType will try to find files first in the templates/default/ folder and if not available there, then it will load the user\'s template files. If the same template file exists in both places, the default one takes precedence. If set to \'Load user templates first\', user templates are always loaded first and if unavailable, then the default one is used. If the same template file exists in both places, the user template always takes precedence.';
+$messages['template_load_order_user_first'] = 'Load default templates first';
+$messages['template_load_order_default_first'] = 'Load user templates first';
+
+$messages['editBlogUser'] = 'Edit Blog User';
+
+$messages['help_summary_service_name'] = 'Name of your site/service that will appear in several places in the front page as well as in the RSS feeds [ Default = empty ]';
+
+$messages['register_step2_help'] = 'Please provide the required information in order to create a blog.';
+
+$messages['create_date'] = 'Date created';
+
+$messages['insert_media'] = 'Insert media';
+$messages['insert_more'] = 'Toggle "More..." link';
+
+$messages['purging_please_wait'] = 'Please wait while data is being purged. This page will keep refreshing itself until all data has been processed, please do not attempt to stop this process';
+
+$messages['error_cannot_delete_last_blog_category'] = 'You cannot delete the last blog category.';
+
+$messages['help_logout_destination_url'] = 'URL where users will be forwarded when logging out of the administration interface instead of the login page. [ Default Value = empty ]';
+$messages['help_default_global_article_category_id'] = 'Identifier of the default global article category [ Default = empty ]';
+$messages['help_blog_does_not_exist_url'] = 'URL where users will be forwarded when they attempt to reach a blog that does not exist in this site, instead of being forwarded to the site\'s default blog [ Default = empty ]';
+
+$messages['error_invalid_blog_name'] = 'The blog name is not valid';
+
+/* strings for /default/ templates */
+
+
+$messages['help_forbidden_blognames'] = 'List of strings separated by a blank space that are not allowed to be used as blog names. It is possible to use regular expressions instead of plain strings. [ Default = (empty) ]';
+
+$messages['posts_updated_ok'] = '%s posts updated successfully';
+$messages['error_updating_post2'] = 'There was an error updating the article with idenfitier "%s"';
+$messages['resources_updated_ok'] = '% resources updated successfully';
+$messages['error_updating_resource2'] = 'There was an error updating the resource with identifier "%s"';
+$messages['albums_updated_ok'] = '%s albums updated successfully';
+$messages['error_updating_album2'] = 'There was an error updating album with identifier "%s"';
+$messages['links_updated_ok'] = '%s links updated successfully';
+$messages['error_updating_link2'] = 'There was an error updating the link with identifier "%s"';
+
+$messages['version'] = 'Version';
+
+$messages['error_resources_disabled'] = 'Sorry, support for uploading new resources has been disabled in this site';
+$messages['help_login_admin_panel'] = 'Click the blog name to enter the administration page.';
+
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog with identifier "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%s"';
+
+$messages['error_updating_user'] = 'There was an error updating user "%s".';
+$messages['user_updated_ok'] = 'User "%s" was successfully updated.';
+$messages['users_updated_ok'] = '%s users were successfully updated';
+$messages['eror_updating_user2'] = 'There was an error updating the user with identifier "%s"';
+
+$messages['error_select_status'] = 'Please select a valid status';
+$messages['error_invalid_blog_name'] = 'Sorry, the blog name is not valid';
+
+$messages['help_resources_naming_rule'] = 'The file naming rules for uploaded resources. \'Original File Name\' will use the original name of the file. \'Encoded File Name\' will use the encoded file name for uploaded resources, the naming rule is [BlogId]-[ResourceId].[Ext]. Please use \'Encoded File Name\' if you are running LifeType on a Multi-Byte Microsoft Windows server. <strong>NOTE: Please don\'t change this option after users have uploaded files into LifeType or older files will not be accessible anymore.</strong> [Default = Original File Name]';
+$messages['original_file_name'] = 'Original File Name';
+$messages['encoded_file_name'] = 'Encoded File Name';
+
+$messages['quick_permission_selection'] = 'Quick permission selection';
+$messages['basic_blog_permission'] = 'Allow blog user to add, update and delete posts, links and resources';
+$messages['full_blog_permission'] = 'Allow blog user to access all blog functions as blog owner';
+
+$messages['error_template_exist'] = 'There was an error uploading the template, template "%s" already exist.';
+
+/// new strings in LT 1.2.2 ///
+$messages['posted_by_help'] = 'Select article owner';
+$messages['insert_player'] = 'Insert Player';
+
+/// new strings in LT 1.2.3 ///
+$messages['help_allow_javascript_blocks_in_posts'] = 'Allow blocks of Javascript code in posts via &lt;script&gt; tags. Please be aware that it may pose a security risk to your blog(s) [ Default = No ]';
+
+$messages['Versions'] = 'Versions';
+$messages['incorrect_file_version_error'] = 'The following files do not match the expected contents:';
+$messages['lifetype_version'] = 'LifeType';
+$messages['lifetype_version_help'] = 'The currently installed version of LifeType is:';
+$messages['file_version_check'] = 'File Version Check';
+$messages['file_version_check_help'] = 'This will perform a basic check on most of LifeType\'s core files, in order to ensure that the current version of the files matches the expected contents according to the installed version. If you have not performed any customizations or changes,
+all files should match the expected version. Please be patient, this process may take a while.';
+$messages['check'] = 'Check';
+$messages['all_files_ok'] = 'All files are correct';
+
+/// new strings for LT 1.2.4 ///
+$messages['plugin_latest_version'] = 'Most recent version available: ';
+$messages['check_versions'] = 'Check versions';
+$messages['lt_version_ok'] = 'The current version of Lifetype is up to date.';
+$messages['lt_version_error'] = 'The most recent version of Lifetype is: ';
+$messages['release_notes'] = 'Release notes';
+
+$messages['kb'] = 'Kb';
+$messages['mb'] = 'Mb';
+$messages['gb'] = 'Gb';
+$messages['edit'] = 'Edit';
+
+/// new strings for LT 1.2.5 ///
+$messages['bookmark_this_filter'] = 'Bookmark this filter';
+$messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is advisable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
+?>
\ No newline at end of file

Modified: plog/trunk/locale/admin/locale_it_IT.php
===================================================================
--- plog/trunk/locale/admin/locale_it_IT.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_it_IT.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1191,4 +1191,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/admin/locale_nl_NL.php
===================================================================
--- plog/trunk/locale/admin/locale_nl_NL.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_nl_NL.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1270,4 +1270,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/admin/locale_ru_RU.php
===================================================================
--- plog/trunk/locale/admin/locale_ru_RU.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_ru_RU.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1178,4 +1178,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/admin/locale_tt_RU.php
===================================================================
--- plog/trunk/locale/admin/locale_tt_RU.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_tt_RU.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1180,4 +1180,11 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/admin/locale_zh_CN.php
===================================================================
--- plog/trunk/locale/admin/locale_zh_CN.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_zh_CN.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1192,7 +1192,14 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
 
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
+
 /// new strings in LT 1.3 ///
 // friend management
 $messages['friendManagement'] = '好友管理';

Modified: plog/trunk/locale/admin/locale_zh_TW.php
===================================================================
--- plog/trunk/locale/admin/locale_zh_TW.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/locale/admin/locale_zh_TW.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1192,7 +1192,14 @@
 /// new strings for LT 1.2.5 ///
 $messages['bookmark_this_filter'] = 'Bookmark this filter';
 $messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is adivsable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
 
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
+
 /// new strings in LT 1.3 ///
 // friend management
 $messages['friendManagement'] = '好友管理';

Copied: plog/trunk/locale/locale_hu_HU.php (from rev 5900, plog/branches/lifetype-1.2/locale/locale_hu_HU.php)
===================================================================
--- plog/trunk/locale/locale_hu_HU.php	                        (rev 0)
+++ plog/trunk/locale/locale_hu_HU.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -0,0 +1,146 @@
+<?php
+// Initial translation by Tamás Gulácsi
+// gthomas at gthomas.homelinux.org http://gthomas.homelinux.org/
+// Göd - HUNGARY (Europe)
+
+$messages["encoding"] = 'UTF-8';
+$messages['locale_description'] = 'Magyar ford&iacute;t&aacute;s a LifeType-hoz';	// must use HTML entities to be ok with any charset
+
+// locale format, see Locale::formatDate for more information
+$messages['date_format'] = '%Y.%m.%d %H:%M';
+
+$messages['days'] = Array( "vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat" );
+// -- compatibility, do not touch -- //
+$messages["Monday"] = $messages["days"][1];
+$messages["Tuesday"] = $messages["days"][2];
+$messages["Wednesday"] = $messages["days"][3];
+$messages["Thursday"] = $messages["days"][4];
+$messages["Friday"] = $messages["days"][5];
+$messages["Saturday"] = $messages["days"][6];
+$messages["Sunday"] = $messages["days"][0];
+
+// abbreviations
+$messages["daysshort"] = Array( "vas", "hé", "ke", "sze", "csüt", "pén", "szo" );
+// -- compatibility, do not touch -- //
+$messages["Mo"] = $messages["daysshort"][1];
+$messages["Tu"] = $messages["daysshort"][2];
+$messages["We"] = $messages["daysshort"][3];
+$messages["Th"] = $messages["daysshort"][4];
+$messages["Fr"] = $messages["daysshort"][5];
+$messages["Sa"] = $messages["daysshort"][6];
+$messages["Su"] = $messages["daysshort"][0];
+
+// months of the year
+$messages["months"] = Array( "január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december" );
+// -- compatibility, do not touch -- //
+$messages["January"] = $messages["months"][0];
+$messages["February"] = $messages["months"][1];
+$messages["March"] = $messages["months"][2];
+$messages["April"] = $messages["months"][3];
+$messages["May"] = $messages["months"][4];
+$messages["June"] = $messages["months"][5];
+$messages["July"] = $messages["months"][6];
+$messages["August"] = $messages["months"][7];
+$messages["September"] = $messages["months"][8];
+$messages["October"] = $messages["months"][9];
+$messages["November"] = $messages["months"][10];
+$messages["December"] = $messages["months"][11];
+
+// miscellaneous texts
+$messages['message'] = 'üzenet';
+$messages['error'] = 'Hiba';
+$messages['date'] = 'dátum';
+$messages['of'] = '';
+$messages['recently'] = 'nemrég…';
+$messages['comments'] = 'megjegyzések';
+$messages['comment on this'] = 'Megjegyzés';
+$messages['my_links'] = 'Linkjeim';
+$messages['archives'] = 'archívumok';
+$messages['search'] = 'keresés';
+$messages['calendar'] = 'kalendárium';
+$messages['search_s'] = 'Keress';
+$messages['search_this_blog'] = 'Keress ebben a blogban :';
+$messages['about_myself'] = 'Ki vagyok én?';
+$messages['permalink_title'] = 'Állandó link az archívumokra';
+$messages['permalink'] = 'Permalink';
+$messages['posted_by'] = 'Beküldte';
+$messages['reply'] = 'Válasz';
+$messages['articles'] = 'Cikkek';
+$messages['contact_me'] = 'Lépj kapcsolatba velem';
+$messages['required'] = 'kötelező';
+$messages['form_authenticated'] = 'Hitelesítve';
+$messages['posted_in'] = 'Beküldve';
+$messages['previous_post'] = 'Előző';
+$messages['next_post'] = 'Következő';
+$messages['comment_default_title'] = '(nincs címe)';
+$messages['guestbook'] = 'Vendégkönyv';
+$messages['trackbacks'] = 'Visszautalás';
+$messages['menu'] = 'Menü';
+$messages['albums'] = 'Albumok';
+$messages['admin'] = 'Adminisztrátor';
+$messages['links'] = 'Linkek';
+$messages['categories'] = 'Kategóriák';
+$messages['num_reads'] = 'Nézetek';
+$messages['category'] = 'Kategória';
+
+// add comment form
+$messages['add_comment'] = 'Kommentálás';
+$messages['comment_topic'] = 'Téma';
+$messages['comment_text'] = 'Szöveg';
+$messages['comment_username'] = 'Neved';
+$messages['comment_email'] = 'email címed (ha van)';
+$messages['comment_url'] = 'Honlapod (ha van)';
+$messages['comment_send'] = 'Küldés';
+$messages['comment_added'] = 'Megjegyzést hozzáadtam!';
+$messages['comment_add_error'] = 'Hiba miatt nem sikerült a megjegyzést hozzáadni';
+$messages['article_does_not_exist'] = 'A cikk nem létezik';
+$messages['no_posts_found'] = 'Nem találtam hozzászólást';
+$messages['user_has_no_posts_yet'] = 'A felhasználónak még nincs hozzászólása';
+$messages['back'] = 'Vissza';
+$messages['post'] = 'Hozzászólás';
+$messages['trackbacks_for_article'] = 'Visszautalás egy cikkre: ';
+$messages['trackback_excerpt'] = 'Kivonat';
+$messages['trackback_weblog'] = 'Blog';
+$messages['search_results'] = 'A keresés eredménye';
+$messages['search_matching_results'] = 'A következő hozzászólásokat találtam: ';
+$messages['search_no_matching_posts'] = 'Nem találtam a feltételeknek megfelelő hozzászólást';
+$messages['read_more'] = '<br /> (Folytatás)';
+$messages['syndicate'] = 'Szindikátus';
+$messages['main'] = 'Főmenü';
+$messages['about'] = 'Rólunk';
+$messages['download'] = 'Letöltés';
+$messages['invalid_url'] = 'Érvénytelen URL-t adtál meg. Kérlek javítsd és próbáld újra';
+
+////// error messages /////
+$messages['error_fetching_article'] = 'A cikket nem tudtam betölteni.';
+$messages['error_fetching_articles'] = 'A cikkeket nem sikerült betölteni.';
+$messages['error_trackback_no_trackback'] = 'A cikkhez nem találtam visszautalást.';
+$messages['error_incorrect_article_id'] = 'A cikk azonosítója hibás.';
+$messages['error_incorrect_blog_id'] = 'A blog azonosító hibás.';
+$messages['error_comment_without_text'] = 'Valami szöveget meg kell adni!';
+$messages['error_comment_without_name'] = 'A név kötelező!';
+$messages['error_adding_comment'] = 'Hiba történt a megjegyzés hozzáadásakor.';
+$messages['error_incorrect_parameter'] = 'Hibás paraméter.';
+$messages['error_parameter_missing'] = 'Egy paraméter hiányzik.';
+$messages['error_comments_not_enabled'] = 'Nem lehet megjegyzést hozzáfűzni.';
+$messages['error_incorrect_search_terms'] = 'Hibás keresési feltételek';
+$messages['error_no_search_results'] = 'Nincs találat';
+$messages['error_no_albums_defined'] = 'Nincsenek albumok.';
+$messages['error_incorrect_category_id'] = 'A kategória azonosító hibás, vagy nem lett kijelölve';
+$messages['error_incorrect_email_address'] = 'Hibás email-cím';
+$messages['error_fetching_category'] = 'Hiba történt a kategória betöltésekor.';
+$messages['error_fetching_resource'] = 'A megadott fájl nem találató.';
+$messages['error_incorrect_user'] = 'A felhasználónév nem érvényes';
+
+$messages['size'] = 'Méret';
+$messages['format'] = 'Formátum';
+$messages['dimensions'] = 'Dimenziók';
+$messages['bits_per_sample'] = 'Színmélység';
+$messages['sample_rate'] = 'Mintavételi sebesség';
+$messages['number_of_channels'] = 'Csatornák száma';
+$messages['length'] = 'Hossz';
+
+/// Strings added in LT 1.2.4 ///
+$messages['audio_codec'] = 'Hang kodek';
+$messages['video_codec'] = 'Video kodek';
+?>

Modified: plog/trunk/templates/admin/editarticlecategories_table.template
===================================================================
--- plog/trunk/templates/admin/editarticlecategories_table.template	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/templates/admin/editarticlecategories_table.template	2007-10-23 10:05:55 UTC (rev 6006)
@@ -17,7 +17,7 @@
   <td class="col_highlighted">
    {check_perms perm=update_category}<a id="category_name_{$category->getId()}" rel="overlay" href="admin.php?op=editArticleCategory&amp;categoryId={$category->getId()}">{/check_perms}{$category->getName()}{check_perms perm=update_category}</a>{/check_perms}
   </td>
-  {if $category->getNumArticles() > 0}
+  {if $category->getNumAllArticles() > 0}
    <td>{check_perms perm=view_articles}<a id="category_num_articles_{$category->getId()}"	 href="admin.php?op=editPosts&amp;showCategory={$category->getId()}&amp;showStatus=0&amp;showMonth=-1">{/check_perms}{$category->getNumAllArticles()}{check_perms perm=view_articles}</a>{/check_perms}</td>
   {else}
    <td>0</td>

Modified: plog/trunk/templates/admin/globalsettings_summary.template
===================================================================
--- plog/trunk/templates/admin/globalsettings_summary.template	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/templates/admin/globalsettings_summary.template	2007-10-23 10:05:55 UTC (rev 6006)
@@ -77,4 +77,11 @@
     <input class="radio" type="radio" id="config[use_http_accept_language_detection]" name="config[use_http_accept_language_detection]" value="1" {if $use_http_accept_language_detection == 1 } checked="checked" {/if} />{$locale->tr("yes")}
     <input class="radio" type="radio" id="config[use_http_accept_language_detection]" name="config[use_http_accept_language_detection]" value="0" {if $use_http_accept_language_detection == 0 } checked="checked" {/if} />{$locale->tr("no")}  
   </div>
+   <!-- notify_new_blogs -->
+   <div class="field">
+    <label for="config[notify_new_blogs]">notify_new_blogs</label>
+	<div class="formHelp">{$locale->tr("help_notify_new_blogs")}</div> 
+    <input class="radio" type="radio" id="config[notify_new_blogs]" name="config[notify_new_blogs]" value="1" {if $notify_new_blogs == 1 } checked="checked" {/if} />{$locale->tr("yes")}
+    <input class="radio" type="radio" id="config[notify_new_blogs]" name="config[notify_new_blogs]" value="0" {if $notify_new_blogs == 0 } checked="checked" {/if} />{$locale->tr("no")}
+  </div>
  </div> 
\ No newline at end of file

Copied: plog/trunk/wizard (from rev 5900, plog/branches/lifetype-1.2/wizard)
===================================================================
--- plog/trunk/wizard	                        (rev 0)
+++ plog/trunk/wizard	2007-10-23 10:05:55 UTC (rev 6006)
@@ -0,0 +1,2367 @@
+|<?php
+
+    if (!defined( "PLOG_CLASS_PATH" )) {
+        define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
+    }
+
+    set_time_limit (5 * 3600);
+
+    //
+    // enable this for debugging purposes
+    //
+    define( "DB_WIZARD_DEBUG", false );
+
+    //
+    // in case you're having problems with time outs while upgrading (probably too
+    // many records) lower this figure
+    //
+    define( "WIZARD_MAX_RECORDS_PER_STEP", 75 );
+    
+    //
+    // minimum php version required
+    //
+    define( "MIN_PHP_VERSION", "4.2.0" );
+    
+    //
+    // whether data transformers should fail on error by default
+    // It might be convenient to set this to 'false' if we're running
+    // the wizard on top of an already updated installation
+    //
+    define( "DATABASE_DATA_TRANSFORMER_FAIL_ON_ERROR_DEFAULT", true );
+
+    // many hosts don't have this enabled and we, for the time being, need it...
+    ini_set("arg_seperator.output", "&amp;");
+
+    include_once( PLOG_CLASS_PATH."class/bootstrap.php" );
+    lt_include( PLOG_CLASS_PATH."class/controller/controller.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/action/action.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/database/db.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/template/template.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/data/validator/passwordvalidator.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );    
+    lt_include( PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/misc/version.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/file/finder/filefinder.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/gallery/resizers/gddetector.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/config/configfilestorage.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/locale/localefinder.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );     
+	lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/dao/permission.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/dao/userpermission.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/misc/integritychecker.class.php" );
+    
+    // table schemas
+    include( PLOG_CLASS_PATH."install/dbschemas.properties.php" );
+    // default configuration values for 1.1
+    include( PLOG_CLASS_PATH."install/defaultconfig.properties.php" );
+
+    define( "TEMP_FOLDER", "./tmp" );
+
+    // maps used to map requests with actions
+    $_actionMap["Checks"] = "WizardChecks";
+    $_actionMap["Default"] = "WizardChecks";
+    $_actionMap["Intro"] = "WizardIntro";
+    $_actionMap["Step1"] = "WizardStepOne";
+    $_actionMap["Step2"] = "WizardStepTwo";
+    $_actionMap["Step3"] = "WizardStepThree";
+    $_actionMap["Step4"] = "WizardStepFour";
+    $_actionMap["Step5"] = "WizardStepFive";
+    $_actionMap["Update1"] = "UpdateStepOne";
+    $_actionMap["Update2"] = "UpdateStepTwo";
+    $_actionMap["Update3"] = "UpdateStepThree";
+    $_actionMap["Fix120"] = "Fix120StepOne";
+
+
+    /**
+     * Open a connection to the database
+     */
+     function connectDb( $ignoreError = false , $selectDatabase = true )
+     {
+        $config = new ConfigFileStorage();
+        // open a connection to the database
+        //$db = NewADOConnection('mysql');
+        $db = PDb::getDriver('mysql');
+        
+        if ( $selectDatabase ) {
+            $res = $db->Connect($config->getValue( "db_host" ), $config->getValue( "db_username" ), $config->getValue( "db_password" ), $config->getValue( "db_database" ), $config->getValue( "db_character_set" ));
+        } else {
+            $res = $db->Connect($config->getValue( "db_host" ), $config->getValue( "db_username" ), $config->getValue( "db_password" ), null, $config->getValue( "db_character_set" ));
+        }
+
+        if( DB_WIZARD_DEBUG )
+            $db->debug = true;
+
+        // return error
+        if( $ignoreError )
+            return $db;
+
+        if( !$res )
+            return false;
+
+        return $db;
+    }
+
+    /**
+     * Returns the database prefix
+     */
+    function getDbPrefix()
+    {
+        $config = new ConfigFileStorage();
+        return $config->getValue( "db_prefix" );
+    }
+
+    /**
+     * some useful little functions
+     */
+    class WizardTools
+    {
+       /**
+        * returns true if plog has already been installed before or
+        * false otherwise
+        */
+       function isNewInstallation()
+       {
+           $configFile = new ConfigFileStorage();
+           // if plog hasn't been installed, this file will have empty settings
+           if( $configFile->getValue( "db_host") == "" && $configFile->getValue( "db_username") == "" &&
+               $configFile->getValue( "db_database") == "" && $configFile->getValue( "db_prefix" ) == "" &&
+               $configFile->getValue( "db_password" ) == "" )
+               $isNew = true;
+           else
+               $isNew = false;
+
+           return( $isNew );
+       }
+
+		/**
+		 * Clean up the default temporary folder
+		 */
+		function cleanTmpFolder()
+		{
+			// remove the files recursively, but only files, do not do anything to directories
+			File::deleteDir( TEMP_FOLDER, true, true, array(".svn", ".htaccess") );
+		}
+    }
+
+    /**
+     * Renders a template file.
+     */
+    class WizardView extends View
+    {
+
+        var $_templateName;
+
+        function WizardView( $templateName )
+        {
+            $this->View();
+            $this->_templateName = $templateName;
+        }
+
+        function render()
+        {
+            // build the file name
+            $templateFileName = "wizard/".$this->_templateName.".template";
+
+            //$t = new Template( $templateFileName, "" );
+            $t = new Smarty();
+            $v = new Version();
+            $this->_params->setValue( "version", $v->getVersion());
+            $this->_params->setValue( "projectPage", $v->getProjectPage());
+            $this->_params->setValue( "safeMode", ini_get("safe_mode"));
+            $t->assign( $this->_params->getAsArray());
+            $t->template_dir    = "./templates";
+            $t->compile_dir     = TEMP_FOLDER;
+            $t->cache_dir       = TEMP_FOLDER;
+            $t->use_sub_dirs    = false;
+            $t->caching = false;
+
+            print $t->fetch( $templateFileName );
+        }
+    }
+    
+    class WizardAction extends Action
+    {
+        function WizardAction( $actionInfo, $request )
+        {
+            $this->Action( $actionInfo, $request );
+        }
+    }    
+    
+    class WizardValidator
+    {
+        var $_desc;
+        var $_critical;
+        var $_valid;
+        var $_solution;
+    
+        function WizardValidator( $desc = "", $solution = "", $critical = true )
+        {            
+            $this->_desc = $desc;
+            $this->_critical = $critical;
+            $this->_valid = false;
+            $this->_solution = $solution;
+        }
+        
+        function isCritical()
+        {
+            return( $this->_critical );
+        }
+        
+        function getDesc()
+        {
+            return( $this->_desc );
+        }
+        
+        function isValid()
+        {
+            return( $this->_valid );
+        }
+        
+        function getSolution()
+        {
+            return( $this->_solution );
+        }
+        
+        function validate() 
+        {
+            return( $this->_valid );
+        }        
+    }
+    
+    class WizardPhpVersionValidator extends WizardValidator
+    {
+        function WizardPhpVersionValidator( $minVersion = MIN_PHP_VERSION )
+        {
+            $this->WizardValidator( "Checking if the installed <b>PHP</b> version is at least $minVersion", 
+                                    "Please upgrade your version of PHP to $minVersion or newer",
+                                    true );
+            $this->_minVersion = $minVersion;
+        }
+    
+        function validate()
+        {
+            $this->_valid = version_compare( phpversion(), $this->_minVersion ) >= 0;
+            return( parent::validate());
+        }
+    }
+    
+    class WizardWritableFileValidator extends WizardValidator
+    {
+        var $_file;
+        
+        function WizardWritableFileValidator( $file )
+        {
+            $this->WizardValidator( "Checking if file/folder <b>$file</b> is writable", 
+                                    "Please make sure that the file is writable by the web server",
+                                    true );
+            $this->_file = $file;
+        }
+    
+        function validate()
+        {
+            $this->_valid = File::isWritable( $this->_file );
+            return( parent::validate());
+        }
+    }
+    
+    class WizardSessionFunctionsAvailableValidator extends WizardValidator
+    {
+        function WizardSessionFunctionsAvailableValidator()
+        {
+            $this->WizardValidator( "Checking if <b>session</b> functions are available", 
+                                    "LifeType requires support for sessions to be part of your PHP installation",
+                                    true );
+        }
+    
+        function validate()
+        {
+            $this->_valid = function_exists( "session_start" ) &&
+                            function_exists( "session_destroy" ) &&
+                            function_exists( "session_cache_limiter" ) &&
+                            function_exists( "session_name" ) &&
+                            function_exists( "session_set_cookie_params" ) &&
+                            function_exists( "session_save_path" );
+            return( parent::validate());            
+        }
+    }
+
+    class WizardSessionSettingsValidator extends WizardValidator
+    {
+        function WizardSessionSettingsValidator()
+        {
+            $this->WizardValidator( "Checking if <b>session.auto_start</b> is disabled", 
+                                    "LifeType can only run when session.auto_start is disabled.",           
+                                    true );
+        }    
+    
+        function validate()
+        {
+            $this->_valid = (ini_get( "session.auto_start" ) == "0");
+            return( parent::validate());    
+        }
+    }
+       
+    class WizardMySQLFunctionsAvailableValidator extends WizardValidator
+    {
+        function WizardMySQLFunctionsAvailableValidator()
+        {
+            $this->WizardValidator( "Checking if <b>MySQL</b> functions are available", 
+                                    "LifeType requires support for MySQL to be part of your PHP installation",
+                                    true );
+        }
+    
+        function validate()
+        {
+            $this->_valid = function_exists( "mysql_select_db" ) &&
+                            function_exists( "mysql_query" ) &&
+                            function_exists( "mysql_connect" ) &&
+                            function_exists( "mysql_fetch_assoc" ) &&
+                            function_exists( "mysql_num_rows" ) &&
+                            function_exists( "mysql_free_result" );
+            return( parent::validate());                            
+        }        
+    }
+    
+    class WizardXmlFunctionsAvailableValidator extends WizardValidator
+    {
+        function WizardXmlFunctionsAvailableValidator()
+        {
+            $this->WizardValidator( "Checking if <b>XML</b> functions are available", 
+                                    "LifeType requires support for XML to be part of your PHP installation",
+                                    true );
+        }    
+    
+        function validate()
+        {
+            $this->_valid = function_exists( "xml_set_object" ) &&
+                            function_exists( "xml_set_element_handler" ) &&
+                            function_exists( "xml_parser_create" ) &&
+                            function_exists( "xml_parser_set_option" ) &&
+                            function_exists( "xml_parse" ) &&
+                            function_exists( "xml_parser_free" );
+            return( parent::validate());                            
+        }        
+    }
+    
+    class WizardSafeModeValidator extends WizardValidator
+    {
+        function WizardSafeModeValidator()
+        {
+            $this->WizardValidator( "Checking if <b>safe mode</b> is disabled", 
+                                    "LifeType can run when PHP's safe mode is enabled, but it may cause some problems.",           
+                                    false );
+        }    
+    
+        function validate()
+        {
+            $this->_valid = (ini_get( "safe_mode" ) == "");
+            return( parent::validate());    
+        }
+    }
+
+    class WizardIconvFunctionsAvailableValidator extends WizardValidator
+    {
+        function WizardIconvFunctionsAvailableValidator()
+        {
+            $this->WizardValidator( "Checking if <b>iconv</b> functions are available", 
+                                    "LifeType requires support for some resource metadata conversion and some LifeType plugins requires support for multi-byte language encoding/decoding.",
+                                    false );
+        }
+    
+        function validate()
+        {
+            $this->_valid = function_exists( "iconv" );
+            return( parent::validate());                            
+        }        
+    }
+
+    class WizardMbstringFunctionsAvailableValidator extends WizardValidator
+    {
+        function WizardMbstringFunctionsAvailableValidator()
+        {
+            $this->WizardValidator( "Checking if <b>mbstring</b> functions are available", 
+                                    "Some LifeType plugins requires support for multi-byte language encoding/decoding.",
+                                    false );
+        }
+    
+        function validate()
+        {
+            $this->_valid = function_exists( "mb_convert_encoding" );
+            return( parent::validate());                            
+        }        
+    }
+
+    class WizardGdFunctionsAvailableValidator extends WizardValidator
+    {
+        function WizardGdFunctionsAvailableValidator()
+        {
+            $this->WizardValidator( "Checking if <b>gd</b> or <b>gd2</b> functions are available", 
+                                    "LifeType requires support for generating image thumbnail.",
+                                    false );
+        }
+    
+        function validate()
+        {
+            $this->_valid = function_exists( "imagecopyresampled" ) &&
+            				function_exists( "imagecopyresized" );
+            return( parent::validate());                            
+        }        
+    }
+    
+    class WizardFileUploadsValidator extends WizardValidator
+    {
+        function WizardFileUploadsValidator()
+        {
+            $this->WizardValidator( "Checking if <b>file_uploads</b> is enabled", 
+                                    "LifeType requires support for uploading resources.",
+                                    true );
+        }    
+    
+        function validate()
+        {
+            $this->_valid = (ini_get( "file_uploads" ) == 1);
+            return( parent::validate());    
+        }
+    }
+
+    class WizardFileIntegrityValidator extends WizardValidator
+    {
+        function WizardFileIntegrityValidator()
+        {
+            $this->WizardValidator( "Checking that all files have been correctly uploaded", 
+                                    "will be set later on...",
+                                    false );
+        }    
+    
+        function validate()
+        {
+			include( PLOG_CLASS_PATH."install/files.properties.php");
+			
+			$result = IntegrityChecker::checkIntegrity( 
+				$data
+			);	
+	
+		
+            $this->_valid = ( count( $result ) == 0 );
+			if( !$this->_valid ) {
+				/* let's modify a private attribute... */
+				$fileList = implode( "<br/>", array_keys( $result ));
+				$this->_solution = "The current version of the following is not the expected one. Installation can proceed but please make sure that all files were uploaded correctly:"."<br/>".$fileList;				
+			}
+
+            return( parent::validate());
+        }
+    }
+    
+    class WizardCtypeFunctionsAvailableValidator extends WizardValidator
+    {
+        function WizardCtypeFunctionsAvailableValidator()
+        {
+            $this->WizardValidator( "Checking if <b>ctype</b> functions are available", 
+                                    "Some LifeType plugins requires support for variable type validation.",
+                                    false );
+        }
+    
+        function validate()
+        {
+            $this->_valid = function_exists( "ctype_digit" );
+            return( parent::validate());                            
+        }        
+    }               
+    
+    class WizardChecks extends WizardAction
+    {        
+        function perform()
+        {
+            // build the array with checks
+            $checkGroups['File checks'] = Array(
+               "writeConfigFile" => new WizardWritableFileValidator( "config/config.properties.php" ),
+               "writeTmpFolder" => new WizardWritableFileValidator( "tmp" ),
+               "writeGalleryFolder" => new WizardWritableFileValidator( "gallery" ),
+			   "fileVersionCheck" => new WizardFileIntegrityValidator()
+            );
+            
+            $checkGroups['PHP version checking'] = Array(
+               "php" => new WizardPhpVersionValidator()
+            );
+
+            $checkGroups['PHP configuration checking'] = Array(
+               "sessionSettings" => new WizardSessionSettingsValidator(),
+               "safemode" => new WizardSafeModeValidator(),
+               "fileUploads" => new WizardFileUploadsValidator()
+            );
+            
+            $checkGroups['PHP functions availability checking'] = Array(
+               "sessions" => new WizardSessionFunctionsAvailableValidator(),
+               "mysql" => new WizardMySQLFunctionsAvailableValidator(),
+               "xml" => new WizardXmlFunctionsAvailableValidator(),
+               "iconv" => new WizardIconvFunctionsAvailableValidator(),
+               "mbstring" => new WizardMbstringFunctionsAvailableValidator(),
+               "gd" => new WizardGdFunctionsAvailableValidator(),
+               "ctype" => new WizardCtypeFunctionsAvailableValidator()
+            );                                    
+            
+            // run the checks
+            $ok = true;
+            foreach( $checkGroups as $checkGroup => $checks ) {
+	            foreach( $checks as $id => $check ) {
+	                $valid = $checkGroups[$checkGroup][$id]->validate();
+	                // if it doesn't validate but it's not critical, then we can proced too
+	                if( !$checkGroups[$checkGroup][$id]->isCritical())
+	                    $valid = true;  
+	                $ok = ($ok && $valid);
+	            }
+	        }
+            
+            // create the view and pass the results
+            $this->_view = new WizardView( "checks" );
+            $this->_view->setValue( "ok", $ok );
+            $this->_view->setValue( "checkGroups", $checkGroups );
+            
+            if( WizardTools::isNewInstallation())
+                $this->_view->setValue( "mode", "install" );
+            else
+                $this->_view->setValue( "mode", "update" );
+
+            return true;
+        }
+    }
+    
+    class WizardPagedAction extends WizardAction
+    {
+        var $willRefresh;
+    
+        function WizardPagedAction( $actionInfo, $request ) 
+        {
+            $this->WizardAction( $actionInfo, $request );
+            
+            $this->willRefresh = false;
+        }
+        
+        /**
+         * @private
+         */
+        function getPageFromRequest()
+        {
+            lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php");    	
+			// get the value from the request
+			$page = HttpVars::getRequestValue( "page" );
+			// but first of all, validate it
+			$val = new IntegerValidator();
+			if( !$val->validate( $page ))
+				$page = 1;			
+							
+			return $page;        
+        }
+        
+        /**
+         * @private
+         */
+        function willRefresh()
+        {
+            return( $this->willRefresh );
+        }
+    }
+
+    /**
+     * Gets the information about the database from the user.
+     */
+    class WizardIntro extends WizardAction
+    {
+        function WizardIntro( $actionInfo, $request )
+        {
+            $this->WizardAction( $actionInfo, $request );
+        }
+
+        function perform()
+        {
+            // we can detect whether plog is already installed or not and direct users to the right
+            // place
+            if( WizardTools::isNewInstallation())
+                $this->_view = new WizardView( "intro" );
+            else {
+                Controller::setForwardAction( "Update1" );
+                return false;
+            }
+
+            $this->setCommonData();
+            return true;
+        }
+    }
+
+    /**
+     *
+     * Saves data to the configuration file
+     *
+     */
+    class WizardStepOne extends WizardAction
+    {
+
+        var $_dbServer;
+        var $_dbUser;
+        var $_dbPassword;
+        var $_dbName;
+        var $_dbPrefix;
+        var $_connection;
+
+        function WizardStepOne( $actionInfo, $request )
+        {
+            $this->WizardAction( $actionInfo, $request );
+
+            // data validation
+            $this->registerFieldValidator( "dbServer", new StringValidator());
+            $this->registerFieldValidator( "dbUser", new StringValidator());
+            $this->registerFieldValidator( "dbPassword",  new StringValidator(), true );
+            $this->registerFieldValidator( "dbName", new StringValidator());
+            $this->registerFieldValidator( "dbPrefix", new StringValidator(), true );
+            $errorView = new WizardView( "intro" );
+            $errorView->setErrorMessage( "Some data was incorrect or missing." );
+            $this->setValidationErrorView( $errorView );
+        }
+
+        function perform()
+        {
+            // fetch the data needed from the request
+            $this->_dbServer   = $this->_request->getValue( "dbServer" );
+            $this->_dbUser     = $this->_request->getValue( "dbUser" );
+            $this->_dbPassword = $this->_request->getValue( "dbPassword" );
+            $this->_dbName     = $this->_request->getValue( "dbName" );
+            $this->_skipThis   = $this->_request->getValue( "skipDbInfo" );
+            $this->_dbPrefix   = $this->_request->getValue( "dbPrefix", DEFAULT_DB_PREFIX );
+
+            // we should now save the data to the configuration file, just before
+            // we read it
+            $configFile = new ConfigFileStorage();
+
+            // we expect everything to be fine
+            $errors = false;
+
+            // before doing anything, we should check of the configuration file is
+            // writable by this script, or else, throw an error and bail out gracefully
+            $configFileName = $configFile->getConfigFileName();
+            if( !File::exists( $configFileName )) {
+                if (! File::touch( $configFileName ) ) {
+                    $this->_view = new WizardView( "intro" );
+                    $message = "Could not create the LifeType configuration file $configFileName. Please make sure
+                                that the file can be created by the user running the webserver. It is needed to
+                                store the database configuration settings.";
+                    $this->_view->setErrorMessage( $message );
+                    $this->setCommonData( true );
+                    return false;
+                } else {
+                    ConfigFileStorage::createConfigFile( $configFileName );
+                }
+            }
+            if( File::exists( $configFileName ) && !File::isWritable( $configFileName )) {
+                $this->_view = new WizardView( "intro" );
+                $message = "Please make sure that the file $configFileName can be written by this script during
+                            the installation process. It is needed to store the database configuration settings. Once the
+                            installation is complete, please revert the permissions to no writing possible.";
+                $this->_view->setErrorMessage( $message );
+                $this->setCommonData( true );
+                return false;
+            }
+
+            // continue if everything went fine
+            if( !$configFile->saveValue( "db_username", $this->_dbUser ) ||
+                !$configFile->saveValue( "db_password", $this->_dbPassword ) ||
+                !$configFile->saveValue( "db_host", $this->_dbServer ) ||
+                !$configFile->saveValue( "db_database", $this->_dbName ) ||
+                !$configFile->saveValue( "db_prefix", $this->_dbPrefix )) {
+                $errors = true;
+            }
+
+            if( $errors ) {
+                $message = "Could not save values to the configuration file. Please make sure it is available and
+                            that has write permissions for the user under your web server is running.";
+                $this->_view = new WizardView( "intro" );
+                $this->_view->setErrorMessage( $message );
+
+                return( false );
+            }
+            else {
+                $connectionEsablished = false;
+
+                $this->_connection = @mysql_connect( $this->_dbServer, $this->_dbUser, $this->_dbPassword );
+                if( $this->_connection ) {
+                    $connectionEsablished = true;
+                } else {
+                    $connectionEsablished = false;
+                    $message = "There was an error connecting to the database. Please check your settings.";
+                }
+
+                if ( !$connectionEsablished ) {
+                    $this->_view = new WizardView( "step1" );
+                    $this->_view->setErrorMessage( $message );
+                    $this->setCommonData( true );
+                    return false;
+                } else {
+                	$this->_view = new WizardView( "step1" );
+	                $availableCharacterSets = $this->getAvailableCharacterSets();
+	                $defaultCharacterSet = $this->getDatabaseCharacterSet();
+	                $createDatabase = false;
+	                if( empty( $defaultCharacterSet ) )
+	                {
+	                	$defaultCharacterSet = $this->getServerCharacterSet();
+	                	$createDatabase = true;
+	                }
+	                $this->_view->setValue( "availableCharacterSets", $availableCharacterSets );
+	                $this->_view->setValue( "defaultCharacterSet", $defaultCharacterSet );
+	                $this->_view->setValue( "createDatabase", $createDatabase );
+	                // now we better read the information from the config file to make sure that
+	                // it has been correctly saved
+	                $this->setCommonData( true );
+	                return true;
+	            }
+            }
+        }
+
+	    function getAvailableCharacterSets()
+	    {
+	        // check mysql version first. Version lower than 4.1 doesn't support utf8
+	        $serverVersion = mysql_get_server_info( $this->_connection );
+	        $version = explode( '.', $serverVersion );
+	        if ( $version[0] < 4 ) return false;
+	        if ( ( $version[0] == 4 ) && ( $version[1] == 0 ) ) return false;
+	        
+	        // check if utf8 support was compiled in
+	        $result = mysql_query( "SHOW CHARACTER SET", $this->_connection );
+	        if( $result )
+	        {
+		        if( mysql_num_rows($result) > 0 ) {
+		            // iterate through resultset
+		            $availableCharacterSets = array();
+		            while( $row = mysql_fetch_array( $result, MYSQL_ASSOC ) )
+		            {
+						array_push( $availableCharacterSets, $row['Charset'] );
+		            }
+		            return $availableCharacterSets;
+		        }
+		    }
+	        return false;
+	    }
+	    
+	    function getDatabaseCharacterSet()
+	    {
+			if( !@mysql_select_db( $this->_dbName, $this->_connection ) ) {
+				return false;
+			}
+	        
+	        // We use a SHOW CREATE DATABASE command to show the original
+	        // SQL character set when DB was created.
+	        $result = mysql_query( "SHOW CREATE DATABASE `".$this->_dbName."`", $this->_connection );
+	        if( $result )
+	        {
+		        if( mysql_num_rows( $result ) < 0 ) {
+		            // The specified db name is wrong!
+		            return false;
+		        }
+		        $dbInfo = mysql_fetch_row( $result );
+		        $pattern = '/40100 DEFAULT CHARACTER SET (\w+) /';
+		        if( ( preg_match( $pattern, $dbInfo[1], $match ) > 0 ) ) {
+		            return $match[1];
+		        }
+		    }
+	        return false;
+	    }
+	
+	    function getServerCharacterSet(){
+	        // We use a SHOW CREATE DATABASE command to show the original
+	        // SQL character set when DB was created.
+	        $result = mysql_query( "SHOW VARIABLES LIKE 'character_set_server'", $this->_connection );
+	        if( $result )
+	        {
+		        if( mysql_num_rows( $result ) > 0 ) {
+		            $row = mysql_fetch_array( $result, MYSQL_ASSOC );
+		            return $row['Value'];
+		        }
+			}
+	        return false;
+	    }
+    }
+
+    /**
+     *
+     * Second step where we connect to the database and create the tables.
+     *
+     */
+    class WizardStepTwo extends WizardAction
+    {
+
+        var $_db;
+        var $_database;
+        var $_dbCharacterSet;
+        var $_createDatabase;
+
+        function setDbConfigValues( &$view )
+        {
+            $configFile = new ConfigFileStorage();
+            $configFile->reload();
+            $view->setValue( "dbUser", $configFile->getValue( "db_username" ));
+            $view->setValue( "dbPassword", $configFile->getValue( "db_password" ));
+            $view->setValue( "dbServer", $configFile->getValue( "db_host" ));
+            $view->setValue( "dbName", $configFile->getValue( "db_database" ));
+            $view->setValue( "dbPrefix", $configFile->getValue( "db_prefix" ));
+            $view->setValue( "dbCharacterSet", $configFile->getValue( "db_character_set" ));
+            return true;
+        }
+
+        function perform()
+        {
+            global $Tables;
+            global $Inserts;
+
+			$this->_dbCharacterSet = $this->_request->getValue( "dbCharacterSet" );
+            $configFile = new ConfigFileStorage();
+			$configFileName = $configFile->getConfigFileName();
+            
+            if( File::exists( $configFileName ) && !File::isWritable( $configFileName )) {
+                $this->_view = new WizardView( "step1" );
+                $message = "Please make sure that the file $configFileName can be written by this script during
+                            the installation process. It is needed to store the database configuration settings. Once the
+                            installation is complete, please revert the permissions to no writing possible.";
+                $this->_view->setErrorMessage( $message );
+                $this->setCommonData( true );
+                return false;
+            }
+
+            // continue if everything went fine
+            if( !$configFile->saveValue( "db_character_set", $this->_dbCharacterSet ) ) {
+                $message = "Could not save values to the configuration file. Please make sure it is available and
+                            that has write permissions for the user under your web server is running.";
+                $this->_view = new WizardView( "step1" );
+                $this->_view->setErrorMessage( $message );
+
+                return false;
+            }
+            
+            $createDb = $this->_request->getValue( "createDatabase" );
+            $message = '';
+
+            // only check for errors in case the database table should already exist!
+            if( !$createDb ) {
+                $connectionEsablished = false;
+
+                // Lets check the 'everything is fine' case first..
+                $this->_db = connectDb();
+                if( $this->_db ) {
+                     $connectionEsablished = true;
+                } else {
+                     $connectionEsablished = false;
+                     $message = "There was an error selecting the database. Please verify the database was already created or check the 'Create database' checkbox.";
+                }
+
+                // We were unable to connect to the db and select the right db.. lets try
+                // just to connect.. maybe the database needs to be created (even though the
+                // user did not check the appropriate box).
+                if ( !$connectionEsablished ) {
+                    $this->_db = connectDb( true, false );
+                    if( !$this->_db ) {
+                         $message = "There was an error connecting to the database. Please check your settings.";
+                    }
+                }
+
+                if ( !$connectionEsablished ) {
+                    $this->_view = new WizardView( "step1" );
+                    $this->setDbConfigValues( $this->_view );
+                    $this->_view->setErrorMessage( $message );
+                    $this->setCommonData( true );
+                    return false;
+                }
+            }
+
+            $config = new ConfigFileStorage();
+            $this->_database = $config->getValue( "db_database" );
+            $this->_dbPrefix = $config->getValue( "db_prefix" );
+
+            // create the database
+            if( $createDb ) {
+                $this->_db = connectDb( false, false );
+				if( !$this->_db ) {
+                    $this->_view = new WizardView( "step1" );
+                    $this->setDbConfigValues( $this->_view );
+                    $this->_view->setErrorMessage( $message );
+                    $this->setCommonData( true );
+                    return false;					
+				}
+                if( !$this->_db->Execute( "CREATE DATABASE ".$this->_database )) {
+                    $message = "Error creating the database: ".$this->_db->ErrorMsg();
+					$message .= "<br/><br/>If the database already exists, go back to Step 2 and use a new database name.";
+                    $this->_view = new WizardView( "step1" );
+                    $this->setDbConfigValues( $this->_view );
+                    $this->_view->setErrorMessage( $message );
+                    $this->setCommonData( true );
+                    return false;
+                } else {
+                    $message = "Database created successfully.<br/>";
+                }
+            }
+
+            // reconnect using the new database.
+            $config = new ConfigFileStorage();
+            $this->_db->Connect( $config->getValue( "db_host" ), 
+                                 $config->getValue( "db_username" ), 
+                                 $config->getValue( "db_password" ), 
+                                 $config->getValue( "db_database" ));
+                                 
+            // create a data dictionary to give us the right sql code needed to create the tables
+            $dict = NewPDbDataDictionary( $this->_db );
+
+           // create the tables
+            $errors = false;            
+            
+            foreach( $Tables as $name => $table ) {
+            	$upperName = $dict->upperName;
+            	$tableSchema = $table["schema"];
+            	if ( isset( $table["options"] ) )
+            	{
+            		$tableOptions = $table["options"];
+            		$options = array ( $upperName => $tableOptions );
+            	} else {
+            		$options = array ();
+                }
+                $sqlarray = $dict->CreateTableSQL( $this->_dbPrefix.$name, $tableSchema, $options );
+
+                // each table may need more than one sql query because of indexes, triggers, etc...
+                $ok = true;
+                foreach( $sqlarray as $sql ) {
+                    $ok = ( $ok && $this->_db->Execute( $sql ));
+                }
+                
+                if( $ok )
+                    $message .= "Table <strong>$name</strong> created successfully.<br/>";
+                else {
+                    $message .= "Error creating table $name: ".$this->_db->ErrorMsg()."<br/>";
+                    $errors = true;
+                }                    
+            }
+
+            if( $errors ) {
+                $message = "There was an error creating the tables in the database. Please make sure that the user chosen to connect to the database has enough permissions to create tables.<br/><br/>$message";
+                $this->_view = new WizardView( "step1" );
+                $this->_view->setErrorMessage( $message );
+                $this->setDbConfigValues( $this->_view );
+                $this->setCommonData();
+                return false;
+            }
+
+             // try to guess the url where plog is running
+             $httpProtocol = (array_key_exists("HTTPS", $_SERVER) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
+             $httpHost = $_SERVER["HTTP_HOST"];
+             $requestUrl = $_SERVER["REQUEST_URI"];
+             $requestUrl = str_replace( "/wizard.php", "", $requestUrl );
+             $plogUrl = $httpProtocol.$httpHost.$requestUrl;
+
+            // Find some of the tools we are going to need (last one is for os x, with fink installed)
+            // TBD: support for Windows specific directories
+            $folders = Array( "/bin/", "/usr/bin/", "/usr/local/bin/", "/sw/bin/" );
+            $finder = new FileFinder();
+            $pathToUnzip = $finder->findBinary( "unzip", $folders );
+            $pathToTar = $finder->findBinary( "tar", $folders);
+            $pathToGzip = $finder->findBinary( "gzip", $folders);
+            $pathToBzip2 = $finder->findBinary( "bzip2", $folders);
+            $pathToConvert = $finder->findBinary( "convert", $folders);
+
+            // and execute some insert's
+            foreach( $Inserts as $insert ) {
+                $query = str_replace( "{dbprefix}", $this->_dbPrefix, $insert );
+                $query = str_replace( "{plog_base_url}", $plogUrl, $query );
+                // replace also the placeholders for the paths to the tools
+                $query = str_replace( "{path_to_tar}", $pathToTar, $query );
+                $query = str_replace( "{path_to_unzip}", $pathToUnzip, $query );
+                $query = str_replace( "{path_to_bz2}", $pathToBzip2, $query );
+                $query = str_replace( "{path_to_gzip}", $pathToGzip, $query );
+                $query = str_replace( "{path_to_convert}", $pathToConvert, $query );
+                $query = str_replace( "{path_to_convert}", $pathToConvert, $query );
+                if( !$this->_db->Execute( $query )) {
+                    $message .= "Error executing code: ".$this->_db->ErrorMsg()."<br/>";
+                    $errors = true;
+                }
+            }
+
+            //
+            // show some information regarding the helper tools we're going to need
+            // and wether they were found or not
+            //
+            $message .= "<br/><b>-- Helper tools --</b><br/>";
+            if( $pathToTar == "" )
+                $message .= "The helper tool 'tar' was not found<br/>";
+            else
+                $message .= "The helper tool 'tar' was found in $pathToTar<br/>";
+            if( $pathToGzip == "" )
+                $message .= "The helper tool 'gzip' was not found<br/>";
+            else
+                $message .= "The helper tool 'gzip' was found in $pathToGzip<br/>";
+            if( $pathToUnzip == "" )
+                $message .= "The helper tool 'unzip' was not found<br/>";
+            else
+                $message .= "The helper tool 'unzip' was found in $pathToUnzip<br/>";
+            if( $pathToBzip2 == "" )
+                $message .= "The helper tool 'bzip2' was not found<br/>";
+            else
+                $message .= "The helper tool 'bzip2' was found in $pathToTar<br/>";
+            if( $pathToConvert == "" )
+                $message .= "The helper tool 'convert' (from the ImageMagick package) was not found<br/>";
+            else
+                $message .= "The helper tool 'convert' (from the ImageMagick package) was found in $pathToConvert<br/>";
+
+            // Scan for locales
+            $locales = new Locales();
+            // find all the new locales that we have not yet stored
+            $f = new LocaleFinder();
+            $newLocaleCodes = $f->find();
+
+            foreach( $newLocaleCodes as $newLocaleCode ) {
+                $res = $locales->addLocale( $newLocaleCode );
+            }
+
+			// load the core permissions
+		    include( PLOG_CLASS_PATH."install/corepermissions.properties.php" );
+
+		    // process permissions
+		    $total = 0;		
+		    foreach( $permissions as $perm ) {
+			    // check if it already exists
+			    $query = "SELECT * FROM ".Db::getPrefix()."permissions WHERE permission = '".$perm[0]."'";
+			    $result = $this->_db->Execute( $query );
+			    if( !$result || $result->RowCount() < 1 ) {
+				   	// permission needs to be added
+					$corePerm = ( $perm[2] == true ? 1 : 0 );
+					$adminOnly = ( $perm[3] == true ? 1 : 0 );
+
+					$query = "INSERT INTO ".Db::getPrefix()."permissions (permission,description,core_perm,admin_only) ".
+					          "VALUES ('".$perm[0]."','".$perm[1]."','".$corePerm."','".$adminOnly."')";
+
+					$this->_db->Execute( $query );
+					$total++;
+			    }
+		    }
+
+			// show some feedback
+            if( $errors ) {
+                $this->_view = new WizardView( "step1" );
+                $this->setDbConfigValues( $this->_view );
+                $message = "There was an error initializing some of the tables. Please make sure that the user chosen to connect to the database has enough permissions to add records to the database.<br/><br/>$message";
+                $this->_view->setErrorMessage( $message );
+                $this->setCommonData();
+            }
+            else {
+                $this->_view = new WizardView( "step2" );
+                $this->_view->setValue( "message", $message );
+            }
+        }
+    }
+
+    /**
+     *
+     * this action only shows some feedback
+     *
+     */
+    class WizardStepThree extends WizardAction
+    {
+        function perform()
+        {
+            $this->_view = new WizardView( "step3" );
+            $this->setCommonData();
+        }
+    }
+
+    /**
+     *
+     * Create the first user in the database
+     *
+     */
+    class WizardStepFour extends WizardAction
+    {
+
+        var $_userName;
+        var $_userPassword;
+        var $_confirmPassword;
+        var $_userEmail;
+        var $_userFullName;
+
+        function WizardStepFour( $actionInfo, $request )
+        {
+            $this->WizardAction( $actionInfo, $request );
+
+            $this->registerFieldValidator( "userName", new UsernameValidator());
+            $this->registerFieldValidator( "userPassword", new PasswordValidator());
+            $this->registerFieldValidator( "userPasswordCheck", new PasswordValidator());
+            $this->registerFieldValidator( "userEmail", new EmailValidator());
+            $this->registerField( "userFullName" );
+            $view = new WizardView( "step3" );
+            $view->setErrorMessage( "Some data is missing or incorrect" );
+            $this->setValidationErrorView( $view );
+        }
+
+        // creates the user
+        function perform()
+        {
+            $this->_userName = $this->_request->getValue( "userName" );
+            $this->_userPassword = $this->_request->getValue( "userPassword" );
+            $this->_confirmPassword = $this->_request->getValue( "userPasswordCheck" );
+            $this->_userEmail = $this->_request->getValue( "userEmail" );
+            $this->_userFullName = $this->_request->getValue( "userFullName" );
+
+            $db = connectDb();
+
+            if( !$db ) {
+                $this->_view = new WizardView( "step3" );
+                $this->_view->setErrorMessage( "There was an error connecting to the database. Please check your settings." );
+                $this->setCommonData();
+                return false;
+            }
+
+            if( $this->_confirmPassword != $this->_userPassword ) {
+                $this->_view = new WizardView( "step3" );
+                $this->_form->setFieldValidationStatus( "userPasswordCheck", false );
+                $this->setCommonData( true );
+                return false;
+            }
+
+            $dbPrefix = Db::getPrefix();
+
+            $users = new Users();
+            $user = new UserInfo( $this->_userName,
+                                  $this->_userPassword,
+                                  $this->_userEmail,
+                                  "",
+                                  $this->_userFullName);
+			// set the user as an administrator
+			$user->setSiteAdmin( true );
+			// and add this record to the db
+            $userId = $users->addUser( $user );
+            if( !$userId ) {
+                $this->_view = new WizardView( "step3" );
+				$db =& Db::getDb();
+                $message = "There was an error adding the user. Make sure that the user does not already exist in the database (".$db->ErrorMsg().")";
+                $this->_view->setErrorMessage( $message );
+                $this->setCommonData();
+                return false;
+            }
+
+			// since this user is an administrator, he must be granted all the administrator
+			// permissions available
+			$perms = new Permissions();
+			$userPerms = new UserPermissions();
+			foreach( $perms->getAllPermissions() as $perm ) {
+				if( $perm->isAdminOnlyPermission()) {
+					// if it's an admin permission, add it
+					$p = new UserPermission( $userId, 0, $perm->getId());
+					$userPerms->grantPermission( $p );
+					//print("granting permission: ".$perm->getName()."<br/>");
+				}
+			}
+
+            $this->_view = new Wizardview( "step4" );
+            $this->_view->setValue( "ownerid", $userId );
+            $this->_view->setValue( "siteLocales", Locales::getLocales());
+            $this->_view->setValue( "defaultLocale", Locales::getDefaultLocale());
+            $ts = new TemplateSets();
+            $this->_view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
+            $this->setCommonData();
+            return true;
+        }
+
+    }
+
+    class WizardStepFive extends WizardAction
+    {
+
+        var $_blogName;
+        var $_ownerId;
+        var $_blogProperties;
+
+        function WizardStepFive( $actionInfo, $request )
+        {
+              $this->WizardAction( $actionInfo, $request );
+
+              $this->registerFieldValidator( "blogName", new StringValidator());
+              $this->registerFieldValidator( "ownerid", new IntegerValidator());
+              $this->registerFieldValidator( "blogTemplate", new StringValidator());
+              $this->registerFieldValidator( "blogLocale", new StringValidator());			  
+              $view = new WizardView( "step4" );
+              $view->setErrorMessage( "Some data is missing or incorrect" );
+              $view->setValue( "siteLocales", Locales::getLocales());
+			  $view->setValue( "defaultLocale", Locales::getDefaultLocale());
+              $ts = new TemplateSets();
+              $view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
+              $this->setValidationErrorView( $view );
+        }
+
+        function perform()
+        {
+            // Before we add a new blog, we need to add blog category and global article category first
+            // add blog category
+            $blogCategories = new BlogCategories();
+            $blogCategory = new BlogCategory( "General", "General" );
+            $blogCategoryId = $blogCategories->addBlogCategory( $blogCategory );
+
+            // add global article category
+            $globalArticleCategories = new GlobalArticleCategories();
+            $globalArticleCategory = new GlobalArticleCategory( "General", "General" );
+            $globalArticleCategoryId = $globalArticleCategories->addGlobalArticleCategory( $globalArticleCategory );
+            
+            // retrieve the values from the view
+            $this->_blogName = $this->_request->getValue( "blogName" );
+            $this->_ownerId  = $this->_request->getValue( "ownerid" );
+            $this->_blogProperties = $this->_request->getValue( "properties" );
+            $this->_blogTemplate = $this->_request->getValue( "blogTemplate" );
+            $this->_blogLocale = $this->_request->getValue( "blogLocale" );
+
+            // configure the blog
+            $blogs = new Blogs();
+            $blog = new BlogInfo( $this->_blogName, $this->_ownerId, "", "" );
+            // set the default BlogCategory id to blog
+            $blog->setBlogCategoryId( $blogCategoryId );
+            $blog->setProperties( $this->_blogProperties );
+            $blog->setStatus( BLOG_STATUS_ACTIVE );
+            $blogSettings = $blog->getSettings();
+            $blogSettings->setValue( "locale", $this->_blogLocale );
+            $blogSettings->setValue( "template", $this->_blogTemplate );
+            $blog->setSettings( $blogSettings );
+
+            // and now save it to the database
+            $newblogId = $blogs->addBlog( $blog );
+            if( !$newblogId ) {
+                $this->_view = new WizardView( "step4" );
+                $this->_view->setValue( "siteLocales", Locales::getLocales());
+                $ts = new TemplateSets();
+                $this->_view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
+                $this->_view->setErrorMessage( "There was an error creating the new blog" );
+                $this->setCommonData( true );
+                return false;
+            }
+
+            // if the blog was created, we can add some basic information
+            // add a category
+            $articleCategories = new ArticleCategories();
+            $articleCategory = new ArticleCategory( "General", "General", $newblogId, true );
+            $catId = $articleCategories->addArticleCategory( $articleCategory );
+
+            // load the right locale
+            $locale =& Locales::getLocale( $this->_blogLocale );
+            // and load the right text
+            $articleTopic = $locale->tr( "register_default_article_topic" );
+            $articleText  = $locale->tr( "register_default_article_text" );
+            $article = new Article( $articleTopic, $articleText, Array( $catId ), $this->_ownerId, $newblogId, POST_STATUS_PUBLISHED, 0, Array(), "welcome" );
+            // set the default ArticleGlobalCategory id to article
+            $article->setGlobalCategoryId( $globalArticleCategoryId );
+            // set the current time to article
+            $t = new Timestamp();
+            $article->setDateObject( $t );
+            $articles = new Articles();
+            $articles->addArticle( $article );
+
+            // add a new first album so that users can start uploading stuff right away
+            $t = new Timestamp();
+            $album = new GalleryAlbum( $newblogId,
+                                       "General",
+                                       "General",
+                                       GALLERY_RESOURCE_PREVIEW_AVAILABLE,
+                                       0,
+                                       $t->getTimestamp(),
+                                       Array(),
+                                       true );
+            $albums = new GalleryAlbums();
+            $albums->addAlbum( $album );
+            
+            // add a new default mylinkscategory
+            $linksCategory = new MyLinksCategory( "General", $newblogId );
+            $linksCategories = new MyLinksCategories();
+            $linksCategories->addMyLinksCategory( $linksCategory );         
+
+            // save a few things in the default configuration
+            $config =& Config::getConfig();
+            // default blog id
+            $config->saveValue( "default_blog_id", (int)$newblogId );
+            // default locale
+            $config->saveValue( "default_locale", $this->_blogLocale );
+            // and finally, the default template
+            $config->saveValue( "default_template", $this->_blogTemplate );
+
+            //
+            // detect wether we have GD available and set the blog to use it
+            //
+            if( GdDetector::detectGd()) {
+                $config->saveValue( "thumbnail_method", "gd" );
+                $message = "GD has been detected and set as the backend for dealing with images.";
+            }
+            else {
+                $pathToConvert = $config->getValue( "path_to_convert" );
+                if( $pathToConvert ) {
+                    $config->saveValue( "thumbnail_method", "imagemagick" );
+                    $message = "ImageMagick has been detected and set as the backend for dealing with images.";
+                }
+                else {
+                    // nothing was found, so we'll have to do away with the 'null' resizer...
+                    $config->saveValue( "thumbnail_method", "null" );
+                    $message = "Neither GD nor ImageMagick have been detected in this host so it will not be possible to generate thumbnails from images.";
+                }
+            }
+            
+            // clean the data cache to avoid problems when we're done
+            lt_include( PLOG_CLASS_PATH."class/cache/cachemanager.class.php" );
+            $cache =& CacheManager::getCache();
+            $cache->clearCache();
+
+            WizardTools::cleanTmpFolder();
+
+            $this->_view = new WizardView( "step5" );
+            $this->_view->setValue( "message", $message );
+            return true;
+        }
+    }
+
+    class UpdateStepOne extends WizardAction
+    {
+
+        function perform()
+        {
+            $this->_view = new WizardView( "update1" );
+            WizardStepTwo::setDbConfigValues( $this->_view );
+            $this->setCommonData();
+        }
+    }
+
+    class UpdateStepTwo extends WizardAction
+    {
+        function perform()
+        {
+			lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
+			$config =& Config::getConfig();
+			$resourcesNamingRule = $config->getValue( "resources_naming_rule", "original_file_name" );
+			
+            $this->_view = new WizardView( "update2" );
+            $this->_view->setValue( "resourcesNamingRule", $resourcesNamingRule );
+            $this->setCommonData();
+        }
+    }
+    
+    /**
+     * Generic class that performs data updates on the database
+     */
+    class DatabaseDataTransformer extends Model
+    {
+        /**
+         * @public
+         * Public fields, may be accessed by other classes
+         */
+        var $updatedRecords;
+        var $message;
+        var $errorRecords;
+        var $notModifiedRecords;
+        var $failOnError;
+        var $page;
+        var $itemsPerPage;
+        var $dbPrefix;
+    
+        function DatabaseDataTransformer( $page = -1, $itemsPerPage = WIZARD_MAX_RECORDS_PER_STEP )
+        {
+            $this->Model();
+            
+            $this->updatedRecords = 0;
+            $this->errorRecords   = 0;
+            $this->notModifiedRecords = 0;
+            $this->addedRecords = 0;
+            $this->deletedRecords = 0;
+            $this->failOnError = DATABASE_DATA_TRANSFORMER_FAIL_ON_ERROR_DEFAULT;
+            $this->message = "";
+            
+            $this->page = $page;
+            $this->itemsPerPage = $itemsPerPage;
+            
+            $this->dbPrefix = $this->getPrefix();
+        }
+        
+        /**
+         * Rerforms the transformation. Returns true if the step was successful or false otherwise.
+         * Upon finalization, please check the $message string to get more information. Use the $updatedRecords,
+         * $errorRecords, $notModifiedRecords, $addedRecords and $deletedRecords for some figures regarding the 
+         * previous step
+         */
+        function perform()
+        {
+            // must be implemented by child classes
+            return true;        
+        }
+        
+        /**
+         * Returns true if there is no more data for this transformer to upgrade, or false otherwise
+         *
+         * @return True if ready or false if not
+         */
+        function isComplete()
+        {
+            return( $this->getNumSteps() <= $this->page );
+        }
+        
+        /**
+         * returns the number of steps needed to process this data
+         */
+        function getNumSteps( $table = "" )
+        {
+            // if there is a table name, we can take a shortcut or else we expect child
+            // classes to reimplement this method
+            if( $table ) {
+                $numItems = $this->getNumItems( $this->getPrefix().$table );
+                
+                $numSteps = ceil( $numItems / $this->itemsPerPage );
+            }
+            else {
+                $numSteps = 0;
+            }
+            
+            return( $numSteps );
+        }
+        
+        /**
+         * returns the total number of records processed so far based on the current page and the
+         * number of items per page
+         */
+        function getTotalProcessedRecords()
+        {
+            return( $this->page * $this->itemsPerPage );
+        }
+        
+        /**
+         * returns an approximate percentage of records processed so far
+         */
+        function getPercentProcessed()
+        {
+            $processed = $this->getTotalProcessedRecords();
+            return((int)($processed / ( $this->getNumSteps() * $this->itemsPerPage ) * 100 ));
+        }
+    }
+
+	/**
+	 * This step takes care of transforming the database schema, one
+	 * table at a time.
+	 */
+	class DatabaseSchemaDataTransformer extends DatabaseDataTransformer
+	{		
+		function getNumSteps()
+		{
+			global $Tables;			
+			return( count( $Tables ) - 1);
+		}
+		
+		function perform()
+		{
+			global $Tables;
+			
+			$tablesArray = array_keys( $Tables );
+			$curTable = $tablesArray[$this->page-1];
+						
+			$db =& Db::getDb();
+            $dict = NewPDbDataDictionary( $db );
+            $errors = false;
+
+			$this->message = "Performing changes to the dabase schema, please wait (step %s of %s)<br/>";
+
+			$errorMessage = "";
+			$table_errors = false;
+			$upperName = $dict->upperName;
+			$tableSchema = $Tables[$curTable]["schema"];
+			if ( isset( $Tables[$curTable]["options"] )) {
+				$tableOptions = $Tables[$curTable]["options"];
+				$options = array ( $upperName => $tableOptions );
+			} 
+			else {
+				$options = array ();
+			}
+
+			// generate the code with the changes for the table
+			$sqlarray = $dict->ChangeTableSQL( $this->getPrefix().$curTable, $tableSchema, $options );
+
+			foreach( $sqlarray as $sql ) {
+				// and run the query
+				//print( "sql: ".$sql."<br/>" );
+				if( !$this->Execute( $sql )) {
+					$table_errors = true;
+					$errors = true;
+					$errorMessage .= $this->_db->ErrorMsg()."<br/>";
+				}
+			}
+
+			if( !$table_errors ) {
+				$this->message .= "Changes to table <strong>$curTable</strong> executed successfully.<br/>";
+				$result = true;
+			}
+			else {
+				$this->message .= "Error modifying table $curTable: ".$errorMessage;
+				$result = false;
+			}
+
+			return( $result ); 
+		}
+	}
+    
+    /**
+	 * Processes all users and grants the appropriate permissions
+     */
+    class UserPermissionsDataTransformer extends DatabaseDataTransformer
+    {        
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "tmp_users_permissions" ));
+        }
+    
+        function perform()
+        {
+            $this->message = "Updating user permissions (step %s of %s)<br/>";        
+        
+            $query3 = "SELECT * FROM ".Db::getPrefix()."tmp_users_permissions";
+            $res3 = $this->Execute( $query3, $this->page, $this->itemsPerPage );
+            if( $res3->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );
+			}
+			
+			$permissions = new Permissions();
+			$userPermissions = new UserPermissions();
+			$allPerms = $permissions->getAllPermissions();
+			$blogOwnerOnlyPerms = Array( "update_blog", 
+			                             "add_blog_user", 
+			                             "update_blog_user", 
+			                             "view_blog_users", 
+			                             "view_blog_stats", 
+			                             "add_blog_template",
+										 "view_blog_templates",
+										 "view_blog_stats" );
+			
+            while( $row = $res3->FetchRow()) {
+            	// grant all the non-admin permissions so that users can still access the blogs to where they still had permissions
+				if( $row["permission_id"] != 3) {
+					foreach( $allPerms as $perm ) {
+						if( !$perm->isAdminOnlyPermission() && !in_array( $perm->getName(), $blogOwnerOnlyPerms )) {
+							//print( "granting perm: ".$perm->getName()." - user: ".$row["user_id"]." - blog id: ".$row["blog_id"]."<br/>");							
+							$perm = new UserPermission( $row["user_id"], $row["blog_id"], $perm->getId());
+							$userPermissions->grantPermission( $perm );
+						}
+					}
+				}
+            }
+      
+            $this->message .= "{$this->updatedRecords} users updated (".$this->getPercentProcessed()."%%)<br/>";
+
+            $this->Execute("DROP TABLE ".Db::getPrefix()."tmp_users_permissions");
+
+            return true;
+        }
+    }
+
+	class PermissionLoader extends DatabaseDataTransformer
+	{
+		
+		//
+		// load the new list of permissions
+		//		
+		function getNumSteps()
+		{
+			return( 0 );
+		}
+		
+		function perform()
+		{
+			// initial message, no errors yet
+            $this->message = "Loading new permissions (step %s of %s)<br/>";			
+			$errors = false;
+			
+			// load the core permissions
+		    include( PLOG_CLASS_PATH."install/corepermissions.properties.php" );	
+
+		    // process permissions
+		    $total = 0;		
+		    foreach( $permissions as $perm ) {
+			    // check if it already exists
+			    $query = "SELECT * FROM ".$this->dbPrefix."permissions WHERE permission = '".$perm[0]."'";
+			    $result = $this->Execute( $query );
+			    if( !$result || $result->RowCount() < 1 ) {				
+				   	// permission needs to be added
+					$corePerm = ( $perm[2] == true ? 1 : 0 );
+					$adminOnly = ( $perm[3] == true ? 1 : 0 );
+					$query = "INSERT INTO ".$this->dbPrefix."permissions (permission,description,core_perm,admin_only) ".
+					          "VALUES ('".$perm[0]."','".$perm[1]."','".$corePerm."','".$adminOnly."')";
+					$this->_db->Execute( $query );
+					$total++;
+			    }
+		    }
+		
+			//
+			// prepare the users_permissions table for the next step
+			//
+
+            // make sure we are starting with an empty table
+            $this->Execute("DELETE FROM ".Db::getPrefix()."tmp_users_permissions");
+            
+			if( !$this->Execute( "INSERT INTO ".$this->dbPrefix."tmp_users_permissions SELECT * FROM ".$this->dbPrefix."users_permissions WHERE blog_id != 0 AND permission_id != 1" )) {
+				$this->message .= "Error preparing the users_permissions table for transformation";
+				$errors = true;
+			}
+			else {
+				$this->Execute( "DELETE FROM ".$this->dbPrefix."users_permissions" );
+				$this->message .= count($permissions)." permissions successfully loaded";
+				$errors = false;
+			}				
+			
+			return( !$errors );			
+		}	
+	}
+
+	class ConfigDataTransformer extends DatabaseDataTransformer
+	{
+		function getNumSteps()
+		{
+			return( 0 );
+		}
+		
+		function perform()
+		{
+		    global $Inserts;	
+			
+            $this->message = "Adding new configuration parameters (step %s of %s)<br/>";
+			$errors = false;
+			
+            // Find some of the tools we are going to need (last one is for os x, with fink installed), this will be needed later on
+            $folders = Array( "/bin/", "/usr/bin/", "/usr/local/bin/", "/sw/bin/" );
+            $finder = new FileFinder();
+            $pathToUnzip = $finder->findBinary( "unzip", $folders );
+            $pathToTar = $finder->findBinary( "tar", $folders);
+            $pathToGzip = $finder->findBinary( "gzip", $folders);
+            $pathToBzip2 = $finder->findBinary( "bzip2", $folders);
+            $pathToConvert = $finder->findBinary( "convert", $folders);
+
+            // check the configuration and add the new configuration settings that were added for 1.2
+            foreach( $Inserts as $key => $insert ) {
+				$checkKeyQuery = "SELECT * FROM ".$this->dbPrefix."config WHERE config_key ='".$key."';";
+				$result = $this->Execute($checkKeyQuery);
+                if(!$result){
+                    $this->message .= "Error executing code: ".$this->_db->ErrorMsg()."<br/>";
+                    $errors = true;
+                }
+				else{
+                    if ($result->RecordCount() == 0) {	
+                        // replace the prefix
+                        $query = str_replace( "{dbprefix}", $this->dbPrefix, $insert );
+                        // replace also the placeholders for the paths to the tools
+                        $query = str_replace( "{path_to_tar}", $pathToTar, $query );
+                        $query = str_replace( "{path_to_unzip}", $pathToUnzip, $query );
+                        $query = str_replace( "{path_to_bz2}", $pathToBzip2, $query );
+                        $query = str_replace( "{path_to_gzip}", $pathToGzip, $query );
+                        $query = str_replace( "{path_to_convert}", $pathToConvert, $query );
+                        $query = str_replace( "{path_to_convert}", $pathToConvert, $query );
+                        if( !$this->Execute( $query )) {
+                            $this->message .= "Error executing code: ".$this->_db->ErrorMsg()."<br/>";
+                            $errors = true;
+                        }
+                    }
+                    $result->Close();
+                }
+            }
+                // check to see if we need to remove duplicates and the id index
+            $query = "SELECT id FROM ".$this->dbPrefix."config LIMIT 1";
+            $result = $this->Execute($query);
+                // if $result is false, id column has already been removed
+            if($result){
+                $result->Close();           
+                    // remove all duplicates in plog_config table
+                    
+                    // first create temp table without the duplicates
+                $query = "CREATE TEMPORARY TABLE tmptable ".
+                         "SELECT * FROM ".$this->dbPrefix."config WHERE 1 GROUP BY config_key";
+                $result = $this->Execute($query);
+                if($result){
+                    //$result->Close();
+                        // Now delete the old table
+                    $query = "DELETE FROM ".$this->dbPrefix."config";
+                    $result = $this->Execute($query);
+                    if($result) {
+                        //$result->Close();
+                        // Insert the unique rows into the old table
+                        $query = "INSERT INTO ".$this->dbPrefix."config SELECT * FROM tmptable";
+                        $result = $this->Execute($query);
+                    }
+                }
+                /*if(!$result){
+                    $this->message .= "Error removing duplicates in config table<br/>";
+                    $errors = true;
+                }*/
+
+                if($result){
+
+                    // remove index id field, we don't need it any more!
+                    $query = "ALTER TABLE ".$this->dbPrefix."config DROP COLUMN id";
+                    $result = $this->Execute($query);
+                    if(!$result){
+                        $this->message .= "Error removing old id column from config table: ".$this->_db->ErrorMsg()."<br/>";
+                        $errors = true;
+                    }
+                }
+            }			
+
+			if( !$errors ) {
+				$this->message .= "Configuration settings updated successfully";
+			}
+			
+			return( !$errors );
+		}		
+	}
+
+    /**
+	 * Processes all admin users and grants the appropriate permissions
+     */
+    class AdminUserPermissionsDataTransformer extends DatabaseDataTransformer
+    {        
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "users" ));
+        }
+    
+        function perform()
+        {
+            $this->message = "Updating admin user permissions (step %s of %s)<br/>";        
+        
+            // load each one of the categories and update them
+            // list of categories
+            /*$query3 = "SELECT id, site_admin FROM ".$this->dbPrefix."users";
+            $res3 = $this->Execute( $query3, $this->page, $this->itemsPerPage );
+            if( $res3->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );
+			}*/
+			
+			$users = new Users();
+			$allUsers = $users->getAllUsers( USER_STATUS_ALL, "", "", $this->page, $this->itemsPerPage );
+			
+			$permissions = new Permissions();
+			$userPermissions = new UserPermissions();
+			$loginPerm = $permissions->getPermissionByName( "login_perm" );
+			$allPerms = $permissions->getAllPermissions();
+			
+            //while( $row = $res3->FetchRow()) {
+			foreach( $allUsers as $user ) {
+				//print("Processing user: ".$user->getUsername()."<br/>");
+            	//if( $row["site_admin"] > 0 ) {
+				if( $user->isSiteAdmin()) {
+					// it's an admin, let's grant all the appropriate permissions
+					foreach( $allPerms as $perm ) {
+						if( $perm->isAdminOnlyPermission() && $perm->getName() != "login_perm" ) {
+							//$userPerm = new UserPermission( $row["id"], 0, $perm->getId());
+							$userPerm = new UserPermission( $user->getId(), 0, $perm->getId());
+							$userPermissions->grantPermission( $userPerm );
+						}
+					}
+				}
+				// grant the login_perm permission or else users won't be able to log in
+				$newPerm = new UserPermission( $user->getId(), 0, $loginPerm->getId());
+				$userPermissions->grantPermission( $newPerm );
+				
+				$this->updatedRecords++;
+            }
+        
+            $this->message .= "{$this->updatedRecords} users updated (".$this->getPercentProcessed()."%%)<br/>";
+            return true;        
+        }
+    }
+    
+    /**
+     * processes all resource files and renames the files to their "real" names
+     */
+    class ResourcesOriginalFileNameDataTransformer extends DatabaseDataTransformer
+    {
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "gallery_resources" ));
+        }
+    
+        function perform()
+        {
+            $this->message = "Updating resource files with original file naming rule (step %s of %s)<br/>";        
+        
+            $query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
+
+			$config =& Config::getConfig();
+			$galleryFolder = $config->getValue( "resources_folder" );
+
+            // total number of comments
+            $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
+            if( !$res1 ) {
+                $this->message .= "Error performing loading resource data";
+                return false;
+            }
+            if( $res1->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );            
+            }
+            $numComments = Array();
+            while( $row = $res1->FetchRow()) {
+				//
+				// process each one of the rows and rename the main file
+				//
+				
+				// get the file extension
+				if(( $extPos = strrpos( $row["file_name"], "." )) !== false ) {					
+					$fileExt = substr( $row["file_name"], $extPos+1, strlen( $row["file_name"] ));
+				}
+				else {
+					$fileExt = "";
+				}
+								
+				$fileName = $galleryFolder.$row["owner_id"]."/".$row["owner_id"]."-".$row["id"].".".$fileExt;
+				$destFileName = $galleryFolder.$row["owner_id"]."/".$row["file_name"];
+				
+                    //print( "Renaming file: $fileName --- $destFileName<br/>" );
+
+                    // skip the rename if we already did it
+				if( File::exists( $fileName )) {
+	                if( !File::exists( $destFileName)) {
+	                    if( !File::rename( $fileName, $destFileName )) {
+	                        $this->message .= "Error updating resource file with id ".$row["id"].", while attempting to rename file from $fileName to $destFileName<br/>";
+	                    }
+					}
+				}
+				
+				// if it's an image, we also need to process the previews
+				if( $row["resource_type"] == "1" ) {
+					// calculate the extension of the preview file, depending on how it was saved
+					if( $row["thumbnail_format"] == "same" ) {
+						$previewExt = strtolower( $fileExt );
+						$destFileName = $row["file_name"];
+					}
+					else {
+						$previewExt = $row["thumbnail_format"];
+						// remove the old extension and put the new one in place
+						//print("file name = ".$row["file_name"]." - file ext = $fileExt - previewExt = $previewExt" );
+						$destFileName = str_replace( $fileExt, $previewExt, $row["file_name"] );
+					}
+						
+					// file names for the preview and medium preview
+					$previewFileName = $galleryFolder.$row["owner_id"]."/previews/".$row["owner_id"]."-".$row["id"].".".$previewExt;
+					$medPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$row["owner_id"]."-".$row["id"].".".$previewExt;					
+					// destination file names for the preview and medium preview
+					$destPreviewFileName = $galleryFolder.$row["owner_id"]."/previews/".$destFileName;
+					$destMedPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$destFileName;
+					
+					//print(" -- renaming preview: $previewFileName -- $destPreviewFileName<br/>");
+					//print(" -- renaming medium preview: $medPreviewFileName -- $destMedPreviewFileName<br/>");					
+					
+					if( File::exists( $previewFileName )) {
+                    	if( !File::exists( $destPreviewFileName)) {
+                        	File::rename( $previewFileName, $destPreviewFileName );
+                    	}
+					}
+					if( File::exists( $medPreviewFileName )) {
+	                    if( !File::exists( $destMedPreviewFileName)) {
+	                        File::rename( $medPreviewFileName, $destMedPreviewFileName );
+	                    }
+					}
+				}
+
+                $this->updatedRecords++;
+            }
+            $res1->Close();
+            $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
+            return true;        
+        }        
+    }
+
+    /**
+     * processes all resource files and renames the files to their "encoded" names
+     */
+    class ResourcesEncodedFileNameDataTransformer extends DatabaseDataTransformer
+    {
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "gallery_resources" ));
+        }
+    
+        function perform()
+        {
+            $this->message = "Updating resource files with encoded file naming rule (step %s of %s)<br/>";        
+        
+            $query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
+
+			$config =& Config::getConfig();
+			$galleryFolder = $config->getValue( "resources_folder" );
+
+            // total number of comments
+            $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
+            if( !$res1 ) {
+                $this->message .= "Error performing loading resource data";
+                return false;
+            }
+            if( $res1->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );            
+            }
+            $numComments = Array();
+            while( $row = $res1->FetchRow()) {
+				//
+				// process each one of the rows and rename the main file
+				//
+				
+				// get the file extension
+				if(( $extPos = strrpos( $row["file_name"], "." )) !== false ) {					
+					$fileExt = substr( $row["file_name"], $extPos+1, strlen( $row["file_name"] ));
+				}
+				else {
+					$fileExt = "";
+				}
+								
+				$fileName = $galleryFolder.$row["owner_id"]."/".$row["owner_id"]."-".$row["id"].".".$fileExt;
+				$destFileName = $galleryFolder.$row["owner_id"]."/".$row["owner_id"]."-".$row["id"].".".strtolower($fileExt);
+				
+				if( $fileName != $destFileName ) {
+					if( File::exists( $fileName )) {
+		                if( !File::exists( $destFileName)) {
+		                    if( !File::rename( $fileName, $destFileName )) {
+		                        $this->message .= "Error updating resource file with id ".$row["id"].", while attempting to rename file from $fileName to $destFileName<br/>";
+		                    }
+						}
+					}
+				}	
+
+                $this->updatedRecords++;
+            }
+            $res1->Close();
+            $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
+            return true;        
+        }        
+    }
+
+    /**
+     * processes all resource files that we did not convert correctly in 1.2.0
+     */
+    class ResourcesFix120FileNameDataTransformer extends DatabaseDataTransformer
+    {
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "gallery_resources" ));
+        }
+    
+        function perform()
+        {
+            $this->message = "Fixing resource files with original file naming rule (step %s of %s)<br/>";        
+        
+            $query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
+
+			$config =& Config::getConfig();
+			$galleryFolder = $config->getValue( "resources_folder" );
+
+            // total number of comments
+            $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
+            if( !$res1 ) {
+                $this->message .= "Error performing loading resource data";
+                return false;
+            }
+            if( $res1->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );            
+            }
+            $numComments = Array();
+            while( $row = $res1->FetchRow()) {
+				//
+				// process each one of the rows and rename the main file
+				//
+				
+				// get the file extension
+				if(( $extPos = strrpos( $row["file_name"], "." )) !== false ) {					
+					$fileExt = substr( $row["file_name"], $extPos+1, strlen( $row["file_name"] ));
+				}
+				else {
+					$fileExt = "";
+				}
+
+				// Only convert the preview file name if the file extension does not lower case
+				if( strtolower( $fileExt ) != $fileExt ) {
+					// if it's an image, we also need to process the previews
+					if( $row["resource_type"] == "1" ) {
+						// calculate the extension of the preview file, depending on how it was saved
+						if( $row["thumbnail_format"] == "same" ) {
+							$previewExt = strtolower( $fileExt );
+							$destFileName = $row["file_name"];
+						}
+						else {
+							$previewExt = $row["thumbnail_format"];
+							// remove the old extension and put the new one in place
+							//print("file name = ".$row["file_name"]." - file ext = $fileExt - previewExt = $previewExt" );
+							$destFileName = str_replace( $fileExt, $previewExt, $row["file_name"] );
+						}
+							
+						// file names for the preview and medium preview
+						$previewFileName = $galleryFolder.$row["owner_id"]."/previews/".$row["owner_id"]."-".$row["id"].".".$previewExt;
+						$medPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$row["owner_id"]."-".$row["id"].".".$previewExt;					
+						// destination file names for the preview and medium preview
+						$destPreviewFileName = $galleryFolder.$row["owner_id"]."/previews/".$destFileName;
+						$destMedPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$destFileName;
+						
+						//print(" -- renaming preview: $previewFileName -- $destPreviewFileName<br/>");
+						//print(" -- renaming medium preview: $medPreviewFileName -- $destMedPreviewFileName<br/>");					
+						
+						if( File::exists( $previewFileName )) {
+	                    	if( !File::exists( $destPreviewFileName)) {
+	                        	File::rename( $previewFileName, $destPreviewFileName );
+	                    	}
+						}
+						if( File::exists( $medPreviewFileName )) {
+		                    if( !File::exists( $destMedPreviewFileName)) {
+		                        File::rename( $medPreviewFileName, $destMedPreviewFileName );
+		                    }
+						}
+					}
+				}
+
+                $this->updatedRecords++;
+            }
+            $res1->Close();
+            $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
+            return true;        
+        }        
+    }    
+
+	// Dummy Transformer
+	class DummyDataTransformer extends DatabaseDataTransformer
+	{
+		function getNumSteps()
+		{
+			return( 0 );
+		}
+		
+		function perform()
+		{
+			return true;
+		}
+	}
+    
+    /**
+     * This class is basically now a "data transformer runner", because now it works
+     * like class that executes data transformers, collects their results and refreshes
+     * the page to execute the next step of the transformer. If the current transformer
+     * reported that its processing is complete, this class will continue with the next
+     * transformer unless there are no more transformer to run.
+     *
+     * In order to coordinate the current step and the current transformer, two parameters
+     * are needed in each request:
+     *
+     * - page
+     * - transformerId
+     *
+     * The 'page' parameter holds the current page, while 'transformerId' is the index of 
+     * the current transformer in the $this->transformers array.
+     *
+     * In order to add new transformers, follow these steps:
+     *
+     * - Create your own transfomer class by extending DatabaseDataTransformer and implementing
+     * the methods DatabaseDataTransformer::perform() and DatabaseDataTransformer::getNumSteps(). The
+     * first does the data processing while the second one returns the number of needed steps to the
+     * class running the transformer.
+     * - Add the name of the transformer class to the the UpdateStepThree::transformers array,
+     * and the class will take care of everything else. 
+     */
+    class UpdateStepThree extends WizardPagedAction
+    {
+        var $resourcesNamingRule;
+        var $message;  
+        var $currentTransformerId;
+        var $totalTransformers;
+    
+        function UpdateStepThree( $actionInfo, $httpRequest )
+        {
+            $this->WizardPagedAction( $actionInfo, $httpRequest );
+            // data validation
+            $this->registerFieldValidator( "resourcesNamingRule", new StringValidator());
+			$errorView = new WizardView( "update2" );
+            $errorView->setErrorMessage( "Some data was incorrect or missing." );
+            $this->setValidationErrorView( $errorView );
+            
+            /**
+             * array with the data transformers that will be run
+             */
+			$this->resourcesNamingRule = $this->_request->getValue( "resourcesNamingRule" );
+			if( $this->resourcesNamingRule == 'encoded_file_name' ) {
+	            $this->transformers = Array(
+					"DatabaseSchemaDataTransformer",
+					"PermissionLoader",
+					"AdminUserPermissionsDataTransformer",
+					"UserPermissionsDataTransformer",
+					"ConfigDataTransformer",
+					"ResourcesEncodedFileNameDataTransformer",
+					"DummyDataTransformer"
+	            );
+	        }
+	        else {
+	            $this->transformers = Array(
+					"DatabaseSchemaDataTransformer",
+					"PermissionLoader",
+					"AdminUserPermissionsDataTransformer",
+					"UserPermissionsDataTransformer",
+					"ConfigDataTransformer",
+					"ResourcesOriginalFileNameDataTransformer",
+					"DummyDataTransformer"
+	            );
+	    	}
+
+            $this->currentTransformerId = $this->getTransformerIdFromRequest();
+            $this->totalTransformers = count( $this->transformers ) - 1;
+        }
+        
+        /**
+         * gets the id of the transformer from the request. If it is not available, it
+         * will return the id of the first transformer available (which is '0')
+         *
+         * @private
+         */
+        function getTransformerIdFromRequest()
+        {    	
+			$id = HttpVars::getRequestValue( "transformerId" );
+			$val = new IntegerValidator();
+			if( !$val->validate( $id ))
+				$id = 0;
+							
+			return $id;        
+        }        
+
+       function perform()
+       {
+            $step = $this->getPageFromRequest();
+            
+            // get the current transformer class so that we can continue where we left
+            $transformerClass = $this->transformers[$this->currentTransformerId];
+            $transformer = new $transformerClass( $step );
+            $result = $transformer->perform();
+            $complete = $transformer->isComplete();
+            $message = $transformer->message;
+            $message = sprintf( $message, $this->currentTransformerId + 1, $this->totalTransformers );
+            
+            //print("transformer = $transformerClass<br/>");
+             
+            // error during processing and the processor is configured
+            // to fail on error   
+            if( !$result && $transformer->failOnError ) {
+                //print("Error in step = $step<br/>");
+                $this->_view = new WizardView( "update3" );
+                $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
+                // current and next step
+                $this->_view->setValue( "currentStep", $step );
+                $this->_view->setValue( "nextStep", $step+1 );                
+                // whether this transformer is ready
+                $this->_view->setValue( "complete", $complete );
+                // transformer id
+                $this->_view->setValue( "transformerId", $this->currentTransformerId );            
+                $this->_view->setValue( "error", true );
+                if( $transformer->DbError() != "" ) {
+                    $message .= "<br/>The database error message was: ".$transformer->DbError()."<br/>";
+                }
+
+                $this->_view->setErrorMessage( $message );
+            }                
+            else {
+                if( !$complete ) {
+                    //print("it's not complete! step = $step<br/>");
+                    $this->_view = new WizardView( "update3" );
+                    $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
+                    // current and next step
+                    $this->_view->setValue( "currentStep", $step );
+                    $this->_view->setValue( "nextStep", $step+1 );                
+                    // whether this transformer is ready
+                    $this->_view->setValue( "complete", $complete );
+                    // transformer id
+                    $this->_view->setValue( "transformerId", $this->currentTransformerId );
+                }            
+                else {
+                    // have we already been through all transformers?
+                    //print("transformer complete! - num transformers = ".count($this->transformers)."<br/>");
+                    $moreTransformers = ( $this->currentTransformerId+1 < count( $this->transformers ));
+                    if( $moreTransformers ) {
+                        //print("Starting new transformer!<br/>");
+                        $this->_view = new WizardView( "update3" );
+                        $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
+                        // current and next step
+                        $this->_view->setValue( "currentStep", 0 );
+                        $this->_view->setValue( "nextStep", 1 );  
+                        // whether this transformer is ready
+                        $this->_view->setValue( "complete", false );
+                        // transformer id
+                        $this->_view->setValue( "transformerId", $this->currentTransformerId+1 );
+                    }
+                    else {
+                        // no more data to transform, we can finalize the installation!
+						// delete the contents of the temporary folder
+						lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
+						$config =& Config::getConfig();
+						$tmpFolder = $config->getValue( "temp_folder", TEMP_FOLDER );
+                        WizardTools::cleanTmpFolder();
+                        
+                        // save the resources naming rule to config table
+						$config->saveValue( "resources_naming_rule", $this->resourcesNamingRule );
+
+                        $this->_view = new WizardView( "update4" );
+                    }
+                }
+            }
+
+            $this->_view->setValue( "message", $message );            
+
+            return true;
+        }
+    }
+
+	// Fix those resources that we did not convert correctly in 1.2.0
+    class Fix120StepOne extends WizardPagedAction
+    {
+        var $message;  
+        var $currentTransformerId;
+        var $totalTransformers;
+    
+        function Fix120StepOne( $actionInfo, $httpRequest )
+        {
+            $this->WizardPagedAction( $actionInfo, $httpRequest );
+            
+            /**
+             * array with the data transformers that will be run
+             */
+            $this->transformers = Array(
+				"ResourcesFix120FileNameDataTransformer",
+				"DummyDataTransformer"
+            );
+
+            $this->currentTransformerId = $this->getTransformerIdFromRequest();
+            $this->totalTransformers = count( $this->transformers ) - 1;
+        }
+        
+        /**
+         * gets the id of the transformer from the request. If it is not available, it
+         * will return the id of the first transformer available (which is '0')
+         *
+         * @private
+         */
+        function getTransformerIdFromRequest()
+        {    	
+			$id = HttpVars::getRequestValue( "transformerId" );
+			$val = new IntegerValidator();
+			if( !$val->validate( $id ))
+				$id = 0;
+							
+			return $id;        
+        }        
+
+       function perform()
+       {
+            $step = $this->getPageFromRequest();
+            
+            // get the current transformer class so that we can continue where we left
+            $transformerClass = $this->transformers[$this->currentTransformerId];
+            $transformer = new $transformerClass( $step );
+            $result = $transformer->perform();
+            $complete = $transformer->isComplete();
+            $message = $transformer->message;
+            $message = sprintf( $message, $this->currentTransformerId + 1, $this->totalTransformers );
+            
+            //print("transformer = $transformerClass<br/>");
+             
+            // error during processing and the processor is configured
+            // to fail on error   
+            if( !$result && $transformer->failOnError ) {
+                //print("Error in step = $step<br/>");
+                $this->_view = new WizardView( "update3" );
+                // current and next step
+                $this->_view->setValue( "currentStep", $step );
+                $this->_view->setValue( "nextStep", $step+1 );                
+                // whether this transformer is ready
+                $this->_view->setValue( "complete", $complete );
+                // transformer id
+                $this->_view->setValue( "transformerId", $this->currentTransformerId );            
+                $this->_view->setValue( "error", true );
+                if( $transformer->DbError() != "" ) {
+                    $message .= "<br/>The database error message was: ".$transformer->DbError()."<br/>";
+                }
+
+                $this->_view->setErrorMessage( $message );
+            }                
+            else {
+                if( !$complete ) {
+                    //print("it's not complete! step = $step<br/>");
+                    $this->_view = new WizardView( "fix120" );
+                    // current and next step
+                    $this->_view->setValue( "currentStep", $step );
+                    $this->_view->setValue( "nextStep", $step+1 );                
+                    // whether this transformer is ready
+                    $this->_view->setValue( "complete", $complete );
+                    // transformer id
+                    $this->_view->setValue( "transformerId", $this->currentTransformerId );
+                }            
+                else {
+                    // have we already been through all transformers?
+                    //print("transformer complete! - num transformers = ".count($this->transformers)."<br/>");
+                    $moreTransformers = ( $this->currentTransformerId+1 < count( $this->transformers ));
+                    if( $moreTransformers ) {
+                        //print("Starting new transformer!<br/>");
+                        $this->_view = new WizardView( "fix120" );
+                        // current and next step
+                        $this->_view->setValue( "currentStep", 0 );
+                        $this->_view->setValue( "nextStep", 1 );  
+                        // whether this transformer is ready
+                        $this->_view->setValue( "complete", false );
+                        // transformer id
+                        $this->_view->setValue( "transformerId", $this->currentTransformerId+1 );
+                    }
+                    else {
+                        // no more data to transform, we can finalize the installation!
+						// delete the contents of the temporary folder
+						lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
+						$config =& Config::getConfig();
+						$tmpFolder = $config->getValue( "temp_folder", TEMP_FOLDER );
+                        WizardTools::cleanTmpFolder();
+
+                        // User upgrade LifeType from 1.1.x to 1.2.0, they have to use "original_file_name",
+                        // becasue there is no option for user to choose he want to use encoded file name
+                        // or original file name.
+                        // save the resources naming rule to config table
+						$config->saveValue( "resources_naming_rule", "original_file_name" );
+
+                        $this->_view = new WizardView( "update4" );
+                    }
+                }
+            }
+
+            $this->_view->setValue( "message", $message );            
+
+            return true;
+        }
+    }
+
+    // check if the "./tmp" folder is writable by us, otherwise
+    // throw an error before the user gets countless errors
+    // from Smarty
+    if( !File::isWritable( TEMP_FOLDER ) || !File::isDir( TEMP_FOLDER )) {
+        print("<span style=\"color:red; font-size: 14px;\">Error</span><br/><br/>This wizard needs the ".TEMP_FOLDER." folder to be writable by the web server user.<br/><br/>Please correct it and try again.");
+        die();
+    }
+
+    //// main part ////
+    $controller = new Controller( $_actionMap, "nextStep" );
+    $controller->process( HttpVars::getRequest());
+?>

Deleted: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2007-10-23 09:31:01 UTC (rev 6005)
+++ plog/trunk/wizard.php	2007-10-23 10:05:55 UTC (rev 6006)
@@ -1,2299 +0,0 @@
-<?php
-
-    if (!defined( "PLOG_CLASS_PATH" )) {
-        define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
-    }
-
-    set_time_limit (5 * 3600);
-
-	include_once( PLOG_CLASS_PATH."class/bootstrap.php" );
-	lt_include( PLOG_CLASS_PATH."class/dao/userstatus.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/dao/blogstatus.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );		
-
-    //
-    // enable this for debugging purposes
-    //
-    define( "DB_WIZARD_DEBUG", true );
-
-	//
-	// disable integrity check in development version
-	//
-	define( "INTEGRITY_CHECK", false);
-
-    //
-    // in case you're having problems with time outs while upgrading (probably too
-    // many records) lower this figure
-    //
-    define( "WIZARD_MAX_RECORDS_PER_STEP", 75 );
-    
-    //
-    // minimum php version required
-    //
-    define( "MIN_PHP_VERSION", "5.0" );
-    
-    //
-    // whether data transformers should fail on error by default
-    // It might be convenient to set this to 'false' if we're running
-    // the wizard on top of an already updated installation
-    //
-    define( "DATABASE_DATA_TRANSFORMER_FAIL_ON_ERROR_DEFAULT", true );
-
-    // many hosts don't have this enabled and we, for the time being, need it...
-    ini_set("arg_seperator.output", "&amp;");
-
-    include_once( PLOG_CLASS_PATH."class/bootstrap.php" );
-    
-    // table schemas
-    include( PLOG_CLASS_PATH."install/dbschemas.properties.php" );
-    // default configuration values for 1.1
-    include( PLOG_CLASS_PATH."install/defaultconfig.properties.php" );
-
-    define( "TEMP_FOLDER", "./tmp" );
-
-    // maps used to map requests with actions
-    $_actionMap["Checks"] = "WizardChecks";
-    $_actionMap["Default"] = "WizardChecks";
-    $_actionMap["Intro"] = "WizardIntro";
-    $_actionMap["Step1"] = "WizardStepOne";
-    $_actionMap["Step2"] = "WizardStepTwo";
-    $_actionMap["Step3"] = "WizardStepThree";
-    $_actionMap["Step4"] = "WizardStepFour";
-    $_actionMap["Step5"] = "WizardStepFive";
-    $_actionMap["Update1"] = "UpdateStepOne";
-    $_actionMap["Update2"] = "UpdateStepTwo";
-    $_actionMap["Update3"] = "UpdateStepThree";
-    $_actionMap["Fix120"] = "Fix120StepOne";
-
-
-    /**
-     * Open a connection to the database
-     */
-     function connectDb( $ignoreError = false , $selectDatabase = true )
-     {
-        $config = new ConfigFileStorage();
-        // open a connection to the database
-        //$db = NewADOConnection('mysql');
-        $db = PDb::getDriver($config->getValue( "db_driver" ));
-        
-        if ( $selectDatabase ) {
-            $res = $db->Connect($config->getValue( "db_host" ), $config->getValue( "db_username" ), $config->getValue( "db_password" ), $config->getValue( "db_database" ), $config->getValue( "db_character_set" ));
-        } else {
-            $res = $db->Connect($config->getValue( "db_host" ), $config->getValue( "db_username" ), $config->getValue( "db_password" ), null, $config->getValue( "db_character_set" ));
-        }
-
-        if( DB_WIZARD_DEBUG )
-            $db->debug = true;
-
-        // return error
-        if( $ignoreError )
-            return $db;
-
-        if( !$res )
-            return false;
-
-        return $db;
-    }
-
-    /**
-     * Returns the database prefix
-     */
-    function getDbPrefix()
-    {
-        $config = new ConfigFileStorage();
-        return $config->getValue( "db_prefix" );
-    }
-
-    /**
-     * some useful little functions
-     */
-    class WizardTools
-    {
-       /**
-        * returns true if plog has already been installed before or
-        * false otherwise
-        */
-       function isNewInstallation()
-       {
-           $configFile = new ConfigFileStorage();
-           // if plog hasn't been installed, this file will have empty settings
-           if( $configFile->getValue( "db_host") == "" && $configFile->getValue( "db_username") == "" &&
-               $configFile->getValue( "db_database") == "" && $configFile->getValue( "db_prefix" ) == "" &&
-               $configFile->getValue( "db_password" ) == "" )
-               $isNew = true;
-           else
-               $isNew = false;
-
-           return( $isNew );
-       }
-
-		/**
-		 * Clean up the default temporary folder
-		 */
-		function cleanTmpFolder()
-		{
-			// remove the files recursively, but only files, do not do anything to directories
-			File::deleteDir( TEMP_FOLDER, true, true, array(".svn", ".htaccess") );
-		}
-    }
-
-    /**
-     * Renders a template file.
-     */
-    class WizardView extends View
-    {
-
-        var $_templateName;
-
-        function WizardView( $templateName )
-        {
-            $this->View();
-            $this->_templateName = $templateName;
-        }
-
-        function render()
-        {
-            // build the file name
-            $templateFileName = "wizard/".$this->_templateName.".template";
-
-            //$t = new Template( $templateFileName, "" );
-            $t = new Smarty();
-            $v = new Version();
-            $this->_params->setValue( "version", $v->getVersion());
-            $this->_params->setValue( "projectPage", $v->getProjectPage());
-            $this->_params->setValue( "safeMode", ini_get("safe_mode"));
-            $t->assign( $this->_params->getAsArray());
-            $t->template_dir    = "./templates";
-            $t->compile_dir     = TEMP_FOLDER;
-            $t->cache_dir       = TEMP_FOLDER;
-            $t->use_sub_dirs    = false;
-            $t->caching = false;
-
-            print $t->fetch( $templateFileName );
-        }
-    }
-    
-    class WizardAction extends Action
-    {
-        function WizardAction( $actionInfo, $request )
-        {
-            $this->Action( $actionInfo, $request );
-        }
-    }    
-    
-    class WizardValidator
-    {
-        var $_desc;
-        var $_critical;
-        var $_valid;
-        var $_solution;
-    
-        function WizardValidator( $desc = "", $solution = "", $critical = true )
-        {            
-            $this->_desc = $desc;
-            $this->_critical = $critical;
-            $this->_valid = false;
-            $this->_solution = $solution;
-        }
-        
-        function isCritical()
-        {
-            return( $this->_critical );
-        }
-        
-        function getDesc()
-        {
-            return( $this->_desc );
-        }
-        
-        function isValid()
-        {
-            return( $this->_valid );
-        }
-        
-        function getSolution()
-        {
-            return( $this->_solution );
-        }
-        
-        function validate() 
-        {
-            return( $this->_valid );
-        }        
-    }
-    
-    class WizardPhpVersionValidator extends WizardValidator
-    {
-        function WizardPhpVersionValidator( $minVersion = MIN_PHP_VERSION )
-        {
-            $this->WizardValidator( "Checking if the installed <b>PHP</b> version is at least $minVersion", 
-                                    "Please upgrade your version of PHP to $minVersion or newer",
-                                    true );
-            $this->_minVersion = $minVersion;
-        }
-    
-        function validate()
-        {
-            $this->_valid = version_compare( phpversion(), $this->_minVersion ) >= 0;
-            return( parent::validate());
-        }
-    }
-    
-    class WizardWritableFileValidator extends WizardValidator
-    {
-        var $_file;
-        
-        function WizardWritableFileValidator( $file )
-        {
-            $this->WizardValidator( "Checking if file/folder <b>$file</b> is writable", 
-                                    "Please make sure that the file is writable by the web server",
-                                    true );
-            $this->_file = $file;
-        }
-    
-        function validate()
-        {
-            $this->_valid = File::isWritable( $this->_file );
-            return( parent::validate());
-        }
-    }
-    
-    class WizardSessionFunctionsAvailableValidator extends WizardValidator
-    {
-        function WizardSessionFunctionsAvailableValidator()
-        {
-            $this->WizardValidator( "Checking if <b>session</b> functions are available", 
-                                    "LifeType requires support for sessions to be part of your PHP installation",
-                                    true );
-        }
-    
-        function validate()
-        {
-            $this->_valid = function_exists( "session_start" ) &&
-                            function_exists( "session_destroy" ) &&
-                            function_exists( "session_cache_limiter" ) &&
-                            function_exists( "session_name" ) &&
-                            function_exists( "session_set_cookie_params" ) &&
-                            function_exists( "session_save_path" );
-            return( parent::validate());            
-        }
-    }
-
-    class WizardSessionSettingsValidator extends WizardValidator
-    {
-        function WizardSessionSettingsValidator()
-        {
-            $this->WizardValidator( "Checking if <b>session.auto_start</b> is disabled", 
-                                    "LifeType can only run when session.auto_start is disabled.",           
-                                    true );
-        }    
-    
-        function validate()
-        {
-            $this->_valid = (ini_get( "session.auto_start" ) == "0");
-            return( parent::validate());    
-        }
-    }
-       
-    class WizardSQLFunctionsAvailableValidator extends WizardValidator
-    {
-        function WizardSQLFunctionsAvailableValidator()
-        {
-            $this->WizardValidator( "Checking if <b>MySQL</b> or <b>PostgreSQL</b> functions are available", 
-                                    "LifeType requires support for MySQL to be part of your PHP installation",
-                                    true );
-        }
-    
-        function validate()
-        {
-            $this->_valid = (function_exists( "mysql_select_db" ) &&
-                            function_exists( "mysql_query" ) &&
-                            function_exists( "mysql_connect" ) &&
-                            function_exists( "mysql_fetch_assoc" ) &&
-                            function_exists( "mysql_num_rows" ) &&
-                            function_exists( "mysql_free_result" )) ||
-							(function_exists( "pg_query" ));
-            return( parent::validate());                            
-        }        
-    }
-    
-    class WizardXmlFunctionsAvailableValidator extends WizardValidator
-    {
-        function WizardXmlFunctionsAvailableValidator()
-        {
-            $this->WizardValidator( "Checking if <b>XML</b> functions are available", 
-                                    "LifeType requires support for XML to be part of your PHP installation",
-                                    true );
-        }    
-    
-        function validate()
-        {
-            $this->_valid = function_exists( "xml_set_object" ) &&
-                            function_exists( "xml_set_element_handler" ) &&
-                            function_exists( "xml_parser_create" ) &&
-                            function_exists( "xml_parser_set_option" ) &&
-                            function_exists( "xml_parse" ) &&
-                            function_exists( "xml_parser_free" );
-            return( parent::validate());                            
-        }        
-    }
-    
-    class WizardSafeModeValidator extends WizardValidator
-    {
-        function WizardSafeModeValidator()
-        {
-            $this->WizardValidator( "Checking if <b>safe mode</b> is disabled", 
-                                    "LifeType can run when PHP's safe mode is enabled, but it may cause some problems.",           
-                                    false );
-        }    
-    
-        function validate()
-        {
-            $this->_valid = (ini_get( "safe_mode" ) == "");
-            return( parent::validate());    
-        }
-    }
-
-    class WizardIconvFunctionsAvailableValidator extends WizardValidator
-    {
-        function WizardIconvFunctionsAvailableValidator()
-        {
-            $this->WizardValidator( "Checking if <b>iconv</b> functions are available", 
-                                    "LifeType requires support for some resource metadata conversion and some LifeType plugins requires support for multi-byte language encoding/decoding.",
-                                    false );
-        }
-    
-        function validate()
-        {
-            $this->_valid = function_exists( "iconv" );
-            return( parent::validate());                            
-        }        
-    }
-
-    class WizardMbstringFunctionsAvailableValidator extends WizardValidator
-    {
-        function WizardMbstringFunctionsAvailableValidator()
-        {
-            $this->WizardValidator( "Checking if <b>mbstring</b> functions are available", 
-                                    "Some LifeType plugins requires support for multi-byte language encoding/decoding.",
-                                    false );
-        }
-    
-        function validate()
-        {
-            $this->_valid = function_exists( "mb_convert_encoding" );
-            return( parent::validate());                            
-        }        
-    }
-
-    class WizardGdFunctionsAvailableValidator extends WizardValidator
-    {
-        function WizardGdFunctionsAvailableValidator()
-        {
-            $this->WizardValidator( "Checking if <b>gd</b> or <b>gd2</b> functions are available", 
-                                    "LifeType requires support for generating image thumbnail.",
-                                    false );
-        }
-    
-        function validate()
-        {
-            $this->_valid = function_exists( "imagecopyresampled" ) &&
-            				function_exists( "imagecopyresized" );
-            return( parent::validate());                            
-        }        
-    }
-    
-    class WizardFileUploadsValidator extends WizardValidator
-    {
-        function WizardFileUploadsValidator()
-        {
-            $this->WizardValidator( "Checking if <b>file_uploads</b> is enabled", 
-                                    "LifeType requires support for uploading resources.",
-                                    true );
-        }    
-    
-        function validate()
-        {
-            $this->_valid = (ini_get( "file_uploads" ) == 1);
-            return( parent::validate());    
-        }
-    }
-
-    class WizardFileIntegrityValidator extends WizardValidator
-    {
-        function WizardFileIntegrityValidator()
-        {
-            $this->WizardValidator( "Checking that all files have been correctly uploaded", 
-                                    "will be set later on...",
-                                    false );
-        }    
-    
-        function validate()
-        {
-			include( PLOG_CLASS_PATH."install/files.properties.php");
-			
-			$result = IntegrityChecker::checkIntegrity( 
-				$data
-			);	
-	
-		
-            $this->_valid = ( count( $result ) == 0 );
-			if( !$this->_valid ) {
-				/* let's modify a private attribute... */
-				$fileList = implode( "<br/>", array_keys( $result ));
-				$this->_solution = "The current version of the following is not the expected one. Installation can proceed but please make sure that all files were uploaded correctly:"."<br/>".$fileList;				
-			}
-
-            return( parent::validate());
-        }
-    }
-    
-    class WizardCtypeFunctionsAvailableValidator extends WizardValidator
-    {
-        function WizardCtypeFunctionsAvailableValidator()
-        {
-            $this->WizardValidator( "Checking if <b>ctype</b> functions are available", 
-                                    "Some LifeType plugins requires support for variable type validation.",
-                                    false );
-        }
-    
-        function validate()
-        {
-            $this->_valid = function_exists( "ctype_digit" );
-            return( parent::validate());                            
-        }        
-    }               
-    
-    class WizardChecks extends WizardAction
-    {        
-        function perform()
-        {
-            // build the array with checks
-			if( INTEGRITY_CHECK ) {
-	            $checkGroups['File checks'] = Array(
-	               "writeConfigFile" => new WizardWritableFileValidator( "config/config.properties.php" ),
-	               "writeTmpFolder" => new WizardWritableFileValidator( "tmp" ),
-	               "writeGalleryFolder" => new WizardWritableFileValidator( "gallery" ),
-				   "fileVersionCheck" => new WizardFileIntegrityValidator()
-	            );
-	        } else {
-	            $checkGroups['File checks'] = Array(
-	               "writeConfigFile" => new WizardWritableFileValidator( "config/config.properties.php" ),
-	               "writeTmpFolder" => new WizardWritableFileValidator( "tmp" ),
-	               "writeGalleryFolder" => new WizardWritableFileValidator( "gallery" )
-	            );
-			}	        	
-            
-            $checkGroups['PHP version checking'] = Array(
-               "php" => new WizardPhpVersionValidator()
-            );
-
-            $checkGroups['PHP configuration checking'] = Array(
-               "sessionSettings" => new WizardSessionSettingsValidator(),
-               "safemode" => new WizardSafeModeValidator(),
-               "fileUploads" => new WizardFileUploadsValidator()
-            );
-            
-            $checkGroups['PHP functions availability checking'] = Array(
-               "sessions" => new WizardSessionFunctionsAvailableValidator(),
-               "mysql" => new WizardSQLFunctionsAvailableValidator(),
-               "xml" => new WizardXmlFunctionsAvailableValidator(),
-               "iconv" => new WizardIconvFunctionsAvailableValidator(),
-               "mbstring" => new WizardMbstringFunctionsAvailableValidator(),
-               "gd" => new WizardGdFunctionsAvailableValidator(),
-               "ctype" => new WizardCtypeFunctionsAvailableValidator()
-            );                                    
-            
-            // run the checks
-            $ok = true;
-            foreach( $checkGroups as $checkGroup => $checks ) {
-	            foreach( $checks as $id => $check ) {
-	                $valid = $checkGroups[$checkGroup][$id]->validate();
-	                // if it doesn't validate but it's not critical, then we can proced too
-	                if( !$checkGroups[$checkGroup][$id]->isCritical())
-	                    $valid = true;  
-	                $ok = ($ok && $valid);
-	            }
-	        }
-            
-            // create the view and pass the results
-            $this->_view = new WizardView( "checks" );
-            $this->_view->setValue( "ok", $ok );
-            $this->_view->setValue( "checkGroups", $checkGroups );
-            
-            if( WizardTools::isNewInstallation())
-                $this->_view->setValue( "mode", "install" );
-            else
-                $this->_view->setValue( "mode", "update" );
-
-            return true;
-        }
-    }
-    
-    class WizardPagedAction extends WizardAction
-    {
-        var $willRefresh;
-    
-        function WizardPagedAction( $actionInfo, $request ) 
-        {
-            $this->WizardAction( $actionInfo, $request );
-            
-            $this->willRefresh = false;
-        }
-        
-        /**
-         * @private
-         */
-        function getPageFromRequest()
-        {
-                	
-			// get the value from the request
-			$page = HttpVars::getRequestValue( "page" );
-			// but first of all, validate it
-			$val = new IntegerValidator();
-			if( !$val->validate( $page ))
-				$page = 1;			
-							
-			return $page;        
-        }
-        
-        /**
-         * @private
-         */
-        function willRefresh()
-        {
-            return( $this->willRefresh );
-        }
-    }
-
-    /**
-     * Gets the information about the database from the user.
-     */
-    class WizardIntro extends WizardAction
-    {
-        function WizardIntro( $actionInfo, $request )
-        {
-            $this->WizardAction( $actionInfo, $request );
-        }
-
-        function perform()
-        {
-            // we can detect whether plog is already installed or not and direct users to the right
-            // place
-            if( WizardTools::isNewInstallation())
-                $this->_view = new WizardView( "intro" );
-            else {
-                Controller::setForwardAction( "Update1" );
-                return false;
-            }
-
-            $this->setCommonData();
-            return true;
-        }
-    }
-
-    /**
-     *
-     * Saves data to the configuration file
-     *
-     */
-    class WizardStepOne extends WizardAction
-    {
-
-        var $_dbServer;
-        var $_dbUser;
-        var $_dbPassword;
-        var $_dbName;
-        var $_dbPrefix;
-        var $_connection;
-
-        function WizardStepOne( $actionInfo, $request )
-        {
-            $this->WizardAction( $actionInfo, $request );
-
-            // data validation
-            $this->registerFieldValidator( "dbServer", new StringValidator());
-            $this->registerFieldValidator( "dbUser", new StringValidator());
-            $this->registerFieldValidator( "dbPassword",  new StringValidator(), true );
-            $this->registerFieldValidator( "dbName", new StringValidator());
-            $this->registerFieldValidator( "dbDriver", new StringValidator());
-            $this->registerFieldValidator( "dbPrefix", new StringValidator(), true );
-            $errorView = new WizardView( "intro" );
-            $errorView->setErrorMessage( "Some data was incorrect or missing." );
-            $this->setValidationErrorView( $errorView );
-        }
-
-        function perform()
-        {
-            // fetch the data needed from the request
-            $this->_dbServer   = $this->_request->getValue( "dbServer" );
-            $this->_dbUser     = $this->_request->getValue( "dbUser" );
-            $this->_dbPassword = $this->_request->getValue( "dbPassword" );
-            $this->_dbName     = $this->_request->getValue( "dbName" );
-            $this->_skipThis   = $this->_request->getValue( "skipDbInfo" );
-            $this->_dbPrefix   = $this->_request->getValue( "dbPrefix", DEFAULT_DB_PREFIX );
-            $this->_dbDriver   = $this->_request->getValue( "dbDriver", DEFAULT_DB_PREFIX );
-
-            // we should now save the data to the configuration file, just before
-            // we read it
-            $configFile = new ConfigFileStorage();
-
-            // we expect everything to be fine
-            $errors = false;
-
-            // before doing anything, we should check of the configuration file is
-            // writable by this script, or else, throw an error and bail out gracefully
-            $configFileName = $configFile->getConfigFileName();
-            if( !File::exists( $configFileName )) {
-                if (! File::touch( $configFileName ) ) {
-                    $this->_view = new WizardView( "intro" );
-                    $message = "Could not create the LifeType configuration file $configFileName. Please make sure
-                                that the file can be created by the user running the webserver. It is needed to
-                                store the database configuration settings.";
-                    $this->_view->setErrorMessage( $message );
-                    $this->setCommonData( true );
-                    return false;
-                } else {
-                    ConfigFileStorage::createConfigFile( $configFileName );
-                }
-            }
-            if( File::exists( $configFileName ) && !File::isWritable( $configFileName )) {
-                $this->_view = new WizardView( "intro" );
-                $message = "Please make sure that the file $configFileName can be written by this script during
-                            the installation process. It is needed to store the database configuration settings. Once the
-                            installation is complete, please revert the permissions to no writing possible.";
-                $this->_view->setErrorMessage( $message );
-                $this->setCommonData( true );
-                return false;
-            }
-
-            // continue if everything went fine
-            if( !$configFile->saveValue( "db_username", $this->_dbUser ) ||
-                !$configFile->saveValue( "db_password", $this->_dbPassword ) ||
-                !$configFile->saveValue( "db_host", $this->_dbServer ) ||
-                !$configFile->saveValue( "db_database", $this->_dbName ) ||
-                !$configFile->saveValue( "db_prefix", $this->_dbPrefix ) ||
-				!$configFile->saveValue( "db_driver", $this->_dbDriver )) {
-                $errors = true;
-            }
-
-            if( $errors ) {
-                $message = "Could not save values to the configuration file. Please make sure it is available and
-                            that has write permissions for the user under your web server is running.";
-                $this->_view = new WizardView( "intro" );
-                $this->_view->setErrorMessage( $message );
-
-                return( false );
-            }
-            else {
-                $connectionEsablished = false;
-
-				// load the database driver
-				$driver = PDb::getDriver( $this->_dbDriver );
-				
-				// and attempt to connect
-                $this->_connection = $driver->Connect( $this->_dbServer, $this->_dbUser, $this->_dbPassword );
-                if( $this->_connection ) {
-                    $connectionEsablished = true;
-                } 
-				else {
-                    $connectionEsablished = false;
-                    $message = "There was an error connecting to the database. Please check your settings.";
-                }
-
-                if ( !$connectionEsablished ) {
-                    $this->_view = new WizardView( "step1" );
-                    $this->_view->setErrorMessage( $message );
-                    $this->setCommonData( true );
-                    return false;
-                } 
-				else {
-                	$this->_view = new WizardView( "step1" );
-	                $this->setCommonData( true );
-	                return true;
-	            }
-            }
-        }
-    }
-
-    /**
-     *
-     * Second step where we connect to the database and create the tables.
-     *
-     */
-    class WizardStepTwo extends WizardAction
-    {
-
-        var $_db;
-        var $_database;
-        var $_dbCharacterSet;
-        var $_createDatabase;
-
-        function setDbConfigValues( &$view )
-        {
-            $configFile = new ConfigFileStorage();
-            $configFile->reload();
-            $view->setValue( "dbUser", $configFile->getValue( "db_username" ));
-            $view->setValue( "dbPassword", $configFile->getValue( "db_password" ));
-            $view->setValue( "dbServer", $configFile->getValue( "db_host" ));
-            $view->setValue( "dbName", $configFile->getValue( "db_database" ));
-            $view->setValue( "dbPrefix", $configFile->getValue( "db_prefix" ));
-            $view->setValue( "dbCharacterSet", "utf8" );
-            $view->setValue( "dbDriver", $configFile->getValue( "db_driver" ));
-            return true;
-        }
-
-        function perform()
-        {
-            global $Tables;
-            global $Inserts;
-
-			$this->_dbCharacterSet = "utf8";
-            $configFile = new ConfigFileStorage();
-			$configFileName = $configFile->getConfigFileName();
-            
-            if( File::exists( $configFileName ) && !File::isWritable( $configFileName )) {
-                $this->_view = new WizardView( "step1" );
-                $message = "Please make sure that the file $configFileName can be written by this script during
-                            the installation process. It is needed to store the database configuration settings. Once the
-                            installation is complete, please revert the permissions to no writing possible.";
-                $this->_view->setErrorMessage( $message );
-                $this->setCommonData( true );
-                return false;
-            }
-
-            // continue if everything went fine
-            if( !$configFile->saveValue( "db_character_set", $this->_dbCharacterSet ) ) {
-                $message = "Could not save values to the configuration file. Please make sure it is available and
-                            that has write permissions for the user under your web server is running.";
-                $this->_view = new WizardView( "step1" );
-                $this->_view->setErrorMessage( $message );
-
-                return false;
-            }
-            
-            $createDb = $this->_request->getValue( "createDatabase" );
-            $message = '';
-
-            // only check for errors in case the database table should already exist!
-            if( !$createDb ) {
-                $connectionEsablished = false;
-
-                // Lets check the 'everything is fine' case first..
-                $this->_db = connectDb();
-                if( $this->_db ) {
-                     $connectionEsablished = true;
-                } else {
-                     $connectionEsablished = false;
-                     $message = "There was an error selecting the database. Please verify the database was already created or check the 'Create database' checkbox.";
-                }
-
-                // We were unable to connect to the db and select the right db.. lets try
-                // just to connect.. maybe the database needs to be created (even though the
-                // user did not check the appropriate box).
-                if ( !$connectionEsablished ) {
-                    $this->_db = connectDb( true, false );
-                    if( !$this->_db ) {
-                         $message = "There was an error connecting to the database. Please check your settings.";
-                    }
-                }
-
-                if ( !$connectionEsablished ) {
-                    $this->_view = new WizardView( "step1" );
-                    $this->setDbConfigValues( $this->_view );
-                    $this->_view->setErrorMessage( $message );
-                    $this->setCommonData( true );
-                    return false;
-                }
-            }
-
-            $config = new ConfigFileStorage();
-            $this->_database = $config->getValue( "db_database" );
-            $this->_dbPrefix = $config->getValue( "db_prefix" );
-
-            // create the database
-            if( $createDb ) {
-                $this->_db = connectDb( false, false );
-				if( !$this->_db ) {
-                    $this->_view = new WizardView( "step1" );
-                    $this->setDbConfigValues( $this->_view );
-                    $this->_view->setErrorMessage( $message );
-                    $this->setCommonData( true );
-                    return false;					
-				}
-                if( !$this->_db->Execute( "CREATE DATABASE ".$this->_database )) {
-                    $message = "Error creating the database: ".$this->_db->ErrorMsg();
-					$message .= "<br/><br/>If the database already exists, go back to Step 2 and use a new database name.";
-                    $this->_view = new WizardView( "step1" );
-                    $this->setDbConfigValues( $this->_view );
-                    $this->_view->setErrorMessage( $message );
-                    $this->setCommonData( true );
-                    return false;
-                } else {
-                    $message = "Database created successfully.<br/>";
-                }
-            }
-
-            // reconnect using the new database.
-            $config = new ConfigFileStorage();
-            $this->_db->Connect( $config->getValue( "db_host" ), 
-                                 $config->getValue( "db_username" ), 
-                                 $config->getValue( "db_password" ), 
-                                 $config->getValue( "db_database" ));
-                                 
-            // create a data dictionary to give us the right sql code needed to create the tables
-            $dict = NewPDbDataDictionary( $this->_db );
-
-           // create the tables
-            $errors = false;            
-            
-            foreach( $Tables as $name => $table ) {
-            	$upperName = $dict->upperName;
-            	$tableSchema = $table["schema"];
-            	if ( isset( $table["options"] ) ) {
-            		$tableOptions = $table["options"];
-            		$options = array ( $upperName => $tableOptions );
-            	} 
-				else {
-            		$options = array ();
-                }
-                $sqlarray = $dict->CreateTableSQL( $this->_dbPrefix.$name, $tableSchema, $options );
-
-                // each table may need more than one sql query because of indexes, triggers, etc...
-                $ok = true;
-                foreach( $sqlarray as $sql ) {
-					$ret = true;
-					if( !$this->_db->Execute( $sql )) {
-						$ret = false;
-						print("SQL query failed: ".$sql);
-						die();
-					}
-                    $ok = ( $ok && $ret);
-                }
-                
-                if( $ok )
-                    $message .= "Table <strong>$name</strong> created successfully.<br/>";
-                else {
-                    $message .= "Error creating table $name: ".$this->_db->ErrorMsg()."<br/>";
-                    $errors = true;
-                }                    
-            }
-
-            if( $errors ) {
-                $message = "There was an error creating the tables in the database. Please make sure that the user chosen to connect to the database has enough permissions to create tables.<br/><br/>$message";
-                $this->_view = new WizardView( "step1" );
-                $this->_view->setErrorMessage( $message );
-                $this->setDbConfigValues( $this->_view );
-                $this->setCommonData();
-                return false;
-            }
-
-             // try to guess the url where plog is running
-             $httpProtocol = (array_key_exists("HTTPS", $_SERVER) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
-             $httpHost = $_SERVER["HTTP_HOST"];
-             $requestUrl = $_SERVER["REQUEST_URI"];
-             $requestUrl = str_replace( "/wizard.php", "", $requestUrl );
-             $plogUrl = $httpProtocol.$httpHost.$requestUrl;
-
-            // Find some of the tools we are going to need (last one is for os x, with fink installed)
-            // TBD: support for Windows specific directories
-            $folders = Array( "/bin/", "/usr/bin/", "/usr/local/bin/", "/sw/bin/" );
-            $finder = new FileFinder();
-            $pathToUnzip = $finder->findBinary( "unzip", $folders );
-            $pathToTar = $finder->findBinary( "tar", $folders);
-            $pathToGzip = $finder->findBinary( "gzip", $folders);
-            $pathToBzip2 = $finder->findBinary( "bzip2", $folders);
-            $pathToConvert = $finder->findBinary( "convert", $folders);
-
-            // and execute some insert's
-            foreach( $Inserts as $insert ) {
-                $query = str_replace( "{dbprefix}", $this->_dbPrefix, $insert );
-                $query = str_replace( "{plog_base_url}", $plogUrl, $query );
-                // replace also the placeholders for the paths to the tools
-                $query = str_replace( "{path_to_tar}", $pathToTar, $query );
-                $query = str_replace( "{path_to_unzip}", $pathToUnzip, $query );
-                $query = str_replace( "{path_to_bz2}", $pathToBzip2, $query );
-                $query = str_replace( "{path_to_gzip}", $pathToGzip, $query );
-                $query = str_replace( "{path_to_convert}", $pathToConvert, $query );
-                $query = str_replace( "{path_to_convert}", $pathToConvert, $query );
-                if( !$this->_db->Execute( $query )) {
-                    $message .= "Error executing code: ".$this->_db->ErrorMsg()."<br/>";
-                    $errors = true;
-                }
-            }
-
-            //
-            // show some information regarding the helper tools we're going to need
-            // and wether they were found or not
-            //
-            $message .= "<br/><b>-- Helper tools --</b><br/>";
-            if( $pathToTar == "" )
-                $message .= "The helper tool 'tar' was not found<br/>";
-            else
-                $message .= "The helper tool 'tar' was found in $pathToTar<br/>";
-            if( $pathToGzip == "" )
-                $message .= "The helper tool 'gzip' was not found<br/>";
-            else
-                $message .= "The helper tool 'gzip' was found in $pathToGzip<br/>";
-            if( $pathToUnzip == "" )
-                $message .= "The helper tool 'unzip' was not found<br/>";
-            else
-                $message .= "The helper tool 'unzip' was found in $pathToUnzip<br/>";
-            if( $pathToBzip2 == "" )
-                $message .= "The helper tool 'bzip2' was not found<br/>";
-            else
-                $message .= "The helper tool 'bzip2' was found in $pathToTar<br/>";
-            if( $pathToConvert == "" )
-                $message .= "The helper tool 'convert' (from the ImageMagick package) was not found<br/>";
-            else
-                $message .= "The helper tool 'convert' (from the ImageMagick package) was found in $pathToConvert<br/>";
-
-            // Scan for locales
-            $locales = new Locales();
-            // find all the new locales that we have not yet stored
-            $f = new LocaleFinder();
-            $newLocaleCodes = $f->find();
-
-            foreach( $newLocaleCodes as $newLocaleCode ) {
-                $res = $locales->addLocale( $newLocaleCode );
-            }
-
-			// load the core permissions
-		    include( PLOG_CLASS_PATH."install/corepermissions.properties.php" );
-
-		    // process permissions
-		    $total = 0;		
-		    foreach( $permissions as $perm ) {
-			    // check if it already exists
-			    $query = "SELECT * FROM ".Db::getPrefix()."permissions WHERE permission = '".$perm[0]."'";
-			    $result = $this->_db->Execute( $query );
-			    if( !$result || $result->RowCount() < 1 ) {
-				   	// permission needs to be added
-					$corePerm = ( $perm[2] == true ? 1 : 0 );
-					$adminOnly = ( $perm[3] == true ? 1 : 0 );
-
-					$query = "INSERT INTO ".Db::getPrefix()."permissions (permission,description,core_perm,admin_only) ".
-					          "VALUES ('".$perm[0]."','".$perm[1]."','".$corePerm."','".$adminOnly."')";
-
-					$this->_db->Execute( $query );
-					$total++;
-			    }
-		    }
-
-			// show some feedback
-            if( $errors ) {
-                $this->_view = new WizardView( "step1" );
-                $this->setDbConfigValues( $this->_view );
-                $message = "There was an error initializing some of the tables. Please make sure that the user chosen to connect to the database has enough permissions to add records to the database.<br/><br/>$message";
-                $this->_view->setErrorMessage( $message );
-                $this->setCommonData();
-            }
-            else {
-                $this->_view = new WizardView( "step2" );
-                $this->_view->setValue( "message", $message );
-            }
-        }
-    }
-
-    /**
-     *
-     * this action only shows some feedback
-     *
-     */
-    class WizardStepThree extends WizardAction
-    {
-        function perform()
-        {
-            $this->_view = new WizardView( "step3" );
-            $this->setCommonData();
-        }
-    }
-
-    /**
-     *
-     * Create the first user in the database
-     *
-     */
-    class WizardStepFour extends WizardAction
-    {
-
-        var $_userName;
-        var $_userPassword;
-        var $_confirmPassword;
-        var $_userEmail;
-        var $_userFullName;
-
-        function WizardStepFour( $actionInfo, $request )
-        {
-            $this->WizardAction( $actionInfo, $request );
-
-            $this->registerFieldValidator( "userName", new UsernameValidator());
-            //$this->registerFieldValidator( "userPassword", new PasswordValidator());
-            //$this->registerFieldValidator( "userPasswordCheck", new PasswordValidator());
-            $this->registerFieldValidator( "userEmail", new EmailValidator());
-            $this->registerField( "userFullName" );
-            $view = new WizardView( "step3" );
-            $view->setErrorMessage( "Some data is missing or incorrect" );
-            $this->setValidationErrorView( $view );
-        }
-
-        // creates the user
-        function perform()
-        {
-            $this->_userName = $this->_request->getValue( "userName" );
-            $this->_userPassword = $this->_request->getValue( "userPassword" );
-            $this->_confirmPassword = $this->_request->getValue( "userPasswordCheck" );
-            $this->_userEmail = $this->_request->getValue( "userEmail" );
-            $this->_userFullName = $this->_request->getValue( "userFullName" );
-
-            $db = connectDb();
-
-            if( !$db ) {
-                $this->_view = new WizardView( "step3" );
-                $this->_view->setErrorMessage( "There was an error connecting to the database. Please check your settings." );
-                $this->setCommonData();
-                return false;
-            }
-
-            if( $this->_confirmPassword != $this->_userPassword ) {
-                $this->_view = new WizardView( "step3" );
-                $this->_form->setFieldValidationStatus( "userPasswordCheck", false );
-                $this->setCommonData( true );
-                return false;
-            }
-
-            $dbPrefix = Db::getPrefix();
-
-            $users = new Users();
-            $user = new UserInfo( $this->_userName,
-                                  $this->_userPassword,
-                                  $this->_userEmail,
-                                  "",
-                                  $this->_userFullName);
-			// set the user as an administrator
-			$user->setSiteAdmin( true );
-			// and add this record to the db
-            $userId = $users->addUser( $user );
-            if( !$userId ) {
-                $this->_view = new WizardView( "step3" );
-				$db =& Db::getDb();
-                $message = "There was an error adding the user. Make sure that the user does not already exist in the database (".$db->ErrorMsg().")";
-                $this->_view->setErrorMessage( $message );
-                $this->setCommonData();
-                return false;
-            }
-
-			// since this user is an administrator, he must be granted all the administrator
-			// permissions available
-			$perms = new Permissions();
-			$userPerms = new UserPermissions();
-			foreach( $perms->getAllPermissions() as $perm ) {
-				if( $perm->isAdminOnlyPermission()) {
-					// if it's an admin permission, add it
-					$p = new UserPermission( $userId, 0, $perm->getId());
-					$userPerms->grantPermission( $p );
-					//print("granting permission: ".$perm->getName()."<br/>");
-				}
-			}
-
-			// add the default friend group for user
-            $friendGroups = new FriendGroups();
-            $friendGroup = new FriendGroup( $userId, "General", "General" );
-            $friendGroups->addFriendGroup( $friendGroup );            
-
-			// add the default private message boxes for user
-		    $privateMessageBoxes = new PrivateMessageBoxes();
-		    $inbox = new PrivateMessageBox( $userId, BOX_TYPE_INBOX );
-		    $outbox = new PrivateMessageBox( $userId, BOX_TYPE_OUTBOX );
-		    $privateMessageBoxes->addPrivateMessageBox( $inbox );
-		    $privateMessageBoxes->addPrivateMessageBox( $outbox );
-
-            $this->_view = new Wizardview( "step4" );
-            $this->_view->setValue( "ownerid", $userId );
-            $this->_view->setValue( "siteLocales", Locales::getLocales());
-            $this->_view->setValue( "defaultLocale", Locales::getDefaultLocale());
-            $ts = new TemplateSets();
-            $this->_view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
-            $this->setCommonData();
-            return true;
-        }
-
-    }
-
-    class WizardStepFive extends WizardAction
-    {
-
-        var $_blogName;
-        var $_ownerId;
-        var $_blogProperties;
-
-        function WizardStepFive( $actionInfo, $request )
-        {
-              $this->WizardAction( $actionInfo, $request );
-
-              $this->registerFieldValidator( "blogName", new StringValidator());
-              $this->registerFieldValidator( "ownerid", new IntegerValidator());
-              $this->registerFieldValidator( "blogTemplate", new StringValidator());
-              $this->registerFieldValidator( "blogLocale", new StringValidator());			  
-              $view = new WizardView( "step4" );
-              $view->setErrorMessage( "Some data is missing or incorrect" );
-              $view->setValue( "siteLocales", Locales::getLocales());
-			  $view->setValue( "defaultLocale", Locales::getDefaultLocale());
-              $ts = new TemplateSets();
-              $view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
-              $this->setValidationErrorView( $view );
-        }
-
-        function perform()
-        {
-            // Before we add a new blog, we need to add blog category and global article category first
-            // add blog category
-            $blogCategories = new BlogCategories();
-            $blogCategory = new BlogCategory( "General", "General" );
-            $blogCategoryId = $blogCategories->addBlogCategory( $blogCategory );
-
-            // add global article category
-            $globalArticleCategories = new GlobalArticleCategories();
-            $globalArticleCategory = new GlobalArticleCategory( "General", "General" );
-            $globalArticleCategoryId = $globalArticleCategories->addGlobalArticleCategory( $globalArticleCategory );
-            
-            // retrieve the values from the view
-            $this->_blogName = $this->_request->getValue( "blogName" );
-            $this->_ownerId  = $this->_request->getValue( "ownerid" );
-            $this->_blogProperties = $this->_request->getValue( "properties" );
-            $this->_blogTemplate = $this->_request->getValue( "blogTemplate" );
-            $this->_blogLocale = $this->_request->getValue( "blogLocale" );
-
-            // configure the blog
-            $blogs = new Blogs();
-            $blog = new BlogInfo( $this->_blogName, $this->_ownerId, "", "" );
-            // set the default BlogCategory id to blog
-            $blog->setBlogCategoryId( $blogCategoryId );
-            $blog->setProperties( $this->_blogProperties );
-            $blog->setStatus( BLOG_STATUS_ACTIVE );
-            $blogSettings = $blog->getSettings();
-            $blogSettings->setValue( "locale", $this->_blogLocale );
-            $blogSettings->setValue( "template", $this->_blogTemplate );
-            $blog->setSettings( $blogSettings );
-
-            // and now save it to the database
-            $newblogId = $blogs->addBlog( $blog );
-            if( !$newblogId ) {
-                $this->_view = new WizardView( "step4" );
-                $this->_view->setValue( "siteLocales", Locales::getLocales());
-                $ts = new TemplateSets();
-                $this->_view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
-                $this->_view->setErrorMessage( "There was an error creating the new blog" );
-                $this->setCommonData( true );
-                return false;
-            }
-
-            // if the blog was created, we can add some basic information
-            // add a category
-            $articleCategories = new ArticleCategories();
-            $articleCategory = new ArticleCategory( "General", "General", $newblogId, true );
-            $catId = $articleCategories->addArticleCategory( $articleCategory );
-
-            // load the right locale
-            $locale =& Locales::getLocale( $this->_blogLocale );
-            // and load the right text
-            $articleTopic = $locale->tr( "register_default_article_topic" );
-            $articleText  = $locale->tr( "register_default_article_text" );
-            $article = new Article( $articleTopic, $articleText, Array( $catId ), $this->_ownerId, $newblogId, POST_STATUS_PUBLISHED, 0, Array(), "welcome" );
-            // set the default ArticleGlobalCategory id to article
-            $article->setGlobalCategoryId( $globalArticleCategoryId );
-            // set the current time to article
-            $t = new Timestamp();
-            $article->setDateObject( $t );
-            $articles = new Articles();
-            $articles->addArticle( $article );
-
-            // add a new first album so that users can start uploading stuff right away
-            $t = new Timestamp();
-            $album = new GalleryAlbum( $newblogId,
-                                       "General",
-                                       "General",
-                                       GalleryConstants::GALLERY_RESOURCE_PREVIEW_AVAILABLE,
-                                       0,
-                                       $t->getTimestamp(),
-                                       Array(),
-                                       true );
-            $albums = new GalleryAlbums();
-            $albums->addAlbum( $album );
-            
-            // add a new default mylinkscategory
-            $linksCategory = new MyLinksCategory( "General", $newblogId );
-            $linksCategories = new MyLinksCategories();
-            $linksCategories->addMyLinksCategory( $linksCategory );         
-
-            // save a few things in the default configuration
-            $config =& Config::getConfig();
-            // default blog id
-            $config->saveValue( "default_blog_id", (int)$newblogId );
-            // default locale
-            $config->saveValue( "default_locale", $this->_blogLocale );
-            // and finally, the default template
-            $config->saveValue( "default_template", $this->_blogTemplate );
-
-            //
-            // detect wether we have GD available and set the blog to use it
-            //
-            if( GdDetector::detectGd()) {
-                $config->saveValue( "thumbnail_method", "gd" );
-                $message = "GD has been detected and set as the backend for dealing with images.";
-            }
-            else {
-                $pathToConvert = $config->getValue( "path_to_convert" );
-                if( $pathToConvert ) {
-                    $config->saveValue( "thumbnail_method", "imagemagick" );
-                    $message = "ImageMagick has been detected and set as the backend for dealing with images.";
-                }
-                else {
-                    // nothing was found, so we'll have to do away with the 'null' resizer...
-                    $config->saveValue( "thumbnail_method", "null" );
-                    $message = "Neither GD nor ImageMagick have been detected in this host so it will not be possible to generate thumbnails from images.";
-                }
-            }
-            
-            // clean the data cache to avoid problems when we're done
-            
-            $cache =& CacheManager::getCache();
-            $cache->clearCache();
-
-            WizardTools::cleanTmpFolder();
-
-            $this->_view = new WizardView( "step5" );
-            $this->_view->setValue( "message", $message );
-            return true;
-        }
-    }
-
-    class UpdateStepOne extends WizardAction
-    {
-
-        function perform()
-        {
-            $this->_view = new WizardView( "update1" );
-            WizardStepTwo::setDbConfigValues( $this->_view );
-            $this->setCommonData();
-        }
-    }
-
-    class UpdateStepTwo extends WizardAction
-    {
-        function perform()
-        {
-			
-			$config =& Config::getConfig();
-			$resourcesNamingRule = $config->getValue( "resources_naming_rule", "original_file_name" );
-			
-            $this->_view = new WizardView( "update2" );
-            $this->_view->setValue( "resourcesNamingRule", $resourcesNamingRule );
-            $this->setCommonData();
-        }
-    }
-    
-    /**
-     * Generic class that performs data updates on the database
-     */
-    class DatabaseDataTransformer extends Model
-    {
-        /**
-         * @public
-         * Public fields, may be accessed by other classes
-         */
-        var $updatedRecords;
-        var $message;
-        var $errorRecords;
-        var $notModifiedRecords;
-        var $failOnError;
-        var $page;
-        var $itemsPerPage;
-        var $dbPrefix;
-    
-        function DatabaseDataTransformer( $page = -1, $itemsPerPage = WIZARD_MAX_RECORDS_PER_STEP )
-        {
-            $this->Model();
-            
-            $this->updatedRecords = 0;
-            $this->errorRecords   = 0;
-            $this->notModifiedRecords = 0;
-            $this->addedRecords = 0;
-            $this->deletedRecords = 0;
-            $this->failOnError = DATABASE_DATA_TRANSFORMER_FAIL_ON_ERROR_DEFAULT;
-            $this->message = "";
-            
-            $this->page = $page;
-            $this->itemsPerPage = $itemsPerPage;
-            
-            $this->dbPrefix = $this->getPrefix();
-        }
-        
-        /**
-         * Rerforms the transformation. Returns true if the step was successful or false otherwise.
-         * Upon finalization, please check the $message string to get more information. Use the $updatedRecords,
-         * $errorRecords, $notModifiedRecords, $addedRecords and $deletedRecords for some figures regarding the 
-         * previous step
-         */
-        function perform()
-        {
-            // must be implemented by child classes
-            return true;        
-        }
-        
-        /**
-         * Returns true if there is no more data for this transformer to upgrade, or false otherwise
-         *
-         * @return True if ready or false if not
-         */
-        function isComplete()
-        {
-            return( $this->getNumSteps() <= $this->page );
-        }
-        
-        /**
-         * returns the number of steps needed to process this data
-         */
-        function getNumSteps( $table = "" )
-        {
-            // if there is a table name, we can take a shortcut or else we expect child
-            // classes to reimplement this method
-            if( $table ) {
-                $numItems = $this->getNumItems( $this->getPrefix().$table );
-                
-                $numSteps = ceil( $numItems / $this->itemsPerPage );
-            }
-            else {
-                $numSteps = 0;
-            }
-            
-            return( $numSteps );
-        }
-        
-        /**
-         * returns the total number of records processed so far based on the current page and the
-         * number of items per page
-         */
-        function getTotalProcessedRecords()
-        {
-            return( $this->page * $this->itemsPerPage );
-        }
-        
-        /**
-         * returns an approximate percentage of records processed so far
-         */
-        function getPercentProcessed()
-        {
-            $processed = $this->getTotalProcessedRecords();
-            return((int)($processed / ( $this->getNumSteps() * $this->itemsPerPage ) * 100 ));
-        }
-    }
-
-	/**
-	 * This step takes care of transforming the database schema, one
-	 * table at a time.
-	 */
-	class DatabaseSchemaDataTransformer extends DatabaseDataTransformer
-	{		
-		function getNumSteps()
-		{
-			global $Tables;			
-			return( count( $Tables ) - 1);
-		}
-		
-		function perform()
-		{
-			global $Tables;
-			
-			$tablesArray = array_keys( $Tables );
-			$curTable = $tablesArray[$this->page-1];
-						
-			$db =& Db::getDb();
-            $dict = NewPDbDataDictionary( $db );
-            $errors = false;
-
-			$this->message = "Performing changes to the dabase schema, please wait (step %s of %s)<br/>";
-
-			$errorMessage = "";
-			$table_errors = false;
-			$upperName = $dict->upperName;
-			$tableSchema = $Tables[$curTable]["schema"];
-			if ( isset( $Tables[$curTable]["options"] )) {
-				$tableOptions = $Tables[$curTable]["options"];
-				$options = array ( $upperName => $tableOptions );
-			} 
-			else {
-				$options = array ();
-			}
-
-			// generate the code with the changes for the table
-			$sqlarray = $dict->ChangeTableSQL( $this->getPrefix().$curTable, $tableSchema, $options );
-
-			foreach( $sqlarray as $sql ) {
-				// and run the query
-				//print( "sql: ".$sql."<br/>" );
-				if( !$this->Execute( $sql )) {
-					$table_errors = true;
-					$errors = true;
-					$errorMessage .= $this->_db->ErrorMsg()."<br/>";
-				}
-			}
-
-			if( !$table_errors ) {
-				$this->message .= "Changes to table <strong>$curTable</strong> executed successfully.<br/>";
-				$result = true;
-			}
-			else {
-				$this->message .= "Error modifying table $curTable: ".$errorMessage;
-				$result = false;
-			}
-
-			return( $result ); 
-		}
-	}
-    
-    /**
-	 * Processes all users and grants the appropriate permissions
-     */
-    class UserPermissionsDataTransformer extends DatabaseDataTransformer
-    {        
-        function getNumSteps()
-        {
-            return( parent::getNumSteps( "tmp_users_permissions" ));
-        }
-    
-        function perform()
-        {
-            $this->message = "Updating user permissions (step %s of %s)<br/>";        
-        
-            $query3 = "SELECT * FROM ".Db::getPrefix()."tmp_users_permissions";
-            $res3 = $this->Execute( $query3, $this->page, $this->itemsPerPage );
-            if( $res3->RecordCount() == 0 ) {
-				$this->message .= "No more records to process";
-				return( true );
-			}
-			
-			$permissions = new Permissions();
-			$userPermissions = new UserPermissions();
-			$allPerms = $permissions->getAllPermissions();
-			$blogOwnerOnlyPerms = Array( "update_blog", 
-			                             "add_blog_user", 
-			                             "update_blog_user", 
-			                             "view_blog_users", 
-			                             "view_blog_stats", 
-			                             "add_blog_template",
-										 "view_blog_templates",
-										 "view_blog_stats" );
-			
-            while( $row = $res3->FetchRow()) {
-            	// grant all the non-admin permissions so that users can still access the blogs to where they still had permissions
-				if( $row["permission_id"] != 3) {
-					foreach( $allPerms as $perm ) {
-						if( !$perm->isAdminOnlyPermission() && !in_array( $perm->getName(), $blogOwnerOnlyPerms )) {
-							//print( "granting perm: ".$perm->getName()." - user: ".$row["user_id"]." - blog id: ".$row["blog_id"]."<br/>");							
-							$perm = new UserPermission( $row["user_id"], $row["blog_id"], $perm->getId());
-							$userPermissions->grantPermission( $perm );
-						}
-					}
-				}
-            }
-      
-            $this->message .= "{$this->updatedRecords} users updated (".$this->getPercentProcessed()."%%)<br/>";
-
-            $this->Execute("DROP TABLE ".Db::getPrefix()."tmp_users_permissions");
-
-            return true;
-        }
-    }
-
-	class PermissionLoader extends DatabaseDataTransformer
-	{
-		
-		//
-		// load the new list of permissions
-		//		
-		function getNumSteps()
-		{
-			return( 0 );
-		}
-		
-		function perform()
-		{
-			// initial message, no errors yet
-            $this->message = "Loading new permissions (step %s of %s)<br/>";			
-			$errors = false;
-			
-			// load the core permissions
-		    include( PLOG_CLASS_PATH."install/corepermissions.properties.php" );	
-
-		    // process permissions
-		    $total = 0;		
-		    foreach( $permissions as $perm ) {
-			    // check if it already exists
-			    $query = "SELECT * FROM ".$this->dbPrefix."permissions WHERE permission = '".$perm[0]."'";
-			    $result = $this->Execute( $query );
-			    if( !$result || $result->RowCount() < 1 ) {				
-				   	// permission needs to be added
-					$corePerm = ( $perm[2] == true ? 1 : 0 );
-					$adminOnly = ( $perm[3] == true ? 1 : 0 );
-					$query = "INSERT INTO ".$this->dbPrefix."permissions (permission,description,core_perm,admin_only) ".
-					          "VALUES ('".$perm[0]."','".$perm[1]."','".$corePerm."','".$adminOnly."')";
-					$this->_db->Execute( $query );
-					$total++;
-			    }
-		    }
-		
-			//
-			// prepare the users_permissions table for the next step
-			//
-
-            // make sure we are starting with an empty table
-            $this->Execute("DELETE FROM ".Db::getPrefix()."tmp_users_permissions");
-            
-			if( !$this->Execute( "INSERT INTO ".$this->dbPrefix."tmp_users_permissions SELECT * FROM ".$this->dbPrefix."users_permissions WHERE blog_id != 0 AND permission_id != 1" )) {
-				$this->message .= "Error preparing the users_permissions table for transformation";
-				$errors = true;
-			}
-			else {
-				$this->Execute( "DELETE FROM ".$this->dbPrefix."users_permissions" );
-				$this->message .= count($permissions)." permissions successfully loaded";
-				$errors = false;
-			}				
-			
-			return( !$errors );			
-		}	
-	}
-
-	class ConfigDataTransformer extends DatabaseDataTransformer
-	{
-		function getNumSteps()
-		{
-			return( 0 );
-		}
-		
-		function perform()
-		{
-		    global $Inserts;	
-			
-            $this->message = "Adding new configuration parameters (step %s of %s)<br/>";
-			$errors = false;
-			
-            // Find some of the tools we are going to need (last one is for os x, with fink installed), this will be needed later on
-            $folders = Array( "/bin/", "/usr/bin/", "/usr/local/bin/", "/sw/bin/" );
-            $finder = new FileFinder();
-            $pathToUnzip = $finder->findBinary( "unzip", $folders );
-            $pathToTar = $finder->findBinary( "tar", $folders);
-            $pathToGzip = $finder->findBinary( "gzip", $folders);
-            $pathToBzip2 = $finder->findBinary( "bzip2", $folders);
-            $pathToConvert = $finder->findBinary( "convert", $folders);
-
-            // check the configuration and add the new configuration settings that were added for 1.2
-            foreach( $Inserts as $key => $insert ) {
-				$checkKeyQuery = "SELECT * FROM ".$this->dbPrefix."config WHERE config_key ='".$key."';";
-				$result = $this->Execute($checkKeyQuery);
-                if(!$result){
-                    $this->message .= "Error executing code: ".$this->_db->ErrorMsg()."<br/>";
-                    $errors = true;
-                }
-				else{
-                    if ($result->RecordCount() == 0) {	
-                        // replace the prefix
-                        $query = str_replace( "{dbprefix}", $this->dbPrefix, $insert );
-                        // replace also the placeholders for the paths to the tools
-                        $query = str_replace( "{path_to_tar}", $pathToTar, $query );
-                        $query = str_replace( "{path_to_unzip}", $pathToUnzip, $query );
-                        $query = str_replace( "{path_to_bz2}", $pathToBzip2, $query );
-                        $query = str_replace( "{path_to_gzip}", $pathToGzip, $query );
-                        $query = str_replace( "{path_to_convert}", $pathToConvert, $query );
-                        $query = str_replace( "{path_to_convert}", $pathToConvert, $query );
-                        if( !$this->Execute( $query )) {
-                            $this->message .= "Error executing code: ".$this->_db->ErrorMsg()."<br/>";
-                            $errors = true;
-                        }
-                    }
-                    $result->Close();
-                }
-            }
-                // check to see if we need to remove duplicates and the id index
-            $query = "SELECT id FROM ".$this->dbPrefix."config LIMIT 1";
-            $result = $this->Execute($query);
-                // if $result is false, id column has already been removed
-            if($result){
-                $result->Close();           
-                    // remove all duplicates in plog_config table
-                    
-                    // first create temp table without the duplicates
-                $query = "CREATE TEMPORARY TABLE tmptable ".
-                         "SELECT * FROM ".$this->dbPrefix."config WHERE 1 GROUP BY config_key";
-                $result = $this->Execute($query);
-                if($result){
-                    //$result->Close();
-                        // Now delete the old table
-                    $query = "DELETE FROM ".$this->dbPrefix."config";
-                    $result = $this->Execute($query);
-                    if($result) {
-                        //$result->Close();
-                        // Insert the unique rows into the old table
-                        $query = "INSERT INTO ".$this->dbPrefix."config SELECT * FROM tmptable";
-                        $result = $this->Execute($query);
-                    }
-                }
-                /*if(!$result){
-                    $this->message .= "Error removing duplicates in config table<br/>";
-                    $errors = true;
-                }*/
-
-                if($result){
-
-                    // remove index id field, we don't need it any more!
-                    $query = "ALTER TABLE ".$this->dbPrefix."config DROP COLUMN id";
-                    $result = $this->Execute($query);
-                    if(!$result){
-                        $this->message .= "Error removing old id column from config table: ".$this->_db->ErrorMsg()."<br/>";
-                        $errors = true;
-                    }
-                }
-            }			
-
-			if( !$errors ) {
-				$this->message .= "Configuration settings updated successfully";
-			}
-			
-			return( !$errors );
-		}		
-	}
-
-    /**
-	 * Processes all admin users and grants the appropriate permissions
-     */
-    class AdminUserPermissionsDataTransformer extends DatabaseDataTransformer
-    {        
-        function getNumSteps()
-        {
-            return( parent::getNumSteps( "users" ));
-        }
-    
-        function perform()
-        {
-            $this->message = "Updating admin user permissions (step %s of %s)<br/>";        
-        
-            // load each one of the categories and update them
-            // list of categories
-            /*$query3 = "SELECT id, site_admin FROM ".$this->dbPrefix."users";
-            $res3 = $this->Execute( $query3, $this->page, $this->itemsPerPage );
-            if( $res3->RecordCount() == 0 ) {
-				$this->message .= "No more records to process";
-				return( true );
-			}*/
-			
-			$users = new Users();
-			$allUsers = $users->getAllUsers( USER_STATUS_ALL, "", "", $this->page, $this->itemsPerPage );
-			
-			$permissions = new Permissions();
-			$userPermissions = new UserPermissions();
-			$loginPerm = $permissions->getPermissionByName( "login_perm" );
-			$allPerms = $permissions->getAllPermissions();
-			
-            //while( $row = $res3->FetchRow()) {
-			foreach( $allUsers as $user ) {
-				//print("Processing user: ".$user->getUsername()."<br/>");
-            	//if( $row["site_admin"] > 0 ) {
-				if( $user->isSiteAdmin()) {
-					// it's an admin, let's grant all the appropriate permissions
-					foreach( $allPerms as $perm ) {
-						if( $perm->isAdminOnlyPermission() && $perm->getName() != "login_perm" ) {
-							//$userPerm = new UserPermission( $row["id"], 0, $perm->getId());
-							$userPerm = new UserPermission( $user->getId(), 0, $perm->getId());
-							$userPermissions->grantPermission( $userPerm );
-						}
-					}
-				}
-				// grant the login_perm permission or else users won't be able to log in
-				$newPerm = new UserPermission( $user->getId(), 0, $loginPerm->getId());
-				$userPermissions->grantPermission( $newPerm );
-				
-				$this->updatedRecords++;
-            }
-        
-            $this->message .= "{$this->updatedRecords} users updated (".$this->getPercentProcessed()."%%)<br/>";
-            return true;        
-        }
-    }
-    
-    /**
-     * processes all resource files and renames the files to their "real" names
-     */
-    class ResourcesOriginalFileNameDataTransformer extends DatabaseDataTransformer
-    {
-        function getNumSteps()
-        {
-            return( parent::getNumSteps( "gallery_resources" ));
-        }
-    
-        function perform()
-        {
-            $this->message = "Updating resource files with original file naming rule (step %s of %s)<br/>";        
-        
-            $query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
-
-			$config =& Config::getConfig();
-			$galleryFolder = $config->getValue( "resources_folder" );
-
-            // total number of comments
-            $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
-            if( !$res1 ) {
-                $this->message .= "Error performing loading resource data";
-                return false;
-            }
-            if( $res1->RecordCount() == 0 ) {
-				$this->message .= "No more records to process";
-				return( true );            
-            }
-            $numComments = Array();
-            while( $row = $res1->FetchRow()) {
-				//
-				// process each one of the rows and rename the main file
-				//
-				
-				// get the file extension
-				if(( $extPos = strrpos( $row["file_name"], "." )) !== false ) {					
-					$fileExt = substr( $row["file_name"], $extPos+1, strlen( $row["file_name"] ));
-				}
-				else {
-					$fileExt = "";
-				}
-								
-				$fileName = $galleryFolder.$row["owner_id"]."/".$row["owner_id"]."-".$row["id"].".".$fileExt;
-				$destFileName = $galleryFolder.$row["owner_id"]."/".$row["file_name"];
-				
-                    //print( "Renaming file: $fileName --- $destFileName<br/>" );
-                    // skip the rename if we already did it
-				if( File::exists( $fileName )) {
-	                if( !File::exists( $destFileName)) {
-	                    if( !File::rename( $fileName, $destFileName )) {
-	                        $this->message .= "Error updating resource file with id ".$row["id"].", while attempting to rename file from $fileName to $destFileName<br/>";
-	                    }
-					}
-				}
-				
-				// if it's an image, we also need to process the previews
-				if( $row["resource_type"] == "1" ) {
-					// calculate the extension of the preview file, depending on how it was saved
-					if( $row["thumbnail_format"] == "same" ) {
-						$previewExt = strtolower( $fileExt );
-						$destFileName = $row["file_name"];
-					}
-					else {
-						$previewExt = $row["thumbnail_format"];
-						// remove the old extension and put the new one in place
-						//print("file name = ".$row["file_name"]." - file ext = $fileExt - previewExt = $previewExt" );
-						$destFileName = str_replace( $fileExt, $previewExt, $row["file_name"] );
-					}
-						
-					// file names for the preview and medium preview
-					$previewFileName = $galleryFolder.$row["owner_id"]."/previews/".$row["owner_id"]."-".$row["id"].".".$previewExt;
-					$medPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$row["owner_id"]."-".$row["id"].".".$previewExt;					
-					// destination file names for the preview and medium preview
-					$destPreviewFileName = $galleryFolder.$row["owner_id"]."/previews/".$destFileName;
-					$destMedPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$destFileName;
-					
-					//print(" -- renaming preview: $previewFileName -- $destPreviewFileName<br/>");
-					//print(" -- renaming medium preview: $medPreviewFileName -- $destMedPreviewFileName<br/>");					
-					
-					if( File::exists( $previewFileName )) {
-                    	if( !File::exists( $destPreviewFileName)) {
-                        	File::rename( $previewFileName, $destPreviewFileName );
-                    	}
-					}
-					if( File::exists( $medPreviewFileName )) {
-	                    if( !File::exists( $destMedPreviewFileName)) {
-	                        File::rename( $medPreviewFileName, $destMedPreviewFileName );
-	                    }
-					}
-				}
-
-                $this->updatedRecords++;
-            }
-            $res1->Close();
-            $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
-            return true;        
-        }        
-    }
-
-    /**
-     * processes all resource files and renames the files to their "encoded" names
-     */
-    class ResourcesEncodedFileNameDataTransformer extends DatabaseDataTransformer
-    {
-        function getNumSteps()
-        {
-            return( parent::getNumSteps( "gallery_resources" ));
-        }
-    
-        function perform()
-        {
-            $this->message = "Updating resource files with encoded file naming rule (step %s of %s)<br/>";        
-        
-            $query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
-
-			$config =& Config::getConfig();
-			$galleryFolder = $config->getValue( "resources_folder" );
-
-            // total number of comments
-            $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
-            if( !$res1 ) {
-                $this->message .= "Error performing loading resource data";
-                return false;
-            }
-            if( $res1->RecordCount() == 0 ) {
-				$this->message .= "No more records to process";
-				return( true );            
-            }
-            $numComments = Array();
-            while( $row = $res1->FetchRow()) {
-				//
-				// process each one of the rows and rename the main file
-				//
-				
-				// get the file extension
-				if(( $extPos = strrpos( $row["file_name"], "." )) !== false ) {					
-					$fileExt = substr( $row["file_name"], $extPos+1, strlen( $row["file_name"] ));
-				}
-				else {
-					$fileExt = "";
-				}
-								
-				$fileName = $galleryFolder.$row["owner_id"]."/".$row["owner_id"]."-".$row["id"].".".$fileExt;
-				$destFileName = $galleryFolder.$row["owner_id"]."/".$row["owner_id"]."-".$row["id"].".".strtolower($fileExt);
-				
-				if( $fileName != $destFileName ) {
-					if( File::exists( $fileName )) {
-		                if( !File::exists( $destFileName)) {
-		                    if( !File::rename( $fileName, $destFileName )) {
-		                        $this->message .= "Error updating resource file with id ".$row["id"].", while attempting to rename file from $fileName to $destFileName<br/>";
-		                    }
-						}
-					}
-				}	
-
-                $this->updatedRecords++;
-            }
-            $res1->Close();
-            $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
-            return true;        
-        }        
-    }
-
-    /**
-     * processes all resource files that we did not convert correctly in 1.2.0
-     */
-    class ResourcesFix120FileNameDataTransformer extends DatabaseDataTransformer
-    {
-        function getNumSteps()
-        {
-            return( parent::getNumSteps( "gallery_resources" ));
-        }
-    
-        function perform()
-        {
-            $this->message = "Fixing resource files with original file naming rule (step %s of %s)<br/>";        
-        
-            $query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
-
-			$config =& Config::getConfig();
-			$galleryFolder = $config->getValue( "resources_folder" );
-
-            // total number of comments
-            $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
-            if( !$res1 ) {
-                $this->message .= "Error performing loading resource data";
-                return false;
-            }
-            if( $res1->RecordCount() == 0 ) {
-				$this->message .= "No more records to process";
-				return( true );            
-            }
-            $numComments = Array();
-            while( $row = $res1->FetchRow()) {
-				//
-				// process each one of the rows and rename the main file
-				//
-				
-				// get the file extension
-				if(( $extPos = strrpos( $row["file_name"], "." )) !== false ) {					
-					$fileExt = substr( $row["file_name"], $extPos+1, strlen( $row["file_name"] ));
-				}
-				else {
-					$fileExt = "";
-				}
-
-				// Only convert the preview file name if the file extension does not lower case
-				if( strtolower( $fileExt ) != $fileExt ) {
-					// if it's an image, we also need to process the previews
-					if( $row["resource_type"] == "1" ) {
-						// calculate the extension of the preview file, depending on how it was saved
-						if( $row["thumbnail_format"] == "same" ) {
-							$previewExt = strtolower( $fileExt );
-							$destFileName = $row["file_name"];
-						}
-						else {
-							$previewExt = $row["thumbnail_format"];
-							// remove the old extension and put the new one in place
-							//print("file name = ".$row["file_name"]." - file ext = $fileExt - previewExt = $previewExt" );
-							$destFileName = str_replace( $fileExt, $previewExt, $row["file_name"] );
-						}
-							
-						// file names for the preview and medium preview
-						$previewFileName = $galleryFolder.$row["owner_id"]."/previews/".$row["owner_id"]."-".$row["id"].".".$previewExt;
-						$medPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$row["owner_id"]."-".$row["id"].".".$previewExt;					
-						// destination file names for the preview and medium preview
-						$destPreviewFileName = $galleryFolder.$row["owner_id"]."/previews/".$destFileName;
-						$destMedPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$destFileName;
-						
-						//print(" -- renaming preview: $previewFileName -- $destPreviewFileName<br/>");
-						//print(" -- renaming medium preview: $medPreviewFileName -- $destMedPreviewFileName<br/>");					
-						
-						if( File::exists( $previewFileName )) {
-	                    	if( !File::exists( $destPreviewFileName)) {
-	                        	File::rename( $previewFileName, $destPreviewFileName );
-	                    	}
-						}
-						if( File::exists( $medPreviewFileName )) {
-		                    if( !File::exists( $destMedPreviewFileName)) {
-		                        File::rename( $medPreviewFileName, $destMedPreviewFileName );
-		                    }
-						}
-					}
-				}
-
-                $this->updatedRecords++;
-            }
-            $res1->Close();
-            $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
-            return true;        
-        }        
-    }    
-
-	// Dummy Transformer
-	class DummyDataTransformer extends DatabaseDataTransformer
-	{
-		function getNumSteps()
-		{
-			return( 0 );
-		}
-		
-		function perform()
-		{
-			return true;
-		}
-	}
-    
-    /**
-     * This class is basically now a "data transformer runner", because now it works
-     * like class that executes data transformers, collects their results and refreshes
-     * the page to execute the next step of the transformer. If the current transformer
-     * reported that its processing is complete, this class will continue with the next
-     * transformer unless there are no more transformer to run.
-     *
-     * In order to coordinate the current step and the current transformer, two parameters
-     * are needed in each request:
-     *
-     * - page
-     * - transformerId
-     *
-     * The 'page' parameter holds the current page, while 'transformerId' is the index of 
-     * the current transformer in the $this->transformers array.
-     *
-     * In order to add new transformers, follow these steps:
-     *
-     * - Create your own transfomer class by extending DatabaseDataTransformer and implementing
-     * the methods DatabaseDataTransformer::perform() and DatabaseDataTransformer::getNumSteps(). The
-     * first does the data processing while the second one returns the number of needed steps to the
-     * class running the transformer.
-     * - Add the name of the transformer class to the the UpdateStepThree::transformers array,
-     * and the class will take care of everything else. 
-     */
-    class UpdateStepThree extends WizardPagedAction
-    {
-        var $resourcesNamingRule;
-        var $message;  
-        var $currentTransformerId;
-        var $totalTransformers;
-    
-        function UpdateStepThree( $actionInfo, $httpRequest )
-        {
-            $this->WizardPagedAction( $actionInfo, $httpRequest );
-            // data validation
-            $this->registerFieldValidator( "resourcesNamingRule", new StringValidator());
-			$errorView = new WizardView( "update2" );
-            $errorView->setErrorMessage( "Some data was incorrect or missing." );
-            $this->setValidationErrorView( $errorView );
-            
-            /**
-             * array with the data transformers that will be run
-             */
-			$this->resourcesNamingRule = $this->_request->getValue( "resourcesNamingRule" );
-			if( $this->resourcesNamingRule == 'encoded_file_name' ) {
-	            $this->transformers = Array(
-					"DatabaseSchemaDataTransformer",
-					"PermissionLoader",
-					"AdminUserPermissionsDataTransformer",
-					"UserPermissionsDataTransformer",
-					"ConfigDataTransformer",
-					"ResourcesEncodedFileNameDataTransformer",
-					"DummyDataTransformer"
-	            );
-	        }
-	        else {
-	            $this->transformers = Array(
-					"DatabaseSchemaDataTransformer",
-					"PermissionLoader",
-					"AdminUserPermissionsDataTransformer",
-					"UserPermissionsDataTransformer",
-					"ConfigDataTransformer",
-					"ResourcesOriginalFileNameDataTransformer",
-					"DummyDataTransformer"
-	            );
-	    	}
-
-            $this->currentTransformerId = $this->getTransformerIdFromRequest();
-            $this->totalTransformers = count( $this->transformers ) - 1;
-        }
-        
-        /**
-         * gets the id of the transformer from the request. If it is not available, it
-         * will return the id of the first transformer available (which is '0')
-         *
-         * @private
-         */
-        function getTransformerIdFromRequest()
-        {    	
-			$id = HttpVars::getRequestValue( "transformerId" );
-			$val = new IntegerValidator();
-			if( !$val->validate( $id ))
-				$id = 0;
-							
-			return $id;        
-        }        
-
-       function perform()
-       {
-            $step = $this->getPageFromRequest();
-            
-            // get the current transformer class so that we can continue where we left
-            $transformerClass = $this->transformers[$this->currentTransformerId];
-            $transformer = new $transformerClass( $step );
-            $result = $transformer->perform();
-            $complete = $transformer->isComplete();
-            $message = $transformer->message;
-            $message = sprintf( $message, $this->currentTransformerId + 1, $this->totalTransformers );
-            
-            //print("transformer = $transformerClass<br/>");
-             
-            // error during processing and the processor is configured
-            // to fail on error   
-            if( !$result && $transformer->failOnError ) {
-                //print("Error in step = $step<br/>");
-                $this->_view = new WizardView( "update3" );
-                $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
-                // current and next step
-                $this->_view->setValue( "currentStep", $step );
-                $this->_view->setValue( "nextStep", $step+1 );                
-                // whether this transformer is ready
-                $this->_view->setValue( "complete", $complete );
-                // transformer id
-                $this->_view->setValue( "transformerId", $this->currentTransformerId );            
-                $this->_view->setValue( "error", true );
-                if( $transformer->DbError() != "" ) {
-                    $message .= "<br/>The database error message was: ".$transformer->DbError()."<br/>";
-                }
-
-                $this->_view->setErrorMessage( $message );
-            }                
-            else {
-                if( !$complete ) {
-                    //print("it's not complete! step = $step<br/>");
-                    $this->_view = new WizardView( "update3" );
-                    $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
-                    // current and next step
-                    $this->_view->setValue( "currentStep", $step );
-                    $this->_view->setValue( "nextStep", $step+1 );                
-                    // whether this transformer is ready
-                    $this->_view->setValue( "complete", $complete );
-                    // transformer id
-                    $this->_view->setValue( "transformerId", $this->currentTransformerId );
-                }            
-                else {
-                    // have we already been through all transformers?
-                    //print("transformer complete! - num transformers = ".count($this->transformers)."<br/>");
-                    $moreTransformers = ( $this->currentTransformerId+1 < count( $this->transformers ));
-                    if( $moreTransformers ) {
-                        //print("Starting new transformer!<br/>");
-                        $this->_view = new WizardView( "update3" );
-                        $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
-                        // current and next step
-                        $this->_view->setValue( "currentStep", 0 );
-                        $this->_view->setValue( "nextStep", 1 );  
-                        // whether this transformer is ready
-                        $this->_view->setValue( "complete", false );
-                        // transformer id
-                        $this->_view->setValue( "transformerId", $this->currentTransformerId+1 );
-                    }
-                    else {
-                        // no more data to transform, we can finalize the installation!
-						// delete the contents of the temporary folder
-						
-						$config =& Config::getConfig();
-						$tmpFolder = $config->getValue( "temp_folder", TEMP_FOLDER );
-                        WizardTools::cleanTmpFolder();
-                        
-                        // save the resources naming rule to config table
-						$config->saveValue( "resources_naming_rule", $this->resourcesNamingRule );
-
-                        $this->_view = new WizardView( "update4" );
-                    }
-                }
-            }
-
-            $this->_view->setValue( "message", $message );            
-
-            return true;
-        }
-    }
-
-	// Fix those resources that we did not convert correctly in 1.2.0
-    class Fix120StepOne extends WizardPagedAction
-    {
-        var $message;  
-        var $currentTransformerId;
-        var $totalTransformers;
-    
-        function Fix120StepOne( $actionInfo, $httpRequest )
-        {
-            $this->WizardPagedAction( $actionInfo, $httpRequest );
-            
-            /**
-             * array with the data transformers that will be run
-             */
-            $this->transformers = Array(
-				"ResourcesFix120FileNameDataTransformer",
-				"DummyDataTransformer"
-            );
-
-            $this->currentTransformerId = $this->getTransformerIdFromRequest();
-            $this->totalTransformers = count( $this->transformers ) - 1;
-        }
-        
-        /**
-         * gets the id of the transformer from the request. If it is not available, it
-         * will return the id of the first transformer available (which is '0')
-         *
-         * @private
-         */
-        function getTransformerIdFromRequest()
-        {    	
-			$id = HttpVars::getRequestValue( "transformerId" );
-			$val = new IntegerValidator();
-			if( !$val->validate( $id ))
-				$id = 0;
-							
-			return $id;        
-        }        
-
-       function perform()
-       {
-            $step = $this->getPageFromRequest();
-            
-            // get the current transformer class so that we can continue where we left
-            $transformerClass = $this->transformers[$this->currentTransformerId];
-            $transformer = new $transformerClass( $step );
-            $result = $transformer->perform();
-            $complete = $transformer->isComplete();
-            $message = $transformer->message;
-            $message = sprintf( $message, $this->currentTransformerId + 1, $this->totalTransformers );
-            
-            //print("transformer = $transformerClass<br/>");
-             
-            // error during processing and the processor is configured
-            // to fail on error   
-            if( !$result && $transformer->failOnError ) {
-                //print("Error in step = $step<br/>");
-                $this->_view = new WizardView( "update3" );
-                // current and next step
-                $this->_view->setValue( "currentStep", $step );
-                $this->_view->setValue( "nextStep", $step+1 );                
-                // whether this transformer is ready
-                $this->_view->setValue( "complete", $complete );
-                // transformer id
-                $this->_view->setValue( "transformerId", $this->currentTransformerId );            
-                $this->_view->setValue( "error", true );
-                if( $transformer->DbError() != "" ) {
-                    $message .= "<br/>The database error message was: ".$transformer->DbError()."<br/>";
-                }
-
-                $this->_view->setErrorMessage( $message );
-            }                
-            else {
-                if( !$complete ) {
-                    //print("it's not complete! step = $step<br/>");
-                    $this->_view = new WizardView( "fix120" );
-                    // current and next step
-                    $this->_view->setValue( "currentStep", $step );
-                    $this->_view->setValue( "nextStep", $step+1 );                
-                    // whether this transformer is ready
-                    $this->_view->setValue( "complete", $complete );
-                    // transformer id
-                    $this->_view->setValue( "transformerId", $this->currentTransformerId );
-                }            
-                else {
-                    // have we already been through all transformers?
-                    //print("transformer complete! - num transformers = ".count($this->transformers)."<br/>");
-                    $moreTransformers = ( $this->currentTransformerId+1 < count( $this->transformers ));
-                    if( $moreTransformers ) {
-                        //print("Starting new transformer!<br/>");
-                        $this->_view = new WizardView( "fix120" );
-                        // current and next step
-                        $this->_view->setValue( "currentStep", 0 );
-                        $this->_view->setValue( "nextStep", 1 );  
-                        // whether this transformer is ready
-                        $this->_view->setValue( "complete", false );
-                        // transformer id
-                        $this->_view->setValue( "transformerId", $this->currentTransformerId+1 );
-                    }
-                    else {
-                        // no more data to transform, we can finalize the installation!
-						// delete the contents of the temporary folder
-						
-						$config =& Config::getConfig();
-						$tmpFolder = $config->getValue( "temp_folder", TEMP_FOLDER );
-                        WizardTools::cleanTmpFolder();
-
-                        // User upgrade LifeType from 1.1.x to 1.2.0, they have to use "original_file_name",
-                        // becasue there is no option for user to choose he want to use encoded file name
-                        // or original file name.
-                        // save the resources naming rule to config table
-						$config->saveValue( "resources_naming_rule", "original_file_name" );
-
-                        $this->_view = new WizardView( "update4" );
-                    }
-                }
-            }
-
-            $this->_view->setValue( "message", $message );            
-
-            return true;
-        }
-    }
-
-    // check if the "./tmp" folder is writable by us, otherwise
-    // throw an error before the user gets countless errors
-    // from Smarty
-    if( !File::isWritable( TEMP_FOLDER ) || !File::isDir( TEMP_FOLDER )) {
-        print("<span style=\"color:red; font-size: 14px;\">Error</span><br/><br/>This wizard needs the ".TEMP_FOLDER." folder to be writable by the web server user.<br/><br/>Please correct it and try again.");
-        die();
-    }
-
-    //// main part ////
-    $controller = new Controller( $_actionMap, "nextStep" );
-    $controller->process( HttpVars::getRequest());
-?>



More information about the pLog-svn mailing list