OSDN Git Service

if is IE use openWYSIWYG, is is NOT ie use WYMeditor.
authorelixirel <elixirel@sourceforge.jp>
Mon, 28 Dec 2009 11:50:20 +0000 (20:50 +0900)
committerelixirel <elixirel@sourceforge.jp>
Mon, 28 Dec 2009 11:50:20 +0000 (20:50 +0900)
124 files changed:
erbtemp/editentry.html.erb
erbtemp/newentry.html.erb
openwysiwyg/addons/imagelibrary/changelog [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/config.inc.php [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/images/dirup.png [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/images/folder.png [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/images/gif.gif [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/images/jpg.gif [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/images/psd.gif [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/images/unknown.png [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/insert_image.php [new file with mode: 0644]
openwysiwyg/addons/imagelibrary/select_image.php [new file with mode: 0644]
openwysiwyg/changelog [new file with mode: 0644]
openwysiwyg/docs/addons.html [new file with mode: 0644]
openwysiwyg/docs/doc.html [new file with mode: 0644]
openwysiwyg/docs/images/logo.gif [new file with mode: 0644]
openwysiwyg/docs/style.css [new file with mode: 0644]
openwysiwyg/example.html [new file with mode: 0644]
openwysiwyg/images/backcolor.gif [new file with mode: 0644]
openwysiwyg/images/backcolor_on.gif [new file with mode: 0644]
openwysiwyg/images/background_silver.jpg [new file with mode: 0644]
openwysiwyg/images/bold.gif [new file with mode: 0644]
openwysiwyg/images/bold_on.gif [new file with mode: 0644]
openwysiwyg/images/copy.gif [new file with mode: 0644]
openwysiwyg/images/copy_on.gif [new file with mode: 0644]
openwysiwyg/images/cut.gif [new file with mode: 0644]
openwysiwyg/images/cut_on.gif [new file with mode: 0644]
openwysiwyg/images/delete.gif [new file with mode: 0644]
openwysiwyg/images/delete_on.gif [new file with mode: 0644]
openwysiwyg/images/forecolor.gif [new file with mode: 0644]
openwysiwyg/images/forecolor_on.gif [new file with mode: 0644]
openwysiwyg/images/help.gif [new file with mode: 0644]
openwysiwyg/images/help_on.gif [new file with mode: 0644]
openwysiwyg/images/indent_left.gif [new file with mode: 0644]
openwysiwyg/images/indent_left_on.gif [new file with mode: 0644]
openwysiwyg/images/indent_right.gif [new file with mode: 0644]
openwysiwyg/images/indent_right_on.gif [new file with mode: 0644]
openwysiwyg/images/insert_hyperlink.gif [new file with mode: 0644]
openwysiwyg/images/insert_hyperlink_on.gif [new file with mode: 0644]
openwysiwyg/images/insert_picture.gif [new file with mode: 0644]
openwysiwyg/images/insert_picture_on.gif [new file with mode: 0644]
openwysiwyg/images/insert_table.gif [new file with mode: 0644]
openwysiwyg/images/insert_table_on.gif [new file with mode: 0644]
openwysiwyg/images/italics.gif [new file with mode: 0644]
openwysiwyg/images/italics_on.gif [new file with mode: 0644]
openwysiwyg/images/justify_center.gif [new file with mode: 0644]
openwysiwyg/images/justify_center_on.gif [new file with mode: 0644]
openwysiwyg/images/justify_justify.gif [new file with mode: 0644]
openwysiwyg/images/justify_justify_on.gif [new file with mode: 0644]
openwysiwyg/images/justify_left.gif [new file with mode: 0644]
openwysiwyg/images/justify_left_on.gif [new file with mode: 0644]
openwysiwyg/images/justify_right.gif [new file with mode: 0644]
openwysiwyg/images/justify_right_on.gif [new file with mode: 0644]
openwysiwyg/images/list_ordered.gif [new file with mode: 0644]
openwysiwyg/images/list_ordered_on.gif [new file with mode: 0644]
openwysiwyg/images/list_unordered.gif [new file with mode: 0644]
openwysiwyg/images/list_unordered_on.gif [new file with mode: 0644]
openwysiwyg/images/logo.gif [new file with mode: 0644]
openwysiwyg/images/maximize.gif [new file with mode: 0644]
openwysiwyg/images/maximize_on.gif [new file with mode: 0644]
openwysiwyg/images/paste.gif [new file with mode: 0644]
openwysiwyg/images/paste_on.gif [new file with mode: 0644]
openwysiwyg/images/preview.gif [new file with mode: 0644]
openwysiwyg/images/preview_on.gif [new file with mode: 0644]
openwysiwyg/images/print.gif [new file with mode: 0644]
openwysiwyg/images/print_on.gif [new file with mode: 0644]
openwysiwyg/images/redo.gif [new file with mode: 0644]
openwysiwyg/images/redo_on.gif [new file with mode: 0644]
openwysiwyg/images/remove_format.gif [new file with mode: 0644]
openwysiwyg/images/remove_format_on.gif [new file with mode: 0644]
openwysiwyg/images/return.gif [new file with mode: 0644]
openwysiwyg/images/return_on.gif [new file with mode: 0644]
openwysiwyg/images/save.gif [new file with mode: 0644]
openwysiwyg/images/save_on.gif [new file with mode: 0644]
openwysiwyg/images/select_font.gif [new file with mode: 0644]
openwysiwyg/images/select_font_on.gif [new file with mode: 0644]
openwysiwyg/images/select_heading.gif [new file with mode: 0644]
openwysiwyg/images/select_heading_on.gif [new file with mode: 0644]
openwysiwyg/images/select_size.gif [new file with mode: 0644]
openwysiwyg/images/select_size_on.gif [new file with mode: 0644]
openwysiwyg/images/seperator.gif [new file with mode: 0644]
openwysiwyg/images/seperator2.gif [new file with mode: 0644]
openwysiwyg/images/settings.gif [new file with mode: 0644]
openwysiwyg/images/strikethrough.gif [new file with mode: 0644]
openwysiwyg/images/strikethrough_on.gif [new file with mode: 0644]
openwysiwyg/images/subscript.gif [new file with mode: 0644]
openwysiwyg/images/subscript_on.gif [new file with mode: 0644]
openwysiwyg/images/superscript.gif [new file with mode: 0644]
openwysiwyg/images/superscript_on.gif [new file with mode: 0644]
openwysiwyg/images/underline.gif [new file with mode: 0644]
openwysiwyg/images/underline_on.gif [new file with mode: 0644]
openwysiwyg/images/undo.gif [new file with mode: 0644]
openwysiwyg/images/undo_on.gif [new file with mode: 0644]
openwysiwyg/images/view_source.gif [new file with mode: 0644]
openwysiwyg/images/view_source_on.gif [new file with mode: 0644]
openwysiwyg/images/view_text.gif [new file with mode: 0644]
openwysiwyg/images/view_text_on.gif [new file with mode: 0644]
openwysiwyg/popups/about.html [new file with mode: 0644]
openwysiwyg/popups/about_license.html [new file with mode: 0644]
openwysiwyg/popups/create_table.html [new file with mode: 0644]
openwysiwyg/popups/insert_hyperlink.html [new file with mode: 0644]
openwysiwyg/popups/insert_image.html [new file with mode: 0644]
openwysiwyg/popups/license.html [new file with mode: 0644]
openwysiwyg/popups/preview.html [new file with mode: 0644]
openwysiwyg/popups/select_color.html [new file with mode: 0644]
openwysiwyg/scripts/wysiwyg-color.js [new file with mode: 0644]
openwysiwyg/scripts/wysiwyg-popup.js [new file with mode: 0644]
openwysiwyg/scripts/wysiwyg-settings.js [new file with mode: 0644]
openwysiwyg/scripts/wysiwyg.js [new file with mode: 0644]
openwysiwyg/styles/wysiwyg.css [new file with mode: 0644]
openwysiwyg/uploads/hagbard.jpg [new file with mode: 0644]
wymeditor/iframe/default/lbl-blockquote.png [new file with mode: 0644]
wymeditor/iframe/default/lbl-h1.png [new file with mode: 0644]
wymeditor/iframe/default/lbl-h2.png [new file with mode: 0644]
wymeditor/iframe/default/lbl-h3.png [new file with mode: 0644]
wymeditor/iframe/default/lbl-h4.png [new file with mode: 0644]
wymeditor/iframe/default/lbl-h5.png [new file with mode: 0644]
wymeditor/iframe/default/lbl-h6.png [new file with mode: 0644]
wymeditor/iframe/default/lbl-p.png [new file with mode: 0644]
wymeditor/iframe/default/lbl-pre.png [new file with mode: 0644]
wymeditor/iframe/default/wymiframe.css [new file with mode: 0644]
wymeditor/iframe/default/wymiframe.html [new file with mode: 0644]
wymeditor/jquery.wymeditor.back.js [new file with mode: 0644]
wymeditor/jquery.wymeditor.js

index 85278f0..e3a3d71 100644 (file)
@@ -3,13 +3,20 @@
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
         <title><%= APPTITLE %></title>
         <link rel="stylesheet" href="./erbtemp/stylesheet.css" type="text/css">
-        <script type="text/javascript" src="./jquery/jquery.js">
-        </script>
-        <script type="text/javascript" src="./wymeditor/jquery.wymeditor.min.js">
-        </script>
-        <script type="text/javascript">
-            if (window.ActiveXObject) {
-            } else {
+        <% if params["action"] == "edit" || params["action"] == "back" %>
+        <!--[if IE]>
+            <script type="text/javascript" src="./openwysiwyg/scripts/wysiwyg.js">
+            </script>
+            <script type="text/javascript">
+            WYSIWYG.attach('contenteditor');
+            </script>
+        <![endif]--><% end %>
+        <![if !IE]>
+            <script type="text/javascript" src="./jquery/jquery.js">
+            </script>
+            <script type="text/javascript" src="./wymeditor/jquery.wymeditor.js">
+            </script>
+            <script type="text/javascript">
                 jQuery(function(){
                     jQuery('#contenteditor').wymeditor({
                         updateSelector: ".wymupdate",
@@ -17,8 +24,9 @@
                         iframeBasePath: "main_"
                     });
                 });
-            }
-            
+            </script>
+        <![endif]>
+        <script type="text/javascript">
             function switchsubmit(form, action){
                 document.getElementsByName("action").item(0).value = action;
                 form.submit();
index 1a95101..30bc160 100644 (file)
@@ -3,13 +3,20 @@
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
         <title><%= APPTITLE %></title>
         <link rel="stylesheet" href="./erbtemp/stylesheet.css" type="text/css">
-        <script type="text/javascript" src="./jquery/jquery.js">
-        </script>
-        <script type="text/javascript" src="./wymeditor/jquery.wymeditor.js">
-        </script>
-        <script type="text/javascript">
-            if (window.ActiveXObject) {
-            } else {
+        <% if params["action"].blank? || params["action"] == "back" %>
+        <!--[if IE]>
+            <script type="text/javascript" src="./openwysiwyg/scripts/wysiwyg.js">
+            </script>
+            <script type="text/javascript">
+            WYSIWYG.attach('contenteditor');
+            </script>
+        <![endif]--><% end %>
+        <![if !IE]>
+            <script type="text/javascript" src="./jquery/jquery.js">
+            </script>
+            <script type="text/javascript" src="./wymeditor/jquery.wymeditor.js">
+            </script>
+            <script type="text/javascript">
                 jQuery(function(){
                     jQuery('#contenteditor').wymeditor({
                         updateSelector: ".wymupdate",
@@ -17,8 +24,9 @@
                         iframeBasePath: "main_"
                     });
                 });
-            }
-            
+            </script>
+        <![endif]>
+        <script type="text/javascript">
             function switchsubmit(form, action){
                 document.getElementsByName("action").item(0).value = action;
                 form.submit();
diff --git a/openwysiwyg/addons/imagelibrary/changelog b/openwysiwyg/addons/imagelibrary/changelog
new file mode 100644 (file)
index 0000000..59f8fd3
--- /dev/null
@@ -0,0 +1,10 @@
+v0.2.2
+       * changed - Using full php tags instead of <? only
+       * fixed - Solved problem while generate source of an image if it is within a subdirectory 
+       * changed - Hide upload button if $allowuploads is false 
+
+v0.2.1
+       * fixed - Problem with relative URL to images using openImageLibrary
+
+v0.1
+       * inital release
\ No newline at end of file
diff --git a/openwysiwyg/addons/imagelibrary/config.inc.php b/openwysiwyg/addons/imagelibrary/config.inc.php
new file mode 100644 (file)
index 0000000..1e95735
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+/********************************************************************
+ * openImageLibrary addon v0.2.2 Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ * 
+ * $Id: config.inc.php,v 1.7 2006/12/17 21:34:28 xhaggi Exp $
+ * 
+ * An open source image library addon for the openWYSIWYG.
+ * This library gives you the possibility to upload, browse and select 
+ * images on your webserver.
+ * 
+ * Requirements: 
+ * - PHP 4.1.x or later
+ * - openWYSIWYG v1.4.6 or later
+ ********************************************************************/
+/*
+ * Path to a directory which holds the images.
+ */
+$imagebasedir = '../../uploads';
+
+/*
+ * An absolute or relative URL to the image folder.
+ * This url is used to generate the source of the image.
+ */
+$imagebaseurl = 'uploads';
+
+/*
+ * Allow your users to browse the subdir of the defined basedir.
+ */
+$browsedirs = true;
+
+/*
+ * If enabled users will be able to upload 
+ * files to any viewable directory. You should really only enable
+ * this if the area this script is in is already password protected.
+ */
+$allowuploads = true;
+
+/*
+ * If a user uploads a file with the same
+ * name as an existing file do you want the existing file
+ * to be overwritten?
+*/
+$overwrite = false;
+
+/*
+ * Define the extentions you want to show within the 
+ * directory listing. The extensions also limit the 
+ * files the user can upload to your image folders.   
+ */
+$supportedextentions = array(
+       'gif', 
+       'png', 
+       'jpeg', 
+       'jpg',
+       'bmp'
+);
+                       
+/*
+ * If you want to add your own special file icons use 
+ * this section below. Each entry relates to the extension of the 
+ * given file, in the form <extension> => <filename>. 
+ * These files must be located within the dlf directory.
+ */
+$filetypes = array (
+       'png' => 'jpg.gif',
+       'jpeg' => 'jpg.gif',
+       'bmp' => 'jpg.gif',
+       'jpg' => 'jpg.gif', 
+       'gif' => 'gif.gif',
+       'psd' => 'psd.gif',
+);
+       
+?>
diff --git a/openwysiwyg/addons/imagelibrary/images/dirup.png b/openwysiwyg/addons/imagelibrary/images/dirup.png
new file mode 100644 (file)
index 0000000..c118622
Binary files /dev/null and b/openwysiwyg/addons/imagelibrary/images/dirup.png differ
diff --git a/openwysiwyg/addons/imagelibrary/images/folder.png b/openwysiwyg/addons/imagelibrary/images/folder.png
new file mode 100644 (file)
index 0000000..a61dd23
Binary files /dev/null and b/openwysiwyg/addons/imagelibrary/images/folder.png differ
diff --git a/openwysiwyg/addons/imagelibrary/images/gif.gif b/openwysiwyg/addons/imagelibrary/images/gif.gif
new file mode 100644 (file)
index 0000000..1a51148
Binary files /dev/null and b/openwysiwyg/addons/imagelibrary/images/gif.gif differ
diff --git a/openwysiwyg/addons/imagelibrary/images/jpg.gif b/openwysiwyg/addons/imagelibrary/images/jpg.gif
new file mode 100644 (file)
index 0000000..38a1880
Binary files /dev/null and b/openwysiwyg/addons/imagelibrary/images/jpg.gif differ
diff --git a/openwysiwyg/addons/imagelibrary/images/psd.gif b/openwysiwyg/addons/imagelibrary/images/psd.gif
new file mode 100644 (file)
index 0000000..eef1318
Binary files /dev/null and b/openwysiwyg/addons/imagelibrary/images/psd.gif differ
diff --git a/openwysiwyg/addons/imagelibrary/images/unknown.png b/openwysiwyg/addons/imagelibrary/images/unknown.png
new file mode 100644 (file)
index 0000000..67f2fa1
Binary files /dev/null and b/openwysiwyg/addons/imagelibrary/images/unknown.png differ
diff --git a/openwysiwyg/addons/imagelibrary/insert_image.php b/openwysiwyg/addons/imagelibrary/insert_image.php
new file mode 100644 (file)
index 0000000..8811fd3
--- /dev/null
@@ -0,0 +1,301 @@
+<?php
+/********************************************************************
+ * openImageLibrary addon Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ ********************************************************************/
+
+require('config.inc.php');
+error_reporting(0);
+// get the identifier of the editor
+$wysiwyg = $_GET['wysiwyg']; 
+// set image dir
+$leadon = $rootdir.$imagebasedir;
+
+if($leadon=='.') $leadon = '';
+if((substr($leadon, -1, 1)!='/') && $leadon!='') $leadon = $leadon . '/';
+$startdir = $leadon;
+
+// validate the directory
+$_GET['dir'] = $_POST['dir'] ? $_POST['dir'] : $_GET['dir'];
+if($_GET['dir']) {
+       if(substr($_GET['dir'], -1, 1)!='/') {
+               $_GET['dir'] = $_GET['dir'] . '/';
+       }
+       $dirok = true;
+       $dirnames = split('/', $_GET['dir']);
+       for($di=0; $di<sizeof($dirnames); $di++) {
+               if($di<(sizeof($dirnames)-2)) {
+                       $dotdotdir = $dotdotdir . $dirnames[$di] . '/';
+               }
+       }
+       if(substr($_GET['dir'], 0, 1)=='/') {
+               $dirok = false;
+       }
+
+       if($_GET['dir'] == $leadon) {
+               $dirok = false;
+       }
+       
+       if($dirok) {
+               $leadon = $_GET['dir'];
+       }
+}
+
+// upload file
+if($allowuploads && $_FILES['file']) {
+       $upload = true;
+       if(!$overwrite) {
+               if(file_exists($leadon.$_FILES['file']['name'])) {
+                       $upload = false;
+               }
+       }
+       $ext = strtolower(substr($_FILES['file']['name'], strrpos($_FILES['file']['name'], '.')+1));
+       if(!in_array($ext, $supportedextentions)) {
+               $upload = false;
+       }
+       if($upload) {
+               move_uploaded_file($_FILES['file']['tmp_name'], $leadon . $_FILES['file']['name']);
+       }
+}
+
+if($allowuploads) {
+       $phpallowuploads = (bool) ini_get('file_uploads');              
+       $phpmaxsize = ini_get('upload_max_filesize');
+       $phpmaxsize = trim($phpmaxsize);
+       $last = strtolower($phpmaxsize{strlen($phpmaxsize)-1});
+       switch($last) {
+               case 'g':
+                       $phpmaxsize *= 1024;
+               case 'm':
+                       $phpmaxsize *= 1024;
+       }
+}
+
+?>
+
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+<title>openWYSIWYG | Insert Image</title>
+
+<script type="text/javascript" src="../../scripts/wysiwyg-popup.js"></script>
+<script language="JavaScript" type="text/javascript">
+
+/* ---------------------------------------------------------------------- *\
+  Function    : insertImage()
+  Description : Inserts image into the WYSIWYG.
+\* ---------------------------------------------------------------------- */
+function insertImage() {
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+       
+       // get values from form fields
+       var src = document.getElementById('src').value;
+       var alt = document.getElementById('alt').value;
+       var width = document.getElementById('width').value
+       var height = document.getElementById('height').value
+       var border = document.getElementById('border').value
+       var align = document.getElementById('align').value
+       var vspace = document.getElementById('vspace').value
+       var hspace = document.getElementById('hspace').value
+       
+       // insert image
+       WYSIWYG.insertImage(src, width, height, align, border, alt, hspace, vspace, n);
+       window.close();
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : loadImage()
+  Description : load the settings of a selected image into the form fields
+\* ---------------------------------------------------------------------- */
+function loadImage() {
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+       
+       // get selection and range
+       var sel = WYSIWYG.getSelection(n);
+       var range = WYSIWYG.getRange(sel);
+       
+       // the current tag of range
+       var img = WYSIWYG.findParent("img", range);
+       
+       // if no image is defined then return
+       if(img == null) return;
+               
+       // assign the values to the form elements
+       for(var i = 0;i < img.attributes.length;i++) {
+               var attr = img.attributes[i].name.toLowerCase();
+               var value = img.attributes[i].value;
+               //alert(attr + " = " + value);
+               if(attr && value && value != "null") {
+                       switch(attr) {
+                               case "src": 
+                                       // strip off urls on IE
+                                       if(WYSIWYG_Core.isMSIE) value = WYSIWYG.stripURLPath(n, value, false);
+                                       document.getElementById('src').value = value;
+                               break;
+                               case "alt":
+                                       document.getElementById('alt').value = value;
+                               break;
+                               case "align":
+                                       selectItemByValue(document.getElementById('align'), value);
+                               break;
+                               case "border":
+                                       document.getElementById('border').value = value;
+                               break;
+                               case "hspace":
+                                       document.getElementById('hspace').value = value;
+                               break;
+                               case "vspace":
+                                       document.getElementById('vspace').value = value;
+                               break;
+                               case "width":
+                                       document.getElementById('width').value = value;
+                               break;
+                               case "height":
+                                       document.getElementById('height').value = value;
+                               break;                          
+                       }
+               }
+       }
+       
+       // get width and height from style attribute in none IE browsers
+       if(!WYSIWYG_Core.isMSIE && document.getElementById('width').value == "" && document.getElementById('width').value == "") {
+               document.getElementById('width').value = img.style.width.replace(/px/, "");
+               document.getElementById('height').value = img.style.height.replace(/px/, "");
+       }
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : selectItem()
+  Description : Select an item of an select box element by value.
+\* ---------------------------------------------------------------------- */
+function selectItemByValue(element, value) {
+       if(element.options.length) {
+               for(var i=0;i<element.options.length;i++) {
+                       if(element.options[i].value == value) {
+                               element.options[i].selected = true;
+                       }
+               }
+       }
+}
+
+</script>
+</head>
+<body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" onLoad="loadImage();">
+<table border="0" cellpadding="0" cellspacing="0" style="padding: 10px;">
+<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?wysiwyg=<?php echo $wysiwyg; ?>" enctype="multipart/form-data">
+<input type="hidden" id="dir" name="dir" value="">
+<tr>
+<td style="vertical-align:top;">
+<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Insert Image:</span>
+<table width="380" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
+       <?php
+       if($allowuploads) {
+               if($phpallowuploads) {
+               
+       ?>
+               <tr>
+                       <td style="padding-top: 0px;padding-bottom: 0px; font-family: arial, verdana, helvetica; font-size: 11px;width:80px;">Upload:</td>
+                       <td style="padding-top: 0px;padding-bottom: 0px;width:300px;"><input type="file" name="file" size="30" style="font-size: 10px; width: 100%;" /></td>
+               </tr>
+               <tr>
+                       <td style="padding-top: 0px;padding-bottom: 2px;font-family: tahoma; font-size: 9px;">&nbsp;</td>
+                       <td style="padding-top: 0px;padding-bottom: 2px;font-family: tahoma; font-size: 9px;">(Max Filesize: <?php echo $phpmaxsize; ?>KB)</td>
+               </tr>
+       <?php
+               }
+               else {
+       ?>
+               <tr>
+                       <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" colspan="2">
+                               File uploads are disabled in your php.ini file. Please enable them.
+                       </td>
+               </tr>
+       <?php
+               }
+       }
+       ?>
+       <tr>
+               <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Image URL:</td>
+               <td style="padding-bottom: 2px; padding-top: 0px;" width="300"><input type="text" name="src" id="src" value=""  style="font-size: 10px; width: 100%;"></td>
+       </tr>
+       <tr>
+               <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Alternate Text:</td>
+               <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="alt" id="alt" value=""  style="font-size: 10px; width: 100%;"></td>
+       </tr>
+</table>
+       
+<table width="380" border="0" cellpadding="0" cellspacing="0"><tr><td style="vertical-align:top;">
+<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Layout:</span>
+<table width="180" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
+<tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Width:</td>
+  <td style="width:60px;padding-bottom: 2px; padding-top: 0px;"><input type="text" name="width" id="width" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Height:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="height" id="height" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Border:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="border" id="border" value="0"  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+</table>       
+
+</td>
+<td width="10">&nbsp;</td>
+<td style="vertical-align:top;">
+
+<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">&nbsp;</span>
+<table width="200" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
+<tr>
+  <td style="width: 115px;padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="100">Alignment:</td>
+       <td style="width: 85px;padding-bottom: 2px; padding-top: 0px;">
+       <select name="align" id="align" style="font-family: arial, verdana, helvetica; font-size: 11px; width: 100%;">
+        <option value="">Not Set</option>
+        <option value="left">Left</option>
+        <option value="right">Right</option>
+        <option value="texttop">Texttop</option>
+        <option value="absmiddle">Absmiddle</option>
+        <option value="baseline">Baseline</option>
+        <option value="absbottom">Absbottom</option>
+        <option value="bottom">Bottom</option>
+        <option value="middle">Middle</option>
+        <option value="top">Top</option>
+       </select>
+       </td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Horizontal Space:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="hspace" id="hspace" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Vertical Space:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="vspace" id="vspace" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+</table>       
+
+</td>
+</tr>
+</table>
+</td>
+<td style="vertical-align: top;width: 150px; padding-left: 5px;">
+       <span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Select Image:</span>
+       <iframe id="chooser" frameborder="0" style="height:165px;width: 180px;border: 2px solid #FFFFFF; padding: 5px;" src="select_image.php?dir=<?php echo $leadon; ?>"></iframe>
+</td>
+</tr>
+<tr>
+       <td colspan="2" align="right" style="padding-top: 5px;">
+               <input type="submit" value="  Submit  " onclick="insertImage();return false;" style="font-size: 12px;">
+               <?php if ( $allowuploads ) { ?> 
+                       <input type="submit" value="  Upload  " style="font-size: 12px;">
+               <?php } ?>              
+               <input type="button" value="  Cancel  " onclick="window.close();" style="font-size: 12px;">     
+       </td>
+</tr>
+</form>
+</table>
+</body>
+</html>
diff --git a/openwysiwyg/addons/imagelibrary/select_image.php b/openwysiwyg/addons/imagelibrary/select_image.php
new file mode 100644 (file)
index 0000000..2b4c024
--- /dev/null
@@ -0,0 +1,201 @@
+<?php
+/********************************************************************
+ * openImageLibrary addon Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ ********************************************************************/
+require('config.inc.php');
+error_reporting(0);
+if((substr($imagebaseurl, -1, 1)!='/') && $imagebaseurl!='') $imagebaseurl = $imagebaseurl . '/';
+if((substr($imagebasedir, -1, 1)!='/') && $imagebasedir!='') $imagebasedir = $imagebasedir . '/';
+$leadon = $imagebasedir;
+if($leadon=='.') $leadon = '';
+if((substr($leadon, -1, 1)!='/') && $leadon!='') $leadon = $leadon . '/';
+$startdir = $leadon;
+
+if($_GET['dir']) {
+       if(substr($_GET['dir'], -1, 1)!='/') {
+               $_GET['dir'] = $_GET['dir'] . '/';
+       }
+       $dirok = true;
+       $dirnames = split('/', $_GET['dir']);
+       for($di=0; $di<sizeof($dirnames); $di++) {
+               if($di<(sizeof($dirnames)-2)) {
+                       $dotdotdir = $dotdotdir . $dirnames[$di] . '/';
+               }
+       }
+       if(substr($_GET['dir'], 0, 1)=='/') {
+               $dirok = false;
+       }
+
+       if($_GET['dir'] == $leadon) {
+               $dirok = false;
+       }
+       
+       if($dirok) {
+               $leadon = $_GET['dir'];
+       }
+}
+
+$opendir = $leadon;
+if(!$leadon) $opendir = '.';
+if(!file_exists($opendir)) {
+       $opendir = '.';
+       $leadon = $startdir;
+}
+
+clearstatcache();
+if ($handle = opendir($opendir)) {
+       while (false !== ($file = readdir($handle))) { 
+               //first see if this file is required in the listing
+               if ($file == "." || $file == "..")  continue;
+               if (@filetype($leadon.$file) == "dir") {
+                       if(!$browsedirs) continue;
+               
+                       $n++;
+                       if($_GET['sort']=="date") {
+                               $key = @filemtime($leadon.$file) . ".$n";
+                       }
+                       else {
+                               $key = $n;
+                       }
+                       $dirs[$key] = $file . "/";
+               }
+               else {
+                       $n++;
+                       if($_GET['sort']=="date") {
+                               $key = @filemtime($leadon.$file) . ".$n";
+                       }
+                       elseif($_GET['sort']=="size") {
+                               $key = @filesize($leadon.$file) . ".$n";
+                       }
+                       else {
+                               $key = $n;
+                       }
+                       $files[$key] = $file;
+               }
+       }
+       closedir($handle); 
+}
+
+//sort our files
+if($_GET['sort']=="date") {
+       @ksort($dirs, SORT_NUMERIC);
+       @ksort($files, SORT_NUMERIC);
+}
+elseif($_GET['sort']=="size") {
+       @natcasesort($dirs); 
+       @ksort($files, SORT_NUMERIC);
+}
+else {
+       @natcasesort($dirs); 
+       @natcasesort($files);
+}
+
+//order correctly
+if($_GET['order']=="desc" && $_GET['sort']!="size") {$dirs = @array_reverse($dirs);}
+if($_GET['order']=="desc") {$files = @array_reverse($files);}
+$dirs = @array_values($dirs); $files = @array_values($files);
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+<title>openWYSIWYG | Select Image</title>
+<style type="text/css">
+body {
+       margin: 0px;
+}
+a {
+       font-family: Arial, verdana, helvetica; 
+       font-size: 11px; 
+       color: #000000;
+       text-decoration: none;
+}
+a:hover {
+       text-decoration: underline;
+}
+</style>
+<script type="text/javascript">
+       function selectImage(url) {
+               if(parent) {
+                       parent.document.getElementById("src").value = url;
+               }
+       }
+       
+       if(parent) {
+               parent.document.getElementById("dir").value = '<?php echo $leadon; ?>';
+       }
+       
+</script>
+</head>
+<body>
+       <table border="0">
+               <tbody>
+                <?php
+                       $breadcrumbs = split('/', str_replace($basedir."/", "", $leadon));
+                       if(($bsize = sizeof($breadcrumbs)) > 0) {
+                               if(($bsize-1) > 0) {    
+                                       echo "<tr><td>";
+                                       $sofar = '';
+                                       for($bi=0;$bi<($bsize-1);$bi++) {
+                                               $sofar = $sofar . $breadcrumbs[$bi] . '/';
+                                               echo '<a href="'.$_SERVER['PHP_SELF'].'?dir='.urlencode($sofar).'" style="font-size:10px;font-family:Tahoma;">&raquo; '.$breadcrumbs[$bi].'</a><br>';
+                                       }
+                                       echo "</td></tr>";
+                               }
+                       }
+                 ?>
+               <tr>
+                       <td>
+                                 <?php
+                                       $class = 'b';
+                                       if($dirok) {
+                                       ?>
+                                       <a href="<?php echo $_SERVER['PHP_SELF'].'?dir='.urlencode($dotdotdir); ?>"><img src="images/dirup.png" alt="Folder" border="0" /> <strong>..</strong></a><br>
+                                       <?php
+                                               if($class=='b') $class='w';
+                                               else $class = 'b';
+                                       }
+                                       $arsize = sizeof($dirs);
+                                       for($i=0;$i<$arsize;$i++) {
+                                               $dir = substr($dirs[$i], 0, strlen($dirs[$i]) - 1);
+                                       ?>
+                                       <a href="<?php echo $_SERVER['PHP_SELF'].'?dir='.urlencode($leadon.$dirs[$i]); ?>"><img src="images/folder.png" alt="<?php echo $dir; ?>" border="0" /> <strong><?php echo $dir; ?></strong></a><br>
+                                       <?php
+                                               if($class=='b') $class='w';
+                                               else $class = 'b';      
+                                       }
+                                       
+                                       $arsize = sizeof($files);
+                                       for($i=0;$i<$arsize;$i++) {
+                                               $icon = 'unknown.png';
+                                               $ext = strtolower(substr($files[$i], strrpos($files[$i], '.')+1));
+                                               if(in_array($ext, $supportedextentions)) {
+                                                       
+                                                       $thumb = '';
+                                                       if($filetypes[$ext]) {
+                                                               $icon = $filetypes[$ext];
+                                                       }
+                                                       
+                                                       $filename = $files[$i];
+                                                       if(strlen($filename)>43) {
+                                                               $filename = substr($files[$i], 0, 40) . '...';
+                                                       }
+                                                       $fileurl = $leadon . $files[$i];
+                                                       $filedir = str_replace($imagebasedir, "", $leadon);
+                                       ?>
+                                       <a href="javascript:void(0)" onclick="selectImage('<?php echo $imagebaseurl.$filedir.$filename; ?>');"><img src="images/<?php echo $icon; ?>" alt="<?php echo $files[$i]; ?>" border="0" /> <strong><?php echo $filename; ?></strong></a><br>
+                                       <?php
+                                                       if($class=='b') $class='w';
+                                                       else $class = 'b';      
+                                               }
+                                       }       
+                                       ?>
+                               </td>
+                       </tr>
+               </tbody>
+       </table>
+</body>
+</html>
\ No newline at end of file
diff --git a/openwysiwyg/changelog b/openwysiwyg/changelog
new file mode 100644 (file)
index 0000000..a52e39b
--- /dev/null
@@ -0,0 +1,152 @@
+v1.4.7
+       * added - Possibilty to maximize the editor window
+       * fixed - Correct relative image path on preview, now it works for all images
+       * added - Table highlighting possibility
+       * added - Possiblity to assign headings (crashed)
+       * changed - Code improvments to tons of functions
+       * changed - WYSIWYG.formatText() function renamed to WYSIWYG.execCommand()
+       * changed - WYSIWYG.findParentTag() renamed to WYSIWYG.findParent()
+       * added - WYSIWYG_Core.findParentNode(tagName, node) function which finds a parent node by tag name starts on the given node
+       * fixed - Implement function WYSIWYG_Core.getAttribute which solve the problem while getting the style attribute on IE
+       * changed - Getting style attribute while editing a link
+       * added - WYSIWYG_Table object, which is used for improving table editing
+       * changed - New icons print and preview (thx sweb)
+       * added - Save and return button on toolbar, the return button is disabled by default. (thx sweb)
+       * added - Table function improvments
+       * added - New WYSIWYG_Color object, which handels the color choosing
+       * added - Full justify text (code by tim)
+       
+v1.4.6c
+       * fixed - Solved issue with backcolor command on IE
+       * changed - Add parameter value to WYSIWYG_Core.execCommand() function
+       
+v1.4.6b
+       * changed - Debug code on context menu removed
+       * fixed - Add "px" to left and top style information on context menu
+       * changed - Correct comment of wyswiwyg-settings.js
+
+v1.4.6a
+       * fixed - bad class name on mouse over of toolbar buttons fixed
+       * changed - Rewritten function to get the current position of an element (iframe)
+       * fixed - Context menu position issue solved
+       * fixed - Wrong variable call fixed
+       * fixed - Problem while removing elements with the context menu solved
+       
+v1.4.6 (2006-12-17)
+       * changed - Modification changed to be the official version of openWYSIWYG
+       * fixed - Child nodes will be copied to the parent if a node is removed
+       * changed - Complete rewritten context menu
+       * changed - Behaviours of the context menu dependents on selection
+       * added - Copy/Cut/Paste to context menu
+       * changed - Code structure changes
+       * added - wysiwyg-popup.js which holds popup specific functions
+       * added - new object WYSIWYG_Core added, which holds all core functions
+       * added - addEvent() and removeEvent() core function added
+       * added - attach() and attachAll() functions which used to attach the editor to textareas
+       * changed - Complete rewritten insertLink function, now it works with tags like img, h1 etc
+       * added - Override width and height of the editor with size given by the style attributes width and height of the textarea
+       * added - New function includeCSS() in Core object, which includes a given stylesheet file on the head tag of the current page
+       * fixed - Solved problem if you want to attach the editor to all textareas
+       * changed - Include of stylesheet files changed, now using the includeCSS function
+       * changed - Complete rewritten display function, now you can use it like like function attach()
+
+v0.4.5 (2006-11-12)
+       * added - openImageLibrary addon (for now PHP only)
+    * fixed - correct relative anchor and image path on preview
+    * changed - various javascript code changes
+
+v0.4.4 (2006-11-11)
+    * added - capability of using image library addons
+    * fixed - corrupt font + font size selection html
+
+v0.4.3 (2006-10-20)
+    * added - Possibility to invert the line break print outs of IE (ENTER = <br>, SHIFT + ENTER = <p>)
+    * fixed - Replace of <p> with <br> on carriage return prevented the IE to set ordered and unordered lists.
+    * added - Settings object to customize the Editor
+    * fixed - Solve javascript error on example.html
+    * fixed - Change html layout of the editor to solve the minimum width problem on dynamic editor size.
+    * added - Enable/disable possibilty of the context menu
+    * added - A general remove function, so it is possible to remove each html element
+    * added - Adding an option 'Remove Node' to the context menu
+    * added - Adding the possibilty to add the font + font size selection to toolbar2 or placing them where ever you want on the toolbars
+    * changed - Removing the vars EnableFontSelection and EnableFontSizeSelection because font + font size selection goes to ToolBar Array like all other buttons.
+    * changed - Removing vars EditorMinimumWidth and EditorMinimumHeight after solving the minimum width problem on IE. No more use.
+    * added - New Function addToolbarElement() and removeToolbarElement within the settings object
+    * added - Possibility to select a html node using the status bar node structure
+    * changed - Complete redesign of the toolbar implementation
+    * changed - Remove function removeImage() and removeLink(), because function removeNode() do it for all
+    * added - Two new functions getEditorOffsetY() and getEditorOffsetX() to get the offsets of the editor window to the body if the the page
+    * fixed - broken image path on toolbar button text view
+    * added - New function enable(), now you can enable/display the editor on the fly
+
+v0.4.2 (2006-10-16)
+    * added - Converting decimal colors to hex colors within style attributes
+    * changed - Rename getParentTag() to findParentTag(), the function finds a tag by a given tag name
+    * changed - Improving function findParentTag(), now it finds IMG tags and do not return #tags but the parent tag
+    * added - Reimplementing function getTag(). The function gets the current selected tag
+    * added - New Function getParent(). Returns the parent node of the given element
+    * added - New Function getNodeTree(). The function returns a tree of nodes as array, beginning with the current selected element (node) and ending with the HTML node (element).
+    * added - New status bar implemented. It's shown the element structure, beginning with the current selected element and ending with the HTML element.
+    * added - New Function updateStatusBar(). Updates the status bar with the element structure.
+    * changed - Possibility of setting dynamic width and height of the editor
+    * fixed - Solving bug while setting style attribute on links
+
+v0.4.1 (2006-10-14)
+    * added - Custom context menu for images and links
+    * added - Remove option for images and links on the context menu
+    * added - New functions removeLink() and removeImages()
+    * added - New function $() implemented, its a replacement for document.getElementById()
+    * changed - Some small other code changes
+
+v0.4 (2006-10-12)
+    * fixed - Dublicated id attribute in color chooser popup
+    * fixed - Preventing IE to insert <p> tags on carriage return. IE will insert a normal <br> instead. (Thx to richyrich)
+    * fixed - Crappy layout of hyperlink popup on IE (fields: class and name)
+    * fixed - With multiple editors on one form, the global var viewTextMode is not unique for each editor. Used an Array instead to set the var for each editor individually
+    * fixed - Submitting the editor while in text mode then it will submit escaped html (<br> -> submit -> &lt;br&gt;). Auto switch to HTML Mode if submit
+    * fixed - Validate objects on hideFonts() and hideFontSizes() function
+    * changed - Improvements on closing font + font size selection. Add a unique event listener for each selection.
+
+v0.3.2a (2006-10-11)
+    * added - Improvements on font and font size selection, now the drop downs will be closed if you go through the editor.
+    * fixed - Opera bug in insertNodeAtSelection() function solved. That's why the table popup won`t close if you submit it.
+    * fixed - CSS file problem in table popup. There was a hard coded path to the CSS file. I changed it so the path to the CSS file will be dynamically inserted.
+    * added - Improvements to the color selection menus on table popup, now the button "pick" has a toggle function (open/close the color selections).
+    * fixed - Font and font size selection fixed. I improved the closing a little bit, so if you choose font and then click an font size the font menue will be closed before.
+    * added - Added a select field to the hyperlink popup which holds the default targets _blank, _self, _parent, _top. On change the select field updates the 'target' text field.
+   
+
+v0.3.1 (2006-10-10)
+    * fixed - Solve the habit of IE to convert relative urls into absolute. Now you can set two vars AnchorPathToStrip and ImagePathToStrip which holds an url that will be stripped off the href and src attributes. If you set the vars to "auto" then the url will automatically get of the current document. I recommend that you use the "auto" methode.
+
+v0.3 (2006-10-09)
+    * added - Default style now also applies to the preview window
+    * added - Print button + function
+    * fixed - A little mistake within the function setAttribute, attr.toLowerCase -> attr.toLowerCase() it prevented the script to apply the styles in IE correctly
+    * fixed - Problem while replacing \n with <br> after submitting data in IE solved.
+    * fixed - Complete rewritten function insertLink + insertImage. Improving edit capabiltity on both links and images.
+
+v0.2 (2006-10-08)
+    * added - New function insertLink(), now you can insert and edit links. New available attributes are target, styleclass, name and style. (IE has some limitations, getting style attribute doesn`t work, hope i can solve this problem)
+    * fixed - Stripping MS Word HTML (removed some bugs within the regex)
+    * changed - Complete rewritten source code, now all functions + var are within a var WYSIWYG. (ex. WYSIWYG.generate('textarea1', 500, 200); )
+    * fixed - Replace <div> with <span> while insert html on none IE Browsers, this solve the new line problem after the <div> tag.
+    * added - New function insertImage(), now you can insert and editing images
+    * added - Validation of browser versions (thx to TIM)
+
+v0.1 (2006-10-06)
+    * added - Possibility to replace \n with <br> to be compatible with previous content coming from a database, for example.
+    * added - Button to strip any HTML added by word
+    * changed - Modified generate_wysiwyg() method (added width and height to customize size of each editor, width and height are optional parameter)
+    * added - Possibility to set the default font family, font size and font color of the editor area
+    * added - New function disable_wysiwyg() to disable a editor area
+    * changed - Some changes were made to toolbar1 and toolbar2. now toolbar2 is hidden if no elements are assigned.
+    * changed - Now you can add the viewSource button to toolbar1
+    * added - A new function display_wysiwyg() only for displaying an iframe with content of a textarea (without any editable features)
+    * added - A style-class for the iframe to customize the background-color (useful in firefox, because firefox use the background of the parent element)
+    * added - Preview button + function (thx to Korvo), now it works in Firefox and use the innerHTML of the iframe instead of the texteare value
+    * fixed - Some code improvements for better compatibility with Firefox + IE
+    * changed - The var cssDir changed to cssFile, now it includes the complete file path (ex. styles/wysiwyg.css)
+    * added - new stylesheet classes, check the css file
+    * added - Possibility to enable/disable font + font size selection
+    * fixed - Firefox BackColor problem fixed (thx to Merk), no hilite button needed only solve the problem on firefox
diff --git a/openwysiwyg/docs/addons.html b/openwysiwyg/docs/addons.html
new file mode 100644 (file)
index 0000000..3b6ab61
--- /dev/null
@@ -0,0 +1,178 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+       <title>openWYSIWYG</title>
+       <link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body>
+       <table border="0" cellpadding="2" cellspacing="0" style="width:100%;">
+               <tbody>
+               <tr style="vertical-align: top;">
+                       <td>
+                               <a href="http://www.openwebware.com" target="_blank">
+                                       <img src="images/logo.gif" border="0">
+                               </a>
+                       </td>
+                       <td style="text-align:right;">
+                               <font class="naviblock">
+                                       <a href="doc.html" class="navi" title="Documentation">DOCUMENTATION</a> | <a href="addons.html" class="navi" title="Addons">ADDONS</a> | <a href="../example.html" class="navi" title="Examples">EXAMPLES</a>
+                               </font>
+                       </td>
+               </tr>
+               <tr>
+                       <td colspan="2">
+                               <br>
+                               <table border="0" cellpadding="2" cellspacing="0" style="width:100%;">
+                               <tbody>
+                                       <tr>
+                                               <td class="headline">
+                                                       <h1>Addons</h1>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td class="info">
+                                                       Copyright (c) 2006 openWebWare.com
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="">
+                                                       <br>
+                                                       <h2>openImageLibrary addon (PHP)<br></h2>
+                                                       <p> 
+                                                               Here we want to explain how you can use the openImageLibrary addon (for now PHP only) to let your users uploading, browsing and selecting images on your webserver.<br>
+                                                               First you have to download the latest version of the openWYSIWYG modification, which includes the openImageLibrary addon.<br>
+                                                               You will find a directory called <i>addons</i> in the root of the openWYSIWYG directory. If it not there you do not have the latest version of the openWYSIWYG editor.<br><br>
+                                                               To enable the openImageLibrary addon you have to customize the insert image popup implementation of the openWYSIWYG.<br>
+                                                               The following shows how you change the implementation of the insert image popup.
+                                                               <div class="codeblock">
+                                                                       <span class="darkblue">var <span class="red">mysettings</span> = new WYSIWYG.Settings();</span>
+                                                                       <br><br>
+                                                                       <span class="green">// define the location of the openImageLibrary addon</span><br>
+                                                                       <span class="darkblue"><span class="red">mysettings</span>.<b>ImagePopupFile</b> = "addons/imagelibrary/insert_image.php";</span>
+                                                                       <br>
+                                                                       <span class="green">// define the width of the insert image popup</span><br>
+                                                                       <span class="darkblue"><span class="red">mysettings</span>.<b>ImagePopupWidth</b> = 600;</span>
+                                                                       <br>
+                                                                       <span class="green">// define the height of the insert image popup</span><br>
+                                                                       <span class="darkblue"><span class="red">mysettings</span>.<b>ImagePopupHeight</b> = 245;</span>
+                                                                       <br>
+                                                               </div>
+                                                               <br>Attach the editor on the textarea with the previously defined <span class="red"><i>mysettings</i></span> object.
+                                                               <div class="codeblock">
+                                                                       <span class="blue"></span><span class="blue">&#060;script language=</span><span class="green">"javascript1.2"</span><span class="blue">&#062;</span><br>
+                                                                       &nbsp;&nbsp;&nbsp;<span class="darkblue">WYSIWYG.<b>attach</b>('textareaID', <span class="red">mysettings</span><span class="darkblue">);</span><br>
+                                                                       <span class="blue">&#060;/script&#062;</span>
+                                                               </div>
+                                                               <br>
+                                                               Now try it out! 
+                                                               <br>
+                                                       </p>
+                                                       <br><br>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <h2>
+                                                               Customize the openImageLibrary addon
+                                                       </h2>                                                           
+                                                       This section describe how you can customize the openImageLibrary addon.<br><br>
+                                                       
+                                                       <h3>Settings of the openImageLibrary addon:</h3>
+                                                       <br>
+                                                       The following settings can be modified within the config file <i>(addons/imagelibrary/config.inc.php)</i>
+                                                       <br>
+                                                       <table border="0" cellpadding="2" cellspacing="0" class="codeblock" style="width:91%">
+                                                               <colgroup>
+                                                                       <col width="35%">
+                                                                       <col width="65%">
+                                                               </colgroup>
+                                                               <tbody>
+                                                               <tr>    
+                                                                       <td>
+                                                                               <b>$imagebasedir</b> = '../../uploads';
+                                                                       </td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       Path to a directory which holds the images.
+                                                                               </span>
+                                                                       </td>
+                                                               </tr>
+                                                               <tr>    
+                                                                       <td>
+                                                                               <b>$imagebaseurl</b> = 'uploads';
+                                                                       </td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       An absolute or relative URL to the image folder.
+                                                                                       This url is used to generate the source of the image.
+                                                                               </span>
+                                                                       </td>
+                                                               </tr>
+                                                               <tr>    
+                                                                       <td>
+                                                                               <b>$browsedirs</b> = true;
+                                                                       </td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       Allow your users to browse the subdir of the defined basedir.
+                                                                               </span>
+                                                                       </td>
+                                                               </tr>
+                                                               <tr>    
+                                                                       <td>
+                                                                               <b>$allowuploads</b> = true;
+                                                                       </td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       If enabled users will be able to upload files to any viewable directory. 
+                                                                                       You should really only enable this if the area this script is in is already password protected.
+                                                                               </span>
+                                                                       </td>
+                                                               </tr>
+                                                               <tr>    
+                                                                       <td>
+                                                                               <b>$overwrite</b> = false;
+                                                                       </td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       If a user uploads a file with the same name as an existing 
+                                                                                       file do you want the existing file to be overwritten ?
+                                                                               </span>
+                                                                       </td>
+                                                               </tr>
+                                                               <tr>    
+                                                                       <td>
+                                                                               <b>$supportedextentions</b> = array(&lt;file extensions&gt;);
+                                                                       </td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       Define the extentions you want to show within the directory listing.<br>
+                                                                                       The extensions also limit the files the user can upload to your image folders. 
+                                                                               </span>
+                                                                       </td>
+                                                               </tr>
+                                                               <tr>    
+                                                                       <td>
+                                                                               <b>$filetypes</b> = array (&lt;extension&gt; => &lt;filename&gt;)
+                                                                       </td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       If you want to add your own special file icons use this section below. 
+                                                                                       Each entry relates to the extension of the given file, in the form &lt;extension&gt; => &lt;filename&gt;. <br>
+                                                                                       These files must be located within the dlf directory.
+                                                                               </span>
+                                                                       </td>
+                                                               </tr>
+                                                               </tbody>
+                                                       </table>
+                                                       <br>                                    
+                                               </td>
+                                       </tr>   
+                                       </tbody>
+                               </table>
+                       </td>
+               </tr>
+               </tbody>
+       </table>
+</body>
+</html>
diff --git a/openwysiwyg/docs/doc.html b/openwysiwyg/docs/doc.html
new file mode 100644 (file)
index 0000000..2477538
--- /dev/null
@@ -0,0 +1,536 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+       <title>openWYSIWYG</title>
+       <link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body>
+       <table border="0" cellpadding="2" cellspacing="0" style="width:100%;">
+               <tbody>
+               <tr style="vertical-align: top;">
+                       <td>
+                               <a href="http://www.openwebware.com" target="_blank">
+                                       <img src="images/logo.gif" border="0">
+                               </a>
+                       </td>
+                       <td style="text-align:right;">
+                               <font class="naviblock">
+                                       <a href="doc.html" class="navi" title="Documentation">DOCUMENTATION</a> | <a href="addons.html" class="navi" title="Addons">ADDONS</a> | <a href="../example.html" class="navi" title="Examples">EXAMPLES</a>
+                               </font>
+                       </td>
+               </tr>
+               <tr>
+                       <td colspan="2">
+                               <br>
+                               <table border="0" cellpadding="2" cellspacing="0" style="width:100%;">
+                               <tbody>
+                                       <tr>
+                                               <td class="headline">
+                                                       <h1>Documentation</h1>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td class="info">
+                                                       Copyright (c) 2006 openWebWare.com
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="">
+                                                       <br>
+                                                       <h2>Setup the openWYSIWYG editor</h2>
+                                                       <p>
+                                                               Include the javascript files like the following:
+                                                               <br>
+                                                               <div class="codeblock">
+                                                                       <span class="blue">&lt;script language=</span><span class="green">"JavaScript"</span> <span class="blue">type=</span><span class="green">"text/javascript"</span> <span class="blue">src=</span><span class="green">"<span class="red">scripts</span>/wysiwyg.js"</span><span class="blue">&gt;&lt;/script&gt;</span>
+                                                                       <br>
+                                                                       <span class="blue">&lt;script language=</span><span class="green">"JavaScript"</span> <span class="blue">type=</span><span class="green">"text/javascript"</span> <span class="blue">src=</span><span class="green">"<span class="red">scripts</span>/wysiwyg-settings.js"</span><span class="blue">&gt;&lt;/script&gt;<span class="green"> // optional</span></span>
+                                                               </div>
+                                                               <br>
+                                                               Note: You might need to change the src path (red), depending on where you put the files.
+                                                       </p>
+                                                       <p>Now you have to attach the openWYSIWYG editor to all or to defined textareas of your page.<br>
+                                                               <div class="codeblock">
+                                                                       <span class="blue"></span><span class="blue">&#060;script language=</span><span class="green">"javascript1.2"</span><span class="blue">&gt;<br>&nbsp;&nbsp; </span><span class="darkblue"><span class="green">// attach the editor to all textareas of your page.</span></span><br>
+                                                                       &nbsp;&nbsp;&nbsp;<span class="darkblue">WYSIWYG.<strong>attach</strong>('all'); <br>&nbsp;&nbsp; <br></span><span class="darkblue">&nbsp;&nbsp; <span class="green">// attach the editor to the textarea with the identifier 'textarea1'.</span></span><br><span class="darkblue">&nbsp;&nbsp; WYSIWYG.<strong>attach</strong>('textarea1');<br></span><span class="darkblue"></span>
+                                                                       <span class="blue">&#060;/script&#062;</span>
+                                                               </div>
+                                                               <br>
+                                                               Now try it out! 
+                                                               <br><br>
+                                                               If you don't see any images on the toolbar then you have to change the image path.<br>
+                                                               Have a look at the customize section.
+                                                               <br><br>
+                                                               If you need to display contents of textarea's with HTML output support, but without the editing possibilities, you can use a function called display.
+                                                               <div class="codeblock">
+                                                                       <span class="blue"></span><span class="blue">&#060;script language=</span><span class="green">"javascript1.2"</span><span class="blue">&gt;<br>&nbsp;&nbsp; </span><span class="darkblue"><span class="green">// display iframes instead of textareas. It apply's to all textareas of your page.</span></span><br>
+                                                                       &nbsp;&nbsp;&nbsp;<span class="darkblue">WYSIWYG.<strong>display</strong>('all'); <br>&nbsp;&nbsp; <br></span><span class="darkblue">&nbsp;&nbsp; <span class="green">// display an iframe instead of the textarea with the identifier 'textarea1'</span></span><br><span class="darkblue">&nbsp;&nbsp; WYSIWYG.<strong>display</strong>('textarea1');<br></span><span class="darkblue"></span>
+                                                                       <span class="blue">&#060;/script&#062;</span>
+                                                               </div>
+                                                       </p>
+                                                       <br><br>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <h2>
+                                                               Customize the openWYSIWYG
+                                                       </h2>                                                           
+                                                       This section describe how you can customize the openWYSIWYG editor.<br><br>
+                                                       <h3>The Settings object:</h3><br>
+                                                       You can create a new instance of the settings object. 
+                                                       This object will be used to customize your editor.
+                                                       <div class="codeblock">
+                                                               <span class="darkblue">var <span class="red">mysettings</span> = new WYSIWYG.Settings();</span>
+                                                       </div>
+                                                       <br>Now attach the editor to all or to defined textareas of your page.<br> 
+                                                       <div class="codeblock">
+                                                       <span class="darkblue">WYSIWYG.<b>attach</b>(</span><span class="green">'all'</span><span class="darkblue">, <span class="red">mysettings</span><span class="darkblue">);</span><br>
+                                                       </div>
+                                                       <br><br>
+                                                       <h3>Properties of the Settings object:</h3>
+                                                       <br>
+                                                       Here is a list of all properties you can change to customize the look and feel of your editor.
+                                                       <br>
+                                                       <table border="0" cellpadding="2" cellspacing="0" class="codeblock" style="width:91%">
+                                                               <colgroup>
+                                                                       <col width="35%">
+                                                                       <col width="65%">
+                                                               </colgroup>
+                                                               <tbody>
+                                                               <tr>    
+                                                                       <td><span class="red">mysettings</span>.<b>ImagesDir</b> = "&lt;path&gt;";</td>
+                                                                       <td><span class="green">The path where your images are located (default: 'images/')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>PopupsDir</b> = "&lt;path&gt;"; </td>
+                                                                       <td><span class="green">The path where your popup htmls are located (default: 'popups/')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>CSSFile</b> = "&lt;path&gt;"; </td>
+                                                                       <td><span class="green">The path + file where your stylesheet file is located (default: 'styles/wysiwyg.css')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>Width</b> = "&lt;width&gt;"; </td>
+                                                                       <td><span class="green">The width of the editor window (valid units are px and %) (default: '500px')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>Height</b> = "&lt;height&gt;"; </td>
+                                                                       <td><span class="green">The height of the editor window (valid units are px and %) (default: '200px')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>DefaultStyle</b> = "&lt;stylesheet&gt;"; </td>
+                                                                       <td><span class="green">The default stylesheet of the editor window <br>(default: 'font-family: Arial; font-size: 12px; background-color: #FFFFFF')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>DisabledStyle</b> = "&lt;stylesheet&gt;"; </td>
+                                                                       <td><span class="green">The style which appears if the editor is disabled<br> (default: 'font-family: Arial; font-size: 12px; background-color: #EEEEEE')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>ReplaceLineBreaks</b> = &lt;true/false&gt;; </td>
+                                                                       <td><span class="green">Replace line breaks (\n) with html line breaks &lt;br&gt; (used for none html content) (default: false)</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>PreviewWidth</b> = &lt;width&gt;; </td>
+                                                                       <td><span class="green">The width of the preview popup (default: 500)</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>PreviewHeight</b> = &lt;height&gt;; </td>
+                                                                       <td><span class="green">The height of the preview popup (default: 400)</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>RemoveFormatConfMessage</b> = "&lt;text&gt;"; </td>
+                                                                       <td><span class="green">Text which appears if the MS word clean up button is pressed (default: 'Clean HTML inserted by MS Word ?')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>NoValidBrowserMessage</b> = "&lt;text&gt;"; </td>
+                                                                       <td><span class="green">Text which appears if the browser is not supported by openWYSIWYG (default: 'openWYSIWYG does not support your browser.')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>AnchorPathToStrip</b> = "&lt;url&gt;"; </td>
+                                                                       <td><span class="green">The url which is striped off on anchors (only IE, recommended: auto) (default: 'auto')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>ImagePathToStrip</b> = "&lt;url&gt;"; </td>
+                                                                       <td><span class="green">The url which is striped off on images (only IE, recommended: auto) (default: 'auto')</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>ContextMenu</b> = &lt;true/false&gt;;</td>
+                                                                       <td><span class="green">Enable / disable the custom context menu (default: true)</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>StatusBarEnabled</b> = &lt;true/false&gt;;</td>
+                                                                       <td><span class="green">Enable / disable the status bar (default: true)</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>InvertIELineBreaks</b> = &lt;true/false&gt;;</td>
+                                                                       <td><span class="green">Enable / disable invert of line break capability in IE (default: false)</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>InsertImagePopup</b> = &lt;path/file&gt;;</td>
+                                                                       <td><span class="green">If you use another implementation like an image library written in PHP, then you can use this setting to customize the location of the implementation file. No need to edit the main javascript file.<br>(It's used for future upcoming image library addons)</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>InsertImageWith</b> = &lt;width&gt;;</td>
+                                                                       <td><span class="green">Width of the image popup window. (Default: 400)</span></td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td><span class="red">mysettings</span>.<b>InsertImageWith</b> = &lt;height&gt;;</td>
+                                                                       <td><span class="green">Height of the image popup window. (Default: 210)</span></td>
+                                                               </tr>
+                                                               </tbody>
+                                                       </table>
+                                                       <br>
+                                                       <h3>Methods of the Settings object:</h3>
+                                                       <br>
+                                                       There are three methods to customize the toolbar elements. (Recommended if you newly to javascript)
+                                                       <br>    
+                                                       <table border="0" cellpadding="2" cellspacing="0" class="codeblock" style="width:91%">
+                                                               <colgroup>
+                                                                       <col width="50%">
+                                                                       <col width="50%">
+                                                               </colgroup>
+                                                               <tbody>
+                                                               <tr>    
+                                                                       <td><span class="red">mysettings</span>.<b>addToolbarElement</b>("&lt;element&gt;", &lt;toolbar&gt;, &lt;position&gt;);</td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       Add the given &lt;element&gt; to the defined &lt;toolbar&gt; on the defined &lt;position&gt;.<br><br>
+                                                                                       Valid elements are:<br>
+                                                                                       <i>font, fontsize,      bold, italic, underline, forecolor, backcolor, justifyleft, justifycenter, justifyright, 
+                                                                                       unorderedlist, orderedlist, outdent, indent, subscript, superscript, cut, copy, paste, removeformat,
+                                                                                       undo, redo, inserttable, insertimage, createlink, seperator, undo, redo, seperator, preview, print, 
+                                                                                       viewSource, help</i>
+                                                                                       <br><br>
+                                                                                       The element <i>seperator</i> adds a line seperator between elements
+                                                                                       <br><br>
+                                                                                       &lt;toolbar&gt; is an integer starts with 1.
+                                                                                       <br>
+                                                                                       &lt;position&gt; is an integer starts with 1.
+                                                                                       <br><br>
+                                                                                       Example:
+                                                                               </span>
+                                                                               <span color="darkblue"> mysettings.addToolbarElement("bold", 1, 1);</span>
+                                                                               <br><br>
+                                                                       </td>
+                                                               </tr>           
+                                                               <tr>    
+                                                                       <td><span class="red">mysettings</span>.<b>removeToolbarElement</b>("&lt;element&gt;");</td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       Removes the given &lt;element&gt; on the toolbar.<br><br>
+                                                                                       Valid elements are:<br>
+                                                                                       <i>font, fontsize,      bold, italic, underline, forecolor, backcolor, justifyleft, justifycenter, justifyright, 
+                                                                                       unorderedlist, orderedlist, outdent, indent, subscript, superscript, cut, copy, paste, removeformat,
+                                                                                       undo, redo, inserttable, insertimage, createlink, seperator, undo, redo, seperator, preview, print, 
+                                                                                       viewSource, help</i>
+                                                                                       <br><br>
+                                                                                       You can not remove the element <i>seperator</i> only overriding with the function addToolbarElement()
+                                                                                       <br><br>
+                                                                                       Example:
+                                                                               </span>
+                                                                               <span color="darkblue"> mysettings.removeToolbarElement("bold");</span>
+                                                                               <br><br>
+                                                                       </td>
+                                                               </tr>           
+                                                               <tr>    
+                                                                       <td><span class="red">mysettings</span>.<b>clearToolbar</b>(&lt;toolbar&gt;);</td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       Clears the given &lt;toolbar&gt;. If the element &lt;toolbar&gt; is not defined then the functions clear all existing toolbars.<br><br>
+                                                                                       <br><br>
+                                                                                       &lt;toolbar&gt; is an integer starts with 1.
+                                                                                       <br><br>
+                                                                                       Example:
+                                                                               </span>
+                                                                               <span color="darkblue"> mysettings.clearToolbar(1);</span>
+                                                                       </td>
+                                                               </tr>           
+                                                               </tbody>
+                                                       </table>
+                                                       <br><br>
+                                                       <br>
+                                                       <h3>Array of the Settings object:</h3>
+                                                       <br>
+                                                       There are some arrays within the Settings object you can define directly. So let`s show how does it works.
+                                                       <br>
+                                                       <br>    
+                                                       <table border="0" cellpadding="2" cellspacing="0" class="codeblock" style="width:91%">
+                                                               <colgroup>
+                                                                       <col width="50%">
+                                                                       <col width="50%">
+                                                               </colgroup>
+                                                               <tbody>
+                                                               <tr>    
+                                                                       <td><span class="red">mysettings</span>.<b>Toolbar</b>[&lt;toolbar index&gt;][&lt;element index&gt;] = "&lt;element&gt;";</td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       The toolbar array is defined in two dimensions, the first dimension is the toolbar index,
+                                                                                       the second the element index. If you want to define an element in toolbar 2 on position 3 
+                                                                                       then you have to do this: 
+                                                                               </span> 
+                                                                               <span class="darkblue">
+                                                                                       mysettings.Toolbar[1][2] = "bold";
+                                                                               </span>
+                                                                               <br><br>
+                                                                               <span class="green">
+                                                                                       Valid elements can be found on addToolbarElement().
+                                                                               </span>
+                                                                               <br><br>
+                                                                       </td>
+                                                               </tr>   
+                                                               <tr>    
+                                                                       <td><span class="red">mysettings</span>.<b>Fonts</b>[&lt;element index&gt;] = "&lt;element&gt;";</td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       You have the posibility to change the font families by setting the Fonts array 
+                                                                                       of the Settings object. If you want to add Arial on the second position then you have to do this:
+                                                                               </span> 
+                                                                               <span class="darkblue">
+                                                                                       mysettings.Fonts[1] = "Arial";
+                                                                               </span>
+                                                                               <br><br>
+                                                                               <span class=green>
+                                                                                       Valid elements are:<br>
+                                                                                       All font family elements (look at a stylesheet description of the tag font-family)
+                                                                               </span>
+                                                                               <br><br>
+                                                                       </td>
+                                                               </tr>   
+                                                               <tr>    
+                                                                       <td><span class="red">mysettings</span>.<b>Fontsizes</b>[&lt;element index&gt;] = "&lt;size&gt;";</td>
+                                                                       <td>
+                                                                               <span class="green">
+                                                                                       You can also change the font size which you can use on the editor.
+                                                                                       If you want to add the font size 5 on the first position of drop down box,
+                                                                                       then you have to do this:
+                                                                               </span> 
+                                                                               <span class="darkblue">
+                                                                                       mysettings.Fontsizes[0] = "5";
+                                                                               </span>
+                                                                               <br><br>
+                                                                               <span class=green>
+                                                                                       Valid sizes are:<br>
+                                                                                       1 - ... (i dont know if the size attribute is limit)
+                                                                                       
+                                                                               </span>
+                                                                       </td>
+                                                               </tr>   
+                                                               </tbody>
+                                                       </table>        
+                                                       
+                                                       <br><br><br><br>        
+                                               </td>
+                                       </tr>   
+                                       <tr>
+                                               <td>
+                                                       <h2>
+                                                               Change Log
+                                                       </h2>                                                           
+                                                               <p>
+                                                               <b>v1.4.7 (Released: September 9, 2007)</b><br> 
+                                                               Addresses the following: <br></p>
+                                                               <ul>
+                                                               <li>added - Possibilty to maximize the editor window</li>
+                                                               <li>fixed - Correct relative image path on preview, now it works for all images</li>
+                                                               <li>added - Table highlighting possibility</li>
+                                                               <li>added - Possiblity to assign headings (crashed)</li>
+                                                               <li>changed - Code improvments to tons of functions</li>
+                                                               <li>changed - WYSIWYG.formatText() function renamed to WYSIWYG.execCommand()</li>
+                                                               <li>changed - WYSIWYG.findParentTag() renamed to WYSIWYG.findParent()</li>
+                                                               <li>added - WYSIWYG_Core.findParentNode(tagName, node) function which finds a parent node by tag name starts on the given node</li>
+                                                               <li>fixed - Implement function WYSIWYG_Core.getAttribute which solve the problem while getting the style attribute on IE</li>
+                                                               <li>changed - Getting style attribute while editing a link</li>
+                                                               <li>added - WYSIWYG_Table object, which is used for improving table editing</li>
+                                                               <li>changed - New icons print and preview (thx sweb)</li>
+                                                               <li>added - Save and return button on toolbar, the return button is disabled by default. (thx sweb)</li>
+                                                               <li>added - Table function improvments</li>
+                                                               <li>added - New WYSIWYG_Color object, which handels the color choosing</li>
+                                                               <li>added - Full justify text (code by tim)</li>
+                                                               </ul>
+                                                               <p>
+                                                               <b>v1.4.6c (Released: December 25, 2006)</b><br> 
+                                                               Addresses the following: <br></p>
+                                                               <ul>
+                                                               <li>fixed - Solved issue with backcolor command on IE</li>
+                                                               <li>changed - Add parameter value to WYSIWYG_Core.execCommand() function</li>
+                                                               </ul>
+                                                               <b>v1.4.6b (Released: December 23, 2006)</b><br> 
+                                                               Addresses the following: <br></p>
+                                                               <ul>
+                                                               <li>changed - Debug code on context menu removed</li>
+                                                               <li>fixed - Add "px" to left and top style information on context menu</li>
+                                                               <li>changed - Correct comment of wyswiwyg-settings.js</li>
+                                                               </ul>
+                                                               <b>v1.4.6a (Released: December 21, 2006)</b><br> 
+                                                               Addresses the following: <br></p>
+                                                               <ul>
+                                                               <li>fixed - bad class name on mouse over of toolbar buttons fixed</li>
+                                                               <li>changed - Rewritten function to get the current position of an element (iframe)</li>
+                                                               <li>fixed - Context menu position issue solved</li>
+                                                               <li>fixed - Wrong variable call fixed</li>
+                                                               <li>fixed - Problem while removing elements with the context menu solved</li>
+                                                               </ul>
+                                                               <b>v1.4.6 (Released: December 17, 2006)</b><br> 
+                                                               Addresses the following: <br></p>
+                                                               <ul>
+                                                               <li>changed - Modification changed to be the official version of openWYSIWYG</li>
+                                                               <li>fixed - Child nodes will be copied to the parent if a node is removed</li>
+                                                               <li>changed - Complete rewritten context menu</li>
+                                                               <li>changed - Behaviours of the context menu dependents on selection</li>
+                                                               <li>added - Copy/Cut/Paste to context menu</li>
+                                                               <li>changed - Code structure changes</li>
+                                                               <li>added - wysiwyg-popup.js which holds popup specific functions</li>
+                                                               <li>added - new object WYSIWYG_Core added, which holds all core functions</li>
+                                                               <li>added - addEvent() and removeEvent() core function added</li>
+                                                               <li>added - attach() and attachAll() functions which used to attach the editor to textareas</li>
+                                                               <li>changed - Complete rewritten insertLink function, now it works with tags like img, h1 etc</li>
+                                                               <li>added - Override width and height of the editor with size given by the style attributes width and height of the textarea</li>
+                                                               <li>added - New function includeCSS() in Core object, which includes a given stylesheet file on the head tag of the current page</li>
+                                                               <li>fixed - Solved problem if you want to attach the editor to all textareas</li>
+                                                               <li>changed - Include of stylesheet files changed, now using the includeCSS function</li>
+                                                               <li>changed - Complete rewritten display function, now you can use it like like function attach()</li>
+                                                               </ul>
+                                                               <b>Modification v0.4.5 (Released: November 12, 2006)</b><br> 
+                                                               Addresses the following: 
+                                                               </p><ul>
+                                                               <li>added - openImageLibrary addon (for now PHP only)</li>
+                                                               <li>fixed - correct relative anchor and image path on preview</li>
+                                                               <li>changed - various javascript code changes</li>
+                                                               </ul>
+                                                               <b>Modification v0.4.4 (Released: November 11, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>added - capability of using image library addons</li>
+                                                               <li>fixed - corrupt font + font size selection html</li>
+                                                               </ul>
+                                                               <b>Modification v0.4.3 (Released: October 20, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>added - Possibility to invert the line break print outs of IE (ENTER = &lt;br&gt;, SHIFT + ENTER = &lt;p&gt;)</li>
+                                                               <li>fixed - Replace of &lt;p&gt; with &lt;br&gt; on carriage return prevented the IE to set ordered and unordered lists.</li>
+                                                               <li>added - Settings object to customize the Editor</li>
+                                                               <li>fixed - Solve javascript error on example.html</li>
+                                                               <li>fixed - Change html layout of the editor to solve the minimum width problem on dynamic editor size.</li>
+                                                               <li>added - Enable/disable possibilty of the context menu</li>
+                                                               <li>added - A general remove function, so it is possible to remove each html element</li>
+                                                               <li>added - Adding an option 'Remove Node' to the context menu</li>
+                                                               <li>added - Adding the possibilty to add the font + font size selection to toolbar2 or placing them where ever you want on the toolbars</li>
+                                                               <li>changed - Removing the vars EnableFontSelection and EnableFontSizeSelection because font + font size selection goes to ToolBar Array like all other buttons.</li>
+                                                               <li>changed - Removing vars EditorMinimumWidth and EditorMinimumHeight after solving the minimum width problem on IE. No more use.</li>
+                                                               <li>added - New Function addToolbarElement() and removeToolbarElement within the settings object</li>
+                                                               <li>added - Possibility to select a html node using the status bar node structure </li>
+                                                               <li>changed - Complete redesign of the toolbar implementation</li>
+                                                               <li>changed - Remove function removeImage() and removeLink(), because function removeNode() do it for all</li>
+                                                               <li>added - Two new functions getEditorOffsetY() and getEditorOffsetX() to get the offsets of the editor window to the body if the the page</li>
+                                                               <li>fixed - broken image path on toolbar button text view</li>
+                                                               <li>added - New function enable(), now you can enable/display the editor on the fly</li>
+                                                               </ul>
+                                                               <b>Modification v0.4.2 (Released: October 16, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>added - Converting decimal colors to hex colors within style attributes</li>
+                                                               <li>changed - Rename getParentTag() to findParentTag(), the function finds a tag by a given tag name</li>
+                                                               <li>changed - Improving function findParentTag(), now it finds IMG tags and do not return #tags but the parent tag</li>
+                                                               <li>added - Reimplementing function getTag(). The function gets the current selected tag</li>
+                                                               <li>added - New Function getParent(). Returns the parent node of the given element</li>
+                                                               <li>added - New Function getNodeTree(). The function returns a tree of nodes as array, beginning with the current selected element (node) and ending with the HTML node (element).</li>
+                                                               <li>added - New status bar implemented. It's shown the element structure, beginning with the current selected element and ending with the HTML element.</li>
+                                                               <li>added - New Function updateStatusBar(). Updates the status bar with the element structure.</li>
+                                                               <li>changed - Possibility of setting dynamic width and height of the editor</li>
+                                                               <li>fixed - Solving bug while setting style attribute on links</li>
+                                                               </ul>
+                                                               <p><b>Modification v0.4.1 (Released: October 14, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>added - Custom context menu for images and links</li>
+                                                               <li>added - Remove option for images and links on the context menu</li>
+                                                               <li>added - New functions removeLink() and removeImages()
+                                                               <li>added - New function $() implemented, its a replacement for document.getElementById()</li>
+                                                               <li>changed - Some small other code changes</li>
+                                                               </ul>
+                                                               <p><b>Modification v0.4 (Released: October 12, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>fixed - Dublicated id attribute in color chooser popup</li>
+                                                               <li>fixed - Preventing IE to insert &lt;p&gt; tags on carriage return. IE will insert a normal &lt;br&gt; instead. (Thx to richyrich)</li>
+                                                               <li>fixed - Crappy layout of hyperlink popup on IE (fields: class and name)</li>
+                                                               <li>fixed - With multiple editors on one form, the global var viewTextMode is not unique for each editor. Used an Array instead to set the var for each editor individually</li>
+                                                               <li>fixed - Submitting the editor while in text mode then it will submit escaped html (&lt;br&gt; -> submit -> &amp;lt;br&amp;gt;). Auto switch to HTML Mode if submit</li>
+                                                               <li>fixed - Validate objects on hideFonts() and hideFontSizes() function</li>
+                                                               <li>changed - Improvements on closing font + font size selection. Add a unique event listener for each selection.</li>
+                                                               </ul>
+                                                               <p><b>Modification v0.3.2a (Released: October 11, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>added - Improvements on font and font size selection, now the drop downs will be closed if you go through the editor.</li>
+                                                               <li>fixed - Opera bug in insertNodeAtSelection() function solved. That's why the table popup won`t close if you submit it.</li>
+                                                               <li>fixed - CSS file problem in table popup. There was a hard coded path to the CSS file. I changed it so the path to the CSS file will be dynamically inserted.</li>
+                                                               <li>added - Improvements to the color selection menus on table popup, now the button "pick" has a toggle function (open/close the color selections).</li>
+                                                               </ul>
+                                                               <p><b>Modification v0.3.2a (Released: October 11, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>fixed - Font and font size selection fixed. I improved the closing a little bit, so if you choose font and then click an font size the font menue will be closed before.</li>
+                                                               <li>added - Added a select field to the hyperlink popup which holds the default targets _blank, _self, _parent, _top. On change the select field updates the 'target' text field.</li>
+                                                               </ul>
+                                                               <p><b>Modification v0.3.1 (Released: October 10, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>fixed - Solve the habit of IE to convert relative urls into absolute. 
+                                                               Now you can set two vars AnchorPathToStrip and ImagePathToStrip 
+                                                               which holds an url that will be stripped off the href and src attributes. 
+                                                               If you set the vars to "auto" then the url will automatically get of the current document. I recommend that you use the "auto" methode. </li>
+                                                               </ul>
+                                                               <p><b>Modification v0.3 (Released: October 9, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>added - Default style now also applies to the preview window</li>
+                                                               <li>added - Print button + function</li>
+                                                               <li>fixed - A little mistake within the function setAttribute, attr.toLowerCase -&gt; attr.toLowerCase() it prevented the script to apply the styles in IE correctly</li>
+                                                               <li>fixed - Problem while replacing \n with &lt;br&gt; after submitting data in IE solved.</li>
+                                                               <li>fixed - Complete rewritten function insertLink + insertImage. Improving edit capabiltity on both links and images. </li>
+                                                               </ul>
+                                                               <p><b>Modification v0.2 (Released: October 8, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>added - New function insertLink(), now you can insert and edit links. 
+                                                               New available attributes are target, styleclass, name and style. 
+                                                               (IE has some limitations, getting style attribute doesn`t work, hope i can solve this problem)</li>
+                                                               <li>fixed - Stripping MS Word HTML (removed some bugs within the regex)</li>
+                                                               <li>changed - Complete rewritten source code, now all functions + var are within a var WYSIWYG. (ex. WYSIWYG.generate('textarea1', 500, 200); )</li>
+                                                               <li>fixed - Replace &lt;div&gt; with &lt;span&gt; while insert html on none IE Browsers, this solve the new line problem after the &lt;div&gt; tag.</li>
+                                                               <li>added - New function insertImage(), now you can insert and editing images</li>
+                                                               <li>added - Validation of browser versions (thx to TIM) </li>
+                                                               </ul>
+                                                       
+                                                               <p><b>Modification v0.1 (Released: October 6, 2006)</b><br />
+                                                               Addresses the following:
+                                                               <ul>
+                                                               <li>added - Possibility to replace \n with &lt;br&gt; to be compatible with previous content coming from a database, for example.</li>
+                                                               <li>added - Button to strip any HTML added by word</li>
+                                                               <li>changed - Modified generate_wysiwyg() method (added width and height to customize size of each editor, width and height are optional parameter)</li>
+                                                               <li>added - Possibility to set the default font family, font size and font color of the editor area</li>
+                                                               <li>added - New function disable_wysiwyg() to disable a editor area</li>
+                                                               <li>changed - Some changes were made to toolbar1 and toolbar2. now toolbar2 is hidden if no elements are assigned.</li>
+                                                               <li>changed - Now you can add the viewSource button to toolbar1</li>
+                                                               <li>added - A new function display_wysiwyg() only for displaying an iframe with content of a textarea (without any editable features)</li>
+                                                               <li>added - A style-class for the iframe to customize the background-color (useful in firefox, because firefox use the background of the parent element)</li>
+                                                               <li>added - Preview button + function (thx to Korvo), now it works in Firefox and use the innerHTML of the iframe instead of the texteare value</li>
+                                                               <li>fixed - Some code improvements for better compatibility with Firefox + IE</li>
+                                                               <li>changed - The var cssDir changed to cssFile, now it includes the complete file path (ex. styles/wysiwyg.css)</li>
+                                                               <li>added - new stylesheet classes, check the css file</li>
+                                                               <li>added - Possibility to enable/disable font + font size selection</li>
+                                                               <li>fixed - Firefox BackColor problem fixed (thx to Merk), no hilite button needed only solve the problem on firefox </li>
+                                                               </ul>
+                                                               </p>
+                                                       </td>
+                                               </tr>   
+                                       </tbody>
+                               </table>
+                       </td>
+               </tr>
+               </tbody>
+       </table>
+</body>
+</html>
diff --git a/openwysiwyg/docs/images/logo.gif b/openwysiwyg/docs/images/logo.gif
new file mode 100644 (file)
index 0000000..17daf94
Binary files /dev/null and b/openwysiwyg/docs/images/logo.gif differ
diff --git a/openwysiwyg/docs/style.css b/openwysiwyg/docs/style.css
new file mode 100644 (file)
index 0000000..d9c6774
--- /dev/null
@@ -0,0 +1,112 @@
+body {
+       font-family: Arial;
+       color: #000000;
+       font-weight: normal;
+       font-size: 13px;        
+       background-color: #EEEEEE;
+}
+
+td {
+       font-family: Arial;
+       color: #000000;
+       font-weight: normal;
+       font-size: 13px;                
+}
+
+h1 {
+       font-family: Tahoma;
+       color: #444444;
+       font-weight: bold;
+       font-size: 16px;        
+       margin: 0px;
+}
+
+h2 {
+       font-family: Tahoma;
+       color: #444444;
+       font-weight: bold;
+       font-size: 14px;        
+       margin: 0px;
+       text-decoration: underline;     
+}
+
+h3 {
+       font-family: Tahoma;
+       color: #444444;
+       font-weight: bold;
+       font-size: 12px;        
+       margin: 0px;
+       text-decoration: underline;     
+}
+
+.headline {
+       border-bottom: 1px solid #FF3300;
+       font-weight: bold;
+}
+
+.naviblock {
+       width:280px;
+       text-align:center;
+       border: 1px solid #AAAAAA;
+       padding:5px; 
+       background-color:#FFFFFF;       
+}
+
+a.navi {
+       font-family: Tahoma;
+       color: #444444;
+       font-weight: bold;
+       font-size: 13px;
+       text-decoration: none;          
+}
+
+a.navi:hover {
+       text-decoration: underline;     
+}
+
+a {
+       color: #333333; 
+}
+
+.codeblock {
+       background-color: #FFFFEE; 
+       font-family: courier new; 
+       font-size: 12px; 
+       padding: 5px; 
+       width: 90%; 
+       border: 1px solid #AAAAAA; 
+       margin-left: 10px;
+       margin-top: 5px;
+}
+
+ .codeblock td {
+       font-family: courier new; 
+       font-size: 12px; 
+       vertical-align: top;
+       color: #000088;
+ }
+
+.list {
+       line-height: 20px;      
+}
+
+.red {
+       color: #FF3300; 
+}
+
+.blue {
+       color: #0000FF; 
+}
+
+.green {
+       color: #008080;
+}
+
+.darkblue {
+       color: #000088;
+}
+
+.info {
+       color: #EE0000;
+       font-size:10px;
+}
\ No newline at end of file
diff --git a/openwysiwyg/example.html b/openwysiwyg/example.html
new file mode 100644 (file)
index 0000000..68373cd
--- /dev/null
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+       <head>
+               <title>openWYSIWYG</title>
+               <link rel="stylesheet" href="docs/style.css" type="text/css">
+               
+               <!-- 
+                       Include the WYSIWYG javascript files
+               -->
+               <script type="text/javascript" src="scripts/wysiwyg.js"></script>
+               <script type="text/javascript" src="scripts/wysiwyg-settings.js"></script>
+               <!-- 
+                       Attach the editor on the textareas
+               -->
+               <script type="text/javascript">
+                       // Use it to attach the editor to all textareas with full featured setup
+                       //WYSIWYG.attach('all', full);
+                       
+                       // Use it to attach the editor directly to a defined textarea
+                       WYSIWYG.attach('textarea1'); // default setup
+                       WYSIWYG.attach('textarea2', full); // full featured setup
+                       WYSIWYG.attach('textarea3', small); // small setup
+                       
+                       // Use it to display an iframes instead of a textareas
+                       //WYSIWYG.display('all', full);  
+               </script>
+               
+       </head>
+       <body>
+       <table border="0" cellpadding="2" cellspacing="0" style="width:100%;">
+               <tbody>
+                       <tr style="vertical-align: top;">
+                               <td>
+                                       <a href="http://www.openwebware.com" target="_blank">
+                                               <img src="docs/images/logo.gif" border="0">
+                                       </a>
+                               </td>
+                               <td style="text-align: right;">
+                                       <font class="naviblock">
+                                               <a href="docs/doc.html" class="navi" title="Documentation">DOCUMENTATION</a> | <a href="docs/addons.html" class="navi" title="Addons">ADDONS</a> | <a href="example.html" class="navi" title="Examples">EXAMPLES</a>
+                                       </font>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td colspan="2">
+                                       <br>
+                                       <table border="0" cellpadding="2" cellspacing="0" style="width:100%;">
+                                       <tbody>
+                                               <tr>
+                                                       <td class="headline">
+                                                               <h1>Examples</h1>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td class="info">
+                                                       Copyright (c) 2006 openWebWare.com
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               <br>
+                                                               <form name="exampleForm" action="example.html" method="post">
+<!-- 
+       Default settings
+ -->                                                           
+<h2>
+       Default setup applied to this editor: 
+</h2>
+<br>
+<textarea id="textarea1" name="test1" style="width:560px;height:200px;">
+ <table border="0" cellpadding="0" cellspacing="0" style="margin-left: 10px;">
+ <tr>
+  <td style="padding: 0 10 10 0;">
+  <a href="http://www.openwebware.com/products/openwysiwyg/">
+       <img    src="http://www.openwebware.com/images/openwysiwyg/logo9060.gif" border="0" height="60" width="90" alt="openWYSIWYG - Cross-browser WYSIWYG editor">
+  </a>
+  </td>
+  <td style="font-family: verdana; font-size: 11px; line-height: 130%; color: #494949;" valign="top">  
+  <b>
+       <a href="http://www.openwebware.com/products/openwysiwyg/" style="font-family: arial; font-size: 12px; color: #055F92;">openWYSIWYG - Cross-browser WYSIWYG editor</a>
+   </b>
+       <br />     
+       </td>
+ </tr>
+</table>
+</textarea>
+<br />
+<br />
+
+<!-- 
+       Three toolbars and dynamicly width applied to this editor
+ -->
+<h2>
+Customized toolbar and openImageLibrary addon applied to this editor:
+</h2>
+<br>
+<textarea id="textarea2" name="test2" style="width:80%;height:200px;">
+<h1>GNU Lesser General Public License</h1>
+<tt>
+<p>Version 2.1, February 1999</p>
+
+<blockquote>
+<p>Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.</p>
+
+<p>[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]</p>
+</blockquote>
+
+<h3>Preamble</h3>
+<p>The licenses for most software are designed to take away your freedom to share and change it.</p></tt>
+</textarea>
+
+<br />
+<br />
+
+<!-- 
+       A really small setup applied to this editor
+-->
+<h2> 
+       A really small setup applied to this editor: 
+</h2>
+<br>
+<textarea id="textarea3" name="test3">
+A small editor...can come in handy when you just need font size, bold, italic, etc.
+</textarea>
+
+</form>
+                                                       </td>
+                                               </tr>   
+                                       </tbody>
+                               </table>
+                       </td>
+               </tr>
+               </tbody>
+       </table>
+</body>
+</html>
diff --git a/openwysiwyg/images/backcolor.gif b/openwysiwyg/images/backcolor.gif
new file mode 100644 (file)
index 0000000..fa177ee
Binary files /dev/null and b/openwysiwyg/images/backcolor.gif differ
diff --git a/openwysiwyg/images/backcolor_on.gif b/openwysiwyg/images/backcolor_on.gif
new file mode 100644 (file)
index 0000000..5ea8d37
Binary files /dev/null and b/openwysiwyg/images/backcolor_on.gif differ
diff --git a/openwysiwyg/images/background_silver.jpg b/openwysiwyg/images/background_silver.jpg
new file mode 100644 (file)
index 0000000..efd475b
Binary files /dev/null and b/openwysiwyg/images/background_silver.jpg differ
diff --git a/openwysiwyg/images/bold.gif b/openwysiwyg/images/bold.gif
new file mode 100644 (file)
index 0000000..4ec8e72
Binary files /dev/null and b/openwysiwyg/images/bold.gif differ
diff --git a/openwysiwyg/images/bold_on.gif b/openwysiwyg/images/bold_on.gif
new file mode 100644 (file)
index 0000000..09e7562
Binary files /dev/null and b/openwysiwyg/images/bold_on.gif differ
diff --git a/openwysiwyg/images/copy.gif b/openwysiwyg/images/copy.gif
new file mode 100644 (file)
index 0000000..3339c3f
Binary files /dev/null and b/openwysiwyg/images/copy.gif differ
diff --git a/openwysiwyg/images/copy_on.gif b/openwysiwyg/images/copy_on.gif
new file mode 100644 (file)
index 0000000..296ffdf
Binary files /dev/null and b/openwysiwyg/images/copy_on.gif differ
diff --git a/openwysiwyg/images/cut.gif b/openwysiwyg/images/cut.gif
new file mode 100644 (file)
index 0000000..2c4fd16
Binary files /dev/null and b/openwysiwyg/images/cut.gif differ
diff --git a/openwysiwyg/images/cut_on.gif b/openwysiwyg/images/cut_on.gif
new file mode 100644 (file)
index 0000000..6e9d70f
Binary files /dev/null and b/openwysiwyg/images/cut_on.gif differ
diff --git a/openwysiwyg/images/delete.gif b/openwysiwyg/images/delete.gif
new file mode 100644 (file)
index 0000000..a1390ce
Binary files /dev/null and b/openwysiwyg/images/delete.gif differ
diff --git a/openwysiwyg/images/delete_on.gif b/openwysiwyg/images/delete_on.gif
new file mode 100644 (file)
index 0000000..ca2947e
Binary files /dev/null and b/openwysiwyg/images/delete_on.gif differ
diff --git a/openwysiwyg/images/forecolor.gif b/openwysiwyg/images/forecolor.gif
new file mode 100644 (file)
index 0000000..053ab65
Binary files /dev/null and b/openwysiwyg/images/forecolor.gif differ
diff --git a/openwysiwyg/images/forecolor_on.gif b/openwysiwyg/images/forecolor_on.gif
new file mode 100644 (file)
index 0000000..61e0fb1
Binary files /dev/null and b/openwysiwyg/images/forecolor_on.gif differ
diff --git a/openwysiwyg/images/help.gif b/openwysiwyg/images/help.gif
new file mode 100644 (file)
index 0000000..c709559
Binary files /dev/null and b/openwysiwyg/images/help.gif differ
diff --git a/openwysiwyg/images/help_on.gif b/openwysiwyg/images/help_on.gif
new file mode 100644 (file)
index 0000000..491aac9
Binary files /dev/null and b/openwysiwyg/images/help_on.gif differ
diff --git a/openwysiwyg/images/indent_left.gif b/openwysiwyg/images/indent_left.gif
new file mode 100644 (file)
index 0000000..9ff7c2f
Binary files /dev/null and b/openwysiwyg/images/indent_left.gif differ
diff --git a/openwysiwyg/images/indent_left_on.gif b/openwysiwyg/images/indent_left_on.gif
new file mode 100644 (file)
index 0000000..18e7ea0
Binary files /dev/null and b/openwysiwyg/images/indent_left_on.gif differ
diff --git a/openwysiwyg/images/indent_right.gif b/openwysiwyg/images/indent_right.gif
new file mode 100644 (file)
index 0000000..90f70bc
Binary files /dev/null and b/openwysiwyg/images/indent_right.gif differ
diff --git a/openwysiwyg/images/indent_right_on.gif b/openwysiwyg/images/indent_right_on.gif
new file mode 100644 (file)
index 0000000..58ba3e5
Binary files /dev/null and b/openwysiwyg/images/indent_right_on.gif differ
diff --git a/openwysiwyg/images/insert_hyperlink.gif b/openwysiwyg/images/insert_hyperlink.gif
new file mode 100644 (file)
index 0000000..cd38888
Binary files /dev/null and b/openwysiwyg/images/insert_hyperlink.gif differ
diff --git a/openwysiwyg/images/insert_hyperlink_on.gif b/openwysiwyg/images/insert_hyperlink_on.gif
new file mode 100644 (file)
index 0000000..3083f24
Binary files /dev/null and b/openwysiwyg/images/insert_hyperlink_on.gif differ
diff --git a/openwysiwyg/images/insert_picture.gif b/openwysiwyg/images/insert_picture.gif
new file mode 100644 (file)
index 0000000..4318538
Binary files /dev/null and b/openwysiwyg/images/insert_picture.gif differ
diff --git a/openwysiwyg/images/insert_picture_on.gif b/openwysiwyg/images/insert_picture_on.gif
new file mode 100644 (file)
index 0000000..9b2fcb3
Binary files /dev/null and b/openwysiwyg/images/insert_picture_on.gif differ
diff --git a/openwysiwyg/images/insert_table.gif b/openwysiwyg/images/insert_table.gif
new file mode 100644 (file)
index 0000000..a69b98b
Binary files /dev/null and b/openwysiwyg/images/insert_table.gif differ
diff --git a/openwysiwyg/images/insert_table_on.gif b/openwysiwyg/images/insert_table_on.gif
new file mode 100644 (file)
index 0000000..dc126e9
Binary files /dev/null and b/openwysiwyg/images/insert_table_on.gif differ
diff --git a/openwysiwyg/images/italics.gif b/openwysiwyg/images/italics.gif
new file mode 100644 (file)
index 0000000..8fd547e
Binary files /dev/null and b/openwysiwyg/images/italics.gif differ
diff --git a/openwysiwyg/images/italics_on.gif b/openwysiwyg/images/italics_on.gif
new file mode 100644 (file)
index 0000000..c781bda
Binary files /dev/null and b/openwysiwyg/images/italics_on.gif differ
diff --git a/openwysiwyg/images/justify_center.gif b/openwysiwyg/images/justify_center.gif
new file mode 100644 (file)
index 0000000..6f1c340
Binary files /dev/null and b/openwysiwyg/images/justify_center.gif differ
diff --git a/openwysiwyg/images/justify_center_on.gif b/openwysiwyg/images/justify_center_on.gif
new file mode 100644 (file)
index 0000000..ef75d13
Binary files /dev/null and b/openwysiwyg/images/justify_center_on.gif differ
diff --git a/openwysiwyg/images/justify_justify.gif b/openwysiwyg/images/justify_justify.gif
new file mode 100644 (file)
index 0000000..11b2af6
Binary files /dev/null and b/openwysiwyg/images/justify_justify.gif differ
diff --git a/openwysiwyg/images/justify_justify_on.gif b/openwysiwyg/images/justify_justify_on.gif
new file mode 100644 (file)
index 0000000..1e06876
Binary files /dev/null and b/openwysiwyg/images/justify_justify_on.gif differ
diff --git a/openwysiwyg/images/justify_left.gif b/openwysiwyg/images/justify_left.gif
new file mode 100644 (file)
index 0000000..f2e6142
Binary files /dev/null and b/openwysiwyg/images/justify_left.gif differ
diff --git a/openwysiwyg/images/justify_left_on.gif b/openwysiwyg/images/justify_left_on.gif
new file mode 100644 (file)
index 0000000..5f88cce
Binary files /dev/null and b/openwysiwyg/images/justify_left_on.gif differ
diff --git a/openwysiwyg/images/justify_right.gif b/openwysiwyg/images/justify_right.gif
new file mode 100644 (file)
index 0000000..5df6220
Binary files /dev/null and b/openwysiwyg/images/justify_right.gif differ
diff --git a/openwysiwyg/images/justify_right_on.gif b/openwysiwyg/images/justify_right_on.gif
new file mode 100644 (file)
index 0000000..8544755
Binary files /dev/null and b/openwysiwyg/images/justify_right_on.gif differ
diff --git a/openwysiwyg/images/list_ordered.gif b/openwysiwyg/images/list_ordered.gif
new file mode 100644 (file)
index 0000000..7e7acbc
Binary files /dev/null and b/openwysiwyg/images/list_ordered.gif differ
diff --git a/openwysiwyg/images/list_ordered_on.gif b/openwysiwyg/images/list_ordered_on.gif
new file mode 100644 (file)
index 0000000..a7a1c0a
Binary files /dev/null and b/openwysiwyg/images/list_ordered_on.gif differ
diff --git a/openwysiwyg/images/list_unordered.gif b/openwysiwyg/images/list_unordered.gif
new file mode 100644 (file)
index 0000000..69f7393
Binary files /dev/null and b/openwysiwyg/images/list_unordered.gif differ
diff --git a/openwysiwyg/images/list_unordered_on.gif b/openwysiwyg/images/list_unordered_on.gif
new file mode 100644 (file)
index 0000000..0f36014
Binary files /dev/null and b/openwysiwyg/images/list_unordered_on.gif differ
diff --git a/openwysiwyg/images/logo.gif b/openwysiwyg/images/logo.gif
new file mode 100644 (file)
index 0000000..50bedd4
Binary files /dev/null and b/openwysiwyg/images/logo.gif differ
diff --git a/openwysiwyg/images/maximize.gif b/openwysiwyg/images/maximize.gif
new file mode 100644 (file)
index 0000000..a3c138a
Binary files /dev/null and b/openwysiwyg/images/maximize.gif differ
diff --git a/openwysiwyg/images/maximize_on.gif b/openwysiwyg/images/maximize_on.gif
new file mode 100644 (file)
index 0000000..a3c138a
Binary files /dev/null and b/openwysiwyg/images/maximize_on.gif differ
diff --git a/openwysiwyg/images/paste.gif b/openwysiwyg/images/paste.gif
new file mode 100644 (file)
index 0000000..5d4219d
Binary files /dev/null and b/openwysiwyg/images/paste.gif differ
diff --git a/openwysiwyg/images/paste_on.gif b/openwysiwyg/images/paste_on.gif
new file mode 100644 (file)
index 0000000..111bb95
Binary files /dev/null and b/openwysiwyg/images/paste_on.gif differ
diff --git a/openwysiwyg/images/preview.gif b/openwysiwyg/images/preview.gif
new file mode 100644 (file)
index 0000000..dc34a70
Binary files /dev/null and b/openwysiwyg/images/preview.gif differ
diff --git a/openwysiwyg/images/preview_on.gif b/openwysiwyg/images/preview_on.gif
new file mode 100644 (file)
index 0000000..401890d
Binary files /dev/null and b/openwysiwyg/images/preview_on.gif differ
diff --git a/openwysiwyg/images/print.gif b/openwysiwyg/images/print.gif
new file mode 100644 (file)
index 0000000..4a21d8f
Binary files /dev/null and b/openwysiwyg/images/print.gif differ
diff --git a/openwysiwyg/images/print_on.gif b/openwysiwyg/images/print_on.gif
new file mode 100644 (file)
index 0000000..235c46c
Binary files /dev/null and b/openwysiwyg/images/print_on.gif differ
diff --git a/openwysiwyg/images/redo.gif b/openwysiwyg/images/redo.gif
new file mode 100644 (file)
index 0000000..6e2b689
Binary files /dev/null and b/openwysiwyg/images/redo.gif differ
diff --git a/openwysiwyg/images/redo_on.gif b/openwysiwyg/images/redo_on.gif
new file mode 100644 (file)
index 0000000..a713be1
Binary files /dev/null and b/openwysiwyg/images/redo_on.gif differ
diff --git a/openwysiwyg/images/remove_format.gif b/openwysiwyg/images/remove_format.gif
new file mode 100644 (file)
index 0000000..76617de
Binary files /dev/null and b/openwysiwyg/images/remove_format.gif differ
diff --git a/openwysiwyg/images/remove_format_on.gif b/openwysiwyg/images/remove_format_on.gif
new file mode 100644 (file)
index 0000000..e2d0539
Binary files /dev/null and b/openwysiwyg/images/remove_format_on.gif differ
diff --git a/openwysiwyg/images/return.gif b/openwysiwyg/images/return.gif
new file mode 100644 (file)
index 0000000..307d155
Binary files /dev/null and b/openwysiwyg/images/return.gif differ
diff --git a/openwysiwyg/images/return_on.gif b/openwysiwyg/images/return_on.gif
new file mode 100644 (file)
index 0000000..1c1cc49
Binary files /dev/null and b/openwysiwyg/images/return_on.gif differ
diff --git a/openwysiwyg/images/save.gif b/openwysiwyg/images/save.gif
new file mode 100644 (file)
index 0000000..f4b4bd9
Binary files /dev/null and b/openwysiwyg/images/save.gif differ
diff --git a/openwysiwyg/images/save_on.gif b/openwysiwyg/images/save_on.gif
new file mode 100644 (file)
index 0000000..81b1de0
Binary files /dev/null and b/openwysiwyg/images/save_on.gif differ
diff --git a/openwysiwyg/images/select_font.gif b/openwysiwyg/images/select_font.gif
new file mode 100644 (file)
index 0000000..c57b997
Binary files /dev/null and b/openwysiwyg/images/select_font.gif differ
diff --git a/openwysiwyg/images/select_font_on.gif b/openwysiwyg/images/select_font_on.gif
new file mode 100644 (file)
index 0000000..102dc52
Binary files /dev/null and b/openwysiwyg/images/select_font_on.gif differ
diff --git a/openwysiwyg/images/select_heading.gif b/openwysiwyg/images/select_heading.gif
new file mode 100644 (file)
index 0000000..7e91cf7
Binary files /dev/null and b/openwysiwyg/images/select_heading.gif differ
diff --git a/openwysiwyg/images/select_heading_on.gif b/openwysiwyg/images/select_heading_on.gif
new file mode 100644 (file)
index 0000000..e9ff50f
Binary files /dev/null and b/openwysiwyg/images/select_heading_on.gif differ
diff --git a/openwysiwyg/images/select_size.gif b/openwysiwyg/images/select_size.gif
new file mode 100644 (file)
index 0000000..8e4bef8
Binary files /dev/null and b/openwysiwyg/images/select_size.gif differ
diff --git a/openwysiwyg/images/select_size_on.gif b/openwysiwyg/images/select_size_on.gif
new file mode 100644 (file)
index 0000000..942fbf6
Binary files /dev/null and b/openwysiwyg/images/select_size_on.gif differ
diff --git a/openwysiwyg/images/seperator.gif b/openwysiwyg/images/seperator.gif
new file mode 100644 (file)
index 0000000..0401d25
Binary files /dev/null and b/openwysiwyg/images/seperator.gif differ
diff --git a/openwysiwyg/images/seperator2.gif b/openwysiwyg/images/seperator2.gif
new file mode 100644 (file)
index 0000000..b082bb0
Binary files /dev/null and b/openwysiwyg/images/seperator2.gif differ
diff --git a/openwysiwyg/images/settings.gif b/openwysiwyg/images/settings.gif
new file mode 100644 (file)
index 0000000..f83b2e2
Binary files /dev/null and b/openwysiwyg/images/settings.gif differ
diff --git a/openwysiwyg/images/strikethrough.gif b/openwysiwyg/images/strikethrough.gif
new file mode 100644 (file)
index 0000000..0d0afe8
Binary files /dev/null and b/openwysiwyg/images/strikethrough.gif differ
diff --git a/openwysiwyg/images/strikethrough_on.gif b/openwysiwyg/images/strikethrough_on.gif
new file mode 100644 (file)
index 0000000..e876a85
Binary files /dev/null and b/openwysiwyg/images/strikethrough_on.gif differ
diff --git a/openwysiwyg/images/subscript.gif b/openwysiwyg/images/subscript.gif
new file mode 100644 (file)
index 0000000..39f4c42
Binary files /dev/null and b/openwysiwyg/images/subscript.gif differ
diff --git a/openwysiwyg/images/subscript_on.gif b/openwysiwyg/images/subscript_on.gif
new file mode 100644 (file)
index 0000000..a29140f
Binary files /dev/null and b/openwysiwyg/images/subscript_on.gif differ
diff --git a/openwysiwyg/images/superscript.gif b/openwysiwyg/images/superscript.gif
new file mode 100644 (file)
index 0000000..0d69b43
Binary files /dev/null and b/openwysiwyg/images/superscript.gif differ
diff --git a/openwysiwyg/images/superscript_on.gif b/openwysiwyg/images/superscript_on.gif
new file mode 100644 (file)
index 0000000..14f2020
Binary files /dev/null and b/openwysiwyg/images/superscript_on.gif differ
diff --git a/openwysiwyg/images/underline.gif b/openwysiwyg/images/underline.gif
new file mode 100644 (file)
index 0000000..e32b6e8
Binary files /dev/null and b/openwysiwyg/images/underline.gif differ
diff --git a/openwysiwyg/images/underline_on.gif b/openwysiwyg/images/underline_on.gif
new file mode 100644 (file)
index 0000000..db2068f
Binary files /dev/null and b/openwysiwyg/images/underline_on.gif differ
diff --git a/openwysiwyg/images/undo.gif b/openwysiwyg/images/undo.gif
new file mode 100644 (file)
index 0000000..fe9afeb
Binary files /dev/null and b/openwysiwyg/images/undo.gif differ
diff --git a/openwysiwyg/images/undo_on.gif b/openwysiwyg/images/undo_on.gif
new file mode 100644 (file)
index 0000000..8885006
Binary files /dev/null and b/openwysiwyg/images/undo_on.gif differ
diff --git a/openwysiwyg/images/view_source.gif b/openwysiwyg/images/view_source.gif
new file mode 100644 (file)
index 0000000..3f23035
Binary files /dev/null and b/openwysiwyg/images/view_source.gif differ
diff --git a/openwysiwyg/images/view_source_on.gif b/openwysiwyg/images/view_source_on.gif
new file mode 100644 (file)
index 0000000..e8106db
Binary files /dev/null and b/openwysiwyg/images/view_source_on.gif differ
diff --git a/openwysiwyg/images/view_text.gif b/openwysiwyg/images/view_text.gif
new file mode 100644 (file)
index 0000000..9d445c4
Binary files /dev/null and b/openwysiwyg/images/view_text.gif differ
diff --git a/openwysiwyg/images/view_text_on.gif b/openwysiwyg/images/view_text_on.gif
new file mode 100644 (file)
index 0000000..cc57b26
Binary files /dev/null and b/openwysiwyg/images/view_text_on.gif differ
diff --git a/openwysiwyg/popups/about.html b/openwysiwyg/popups/about.html
new file mode 100644 (file)
index 0000000..8c7676e
--- /dev/null
@@ -0,0 +1,100 @@
+<html>
+       <head>
+               <title>openWYSIWYG | About</title>
+               <script type="text/javascript" src="../scripts/wysiwyg-popup.js"></script>
+               <script type="text/javascript">
+                       var n = WYSIWYG_Popup.getParam('wysiwyg');
+               </script>
+       </head>
+       <body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+               <table border="0" cellpadding="0" cellspacing="0" style="padding: 10px;">
+                       <tr>
+                               <td>
+                                       <table width="380" border="0" cellpadding="0" cellspacing="0">
+                                               <tr>
+                                                       <td style="border-bottom: 2px solid #FFFFFF;" rowspan="2">
+                                                               <script type="text/javascript">
+                                                                       document.write('<img src="../' + window.opener.WYSIWYG.config[n].ImagesDir + 'logo.gif" alt="openWebWare: openWYSIWYG">');
+                                                               </script>
+                                                       </td>
+                                                       <td colspan="4" style="height: 50px;">
+                                                               &nbsp;
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td width="60" style="background-color: #F7F7F7;">
+
+                                                               <table width="60" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border-width: 2 2 0 2; border-style: solid; border-color: #FFFFFF; border-bottom: 2px solid #F7F7F7; padding: 2px;">
+                                                                       <tr>
+                                                                               <td align="center" style="font-family: arial, verdana, helvetica, sans serif; font-size: 10px;">
+                                                                                       <script type="text/javascript">
+                                                                                               document.write('<a href="about.html?wysiwyg=' + n + '" style="color: #000000; text-decoration: none;">About</a>');
+                                                                                       </script>
+                                                                               </td>
+                                                                       </tr>
+                                                               </table>
+
+                                                       </td>
+                                                       <td width="5" style="border-bottom: 2px solid #FFFFFF;">
+                                                               &nbsp;
+                                                       </td>
+                                                       <td width="60" style="background-color: #F7F7F7;">
+
+                                                               <table width="60" border="0" cellpadding="0" cellspacing="0" style="background-color: #DDDDDD; border: 2px solid #FFFFFF; padding: 2px;">
+                                                                       <tr>
+                                                                               <td align="center" style="font-family: arial, verdana, helvetica, sans serif; font-size: 10px;">
+                                                                                       <script type="text/javascript">
+                                                                                               document.write('<a href="about_license.html?wysiwyg=' + n + '" style="color: #000000; text-decoration: none;">License</a>');
+                                                                                       </script>
+                                                                               </td>
+                                                                       </tr>
+                                                               </table>
+
+                                                       </td>
+                                                       <td width="5" style="border-bottom: 2px solid #FFFFFF;">
+                                                               &nbsp;
+                                                       </td>
+                                               </tr>
+                                       </table>
+
+                                       <table width="380" border="0" cellpadding="0" cellspacing="0" style="height: 260px; background-color: #F7F7F7; border-width: 0 2 2 2; border-style: solid; border-color: #FFFFFF; padding: 5px;">
+                                               <tr>
+                                                       <td style="font-family: arial, verdana, helvetica, sans serif; font-size: 10px;">
+                                                               An open source cross-browser WYSIWYG editor.<br><br>
+                                                               Version 1.4.7<br>
+
+                                                               Copyright &copy 2006
+                                                               <a href="http://www.openwebware.com/" target="_blank">openWebWare.com</a>
+                                                               <br>
+                                                               All Rights Reserved
+                                                               <br>
+                                                               <br>
+
+                                                               <br>
+                                                               <b style="font-size: 12px;">Resources:</b>
+                                                               <ul> 
+                                                                       <li>
+                                                                               <a href="http://www.openwebware.com/" target="_blank">openWebWare.com Website</a> - open source applications and developer tools.
+                                                                       </li>
+                                                                       <li style="margin-top: 3px;">
+                                                                               <a href="http://www.openwebware.com/products/openwysiwyg/" target="_blank">openWYSIWYG Homepage</a> - cross browser &lt;textarea&gt; replacelemt.
+                                                                       </li>
+                                                                       <li style="margin-top: 3px;">
+                                                                               <a href="http://www.openwebware.com/forum/viewforum.php?f=1" target="_blank">User Forums</a> - trade openWYSIWYG tips and tricks with other developers.
+                                                                       </li>
+                                                                       <!-- 
+                                                                       <li style="margin-top: 3px;">
+                                                                               <a href="http://www.openwebware.com/products/openwysiwyg/docs/" target="_blank">Online Documentation</a> - user documentation.
+                                                                       </li>
+                                                                        -->
+                                                               </ul>
+
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+
+       </body>
+</html>
diff --git a/openwysiwyg/popups/about_license.html b/openwysiwyg/popups/about_license.html
new file mode 100644 (file)
index 0000000..fa05365
--- /dev/null
@@ -0,0 +1,75 @@
+<html>
+       <head>
+               <title>openWYSIWYG | About</title>
+               <script type="text/javascript" src="../scripts/wysiwyg-popup.js"></script>
+               <script type="text/javascript">
+                       var n = WYSIWYG_Popup.getParam('wysiwyg');
+               </script>
+       </head>
+       <body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+               <table border="0" cellpadding="0" cellspacing="0" style="padding: 10px;">
+                       <tr>
+                               <td>
+                                       <table width="380" border="0" cellpadding="0" cellspacing="0">
+                                               <tr>
+                                                       <td style="border-bottom: 2px solid #FFFFFF;" rowspan="2">
+                                                               <script type="text/javascript">
+                                                                       document.write('<img src="../' + window.opener.WYSIWYG.config[n].ImagesDir + 'logo.gif" alt="openWebWare: openWYSIWYG">');
+                                                               </script>
+                                                       </td>
+                                                       <td colspan="4" style="height: 50px;">
+                                                               &nbsp;
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td width="60" style="background-color: #F7F7F7;">
+                                                               <table width="60" border="0" cellpadding="0" cellspacing="0"
+                                                                       style="background-color: #DDDDDD; border: 2px solid #FFFFFF; padding: 2px;">
+                                                                       <tr>
+                                                                               <td align="center" style="font-family: arial, verdana, helvetica, sans serif; font-size: 10px;">
+                                                                                       <script type="text/javascript">
+                                                                                               document.write('<a href="about.html?wysiwyg=' + n + '" style="color: #000000; text-decoration: none;">About</a>');
+                                                                                       </script>
+                                                                               </td>
+                                                                       </tr>
+                                                               </table>
+
+                                                       </td>
+                                                       <td width="5" style="border-bottom: 2px solid #FFFFFF;">
+                                                               &nbsp;
+                                                       </td>
+                                                       <td width="60" style="background-color: #F7F7F7;">
+
+                                                               <table width="60" border="0" cellpadding="0" cellspacing="0"
+                                                                       style="background-color: #F7F7F7; border-width: 2 2 0 2; border-style: solid; border-color: #FFFFFF; border-bottom: 2px solid #F7F7F7; padding: 2px;">
+                                                                       <tr>
+                                                                               <td align="center"
+                                                                                       style="font-family: arial, verdana, helvetica, sans serif; font-size: 10px;">
+                                                                                       <script type="text/javascript">
+                                                                                               document.write('<a href="about_license.html?wysiwyg=' + n + '" style="color: #000000; text-decoration: none;">License</a>');
+                                                                                       </script>
+                                                                               </td>
+                                                                       </tr>
+                                                               </table>
+
+                                                       </td>
+                                                       <td width="5" style="border-bottom: 2px solid #FFFFFF;">
+                                                               &nbsp;
+                                                       </td>
+                                               </tr>
+                                       </table>
+
+                                       <table width="380" border="0" cellpadding="0" cellspacing="0"
+                                               style="height: 260px; background-color: #F7F7F7; border-width: 0 2 2 2; border-style: solid; border-color: #FFFFFF; padding: 5px;">
+                                               <tr>
+                                                       <td>
+                                                               <iframe style="width: 360px; height: 244px; border: none;" src="license.html"></iframe>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+               </table>
+
+       </body>
+</html>
diff --git a/openwysiwyg/popups/create_table.html b/openwysiwyg/popups/create_table.html
new file mode 100644 (file)
index 0000000..38d9ee4
--- /dev/null
@@ -0,0 +1,262 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+       <head>
+               <title>openWYSIWYG | Create or Modify Table</title>
+
+               <style type="text/css">
+                       body, td {
+                               font-family: arial, verdana, helvetica; 
+                               font-size: 11px;
+                       }
+                       
+                       select, input, button {
+                               font-size: 10px;
+                       }
+                       
+                       .table-settings {
+                               background-color: #F7F7F7; 
+                               border: 2px solid #FFFFFF; 
+                               padding: 5px;                   
+                       }
+               </style>
+
+       </head>
+       <script type="text/javascript" src="../scripts/wysiwyg-popup.js"></script>
+       <script type="text/javascript" src="../scripts/wysiwyg-color.js"></script>
+               
+       <script type="text/javascript">
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+               
+       // add stylesheet file
+       if(n) document.write('<link rel="stylesheet" type="text/css" href="../' + WYSIWYG.config[n].CSSFile +'">\n');
+       
+       /* ---------------------------------------------------------------------- *\
+         Function    : buildTable()
+         Description : Builds a table and inserts it into the WYSIWYG.
+       \* ---------------------------------------------------------------------- */
+       function buildTable() {
+                       
+               var WYSIWYG_Table = window.opener.WYSIWYG_Table;
+               var doc = WYSIWYG.getEditorWindow(n).document;
+               // create a table object
+               var table = doc.createElement("TABLE");
+               // set cols and rows
+               WYSIWYG_Core.setAttribute(table, "tmpcols", document.getElementById("cols").value);
+               WYSIWYG_Core.setAttribute(table, "tmprows", document.getElementById("rows").value);
+               // alignment
+               if(document.getElementById("alignment").value != "") 
+                       WYSIWYG_Core.setAttribute(table, "align", document.getElementById("alignment").value);
+               
+               // style attributes
+               var style = "";
+               // padding
+               style += "padding:" + document.getElementById("padding").value + "px;";
+               // width
+               style += "width:" + document.getElementById("width").value + document.getElementById("widthType").value + ";";
+               // border
+               style += "border:" + document.getElementById("border").value + "px;";
+               // borderstyle
+               if(document.getElementById("borderstyle").value != "none")
+                       style += "border-style:" + document.getElementById("borderstyle").value + ";";
+               // border-color
+               if(document.getElementById("bordercolor").value != "none")
+                       style += "border-color:" + document.getElementById("bordercolor").value + ";";
+               // border-collapse
+               var collapse = document.getElementById("bordercollapse").checked ? "true" : "separate";
+               style += "border-collapse:" + collapse + ";";
+               // background-color
+               if(document.getElementById("backgroundcolor").value != "none")
+                       style += "background-color:" + document.getElementById("backgroundcolor").value + ";";
+               
+               WYSIWYG_Core.setAttribute(table, "style", style);
+               
+               
+               WYSIWYG_Table.create(n, table);
+               window.close();
+               return;
+               
+               // Checks if the table border will use the BORDER-COLLAPSE CSS attribute
+               var collapse;
+               if (document.getElementById('borderCollapse').checked == true) {
+                       collapse = document.getElementById('borderCollapse').value;
+               }
+               else {
+                       collapse = "separate";
+               }
+               
+               // Builds a table based on the data input into the form
+               var table = '<table border="0" cellpadding="0" cellspacing="0" style="';
+               table += 'BORDER-COLLAPSE: ' + collapse + ';';  
+               table += ' border: ' + document.getElementById('borderWidth').value + ' ' +  document.getElementById('borderStyle').value + ' ' +  document.getElementById('borderColor').value + ';';  
+               table += ' width: ' + document.getElementById('tableWidth').value + document.getElementById('widthType').value + ';';
+               table += ' background-color: ' + document.getElementById('shadingColor').value + ';"';
+               table += ' alignment="' + document.getElementById('alignment').value + '">\n';  
+               
+               // Creates the number of rows and cols the table will have
+               for (var i = 0; i < document.getElementById('rows').value; i++) {
+                       table += '<tr>\n';
+                       for (var j = 0; j < document.getElementById('cols').value; j++) {
+                               table += '<td style="border: ' + document.getElementById('borderWidth').value + ' ' +  document.getElementById('borderStyle').value + ' ' +  document.getElementById('borderColor').value + '; padding: ' + document.getElementById('padding').value + ';">&nbsp;</td>\n';
+                       }
+                       table += '</tr>\n';
+               }
+               table += '</table>\n';
+               
+               
+               // Inserts the table code into the WYSIWYG editor       
+               WYSIWYG.insertHTML(table, n);
+               window.close();
+       }       
+       </script>
+
+       <body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" onload="WYSIWYG_ColorInst.init();">
+
+               <table border="0" cellpadding="0" cellspacing="0" style="width:100%;padding: 10px;">
+                       <tr>
+                               <td>
+                                       <span style=" font-weight: bold;">Table Properties:</span>
+
+                                       <table style="width:100%;" border="0" cellpadding="1" cellspacing="0"
+                                               class="table-settings">
+                                               <tr>
+                                                       <td style="width: 20%;">
+                                                               Rows:
+                                                       </td>
+                                                       <td style="width: 25%;">
+                                                               <input type="text" size="4" id="rows" name="rows" value="2" style="width: 50px;">
+                                                       </td>
+                                                       <td style="width: 25%;">
+                                                               Width:
+                                                       </td>
+                                                       <td style="width: 30%;">
+                                                               <input type="text" name="width" id="width" value="100" size="10" style="width: 50px;">
+                                                               <select name="widthType" id="widthType"
+                                                                       style="margin-right: 10px; font-size: 10px;">
+                                                                       <option value="%">%</option>
+                                                                       <option value="px">px</option>
+                                                               </select>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               Cols:
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" size="4" id="cols" name="cols" value="2"     style="width: 50px;">
+                                                       </td>
+                                                       <td>
+                                                               Alignment:
+                                                       </td>
+                                                       <td>
+                                                               <select name="alignment" id="alignment" style="margin-right: 10px; width: 95px;">
+                                                                       <option value="">Not Set</option>
+                                                                       <option value="left">Left</option>
+                                                                       <option value="right">Right</option>
+                                                                       <option value="center">Center</option>
+                                                               </select>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               Padding:
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" id="padding" name="padding" value="2" style="width: 50px;">
+                                                       </td>
+                                                       <td>
+                                                               Background-Color:
+                                                       </td>
+                                                       <td>
+                                                               <table border="0" cellpadding="0" cellspacing="0">
+                                                                       <tr>
+                                                                               <td width="25">
+                                                                                       <table border="0" cellpadding="0" cellspacing="0">
+                                                                                               <tr>
+                                                                                                       <td>
+                                                                                                               <input type="text" name="backgroundcolor" id="backgroundcolor" value="none" style="width:50px;">
+                                                                                                       </td>
+                                                                                               </tr>
+                                                                                       </table>
+                                                                               </td>
+                                                                               <td>
+                                                                                       <button style="margin-left: 2px;" onClick="WYSIWYG_ColorInst.choose('backgroundcolor');">
+                                                                                               Choose
+                                                                                       </button>
+                                                                               </td>
+                                                                       </tr>
+                                                               </table>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                               <td>
+                                                       Border-Size:
+                                               </td>
+                                               <td>
+                                                       <input type="text" size="4" id="border" name="border" value="0" style="width: 50px;">
+                                               </td>
+                                               <td>
+                                                       Border-Color:
+                                               </td>
+                                               <td>
+                                                       <table border="0" cellpadding="0" cellspacing="0">
+                                                               <tr>
+                                                                       <td width="25">
+                                                                               <table border="0" cellpadding="0" cellspacing="0">
+                                                                                       <tr>
+                                                                                               <td>                                                                                            
+                                                                                                       <input type="text" name="bordercolor" id="bordercolor" value="none" style="width:50px;">
+                                                                                               </td>
+                                                                                       </tr>
+                                                                               </table>
+                                                                       </td>
+                                                                       <td>
+                                                                               <button style="margin-left: 2px;" onClick="WYSIWYG_ColorInst.choose('bordercolor');">
+                                                                                       Choose
+                                                                               </button>
+                                                                       </td>
+                                                               </tr>
+                                                       </table>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       Border-Style:
+                                               </td>
+                                               <td>
+                                                       <select id="borderstyle" name="borderstyle" style="width: 80px;">
+                                                               <option value="none">none</option>
+                                                               <option value="solid">solid</option>
+                                                               <option value="double">double</option>
+                                                               <option value="dotted">dotted</option>
+                                                               <option value="dashed">dashed</option>
+                                                               <option value="groove">groove</option>
+                                                               <option value="ridge">ridge</option>
+                                                               <option value="inset">inset</option>
+                                                               <option value="outset">outset</option>
+                                                       </select>
+                                               </td>
+                                               <td>
+                                                       Border-Collapse:
+                                               </td>
+                                               <td>
+                                                       <input type="checkbox" name="bordercollapse" id="bordercollapse">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+               </table>
+                       <div align="right">
+                               <input type="submit" value="  Submit  " onClick="buildTable();"
+                                       style="font-size: 12px;">
+                               &nbsp;
+                               <input type="submit" value="  Cancel  " onClick="window.close();"
+                                       style="font-size: 12px; margin-right: 15px;">
+                       </div>
+                               </td>
+                       </tr>
+               </table>
+       </div>
+       </body>
+</html>
\ No newline at end of file
diff --git a/openwysiwyg/popups/insert_hyperlink.html b/openwysiwyg/popups/insert_hyperlink.html
new file mode 100644 (file)
index 0000000..fe10263
--- /dev/null
@@ -0,0 +1,173 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+       <title>openWYSIWYG | Create or Modify Link</title>
+</head>
+<script type="text/javascript" src="../scripts/wysiwyg-popup.js"></script>
+
+<script type="text/javascript">
+
+/* ---------------------------------------------------------------------- *\
+  Function    : insertHyperLink() (changed)
+  Description : Insert the link into the iframe html area
+\* ---------------------------------------------------------------------- */
+function insertHyperLink() {
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+       
+       // get values from form fields
+       var href = document.getElementById('linkUrl').value;
+       var target = document.getElementById('linkTarget').value;
+       var style = document.getElementById('linkStyle').value;
+       var styleClass = document.getElementById('linkClass').value;
+       var name = document.getElementById('linkName').value;
+  
+       // insert link
+       WYSIWYG.insertLink(href, target, style, styleClass, name, n);
+       window.close();
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : loadLink() (new)
+  Description : Load the link attributes to the form
+\* ---------------------------------------------------------------------- */
+function loadLink() {
+       // get params
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+       
+       // get selection and range
+       var sel = WYSIWYG.getSelection(n);
+       var range = WYSIWYG.getRange(sel);
+       var lin = null;
+       if(WYSIWYG_Core.isMSIE) {
+               if(sel.type == "Control" && range.length == 1) {        
+                       range = WYSIWYG.getTextRange(range(0));
+                       range.select();
+               }
+               if (sel.type == 'Text' || sel.type == 'None') {
+                       sel = WYSIWYG.getSelection(n);
+                       range = WYSIWYG.getRange(sel);
+                       // find a as parent element
+                       lin = WYSIWYG.findParent("a", range);
+               }
+       }
+       else {
+               // find a as parent element
+               lin = WYSIWYG.findParent("a", range);
+       }
+       
+       // if no link as parent found exit here
+       if(lin == null) return;
+               
+       // set form elements with attribute values
+       for(var i=0; i<lin.attributes.length; i++) {
+               var attr = lin.attributes[i].name.toLowerCase();
+               var value = lin.attributes[i].value;
+               if(attr && value && value != "null") {
+                       switch (attr) {
+                               case "href":
+                                       // strip off urls on IE
+                                       if(WYSIWYG_Core.isMSIE) value = WYSIWYG.stripURLPath(n, value, false);
+                                       document.getElementById('linkUrl').value = value;
+                               break;
+                               case "target":
+                                       document.getElementById('linkTarget').value = value;
+                                       selectItemByValue(document.getElementById('linkTargetChooser'), value);
+                               break;
+                               case "name":
+                                       document.getElementById('linkName').value = value;
+                               break;
+                               case "class":
+                                       document.getElementById('linkClass').value = value;
+                               break;
+                               case "className":
+                                       document.getElementById('linkClass').value = value;
+                               break;
+                               
+                       }
+               }
+       }
+       
+       // Getting style attribute of the link separately, because IE interprets the 
+       // style attribute is an complex object, and do not return a text stylesheet like Mozilla.
+       document.getElementById('linkStyle').value = WYSIWYG_Core.replaceRGBWithHexColor(WYSIWYG_Core.getAttribute(lin, "style"));      
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : updateTarget() (new)
+  Description : Updates the target text field
+  Arguments   : value - Value to be set
+\* ---------------------------------------------------------------------- */
+function updateTarget(value) {
+       document.getElementById('linkTarget').value = value;
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : selectItem()
+  Description : Select an item of an select box element by value.
+\* ---------------------------------------------------------------------- */
+function selectItemByValue(element, value) {
+       if(element.options.length) {
+               for(var i=0;i<element.options.length;i++) {
+                       if(element.options[i].value == value) {
+                               element.options[i].selected = true;
+                               return;
+                       }
+               }
+               element.options[(element.options.length-1)].selected = true;
+       }
+}
+
+</script>
+<body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" onLoad="loadLink();">
+
+<table border="0" cellpadding="0" cellspacing="0" style="padding: 10px;"><tr><td>
+
+<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Insert Hyperlink:</span>
+       <table width="330" border="0" cellpadding="1" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
+       <tr>
+               <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">URL:</td>
+               <td style="padding-bottom: 2px; padding-top: 0px;" colspan="3">
+                       <input type="text" name="linkUrl" id="linkUrl" value="http://" style="font-size: 10px; width: 100%;">
+               </td>
+       </tr>
+       <tr>
+               <td style="padding-bottom: 2px; width: 50px; font-family: arial, verdana, helvetica; font-size: 11px;">Target:</td>
+               <td style="padding-bottom: 2px;" colspan="3">
+                       <input type="text" name="linkTarget" id="linkTarget" value="" style="font-size: 10px; width: 65%;">
+                       &nbsp;
+                       <select name="linkTargetChooser" id="linkTargetChooser" style="font-size: 10px; width: 30%;" onchange="updateTarget(this.value);">
+                               <option value="" selected>no target</option>
+                               <option value="_blank">_blank</option>
+                               <option value="_self">_self</option>
+                               <option value="_parent">_parent</option>
+                               <option value="_top">_top</option>
+                               <option value="">custom</option>
+                       </select>
+               </td>   
+       </tr>
+       <tr>
+               <td style="padding-bottom: 2px; width: 50px; font-family: arial, verdana, helvetica; font-size: 11px;">Style:</td>
+               <td style="padding-bottom: 2px;" colspan="3">
+                       <input type="text" name="linkStyle" id="linkStyle" value="" style="font-size: 10px; width: 100%;">
+               </td>   
+       </tr>
+       <tr>
+               <td style="padding-bottom: 2px; width: 50px; font-family: arial, verdana, helvetica; font-size: 11px;">Class:</td>
+               <td style="padding-bottom: 2px;">
+                       <input type="text" name="linkClass" id="linkClass" value="" style="font-size: 10px; width: 90%;">
+               </td>   
+               <td style="padding-bottom: 2px; width: 30px; font-family: arial, verdana, helvetica; font-size: 11px;">Name:</td>
+               <td style="padding-bottom: 2px; width: 120px;">
+                       <input type="text" name="linkName" id="linkName" value="" style="font-size: 10px; width: 100%;">
+               </td>   
+       </tr>
+</table>       
+
+<div align="right" style="padding-top: 5px;"><input type="submit" value="  Submit  " onClick="insertHyperLink();" style="font-size: 12px;" >&nbsp;<input type="submit" value="  Cancel  " onClick="window.close();" style="font-size: 12px;" ></div>
+
+</td></tr></table>
+
+</body>
+</html>
diff --git a/openwysiwyg/popups/insert_image.html b/openwysiwyg/popups/insert_image.html
new file mode 100644 (file)
index 0000000..5b68dd3
--- /dev/null
@@ -0,0 +1,185 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+<title>openWYSIWYG | Insert or Modify Image</title>
+
+<script type="text/javascript" src="../scripts/wysiwyg-popup.js"></script>
+<script language="JavaScript" type="text/javascript">
+
+/* ---------------------------------------------------------------------- *\
+  Function    : insertImage()
+  Description : Inserts image into the WYSIWYG.
+\* ---------------------------------------------------------------------- */
+function insertImage() {
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+       
+       // get values from form fields
+       var src = document.getElementById('src').value;
+       var alt = document.getElementById('alt').value;
+       var width = document.getElementById('width').value
+       var height = document.getElementById('height').value
+       var border = document.getElementById('border').value
+       var align = document.getElementById('align').value
+       var vspace = document.getElementById('vspace').value
+       var hspace = document.getElementById('hspace').value
+       
+       // insert image
+       WYSIWYG.insertImage(src, width, height, align, border, alt, hspace, vspace, n);
+       window.close();
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : loadImage()
+  Description : load the settings of a selected image into the form fields
+\* ---------------------------------------------------------------------- */
+function loadImage() {
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+       
+       // get selection and range
+       var sel = WYSIWYG.getSelection(n);
+       var range = WYSIWYG.getRange(sel);
+       
+       // the current tag of range
+       var img = WYSIWYG.findParent("img", range);
+       
+       // if no image is defined then return
+       if(img == null) return;
+               
+       // assign the values to the form elements
+       for(var i = 0;i < img.attributes.length;i++) {
+               var attr = img.attributes[i].name.toLowerCase();
+               var value = img.attributes[i].value;
+               //alert(attr + " = " + value);
+               if(attr && value && value != "null") {
+                       switch(attr) {
+                               case "src": 
+                                       // strip off urls on IE
+                                       if(WYSIWYG_Core.isMSIE) value = WYSIWYG.stripURLPath(n, value, false);
+                                       document.getElementById('src').value = value;
+                               break;
+                               case "alt":
+                                       document.getElementById('alt').value = value;
+                               break;
+                               case "align":
+                                       selectItemByValue(document.getElementById('align'), value);
+                               break;
+                               case "border":
+                                       document.getElementById('border').value = value;
+                               break;
+                               case "hspace":
+                                       document.getElementById('hspace').value = value;
+                               break;
+                               case "vspace":
+                                       document.getElementById('vspace').value = value;
+                               break;
+                               case "width":
+                                       document.getElementById('width').value = value;
+                               break;
+                               case "height":
+                                       document.getElementById('height').value = value;
+                               break;                          
+                       }
+               }
+       }
+       
+       // get width and height from style attribute in none IE browsers
+       if(!WYSIWYG_Core.isMSIE && document.getElementById('width').value == "" && document.getElementById('width').value == "") {
+               document.getElementById('width').value = img.style.width.replace(/px/, "");
+               document.getElementById('height').value = img.style.height.replace(/px/, "");
+       }
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : selectItem()
+  Description : Select an item of an select box element by value.
+\* ---------------------------------------------------------------------- */
+function selectItemByValue(element, value) {
+       if(element.options.length) {
+               for(var i=0;i<element.options.length;i++) {
+                       if(element.options[i].value == value) {
+                               element.options[i].selected = true;
+                       }
+               }
+       }
+}
+
+</script>
+</head>
+<body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" onLoad="loadImage();">
+
+<table border="0" cellpadding="0" cellspacing="0" style="padding: 10px;"><tr><td>
+
+<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Insert Image:</span>
+<table width="380" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Image URL:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;" width="300"><input type="text" name="src" id="src" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Alternate Text:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="alt" id="alt" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+</table>
+       
+
+
+<table width="380" border="0" cellpadding="0" cellspacing="0" style="margin-top: 10px;"><tr><td style="vertical-align:top;">
+
+<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Layout:</span>
+<table width="180" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
+<tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Width:</td>
+  <td style="width:60px;padding-bottom: 2px; padding-top: 0px;"><input type="text" name="width" id="width" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Height:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="height" id="height" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Border:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="border" id="border" value="0"  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+</table>       
+
+</td>
+<td width="10">&nbsp;</td>
+<td style="vertical-align:top;">
+
+<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">&nbsp;</span>
+<table width="200" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
+<tr>
+  <td style="width: 115px;padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="100">Alignment:</td>
+       <td style="width: 85px;padding-bottom: 2px; padding-top: 0px;">
+       <select name="align" id="align" style="font-family: arial, verdana, helvetica; font-size: 11px; width: 100%;">
+        <option value="">Not Set</option>
+        <option value="left">Left</option>
+        <option value="right">Right</option>
+        <option value="texttop">Texttop</option>
+        <option value="absmiddle">Absmiddle</option>
+        <option value="baseline">Baseline</option>
+        <option value="absbottom">Absbottom</option>
+        <option value="bottom">Bottom</option>
+        <option value="middle">Middle</option>
+        <option value="top">Top</option>
+       </select>
+       </td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Horizontal Space:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="hspace" id="hspace" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+ <tr>
+  <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Vertical Space:</td>
+       <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="vspace" id="vspace" value=""  style="font-size: 10px; width: 100%;"></td>
+ </tr>
+</table>       
+
+</td></tr></table>
+
+<div align="right" style="padding-top: 5px;"><input type="submit" value="  Submit  " onClick="insertImage();" style="font-size: 12px;" >&nbsp;<input type="submit" value="  Cancel  " onClick="window.close();" style="font-size: 12px;" ></div>
+
+</td></tr></table>
+
+</body>
+</html>
diff --git a/openwysiwyg/popups/license.html b/openwysiwyg/popups/license.html
new file mode 100644 (file)
index 0000000..49c89d2
--- /dev/null
@@ -0,0 +1,166 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+<title>openWYSIWYG | License</title>
+</head>
+<body style="font-family: arial, verdana, helvetia, sans serif; font-size: 12px; background-color: #F7F7F7;">
+<h1>GNU Lesser General Public License</h1>
+
+<p>Version 2.1, February 1999</p>
+
+<blockquote>
+<p>Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.</p>
+
+<p>[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]</p></blockquote>
+
+<h3>Preamble</h3>
+
+<p> The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. </p>
+
+ <p>This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
+</p>
+<p> When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</p>
+
+ <p>To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
+</p>
+<p> For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. </p>
+
+ <p>We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. </p>
+
+ <p>To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. </p>
+<p>
+ Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. </p>
+
+ <p>Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. </p>
+
+ <p>When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. </p>
+
+ <p>We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. </p>
+
+ <p>For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
+</p>
+ <p>In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. </p>
+
+<p> Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
+</p>
+ <p>The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. </p>
+
+<h3>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</h3>
+
+<p><strong>0.</strong> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".</p>
+
+<p> A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. </p>
+
+<p> The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) </p>
+
+<p> "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</p>
+
+ <p>Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. </p>
+
+<p><strong>1.</strong> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
+</p>
+<p> You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. </p>
+
+<p><strong>2.</strong> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+</p>
+
+<blockquote>
+<p>a) The modified work must itself be a software library. </p>
+<p>b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</p>
+<p>c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. </p>
+<p>d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. </p>
+
+
+<p> (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) 
+</p>
+<p> These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+</p>
+ <p>Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
+</p>
+<p> In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+</p></blockquote>
+<p><strong>3.</strong> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. </p>
+
+ <p>Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
+</p>
+<p> This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
+</p>
+<p><strong>4.</strong> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
+</p>
+
+ <p>If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</p>
+
+<p><strong>5.</strong> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. </p>
+
+<p> However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. </p>
+
+<p> When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. </p>
+
+<p> If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) </p>
+
+<p>Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. </p>
+
+<p><strong>6.</strong> As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. </p>
+<p>
+ You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: </p>
+
+<blockquote><p>a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) </p>
+
+<p>b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. </p>
+<p>
+c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. </p>
+
+<p>d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. </p>
+
+<p>e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</p>
+</blockquote>
+
+ <p>For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. </p>
+
+<p> It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. </p>
+
+<p><strong>7.</strong> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: </p>
+
+<blockquote>
+<p>a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. </p>
+
+<p>b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</p></blockquote>
+
+<p><strong>8.</strong> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. </p>
+<p>
+<strong>9.</strong> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. </p>
+<p>
+<strong>10.</strong> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. </p>
+
+<p><strong>11.</strong> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. </p>
+<p>
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. </p>
+
+<p>It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. </p>
+
+<p>This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. </p>
+<p>
+<strong>12.</strong> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. </p>
+<p>
+<strong>13.</strong> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</p>
+
+<p>Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. </p>
+<p>
+<strong>14.</strong> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. </p>
+<p>
+NO WARRANTY </p>
+<p>
+<strong>15. </strong>BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. </p>
+<p>
+<strong>16.</strong> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. </p>
+
+<h3><strong>END OF TERMS AND CONDITIONS</strong></h3>
+
+</body>
+</html>
diff --git a/openwysiwyg/popups/preview.html b/openwysiwyg/popups/preview.html
new file mode 100644 (file)
index 0000000..61a0127
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+<title>Preview</title>
+</head>
+<script type="text/javascript" src="../scripts/wysiwyg-popup.js"></script>
+<script type="text/javascript">
+
+function preview() {   
+       // get params
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+       // set default styles
+       WYSIWYG_Core.setAttribute(document.body, "style", WYSIWYG.config[n].DefaultStyle);
+       // get content
+       WYSIWYG_Table.disableHighlighting(n);
+       var content = WYSIWYG.getEditorWindow(n).document.body.innerHTML;
+       WYSIWYG_Table.refreshHighlighting(n);
+       content = content.replace(/src="([^/|^http|^https])/gi, "src=\"../$1"); // correct relative image path
+       content = content.replace(/href="([^/|^http|^https|^ftp])/gi, "href=\"../$1"); // correct relative anchor path
+       // set content
+       document.body.innerHTML = content;
+}
+</script>
+<body onLoad="preview();">
+</body>
+</html> 
+
diff --git a/openwysiwyg/popups/select_color.html b/openwysiwyg/popups/select_color.html
new file mode 100644 (file)
index 0000000..ca06bd8
--- /dev/null
@@ -0,0 +1,335 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+       <title>openWYSIWYG | Select Color</title>
+</head>
+<script type="text/javascript" src="../scripts/wysiwyg-popup.js"></script>
+<script type="text/javascript">
+
+/**
+ * Loads the color in the form field
+ */
+function loadColor() {
+       document.getElementById('enterColor').value = "#" + WYSIWYG_Popup.getParam('color');
+}
+
+/* ---------------------------------------------------------------------- *\
+  Function    : selectColor()
+  Description : Selects the color and inserts it into the WYSIWYG
+\* ---------------------------------------------------------------------- */
+function selectColor(color) {
+       // get params
+       var n = WYSIWYG_Popup.getParam('wysiwyg');
+       var cmd = WYSIWYG_Popup.getParam('command');
+       var doc = WYSIWYG.getEditorWindow(n).document;
+       // execute command
+       WYSIWYG_Core.execCommand(n, cmd, color);
+       // close window
+    window.close();
+}
+
+
+/* ---------------------------------------------------------------------- *\
+  Function    : previewColor()
+  Description : Updates the preview pane as the user mouses over different colors
+\* ---------------------------------------------------------------------- */
+function previewColor(color) {
+  document.getElementById('enterColor').value = color;
+       document.getElementById('PreviewColor').style.backgroundColor = color;
+}
+</script>
+<body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" onLoad="loadColor();">
+<center>
+<table border="0" cellspacing="0" cellpadding="4" width="100%">
+<form onSubmit="selectColor(document.getElementById('enterColor').value);">
+ <tr>
+  <td valign=center><div style="background-color: #000000; padding: 1; height: 21px; width: 50px"><div id="PreviewColor" style="height: 100%; width: 100%"></div></div></td>
+  <td valign=center><input type="text" size="15" name="enterColor" id="enterColor" style="font-size: 10px;"></td>
+  <td width="100%"></td>
+ </tr>
+ </form>
+</table>
+
+<table border=0 cellspacing=1 cellpadding=0 bgcolor="#000000" style="cursor: hand;" >
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#003300" onMouseOver="previewColor('#003300')" onClick="selectColor('#003300')" height="10" width="10"></td>
+  <td bgcolor="#006600" onMouseOver="previewColor('#006600')" onClick="selectColor('#006600')" height="10" width="10"></td>
+  <td bgcolor="#009900" onMouseOver="previewColor('#009900')" onClick="selectColor('#009900')" height="10" width="10"></td>
+  <td bgcolor="#00CC00" onMouseOver="previewColor('#00CC00')" onClick="selectColor('#00CC00')" height="10" width="10"></td>
+  <td bgcolor="#00FF00" onMouseOver="previewColor('#00FF00')" onClick="selectColor('#00FF00')" height="10" width="10"></td>
+  <td bgcolor="#330000" onMouseOver="previewColor('#330000')" onClick="selectColor('#330000')" height="10" width="10"></td>
+  <td bgcolor="#333300" onMouseOver="previewColor('#333300')" onClick="selectColor('#333300')" height="10" width="10"></td>
+  <td bgcolor="#336600" onMouseOver="previewColor('#336600')" onClick="selectColor('#336600')" height="10" width="10"></td>
+  <td bgcolor="#339900" onMouseOver="previewColor('#339900')" onClick="selectColor('#339900')" height="10" width="10"></td>
+  <td bgcolor="#33CC00" onMouseOver="previewColor('#33CC00')" onClick="selectColor('#33CC00')" height="10" width="10"></td>
+  <td bgcolor="#33FF00" onMouseOver="previewColor('#33FF00')" onClick="selectColor('#33FF00')" height="10" width="10"></td>
+  <td bgcolor="#660000" onMouseOver="previewColor('#660000')" onClick="selectColor('#660000')" height="10" width="10"></td>
+  <td bgcolor="#663300" onMouseOver="previewColor('#663300')" onClick="selectColor('#663300')" height="10" width="10"></td>
+  <td bgcolor="#666600" onMouseOver="previewColor('#666600')" onClick="selectColor('#666600')" height="10" width="10"></td>
+  <td bgcolor="#669900" onMouseOver="previewColor('#669900')" onClick="selectColor('#669900')" height="10" width="10"></td>
+  <td bgcolor="#66CC00" onMouseOver="previewColor('#66CC00')" onClick="selectColor('#66CC00')" height="10" width="10"></td>
+  <td bgcolor="#66FF00" onMouseOver="previewColor('#66FF00')" onClick="selectColor('#66FF00')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#333333" onMouseOver="previewColor('#333333')" onClick="selectColor('#333333')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#000033" onMouseOver="previewColor('#000033')" onClick="selectColor('#000033')" height="10" width="10"></td>
+  <td bgcolor="#003333" onMouseOver="previewColor('#003333')" onClick="selectColor('#003333')" height="10" width="10"></td>
+  <td bgcolor="#006633" onMouseOver="previewColor('#006633')" onClick="selectColor('#006633')" height="10" width="10"></td>
+  <td bgcolor="#009933" onMouseOver="previewColor('#009933')" onClick="selectColor('#009933')" height="10" width="10"></td>
+  <td bgcolor="#00CC33" onMouseOver="previewColor('#00CC33')" onClick="selectColor('#00CC33')" height="10" width="10"></td>
+  <td bgcolor="#00FF33" onMouseOver="previewColor('#00FF33')" onClick="selectColor('#00FF33')" height="10" width="10"></td>
+  <td bgcolor="#330033" onMouseOver="previewColor('#330033')" onClick="selectColor('#330033')" height="10" width="10"></td>
+  <td bgcolor="#333333" onMouseOver="previewColor('#333333')" onClick="selectColor('#333333')" height="10" width="10"></td>
+  <td bgcolor="#336633" onMouseOver="previewColor('#336633')" onClick="selectColor('#336633')" height="10" width="10"></td>
+  <td bgcolor="#339933" onMouseOver="previewColor('#339933')" onClick="selectColor('#339933')" height="10" width="10"></td>
+  <td bgcolor="#33CC33" onMouseOver="previewColor('#33CC33')" onClick="selectColor('#33CC33')" height="10" width="10"></td>
+  <td bgcolor="#33FF33" onMouseOver="previewColor('#33FF33')" onClick="selectColor('#33FF33')" height="10" width="10"></td>
+  <td bgcolor="#660033" onMouseOver="previewColor('#660033')" onClick="selectColor('#660033')" height="10" width="10"></td>
+  <td bgcolor="#663333" onMouseOver="previewColor('#663333')" onClick="selectColor('#663333')" height="10" width="10"></td>
+  <td bgcolor="#666633" onMouseOver="previewColor('#666633')" onClick="selectColor('#666633')" height="10" width="10"></td>
+  <td bgcolor="#669933" onMouseOver="previewColor('#669933')" onClick="selectColor('#669933')" height="10" width="10"></td>
+  <td bgcolor="#66CC33" onMouseOver="previewColor('#66CC33')" onClick="selectColor('#66CC33')" height="10" width="10"></td>
+  <td bgcolor="#66FF33" onMouseOver="previewColor('#66FF33')" onClick="selectColor('#66FF33')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#666666" onMouseOver="previewColor('#666666')" onClick="selectColor('#666666')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#000066" onMouseOver="previewColor('#000066')" onClick="selectColor('#000066')" height="10" width="10"></td>
+  <td bgcolor="#003366" onMouseOver="previewColor('#003366')" onClick="selectColor('#003366')" height="10" width="10"></td>
+  <td bgcolor="#006666" onMouseOver="previewColor('#006666')" onClick="selectColor('#006666')" height="10" width="10"></td>
+  <td bgcolor="#009966" onMouseOver="previewColor('#009966')" onClick="selectColor('#009966')" height="10" width="10"></td>
+  <td bgcolor="#00CC66" onMouseOver="previewColor('#00CC66')" onClick="selectColor('#00CC66')" height="10" width="10"></td>
+  <td bgcolor="#00FF66" onMouseOver="previewColor('#00FF66')" onClick="selectColor('#00FF66')" height="10" width="10"></td>
+  <td bgcolor="#330066" onMouseOver="previewColor('#330066')" onClick="selectColor('#330066')" height="10" width="10"></td>
+  <td bgcolor="#333366" onMouseOver="previewColor('#333366')" onClick="selectColor('#333366')" height="10" width="10"></td>
+  <td bgcolor="#336666" onMouseOver="previewColor('#336666')" onClick="selectColor('#336666')" height="10" width="10"></td>
+  <td bgcolor="#339966" onMouseOver="previewColor('#339966')" onClick="selectColor('#339966')" height="10" width="10"></td>
+  <td bgcolor="#33CC66" onMouseOver="previewColor('#33CC66')" onClick="selectColor('#33CC66')" height="10" width="10"></td>
+  <td bgcolor="#33FF66" onMouseOver="previewColor('#33FF66')" onClick="selectColor('#33FF66')" height="10" width="10"></td>
+  <td bgcolor="#660066" onMouseOver="previewColor('#660066')" onClick="selectColor('#660066')" height="10" width="10"></td>
+  <td bgcolor="#663366" onMouseOver="previewColor('#663366')" onClick="selectColor('#663366')" height="10" width="10"></td>
+  <td bgcolor="#666666" onMouseOver="previewColor('#666666')" onClick="selectColor('#666666')" height="10" width="10"></td>
+  <td bgcolor="#669966" onMouseOver="previewColor('#669966')" onClick="selectColor('#669966')" height="10" width="10"></td>
+  <td bgcolor="#66CC66" onMouseOver="previewColor('#66CC66')" onClick="selectColor('#66CC66')" height="10" width="10"></td>
+  <td bgcolor="#66FF66" onMouseOver="previewColor('#66FF66')" onClick="selectColor('#66FF66')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#999999" onMouseOver="previewColor('#999999')" onClick="selectColor('#999999')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#000099" onMouseOver="previewColor('#000099')" onClick="selectColor('#000099')" height="10" width="10"></td>
+  <td bgcolor="#003399" onMouseOver="previewColor('#003399')" onClick="selectColor('#003399')" height="10" width="10"></td>
+  <td bgcolor="#006699" onMouseOver="previewColor('#006699')" onClick="selectColor('#006699')" height="10" width="10"></td>
+  <td bgcolor="#009999" onMouseOver="previewColor('#009999')" onClick="selectColor('#009999')" height="10" width="10"></td>
+  <td bgcolor="#00CC99" onMouseOver="previewColor('#00CC99')" onClick="selectColor('#00CC99')" height="10" width="10"></td>
+  <td bgcolor="#00FF99" onMouseOver="previewColor('#00FF99')" onClick="selectColor('#00FF99')" height="10" width="10"></td>
+  <td bgcolor="#330099" onMouseOver="previewColor('#330099')" onClick="selectColor('#330099')" height="10" width="10"></td>
+  <td bgcolor="#333399" onMouseOver="previewColor('#333399')" onClick="selectColor('#333399')" height="10" width="10"></td>
+  <td bgcolor="#336699" onMouseOver="previewColor('#336699')" onClick="selectColor('#336699')" height="10" width="10"></td>
+  <td bgcolor="#339999" onMouseOver="previewColor('#339999')" onClick="selectColor('#339999')" height="10" width="10"></td>
+  <td bgcolor="#33CC99" onMouseOver="previewColor('#33CC99')" onClick="selectColor('#33CC99')" height="10" width="10"></td>
+  <td bgcolor="#33FF99" onMouseOver="previewColor('#33FF99')" onClick="selectColor('#33FF99')" height="10" width="10"></td>
+  <td bgcolor="#660099" onMouseOver="previewColor('#660099')" onClick="selectColor('#660099')" height="10" width="10"></td>
+  <td bgcolor="#663399" onMouseOver="previewColor('#663399')" onClick="selectColor('#663399')" height="10" width="10"></td>
+  <td bgcolor="#666699" onMouseOver="previewColor('#666699')" onClick="selectColor('#666699')" height="10" width="10"></td>
+  <td bgcolor="#669999" onMouseOver="previewColor('#669999')" onClick="selectColor('#669999')" height="10" width="10"></td>
+  <td bgcolor="#66CC99" onMouseOver="previewColor('#66CC99')" onClick="selectColor('#66CC99')" height="10" width="10"></td>
+  <td bgcolor="#66FF99" onMouseOver="previewColor('#66FF99')" onClick="selectColor('#66FF99')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#CCCCCC" onMouseOver="previewColor('#CCCCCC')" onClick="selectColor('#CCCCCC')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#0000CC" onMouseOver="previewColor('#0000CC')" onClick="selectColor('#0000CC')" height="10" width="10"></td>
+  <td bgcolor="#0033CC" onMouseOver="previewColor('#0033CC')" onClick="selectColor('#0033CC')" height="10" width="10"></td>
+  <td bgcolor="#0066CC" onMouseOver="previewColor('#0066CC')" onClick="selectColor('#0066CC')" height="10" width="10"></td>
+  <td bgcolor="#0099CC" onMouseOver="previewColor('#0099CC')" onClick="selectColor('#0099CC')" height="10" width="10"></td>
+  <td bgcolor="#00CCCC" onMouseOver="previewColor('#00CCCC')" onClick="selectColor('#00CCCC')" height="10" width="10"></td>
+  <td bgcolor="#00FFCC" onMouseOver="previewColor('#00FFCC')" onClick="selectColor('#00FFCC')" height="10" width="10"></td>
+  <td bgcolor="#3300CC" onMouseOver="previewColor('#3300CC')" onClick="selectColor('#3300CC')" height="10" width="10"></td>
+  <td bgcolor="#3333CC" onMouseOver="previewColor('#3333CC')" onClick="selectColor('#3333CC')" height="10" width="10"></td>
+  <td bgcolor="#3366CC" onMouseOver="previewColor('#3366CC')" onClick="selectColor('#3366CC')" height="10" width="10"></td>
+  <td bgcolor="#3399CC" onMouseOver="previewColor('#3399CC')" onClick="selectColor('#3399CC')" height="10" width="10"></td>
+  <td bgcolor="#33CCCC" onMouseOver="previewColor('#33CCCC')" onClick="selectColor('#33CCCC')" height="10" width="10"></td>
+  <td bgcolor="#33FFCC" onMouseOver="previewColor('#33FFCC')" onClick="selectColor('#33FFCC')" height="10" width="10"></td>
+  <td bgcolor="#6600CC" onMouseOver="previewColor('#6600CC')" onClick="selectColor('#6600CC')" height="10" width="10"></td>
+  <td bgcolor="#6633CC" onMouseOver="previewColor('#6633CC')" onClick="selectColor('#6633CC')" height="10" width="10"></td>
+  <td bgcolor="#6666CC" onMouseOver="previewColor('#6666CC')" onClick="selectColor('#6666CC')" height="10" width="10"></td>
+  <td bgcolor="#6699CC" onMouseOver="previewColor('#6699CC')" onClick="selectColor('#6699CC')" height="10" width="10"></td>
+  <td bgcolor="#66CCCC" onMouseOver="previewColor('#66CCCC')" onClick="selectColor('#66CCCC')" height="10" width="10"></td>
+  <td bgcolor="#66FFCC" onMouseOver="previewColor('#66FFCC')" onClick="selectColor('#66FFCC')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#FFFFFF" onMouseOver="previewColor('#FFFFFF')" onClick="selectColor('#FFFFFF')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#0000FF" onMouseOver="previewColor('#0000FF')" onClick="selectColor('#0000FF')" height="10" width="10"></td>
+  <td bgcolor="#0033FF" onMouseOver="previewColor('#0033FF')" onClick="selectColor('#0033FF')" height="10" width="10"></td>
+  <td bgcolor="#0066FF" onMouseOver="previewColor('#0066FF')" onClick="selectColor('#0066FF')" height="10" width="10"></td>
+  <td bgcolor="#0099FF" onMouseOver="previewColor('#0099FF')" onClick="selectColor('#0099FF')" height="10" width="10"></td>
+  <td bgcolor="#00CCFF" onMouseOver="previewColor('#00CCFF')" onClick="selectColor('#00CCFF')" height="10" width="10"></td>
+  <td bgcolor="#00FFFF" onMouseOver="previewColor('#00FFFF')" onClick="selectColor('#00FFFF')" height="10" width="10"></td>
+  <td bgcolor="#3300FF" onMouseOver="previewColor('#3300FF')" onClick="selectColor('#3300FF')" height="10" width="10"></td>
+  <td bgcolor="#3333FF" onMouseOver="previewColor('#3333FF')" onClick="selectColor('#3333FF')" height="10" width="10"></td>
+  <td bgcolor="#3366FF" onMouseOver="previewColor('#3366FF')" onClick="selectColor('#3366FF')" height="10" width="10"></td>
+  <td bgcolor="#3399FF" onMouseOver="previewColor('#3399FF')" onClick="selectColor('#3399FF')" height="10" width="10"></td>
+  <td bgcolor="#33CCFF" onMouseOver="previewColor('#33CCFF')" onClick="selectColor('#33CCFF')" height="10" width="10"></td>
+  <td bgcolor="#33FFFF" onMouseOver="previewColor('#33FFFF')" onClick="selectColor('#33FFFF')" height="10" width="10"></td>
+  <td bgcolor="#6600FF" onMouseOver="previewColor('#6600FF')" onClick="selectColor('#6600FF')" height="10" width="10"></td>
+  <td bgcolor="#6633FF" onMouseOver="previewColor('#6633FF')" onClick="selectColor('#6633FF')" height="10" width="10"></td>
+  <td bgcolor="#6666FF" onMouseOver="previewColor('#6666FF')" onClick="selectColor('#6666FF')" height="10" width="10"></td>
+  <td bgcolor="#6699FF" onMouseOver="previewColor('#6699FF')" onClick="selectColor('#6699FF')" height="10" width="10"></td>
+  <td bgcolor="#66CCFF" onMouseOver="previewColor('#66CCFF')" onClick="selectColor('#66CCFF')" height="10" width="10"></td>
+  <td bgcolor="#66FFFF" onMouseOver="previewColor('#66FFFF')" onClick="selectColor('#66FFFF')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#FF0000" onMouseOver="previewColor('#FF0000')" onClick="selectColor('#FF0000')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#990000" onMouseOver="previewColor('#990000')" onClick="selectColor('#990000')" height="10" width="10"></td>
+  <td bgcolor="#993300" onMouseOver="previewColor('#993300')" onClick="selectColor('#993300')" height="10" width="10"></td>
+  <td bgcolor="#996600" onMouseOver="previewColor('#996600')" onClick="selectColor('#996600')" height="10" width="10"></td>
+  <td bgcolor="#999900" onMouseOver="previewColor('#999900')" onClick="selectColor('#999900')" height="10" width="10"></td>
+  <td bgcolor="#99CC00" onMouseOver="previewColor('#99CC00')" onClick="selectColor('#99CC00')" height="10" width="10"></td>
+  <td bgcolor="#99FF00" onMouseOver="previewColor('#99FF00')" onClick="selectColor('#99FF00')" height="10" width="10"></td>
+  <td bgcolor="#CC0000" onMouseOver="previewColor('#CC0000')" onClick="selectColor('#CC0000')" height="10" width="10"></td>
+  <td bgcolor="#CC3300" onMouseOver="previewColor('#CC3300')" onClick="selectColor('#CC3300')" height="10" width="10"></td>
+  <td bgcolor="#CC6600" onMouseOver="previewColor('#CC6600')" onClick="selectColor('#CC6600')" height="10" width="10"></td>
+  <td bgcolor="#CC9900" onMouseOver="previewColor('#CC9900')" onClick="selectColor('#CC9900')" height="10" width="10"></td>
+  <td bgcolor="#CCCC00" onMouseOver="previewColor('#CCCC00')" onClick="selectColor('#CCCC00')" height="10" width="10"></td>
+  <td bgcolor="#CCFF00" onMouseOver="previewColor('#CCFF00')" onClick="selectColor('#CCFF00')" height="10" width="10"></td>
+  <td bgcolor="#FF0000" onMouseOver="previewColor('#FF0000')" onClick="selectColor('#FF0000')" height="10" width="10"></td>
+  <td bgcolor="#FF3300" onMouseOver="previewColor('#FF3300')" onClick="selectColor('#FF3300')" height="10" width="10"></td>
+  <td bgcolor="#FF6600" onMouseOver="previewColor('#FF6600')" onClick="selectColor('#FF6600')" height="10" width="10"></td>
+  <td bgcolor="#FF9900" onMouseOver="previewColor('#FF9900')" onClick="selectColor('#FF9900')" height="10" width="10"></td>
+  <td bgcolor="#FFCC00" onMouseOver="previewColor('#FFCC00')" onClick="selectColor('#FFCC00')" height="10" width="10"></td>
+  <td bgcolor="#FFFF00" onMouseOver="previewColor('#FFFF00')" onClick="selectColor('#FFFF00')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#00FF00" onMouseOver="previewColor('#00FF00')" onClick="selectColor('#00FF00')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#990033" onMouseOver="previewColor('#990033')" onClick="selectColor('#990033')" height="10" width="10"></td>
+  <td bgcolor="#993333" onMouseOver="previewColor('#993333')" onClick="selectColor('#993333')" height="10" width="10"></td>
+  <td bgcolor="#996633" onMouseOver="previewColor('#996633')" onClick="selectColor('#996633')" height="10" width="10"></td>
+  <td bgcolor="#999933" onMouseOver="previewColor('#999933')" onClick="selectColor('#999933')" height="10" width="10"></td>
+  <td bgcolor="#99CC33" onMouseOver="previewColor('#99CC33')" onClick="selectColor('#99CC33')" height="10" width="10"></td>
+  <td bgcolor="#99FF33" onMouseOver="previewColor('#99FF33')" onClick="selectColor('#99FF33')" height="10" width="10"></td>
+  <td bgcolor="#CC0033" onMouseOver="previewColor('#CC0033')" onClick="selectColor('#CC0033')" height="10" width="10"></td>
+  <td bgcolor="#CC3333" onMouseOver="previewColor('#CC3333')" onClick="selectColor('#CC3333')" height="10" width="10"></td>
+  <td bgcolor="#CC6633" onMouseOver="previewColor('#CC6633')" onClick="selectColor('#CC6633')" height="10" width="10"></td>
+  <td bgcolor="#CC9933" onMouseOver="previewColor('#CC9933')" onClick="selectColor('#CC9933')" height="10" width="10"></td>
+  <td bgcolor="#CCCC33" onMouseOver="previewColor('#CCCC33')" onClick="selectColor('#CCCC33')" height="10" width="10"></td>
+  <td bgcolor="#CCFF33" onMouseOver="previewColor('#CCFF33')" onClick="selectColor('#CCFF33')" height="10" width="10"></td>
+  <td bgcolor="#FF0033" onMouseOver="previewColor('#FF0033')" onClick="selectColor('#FF0033')" height="10" width="10"></td>
+  <td bgcolor="#FF3333" onMouseOver="previewColor('#FF3333')" onClick="selectColor('#FF3333')" height="10" width="10"></td>
+  <td bgcolor="#FF6633" onMouseOver="previewColor('#FF6633')" onClick="selectColor('#FF6633')" height="10" width="10"></td>
+  <td bgcolor="#FF9933" onMouseOver="previewColor('#FF9933')" onClick="selectColor('#FF9933')" height="10" width="10"></td>
+  <td bgcolor="#FFCC33" onMouseOver="previewColor('#FFCC33')" onClick="selectColor('#FFCC33')" height="10" width="10"></td>
+  <td bgcolor="#FFFF33" onMouseOver="previewColor('#FFFF33')" onClick="selectColor('#FFFF33')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#0000FF" onMouseOver="previewColor('#0000FF')" onClick="selectColor('#0000FF')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#990066" onMouseOver="previewColor('#990066')" onClick="selectColor('#990066')" height="10" width="10"></td>
+  <td bgcolor="#993366" onMouseOver="previewColor('#993366')" onClick="selectColor('#993366')" height="10" width="10"></td>
+  <td bgcolor="#996666" onMouseOver="previewColor('#996666')" onClick="selectColor('#996666')" height="10" width="10"></td>
+  <td bgcolor="#999966" onMouseOver="previewColor('#999966')" onClick="selectColor('#999966')" height="10" width="10"></td>
+  <td bgcolor="#99CC66" onMouseOver="previewColor('#99CC66')" onClick="selectColor('#99CC66')" height="10" width="10"></td>
+  <td bgcolor="#99FF66" onMouseOver="previewColor('#99FF66')" onClick="selectColor('#99FF66')" height="10" width="10"></td>
+  <td bgcolor="#CC0066" onMouseOver="previewColor('#CC0066')" onClick="selectColor('#CC0066')" height="10" width="10"></td>
+  <td bgcolor="#CC3366" onMouseOver="previewColor('#CC3366')" onClick="selectColor('#CC3366')" height="10" width="10"></td>
+  <td bgcolor="#CC6666" onMouseOver="previewColor('#CC6666')" onClick="selectColor('#CC6666')" height="10" width="10"></td>
+  <td bgcolor="#CC9966" onMouseOver="previewColor('#CC9966')" onClick="selectColor('#CC9966')" height="10" width="10"></td>
+  <td bgcolor="#CCCC66" onMouseOver="previewColor('#CCCC66')" onClick="selectColor('#CCCC66')" height="10" width="10"></td>
+  <td bgcolor="#CCFF66" onMouseOver="previewColor('#CCFF66')" onClick="selectColor('#CCFF66')" height="10" width="10"></td>
+  <td bgcolor="#FF0066" onMouseOver="previewColor('#FF0066')" onClick="selectColor('#FF0066')" height="10" width="10"></td>
+  <td bgcolor="#FF3366" onMouseOver="previewColor('#FF3366')" onClick="selectColor('#FF3366')" height="10" width="10"></td>
+  <td bgcolor="#FF6666" onMouseOver="previewColor('#FF6666')" onClick="selectColor('#FF6666')" height="10" width="10"></td>
+  <td bgcolor="#FF9966" onMouseOver="previewColor('#FF9966')" onClick="selectColor('#FF9966')" height="10" width="10"></td>
+  <td bgcolor="#FFCC66" onMouseOver="previewColor('#FFCC66')" onClick="selectColor('#FFCC66')" height="10" width="10"></td>
+  <td bgcolor="#FFFF66" onMouseOver="previewColor('#FFFF66')" onClick="selectColor('#FFFF66')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#FFFF00" onMouseOver="previewColor('#FFFF00')" onClick="selectColor('#FFFF00')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#990099" onMouseOver="previewColor('#990099')" onClick="selectColor('#990099')" height="10" width="10"></td>
+  <td bgcolor="#993399" onMouseOver="previewColor('#993399')" onClick="selectColor('#993399')" height="10" width="10"></td>
+  <td bgcolor="#996699" onMouseOver="previewColor('#996699')" onClick="selectColor('#996699')" height="10" width="10"></td>
+  <td bgcolor="#999999" onMouseOver="previewColor('#999999')" onClick="selectColor('#999999')" height="10" width="10"></td>
+  <td bgcolor="#99CC99" onMouseOver="previewColor('#99CC99')" onClick="selectColor('#99CC99')" height="10" width="10"></td>
+  <td bgcolor="#99FF99" onMouseOver="previewColor('#99FF99')" onClick="selectColor('#99FF99')" height="10" width="10"></td>
+  <td bgcolor="#CC0099" onMouseOver="previewColor('#CC0099')" onClick="selectColor('#CC0099')" height="10" width="10"></td>
+  <td bgcolor="#CC3399" onMouseOver="previewColor('#CC3399')" onClick="selectColor('#CC3399')" height="10" width="10"></td>
+  <td bgcolor="#CC6699" onMouseOver="previewColor('#CC6699')" onClick="selectColor('#CC6699')" height="10" width="10"></td>
+  <td bgcolor="#CC9999" onMouseOver="previewColor('#CC9999')" onClick="selectColor('#CC9999')" height="10" width="10"></td>
+  <td bgcolor="#CCCC99" onMouseOver="previewColor('#CCCC99')" onClick="selectColor('#CCCC99')" height="10" width="10"></td>
+  <td bgcolor="#CCFF99" onMouseOver="previewColor('#CCFF99')" onClick="selectColor('#CCFF99')" height="10" width="10"></td>
+  <td bgcolor="#FF0099" onMouseOver="previewColor('#FF0099')" onClick="selectColor('#FF0099')" height="10" width="10"></td>
+  <td bgcolor="#FF3399" onMouseOver="previewColor('#FF3399')" onClick="selectColor('#FF3399')" height="10" width="10"></td>
+  <td bgcolor="#FF6699" onMouseOver="previewColor('#FF6699')" onClick="selectColor('#FF6699')" height="10" width="10"></td>
+  <td bgcolor="#FF9999" onMouseOver="previewColor('#FF9999')" onClick="selectColor('#FF9999')" height="10" width="10"></td>
+  <td bgcolor="#FFCC99" onMouseOver="previewColor('#FFCC99')" onClick="selectColor('#FFCC99')" height="10" width="10"></td>
+  <td bgcolor="#FFFF99" onMouseOver="previewColor('#FFFF99')" onClick="selectColor('#FFFF99')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#00FFFF" onMouseOver="previewColor('#00FFFF')" onClick="selectColor('#00FFFF')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#9900CC" onMouseOver="previewColor('#9900CC')" onClick="selectColor('#9900CC')" height="10" width="10"></td>
+  <td bgcolor="#9933CC" onMouseOver="previewColor('#9933CC')" onClick="selectColor('#9933CC')" height="10" width="10"></td>
+  <td bgcolor="#9966CC" onMouseOver="previewColor('#9966CC')" onClick="selectColor('#9966CC')" height="10" width="10"></td>
+  <td bgcolor="#9999CC" onMouseOver="previewColor('#9999CC')" onClick="selectColor('#9999CC')" height="10" width="10"></td>
+  <td bgcolor="#99CCCC" onMouseOver="previewColor('#99CCCC')" onClick="selectColor('#99CCCC')" height="10" width="10"></td>
+  <td bgcolor="#99FFCC" onMouseOver="previewColor('#99FFCC')" onClick="selectColor('#99FFCC')" height="10" width="10"></td>
+  <td bgcolor="#CC00CC" onMouseOver="previewColor('#CC00CC')" onClick="selectColor('#CC00CC')" height="10" width="10"></td>
+  <td bgcolor="#CC33CC" onMouseOver="previewColor('#CC33CC')" onClick="selectColor('#CC33CC')" height="10" width="10"></td>
+  <td bgcolor="#CC66CC" onMouseOver="previewColor('#CC66CC')" onClick="selectColor('#CC66CC')" height="10" width="10"></td>
+  <td bgcolor="#CC99CC" onMouseOver="previewColor('#CC99CC')" onClick="selectColor('#CC99CC')" height="10" width="10"></td>
+  <td bgcolor="#CCCCCC" onMouseOver="previewColor('#CCCCCC')" onClick="selectColor('#CCCCCC')" height="10" width="10"></td>
+  <td bgcolor="#CCFFCC" onMouseOver="previewColor('#CCFFCC')" onClick="selectColor('#CCFFCC')" height="10" width="10"></td>
+  <td bgcolor="#FF00CC" onMouseOver="previewColor('#FF00CC')" onClick="selectColor('#FF00CC')" height="10" width="10"></td>
+  <td bgcolor="#FF33CC" onMouseOver="previewColor('#FF33CC')" onClick="selectColor('#FF33CC')" height="10" width="10"></td>
+  <td bgcolor="#FF66CC" onMouseOver="previewColor('#FF66CC')" onClick="selectColor('#FF66CC')" height="10" width="10"></td>
+  <td bgcolor="#FF99CC" onMouseOver="previewColor('#FF99CC')" onClick="selectColor('#FF99CC')" height="10" width="10"></td>
+  <td bgcolor="#FFCCCC" onMouseOver="previewColor('#FFCCCC')" onClick="selectColor('#FFCCCC')" height="10" width="10"></td>
+  <td bgcolor="#FFFFCC" onMouseOver="previewColor('#FFFFCC')" onClick="selectColor('#FFFFCC')" height="10" width="10"></td>
+ </tr>
+ <tr>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#FF00FF" onMouseOver="previewColor('#FF00FF')" onClick="selectColor('#FF00FF')" height="10" width="10"></td>
+  <td bgcolor="#000000" onMouseOver="previewColor('#000000')" onClick="selectColor('#000000')" height="10" width="10"></td>
+  <td bgcolor="#9900FF" onMouseOver="previewColor('#9900FF')" onClick="selectColor('#9900FF')" height="10" width="10"></td>
+  <td bgcolor="#9933FF" onMouseOver="previewColor('#9933FF')" onClick="selectColor('#9933FF')" height="10" width="10"></td>
+  <td bgcolor="#9966FF" onMouseOver="previewColor('#9966FF')" onClick="selectColor('#9966FF')" height="10" width="10"></td>
+  <td bgcolor="#9999FF" onMouseOver="previewColor('#9999FF')" onClick="selectColor('#9999FF')" height="10" width="10"></td>
+  <td bgcolor="#99CCFF" onMouseOver="previewColor('#99CCFF')" onClick="selectColor('#99CCFF')" height="10" width="10"></td>
+  <td bgcolor="#99FFFF" onMouseOver="previewColor('#99FFFF')" onClick="selectColor('#99FFFF')" height="10" width="10"></td>
+  <td bgcolor="#CC00FF" onMouseOver="previewColor('#CC00FF')" onClick="selectColor('#CC00FF')" height="10" width="10"></td>
+  <td bgcolor="#CC33FF" onMouseOver="previewColor('#CC33FF')" onClick="selectColor('#CC33FF')" height="10" width="10"></td>
+  <td bgcolor="#CC66FF" onMouseOver="previewColor('#CC66FF')" onClick="selectColor('#CC66FF')" height="10" width="10"></td>
+  <td bgcolor="#CC99FF" onMouseOver="previewColor('#CC99FF')" onClick="selectColor('#CC99FF')" height="10" width="10"></td>
+  <td bgcolor="#CCCCFF" onMouseOver="previewColor('#CCCCFF')" onClick="selectColor('#CCCCFF')" height="10" width="10"></td>
+  <td bgcolor="#CCFFFF" onMouseOver="previewColor('#CCFFFF')" onClick="selectColor('#CCFFFF')" height="10" width="10"></td>
+  <td bgcolor="#FF00FF" onMouseOver="previewColor('#FF00FF')" onClick="selectColor('#FF00FF')" height="10" width="10"></td>
+  <td bgcolor="#FF33FF" onMouseOver="previewColor('#FF33FF')" onClick="selectColor('#FF33FF')" height="10" width="10"></td>
+  <td bgcolor="#FF66FF" onMouseOver="previewColor('#FF66FF')" onClick="selectColor('#FF66FF')" height="10" width="10"></td>
+  <td bgcolor="#FF99FF" onMouseOver="previewColor('#FF99FF')" onClick="selectColor('#FF99FF')" height="10" width="10"></td>
+  <td bgcolor="#FFCCFF" onMouseOver="previewColor('#FFCCFF')" onClick="selectColor('#FFCCFF')" height="10" width="10"></td>
+  <td bgcolor="#FFFFFF" onMouseOver="previewColor('#FFFFFF')" onClick="selectColor('#FFFFFF')" height="10" width="10"></td>
+ </tr>
+</table>
+</center>
+</body>
+</html>
+
diff --git a/openwysiwyg/scripts/wysiwyg-color.js b/openwysiwyg/scripts/wysiwyg-color.js
new file mode 100644 (file)
index 0000000..fbc2a9e
--- /dev/null
@@ -0,0 +1,137 @@
+/********************************************************************
+ * openWYSIWYG color chooser Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ *
+ * $Id: wysiwyg-color.js,v 1.1 2007/01/29 19:19:49 xhaggi Exp $
+ ********************************************************************/
+function WYSIWYG_Color() {
+       
+       // colors
+       var COLORS = new Array(
+               "#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","#00CCFF","#993366",
+               "#C0C0C0","#FF99CC","#FFCC99","#FFFF99","#CCFFCC","#CCFFFF",
+               "#99CCFF","#666699","#777777","#999999","#EEEEEE","#FFFFFF"     
+       );
+       
+       // div id of the color table
+       var CHOOSER_DIV_ID = "colorpicker-div";
+
+       /**
+        * Init the color picker
+        */
+       this.init = function() {
+               var div = document.createElement("DIV");
+               div.id = CHOOSER_DIV_ID;
+               div.style.position = "absolute";
+               div.style.visibility = "hidden";                
+               document.body.appendChild(div);
+       };
+       
+       
+       /**
+        * Open the color chooser to choose a color.
+        * 
+        * @param {String} element Element identifier 
+        */
+       this.choose = function(element) {
+               var div = document.getElementById(CHOOSER_DIV_ID);
+               if(div == null) {
+                       alert("Initialisation of color picker failed.");
+                       return;
+               }
+                               
+               // writes the content of the color picker
+               write(element);
+                                                               
+               // Display color picker
+               var x = window.event.clientX + document.body.scrollLeft;
+               var y = window.event.clientY + document.body.scrollTop;
+               var winsize = windowSize();
+               if(x + div.offsetWidth > winsize.width) x = winsize.width - div.offsetWidth - 5;
+               if(y + div.offsetHeight > winsize.height) y = winsize.height - div.offsetHeight - 5;
+               div.style.left = x + "px";
+               div.style.top = y + "px";
+               div.style.visibility = "visible";                               
+       };
+       
+       /**
+        * Set the color in the given field
+        *
+        * @param {String} n Element identifier
+        * @param {String} color HexColor String
+        */
+       this.select = function(n, color) {
+               var div = document.getElementById(CHOOSER_DIV_ID);
+               var elm = document.getElementById(n);
+               elm.value = color;
+               elm.style.color = color;
+               elm.style.backgroundColor = color;
+               div.style.visibility = "hidden";
+       }
+       
+       
+       /**
+        * Write the color table
+        * @param {String} n Element identifier
+        * @private
+        */
+       function write(n) {
+               
+               var div = document.getElementById(CHOOSER_DIV_ID);
+               
+               var output = "";
+               output += '<table border="1" cellpadding="0" cellspacing="0" class="wysiwyg-color-picker-table"><tr>';
+               for(var i = 0; i < COLORS.length;i++) {
+                       var color = COLORS[i];
+                       output += '<td class="selectColorBorder" ';
+                       output += 'onmouseover="this.className=\'selectColorOn\';" ';
+                       output += 'onmouseout="this.className=\'selectColorOff\';" ';
+                       output += 'onclick="WYSIWYG_ColorInst.select(\'' + n + '\', \'' + color + '\');"> ';
+                       output += '<div style="background-color:' + color + ';" class="wysiwyg-color-picker-div">&nbsp;</div> ';
+                       output += '</td>';
+                       
+                       if(((i+1) % Math.round(Math.sqrt(COLORS.length))) == 0) {
+                               output += "</tr><tr>";
+                       }
+               }
+               
+               output += '</tr></table>';      
+               
+               // write to div element
+               div.innerHTML = output;
+       };
+       
+       /**
+        * Set the window.event on Mozilla Browser
+        * @private
+        */
+       function _event_tracker(event) { 
+               if (!document.all && document.getElementById) {
+                       window.event = event;
+               }
+       }       
+       document.onmousedown = _event_tracker;
+       
+       /**
+        * Get the window size
+        * @private
+        */
+       function windowSize() {
+               if (window.innerWidth) {
+                       return {width: window.innerWidth, height: window.innerHeight};
+               } 
+               else if (document.body && document.body.offsetWidth) {
+                       return {width: document.body.offsetWidth, height: document.body.offsetHeight};
+               } 
+               else {
+                       return {width: 0, height: 0};
+               }
+       }
+}
+
+var WYSIWYG_ColorInst = new WYSIWYG_Color();
\ No newline at end of file
diff --git a/openwysiwyg/scripts/wysiwyg-popup.js b/openwysiwyg/scripts/wysiwyg-popup.js
new file mode 100644 (file)
index 0000000..163731c
--- /dev/null
@@ -0,0 +1,38 @@
+/********************************************************************
+ * openWYSIWYG popup functions Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ *
+ * $Id: wysiwyg-popup.js,v 1.2 2007/01/22 23:45:30 xhaggi Exp $
+ ********************************************************************/
+var WYSIWYG_Popup = {
+
+       /**
+        * Return the value of an given URL parameter.
+        * 
+        * @param param Parameter
+        * @return Value of the given parameter
+        */
+       getParam: function(param) {
+         var query = window.location.search.substring(1);
+         var parms = query.split('&');
+         for (var i=0; i<parms.length; i++) {
+           var pos = parms[i].indexOf('=');
+           if (pos > 0) {
+              var key = parms[i].substring(0,pos).toLowerCase();
+              var val = parms[i].substring(pos+1);
+              if(key == param.toLowerCase()) 
+               return val;
+           }
+         }
+         return null;
+       }
+}
+
+// close the popup if the opener does not hold the WYSIWYG object
+if(!window.opener) window.close();
+
+// bind objects on local vars
+var WYSIWYG = window.opener.WYSIWYG;   
+var WYSIWYG_Core = window.opener.WYSIWYG_Core;
+var WYSIWYG_Table = window.opener.WYSIWYG_Table;
\ No newline at end of file
diff --git a/openwysiwyg/scripts/wysiwyg-settings.js b/openwysiwyg/scripts/wysiwyg-settings.js
new file mode 100644 (file)
index 0000000..993b67a
--- /dev/null
@@ -0,0 +1,36 @@
+/********************************************************************
+ * openWYSIWYG settings file Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ *
+ * $Id: wysiwyg-settings.js,v 1.4 2007/01/22 23:05:57 xhaggi Exp $
+ ********************************************************************/
+
+/*
+ * Full featured setup used the openImageLibrary addon
+ */
+var full = new WYSIWYG.Settings();
+//full.ImagesDir = "images/";
+//full.PopupsDir = "popups/";
+//full.CSSFile = "styles/wysiwyg.css";
+full.Width = "85%"; 
+full.Height = "250px";
+// customize toolbar buttons
+full.addToolbarElement("font", 3, 1); 
+full.addToolbarElement("fontsize", 3, 2);
+full.addToolbarElement("headings", 3, 3);
+// openImageLibrary addon implementation
+full.ImagePopupFile = "addons/imagelibrary/insert_image.php";
+full.ImagePopupWidth = 600;
+full.ImagePopupHeight = 245;
+
+/*
+ * Small Setup Example
+ */
+var small = new WYSIWYG.Settings();
+small.Width = "350px";
+small.Height = "100px";
+small.DefaultStyle = "font-family: Arial; font-size: 12px; background-color: #AA99AA";
+small.Toolbar[0] = new Array("font", "fontsize", "bold", "italic", "underline"); // small setup for toolbar 1
+small.Toolbar[1] = ""; // disable toolbar 2
+small.StatusBarEnabled = false;
diff --git a/openwysiwyg/scripts/wysiwyg.js b/openwysiwyg/scripts/wysiwyg.js
new file mode 100644 (file)
index 0000000..31d5d38
--- /dev/null
@@ -0,0 +1,2892 @@
+/********************************************************************
+ * openWYSIWYG v1.47 Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ *
+ * $Id: wysiwyg.js,v 1.22 2007/09/08 21:45:57 xhaggi Exp $
+ * $Revision: 1.22 $
+ *
+ * An open source WYSIWYG editor for use in web based applications.
+ * For full source code and docs, visit http://www.openwebware.com
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc., 59
+ * Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ********************************************************************/
+var WYSIWYG = {
+
+    /**
+     * Settings class, holds all customizeable properties
+     */
+    Settings: function(){
+    
+        // Images Directory
+        this.ImagesDir = "./openwysiwyg/images/";
+        
+        // Popups Directory
+        this.PopupsDir = "./openwysiwyg/popups/";
+        
+        // CSS Directory File
+        this.CSSFile = "./openwysiwyg/styles/wysiwyg.css";
+        
+        // Default WYSIWYG width and height (use px or %)
+        this.Width = "500px";
+        this.Height = "300px";
+        
+        // Default stylesheet of the WYSIWYG editor window
+        this.DefaultStyle = "font-family: Arial; font-size: 12px; background-color: #FFFFFF";
+        
+        // Stylesheet if editor is disabled
+        this.DisabledStyle = "font-family: Arial; font-size: 12px; background-color: #EEEEEE";
+        
+        // Width + Height of the preview window
+        this.PreviewWidth = 500;
+        this.PreviewHeight = 400;
+        
+        // Confirmation message if you strip any HTML added by word
+        this.RemoveFormatConfMessage = "Clean HTML inserted by MS Word ?";
+        
+        // Nofication if browser is not supported by openWYSIWYG, leave it blank for no message output.
+        this.NoValidBrowserMessage = "openWYSIWYG does not support your browser.";
+        
+        // Anchor path to strip, leave it blank to ignore
+        // or define auto to strip the path where the editor is placed 
+        // (only IE)
+        this.AnchorPathToStrip = "auto";
+        
+        // Image path to strip, leave it blank to ignore
+        // or define auto to strip the path where the editor is placed 
+        // (only IE)
+        this.ImagePathToStrip = "auto";
+        
+        // Enable / Disable the custom context menu
+        this.ContextMenu = true;
+        
+        // Enabled the status bar update. Within the status bar 
+        // node tree of the actually selected element will build
+        this.StatusBarEnabled = true;
+        
+        // If enabled than the capability of the IE inserting line breaks will be inverted.
+        // Normal: ENTER = <p> , SHIFT + ENTER = <br>
+        // Inverted: ENTER = <br>, SHIFT + ENTER = <p>
+        this.InvertIELineBreaks = false;
+        
+        // Replace line breaks with <br> tags
+        this.ReplaceLineBreaks = false;
+        
+        // Page that opened the WYSIWYG (Used for the return command)
+        this.Opener = "admin.asp";
+        
+        // Insert image implementation
+        this.ImagePopupFile = "";
+        this.ImagePopupWidth = 0;
+        this.ImagePopupHeight = 0;
+        
+        // Holds the available buttons displayed 
+        // on the toolbar of the editor
+        this.Toolbar = new Array();
+        this.Toolbar[0] = new Array("font", "fontsize", "headings", "bold", "italic", "underline", "strikethrough", "seperator", "forecolor", "backcolor", "seperator", "justifyfull", "justifyleft", "justifycenter", "justifyright", "seperator", "unorderedlist", "orderedlist", "outdent", "indent");
+        this.Toolbar[1] = new Array("save", // "return",  // return button disabled by default
+ "seperator", "subscript", "superscript", "seperator", "cut", "copy", "paste", "removeformat", "seperator", "undo", "redo", "seperator", "inserttable", "insertimage", "createlink", "seperator", "preview", "print", "seperator", "viewSource", "maximize", "seperator", "help");
+        
+        // DropDowns
+        this.DropDowns = new Array();
+        // Fonts
+        this.DropDowns['font'] = {
+            id: "fonts",
+            command: "FontName",
+            label: "<font style=\"font-family:{value};font-size:12px;\">{value}</font>",
+            width: "90px",
+            elements: new Array("Arial", "Sans Serif", "Tahoma", "Verdana", "Courier New", "Georgia", "Times New Roman", "Impact", "Comic Sans MS")
+        };
+        // Font sizes
+        this.DropDowns['fontsize'] = {
+            id: "fontsizes",
+            command: "FontSize",
+            label: "<font size=\"{value}\">Size {value}</font>",
+            width: "54px",
+            elements: new Array("1", "2", "3", "4", "5", "6", "7")
+        };
+        // Headings
+        this.DropDowns['headings'] = {
+            id: "headings",
+            command: "FormatBlock",
+            label: "<{value} style=\"margin:0px;text-decoration:none;font-family:Arial\">{value}</{value}>",
+            width: "74px",
+            elements: new Array("H1", "H2", "H3", "H4", "H5", "H6")
+        };
+        
+        // Add the given element to the defined toolbar
+        // on the defined position
+        this.addToolbarElement = function(element, toolbar, position){
+            if (element != "seperator") {
+                this.removeToolbarElement(element);
+            }
+            if (this.Toolbar[toolbar - 1] == null) {
+                this.Toolbar[toolbar - 1] = new Array();
+            }
+            this.Toolbar[toolbar - 1].splice(position + 1, 1, element);
+        };
+        
+        // Remove an element from the toolbar
+        this.removeToolbarElement = function(element){
+            if (element == "seperator") {
+                return;
+            } // do not remove seperators
+            for (var i = 0; i < this.Toolbar.length; i++) {
+                if (this.Toolbar[i]) {
+                    var toolbar = this.Toolbar[i];
+                    for (var j = 0; j < toolbar.length; j++) {
+                        if (toolbar[j] != null && toolbar[j] == element) {
+                            this.Toolbar[i].splice(j, 1);
+                        }
+                    }
+                }
+            }
+        };
+        
+        // clear all or a given toolbar
+        this.clearToolbar = function(toolbar){
+            if (typeof toolbar == "undefined") {
+                this.Toolbar = new Array();
+            }
+            else {
+                this.Toolbar[toolbar + 1] = new Array();
+            }
+        };
+        
+    },
+    
+    
+    /* ---------------------------------------------------------------------- *\
+     !! Do not change something below or you know what you are doning !!
+     \* ---------------------------------------------------------------------- */
+    // List of available block formats (not in use)
+    //BlockFormats: new Array("Address", "Bulleted List", "Definition", "Definition Term", "Directory List", "Formatted", "Heading 1", "Heading 2", "Heading 3", "Heading 4", "Heading 5", "Heading 6", "Menu List", "Normal", "Numbered List"),
+    
+    // List of available actions and their respective ID and images
+    ToolbarList: {
+        //Name              buttonID               buttonTitle                 buttonImage               buttonImageRollover
+        "bold": ['Bold', 'Bold', 'bold.gif', 'bold_on.gif'],
+        "italic": ['Italic', 'Italic', 'italics.gif', 'italics_on.gif'],
+        "underline": ['Underline', 'Underline', 'underline.gif', 'underline_on.gif'],
+        "strikethrough": ['Strikethrough', 'Strikethrough', 'strikethrough.gif', 'strikethrough_on.gif'],
+        "seperator": ['', '', 'seperator.gif', 'seperator.gif'],
+        "subscript": ['Subscript', 'Subscript', 'subscript.gif', 'subscript_on.gif'],
+        "superscript": ['Superscript', 'Superscript', 'superscript.gif', 'superscript_on.gif'],
+        "justifyleft": ['Justifyleft', 'Justifyleft', 'justify_left.gif', 'justify_left_on.gif'],
+        "justifycenter": ['Justifycenter', 'Justifycenter', 'justify_center.gif', 'justify_center_on.gif'],
+        "justifyright": ['Justifyright', 'Justifyright', 'justify_right.gif', 'justify_right_on.gif'],
+        "justifyfull": ['Justifyfull', 'Justifyfull', 'justify_justify.gif', 'justify_justify_on.gif'],
+        "unorderedlist": ['InsertUnorderedList', 'Insert Unordered List', 'list_unordered.gif', 'list_unordered_on.gif'],
+        "orderedlist": ['InsertOrderedList', 'Insert Ordered List', 'list_ordered.gif', 'list_ordered_on.gif'],
+        "outdent": ['Outdent', 'Outdent', 'indent_left.gif', 'indent_left_on.gif'],
+        "indent": ['Indent', 'Indent', 'indent_right.gif', 'indent_right_on.gif'],
+        "cut": ['Cut', 'Cut', 'cut.gif', 'cut_on.gif'],
+        "copy": ['Copy', 'Copy', 'copy.gif', 'copy_on.gif'],
+        "paste": ['Paste', 'Paste', 'paste.gif', 'paste_on.gif'],
+        "forecolor": ['ForeColor', 'Fore Color', 'forecolor.gif', 'forecolor_on.gif'],
+        "backcolor": ['BackColor', 'Back Color', 'backcolor.gif', 'backcolor_on.gif'],
+        "undo": ['Undo', 'Undo', 'undo.gif', 'undo_on.gif'],
+        "redo": ['Redo', 'Redo', 'redo.gif', 'redo_on.gif'],
+        "inserttable": ['InsertTable', 'Insert Table', 'insert_table.gif', 'insert_table_on.gif'],
+        "insertimage": ['InsertImage', 'Insert Image', 'insert_picture.gif', 'insert_picture_on.gif'],
+        "createlink": ['CreateLink', 'Create Link', 'insert_hyperlink.gif', 'insert_hyperlink_on.gif'],
+        "viewSource": ['ViewSource', 'View Source', 'view_source.gif', 'view_source_on.gif'],
+        "viewText": ['ViewText', 'View Text', 'view_text.gif', 'view_text_on.gif'],
+        "help": ['Help', 'Help', 'help.gif', 'help_on.gif'],
+        "fonts": ['Fonts', 'Select Font', 'select_font.gif', 'select_font_on.gif'],
+        "fontsizes": ['Fontsizes', 'Select Size', 'select_size.gif', 'select_size_on.gif'],
+        "headings": ['Headings', 'Select Size', 'select_heading.gif', 'select_heading_on.gif'],
+        "preview": ['Preview', 'Preview', 'preview.gif', 'preview_on.gif'],
+        "print": ['Print', 'Print', 'print.gif', 'print_on.gif'],
+        "removeformat": ['RemoveFormat', 'Strip Word HTML', 'remove_format.gif', 'remove_format_on.gif'],
+        "delete": ['Delete', 'Delete', 'delete.gif', 'delete_on.gif'],
+        "save": ['Save', 'Save document', 'save.gif', 'save_on.gif'],
+        "return": ['Return', 'Return without saving', 'return.gif', 'return_on.gif'],
+        "maximize": ['Maximize', 'Maximize the editor', 'maximize.gif', 'maximize_on.gif']
+    },
+    
+    // stores the different settings for each textarea
+    // the textarea identifier is used to store the settings object
+    config: new Array(),
+    // Create viewTextMode global variable and set to 0
+    // enabling all toolbar commands while in HTML mode
+    viewTextMode: new Array(),
+    // maximized
+    maximized: new Array(),
+    
+    /**
+     * Get the range of the given selection
+     *
+     * @param {Selection} sel Selection object
+     * @return {Range} Range object
+     */
+    getRange: function(sel){
+        return sel.createRange ? sel.createRange() : sel.getRangeAt(0);
+    },
+    
+    /**
+     * Return the editor div element
+     *
+     * @param {String} n Editor identifier
+     * @return {HtmlDivElement} Iframe object
+     */
+    getEditorDiv: function(n){
+        return $("wysiwyg_div_" + n);
+    },
+    
+    /**
+     * Return the editor table element
+     *
+     * @param {String} n Editor identifier
+     * @return {HtmlTableElement} Iframe object
+     */
+    getEditorTable: function(n){
+        return $("wysiwyg_table_" + n);
+    },
+    
+    /**
+     * Get the iframe object of the WYSIWYG editor
+     *
+     * @param {String} n Editor identifier
+     * @return {HtmlIframeElement} Iframe object
+     */
+    getEditor: function(n){
+        return $("wysiwyg" + n);
+    },
+    
+    /**
+     * Get editors window element
+     *
+     * @param {String} n Editor identifier
+     * @return {HtmlWindowElement} Html window object
+     */
+    getEditorWindow: function(n){
+        return this.getEditor(n).contentWindow;
+    },
+    
+    /**
+     * Attach the WYSIWYG editor to the given textarea element
+     *
+     * @param {String} id Textarea identifier (all = all textareas)
+     * @param {Settings} settings the settings which will be applied to the textarea
+     */
+    attach: function(id, settings){
+        if (id != "all") {
+            this.setSettings(id, settings);
+            WYSIWYG_Core.includeCSS(this.config[id].CSSFile);
+            WYSIWYG_Core.addEvent(window, "load", function generateEditor(){
+                WYSIWYG._generate(id, settings);
+            });
+        }
+        else {
+            WYSIWYG_Core.addEvent(window, "load", function generateEditor(){
+                WYSIWYG.attachAll(settings);
+            });
+        }
+    },
+    
+    /**
+     * Attach the WYSIWYG editor to all textarea elements
+     *
+     * @param {Settings} settings Settings to customize the look and feel
+     */
+    attachAll: function(settings){
+        var areas = document.getElementsByTagName("textarea");
+        for (var i = 0; i < areas.length; i++) {
+            var id = areas[i].getAttribute("id");
+            if (id == null || id == "") 
+                continue;
+            this.setSettings(id, settings);
+            WYSIWYG_Core.includeCSS(this.config[id].CSSFile);
+            WYSIWYG._generate(id, settings);
+        }
+    },
+    
+    /**
+     * Display an iframe instead of the textarea.
+     * It's used as textarea replacement to display HTML.
+     *
+     * @param id Textarea identifier (all = all textareas)
+     * @param settings the settings which will be applied to the textarea
+     */
+    display: function(id, settings){
+        if (id != "all") {
+            this.setSettings(id, settings);
+            WYSIWYG_Core.includeCSS(this.config[id].CSSFile);
+            WYSIWYG_Core.addEvent(window, "load", function displayIframe(){
+                WYSIWYG._display(id, settings);
+            });
+        }
+        else {
+            WYSIWYG_Core.addEvent(window, "load", function displayIframe(){
+                WYSIWYG.displayAll(settings);
+            });
+        }
+    },
+    
+    /**
+     * Display an iframe instead of the textarea.
+     * It's apply the iframe to all textareas found in the current document.
+     *
+     * @param settings Settings to customize the look and feel
+     */
+    displayAll: function(settings){
+        var areas = document.getElementsByTagName("textarea");
+        for (var i = 0; i < areas.length; i++) {
+            var id = areas[i].getAttribute("id");
+            if (id == null || id == "") 
+                continue;
+            this.setSettings(id, settings);
+            WYSIWYG_Core.includeCSS(this.config[id].CSSFile);
+            WYSIWYG._display(id, settings);
+        }
+    },
+    
+    /**
+     * Set settings in config array, use the textarea id as identifier
+     *
+     * @param n Textarea identifier (all = all textareas)
+     * @param settings the settings which will be applied to the textarea
+     */
+    setSettings: function(n, settings){
+        if (typeof(settings) != "object") {
+            this.config[n] = new this.Settings();
+        }
+        else {
+            this.config[n] = settings;
+        }
+    },
+    
+    /**
+     * Insert or modify an image
+     *
+     * @param {String} src Source of the image
+     * @param {Integer} width Width
+     * @param {Integer} height Height
+     * @param {String} align Alignment of the image
+     * @param {String} border Border size
+     * @param {String} alt Alternativ Text
+     * @param {Integer} hspace Horizontal Space
+     * @param {Integer} vspace Vertical Space
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    insertImage: function(src, width, height, align, border, alt, hspace, vspace, n){
+    
+        // get editor
+        var doc = this.getEditorWindow(n).document;
+        // get selection and range
+        var sel = this.getSelection(n);
+        var range = this.getRange(sel);
+        
+        // the current tag of range
+        var img = this.findParent("img", range);
+        
+        // element is not a link
+        var update = (img == null) ? false : true;
+        if (!update) {
+            img = doc.createElement("img");
+        }
+        
+        // set the attributes
+        WYSIWYG_Core.setAttribute(img, "src", src);
+        WYSIWYG_Core.setAttribute(img, "style", "width:" + width + ";height:" + height);
+        if (align != "") {
+            WYSIWYG_Core.setAttribute(img, "align", align);
+        }
+        else {
+            img.removeAttribute("align");
+        }
+        WYSIWYG_Core.setAttribute(img, "border", border);
+        WYSIWYG_Core.setAttribute(img, "alt", alt);
+        WYSIWYG_Core.setAttribute(img, "hspace", hspace);
+        WYSIWYG_Core.setAttribute(img, "vspace", vspace);
+        img.removeAttribute("width");
+        img.removeAttribute("height");
+        
+        // on update exit here
+        if (update) {
+            return;
+        }
+        
+        // Check if IE or Mozilla (other)
+        if (WYSIWYG_Core.isMSIE) {
+            range.pasteHTML(img.outerHTML);
+        }
+        else {
+            this.insertNodeAtSelection(img, n);
+        }
+    },
+    
+    /**
+     * Insert or modify a link
+     *
+     * @param {String} href The url of the link
+     * @param {String} target Target of the link
+     * @param {String} style Stylesheet of the link
+     * @param {String} styleClass Stylesheet class of the link
+     * @param {String} name Name attribute of the link
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    insertLink: function(href, target, style, styleClass, name, n){
+    
+        // get editor
+        var doc = this.getEditorWindow(n).document;
+        // get selection and range
+        var sel = this.getSelection(n);
+        var range = this.getRange(sel);
+        var lin = null;
+        
+        // get element from selection
+        if (WYSIWYG_Core.isMSIE) {
+            if (sel.type == "Control" && range.length == 1) {
+                range = this.getTextRange(range(0));
+                range.select();
+            }
+        }
+        
+        // find a as parent element
+        lin = this.findParent("a", range);
+        
+        // check if parent is found
+        var update = (lin == null) ? false : true;
+        if (!update) {
+            lin = doc.createElement("a");
+        }
+        
+        // set the attributes
+        WYSIWYG_Core.setAttribute(lin, "href", href);
+        WYSIWYG_Core.setAttribute(lin, "class", styleClass);
+        WYSIWYG_Core.setAttribute(lin, "className", styleClass);
+        WYSIWYG_Core.setAttribute(lin, "target", target);
+        WYSIWYG_Core.setAttribute(lin, "name", name);
+        WYSIWYG_Core.setAttribute(lin, "style", style);
+        
+        // on update exit here
+        if (update) {
+            return;
+        }
+        
+        // Check if IE or Mozilla (other)
+        if (WYSIWYG_Core.isMSIE) {
+            range.select();
+            lin.innerHTML = range.htmlText;
+            range.pasteHTML(lin.outerHTML);
+        }
+        else {
+            var node = range.startContainer;
+            var pos = range.startOffset;
+            if (node.nodeType != 3) {
+                node = node.childNodes[pos];
+            }
+            if (node.tagName) 
+                lin.appendChild(node);
+            else 
+                lin.innerHTML = sel;
+            this.insertNodeAtSelection(lin, n);
+        }
+    },
+    
+    /**
+     * Strips any HTML added by word
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    removeFormat: function(n){
+    
+        if (!confirm(this.config[n].RemoveFormatConfMessage)) {
+            return;
+        }
+        var doc = this.getEditorWindow(n).document;
+        var str = doc.body.innerHTML;
+        
+        str = str.replace(/<span([^>])*>(&nbsp;)*\s*<\/span>/gi, '');
+        str = str.replace(/<span[^>]*>/gi, '');
+        str = str.replace(/<\/span[^>]*>/gi, '');
+        str = str.replace(/<p([^>])*>(&nbsp;)*\s*<\/p>/gi, '');
+        str = str.replace(/<p[^>]*>/gi, '');
+        str = str.replace(/<\/p[^>]*>/gi, '');
+        str = str.replace(/<h([^>])[0-9]>(&nbsp;)*\s*<\/h>/gi, '');
+        str = str.replace(/<h[^>][0-9]>/gi, '');
+        str = str.replace(/<\/h[^>][0-9]>/gi, '');
+        str = str.replace(/<B [^>]*>/ig, '<b>');
+        
+        // var repl_i1 = /<I[^>]*>/ig;
+        // str = str.replace (repl_i1, '<i>');
+        
+        str = str.replace(/<DIV[^>]*>/ig, '');
+        str = str.replace(/<\/DIV>/gi, '');
+        str = str.replace(/<[\/\w?]+:[^>]*>/ig, '');
+        str = str.replace(/(&nbsp;){2,}/ig, '&nbsp;');
+        str = str.replace(/<STRONG>/ig, '');
+        str = str.replace(/<\/STRONG>/ig, '');
+        str = str.replace(/<TT>/ig, '');
+        str = str.replace(/<\/TT>/ig, '');
+        str = str.replace(/<FONT [^>]*>/ig, '');
+        str = str.replace(/<\/FONT>/ig, '');
+        str = str.replace(/STYLE=\"[^\"]*\"/ig, '');
+        str = str.replace(/<([\w]+) class=([^ |>]*)([^>]*)/gi, '<$1$3');
+        str = str.replace(/<([\w]+) style="([^"]*)"([^>]*)/gi, '<$1$3');
+        str = str.replace(/width=([^ |>]*)([^>]*)/gi, '');
+        str = str.replace(/classname=([^ |>]*)([^>]*)/gi, '');
+        str = str.replace(/align=([^ |>]*)([^>]*)/gi, '');
+        str = str.replace(/valign=([^ |>]*)([^>]*)/gi, '');
+        str = str.replace(/<\\?\??xml[^>]>/gi, '');
+        str = str.replace(/<\/?\w+:[^>]*>/gi, '');
+        str = str.replace(/<st1:.*?>/gi, '');
+        str = str.replace(/o:/gi, '');
+        
+        str = str.replace(/<!--([^>])*>(&nbsp;)*\s*<\/-->/gi, '');
+        str = str.replace(/<!--[^>]*>/gi, '');
+        str = str.replace(/<\/--[^>]*>/gi, '');
+        
+        doc.body.innerHTML = str;
+    },
+    
+    /**
+     * Display an iframe instead of the textarea.
+     *
+     * @private
+     * @param {String} n The editor identifier (the textarea's ID)
+     * @param {Object} settings Object which holds the settings
+     */
+    _display: function(n, settings){
+    
+        // Get the textarea element
+        var textarea = $(n);
+        
+        // Validate if textarea exists
+        if (textarea == null) {
+            alert("No textarea found with the given identifier (ID: " + n + ").");
+            return;
+        }
+        
+        // Validate browser compatiblity
+        if (!WYSIWYG_Core.isBrowserCompatible()) {
+            if (this.config[n].NoValidBrowserMessage != "") {
+                alert(this.config[n].NoValidBrowserMessage);
+            }
+            return;
+        }
+        
+        // Load settings in config array, use the textarea id as identifier
+        if (typeof(settings) != "object") {
+            this.config[n] = new this.Settings();
+        }
+        else {
+            this.config[n] = settings;
+        }
+        
+        // Hide the textarea 
+        textarea.style.display = "none";
+        
+        // Override the width and height of the editor with the 
+        // size given by the style attributes width and height
+        if (textarea.style.width) {
+            this.config[n].Width = textarea.style.width;
+        }
+        if (textarea.style.height) {
+            this.config[n].Height = textarea.style.height
+        }
+        
+        // determine the width + height
+        var currentWidth = this.config[n].Width;
+        var currentHeight = this.config[n].Height;
+        
+        // Calculate the width + height of the editor 
+        var ifrmWidth = "100%";
+        var ifrmHeight = "100%";
+        if (currentWidth.search(/%/) == -1) {
+            ifrmWidth = currentWidth;
+            ifrmHeight = currentHeight;
+        }
+        
+        // Create iframe which will be used for rich text editing
+        var iframe = '<table cellpadding="0" cellspacing="0" border="0" style="width:' + currentWidth + '; height:' + currentHeight + ';" class="tableTextareaEditor"><tr><td valign="top">\n' +
+        '<iframe frameborder="0" id="wysiwyg' +
+        n +
+        '" class="iframeText" style="width:' +
+        ifrmWidth +
+        ';height:' +
+        ifrmHeight +
+        ';"></iframe>\n' +
+        '</td></tr></table>\n';
+        
+        // Insert after the textArea both toolbar one and two
+        textarea.insertAdjacentHTML("afterEnd", iframe);
+        
+        // Pass the textarea's existing text over to the content variable
+        var content = textarea.value;
+        var doc = this.getEditorWindow(n).document;
+        
+        // Replace all \n with <br> 
+        if (this.config[n].ReplaceLineBreaks) {
+            content = content.replace(/(\r\n)|(\n)/ig, "<br>");
+        }
+        
+        // Write the textarea's content into the iframe
+        doc.open();
+        doc.write(content);
+        doc.close();
+        
+        // Set default style of the editor window
+        WYSIWYG_Core.setAttribute(doc.body, "style", this.config[n].DefaultStyle);
+    },
+    
+    /**
+     * Replace the given textarea with wysiwyg editor
+     *
+     * @private
+     * @param {String} n The editor identifier (the textarea's ID)
+     * @param {Object} settings Object which holds the settings
+     */
+    _generate: function(n, settings){
+    
+        // Get the textarea element
+        var textarea = $(n);
+        // Validate if textarea exists
+        if (textarea == null) {
+            alert("No textarea found with the given identifier (ID: " + n + ").");
+            return;
+        }
+        
+        // Validate browser compatiblity
+        if (!WYSIWYG_Core.isBrowserCompatible()) {
+            if (this.config[n].NoValidBrowserMessage != "") {
+                alert(this.config[n].NoValidBrowserMessage);
+            }
+            return;
+        }
+        
+        // Hide the textarea 
+        textarea.style.display = 'none';
+        
+        // Override the width and height of the editor with the 
+        // size given by the style attributes width and height
+        if (textarea.style.width) {
+            this.config[n].Width = textarea.style.width;
+        }
+        if (textarea.style.height) {
+            this.config[n].Height = textarea.style.height
+        }
+        
+        // determine the width + height
+        var currentWidth = this.config[n].Width;
+        var currentHeight = this.config[n].Height;
+        
+        // Calculate the width + height of the editor 
+        var toolbarWidth = currentWidth;
+        var ifrmWidth = "100%";
+        var ifrmHeight = "100%";
+        if (currentWidth.search(/%/) == -1) {
+            toolbarWidth = currentWidth.replace(/px/gi, "");
+            toolbarWidth = (parseFloat(toolbarWidth) + 2) + "px";
+            ifrmWidth = currentWidth;
+            ifrmHeight = currentHeight;
+        }
+        
+        // Generate the WYSIWYG Table
+        // This table holds the toolbars and the iframe as the editor
+        var editor = "";
+        editor += '<div id="wysiwyg_div_' + n + '" style="width:' + currentWidth + ';">';
+        editor += '<table border="0" cellpadding="0" cellspacing="0" class="tableTextareaEditor" id="wysiwyg_table_' + n + '" style="width:' + currentWidth + '; height:' + currentHeight + ';">';
+        editor += '<tr><td style="height:22px;vertical-align:top;">';
+        
+        // Output all command buttons that belong to toolbar one
+        for (var j = 0; j < this.config[n].Toolbar.length; j++) {
+            if (this.config[n].Toolbar[j] && this.config[n].Toolbar[j].length > 0) {
+                var toolbar = this.config[n].Toolbar[j];
+                
+                // Generate WYSIWYG toolbar one
+                editor += '<table border="0" cellpadding="0" cellspacing="0" class="toolbar1" style="width:100%;" id="toolbar' + j + '_' + n + '">';
+                editor += '<tr><td style="width:6px;"><img src="' + this.config[n].ImagesDir + 'seperator2.gif" alt="" hspace="3"></td>';
+                
+                // Interate over the toolbar element
+                for (var i = 0; i < toolbar.length; i++) {
+                    var id = toolbar[i];
+                    if (toolbar[i]) {
+                        if (typeof(this.config[n].DropDowns[id]) != "undefined") {
+                            var dropdown = this.config[n].DropDowns[id];
+                            editor += '<td style="width: ' + dropdown.width + ';">';
+                            // write the drop down content
+                            editor += this.writeDropDown(n, id);
+                            editor += '</td>';
+                        }
+                        else {
+                        
+                            // Get the values of the Button from the global ToolbarList object
+                            var buttonObj = this.ToolbarList[toolbar[i]];
+                            if (buttonObj) {
+                                var buttonID = buttonObj[0];
+                                var buttonTitle = buttonObj[1];
+                                var buttonImage = this.config[n].ImagesDir + buttonObj[2];
+                                var buttonImageRollover = this.config[n].ImagesDir + buttonObj[3];
+                                
+                                if (toolbar[i] == "seperator") {
+                                    editor += '<td style="width: 12px;" align="center">';
+                                    editor += '<img src="' + buttonImage + '" border=0 unselectable="on" width="2" height="18" hspace="2" unselectable="on">';
+                                    editor += '</td>';
+                                }
+                                // View Source button
+                                else 
+                                    if (toolbar[i] == "viewSource") {
+                                        editor += '<td style="width: 22px;">';
+                                        editor += '<span id="HTMLMode' + n + '"><img src="' + buttonImage + '" border="0" unselectable="on" title="' + buttonTitle + '" id="' + buttonID + '" class="buttonEditor" onmouseover="this.className=\'buttonEditorOver\'; this.src=\'' + buttonImageRollover + '\';" onmouseout="this.className=\'buttonEditor\'; this.src=\'' + buttonImage + '\';" onclick="WYSIWYG.execCommand(\'' + n + '\', \'' + buttonID + '\');" unselectable="on" width="20" height="20"></span>';
+                                        editor += '<span id="textMode' + n + '"><img src="' + this.config[n].ImagesDir + 'view_text.gif" border="0" unselectable="on" title="viewText" id="ViewText" class="buttonEditor" onmouseover="this.className=\'buttonEditorOver\'; this.src=\'' + this.config[n].ImagesDir + 'view_text_on.gif\';" onmouseout="this.className=\'buttonEditor\'; this.src=\'' + this.config[n].ImagesDir + 'view_text.gif\';" onclick="WYSIWYG.execCommand(\'' + n + '\',\'ViewText\');" unselectable="on"  width="20" height="20"></span>';
+                                        editor += '</td>';
+                                    }
+                                    else {
+                                        editor += '<td style="width: 22px;">';
+                                        editor += '<img src="' + buttonImage + '" border=0 unselectable="on" title="' + buttonTitle + '" id="' + buttonID + '" class="buttonEditor" onmouseover="this.className=\'buttonEditorOver\'; this.src=\'' + buttonImageRollover + '\';" onmouseout="this.className=\'buttonEditor\'; this.src=\'' + buttonImage + '\';" onclick="WYSIWYG.execCommand(\'' + n + '\', \'' + buttonID + '\');" unselectable="on" width="20" height="20">';
+                                        editor += '</td>';
+                                    }
+                            }
+                        }
+                    }
+                }
+                editor += '<td>&nbsp;</td></tr></table>';
+            }
+        }
+        
+        editor += '</td></tr><tr><td valign="top">\n';
+        // Create iframe which will be used for rich text editing
+        editor += '<iframe frameborder="0" id="wysiwyg' + n + '" class="iframeText" style="width:100%;height:' + currentHeight + ';"></iframe>\n' +
+        '</td></tr>';
+        // Status bar HTML code
+        if (this.config[n].StatusBarEnabled) {
+            editor += '<tr><td class="wysiwyg-statusbar" style="height:10px;" id="wysiwyg_statusbar_' + n + '">&nbsp;</td></tr>';
+        }
+        editor += '</table>';
+        editor += '</div>';
+        
+        // Insert the editor after the textarea            
+        textarea.insertAdjacentHTML("afterEnd", editor);
+        
+        // Hide the "Text Mode" button
+        // Validate if textMode Elements are prensent
+        if ($("textMode" + n)) {
+            $("textMode" + n).style.display = 'none';
+        }
+        
+        // Pass the textarea's existing text over to the content variable
+        var content = textarea.value;
+        var doc = this.getEditorWindow(n).document;
+        
+        
+        // Replace all \n with <br> 
+        if (this.config[n].ReplaceLineBreaks) {
+            content = content.replace(/\n\r|\n/ig, "<br>");
+        }
+        
+        // Write the textarea's content into the iframe
+        doc.open();
+        doc.write(content);
+        doc.close();
+        
+        // Make the iframe editable in both Mozilla and IE
+        // Improve compatiblity for IE + Mozilla
+        if (doc.body.contentEditable) {
+            doc.body.contentEditable = true;
+        }
+        else {
+            doc.designMode = "on";
+        }
+        
+        // Set default font style
+        WYSIWYG_Core.setAttribute(doc.body, "style", this.config[n].DefaultStyle);
+        
+        // Enable table highlighting
+        WYSIWYG_Table.refreshHighlighting(n);
+        
+        // Event Handling
+        // Update the textarea with content in WYSIWYG when user submits form
+        for (var idx = 0; idx < document.forms.length; idx++) {
+            WYSIWYG_Core.addEvent(document.forms[idx], "submit", function xxx_aa(){
+                WYSIWYG.updateTextArea(n);
+            });
+        }
+        
+        // close font selection if mouse moves over the editor window
+        WYSIWYG_Core.addEvent(doc, "mouseover", function xxx_bb(){
+            WYSIWYG.closeDropDowns(n);
+        });
+        
+        // If it's true invert the line break capability of IE
+        if (this.config[n].InvertIELineBreaks) {
+            WYSIWYG_Core.addEvent(doc, "keypress", function xxx_cc(){
+                WYSIWYG.invertIELineBreakCapability(n);
+            });
+        }
+        
+        // status bar update
+        if (this.config[n].StatusBarEnabled) {
+            WYSIWYG_Core.addEvent(doc, "mouseup", function xxx_dd(){
+                WYSIWYG.updateStatusBar(n);
+            });
+        }
+        
+        // custom context menu
+        if (this.config[n].ContextMenu) {
+            WYSIWYG_ContextMenu.init(n);
+        }
+        
+        // init viewTextMode var
+        this.viewTextMode[n] = false;
+    },
+    
+    /**
+     * Disable the given WYSIWYG Editor Box
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    disable: function(n){
+    
+        // get the editor window
+        var editor = this.getEditorWindow(n);
+        
+        // Validate if editor exists
+        if (editor == null) {
+            alert("No editor found with the given identifier (ID: " + n + ").");
+            return;
+        }
+        
+        if (editor) {
+            // disable design mode or content editable feature
+            if (editor.document.body.contentEditable) {
+                editor.document.body.contentEditable = false;
+            }
+            else {
+                editor.document.designMode = "Off";
+            }
+            
+            // change the style of the body
+            WYSIWYG_Core.setAttribute(editor.document.body, "style", this.config[n].DisabledStyle);
+            
+            // hide the status bar
+            this.hideStatusBar(n);
+            
+            // hide all toolbars
+            this.hideToolbars(n);
+        }
+    },
+    
+    /**
+     * Enables the given WYSIWYG Editor Box
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    enable: function(n){
+    
+        // get the editor window
+        var editor = this.getEditorWindow(n);
+        
+        // Validate if editor exists
+        if (editor == null) {
+            alert("No editor found with the given identifier (ID: " + n + ").");
+            return;
+        }
+        
+        if (editor) {
+            // disable design mode or content editable feature
+            if (editor.document.body.contentEditable) {
+                editor.document.body.contentEditable = true;
+            }
+            else {
+                editor.document.designMode = "On";
+            }
+            
+            // change the style of the body
+            WYSIWYG_Core.setAttribute(editor.document.body, "style", this.config[n].DefaultStyle);
+            
+            // hide the status bar
+            this.showStatusBar(n);
+            
+            // hide all toolbars
+            this.showToolbars(n);
+        }
+    },
+    
+    /**
+     * Returns the node structure of the current selection as array
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    getNodeTree: function(n){
+    
+        var sel = this.getSelection(n);
+        var range = this.getRange(sel);
+        
+        // get element of range
+        var tag = this.getTag(range);
+        if (tag == null) {
+            return;
+        }
+        // get parent of element
+        var node = this.getParent(tag);
+        // init the tree as array with the current selected element
+        var nodeTree = new Array(tag);
+        // get all parent nodes
+        var ii = 1;
+        
+        while (node != null && node.nodeName != "#document") {
+            nodeTree[ii] = node;
+            node = this.getParent(node);
+            ii++;
+        }
+        
+        return nodeTree;
+    },
+    
+    /**
+     * Removes the current node of the selection
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    removeNode: function(n){
+        // get selection and range
+        var sel = this.getSelection(n);
+        var range = this.getRange(sel);
+        // the current tag of range
+        var tag = this.getTag(range);
+        var parent = tag.parentNode;
+        if (tag == null || parent == null) {
+            return;
+        }
+        if (tag.nodeName == "HTML" || tag.nodeName == "BODY") {
+            return;
+        }
+        
+        // copy child elements of the node to the parent element before remove the node
+        var childNodes = new Array();
+        for (var i = 0; i < tag.childNodes.length; i++) 
+            childNodes[i] = tag.childNodes[i];
+        for (var i = 0; i < childNodes.length; i++) 
+            parent.insertBefore(childNodes[i], tag);
+        
+        // remove node
+        parent.removeChild(tag);
+        // validate if parent is a link and the node is only 
+        // surrounded by the link, then remove the link too
+        if (parent.nodeName == "A" && !parent.hasChildNodes()) {
+            if (parent.parentNode) {
+                parent.parentNode.removeChild(parent);
+            }
+        }
+        // update the status bar
+        this.updateStatusBar(n);
+    },
+    
+    /**
+     * Get the selection of the given editor
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    getSelection: function(n){
+        var ifrm = this.getEditorWindow(n);
+        var doc = ifrm.document;
+        var sel = null;
+        if (ifrm.getSelection) {
+            sel = ifrm.getSelection();
+        }
+        else 
+            if (doc.getSelection) {
+                sel = doc.getSelection();
+            }
+            else 
+                if (doc.selection) {
+                    sel = doc.selection;
+                }
+        return sel;
+    },
+    
+    /**
+     * Updates the status bar with the current node tree
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    updateStatusBar: function(n){
+    
+        // get the node structure
+        var nodeTree = this.getNodeTree(n);
+        if (nodeTree == null) {
+            return;
+        }
+        // format the output
+        var outputTree = "";
+        var max = nodeTree.length - 1;
+        for (var i = max; i >= 0; i--) {
+            if (nodeTree[i].nodeName != "HTML" && nodeTree[i].nodeName != "BODY") {
+                outputTree += '<a class="wysiwyg-statusbar" href="javascript:WYSIWYG.selectNode(\'' + n + '\',' + i + ');">' + nodeTree[i].nodeName + '</a>';
+            }
+            else {
+                outputTree += nodeTree[i].nodeName;
+            }
+            if (i > 0) {
+                outputTree += " > ";
+            }
+        }
+        
+        // update the status bar       
+        var statusbar = $("wysiwyg_statusbar_" + n);
+        if (statusbar) {
+            statusbar.innerHTML = outputTree;
+        }
+    },
+    
+    /**
+     * Execute a command on the editor document
+     *
+     * @param {String} command The execCommand (e.g. Bold)
+     * @param {String} n The editor identifier
+     * @param {String} value The value when applicable
+     */
+    execCommand: function(n, cmd, value){
+    
+        // When user clicks toolbar button make sure it always targets its respective WYSIWYG
+        this.getEditorWindow(n).focus();
+        
+        // When in Text Mode these execCommands are enabled
+        var textModeCommands = new Array("ViewText", "Print");
+        
+        // Check if in Text mode and a disabled command execute
+        var cmdValid = false;
+        for (var i = 0; i < textModeCommands.length; i++) {
+            if (textModeCommands[i] == cmd) {
+                cmdValid = true;
+            }
+        }
+        if (this.viewTextMode[n] && !cmdValid) {
+            alert("You are in TEXT Mode. This feature has been disabled.");
+            return;
+        }
+        
+        // rbg to hex convertion implementation dependents on browser
+        var toHexColor = WYSIWYG_Core.isMSIE ? WYSIWYG_Core._dec_to_rgb : WYSIWYG_Core.toHexColor;
+        
+        // popup screen positions
+        var popupPosition = {
+            left: parseInt(window.screen.availWidth / 3),
+            top: parseInt(window.screen.availHeight / 3)
+        };
+        
+        // Check the insert image popup implementation
+        var imagePopupFile = this.config[n].PopupsDir + 'insert_image.html';
+        var imagePopupWidth = 400;
+        var imagePopupHeight = 210;
+        if (typeof this.config[n].ImagePopupFile != "undefined" && this.config[n].ImagePopupFile != "") {
+            imagePopupFile = this.config[n].ImagePopupFile;
+        }
+        if (typeof this.config[n].ImagePopupWidth && this.config[n].ImagePopupWidth > 0) {
+            imagePopupWidth = this.config[n].ImagePopupWidth;
+        }
+        if (typeof this.config[n].ImagePopupHeight && this.config[n].ImagePopupHeight > 0) {
+            imagePopupHeight = this.config[n].ImagePopupHeight;
+        }
+        
+        // switch which action have to do
+        switch (cmd) {
+            case "Maximize":
+                this.maximize(n);
+                break;
+            case "FormatBlock":
+                WYSIWYG_Core.execCommand(n, cmd, "<" + value + ">");
+                break;
+            // ForeColor and 
+            case "ForeColor":
+                var rgb = this.getEditorWindow(n).document.queryCommandValue(cmd);
+                var currentColor = rgb != '' ? toHexColor(this.getEditorWindow(n).document.queryCommandValue(cmd)) : "000000";
+                window.open(this.config[n].PopupsDir + 'select_color.html?color=' + currentColor + '&command=' + cmd + '&wysiwyg=' + n, 'popup', 'location=0,status=0,scrollbars=0,width=210,height=165,top=' + popupPosition.top + ',left=' + popupPosition.left).focus();
+                break;
+                
+            // BackColor
+            case "BackColor":
+                var currentColor = toHexColor(this.getEditorWindow(n).document.queryCommandValue(cmd));
+                window.open(this.config[n].PopupsDir + 'select_color.html?color=' + currentColor + '&command=' + cmd + '&wysiwyg=' + n, 'popup', 'location=0,status=0,scrollbars=0,width=210,height=165,top=' + popupPosition.top + ',left=' + popupPosition.left).focus();
+                break;
+                
+            // InsertImage
+            case "InsertImage":
+                window.open(imagePopupFile + '?wysiwyg=' + n, 'popup', 'location=0,status=0,scrollbars=0,resizable=0,width=' + imagePopupWidth + ',height=' + imagePopupHeight + ',top=' + popupPosition.top + ',left=' + popupPosition.left).focus();
+                break;
+                
+            // Remove Image
+            case "RemoveImage":
+                this.removeImage(n);
+                break;
+                
+            // Remove Link
+            case "RemoveLink":
+                this.removeLink(n);
+                break;
+                
+            // Remove a Node
+            case "RemoveNode":
+                this.removeNode(n);
+                break;
+                
+            // Create Link
+            case "CreateLink":
+                window.open(this.config[n].PopupsDir + 'insert_hyperlink.html?wysiwyg=' + n, 'popup', 'location=0,status=0,scrollbars=0,resizable=0,width=350,height=160,top=' + popupPosition.top + ',left=' + popupPosition.left).focus();
+                break;
+                
+            // InsertTable
+            case "InsertTable":
+                window.open(this.config[n].PopupsDir + 'create_table.html?wysiwyg=' + n, 'popup', 'location=0,status=0,scrollbars=0,resizable=0,width=500,height=260,top=' + popupPosition.top + ',left=' + popupPosition.left).focus();
+                break;
+                
+            // ViewSource
+            case "ViewSource":
+                this.viewSource(n);
+                break;
+                
+            // ViewText
+            case "ViewText":
+                this.viewText(n);
+                break;
+                
+            // Help
+            case "Help":
+                window.open(this.config[n].PopupsDir + 'about.html?wysiwyg=' + n, 'popup', 'location=0,status=0,scrollbars=0,resizable=0,width=400,height=350,top=' + popupPosition.top + ',left=' + popupPosition.left).focus();
+                break;
+                
+            // Strip any HTML added by word
+            case "RemoveFormat":
+                this.removeFormat(n);
+                break;
+                
+            // Preview thx to Korvo
+            case "Preview":
+                window.open(this.config[n].PopupsDir + 'preview.html?wysiwyg=' + n, 'popup', 'location=0,status=0,scrollbars=1,resizable=1,width=' + this.config[n].PreviewWidth + ',height=' + this.config[n].PreviewHeight + ',top=' + popupPosition.top + ',left=' + popupPosition.left).focus();
+                break;
+                
+            // Print
+            case "Print":
+                this.print(n);
+                break;
+                
+            // Save
+            case "Save":
+                WYSIWYG.updateTextArea(n);
+                var form = WYSIWYG_Core.findParentNode("FORM", this.getEditor(n));
+                if (form == null) {
+                    alert("Can not submit the content, because no form element found.");
+                    return;
+                }
+                form.submit();
+                break;
+                
+            // Return
+            case "Return":
+                location.replace(this.config[n].Opener);
+                break;
+                
+            default:
+                WYSIWYG_Core.execCommand(n, cmd, value);
+                
+        }
+        
+        // hide node the font + font size selection
+        this.closeDropDowns(n);
+    },
+    
+    /**
+     * Maximize the editor instance
+     *
+     * @param {String} n The editor identifier
+     */
+    maximize: function(n){
+    
+        var divElm = this.getEditorDiv(n);
+        var tableElm = this.getEditorTable(n);
+        var editor = this.getEditor(n);
+        var setting = this.config[n];
+        var size = WYSIWYG_Core.windowSize();
+        size.width -= 5;
+        if (this.maximized[n]) {
+            WYSIWYG_Core.setAttribute(divElm, "style", "position:static;z-index:9998;top:0px;left:0px;width:" + setting.Width + ";height:100%;");
+            WYSIWYG_Core.setAttribute(tableElm, "style", "width:" + setting.Width + ";height:" + setting.Height + ";");
+            WYSIWYG_Core.setAttribute(editor, "style", "width:100%;height:" + setting.Height + ";");
+            this.maximized[n] = false;
+        }
+        else {
+            WYSIWYG_Core.setAttribute(divElm, "style", "position:absolute;z-index:9998;top:0px;left:0px;width:" + size.width + "px;height:" + size.height + "px;");
+            WYSIWYG_Core.setAttribute(tableElm, "style", "width:100%;height:100%;");
+            WYSIWYG_Core.setAttribute(editor, "style", "width:100%;height:100%;");
+            this.maximized[n] = true;
+        }
+        
+    },
+    
+    /**
+     * Insert HTML into WYSIWYG in rich text
+     *
+     * @param {String} html The HTML being inserted (e.g. <b>hello</b>)
+     * @param {String} n The editor identifier
+     */
+    insertHTML: function(html, n){
+        if (WYSIWYG_Core.isMSIE) {
+            this.getEditorWindow(n).document.selection.createRange().pasteHTML(html);
+        }
+        else {
+            var span = this.getEditorWindow(n).document.createElement("span");
+            span.innerHTML = html;
+            this.insertNodeAtSelection(span, n);
+        }
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : insertNodeAtSelection()
+     Description : insert HTML into WYSIWYG in rich text (mozilla)
+     Usage       : WYSIWYG.insertNodeAtSelection(insertNode, n)
+     Arguments   : insertNode - The HTML being inserted (must be innerHTML inserted within a div element)
+     n          - The editor identifier that the HTML will be inserted into (the textarea's ID)
+     \* ---------------------------------------------------------------------- */
+    insertNodeAtSelection: function(insertNode, n){
+    
+        // get editor document
+        var doc = this.getEditorWindow(n).document;
+        // get current selection
+        var sel = this.getSelection(n);
+        
+        // get the first range of the selection
+        // (there's almost always only one range)
+        var range = sel.getRangeAt(0);
+        
+        // deselect everything
+        sel.removeAllRanges();
+        
+        // remove content of current selection from document
+        range.deleteContents();
+        
+        // get location of current selection
+        var container = range.startContainer;
+        var pos = range.startOffset;
+        
+        // make a new range for the new selection
+        range = doc.createRange();
+        
+        if (container.nodeType == 3 && insertNode.nodeType == 3) {
+            // if we insert text in a textnode, do optimized insertion
+            container.insertData(pos, insertNode.data);
+            // put cursor after inserted text
+            range.setEnd(container, pos + insertNode.length);
+            range.setStart(container, pos + insertNode.length);
+        }
+        else {
+        
+            var afterNode;
+            var beforeNode;
+            if (container.nodeType == 3) {
+                // when inserting into a textnode
+                // we create 2 new textnodes
+                // and put the insertNode in between
+                var textNode = container;
+                container = textNode.parentNode;
+                var text = textNode.nodeValue;
+                
+                // text before the split
+                var textBefore = text.substr(0, pos);
+                // text after the split
+                var textAfter = text.substr(pos);
+                
+                beforeNode = document.createTextNode(textBefore);
+                afterNode = document.createTextNode(textAfter);
+                
+                // insert the 3 new nodes before the old one
+                container.insertBefore(afterNode, textNode);
+                container.insertBefore(insertNode, afterNode);
+                container.insertBefore(beforeNode, insertNode);
+                
+                // remove the old node
+                container.removeChild(textNode);
+            }
+            else {
+                // else simply insert the node
+                afterNode = container.childNodes[pos];
+                container.insertBefore(insertNode, afterNode);
+            }
+            
+            try {
+                range.setEnd(afterNode, 0);
+                range.setStart(afterNode, 0);
+            } 
+            catch (e) {
+                alert(e);
+            }
+        }
+        
+        sel.addRange(range);
+    },
+    
+    /**
+     * Prints the content of the WYSIWYG editor area
+     *
+     * @param {String} n The editor identifier (textarea ID)
+     */
+    print: function(n){
+        if (document.all && navigator.appVersion.substring(22, 23) == 4) {
+            var doc = this.getEditorWindow(n).document;
+            doc.focus();
+            var OLECMDID_PRINT = 6;
+            var OLECMDEXECOPT_DONTPROMPTUSER = 2;
+            var OLECMDEXECOPT_PROMPTUSER = 1;
+            var WebBrowser = '<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
+            doc.body.insertAdjacentHTML('beforeEnd', WebBrowser);
+            WebBrowser.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER);
+            WebBrowser.outerHTML = '';
+        }
+        else {
+            this.getEditorWindow(n).print();
+        }
+    },
+    
+    /**
+     * Writes the content of an drop down
+     *
+     * @param {String} n The editor identifier (textarea ID)
+     * @param {String} id Drop down identifier
+     * @return {String} Drop down HTML
+     */
+    writeDropDown: function(n, id){
+    
+        var dropdown = this.config[n].DropDowns[id];
+        var toolbarObj = this.ToolbarList[dropdown.id];
+        var image = this.config[n].ImagesDir + toolbarObj[2];
+        var imageOn = this.config[n].ImagesDir + toolbarObj[3];
+        dropdown.elements.sort();
+        
+        var output = "";
+        output += '<table border="0" cellpadding="0" cellspacing="0"><tr>';
+        output += '<td onMouseOver="$(\'img_' + dropdown.id + '_' + n + '\').src=\'' + imageOn + '\';" onMouseOut="$(\'img_' + dropdown.id + '_' + n + '\').src=\'' + image + '\';">';
+        output += '<img src="' + image + '" id="img_' + dropdown.id + '_' + n + '" height="20" onClick="WYSIWYG.openDropDown(\'' + n + '\',\'' + dropdown.id + '\');" unselectable="on" border="0"><br>';
+        output += '<span id="elm_' + dropdown.id + '_' + n + '" class="dropdown" style="width: 145px;display:none;">';
+        for (var i = 0; i < dropdown.elements.length; i++) {
+            if (dropdown.elements[i]) {
+                var value = dropdown.elements[i];
+                var label = dropdown.label.replace(/{value}/gi, value);
+                // output
+                output += '<button type="button" onClick="WYSIWYG.execCommand(\'' + n + '\',\'' + dropdown.command + '\',\'' + value + '\')\;" onMouseOver="this.className=\'mouseOver\'" onMouseOut="this.className=\'mouseOut\'" class="mouseOut" style="width: 120px;">';
+                output += '<table cellpadding="0" cellspacing="0" border="0"><tr>';
+                output += '<td align="left">' + label + '</td>';
+                output += '</tr></table></button><br>';
+            }
+        }
+        output += '</span></td></tr></table>';
+        
+        return output;
+    },
+    
+    /**
+     * Close all drop downs. You can define a exclude dropdown id
+     *
+     * @param {String} n The editor identifier (textarea ID)
+     * @param {String} exid Excluded drop down identifier
+     */
+    closeDropDowns: function(n, exid){
+        if (typeof(exid) == "undefined") 
+            exid = "";
+        var dropdowns = this.config[n].DropDowns;
+        for (var id in dropdowns) {
+            var dropdown = dropdowns[id];
+            if (dropdown.id != exid) {
+                var divId = "elm_" + dropdown.id + "_" + n;
+                if ($(divId)) 
+                    $(divId).style.display = 'none';
+            }
+        }
+    },
+    
+    /**
+     * Open a defined drop down
+     *
+     * @param {String} n The editor identifier (textarea ID)
+     * @param {String} id Drop down identifier
+     */
+    openDropDown: function(n, id){
+        var divId = "elm_" + id + "_" + n;
+        if ($(divId).style.display == "none") {
+            $(divId).style.display = "block";
+        }
+        else {
+            $(divId).style.display = "none";
+        }
+        $(divId).style.position = "absolute";
+        this.closeDropDowns(n, id);
+    },
+    
+    /**
+     * Shows the HTML source code generated by the WYSIWYG editor
+     *
+     * @param {String} n The editor identifier (textarea ID)
+     */
+    viewSource: function(n){
+    
+        // document
+        var doc = this.getEditorWindow(n).document;
+        
+        // Enable table highlighting
+        WYSIWYG_Table.disableHighlighting(n);
+        
+        // View Source for IE   
+        if (WYSIWYG_Core.isMSIE) {
+            var iHTML = doc.body.innerHTML;
+            // strip off the absolute urls
+            iHTML = this.stripURLPath(n, iHTML);
+            // replace all decimal color strings with hex decimal color strings
+            iHTML = WYSIWYG_Core.replaceRGBWithHexColor(iHTML);
+            doc.body.innerText = iHTML;
+        }
+        // View Source for Mozilla/Netscape
+        else {
+            // replace all decimal color strings with hex decimal color strings
+            var html = WYSIWYG_Core.replaceRGBWithHexColor(doc.body.innerHTML);
+            html = document.createTextNode(html);
+            doc.body.innerHTML = "";
+            doc.body.appendChild(html);
+        }
+        
+        // Hide the HTML Mode button and show the Text Mode button
+        // Validate if Elements are present
+        if ($('HTMLMode' + n)) {
+            $('HTMLMode' + n).style.display = 'none';
+        }
+        if ($('textMode' + n)) {
+            $('textMode' + n).style.display = 'block';
+        }
+        
+        // set the font values for displaying HTML source
+        doc.body.style.fontSize = "12px";
+        doc.body.style.fontFamily = "Courier New";
+        
+        this.viewTextMode[n] = true;
+    },
+    
+    /**
+     * Shows the HTML source code generated by the WYSIWYG editor
+     *
+     * @param {String} n The editor identifier (textarea ID)
+     */
+    viewText: function(n){
+    
+        // get document
+        var doc = this.getEditorWindow(n).document;
+        
+        // View Text for IE             
+        if (WYSIWYG_Core.isMSIE) {
+            var iText = doc.body.innerText;
+            // strip off the absolute urls
+            iText = this.stripURLPath(n, iText);
+            // replace all decimal color strings with hex decimal color strings
+            iText = WYSIWYG_Core.replaceRGBWithHexColor(iText);
+            doc.body.innerHTML = iText;
+        }
+        
+        // View Text for Mozilla/Netscape
+        else {
+            var html = doc.body.ownerDocument.createRange();
+            html.selectNodeContents(doc.body);
+            // replace all decimal color strings with hex decimal color strings
+            html = WYSIWYG_Core.replaceRGBWithHexColor(html.toString());
+            doc.body.innerHTML = html;
+        }
+        
+        // Enable table highlighting
+        WYSIWYG_Table.refreshHighlighting(n);
+        
+        // Hide the Text Mode button and show the HTML Mode button
+        // Validate if Elements are present
+        if ($('textMode' + n)) {
+            $('textMode' + n).style.display = 'none';
+        }
+        if ($('HTMLMode' + n)) {
+            $('HTMLMode' + n).style.display = 'block';
+        }
+        
+        // reset the font values (changed)
+        WYSIWYG_Core.setAttribute(doc.body, "style", this.config[n].DefaultStyle);
+        
+        this.viewTextMode[n] = false;
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : stripURLPath()
+     Description : Strips off the defined image and the anchor urls of the given content.
+     It also can strip the document URL automatically if you define auto.
+     Usage       : WYSIWYG.stripURLPath(content)
+     Arguments   : content  - Content on which the stripping applies
+     \* ---------------------------------------------------------------------- */
+    stripURLPath: function(n, content, exact){
+    
+        // parameter exact is optional
+        if (typeof exact == "undefined") {
+            exact = true;
+        }
+        
+        var stripImgageUrl = null;
+        var stripAnchorUrl = null;
+        
+        // add url to strip of anchors to array
+        if (this.config[n].AnchorPathToStrip == "auto") {
+            stripAnchorUrl = WYSIWYG_Core.getDocumentUrl(document);
+        }
+        else 
+            if (this.config[n].AnchorPathToStrip != "") {
+                stripAnchorUrl = this.config[n].AnchorPathToStrip;
+            }
+        
+        // add strip url of images to array
+        if (this.config[n].ImagePathToStrip == "auto") {
+            stripImgageUrl = WYSIWYG_Core.getDocumentUrl(document);
+        }
+        else 
+            if (this.config[n].ImagePathToStrip != "") {
+                stripImgageUrl = this.config[n].ImagePathToStrip;
+            }
+        
+        var url;
+        var regex;
+        var result;
+        // strip url of image path
+        if (stripImgageUrl) {
+            // escape reserved characters to be a valid regex  
+            url = WYSIWYG_Core.stringToRegex(WYSIWYG_Core.getDocumentPathOfUrl(stripImgageUrl));
+            
+            // exact replacing of url. regex: src="<url>"
+            if (exact) {
+                regex = eval("/(src=\")(" + url + ")([^\"]*)/gi");
+                content = content.replace(regex, "$1$3");
+            }
+            // not exect replacing of url. regex: <url>
+            else {
+                regex = eval("/(" + url + ")(.+)/gi");
+                content = content.replace(regex, "$2");
+            }
+            
+            // strip absolute urls without a heading slash ("images/print.gif")        
+            result = WYSIWYG_Core.getDocumentPathOfUrl(stripImgageUrl).match(/.+[\/]{2,3}[^\/]*/, "");
+            if (result) {
+                url = WYSIWYG_Core.stringToRegex(result[0]);
+                
+                // exact replacing of url. regex: src="<url>"
+                if (exact) {
+                    regex = eval("/(src=\")(" + url + ")([^\"]*)/gi");
+                    content = content.replace(regex, "$1$3");
+                }
+                // not exect replacing of url. regex: <url>
+                else {
+                    regex = eval("/(" + url + ")(.+)/gi");
+                    content = content.replace(regex, "$2");
+                }
+            }
+        }
+        
+        // strip url of image path
+        if (stripAnchorUrl) {
+            // escape reserved characters to be a valid regex          
+            url = WYSIWYG_Core.stringToRegex(WYSIWYG_Core.getDocumentPathOfUrl(stripAnchorUrl));
+            
+            // strip absolute urls with a heading slash ("/product/index.html")
+            // exact replacing of url. regex: src="<url>"
+            if (exact) {
+                regex = eval("/(href=\")(" + url + ")([^\"]*)/gi");
+                content = content.replace(regex, "$1$3");
+            }
+            // not exect replacing of url. regex: <url>
+            else {
+                regex = eval("/(" + url + ")(.+)/gi");
+                content = content.replace(regex, "$2");
+            }
+            
+            // strip absolute urls without a heading slash ("product/index.html")      
+            result = WYSIWYG_Core.getDocumentPathOfUrl(stripAnchorUrl).match(/.+[\/]{2,3}[^\/]*/, "");
+            if (result) {
+                url = WYSIWYG_Core.stringToRegex(result[0]);
+                // exact replacing of url. regex: src="<url>"
+                if (exact) {
+                    regex = eval("/(href=\")(" + url + ")([^\"]*)/gi");
+                    content = content.replace(regex, "$1$3");
+                }
+                // not exect replacing of url. regex: <url>
+                else {
+                    regex = eval("/(" + url + ")(.+)/gi");
+                    content = content.replace(regex, "$2");
+                }
+                
+            }
+            
+            // stip off anchor links with #name                        
+            url = WYSIWYG_Core.stringToRegex(stripAnchorUrl);
+            // exact replacing of url. regex: src="<url>"
+            if (exact) {
+                regex = eval("/(href=\")(" + url + ")(#[^\"]*)/gi");
+                content = content.replace(regex, "$1$3");
+            }
+            // not exect replacing of url. regex: <url>
+            else {
+                regex = eval("/(" + url + ")(.+)/gi");
+                content = content.replace(regex, "$2");
+            }
+            
+            
+            // stip off anchor links with #name (only for local system)
+            url = WYSIWYG_Core.getDocumentUrl(document);
+            var pos = url.lastIndexOf("/");
+            if (pos != -1) {
+                url = url.substring(pos + 1, url.length);
+                url = WYSIWYG_Core.stringToRegex(url);
+                // exact replacing of url. regex: src="<url>"
+                if (exact) {
+                    regex = eval("/(href=\")(" + url + ")(#[^\"]*)/gi");
+                    content = content.replace(regex, "$1$3");
+                }
+                // not exect replacing of url. regex: <url>
+                else {
+                    regex = eval("/(" + url + ")(.+)/gi");
+                    content = content.replace(regex, "$2");
+                }
+            }
+        }
+        
+        return content;
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : updateTextArea()
+     Description : Updates the text area value with the HTML source of the WYSIWYG
+     Arguments   : n   - The editor identifier (the textarea's ID)
+     \* ---------------------------------------------------------------------- */
+    updateTextArea: function(n){
+        // on update switch editor back to html mode
+        if (this.viewTextMode[n]) {
+            this.viewText(n);
+        }
+        // get inner HTML
+        var content = this.getEditorWindow(n).document.body.innerHTML;
+        // strip off defined URLs on IE
+        content = this.stripURLPath(n, content);
+        // replace all decimal color strings with hex color strings
+        content = WYSIWYG_Core.replaceRGBWithHexColor(content);
+        // remove line breaks before content will be updated
+        if (this.config[n].ReplaceLineBreaks) {
+            content = content.replace(/(\r\n)|(\n)/ig, "");
+        }
+        // set content back in textarea
+        $(n).value = content;
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : hideToolbars()
+     Description : Hide all toolbars
+     Usage       : WYSIWYG.hideToolbars(n)
+     Arguments   : n - The editor identifier (the textarea's ID)
+     \* ---------------------------------------------------------------------- */
+    hideToolbars: function(n){
+        for (var i = 0; i < this.config[n].Toolbar.length; i++) {
+            var toolbar = $("toolbar" + i + "_" + n);
+            if (toolbar) {
+                toolbar.style.display = "none";
+            }
+        }
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : showToolbars()
+     Description : Display all toolbars
+     Usage       : WYSIWYG.showToolbars(n)
+     Arguments   : n - The editor identifier (the textarea's ID)
+     \* ---------------------------------------------------------------------- */
+    showToolbars: function(n){
+        for (var i = 0; i < this.config[n].Toolbar.length; i++) {
+            var toolbar = $("toolbar" + i + "_" + n);
+            if (toolbar) {
+                toolbar.style.display = "";
+            }
+        }
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : hideStatusBar()
+     Description : Hide the status bar
+     Usage       : WYSIWYG.hideStatusBar(n)
+     Arguments   : n - The editor identifier (the textarea's ID)
+     \* ---------------------------------------------------------------------- */
+    hideStatusBar: function(n){
+        var statusbar = $('wysiwyg_statusbar_' + n);
+        if (statusbar) {
+            statusbar.style.display = "none";
+        }
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : showStatusBar()
+     Description : Display the status bar
+     Usage       : WYSIWYG.showStatusBar(n)
+     Arguments   : n - The editor identifier (the textarea's ID)
+     \* ---------------------------------------------------------------------- */
+    showStatusBar: function(n){
+        var statusbar = $('wysiwyg_statusbar_' + n);
+        if (statusbar) {
+            statusbar.style.display = "";
+        }
+    },
+    
+    /**
+     * Finds the node with the given tag name in the given range
+     *
+     * @param {String} tagName Parent tag to find
+     * @param {Range} range Current range
+     */
+    findParent: function(parentTagName, range){
+        parentTagName = parentTagName.toUpperCase();
+        var rangeWorking;
+        var elmWorking = null;
+        try {
+            if (!WYSIWYG_Core.isMSIE) {
+                var node = range.startContainer;
+                var pos = range.startOffset;
+                if (node.nodeType != 3) {
+                    node = node.childNodes[pos];
+                }
+                return WYSIWYG_Core.findParentNode(parentTagName, node);
+            }
+            else {
+                elmWorking = (range.length > 0) ? range.item(0) : range.parentElement();
+                elmWorking = WYSIWYG_Core.findParentNode(parentTagName, elmWorking);
+                if (elmWorking != null) 
+                    return elmWorking;
+                
+                rangeWorking = range.duplicate();
+                rangeWorking.collapse(true);
+                rangeWorking.moveEnd("character", 1);
+                if (rangeWorking.text.length > 0) {
+                    while (rangeWorking.compareEndPoints("EndToEnd", range) < 0) {
+                        rangeWorking.move("Character");
+                        if (null != this.findParentTag(parentTagName, rangeWorking)) {
+                            return this.findParentTag(parentTagName, rangeWorking);
+                        }
+                    }
+                }
+                return null;
+            }
+        } 
+        catch (e) {
+            return null;
+        }
+    },
+    
+    /**
+     * Get the acutally tag of the given range
+     *
+     * @param {Range} range Current range
+     */
+    getTag: function(range){
+        try {
+            if (!WYSIWYG_Core.isMSIE) {
+                var node = range.startContainer;
+                var pos = range.startOffset;
+                if (node.nodeType != 3) {
+                    node = node.childNodes[pos];
+                }
+                
+                if (node.nodeName && node.nodeName.search(/#/) != -1) {
+                    return node.parentNode;
+                }
+                return node;
+            }
+            else {
+                if (range.length > 0) {
+                    return range.item(0);
+                }
+                else 
+                    if (range.parentElement()) {
+                        return range.parentElement();
+                    }
+            }
+            return null;
+        } 
+        catch (e) {
+            return null;
+        }
+    },
+    
+    /**
+     * Get the parent node of the given node
+     *
+     * @param {DOMElement} element - Element which parent will be returned
+     */
+    getParent: function(element){
+        if (element.parentNode) {
+            return element.parentNode;
+        }
+        return null;
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : getTextRange()
+     Description : Get the text range object of the given element
+     Usage       : WYSIWYG.getTextRange(element)
+     Arguments   : element - An element of which you get the text range object
+     \* ---------------------------------------------------------------------- */
+    getTextRange: function(element){
+        var range = element.parentTextEdit.createTextRange();
+        range.moveToElementText(element);
+        return range;
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : invertIELineBreakCapability()
+     Description : Inverts the line break capability of IE (Thx to richyrich)
+     Normal: ENTER = <p> , SHIFT + ENTER = <br>
+     Inverted: ENTER = <br>, SHIFT + ENTER = <p>
+     Usage       : WYSIWYG.invertIELineBreakCapability(n)
+     Arguments   : n   - The editor identifier (the textarea's ID)
+     \* ---------------------------------------------------------------------- */
+    invertIELineBreakCapability: function(n){
+    
+        var editor = this.getEditorWindow(n);
+        var sel;
+        // validate if the press key is the carriage return key
+        if (editor.event.keyCode == 13) {
+            if (!editor.event.shiftKey) {
+                sel = this.getRange(this.getSelection(n));
+                sel.pasteHTML("<br>");
+                editor.event.cancelBubble = true;
+                editor.event.returnValue = false;
+                sel.select();
+                sel.moveEnd("character", 1);
+                sel.moveStart("character", 1);
+                sel.collapse(false);
+                return false;
+            }
+            else {
+                sel = this.getRange(this.getSelection(n));
+                sel.pasteHTML("<p>");
+                editor.event.cancelBubble = true;
+                editor.event.returnValue = false;
+                sel.select();
+                sel.moveEnd("character", 1);
+                sel.moveStart("character", 1);
+                sel.collapse(false);
+                return false;
+            }
+        }
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : selectNode()
+     Description : Select a node within the current editor
+     Usage       : WYSIWYG.selectNode(n, level)
+     Arguments   : n   - The editor identifier (the textarea's ID)
+     level - identifies the level of the element which will be selected
+     \* ---------------------------------------------------------------------- */
+    selectNode: function(n, level){
+    
+        var sel = this.getSelection(n);
+        var range = this.getRange(sel);
+        var parentnode = this.getTag(range);
+        var i = 0;
+        
+        for (var node = parentnode; (node && (node.nodeType == 1)); node = node.parentNode) {
+            if (i == level) {
+                this.nodeSelection(n, node);
+            }
+            i++;
+        }
+        
+        this.updateStatusBar(n);
+    },
+    
+    /* ---------------------------------------------------------------------- *\
+     Function    : nodeSelection()
+     Description : Do the node selection
+     Usage       : WYSIWYG.nodeSelection(n, node)
+     Arguments   : n   - The editor identifier (the textarea's ID)
+     node - The node which will be selected
+     \* ---------------------------------------------------------------------- */
+    nodeSelection: function(n, node){
+    
+        var doc = this.getEditorWindow(n).document;
+        var sel = this.getSelection(n);
+        var range = this.getRange(sel);
+        
+        if (!WYSIWYG_Core.isMSIE) {
+            if (node.nodeName == "BODY") {
+                range.selectNodeContents(node);
+            }
+            else {
+                range.selectNode(node);
+            }
+            
+            /*
+             if (endNode) {
+             try {
+             range.setStart(node, startOffset);
+             range.setEnd(endNode, endOffset);
+             } catch(e) {
+             }
+             }
+             */
+            if (sel) {
+                sel.removeAllRanges();
+            }
+            if (sel) {
+                sel.addRange(range);
+            }
+        }
+        else {
+            // MSIE may not select everything when BODY is selected - 
+            // start may be set to first text node instead of first non-text node - 
+            // no known workaround
+            if ((node.nodeName == "TABLE") || (node.nodeName == "IMG") || (node.nodeName == "INPUT") || (node.nodeName == "SELECT") || (node.nodeName == "TEXTAREA")) {
+                try {
+                    range = doc.body.createControlRange();
+                    range.addElement(node);
+                    range.select();
+                } 
+                catch (e) {
+                }
+            }
+            else {
+                range = doc.body.createTextRange();
+                if (range) {
+                    range.collapse();
+                    if (range.moveToElementText) {
+                        try {
+                            range.moveToElementText(node);
+                            range.select();
+                        } 
+                        catch (e) {
+                            try {
+                                range = doc.body.createTextRange();
+                                range.moveToElementText(node);
+                                range.select();
+                            } 
+                            catch (e) {
+                            }
+                        }
+                    }
+                    else {
+                        try {
+                            range = doc.body.createTextRange();
+                            range.moveToElementText(node);
+                            range.select();
+                        } 
+                        catch (e) {
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+/********************************************************************
+ * openWYSIWYG core functions Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ *
+ * $Id: wysiwyg.js,v 1.22 2007/09/08 21:45:57 xhaggi Exp $
+ ********************************************************************/
+var WYSIWYG_Core = {
+
+    /**
+     * Holds true if browser is MSIE, otherwise false
+     */
+    isMSIE: navigator.appName == "Microsoft Internet Explorer" ? true : false,
+    
+    /**
+     * Holds true if browser is Firefox (Mozilla)
+     */
+    isFF: !document.all && document.getElementById && !this.isOpera,
+    
+    /**
+     * Holds true if browser is Opera, otherwise false
+     */
+    isOpera: navigator.appName == "Opera" ? true : false,
+    
+    /**
+     * Trims whitespaces of the given string
+     *
+     * @param str String
+     * @return Trimmed string
+     */
+    trim: function(str){
+        return str.replace(/^\s*|\s*$/g, "");
+    },
+    
+    /**
+     * Determine if the given parameter is defined
+     *
+     * @param p Parameter
+     * @return true/false dependents on definition of the parameter
+     */
+    defined: function(p){
+        return typeof p == "undefined" ? false : true;
+    },
+    
+    /**
+     * Determine if the browser version is compatible
+     *
+     * @return true/false depending on compatiblity of the browser
+     */
+    isBrowserCompatible: function(){
+        //Validate browser and compatibility
+        if (!document.getElementById || !document.designMode || (!document.selection && typeof document.createRange == 'undefined')) {
+            return false;
+        }
+        return true;
+    },
+    
+    /**
+     * Set the style attribute of the given element.
+     * Private method to solve the IE bug while setting the style attribute.
+     *
+     * @param {DOMElement} node The element on which the style attribute will affect
+     * @param {String} style Stylesheet which will be set
+     */
+    _setStyleAttribute: function(node, style){
+        if (style == null) 
+            return;
+        var styles = style.split(";");
+        var pos;
+        for (var i = 0; i < styles.length; i++) {
+            var attributes = styles[i].split(":");
+            if (attributes.length == 2) {
+                try {
+                    var attr = WYSIWYG_Core.trim(attributes[0]);
+                    while ((pos = attr.search(/-/)) != -1) {
+                        var strBefore = attr.substring(0, pos);
+                        var strToUpperCase = attr.substring(pos + 1, pos + 2);
+                        var strAfter = attr.substring(pos + 2, attr.length);
+                        attr = strBefore + strToUpperCase.toUpperCase() + strAfter;
+                    }
+                    var value = WYSIWYG_Core.trim(attributes[1]).toLowerCase();
+                    node.style[attr] = value;
+                } 
+                catch (e) {
+                    alert(e);
+                }
+            }
+        }
+    },
+    
+    /**
+     * Fix's the issue while getting the attribute style on IE
+     * It's return an object but we need the style string
+     *
+     * @private
+     * @param {DOMElement} node Node element
+     * @return {String} Stylesheet
+     */
+    _getStyleAttribute: function(node){
+        if (this.isMSIE) {
+            return node.style['cssText'].toLowerCase();
+        }
+        else {
+            return node.getAttribute("style");
+        }
+    },
+    
+    /**
+     * Set an attribute's value on the given node element.
+     *
+     * @param {DOMElement} node Node element
+     * @param {String} attr Attribute which is set
+     * @param {String} value Value of the attribute
+     */
+    setAttribute: function(node, attr, value){
+        if (value == null || node == null || attr == null) 
+            return;
+        if (attr.toLowerCase() == "style") {
+            this._setStyleAttribute(node, value);
+        }
+        else {
+            node.setAttribute(attr, value);
+        }
+    },
+    
+    /**
+     * Removes an attribute on the given node
+     *
+     * @param {DOMElement} node Node element
+     * @param {String} attr Attribute which will be removed
+     */
+    removeAttribute: function(node, attr){
+        node.removeAttribute(attr, false);
+    },
+    
+    /**
+     * Get the vale of the attribute on the given node
+     *
+     * @param {DOMElement} node Node element
+     * @param {String} attr Attribute which value will be returned
+     */
+    getAttribute: function(node, attr){
+        if (node == null || attr == null) 
+            return;
+        if (attr.toLowerCase() == "style") {
+            return this._getStyleAttribute(node);
+        }
+        else {
+            return node.getAttribute(attr);
+        }
+    },
+    
+    /**
+     * Get the path out of an given url
+     *
+     * @param {String} url The url with is used to get the path
+     */
+    getDocumentPathOfUrl: function(url){
+        var path = null;
+        
+        // if local file system, convert local url into web url
+        url = url.replace(/file:\/\//gi, "file:///");
+        url = url.replace(/\\/gi, "\/");
+        var pos = url.lastIndexOf("/");
+        if (pos != -1) {
+            path = url.substring(0, pos + 1);
+        }
+        return path;
+    },
+    
+    /**
+     * Get the documents url, convert local urls to web urls
+     *
+     * @param {DOMElement} doc Document which is used to get the url
+     */
+    getDocumentUrl: function(doc){
+        // if local file system, convert local url into web url
+        var url = doc.URL;
+        url = url.replace(/file:\/\//gi, "file:///");
+        url = url.replace(/\\/gi, "\/");
+        return url;
+    },
+    
+    /**
+     * Find a parent node with the given name, of the given start node
+     *
+     * @param {String} tagName - Tag name of the node to find
+     * @param {DOMElement} node - Node element
+     */
+    findParentNode: function(tagName, node){
+        while (node.tagName != "HTML") {
+            if (node.tagName == tagName) {
+                return node;
+            }
+            node = node.parentNode;
+        }
+        return null;
+    },
+    
+    /**
+     * Cancel the given event.
+     *
+     * @param e Event which will be canceled
+     */
+    cancelEvent: function(e){
+        if (!e) 
+            return false;
+        if (this.isMSIE) {
+            e.returnValue = false;
+            e.cancelBubble = true;
+        }
+        else {
+            e.preventDefault();
+            e.stopPropagation && e.stopPropagation();
+        }
+        return false;
+    },
+    
+    /**
+     * Converts a RGB color string to hex color string.
+     *
+     * @param color RGB color string
+     * @param Hex color string
+     */
+    toHexColor: function(color){
+        color = color.replace(/^rgb/g, '');
+        color = color.replace(/\(/g, '');
+        color = color.replace(/\)/g, '');
+        color = color.replace(/ /g, '');
+        color = color.split(',');
+        var r = parseFloat(color[0]).toString(16).toUpperCase();
+        var g = parseFloat(color[1]).toString(16).toUpperCase();
+        var b = parseFloat(color[2]).toString(16).toUpperCase();
+        if (r.length < 2) {
+            r = '0' + r;
+        }
+        if (g.length < 2) {
+            g = '0' + g;
+        }
+        if (b.length < 2) {
+            b = '0' + b;
+        }
+        return r + g + b;
+    },
+    
+    /**
+     * Converts a decimal color to hex color string.
+     *
+     * @param Decimal color
+     * @param Hex color string
+     */
+    _dec_to_rgb: function(value){
+        var hex_string = "";
+        for (var hexpair = 0; hexpair < 3; hexpair++) {
+            var myByte = value & 0xFF; // get low byte
+            value >>= 8; // drop low byte
+            var nybble2 = myByte & 0x0F; // get low nybble (4 bits)
+            var nybble1 = (myByte >> 4) & 0x0F; // get high nybble
+            hex_string += nybble1.toString(16); // convert nybble to hex
+            hex_string += nybble2.toString(16); // convert nybble to hex
+        }
+        return hex_string.toUpperCase();
+    },
+    
+    /**
+     * Replace RGB color strings with hex color strings within a string.
+     *
+     * @param {String} str RGB String
+     * @param {String} Hex color string
+     */
+    replaceRGBWithHexColor: function(str){
+        if (str == null) 
+            return "";
+        // find all decimal color strings
+        var matcher = str.match(/rgb\([0-9 ]+,[0-9 ]+,[0-9 ]+\)/gi);
+        if (matcher) {
+            for (var j = 0; j < matcher.length; j++) {
+                var regex = eval("/" + WYSIWYG_Core.stringToRegex(matcher[j]) + "/gi");
+                // replace the decimal color strings with hex color strings
+                str = str.replace(regex, "#" + this.toHexColor(matcher[j]));
+            }
+        }
+        return str;
+    },
+    
+    /**
+     * Execute the given command on the given editor
+     *
+     * @param n The editor's identifier
+     * @param cmd Command which is execute
+     */
+    execCommand: function(n, cmd, value){
+        if (typeof(value) == "undefined") 
+            value = null;
+        
+        // firefox BackColor problem fixed
+        if (cmd == 'BackColor' && WYSIWYG_Core.isFF) 
+            cmd = 'HiliteColor';
+        
+        // firefox cut, paste and copy
+        if (WYSIWYG_Core.isFF && (cmd == "Cut" || cmd == "Paste" || cmd == "Copy")) {
+            try {
+                WYSIWYG.getEditorWindow(n).document.execCommand(cmd, false, value);
+            } 
+            catch (e) {
+                if (confirm("Copy/Cut/Paste is not available in Mozilla and Firefox\nDo you want more information about this issue?")) {
+                    window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html');
+                }
+            }
+        }
+        
+        else {
+            WYSIWYG.getEditorWindow(n).document.execCommand(cmd, false, value);
+        }
+    },
+    
+    /**
+     * Parse a given string to a valid regular expression
+     *
+     * @param {String} string String to be parsed
+     * @return {RegEx} Valid regular expression
+     */
+    stringToRegex: function(string){
+    
+        string = string.replace(/\//gi, "\\/");
+        string = string.replace(/\(/gi, "\\(");
+        string = string.replace(/\)/gi, "\\)");
+        string = string.replace(/\[/gi, "\\[");
+        string = string.replace(/\]/gi, "\\]");
+        string = string.replace(/\+/gi, "\\+");
+        string = string.replace(/\$/gi, "\\$");
+        string = string.replace(/\*/gi, "\\*");
+        string = string.replace(/\?/gi, "\\?");
+        string = string.replace(/\^/gi, "\\^");
+        string = string.replace(/\\b/gi, "\\\\b");
+        string = string.replace(/\\B/gi, "\\\\B");
+        string = string.replace(/\\d/gi, "\\\\d");
+        string = string.replace(/\\B/gi, "\\\\B");
+        string = string.replace(/\\D/gi, "\\\\D");
+        string = string.replace(/\\f/gi, "\\\\f");
+        string = string.replace(/\\n/gi, "\\\\n");
+        string = string.replace(/\\r/gi, "\\\\r");
+        string = string.replace(/\\t/gi, "\\\\t");
+        string = string.replace(/\\v/gi, "\\\\v");
+        string = string.replace(/\\s/gi, "\\\\s");
+        string = string.replace(/\\S/gi, "\\\\S");
+        string = string.replace(/\\w/gi, "\\\\w");
+        string = string.replace(/\\W/gi, "\\\\W");
+        
+        return string;
+    },
+    
+    /**
+     * Add an event listener
+     *
+     * @param obj Object on which the event will be attached
+     * @param ev Kind of event
+     * @param fu Function which is execute on the event
+     */
+    addEvent: function(obj, ev, fu){
+        if (obj.attachEvent) 
+            obj.attachEvent("on" + ev, fu);
+        else 
+            obj.addEventListener(ev, fu, false);
+    },
+    
+    /**
+     * Remove an event listener
+     *
+     * @param obj Object on which the event will be attached
+     * @param ev Kind of event
+     * @param fu Function which is execute on the event
+     */
+    removeEvent: function(obj, ev, fu){
+        if (obj.attachEvent) 
+            obj.detachEvent("on" + ev, fu);
+        else 
+            obj.removeEventListener(ev, fu, false);
+    },
+    
+    /**
+     * Includes a javascript file
+     *
+     * @param file Javascript file path and name
+     */
+    includeJS: function(file){
+        var script = document.createElement("script");
+        this.setAttribute(script, "type", "text/javascript");
+        this.setAttribute(script, "src", file);
+        var heads = document.getElementsByTagName("head");
+        for (var i = 0; i < heads.length; i++) {
+            heads[i].appendChild(script);
+        }
+    },
+    
+    /**
+     * Includes a stylesheet file
+     *
+     * @param file Stylesheet file path and name
+     */
+    includeCSS: function(path){
+        var link = document.createElement("link");
+        this.setAttribute(link, "rel", "stylesheet");
+        this.setAttribute(link, "type", "text/css");
+        this.setAttribute(link, "href", path);
+        var heads = document.getElementsByTagName("head");
+        for (var i = 0; i < heads.length; i++) {
+            heads[i].appendChild(link);
+        }
+    },
+    
+    /**
+     * Get the screen position of the given element.
+     *
+     * @param {HTMLObject} elm1 Element which position will be calculate
+     * @param {HTMLObject} elm2 Element which is the last one before calculation stops
+     * @param {Object} Left and top position of the given element
+     */
+    getElementPosition: function(elm1, elm2){
+        var top = 0, left = 0;
+        while (elm1 && elm1 != elm2) {
+            left += elm1.offsetLeft;
+            top += elm1.offsetTop;
+            elm1 = elm1.offsetParent;
+        }
+        return {
+            left: left,
+            top: top
+        };
+    },
+    
+    /**
+     * Get the window size
+     * @private
+     */
+    windowSize: function(){
+        if (window.innerWidth) {
+            return {
+                width: window.innerWidth,
+                height: window.innerHeight
+            };
+        }
+        else 
+            if (document.body && document.body.offsetWidth) {
+                return {
+                    width: document.body.offsetWidth,
+                    height: document.body.offsetHeight
+                };
+            }
+            else {
+                return {
+                    width: 0,
+                    height: 0
+                };
+            }
+    }
+}
+
+/**
+ * Context menu object
+ */
+var WYSIWYG_ContextMenu = {
+
+    html: "",
+    contextMenuDiv: null,
+    
+    /**
+     * Init function
+     *
+     * @param {String} n Editor identifier
+     */
+    init: function(n){
+        var doc = WYSIWYG.getEditorWindow(n).document;
+        
+        // create context menu div
+        this.contextMenuDiv = document.createElement("div");
+        this.contextMenuDiv.className = "wysiwyg-context-menu-div";
+        this.contextMenuDiv.setAttribute("class", "wysiwyg-context-menu-div");
+        this.contextMenuDiv.style.display = "none";
+        this.contextMenuDiv.style.position = "absolute";
+        this.contextMenuDiv.style.zIndex = 9999;
+        this.contextMenuDiv.style.left = "0";
+        this.contextMenuDiv.style.top = "0";
+        this.contextMenuDiv.unselectable = "on";
+        document.body.insertBefore(this.contextMenuDiv, document.body.firstChild);
+        
+        // bind event listeners
+        WYSIWYG_Core.addEvent(doc, "contextmenu", function context(e){
+            WYSIWYG_ContextMenu.show(e, n);
+        });
+        WYSIWYG_Core.addEvent(doc, "click", function context(e){
+            WYSIWYG_ContextMenu.close();
+        });
+        WYSIWYG_Core.addEvent(doc, "keydown", function context(e){
+            WYSIWYG_ContextMenu.close();
+        });
+        WYSIWYG_Core.addEvent(document, "click", function context(e){
+            WYSIWYG_ContextMenu.close();
+        });
+    },
+    
+    /**
+     * Show the context menu
+     *
+     * @param e Event
+     * @param n Editor identifier
+     */
+    show: function(e, n){
+        if (this.contextMenuDiv == null) 
+            return false;
+        
+        var ifrm = WYSIWYG.getEditor(n);
+        var doc = WYSIWYG.getEditorWindow(n).document;
+        
+        // set the context menu position
+        var pos = WYSIWYG_Core.getElementPosition(ifrm);
+        var x = WYSIWYG_Core.isMSIE ? pos.left + e.clientX : pos.left + (e.pageX - doc.body.scrollLeft);
+        var y = WYSIWYG_Core.isMSIE ? pos.top + e.clientY : pos.top + (e.pageY - doc.body.scrollTop);
+        
+        this.contextMenuDiv.style.left = x + "px";
+        this.contextMenuDiv.style.top = y + "px";
+        this.contextMenuDiv.style.visibility = "visible";
+        this.contextMenuDiv.style.display = "block";
+        
+        // call the context menu, mozilla needs some time
+        window.setTimeout("WYSIWYG_ContextMenu.output('" + n + "')", 10);
+        
+        WYSIWYG_Core.cancelEvent(e);
+        return false;
+    },
+    
+    /**
+     * Output the context menu items
+     *
+     * @param n Editor identifier
+     */
+    output: function(n){
+    
+        // get selection
+        var sel = WYSIWYG.getSelection(n);
+        var range = WYSIWYG.getRange(sel);
+        
+        // get current selected node                                   
+        var tag = WYSIWYG.getTag(range);
+        if (tag == null) {
+            return;
+        }
+        
+        // clear context menu
+        this.clear();
+        
+        // Determine kind of nodes
+        var isImg = (tag.nodeName == "IMG") ? true : false;
+        var isLink = (tag.nodeName == "A") ? true : false;
+        
+        // Selection is an image or selection is a text with length greater 0
+        var len = 0;
+        if (WYSIWYG_Core.isMSIE) 
+            len = (document.selection && range.text) ? range.text.length : 0;
+        else 
+            len = range.toString().length;
+        var sel = len != 0 || isImg;
+        
+        // Icons
+        var iconLink = {
+            enabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["createlink"][3],
+            disabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["createlink"][2]
+        };
+        var iconImage = {
+            enabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["insertimage"][3],
+            disabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["insertimage"][2]
+        };
+        var iconDelete = {
+            enabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["delete"][3],
+            disabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["delete"][2]
+        };
+        var iconCopy = {
+            enabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["copy"][3],
+            disabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["copy"][2]
+        };
+        var iconCut = {
+            enabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["cut"][3],
+            disabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["cut"][2]
+        };
+        var iconPaste = {
+            enabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["paste"][3],
+            disabled: WYSIWYG.config[n].ImagesDir + WYSIWYG.ToolbarList["paste"][2]
+        };
+        
+        // Create context menu html
+        this.html += '<table class="wysiwyg-context-menu" border="0" cellpadding="0" cellspacing="0">';
+        
+        // Add items
+        this.addItem(n, 'Copy', iconCopy, 'Copy', sel);
+        this.addItem(n, 'Cut', iconCut, 'Cut', sel);
+        this.addItem(n, 'Paste', iconPaste, 'Paste', true);
+        this.addSeperator();
+        this.addItem(n, 'InsertImage', iconImage, 'Modify Image Properties...', isImg);
+        this.addItem(n, 'CreateLink', iconLink, 'Create or Modify Link...', sel || isLink);
+        this.addItem(n, 'RemoveNode', iconDelete, 'Remove', true);
+        
+        this.html += '</table>';
+        this.contextMenuDiv.innerHTML = this.html;
+    },
+    
+    /**
+     * Close the context menu
+     */
+    close: function(){
+        this.contextMenuDiv.style.visibility = "hidden";
+        this.contextMenuDiv.style.display = "none";
+    },
+    
+    /**
+     * Clear context menu
+     */
+    clear: function(){
+        this.contextMenuDiv.innerHTML = "";
+        this.html = "";
+    },
+    
+    /**
+     * Add context menu item
+     *
+     * @param n editor identifier
+     * @param cmd Command
+     * @param icon Icon which is diabled
+     * @param title Title of the item
+     * @param disabled If item is diabled
+     */
+    addItem: function(n, cmd, icon, title, disabled){
+        var item = '';
+        
+        if (disabled) {
+            item += '<tr>';
+            item += '<td class="icon"><a href="javascript:WYSIWYG.execCommand(\'' + n + '\',\'' + cmd + '\', null);"><img src="' + icon.enabled + '" border="0"></a></td>';
+            item += '<td onmouseover="this.className=\'mouseover\'" onmouseout="this.className=\'\'" onclick="WYSIWYG.execCommand(\'' + n + '\', \'' + cmd + '\', null);WYSIWYG_ContextMenu.close();"><a href="javascript:void(0);">' + title + '</a></td>';
+            item += '</tr>';
+        }
+        else {
+            item += '<tr>';
+            item += '<td class="icon"><img src="' + icon.disabled + '" border="0"></td>';
+            item += '<td onmouseover="this.className=\'mouseover\'" onmouseout="this.className=\'\'"><span class="disabled">' + title + '</span></td>';
+            item += '</tr>';
+        }
+        
+        this.html += item;
+    },
+    
+    /**
+     * Add seperator to context menu
+     */
+    addSeperator: function(){
+        var output = '';
+        output += '<tr>';
+        output += '<td colspan="2" style="text-align:center;"><hr size="1" color="#C9C9C9" width="95%"></td>';
+        output += '</tr>';
+        this.html += output;
+    }
+}
+
+/**
+ * Table object
+ */
+var WYSIWYG_Table = {
+
+    /**
+     *
+     */
+    create: function(n, tbl){
+    
+        // get editor
+        var doc = WYSIWYG.getEditorWindow(n).document;
+        // get selection and range
+        var sel = WYSIWYG.getSelection(n);
+        var range = WYSIWYG.getRange(sel);
+        var table = null;
+        
+        // get element from selection
+        if (WYSIWYG_Core.isMSIE) {
+            if (sel.type == "Control" && range.length == 1) {
+                range = WYSIWYG.getTextRange(range(0));
+                range.select();
+            }
+        }
+        
+        // find a parent TABLE element
+        //table = WYSIWYG.findParent("table", range);
+        
+        // check if parent is found
+        //var update = (table == null) ? false : true;
+        //if(!update) table = tbl;
+        table = tbl;
+        
+        // add rows and cols
+        var rows = WYSIWYG_Core.getAttribute(tbl, "tmprows");
+        var cols = WYSIWYG_Core.getAttribute(tbl, "tmpcols");
+        WYSIWYG_Core.removeAttribute(tbl, "tmprows");
+        WYSIWYG_Core.removeAttribute(tbl, "tmpcols");
+        for (var i = 0; i < rows; i++) {
+            var tr = doc.createElement("tr");
+            for (var j = 0; j < cols; j++) {
+                var td = createTD();
+                tr.appendChild(td);
+            }
+            table.appendChild(tr);
+        }
+        
+        // on update exit here
+        //if(update) { return; }
+        
+        // Check if IE or Mozilla (other)
+        if (WYSIWYG_Core.isMSIE) {
+            range.pasteHTML(table.outerHTML);
+        }
+        else {
+            WYSIWYG.insertNodeAtSelection(table, n);
+        }
+        
+        // refresh table highlighting
+        this.refreshHighlighting(n);
+        
+        
+        
+        
+        // functions
+        function createTD(){
+            var td = doc.createElement("td");
+            td.innerHTML = "&nbsp;";
+            return td;
+        }
+        
+    },
+    
+    /**
+     * Enables the table highlighting
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    refreshHighlighting: function(n){
+        var doc = WYSIWYG.getEditorWindow(n).document;
+        var tables = doc.getElementsByTagName("table");
+        for (var i = 0; i < tables.length; i++) {
+            this._enableHighlighting(tables[i]);
+        }
+        var tds = doc.getElementsByTagName("td");
+        for (var i = 0; i < tds.length; i++) {
+            this._enableHighlighting(tds[i]);
+        }
+    },
+    
+    /**
+     * Enables the table highlighting
+     *
+     * @param {String} n The editor identifier (the textarea's ID)
+     */
+    disableHighlighting: function(n){
+        var doc = WYSIWYG.getEditorWindow(n).document;
+        var tables = doc.getElementsByTagName("table");
+        for (var i = 0; i < tables.length; i++) {
+            this._disableHighlighting(tables[i]);
+        }
+        var tds = doc.getElementsByTagName("td");
+        for (var i = 0; i < tds.length; i++) {
+            this._disableHighlighting(tds[i]);
+        }
+        
+    },
+    
+    /**
+     * @private
+     */
+    _enableHighlighting: function(node){
+        var style = WYSIWYG_Core.getAttribute(node, "style");
+        if (style == null) 
+            style = " ";
+        //alert("ENABLE: ELM = " + node.tagName + "; STYLE = " + style);
+        WYSIWYG_Core.removeAttribute(node, "prevstyle");
+        WYSIWYG_Core.setAttribute(node, "prevstyle", style);
+        WYSIWYG_Core.setAttribute(node, "style", "border:1px dashed #AAAAAA;");
+    },
+    
+    /**
+     * @private
+     */
+    _disableHighlighting: function(node){
+        var style = WYSIWYG_Core.getAttribute(node, "prevstyle");
+        //alert("DISABLE: ELM = " + node.tagName + "; STYLE = " + style);
+        // if no prevstyle is defined, the table is not in highlighting mode
+        if (style == null || style == "") {
+            this._enableHighlighting(node);
+            return;
+        }
+        WYSIWYG_Core.removeAttribute(node, "prevstyle");
+        WYSIWYG_Core.removeAttribute(node, "style");
+        WYSIWYG_Core.setAttribute(node, "style", style);
+    }
+}
+
+
+/**
+ * Get an element by it's identifier
+ *
+ * @param id Element identifier
+ */
+function $(id){
+    return document.getElementById(id);
+}
+
+/**
+ * Emulates insertAdjacentHTML(), insertAdjacentText() and
+ * insertAdjacentElement() three functions so they work with Netscape 6/Mozilla
+ * by Thor Larholm me@jscript.dk
+ */
+if (typeof HTMLElement != "undefined" && !HTMLElement.prototype.insertAdjacentElement) {
+    HTMLElement.prototype.insertAdjacentElement = function(where, parsedNode){
+        switch (where) {
+            case 'beforeBegin':
+                this.parentNode.insertBefore(parsedNode, this);
+                break;
+            case 'afterBegin':
+                this.insertBefore(parsedNode, this.firstChild);
+                break;
+            case 'beforeEnd':
+                this.appendChild(parsedNode);
+                break;
+            case 'afterEnd':
+                if (this.nextSibling) {
+                    this.parentNode.insertBefore(parsedNode, this.nextSibling);
+                }
+                else {
+                    this.parentNode.appendChild(parsedNode);
+                }
+                break;
+        }
+    };
+    
+    HTMLElement.prototype.insertAdjacentHTML = function(where, htmlStr){
+        var r = this.ownerDocument.createRange();
+        r.setStartBefore(this);
+        var parsedHTML = r.createContextualFragment(htmlStr);
+        this.insertAdjacentElement(where, parsedHTML);
+    };
+    
+    
+    HTMLElement.prototype.insertAdjacentText = function(where, txtStr){
+        var parsedText = document.createTextNode(txtStr);
+        this.insertAdjacentElement(where, parsedText);
+    };
+}
+
+/**
+ * Emulates insertAdjacentHTML(), insertAdjacentText() and
+ * insertAdjacentElement() three functions so they work with Netscape 6/Mozilla/Safari
+ * by Thor Larholm me@jscript.dk
+ *
+ * Modified:06112008 By CJBoCo www.cjboco.com
+ * -Instead of testing for browser type,we test if the object is undefined
+ */
+if (typeof HTMLElement != 'undefined') {
+    if (typeof HTMLElement.insertAdjacentHTML == 'undefined') {
+        HTMLElement.prototype.insertAdjacentElement = function(where, parsedNode){
+            switch (where) {
+                case 'beforeBegin':
+                    this.parentNode.insertBefore(parsedNode, this);
+                    break;
+                case 'afterBegin':
+                    this.insertBefore(parsedNode, this.firstChild);
+                    break;
+                case 'beforeEnd':
+                    this.appendChild(parsedNode);
+                    break;
+                case 'afterEnd':
+                    if (this.nextSibling) {
+                        this.parentNode.insertBefore(parsedNode, this.nextSibling);
+                    }
+                    else {
+                        this.parentNode.appendChild(parsedNode);
+                    }
+                    break;
+            }
+        };
+    }
+    if (typeof HTMLElement.insertAdjacentHTML == 'undefined') {
+        HTMLElement.prototype.insertAdjacentHTML = function(where, htmlStr){
+            var r = this.ownerDocument.createRange();
+            r.setStartBefore(this);
+            var parsedHTML = r.createContextualFragment(htmlStr);
+            this.insertAdjacentElement(where, parsedHTML);
+        };
+    }
+    if (typeof HTMLElement.insertAdjacentText == 'undefined') {
+        HTMLElement.prototype.insertAdjacentText = function(where, txtStr){
+            var parsedText = document.createTextNode(txtStr);
+            this.insertAdjacentElement(where, parsedText);
+        };
+    }
+}
+
diff --git a/openwysiwyg/styles/wysiwyg.css b/openwysiwyg/styles/wysiwyg.css
new file mode 100644 (file)
index 0000000..61b57be
--- /dev/null
@@ -0,0 +1,53 @@
+/********************************************************************
+ * openWYSIWYG stylesheet file Copyright (c) 2006 openWebWare.com
+ * Contact us at devs@openwebware.com
+ * This copyright notice MUST stay intact for use.
+ *
+ * $Id: wysiwyg.css,v 1.2 2007/01/29 19:19:49 xhaggi Exp $
+ ********************************************************************/
+
+/* Toolbar */
+.toolbar1   { height: 26px; background-image: url(../images/background_silver.jpg); }
+/*.toolbar1   { height: 26px; background-color: #F4F4F4; border-bottom:1px solid #C9C9C9; }*/
+
+/* Command Buttons */
+.buttonEditor     { width: 20px; height: 20px; border: 0px solid transparent; margin: 1px; padding: 0px; background: transparent; }
+.buttonEditorOver { width: 20px; height: 20px; border: 1px solid #999999; margin: 0; padding: 0px; }
+
+/* Table Textarea */
+.tableTextareaEditor { border: 1px solid #888888; }
+.iframeText { background-color: #FFFFFF; }
+
+/* Status Bar */
+.wysiwyg-statusbar {font-family: Arial; font-size: 9px; background-color: #EEEEEE;}
+a.wysiwyg-statusbar {font-family: Arial; font-size: 9px; color: #000000; text-decoration:none;}
+a.wysiwyg-statusbar:hover {font-family: Arial; font-size: 9px; color: #000000; text-decoration:underline;}
+
+/* Font Type and Size Drop Down */
+.dropdown          { background-color: #FFFFFF; border: 1px solid #333333; height: 140px; overflow: auto; padding: 1px;}
+button.mouseOver   { background-color: #EEEEEE; border: 1px solid #CCCCCC; padding: 3px; cursor: default; text-align: left;}
+button.mouseOut    { background-color: #FFFFFF; border: 1px solid #FFFFFF; padding: 3px; cursor: default; text-align: left;}
+
+/* Context Menu */
+.wysiwyg-context-menu-div { background-color:#F4F4F4; border: 1px solid #C9C9C9; width:170px; }
+.wysiwyg-context-menu { font-family: Arial; font-size:11px; color:#000000; width:100%;}
+.wysiwyg-context-menu .icon {background-color:#EEEEEE;}
+.wysiwyg-context-menu .disabled { font-family: Arial; font-size:11px; color:#999999; text-decoration:none; padding-left: 3px; }
+.wysiwyg-context-menu a { font-family: Arial; font-size:11px; color:#000000; text-decoration:none; padding-left: 3px;}
+.wysiwyg-context-menu .mouseover {background-color: #EEEEEE;}
+
+
+/* CREATE TABLE POPUP */
+
+/* Select Border Width/Type */
+.on   { background-color: #EEEEEE; border: 1px solid #CCCCCC; padding: 6px; width: 140px; cursor: default; height: 5px;}
+.off  { background-color: #FFFFFF; border: 1px solid #FFFFFF; padding: 6px; width: 140px; cursor: default; height: 5px;}
+
+/* Select Shading/Border Color */
+.wysiwyg-color-picker-table  { border: 1px solid #7E7E81; background-color: #F7F7F7; padding: 1px; }
+.wysiwyg-color-picker-div    { font-size: 1px; height:12px; width:12px; }
+.selectColorBorder { border: 1px solid #F7F7F7; }
+.selectColorOn     { border: 1px solid #999999; background-color: #CCCCCC; }
+.selectColorOff    { border: 1px solid #F7F7F7; background-color: #F7F7F7; }
+
+
diff --git a/openwysiwyg/uploads/hagbard.jpg b/openwysiwyg/uploads/hagbard.jpg
new file mode 100644 (file)
index 0000000..f87a7e3
Binary files /dev/null and b/openwysiwyg/uploads/hagbard.jpg differ
diff --git a/wymeditor/iframe/default/lbl-blockquote.png b/wymeditor/iframe/default/lbl-blockquote.png
new file mode 100644 (file)
index 0000000..65ea205
Binary files /dev/null and b/wymeditor/iframe/default/lbl-blockquote.png differ
diff --git a/wymeditor/iframe/default/lbl-h1.png b/wymeditor/iframe/default/lbl-h1.png
new file mode 100644 (file)
index 0000000..dea1da3
Binary files /dev/null and b/wymeditor/iframe/default/lbl-h1.png differ
diff --git a/wymeditor/iframe/default/lbl-h2.png b/wymeditor/iframe/default/lbl-h2.png
new file mode 100644 (file)
index 0000000..f4b4274
Binary files /dev/null and b/wymeditor/iframe/default/lbl-h2.png differ
diff --git a/wymeditor/iframe/default/lbl-h3.png b/wymeditor/iframe/default/lbl-h3.png
new file mode 100644 (file)
index 0000000..bd99f76
Binary files /dev/null and b/wymeditor/iframe/default/lbl-h3.png differ
diff --git a/wymeditor/iframe/default/lbl-h4.png b/wymeditor/iframe/default/lbl-h4.png
new file mode 100644 (file)
index 0000000..e06ab3d
Binary files /dev/null and b/wymeditor/iframe/default/lbl-h4.png differ
diff --git a/wymeditor/iframe/default/lbl-h5.png b/wymeditor/iframe/default/lbl-h5.png
new file mode 100644 (file)
index 0000000..360fc60
Binary files /dev/null and b/wymeditor/iframe/default/lbl-h5.png differ
diff --git a/wymeditor/iframe/default/lbl-h6.png b/wymeditor/iframe/default/lbl-h6.png
new file mode 100644 (file)
index 0000000..73e644a
Binary files /dev/null and b/wymeditor/iframe/default/lbl-h6.png differ
diff --git a/wymeditor/iframe/default/lbl-p.png b/wymeditor/iframe/default/lbl-p.png
new file mode 100644 (file)
index 0000000..7f2bf34
Binary files /dev/null and b/wymeditor/iframe/default/lbl-p.png differ
diff --git a/wymeditor/iframe/default/lbl-pre.png b/wymeditor/iframe/default/lbl-pre.png
new file mode 100644 (file)
index 0000000..e026e47
Binary files /dev/null and b/wymeditor/iframe/default/lbl-pre.png differ
diff --git a/wymeditor/iframe/default/wymiframe.css b/wymeditor/iframe/default/wymiframe.css
new file mode 100644 (file)
index 0000000..769520c
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * WYMeditor : what you see is What You Mean web-based editor
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
+ * Dual licensed under the MIT (MIT-license.txt)
+ * and GPL (GPL-license.txt) licenses.
+ *
+ * For further information visit:
+ *        http://www.wymeditor.org/
+ * 
+ * File Name:
+ *        wymeditor.css
+ *        Main editor css file.
+ *        See the documentation for more info.
+ * 
+ * File Authors:
+ *        Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
+ *        Daniel Reszka (d.reszka a-t wymeditor dotorg)
+*/
+
+/* VISUAL FEEDBACK */
+
+/* basic */
+  body  { background: #e1e8f1;}
+/* make HTML blocs visible */
+  p,
+  h1,
+  h2,
+  h3,
+  h4,
+  h5,
+  h6,
+  ul,
+  ol,
+  table,
+  blockquote,
+  pre           { background: #FFFFFF no-repeat 2px 2px;
+                  padding:8px 5px 5px;
+                  margin:10px; }
+  td            { background: #F0F4F8; }
+  th            { background: #ffffcc; }
+  ul,
+  ol            { border-left:20px solid #B9C4D0; padding:0px 5px; }
+  caption       { background: #E4E4B0; padding: 5px; font-weight: bold; }
+  table         { font-size: 12px; width: 500px; }
+  td            { width: 25%; }
+  blockquote    { margin-left: 30px; }
+  pre           { background-color:transparent; border: 1px solid white; }
+
+/* Gecko min height fix */
+  p             { min-height: 1em; } /*min-height is needed under Firefox, because empty parargraphs */
+  *+html p      { min-height: auto; } /* but we have to remove it under IE7 because it triggers the 'haslayout' mode */
+  td            { height: 1.6em; }
+/* labels */
+  p         { background-image: url(lbl-p.png); }
+  h1        { background-image: url(lbl-h1.png); }
+  h2        { background-image: url(lbl-h2.png); }
+  h3        { background-image: url(lbl-h3.png); }
+  h4        { background-image: url(lbl-h4.png); }
+  h5        { background-image: url(lbl-h5.png); }
+  h6        { background-image: url(lbl-h6.png); }
+  blockquote{ background-image: url(lbl-blockquote.png); }
+  pre       { background-image: url(lbl-pre.png); }
+
+/* specific HTML elements */
+  caption   { text-align: left; }
+  img       { margin-right: 5px;
+              border-style: solid;
+              border-color: gray;
+              border-width: 0; }
+  a img     { border-width: 1px; border-color: blue; }
+  acronym   { border: 1px solid gray; }
+  span      { background-color: #eef; }
+
+/* visual feedback for non-valid nesting of elements*/
+  h1 h1, h1 h2, h1 h3, h1 h4, h1 h5, h1 h6, h1 p, h1 pre, h1 address,
+  h2 h1, h2 h2, h2 h3, h2 h4, h2 h5, h2 h6, h2 p, h2 pre, h2 address,
+  h3 h1, h3 h2, h3 h3, h3 h4, h3 h5, h3 h6, h3 p, h3 pre, h3 address,
+  h4 h1, h4 h2, h4 h3, h4 h4, h4 h5, h4 h6, h4 p, h4 pre, h4 address,
+  h5 h1, h5 h2, h5 h3, h5 h4, h5 h5, h5 h6, h5 p, h5 pre, h5 address,
+  h6 h1, h6 h2, h6 h3, h6 h4, h6 h4, h6 h6, h6 p, h6 pre, h6 address,
+  p h1, p h2, p h3, p h4, p h5, p h6, p pre, p address,
+  pre h1, pre h2, pre h3, pre h4, pre h5, pre h6, pre p, pre pre, pre address,
+  address h1, address h2, address h3, address h4, address h5, address h6,
+  address p, address pre, address address
+  { background-color: #ff9999 !important;
+    border: 1px solid red !important;
+    font-size: 12px !important;
+    font-weight: normal; }
diff --git a/wymeditor/iframe/default/wymiframe.html b/wymeditor/iframe/default/wymiframe.html
new file mode 100644 (file)
index 0000000..91a690c
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+ * WYMeditor : what you see is What You Mean web-based editor
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
+ * Dual licensed under the MIT (MIT-license.txt)
+ * and GPL (GPL-license.txt) licenses.
+ *
+ * For further information visit:
+ *        http://www.wymeditor.org/
+ *
+ * File Name:
+ *        wymiframe.html
+ *        Iframe used by designMode.
+ *        See the documentation for more info.
+ *
+ * File Authors:
+ *        Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
+-->
+<html>
+<head>
+<title>WYMeditor iframe</title>
+<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
+<link rel="stylesheet" type="text/css" media="screen" href="wymiframe.css" />
+</head>
+<body class="wym_iframe"></body>
+</html>
diff --git a/wymeditor/jquery.wymeditor.back.js b/wymeditor/jquery.wymeditor.back.js
new file mode 100644 (file)
index 0000000..b13e2d0
--- /dev/null
@@ -0,0 +1,4707 @@
+/**
+ * @version 0.5-rc1
+ *
+ * WYMeditor : what you see is What You Mean web-based editor
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
+ * Dual licensed under the MIT (MIT-license.txt)
+ * and GPL (GPL-license.txt) licenses.
+ *
+ * For further information visit:
+ *        http://www.wymeditor.org/
+ *
+ * File: jquery.wymeditor.js
+ *
+ *        Main JS file with core classes and functions.
+ *        See the documentation for more info.
+ *
+ * About: authors
+ *
+ *        Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
+ *        Volker Mische (vmx a-t gmx dotde)
+ *        Scott Lewis (lewiscot a-t gmail dotcom)
+ *        Bermi Ferrer (wymeditor a-t bermi dotorg)
+ *        Daniel Reszka (d.reszka a-t wymeditor dotorg)
+ *        Jonatan Lundin (jonatan.lundin _at_ gmail.com)
+ */
+
+/*
+   Namespace: WYMeditor
+   Global WYMeditor namespace.
+*/
+if(!WYMeditor) var WYMeditor = {};
+
+//Wrap the Firebug console in WYMeditor.console
+(function() {
+    if ( !window.console || !console.firebug ) {
+        var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
+        "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
+
+        WYMeditor.console = {};
+        for (var i = 0; i < names.length; ++i)
+            WYMeditor.console[names[i]] = function() {}
+
+    } else WYMeditor.console = window.console;
+})();
+
+jQuery.extend(WYMeditor, {
+
+/*
+    Constants: Global WYMeditor constants.
+
+    VERSION             - Defines WYMeditor version.
+    INSTANCES           - An array of loaded WYMeditor.editor instances.
+    STRINGS             - An array of loaded WYMeditor language pairs/values.
+    SKINS               - An array of loaded WYMeditor skins.
+    NAME                - The "name" attribute.
+    INDEX               - A string replaced by the instance index.
+    WYM_INDEX           - A string used to get/set the instance index.
+    BASE_PATH           - A string replaced by WYMeditor's base path.
+    SKIN_PATH           - A string replaced by WYMeditor's skin path.
+    WYM_PATH            - A string replaced by WYMeditor's main JS file path.
+    SKINS_DEFAULT_PATH  - The skins default base path.
+    SKINS_DEFAULT_CSS   - The skins default CSS file.
+    LANG_DEFAULT_PATH   - The language files default path.
+    IFRAME_BASE_PATH    - A string replaced by the designmode iframe's base path.
+    IFRAME_DEFAULT      - The iframe's default base path.
+    JQUERY_PATH         - A string replaced by the computed jQuery path.
+    DIRECTION           - A string replaced by the text direction (rtl or ltr).
+    LOGO                - A string replaced by WYMeditor logo.
+    TOOLS               - A string replaced by the toolbar's HTML.
+    TOOLS_ITEMS         - A string replaced by the toolbar items.
+    TOOL_NAME           - A string replaced by a toolbar item's name.
+    TOOL_TITLE          - A string replaced by a toolbar item's title.
+    TOOL_CLASS          - A string replaced by a toolbar item's class.
+    CLASSES             - A string replaced by the classes panel's HTML.
+    CLASSES_ITEMS       - A string replaced by the classes items.
+    CLASS_NAME          - A string replaced by a class item's name.
+    CLASS_TITLE         - A string replaced by a class item's title.
+    CONTAINERS          - A string replaced by the containers panel's HTML.
+    CONTAINERS_ITEMS    - A string replaced by the containers items.
+    CONTAINER_NAME      - A string replaced by a container item's name.
+    CONTAINER_TITLE     - A string replaced by a container item's title.
+    CONTAINER_CLASS     - A string replaced by a container item's class.
+    HTML                - A string replaced by the HTML view panel's HTML.
+    IFRAME              - A string replaced by the designmode iframe.
+    STATUS              - A string replaced by the status panel's HTML.
+    DIALOG_TITLE        - A string replaced by a dialog's title.
+    DIALOG_BODY         - A string replaced by a dialog's HTML body.
+    BODY                - The BODY element.
+    STRING              - The "string" type.
+    BODY,DIV,P,
+    H1,H2,H3,H4,H5,H6,
+    PRE,BLOCKQUOTE,
+    A,BR,IMG,
+    TABLE,TD,TH,
+    UL,OL,LI            - HTML elements string representation.
+    CLASS,HREF,SRC,
+    TITLE,ALT           - HTML attributes string representation.
+    DIALOG_LINK         - A link dialog type.
+    DIALOG_IMAGE        - An image dialog type.
+    DIALOG_TABLE        - A table dialog type.
+    DIALOG_PASTE        - A 'Paste from Word' dialog type.
+    BOLD                - Command: (un)set selection to <strong>.
+    ITALIC              - Command: (un)set selection to <em>.
+    CREATE_LINK         - Command: open the link dialog or (un)set link.
+    INSERT_IMAGE        - Command: open the image dialog or insert an image.
+    INSERT_TABLE        - Command: open the table dialog.
+    PASTE               - Command: open the paste dialog.
+    INDENT              - Command: nest a list item.
+    OUTDENT             - Command: unnest a list item.
+    TOGGLE_HTML         - Command: display/hide the HTML view.
+    FORMAT_BLOCK        - Command: set a block element to another type.
+    PREVIEW             - Command: open the preview dialog.
+    UNLINK              - Command: unset a link.
+    INSERT_UNORDEREDLIST- Command: insert an unordered list.
+    INSERT_ORDEREDLIST  - Command: insert an ordered list.
+    MAIN_CONTAINERS     - An array of the main HTML containers used in WYMeditor.
+    BLOCKS              - An array of the HTML block elements.
+    KEY                 - Standard key codes.
+    NODE                - Node types.
+
+*/
+
+    VERSION             : "0.5-rc1",
+    INSTANCES           : [],
+    STRINGS             : [],
+    SKINS               : [],
+    NAME                : "name",
+    INDEX               : "{Wym_Index}",
+    WYM_INDEX           : "wym_index",
+    BASE_PATH           : "{Wym_Base_Path}",
+    CSS_PATH            : "{Wym_Css_Path}",
+    WYM_PATH            : "{Wym_Wym_Path}",
+    SKINS_DEFAULT_PATH  : "skins/",
+    SKINS_DEFAULT_CSS   : "skin.css",
+    SKINS_DEFAULT_JS    : "skin.js",
+    LANG_DEFAULT_PATH   : "lang/",
+    IFRAME_BASE_PATH    : "{Wym_Iframe_Base_Path}",
+    IFRAME_DEFAULT      : "iframe/default/",
+    JQUERY_PATH         : "{Wym_Jquery_Path}",
+    DIRECTION           : "{Wym_Direction}",
+    LOGO                : "{Wym_Logo}",
+    TOOLS               : "{Wym_Tools}",
+    TOOLS_ITEMS         : "{Wym_Tools_Items}",
+    TOOL_NAME           : "{Wym_Tool_Name}",
+    TOOL_TITLE          : "{Wym_Tool_Title}",
+    TOOL_CLASS          : "{Wym_Tool_Class}",
+    CLASSES             : "{Wym_Classes}",
+    CLASSES_ITEMS       : "{Wym_Classes_Items}",
+    CLASS_NAME          : "{Wym_Class_Name}",
+    CLASS_TITLE         : "{Wym_Class_Title}",
+    CONTAINERS          : "{Wym_Containers}",
+    CONTAINERS_ITEMS    : "{Wym_Containers_Items}",
+    CONTAINER_NAME      : "{Wym_Container_Name}",
+    CONTAINER_TITLE     : "{Wym_Containers_Title}",
+    CONTAINER_CLASS     : "{Wym_Container_Class}",
+    HTML                : "{Wym_Html}",
+    IFRAME              : "{Wym_Iframe}",
+    STATUS              : "{Wym_Status}",
+    DIALOG_TITLE        : "{Wym_Dialog_Title}",
+    DIALOG_BODY         : "{Wym_Dialog_Body}",
+    STRING              : "string",
+    BODY                : "body",
+    DIV                 : "div",
+    P                   : "p",
+    H1                  : "h1",
+    H2                  : "h2",
+    H3                  : "h3",
+    H4                  : "h4",
+    H5                  : "h5",
+    H6                  : "h6",
+    PRE                 : "pre",
+    BLOCKQUOTE          : "blockquote",
+    A                   : "a",
+    BR                  : "br",
+    IMG                 : "img",
+    TABLE               : "table",
+    TD                  : "td",
+    TH                  : "th",
+    UL                  : "ul",
+    OL                  : "ol",
+    LI                  : "li",
+    CLASS               : "class",
+    HREF                : "href",
+    SRC                 : "src",
+    TITLE               : "title",
+    ALT                 : "alt",
+    DIALOG_LINK         : "Link",
+    DIALOG_IMAGE        : "Image",
+    DIALOG_TABLE        : "Table",
+    DIALOG_PASTE        : "Paste_From_Word",
+    BOLD                : "Bold",
+    ITALIC              : "Italic",
+    CREATE_LINK         : "CreateLink",
+    INSERT_IMAGE        : "InsertImage",
+    INSERT_TABLE        : "InsertTable",
+    INSERT_HTML         : "InsertHTML",
+    PASTE               : "Paste",
+    INDENT              : "Indent",
+    OUTDENT             : "Outdent",
+    TOGGLE_HTML         : "ToggleHtml",
+    FORMAT_BLOCK        : "FormatBlock",
+    PREVIEW             : "Preview",
+    UNLINK                             : "Unlink",
+    INSERT_UNORDEREDLIST: "InsertUnorderedList",
+    INSERT_ORDEREDLIST : "InsertOrderedList",
+
+    MAIN_CONTAINERS : new Array("p","h1","h2","h3","h4","h5","h6","pre","blockquote"),
+
+    BLOCKS : new Array("address", "blockquote", "div", "dl",
+          "fieldset", "form", "h1", "h2", "h3", "h4", "h5", "h6", "hr",
+          "noscript", "ol", "p", "pre", "table", "ul", "dd", "dt",
+          "li", "tbody", "td", "tfoot", "th", "thead", "tr"),
+
+    KEY : {
+      BACKSPACE: 8,
+      ENTER: 13,
+      END: 35,
+      HOME: 36,
+      LEFT: 37,
+      UP: 38,
+      RIGHT: 39,
+      DOWN: 40,
+      CURSOR: new Array(37, 38, 39, 40),
+      DELETE: 46
+    },
+
+    NODE : {
+      ELEMENT: 1,
+      ATTRIBUTE: 2,
+      TEXT: 3
+    },
+       
+    /*
+        Class: WYMeditor.editor
+        WYMeditor editor main class, instanciated for each editor occurrence.
+    */
+
+       editor : function(elem, options) {
+
+        /*
+            Constructor: WYMeditor.editor
+
+            Initializes main values (index, elements, paths, ...)
+            and call WYMeditor.editor.init which initializes the editor.
+
+            Parameters:
+
+                elem - The HTML element to be replaced by the editor.
+                options - The hash of options.
+
+            Returns:
+
+                Nothing.
+
+            See Also:
+
+                <WYMeditor.editor.init>
+        */
+
+        //store the instance in the INSTANCES array and store the index
+        this._index = WYMeditor.INSTANCES.push(this) - 1;
+        //store the element replaced by the editor
+        this._element = elem;
+        //store the options
+        this._options = options;
+        //store the element's inner value
+        this._html = jQuery(elem).val();
+
+        //store the HTML option, if any
+        if(this._options.html) this._html = this._options.html;
+        //get or compute the base path (where the main JS file is located)
+        this._options.basePath = this._options.basePath
+        || this.computeBasePath();
+        //get or set the skin path (where the skin files are located)
+        this._options.skinPath = this._options.skinPath
+        || this._options.basePath + WYMeditor.SKINS_DEFAULT_PATH
+           + this._options.skin + '/';
+        //get or compute the main JS file location
+        this._options.wymPath = this._options.wymPath
+        || this.computeWymPath();
+        //get or set the language files path
+        this._options.langPath = this._options.langPath
+        || this._options.basePath + WYMeditor.LANG_DEFAULT_PATH;
+        //get or set the designmode iframe's base path
+        this._options.iframeBasePath = this._options.iframeBasePath
+        || this._options.basePath + WYMeditor.IFRAME_DEFAULT;
+        //get or compute the jQuery JS file location
+        this._options.jQueryPath = this._options.jQueryPath
+        || this.computeJqueryPath();
+
+        //initialize the editor instance
+        this.init();
+       
+       }
+
+});
+
+
+/********** JQUERY **********/
+
+/**
+ * Replace an HTML element by WYMeditor
+ *
+ * @example jQuery(".wymeditor").wymeditor(
+ *        {
+ *
+ *        }
+ *      );
+ * @desc Example description here
+ * 
+ * @name WYMeditor
+ * @description WYMeditor is a web-based WYSIWYM XHTML editor
+ * @param Hash hash A hash of parameters
+ * @option Integer iExample Description here
+ * @option String sExample Description here
+ *
+ * @type jQuery
+ * @cat Plugins/WYMeditor
+ * @author Jean-Francois Hovinne
+ */
+jQuery.fn.wymeditor = function(options) {
+
+  options = jQuery.extend({
+
+    html:       "",
+    
+    basePath:   false,
+    
+    skinPath:    false,
+    
+    wymPath:    false,
+    
+    iframeBasePath: false,
+    
+    jQueryPath: false,
+    
+    styles: false,
+    
+    stylesheet: false,
+    
+    skin:       "default",
+    initSkin:   true,
+    loadSkin:   true,
+
+    lang:       "en",
+
+    direction:  "ltr",
+
+    boxHtml:   "<div class='wym_box'>"
+              + "<div class='wym_area_top'>" 
+              + WYMeditor.TOOLS
+              + "</div>"
+              + "<div class='wym_area_left'></div>"
+              + "<div class='wym_area_right'>"
+              + WYMeditor.CONTAINERS
+              + WYMeditor.CLASSES
+              + "</div>"
+              + "<div class='wym_area_main'>"
+              + WYMeditor.HTML
+              + WYMeditor.IFRAME
+              + WYMeditor.STATUS
+              + "</div>"
+              + "<div class='wym_area_bottom'>"
+              + WYMeditor.LOGO
+              + "</div>"
+              + "</div>",
+
+    logoHtml:  "<a class='wym_wymeditor_link' "
+              + "href='http://www.wymeditor.org/'>WYMeditor</a>",
+
+    iframeHtml:"<div class='wym_iframe wym_section'>"
+              + "<iframe "
+              + "src='"
+              + WYMeditor.IFRAME_BASE_PATH
+              + "wymiframe.html' "
+              + "onload='this.contentWindow.parent.WYMeditor.INSTANCES["
+              + WYMeditor.INDEX + "].initIframe(this)'"
+              + "></iframe>"
+              + "</div>",
+              
+    editorStyles: [],
+
+    toolsHtml: "<div class='wym_tools wym_section'>"
+              + "<h2>{Tools}</h2>"
+              + "<ul>"
+              + WYMeditor.TOOLS_ITEMS
+              + "</ul>"
+              + "</div>",
+              
+    toolsItemHtml:   "<li class='"
+                        + WYMeditor.TOOL_CLASS
+                        + "'><a href='#' name='"
+                        + WYMeditor.TOOL_NAME
+                        + "' title='"
+                        + WYMeditor.TOOL_TITLE
+                        + "'>"
+                        + WYMeditor.TOOL_TITLE
+                        + "</a></li>",
+
+    toolsItems: [
+        {'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'}, 
+        {'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'},
+        {'name': 'Superscript', 'title': 'Superscript',
+            'css': 'wym_tools_superscript'},
+        {'name': 'Subscript', 'title': 'Subscript',
+            'css': 'wym_tools_subscript'},
+        {'name': 'InsertOrderedList', 'title': 'Ordered_List',
+            'css': 'wym_tools_ordered_list'},
+        {'name': 'InsertUnorderedList', 'title': 'Unordered_List',
+            'css': 'wym_tools_unordered_list'},
+        {'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'},
+        {'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'},
+        {'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'},
+        {'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'},
+        {'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'},
+        {'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'},
+        {'name': 'InsertImage', 'title': 'Image', 'css': 'wym_tools_image'},
+        {'name': 'InsertTable', 'title': 'Table', 'css': 'wym_tools_table'},
+        {'name': 'Paste', 'title': 'Paste_From_Word',
+            'css': 'wym_tools_paste'},
+        {'name': 'ToggleHtml', 'title': 'HTML', 'css': 'wym_tools_html'},
+        {'name': 'Preview', 'title': 'Preview', 'css': 'wym_tools_preview'}
+    ],
+
+    containersHtml:    "<div class='wym_containers wym_section'>"
+                        + "<h2>{Containers}</h2>"
+                        + "<ul>"
+                        + WYMeditor.CONTAINERS_ITEMS
+                        + "</ul>"
+                        + "</div>",
+                        
+    containersItemHtml:"<li class='"
+                        + WYMeditor.CONTAINER_CLASS
+                        + "'>"
+                        + "<a href='#' name='"
+                        + WYMeditor.CONTAINER_NAME
+                        + "'>"
+                        + WYMeditor.CONTAINER_TITLE
+                        + "</a></li>",
+                        
+    containersItems: [
+        {'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'},
+        {'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'},
+        {'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'},
+        {'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'},
+        {'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'},
+        {'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'},
+        {'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'},
+        {'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'},
+        {'name': 'BLOCKQUOTE', 'title': 'Blockquote',
+            'css': 'wym_containers_blockquote'},
+        {'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}
+    ],
+
+    classesHtml:       "<div class='wym_classes wym_section'>"
+                        + "<h2>{Classes}</h2><ul>"
+                        + WYMeditor.CLASSES_ITEMS
+                        + "</ul></div>",
+
+    classesItemHtml:   "<li><a href='#' name='"
+                        + WYMeditor.CLASS_NAME
+                        + "'>"
+                        + WYMeditor.CLASS_TITLE
+                        + "</a></li>",
+
+    classesItems:      [],
+
+    statusHtml:        "<div class='wym_status wym_section'>"
+                        + "<h2>{Status}</h2>"
+                        + "</div>",
+
+    htmlHtml:          "<div class='wym_html wym_section'>"
+                        + "<h2>{Source_Code}</h2>"
+                        + "<textarea class='wym_html_val'></textarea>"
+                        + "</div>",
+
+    boxSelector:       ".wym_box",
+    toolsSelector:     ".wym_tools",
+    toolsListSelector: " ul",
+    containersSelector:".wym_containers",
+    classesSelector:   ".wym_classes",
+    htmlSelector:      ".wym_html",
+    iframeSelector:    ".wym_iframe iframe",
+    iframeBodySelector:".wym_iframe",
+    statusSelector:    ".wym_status",
+    toolSelector:      ".wym_tools a",
+    containerSelector: ".wym_containers a",
+    classSelector:     ".wym_classes a",
+    htmlValSelector:   ".wym_html_val",
+    
+    hrefSelector:      ".wym_href",
+    srcSelector:       ".wym_src",
+    titleSelector:     ".wym_title",
+    altSelector:       ".wym_alt",
+    textSelector:      ".wym_text",
+    
+    rowsSelector:      ".wym_rows",
+    colsSelector:      ".wym_cols",
+    captionSelector:   ".wym_caption",
+    summarySelector:   ".wym_summary",
+    
+    submitSelector:    ".wym_submit",
+    cancelSelector:    ".wym_cancel",
+    previewSelector:   "",
+    
+    dialogTypeSelector:    ".wym_dialog_type",
+    dialogLinkSelector:    ".wym_dialog_link",
+    dialogImageSelector:   ".wym_dialog_image",
+    dialogTableSelector:   ".wym_dialog_table",
+    dialogPasteSelector:   ".wym_dialog_paste",
+    dialogPreviewSelector: ".wym_dialog_preview",
+    
+    updateSelector:    ".wymupdate",
+    updateEvent:       "click",
+    
+    dialogFeatures:    "menubar=no,titlebar=no,toolbar=no,resizable=no"
+                      + ",width=560,height=300,top=0,left=0",
+    dialogFeaturesPreview: "menubar=no,titlebar=no,toolbar=no,resizable=no"
+                      + ",scrollbars=yes,width=560,height=300,top=0,left=0",
+
+    dialogHtml:      "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'"
+                      + " 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
+                      + "<html dir='"
+                      + WYMeditor.DIRECTION
+                      + "'><head>"
+                      + "<link rel='stylesheet' type='text/css' media='screen'"
+                      + " href='"
+                      + WYMeditor.CSS_PATH
+                      + "' />"
+                      + "<title>"
+                      + WYMeditor.DIALOG_TITLE
+                      + "</title>"
+                      + "<script type='text/javascript'"
+                      + " src='"
+                      + WYMeditor.JQUERY_PATH
+                      + "'></script>"
+                      + "<script type='text/javascript'"
+                      + " src='"
+                      + WYMeditor.WYM_PATH
+                      + "'></script>"
+                      + "</head>"
+                      + WYMeditor.DIALOG_BODY
+                      + "</html>",
+                      
+    dialogLinkHtml:  "<body class='wym_dialog wym_dialog_link'"
+               + " onload='WYMeditor.INIT_DIALOG(" + WYMeditor.INDEX + ")'"
+               + ">"
+               + "<form>"
+               + "<fieldset>"
+               + "<input type='hidden' class='wym_dialog_type' value='"
+               + WYMeditor.DIALOG_LINK
+               + "' />"
+               + "<legend>{Link}</legend>"
+               + "<div class='row'>"
+               + "<label>{URL}</label>"
+               + "<input type='text' class='wym_href' value='' size='40' />"
+               + "</div>"
+               + "<div class='row'>"
+               + "<label>{Title}</label>"
+               + "<input type='text' class='wym_title' value='' size='40' />"
+               + "</div>"
+               + "<div class='row row-indent'>"
+               + "<input class='wym_submit' type='button'"
+               + " value='{Submit}' />"
+               + "<input class='wym_cancel' type='button'"
+               + "value='{Cancel}' />"
+               + "</div>"
+               + "</fieldset>"
+               + "</form>"
+               + "</body>",
+    
+    dialogImageHtml:  "<body class='wym_dialog wym_dialog_image'"
+               + " onload='WYMeditor.INIT_DIALOG(" + WYMeditor.INDEX + ")'"
+               + ">"
+               + "<form>"
+               + "<fieldset>"
+               + "<input type='hidden' class='wym_dialog_type' value='"
+               + WYMeditor.DIALOG_IMAGE
+               + "' />"
+               + "<legend>{Image}</legend>"
+               + "<div class='row'>"
+               + "<label>{URL}</label>"
+               + "<input type='text' class='wym_src' value='' size='40' />"
+               + "</div>"
+               + "<div class='row'>"
+               + "<label>{Alternative_Text}</label>"
+               + "<input type='text' class='wym_alt' value='' size='40' />"
+               + "</div>"
+               + "<div class='row'>"
+               + "<label>{Title}</label>"
+               + "<input type='text' class='wym_title' value='' size='40' />"
+               + "</div>"
+               + "<div class='row row-indent'>"
+               + "<input class='wym_submit' type='button'"
+               + " value='{Submit}' />"
+               + "<input class='wym_cancel' type='button'"
+               + "value='{Cancel}' />"
+               + "</div>"
+               + "</fieldset>"
+               + "</form>"
+               + "</body>",
+    
+    dialogTableHtml:  "<body class='wym_dialog wym_dialog_table'"
+               + " onload='WYMeditor.INIT_DIALOG(" + WYMeditor.INDEX + ")'"
+               + ">"
+               + "<form>"
+               + "<fieldset>"
+               + "<input type='hidden' class='wym_dialog_type' value='"
+               + WYMeditor.DIALOG_TABLE
+               + "' />"
+               + "<legend>{Table}</legend>"
+               + "<div class='row'>"
+               + "<label>{Caption}</label>"
+               + "<input type='text' class='wym_caption' value='' size='40' />"
+               + "</div>"
+               + "<div class='row'>"
+               + "<label>{Summary}</label>"
+               + "<input type='text' class='wym_summary' value='' size='40' />"
+               + "</div>"
+               + "<div class='row'>"
+               + "<label>{Number_Of_Rows}</label>"
+               + "<input type='text' class='wym_rows' value='3' size='3' />"
+               + "</div>"
+               + "<div class='row'>"
+               + "<label>{Number_Of_Cols}</label>"
+               + "<input type='text' class='wym_cols' value='2' size='3' />"
+               + "</div>"
+               + "<div class='row row-indent'>"
+               + "<input class='wym_submit' type='button'"
+               + " value='{Submit}' />"
+               + "<input class='wym_cancel' type='button'"
+               + "value='{Cancel}' />"
+               + "</div>"
+               + "</fieldset>"
+               + "</form>"
+               + "</body>",
+
+    dialogPasteHtml:  "<body class='wym_dialog wym_dialog_paste'"
+               + " onload='WYMeditor.INIT_DIALOG(" + WYMeditor.INDEX + ")'"
+               + ">"
+               + "<form>"
+               + "<input type='hidden' class='wym_dialog_type' value='"
+               + WYMeditor.DIALOG_PASTE
+               + "' />"
+               + "<fieldset>"
+               + "<legend>{Paste_From_Word}</legend>"
+               + "<div class='row'>"
+               + "<textarea class='wym_text' rows='10' cols='50'></textarea>"
+               + "</div>"
+               + "<div class='row'>"
+               + "<input class='wym_submit' type='button'"
+               + " value='{Submit}' />"
+               + "<input class='wym_cancel' type='button'"
+               + "value='{Cancel}' />"
+               + "</div>"
+               + "</fieldset>"
+               + "</form>"
+               + "</body>",
+
+    dialogPreviewHtml: "<body class='wym_dialog wym_dialog_preview'"
+                      + " onload='WYMeditor.INIT_DIALOG(" + WYMeditor.INDEX + ")'"
+                      + "></body>",
+                      
+    dialogStyles: [],
+
+    stringDelimiterLeft: "{",
+    stringDelimiterRight:"}",
+    
+    preInit: null,
+    preBind: null,
+    postInit: null,
+    
+    preInitDialog: null,
+    postInitDialog: null
+
+  }, options);
+
+  return this.each(function() {
+
+    new WYMeditor.editor(jQuery(this),options);
+  });
+};
+
+/* @name extend
+ * @description Returns the WYMeditor instance based on its index
+ */
+jQuery.extend({
+  wymeditors: function(i) {
+    return (WYMeditor.INSTANCES[i]);
+  }
+});
+
+
+/********** WYMeditor **********/
+
+/* @name Wymeditor
+ * @description WYMeditor class
+ */
+
+/* @name init
+ * @description Initializes a WYMeditor instance
+ */
+WYMeditor.editor.prototype.init = function() {
+
+  //load subclass - browser specific
+  //unsupported browsers: do nothing
+  if (jQuery.browser.msie) {
+    var WymClass = new WYMeditor.WymClassExplorer(this);
+  }
+  else if (jQuery.browser.mozilla) {
+    var WymClass = new WYMeditor.WymClassMozilla(this);
+  }
+  else if (jQuery.browser.opera) {
+    var WymClass = new WYMeditor.WymClassOpera(this);
+  }
+  else if (jQuery.browser.safari) {
+    var WymClass = new WYMeditor.WymClassSafari(this);
+  }
+  
+  if(WymClass) {
+  
+      if(jQuery.isFunction(this._options.preInit)) this._options.preInit(this);
+
+      var SaxListener = new WYMeditor.XhtmlSaxListener();
+      jQuery.extend(SaxListener, WymClass);
+      this.parser = new WYMeditor.XhtmlParser(SaxListener);
+      
+      if(this._options.styles || this._options.stylesheet){
+        this.configureEditorUsingRawCss();
+      }
+      
+      this.helper = new WYMeditor.XmlHelper();
+      
+      //extend the Wymeditor object
+      //don't use jQuery.extend since 1.1.4
+      //jQuery.extend(this, WymClass);
+      for (var prop in WymClass) { this[prop] = WymClass[prop]; }
+
+      //load wymbox
+      this._box = jQuery(this._element).hide().after(this._options.boxHtml).next().addClass('wym_box_' + this._index);
+
+      //store the instance index in wymbox and element replaced by editor instance
+      //but keep it compatible with jQuery < 1.2.3, see #122
+      if( jQuery.isFunction( jQuery.fn.data ) ) {
+        jQuery.data(this._box.get(0), WYMeditor.WYM_INDEX, this._index);
+        jQuery.data(this._element.get(0), WYMeditor.WYM_INDEX, this._index);
+      }
+      
+      var h = WYMeditor.Helper;
+
+      //construct the iframe
+      var iframeHtml = this._options.iframeHtml;
+      iframeHtml = h.replaceAll(iframeHtml, WYMeditor.INDEX, this._index);
+      iframeHtml = h.replaceAll(iframeHtml, WYMeditor.IFRAME_BASE_PATH, this._options.iframeBasePath);
+      
+      //construct wymbox
+      var boxHtml = jQuery(this._box).html();
+      
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.LOGO, this._options.logoHtml);
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS, this._options.toolsHtml);
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.CONTAINERS,this._options.containersHtml);
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.CLASSES, this._options.classesHtml);
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.HTML, this._options.htmlHtml);
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.IFRAME, iframeHtml);
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.STATUS, this._options.statusHtml);
+      
+      //construct tools list
+      var aTools = eval(this._options.toolsItems);
+      var sTools = "";
+
+      for(var i = 0; i < aTools.length; i++) {
+        var oTool = aTools[i];
+        if(oTool.name && oTool.title)
+          var sTool = this._options.toolsItemHtml;
+          var sTool = h.replaceAll(sTool, WYMeditor.TOOL_NAME, oTool.name);
+          sTool = h.replaceAll(sTool, WYMeditor.TOOL_TITLE, this._options.stringDelimiterLeft
+            + oTool.title
+            + this._options.stringDelimiterRight);
+          sTool = h.replaceAll(sTool, WYMeditor.TOOL_CLASS, oTool.css);
+          sTools += sTool;
+      }
+
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS_ITEMS, sTools);
+
+      //construct classes list
+      var aClasses = eval(this._options.classesItems);
+      var sClasses = "";
+
+      for(var i = 0; i < aClasses.length; i++) {
+        var oClass = aClasses[i];
+        if(oClass.name && oClass.title)
+          var sClass = this._options.classesItemHtml;
+          sClass = h.replaceAll(sClass, WYMeditor.CLASS_NAME, oClass.name);
+          sClass = h.replaceAll(sClass, WYMeditor.CLASS_TITLE, oClass.title);
+          sClasses += sClass;
+      }
+
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.CLASSES_ITEMS, sClasses);
+      
+      //construct containers list
+      var aContainers = eval(this._options.containersItems);
+      var sContainers = "";
+
+      for(var i = 0; i < aContainers.length; i++) {
+        var oContainer = aContainers[i];
+        if(oContainer.name && oContainer.title)
+          var sContainer = this._options.containersItemHtml;
+          sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_NAME, oContainer.name);
+          sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_TITLE,
+              this._options.stringDelimiterLeft
+            + oContainer.title
+            + this._options.stringDelimiterRight);
+          sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_CLASS, oContainer.css);
+          sContainers += sContainer;
+      }
+
+      boxHtml = h.replaceAll(boxHtml, WYMeditor.CONTAINERS_ITEMS, sContainers);
+
+      //l10n
+      boxHtml = this.replaceStrings(boxHtml);
+      
+      //load html in wymbox
+      jQuery(this._box).html(boxHtml);
+      
+      //hide the html value
+      jQuery(this._box).find(this._options.htmlSelector).hide();
+      
+      //enable the skin
+      this.loadSkin();
+      
+    }
+};
+
+WYMeditor.editor.prototype.bindEvents = function() {
+
+  //copy the instance
+  var wym = this;
+  
+  //handle click event on tools buttons
+  jQuery(this._box).find(this._options.toolSelector).click(function() {
+    wym._iframe.contentWindow.focus(); //See #154
+    wym.exec(jQuery(this).attr(WYMeditor.NAME));    
+    return(false);
+  });
+  
+  //handle click event on containers buttons
+  jQuery(this._box).find(this._options.containerSelector).click(function() {
+    wym.container(jQuery(this).attr(WYMeditor.NAME));
+    return(false);
+  });
+  
+  //handle keyup event on html value: set the editor value
+  //handle focus/blur events to check if the element has focus, see #147
+  jQuery(this._box).find(this._options.htmlValSelector)
+    .keyup(function() { jQuery(wym._doc.body).html(jQuery(this).val());})
+    .focus(function() { jQuery(this).toggleClass('hasfocus'); })
+    .blur(function() { jQuery(this).toggleClass('hasfocus'); });
+
+  //handle click event on classes buttons
+  jQuery(this._box).find(this._options.classSelector).click(function() {
+  
+    var aClasses = eval(wym._options.classesItems);
+    var sName = jQuery(this).attr(WYMeditor.NAME);
+    
+    var oClass = WYMeditor.Helper.findByName(aClasses, sName);
+    
+    if(oClass) {
+      var jqexpr = oClass.expr;
+      wym.toggleClass(sName, jqexpr);
+    }
+    wym._iframe.contentWindow.focus(); //See #154
+    return(false);
+  });
+  
+  //handle event on update element
+  jQuery(this._options.updateSelector)
+    .bind(this._options.updateEvent, function() {
+      wym.update();
+  });
+};
+
+WYMeditor.editor.prototype.ready = function() {
+  return(this._doc != null);
+};
+
+
+/********** METHODS **********/
+
+/* @name box
+ * @description Returns the WYMeditor container
+ */
+WYMeditor.editor.prototype.box = function() {
+  return(this._box);
+};
+
+/* @name html
+ * @description Get/Set the html value
+ */
+WYMeditor.editor.prototype.html = function(html) {
+
+  if(typeof html === 'string') jQuery(this._doc.body).html(html);
+  else return(jQuery(this._doc.body).html());
+};
+
+/* @name xhtml
+ * @description Cleans up the HTML
+ */
+WYMeditor.editor.prototype.xhtml = function() {
+    return this.parser.parse(this.html());
+};
+
+/* @name exec
+ * @description Executes a button command
+ */
+WYMeditor.editor.prototype.exec = function(cmd) {
+  
+  //base function for execCommand
+  //open a dialog or exec
+  switch(cmd) {
+    case WYMeditor.CREATE_LINK:
+      var container = this.container();
+      if(container || this._selected_image) this.dialog(WYMeditor.DIALOG_LINK);
+    break;
+    
+    case WYMeditor.INSERT_IMAGE:
+      this.dialog(WYMeditor.DIALOG_IMAGE);
+    break;
+    
+    case WYMeditor.INSERT_TABLE:
+      this.dialog(WYMeditor.DIALOG_TABLE);
+    break;
+    
+    case WYMeditor.PASTE:
+      this.dialog(WYMeditor.DIALOG_PASTE);
+    break;
+    
+    case WYMeditor.TOGGLE_HTML:
+      this.update();
+      this.toggleHtml();
+
+      //partially fixes #121 when the user manually inserts an image
+      if(!jQuery(this._box).find(this._options.htmlSelector).is(':visible'))
+        this.listen();
+    break;
+    
+    case WYMeditor.PREVIEW:
+      this.dialog(WYMeditor.PREVIEW, this._options.dialogFeaturesPreview);
+    break;
+    
+    default:
+      this._exec(cmd);
+    break;
+  }
+};
+
+/* @name container
+ * @description Get/Set the selected container
+ */
+WYMeditor.editor.prototype.container = function(sType) {
+
+  if(sType) {
+  
+    var container = null;
+    
+    if(sType.toLowerCase() == WYMeditor.TH) {
+    
+      container = this.container();
+      
+      //find the TD or TH container
+      switch(container.tagName.toLowerCase()) {
+      
+        case WYMeditor.TD: case WYMeditor.TH:
+          break;
+        default:
+          var aTypes = new Array(WYMeditor.TD,WYMeditor.TH);
+          container = this.findUp(this.container(), aTypes);
+          break;
+      }
+      
+      //if it exists, switch
+      if(container!=null) {
+      
+        sType = (container.tagName.toLowerCase() == WYMeditor.TD)? WYMeditor.TH: WYMeditor.TD;
+        this.switchTo(container,sType);
+        this.update();
+      }
+    } else {
+  
+      //set the container type
+      var aTypes=new Array(WYMeditor.P,WYMeditor.H1,WYMeditor.H2,WYMeditor.H3,WYMeditor.H4,WYMeditor.H5,
+      WYMeditor.H6,WYMeditor.PRE,WYMeditor.BLOCKQUOTE);
+      container = this.findUp(this.container(), aTypes);
+      
+      if(container) {
+  
+        var newNode = null;
+  
+        //blockquotes must contain a block level element
+        if(sType.toLowerCase() == WYMeditor.BLOCKQUOTE) {
+        
+          var blockquote = this.findUp(this.container(), WYMeditor.BLOCKQUOTE);
+          
+          if(blockquote == null) {
+          
+            newNode = this._doc.createElement(sType);
+            container.parentNode.insertBefore(newNode,container);
+            newNode.appendChild(container);
+            this.setFocusToNode(newNode.firstChild);
+            
+          } else {
+          
+            var nodes = blockquote.childNodes;
+            var lgt = nodes.length;
+            var firstNode = null;
+            
+            if(lgt > 0) firstNode = nodes.item(0);
+            for(var x=0; x<lgt; x++) {
+              blockquote.parentNode.insertBefore(nodes.item(0),blockquote);
+            }
+            blockquote.parentNode.removeChild(blockquote);
+            if(firstNode) this.setFocusToNode(firstNode);
+          }
+        }
+        
+        else this.switchTo(container,sType);
+      
+        this.update();
+      }
+    }
+  }
+  else return(this.selected());
+};
+
+/* @name toggleClass
+ * @description Toggles class on selected element, or one of its parents
+ */
+WYMeditor.editor.prototype.toggleClass = function(sClass, jqexpr) {
+
+  var container = (this._selected_image
+                    ? this._selected_image
+                    : jQuery(this.selected()));
+  container = jQuery(container).parentsOrSelf(jqexpr);
+  jQuery(container).toggleClass(sClass);
+
+  if(!jQuery(container).attr(WYMeditor.CLASS)) jQuery(container).removeAttr(this._class);
+
+};
+
+/* @name findUp
+ * @description Returns the first parent or self container, based on its type
+ */
+WYMeditor.editor.prototype.findUp = function(node, filter) {
+
+  //filter is a string or an array of strings
+
+  if(node) {
+
+      var tagname = node.tagName.toLowerCase();
+      
+      if(typeof(filter) == WYMeditor.STRING) {
+    
+        while(tagname != filter && tagname != WYMeditor.BODY) {
+        
+          node = node.parentNode;
+          tagname = node.tagName.toLowerCase();
+        }
+      
+      } else {
+      
+        var bFound = false;
+        
+        while(!bFound && tagname != WYMeditor.BODY) {
+          for(var i = 0; i < filter.length; i++) {
+            if(tagname == filter[i]) {
+              bFound = true;
+              break;
+            }
+          }
+          if(!bFound) {
+            node = node.parentNode;
+            tagname = node.tagName.toLowerCase();
+          }
+        }
+      }
+      
+      if(tagname != WYMeditor.BODY) return(node);
+      else return(null);
+      
+  } else return(null);
+};
+
+/* @name switchTo
+ * @description Switch the node's type
+ */
+WYMeditor.editor.prototype.switchTo = function(node,sType) {
+
+  var newNode = this._doc.createElement(sType);
+  var html = jQuery(node).html();
+  node.parentNode.replaceChild(newNode,node);
+  jQuery(newNode).html(html);
+  this.setFocusToNode(newNode);
+};
+
+WYMeditor.editor.prototype.replaceStrings = function(sVal) {
+  //check if the language file has already been loaded
+  //if not, get it via a synchronous ajax call
+  if(!WYMeditor.STRINGS[this._options.lang]) {
+    try {
+      eval(jQuery.ajax({url:this._options.langPath
+        + this._options.lang + '.js', async:false}).responseText);
+    } catch(e) {
+        WYMeditor.console.error("WYMeditor: error while parsing language file.");
+        return sVal;
+    }
+  }
+
+  //replace all the strings in sVal and return it
+  for (var key in WYMeditor.STRINGS[this._options.lang]) {
+    sVal = WYMeditor.Helper.replaceAll(sVal, this._options.stringDelimiterLeft + key 
+    + this._options.stringDelimiterRight,
+    WYMeditor.STRINGS[this._options.lang][key]);
+  };
+  return(sVal);
+};
+
+WYMeditor.editor.prototype.encloseString = function(sVal) {
+
+  return(this._options.stringDelimiterLeft
+    + sVal
+    + this._options.stringDelimiterRight);
+};
+
+/* @name status
+ * @description Prints a status message
+ */
+WYMeditor.editor.prototype.status = function(sMessage) {
+
+  //print status message
+  jQuery(this._box).find(this._options.statusSelector).html(sMessage);
+};
+
+/* @name update
+ * @description Updates the element and textarea values
+ */
+WYMeditor.editor.prototype.update = function() {
+
+  var html = this.xhtml();
+  jQuery(this._element).val(html);
+  jQuery(this._box).find(this._options.htmlValSelector).not('.hasfocus').val(html); //#147
+};
+
+/* @name dialog
+ * @description Opens a dialog box
+ */
+WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHtml ) {
+  
+  var features = dialogFeatures || this._wym._options.dialogFeatures;
+  var wDialog = window.open('', 'dialog', features);
+
+  if(wDialog) {
+
+    var sBodyHtml = "";
+    
+    switch( dialogType ) {
+
+      case(WYMeditor.DIALOG_LINK):
+        sBodyHtml = this._options.dialogLinkHtml;
+      break;
+      case(WYMeditor.DIALOG_IMAGE):
+        sBodyHtml = this._options.dialogImageHtml;
+      break;
+      case(WYMeditor.DIALOG_TABLE):
+        sBodyHtml = this._options.dialogTableHtml;
+      break;
+      case(WYMeditor.DIALOG_PASTE):
+        sBodyHtml = this._options.dialogPasteHtml;
+      break;
+      case(WYMeditor.PREVIEW):
+        sBodyHtml = this._options.dialogPreviewHtml;
+      break;
+
+      default:
+        sBodyHtml = bodyHtml;
+    }
+    
+    var h = WYMeditor.Helper;
+
+    //construct the dialog
+    var dialogHtml = this._options.dialogHtml;
+    dialogHtml = h.replaceAll(dialogHtml, WYMeditor.BASE_PATH, this._options.basePath);
+    dialogHtml = h.replaceAll(dialogHtml, WYMeditor.DIRECTION, this._options.direction);
+    dialogHtml = h.replaceAll(dialogHtml, WYMeditor.CSS_PATH, this._options.skinPath + WYMeditor.SKINS_DEFAULT_CSS);
+    dialogHtml = h.replaceAll(dialogHtml, WYMeditor.WYM_PATH, this._options.wymPath);
+    dialogHtml = h.replaceAll(dialogHtml, WYMeditor.JQUERY_PATH, this._options.jQueryPath);
+    dialogHtml = h.replaceAll(dialogHtml, WYMeditor.DIALOG_TITLE, this.encloseString( dialogType ));
+    dialogHtml = h.replaceAll(dialogHtml, WYMeditor.DIALOG_BODY, sBodyHtml);
+    dialogHtml = h.replaceAll(dialogHtml, WYMeditor.INDEX, this._index);
+      
+    dialogHtml = this.replaceStrings(dialogHtml);
+    
+    var doc = wDialog.document;
+    doc.write(dialogHtml);
+    doc.close();
+  }
+};
+
+/* @name toggleHtml
+ * @description Shows/Hides the HTML
+ */
+WYMeditor.editor.prototype.toggleHtml = function() {
+  jQuery(this._box).find(this._options.htmlSelector).toggle();
+};
+
+WYMeditor.editor.prototype.uniqueStamp = function() {
+       var now = new Date();
+       return("wym-" + now.getTime());
+};
+
+WYMeditor.editor.prototype.paste = function(sData) {
+
+  var sTmp;
+  var container = this.selected();
+       
+  //split the data, using double newlines as the separator
+  var aP = sData.split(this._newLine + this._newLine);
+  var rExp = new RegExp(this._newLine, "g");
+
+  //add a P for each item
+  if(container && container.tagName.toLowerCase() != WYMeditor.BODY) {
+    for(x = aP.length - 1; x >= 0; x--) {
+        sTmp = aP[x];
+        //simple newlines are replaced by a break
+        sTmp = sTmp.replace(rExp, "<br />");
+        jQuery(container).after("<p>" + sTmp + "</p>");
+    }
+  } else {
+    for(x = 0; x < aP.length; x++) {
+        sTmp = aP[x];
+        //simple newlines are replaced by a break
+        sTmp = sTmp.replace(rExp, "<br />");
+        jQuery(this._doc.body).append("<p>" + sTmp + "</p>");
+    }
+  
+  }
+};
+
+WYMeditor.editor.prototype.insert = function(html) {
+    // Do we have a selection?
+    if (this._iframe.contentWindow.getSelection().focusNode != null) {
+        // Overwrite selection with provided html
+        this._exec( WYMeditor.INSERT_HTML, html);
+    } else {
+        // Fall back to the internal paste function if there's no selection
+        this.paste(html)
+    }
+};
+
+WYMeditor.editor.prototype.wrap = function(left, right) {
+    // Do we have a selection?
+    if (this._iframe.contentWindow.getSelection().focusNode != null) {
+        // Wrap selection with provided html
+        this._exec( WYMeditor.INSERT_HTML, left + this._iframe.contentWindow.getSelection().toString() + right);
+    }
+};
+
+WYMeditor.editor.prototype.unwrap = function() {
+    // Do we have a selection?
+    if (this._iframe.contentWindow.getSelection().focusNode != null) {
+        // Unwrap selection
+        this._exec( WYMeditor.INSERT_HTML, this._iframe.contentWindow.getSelection().toString() );
+    }
+};
+
+WYMeditor.editor.prototype.addCssRules = function(doc, aCss) {
+  var styles = doc.styleSheets[0];
+  if(styles) {
+    for(var i = 0; i < aCss.length; i++) {
+      var oCss = aCss[i];
+      if(oCss.name && oCss.css) this.addCssRule(styles, oCss);
+    }
+  }
+};
+
+/********** CONFIGURATION **********/
+
+WYMeditor.editor.prototype.computeBasePath = function() {
+  return jQuery(jQuery.grep(jQuery('script'), function(s){
+    return (s.src && s.src.match(/jquery\.wymeditor(\.pack|\.min|\.packed)?\.js(\?.*)?$/ ))
+  })).attr('src').replace(/jquery\.wymeditor(\.pack|\.min|\.packed)?\.js(\?.*)?$/, '');
+};
+
+WYMeditor.editor.prototype.computeWymPath = function() {
+  return jQuery(jQuery.grep(jQuery('script'), function(s){
+    return (s.src && s.src.match(/jquery\.wymeditor(\.pack|\.min|\.packed)?\.js(\?.*)?$/ ))
+  })).attr('src');
+};
+
+WYMeditor.editor.prototype.computeJqueryPath = function() {
+  return jQuery(jQuery.grep(jQuery('script'), function(s){
+    return (s.src && s.src.match(/jquery(-(.*)){0,1}(\.pack|\.min|\.packed)?\.js(\?.*)?$/ ))
+  })).attr('src');
+};
+
+WYMeditor.editor.prototype.computeCssPath = function() {
+  return jQuery(jQuery.grep(jQuery('link'), function(s){
+   return (s.href && s.href.match(/wymeditor\/skins\/(.*)screen\.css(\?.*)?$/ ))
+  })).attr('href');
+};
+
+WYMeditor.editor.prototype.configureEditorUsingRawCss = function() {
+
+  var CssParser = new WYMeditor.WymCssParser();
+  if(this._options.stylesheet){
+    CssParser.parse(jQuery.ajax({url: this._options.stylesheet,async:false}).responseText);
+  }else{
+    CssParser.parse(this._options.styles, false);
+  }
+
+  if(this._options.classesItems.length == 0) {
+    this._options.classesItems = CssParser.css_settings.classesItems;
+  }
+  if(this._options.editorStyles.length == 0) {
+    this._options.editorStyles = CssParser.css_settings.editorStyles;
+  }
+  if(this._options.dialogStyles.length == 0) {
+    this._options.dialogStyles = CssParser.css_settings.dialogStyles;
+  }
+};
+
+/********** EVENTS **********/
+
+WYMeditor.editor.prototype.listen = function() {
+
+  //don't use jQuery.find() on the iframe body
+  //because of MSIE + jQuery + expando issue (#JQ1143)
+  //jQuery(this._doc.body).find("*").bind("mouseup", this.mouseup);
+  
+  jQuery(this._doc.body).bind("mousedown", this.mousedown);
+  var images = this._doc.body.getElementsByTagName("img");
+  for(var i=0; i < images.length; i++) {
+    jQuery(images[i]).bind("mousedown", this.mousedown);
+  }
+};
+
+WYMeditor.editor.prototype.mousedown = function(evt) {
+  
+  var wym = WYMeditor.INSTANCES[this.ownerDocument.title];
+  wym._selected_image = (this.tagName.toLowerCase() == WYMeditor.IMG) ? this : null;
+  evt.stopPropagation();
+};
+
+/********** SKINS **********/
+
+/*
+ * Function: WYMeditor.loadCss
+ *      Loads a stylesheet in the document.
+ *
+ * Parameters:
+ *      href - The CSS path.
+ */
+WYMeditor.loadCss = function(href) {
+    
+    var link = document.createElement('link');
+    link.rel = 'stylesheet';
+    link.href = href;
+
+    var head = jQuery('head').get(0);
+    head.appendChild(link);
+};
+
+/*
+ *  Function: WYMeditor.editor.loadSkin
+ *      Loads the skin CSS and initialization script (if needed).
+ */
+WYMeditor.editor.prototype.loadSkin = function() {
+
+    //does the user want to automatically load the CSS (default: yes)?
+    //we also test if it hasn't been already loaded by another instance
+    //see below for a better (second) test
+    if(this._options.loadSkin && !WYMeditor.SKINS[this._options.skin]) {
+
+        //check if it hasn't been already loaded
+        //so we don't load it more than once
+        //(we check the existing <link> elements)
+
+        var found = false;
+        var rExp = new RegExp(this._options.skin
+             + '\/' + WYMeditor.SKINS_DEFAULT_CSS + '$');
+
+        jQuery('link').each( function() {
+            if(this.href.match(rExp)) found = true;
+        });
+
+        //load it, using the skin path
+        if(!found) WYMeditor.loadCss( this._options.skinPath
+            + WYMeditor.SKINS_DEFAULT_CSS );
+    }
+
+    //put the classname (ex. wym_skin_default) on wym_box
+    jQuery(this._box).addClass( "wym_skin_" + this._options.skin );
+
+    //does the user want to use some JS to initialize the skin (default: yes)?
+    //also check if it hasn't already been loaded by another instance
+    if(this._options.initSkin && !WYMeditor.SKINS[this._options.skin]) {
+
+        eval(jQuery.ajax({url:this._options.skinPath
+            + WYMeditor.SKINS_DEFAULT_JS, async:false}).responseText);
+    }
+
+    //init the skin, if needed
+    if(WYMeditor.SKINS[this._options.skin]
+    && WYMeditor.SKINS[this._options.skin].init)
+       WYMeditor.SKINS[this._options.skin].init(this);
+
+};
+
+
+/********** DIALOGS **********/
+
+WYMeditor.INIT_DIALOG = function(index) {
+
+  var wym = window.opener.WYMeditor.INSTANCES[index];
+  var doc = window.document;
+  var selected = wym.selected();
+  var dialogType = jQuery(wym._options.dialogTypeSelector).val();
+  var sStamp = wym.uniqueStamp();
+
+  switch(dialogType) {
+
+  case WYMeditor.DIALOG_LINK:
+    //ensure that we select the link to populate the fields
+    if(selected && selected.tagName && selected.tagName.toLowerCase != WYMeditor.A)
+      selected = jQuery(selected).parentsOrSelf(WYMeditor.A);
+
+    //fix MSIE selection if link image has been clicked
+    if(!selected && wym._selected_image)
+      selected = jQuery(wym._selected_image).parentsOrSelf(WYMeditor.A);
+  break;
+
+  }
+
+  //pre-init functions
+  if(jQuery.isFunction(wym._options.preInitDialog))
+    wym._options.preInitDialog(wym,window);
+
+  //add css rules from options
+  var styles = doc.styleSheets[0];
+  var aCss = eval(wym._options.dialogStyles);
+
+  wym.addCssRules(doc, aCss);
+
+  //auto populate fields if selected container (e.g. A)
+  if(selected) {
+    jQuery(wym._options.hrefSelector).val(jQuery(selected).attr(WYMeditor.HREF));
+    jQuery(wym._options.srcSelector).val(jQuery(selected).attr(WYMeditor.SRC));
+    jQuery(wym._options.titleSelector).val(jQuery(selected).attr(WYMeditor.TITLE));
+    jQuery(wym._options.altSelector).val(jQuery(selected).attr(WYMeditor.ALT));
+  }
+
+  //auto populate image fields if selected image
+  if(wym._selected_image) {
+    jQuery(wym._options.dialogImageSelector + " " + wym._options.srcSelector)
+      .val(jQuery(wym._selected_image).attr(WYMeditor.SRC));
+    jQuery(wym._options.dialogImageSelector + " " + wym._options.titleSelector)
+      .val(jQuery(wym._selected_image).attr(WYMeditor.TITLE));
+    jQuery(wym._options.dialogImageSelector + " " + wym._options.altSelector)
+      .val(jQuery(wym._selected_image).attr(WYMeditor.ALT));
+  }
+
+  jQuery(wym._options.dialogLinkSelector + " "
+    + wym._options.submitSelector).click(function() {
+
+      var sUrl = jQuery(wym._options.hrefSelector).val();
+      if(sUrl.length > 0) {
+
+        wym._exec(WYMeditor.CREATE_LINK, sStamp);
+
+        jQuery("a[href=" + sStamp + "]", wym._doc.body)
+            .attr(WYMeditor.HREF, sUrl)
+            .attr(WYMeditor.TITLE, jQuery(wym._options.titleSelector).val());
+
+      }
+      window.close();
+  });
+
+  jQuery(wym._options.dialogImageSelector + " "
+    + wym._options.submitSelector).click(function() {
+
+      var sUrl = jQuery(wym._options.srcSelector).val();
+      if(sUrl.length > 0) {
+
+        wym._exec(WYMeditor.INSERT_IMAGE, sStamp);
+
+        jQuery("img[src$=" + sStamp + "]", wym._doc.body)
+            .attr(WYMeditor.SRC, sUrl)
+            .attr(WYMeditor.TITLE, jQuery(wym._options.titleSelector).val())
+            .attr(WYMeditor.ALT, jQuery(wym._options.altSelector).val());
+      }
+      window.close();
+  });
+
+  jQuery(wym._options.dialogTableSelector + " "
+    + wym._options.submitSelector).click(function() {
+
+      var iRows = jQuery(wym._options.rowsSelector).val();
+      var iCols = jQuery(wym._options.colsSelector).val();
+
+      if(iRows > 0 && iCols > 0) {
+
+        var table = wym._doc.createElement(WYMeditor.TABLE);
+        var newRow = null;
+               var newCol = null;
+
+               var sCaption = jQuery(wym._options.captionSelector).val();
+
+               //we create the caption
+               var newCaption = table.createCaption();
+               newCaption.innerHTML = sCaption;
+
+               //we create the rows and cells
+               for(x=0; x<iRows; x++) {
+                       newRow = table.insertRow(x);
+                       for(y=0; y<iCols; y++) {newRow.insertCell(y);}
+               }
+
+        //set the summary attr
+        jQuery(table).attr('summary',
+            jQuery(wym._options.summarySelector).val());
+
+        //append the table after the selected container
+        var node = jQuery(wym.findUp(wym.container(),
+          WYMeditor.MAIN_CONTAINERS)).get(0);
+        if(!node || !node.parentNode) jQuery(wym._doc.body).append(table);
+        else jQuery(node).after(table);
+      }
+      window.close();
+  });
+
+  jQuery(wym._options.dialogPasteSelector + " "
+    + wym._options.submitSelector).click(function() {
+
+      var sText = jQuery(wym._options.textSelector).val();
+      wym.paste(sText);
+      window.close();
+  });
+
+  jQuery(wym._options.dialogPreviewSelector + " "
+    + wym._options.previewSelector)
+    .html(wym.xhtml());
+
+  //cancel button
+  jQuery(wym._options.cancelSelector).mousedown(function() {
+    window.close();
+  });
+
+  //pre-init functions
+  if(jQuery.isFunction(wym._options.postInitDialog))
+    wym._options.postInitDialog(wym,window);
+
+};
+
+/********** XHTML LEXER/PARSER **********/
+
+/*
+* @name xml
+* @description Use these methods to generate XML and XHTML compliant tags and
+* escape tag attributes correctly
+* @author Bermi Ferrer - http://bermi.org
+* @author David Heinemeier Hansson http://loudthinking.com
+*/
+WYMeditor.XmlHelper = function()
+{
+  this._entitiesDiv = document.createElement('div');
+  return this;
+};
+
+
+/*
+* @name tag
+* @description
+* Returns an empty HTML tag of type *name* which by default is XHTML
+* compliant. Setting *open* to true will create an open tag compatible
+* with HTML 4.0 and below. Add HTML attributes by passing an attributes
+* array to *options*. For attributes with no value like (disabled and
+* readonly), give it a value of true in the *options* array.
+*
+* Examples:
+*
+*   this.tag('br')
+*    # => <br />
+*   this.tag ('br', false, true)
+*    # => <br>
+*   this.tag ('input', jQuery({type:'text',disabled:true }) )
+*    # => <input type="text" disabled="disabled" />
+*/
+WYMeditor.XmlHelper.prototype.tag = function(name, options, open)
+{
+  options = options || false;
+  open = open || false;
+  return '<'+name+(options ? this.tagOptions(options) : '')+(open ? '>' : ' />');
+};
+
+/*
+* @name contentTag
+* @description
+* Returns a XML block tag of type *name* surrounding the *content*. Add
+* XML attributes by passing an attributes array to *options*. For attributes
+* with no value like (disabled and readonly), give it a value of true in
+* the *options* array. You can use symbols or strings for the attribute names.
+*
+*   this.contentTag ('p', 'Hello world!' )
+*    # => <p>Hello world!</p>
+*   this.contentTag('div', this.contentTag('p', "Hello world!"), jQuery({class : "strong"}))
+*    # => <div class="strong"><p>Hello world!</p></div>
+*   this.contentTag("select", options, jQuery({multiple : true}))
+*    # => <select multiple="multiple">...options...</select>
+*/
+WYMeditor.XmlHelper.prototype.contentTag = function(name, content, options)
+{
+  options = options || false;
+  return '<'+name+(options ? this.tagOptions(options) : '')+'>'+content+'</'+name+'>';
+};
+
+/*
+* @name cdataSection
+* @description
+* Returns a CDATA section for the given +content+.  CDATA sections
+* are used to escape blocks of text containing characters which would
+* otherwise be recognized as markup. CDATA sections begin with the string
+* <tt>&lt;![CDATA[</tt> and } with (and may not contain) the string
+* <tt>]]></tt>.
+*/
+WYMeditor.XmlHelper.prototype.cdataSection = function(content)
+{
+  return '<![CDATA['+content+']]>';
+};
+
+
+/*
+* @name escapeOnce
+* @description
+* Returns the escaped +xml+ without affecting existing escaped entities.
+*
+*  this.escapeOnce( "1 > 2 &amp; 3")
+*    # => "1 &gt; 2 &amp; 3"
+*/
+WYMeditor.XmlHelper.prototype.escapeOnce = function(xml)
+{
+  return this._fixDoubleEscape(this.escapeEntities(xml));
+};
+
+/*
+* @name _fixDoubleEscape
+* @description
+* Fix double-escaped entities, such as &amp;amp;, &amp;#123;, etc.
+*/
+WYMeditor.XmlHelper.prototype._fixDoubleEscape = function(escaped)
+{
+  return escaped.replace(/&amp;([a-z]+|(#\d+));/ig, "&$1;");
+};
+
+/*
+* @name tagOptions
+* @description
+* Takes an array like the one generated by Tag.parseAttributes
+*  [["src", "http://www.editam.com/?a=b&c=d&amp;f=g"], ["title", "Editam, <Simplified> CMS"]]
+* or an object like {src:"http://www.editam.com/?a=b&c=d&amp;f=g", title:"Editam, <Simplified> CMS"}
+* and returns a string properly escaped like
+* ' src = "http://www.editam.com/?a=b&amp;c=d&amp;f=g" title = "Editam, &lt;Simplified&gt; CMS"'
+* which is valid for strict XHTML
+*/
+WYMeditor.XmlHelper.prototype.tagOptions = function(options)
+{
+  var xml = this;
+  xml._formated_options = '';
+
+  for (var key in options) {
+    var formated_options = '';
+    var value = options[key];
+    if(typeof value != 'function' && value.length > 0) {
+
+      if(parseInt(key) == key && typeof value == 'object'){
+        key = value.shift();
+        value = value.pop();
+      }
+      if(key != '' && value != ''){
+        xml._formated_options += ' '+key+'="'+xml.escapeOnce(value)+'"';
+      }
+    }
+  }
+  return xml._formated_options;
+};
+
+/*
+* @name escapeEntities
+* @description
+* Escapes XML/HTML entities <, >, & and ". If seccond parameter is set to false it
+* will not escape ". If set to true it will also escape '
+*/
+WYMeditor.XmlHelper.prototype.escapeEntities = function(string, escape_quotes)
+{
+  this._entitiesDiv.innerHTML = string;
+  this._entitiesDiv.textContent = string;
+  var result = this._entitiesDiv.innerHTML;
+  if(typeof escape_quotes == 'undefined'){
+    if(escape_quotes != false) result = result.replace('"', '&quot;');
+    if(escape_quotes == true)  result = result.replace('"', '&#039;');
+  }
+  return result;
+};
+
+/*
+* Parses a string conatining tag attributes and values an returns an array formated like
+*  [["src", "http://www.editam.com"], ["title", "Editam, Simplified CMS"]]
+*/
+WYMeditor.XmlHelper.prototype.parseAttributes = function(tag_attributes)
+{
+  // Use a compounded regex to match single quoted, double quoted and unquoted attribute pairs
+  var result = [];
+  var matches = tag_attributes.split(/((=\s*")(")("))|((=\s*\')(\')(\'))|((=\s*[^>\s]*))/g);
+  if(matches.toString() != tag_attributes){
+    for (var k in matches) {
+      var v = matches[k];
+      if(typeof v != 'function' && v.length != 0){
+        var re = new RegExp('(\\w+)\\s*'+v);
+        if(match = tag_attributes.match(re) ){
+          var value = v.replace(/^[\s=]+/, "");
+          var delimiter = value.charAt(0);
+          delimiter = delimiter == '"' ? '"' : (delimiter=="'"?"'":'');
+          if(delimiter != ''){
+            value = delimiter == '"' ? value.replace(/^"|"+$/g, '') :  value.replace(/^'|'+$/g, '');
+          }
+          tag_attributes = tag_attributes.replace(match[0],'');
+          result.push([match[1] , value]);
+        }
+      }
+    }
+  }
+  return result;
+};
+
+/**
+* XhtmlValidator for validating tag attributes
+*
+* @author Bermi Ferrer - http://bermi.org
+*/
+WYMeditor.XhtmlValidator = {
+  "_attributes":
+  {
+    "core":
+    {
+      "except":[
+      "base",
+      "head",
+      "html",
+      "meta",
+      "param",
+      "script",
+      "style",
+      "title"
+      ],
+      "attributes":[
+      "class",
+      "id",
+      "style",
+      "title",
+      "accesskey",
+      "tabindex"
+      ]
+    },
+    "language":
+    {
+      "except":[
+      "base",
+      "br",
+      "hr",
+      "iframe",
+      "param",
+      "script"
+      ],
+      "attributes":
+      {
+        "dir":[
+        "ltr",
+        "rtl"
+        ],
+        "0":"lang",
+        "1":"xml:lang"
+      }
+    },
+    "keyboard":
+    {
+      "attributes":
+      {
+        "accesskey":/^(\w){1}$/,
+        "tabindex":/^(\d)+$/
+      }
+    }
+  },
+  "_events":
+  {
+    "window":
+    {
+      "only":[
+      "body"
+      ],
+      "attributes":[
+      "onload",
+      "onunload"
+      ]
+    },
+    "form":
+    {
+      "only":[
+      "form",
+      "input",
+      "textarea",
+      "select",
+      "a",
+      "label",
+      "button"
+      ],
+      "attributes":[
+      "onchange",
+      "onsubmit",
+      "onreset",
+      "onselect",
+      "onblur",
+      "onfocus"
+      ]
+    },
+    "keyboard":
+    {
+      "except":[
+      "base",
+      "bdo",
+      "br",
+      "frame",
+      "frameset",
+      "head",
+      "html",
+      "iframe",
+      "meta",
+      "param",
+      "script",
+      "style",
+      "title"
+      ],
+      "attributes":[
+      "onkeydown",
+      "onkeypress",
+      "onkeyup"
+      ]
+    },
+    "mouse":
+    {
+      "except":[
+      "base",
+      "bdo",
+      "br",
+      "head",
+      "html",
+      "meta",
+      "param",
+      "script",
+      "style",
+      "title"
+      ],
+      "attributes":[
+      "onclick",
+      "ondblclick",
+      "onmousedown",
+      "onmousemove",
+      "onmouseover",
+      "onmouseout",
+      "onmouseup"
+      ]
+    }
+  },
+  "_tags":
+  {
+    "a":
+    {
+      "attributes":
+      {
+        "0":"charset",
+        "1":"coords",
+        "2":"href",
+        "3":"hreflang",
+        "4":"name",
+        "rel":/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/,
+        "rev":/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/,
+        "shape":/^(rect|rectangle|circ|circle|poly|polygon)$/,
+        "5":"type"
+      }
+    },
+    "0":"abbr",
+    "1":"acronym",
+    "2":"address",
+    "area":
+    {
+      "attributes":
+      {
+        "0":"alt",
+        "1":"coords",
+        "2":"href",
+        "nohref":/^(true|false)$/,
+        "shape":/^(rect|rectangle|circ|circle|poly|polygon)$/
+      },
+      "required":[
+      "alt"
+      ]
+    },
+    "3":"b",
+    "base":
+    {
+      "attributes":[
+      "href"
+      ],
+      "required":[
+      "href"
+      ]
+    },
+    "bdo":
+    {
+      "attributes":
+      {
+        "dir":/^(ltr|rtl)$/
+      },
+      "required":[
+      "dir"
+      ]
+    },
+    "4":"big",
+    "blockquote":
+    {
+      "attributes":[
+      "cite"
+      ]
+    },
+    "5":"body",
+    "6":"br",
+    "button":
+    {
+      "attributes":
+      {
+        "disabled":/^(disabled)$/,
+        "type":/^(button|reset|submit)$/,
+        "0":"value"
+      },
+      "inside":"form"
+    },
+    "7":"caption",
+    "8":"cite",
+    "9":"code",
+    "col":
+    {
+      "attributes":
+      {
+        "align":/^(right|left|center|justify)$/,
+        "0":"char",
+        "1":"charoff",
+        "span":/^(\d)+$/,
+        "valign":/^(top|middle|bottom|baseline)$/,
+        "2":"width"
+      },
+      "inside":"colgroup"
+    },
+    "colgroup":
+    {
+      "attributes":
+      {
+        "align":/^(right|left|center|justify)$/,
+        "0":"char",
+        "1":"charoff",
+        "span":/^(\d)+$/,
+        "valign":/^(top|middle|bottom|baseline)$/,
+        "2":"width"
+      }
+    },
+    "10":"dd",
+    "del":
+    {
+      "attributes":
+      {
+        "0":"cite",
+        "datetime":/^([0-9]){8}/
+      }
+    },
+    "11":"div",
+    "12":"dfn",
+    "13":"dl",
+    "14":"dt",
+    "15":"em",
+    "fieldset":
+    {
+      "inside":"form"
+    },
+    "form":
+    {
+      "attributes":
+      {
+        "0":"action",
+        "1":"accept",
+        "2":"accept-charset",
+        "3":"enctype",
+        "method":/^(get|post)$/
+      },
+      "required":[
+      "action"
+      ]
+    },
+    "head":
+    {
+      "attributes":[
+      "profile"
+      ]
+    },
+    "16":"h1",
+    "17":"h2",
+    "18":"h3",
+    "19":"h4",
+    "20":"h5",
+    "21":"h6",
+    "22":"hr",
+    "html":
+    {
+      "attributes":[
+      "xmlns"
+      ]
+    },
+    "23":"i",
+    "img":
+    {
+      "attributes":[
+      "alt",
+      "src",
+      "height",
+      "ismap",
+      "longdesc",
+      "usemap",
+      "width"
+      ],
+      "required":[
+      "alt",
+      "src"
+      ]
+    },
+    "input":
+    {
+      "attributes":
+      {
+        "0":"accept",
+        "1":"alt",
+        "checked":/^(checked)$/,
+        "disabled":/^(disabled)$/,
+        "maxlength":/^(\d)+$/,
+        "2":"name",
+        "readonly":/^(readonly)$/,
+        "size":/^(\d)+$/,
+        "3":"src",
+        "type":/^(button|checkbox|file|hidden|image|password|radio|reset|submit|text)$/,
+        "4":"value"
+      },
+      "inside":"form"
+    },
+    "ins":
+    {
+      "attributes":
+      {
+        "0":"cite",
+        "datetime":/^([0-9]){8}/
+      }
+    },
+    "24":"kbd",
+    "label":
+    {
+      "attributes":[
+      "for"
+      ],
+      "inside":"form"
+    },
+    "25":"legend",
+    "26":"li",
+    "link":
+    {
+      "attributes":
+      {
+        "0":"charset",
+        "1":"href",
+        "2":"hreflang",
+        "media":/^(all|braille|print|projection|screen|speech|,|;| )+$/i,
+        //next comment line required by Opera!
+        /*"rel":/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,*/
+        "rel":/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,
+        "rev":/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,
+        "3":"type"
+      },
+      "inside":"head"
+    },
+    "map":
+    {
+      "attributes":[
+      "id",
+      "name"
+      ],
+      "required":[
+      "id"
+      ]
+    },
+    "meta":
+    {
+      "attributes":
+      {
+        "0":"content",
+        "http-equiv":/^(content\-type|expires|refresh|set\-cookie)$/i,
+        "1":"name",
+        "2":"scheme"
+      },
+      "required":[
+      "content"
+      ]
+    },
+    "27":"noscript",
+    "object":
+    {
+      "attributes":[
+      "archive",
+      "classid",
+      "codebase",
+      "codetype",
+      "data",
+      "declare",
+      "height",
+      "name",
+      "standby",
+      "type",
+      "usemap",
+      "width"
+      ]
+    },
+    "28":"ol",
+    "optgroup":
+    {
+      "attributes":
+      {
+        "0":"label",
+        "disabled": /^(disabled)$/
+      },
+      "required":[
+      "label"
+      ]
+    },
+    "option":
+    {
+      "attributes":
+      {
+        "0":"label",
+        "disabled":/^(disabled)$/,
+        "selected":/^(selected)$/,
+        "1":"value"
+      },
+      "inside":"select"
+    },
+    "29":"p",
+    "param":
+    {
+      "attributes":
+      {
+        "0":"type",
+        "valuetype":/^(data|ref|object)$/,
+        "1":"valuetype",
+        "2":"value"
+      },
+      "required":[
+      "name"
+      ]
+    },
+    "30":"pre",
+    "q":
+    {
+      "attributes":[
+      "cite"
+      ]
+    },
+    "31":"samp",
+    "script":
+    {
+      "attributes":
+      {
+        "type":/^(text\/ecmascript|text\/javascript|text\/jscript|text\/vbscript|text\/vbs|text\/xml)$/,
+        "0":"charset",
+        "defer":/^(defer)$/,
+        "1":"src"
+      },
+      "required":[
+      "type"
+      ]
+    },
+    "select":
+    {
+      "attributes":
+      {
+        "disabled":/^(disabled)$/,
+        "multiple":/^(multiple)$/,
+        "0":"name",
+        "1":"size"
+      },
+      "inside":"form"
+    },
+    "32":"small",
+    "33":"span",
+    "34":"strong",
+    "style":
+    {
+      "attributes":
+      {
+        "0":"type",
+        "media":/^(screen|tty|tv|projection|handheld|print|braille|aural|all)$/
+      },
+      "required":[
+      "type"
+      ]
+    },
+    "35":"sub",
+    "36":"sup",
+    "table":
+    {
+      "attributes":
+      {
+        "0":"border",
+        "1":"cellpadding",
+        "2":"cellspacing",
+        "frame":/^(void|above|below|hsides|lhs|rhs|vsides|box|border)$/,
+        "rules":/^(none|groups|rows|cols|all)$/,
+        "3":"summary",
+        "4":"width"
+      }
+    },
+    "tbody":
+    {
+      "attributes":
+      {
+        "align":/^(right|left|center|justify)$/,
+        "0":"char",
+        "1":"charoff",
+        "valign":/^(top|middle|bottom|baseline)$/
+      }
+    },
+    "td":
+    {
+      "attributes":
+      {
+        "0":"abbr",
+        "align":/^(left|right|center|justify|char)$/,
+        "1":"axis",
+        "2":"char",
+        "3":"charoff",
+        "colspan":/^(\d)+$/,
+        "4":"headers",
+        "rowspan":/^(\d)+$/,
+        "scope":/^(col|colgroup|row|rowgroup)$/,
+        "valign":/^(top|middle|bottom|baseline)$/
+      }
+    },
+    "textarea":
+    {
+      "attributes":[
+      "cols",
+      "rows",
+      "disabled",
+      "name",
+      "readonly"
+      ],
+      "required":[
+      "cols",
+      "rows"
+      ],
+      "inside":"form"
+    },
+    "tfoot":
+    {
+      "attributes":
+      {
+        "align":/^(right|left|center|justify)$/,
+        "0":"char",
+        "1":"charoff",
+        "valign":/^(top|middle|bottom)$/,
+        "2":"baseline"
+      }
+    },
+    "th":
+    {
+      "attributes":
+      {
+        "0":"abbr",
+        "align":/^(left|right|center|justify|char)$/,
+        "1":"axis",
+        "2":"char",
+        "3":"charoff",
+        "colspan":/^(\d)+$/,
+        "4":"headers",
+        "rowspan":/^(\d)+$/,
+        "scope":/^(col|colgroup|row|rowgroup)$/,
+        "valign":/^(top|middle|bottom|baseline)$/
+      }
+    },
+    "thead":
+    {
+      "attributes":
+      {
+        "align":/^(right|left|center|justify)$/,
+        "0":"char",
+        "1":"charoff",
+        "valign":/^(top|middle|bottom|baseline)$/
+      }
+    },
+    "37":"title",
+    "tr":
+    {
+      "attributes":
+      {
+        "align":/^(right|left|center|justify|char)$/,
+        "0":"char",
+        "1":"charoff",
+        "valign":/^(top|middle|bottom|baseline)$/
+      }
+    },
+    "38":"tt",
+    "39":"ul",
+    "40":"var"
+  },
+
+  // Temporary skiped attributes
+  skiped_attributes : [],
+  skiped_attribute_values : [],
+
+  getValidTagAttributes: function(tag, attributes)
+  {
+    var valid_attributes = {};
+    var possible_attributes = this.getPossibleTagAttributes(tag);
+    for(var attribute in attributes) {
+      var value = attributes[attribute];
+      var h = WYMeditor.Helper;
+      if(!h.contains(this.skiped_attributes, attribute) && !h.contains(this.skiped_attribute_values, value)){
+        if (typeof value != 'function' && h.contains(possible_attributes, attribute)) {
+          if (this.doesAttributeNeedsValidation(tag, attribute)) {
+            if(this.validateAttribute(tag, attribute, value)){
+              valid_attributes[attribute] = value;
+            }
+          }else{
+            valid_attributes[attribute] = value;
+          }
+        }
+      }
+    }
+    return valid_attributes;
+  },
+  getUniqueAttributesAndEventsForTag : function(tag)
+  {
+    var result = [];
+
+    if (this._tags[tag] && this._tags[tag]['attributes']) {
+      for (k in this._tags[tag]['attributes']) {
+        result.push(parseInt(k) == k ? this._tags[tag]['attributes'][k] : k);
+      }
+    }
+    return result;
+  },
+  getDefaultAttributesAndEventsForTags : function()
+  {
+    var result = [];
+    for (var key in this._events){
+      result.push(this._events[key]);
+    }
+    for (var key in this._attributes){
+      result.push(this._attributes[key]);
+    }
+    return result;
+  },
+  isValidTag : function(tag)
+  {
+    if(this._tags[tag]){
+      return true;
+    }
+    for(var key in this._tags){
+      if(this._tags[key] == tag){
+        return true;
+      }
+    }
+    return false;
+  },
+  getDefaultAttributesAndEventsForTag : function(tag)
+  {
+    var default_attributes = [];
+    if (this.isValidTag(tag)) {
+      var default_attributes_and_events = this.getDefaultAttributesAndEventsForTags();
+
+      for(var key in default_attributes_and_events) {
+        var defaults = default_attributes_and_events[key];
+        if(typeof defaults == 'object'){
+          var h = WYMeditor.Helper;
+          if ((defaults['except'] && h.contains(defaults['except'], tag)) || (defaults['only'] && !h.contains(defaults['only'], tag))) {
+            continue;
+          }
+
+          var tag_defaults = defaults['attributes'] ? defaults['attributes'] : defaults['events'];
+          for(var k in tag_defaults) {
+            default_attributes.push(typeof tag_defaults[k] != 'string' ? k : tag_defaults[k]);
+          }
+        }
+      }
+    }
+    return default_attributes;
+  },
+  doesAttributeNeedsValidation: function(tag, attribute)
+  {
+    return this._tags[tag] && ((this._tags[tag]['attributes'] && this._tags[tag]['attributes'][attribute]) || (this._tags[tag]['required'] &&
+     WYMeditor.Helper.contains(this._tags[tag]['required'], attribute)));
+  },
+  validateAttribute : function(tag, attribute, value)
+  {
+    if ( this._tags[tag] &&
+      (this._tags[tag]['attributes'] && this._tags[tag]['attributes'][attribute] && value.length > 0 && !value.match(this._tags[tag]['attributes'][attribute])) || // invalid format
+      (this._tags[tag] && this._tags[tag]['required'] && WYMeditor.Helper.contains(this._tags[tag]['required'], attribute) && value.length == 0) // required attribute
+    ) {
+      return false;
+    }
+    return typeof this._tags[tag] != 'undefined';
+  },
+  getPossibleTagAttributes : function(tag)
+  {
+    if (!this._possible_tag_attributes) {
+      this._possible_tag_attributes = {};
+    }
+    if (!this._possible_tag_attributes[tag]) {
+      this._possible_tag_attributes[tag] = this.getUniqueAttributesAndEventsForTag(tag).concat(this.getDefaultAttributesAndEventsForTag(tag));
+    }
+    return this._possible_tag_attributes[tag];
+  }
+};
+
+
+/**
+*    Compounded regular expression. Any of
+*    the contained patterns could match and
+*    when one does, it's label is returned.
+*
+*    Constructor. Starts with no patterns.
+*    @param boolean case    True for case sensitive, false
+*                            for insensitive.
+*    @access public
+*    @author Marcus Baker (http://lastcraft.com)
+*    @author Bermi Ferrer (http://bermi.org)
+*/
+WYMeditor.ParallelRegex = function(case_sensitive)
+{
+  this._case = case_sensitive;
+  this._patterns = [];
+  this._labels = [];
+  this._regex = null;
+  return this;
+};
+
+
+/**
+*    Adds a pattern with an optional label.
+*    @param string pattern      Perl style regex, but ( and )
+*                                lose the usual meaning.
+*    @param string label        Label of regex to be returned
+*                                on a match.
+*    @access public
+*/
+WYMeditor.ParallelRegex.prototype.addPattern = function(pattern, label)
+{
+  label = label || true;
+  var count = this._patterns.length;
+  this._patterns[count] = pattern;
+  this._labels[count] = label;
+  this._regex = null;
+};
+
+/**
+*    Attempts to match all patterns at once against
+*    a string.
+*    @param string subject      String to match against.
+*
+*    @return boolean             True on success.
+*    @return string match         First matched portion of
+*                                subject.
+*    @access public
+*/
+WYMeditor.ParallelRegex.prototype.match = function(subject)
+{
+  if (this._patterns.length == 0) {
+    return [false, ''];
+  }
+  var matches = subject.match(this._getCompoundedRegex());
+
+  if(!matches){
+    return [false, ''];
+  }
+  var match = matches[0];
+  for (var i = 1; i < matches.length; i++) {
+    if (matches[i]) {
+      return [this._labels[i-1], match];
+    }
+  }
+  return [true, matches[0]];
+};
+
+/**
+*    Compounds the patterns into a single
+*    regular expression separated with the
+*    "or" operator. Caches the regex.
+*    Will automatically escape (, ) and / tokens.
+*    @param array patterns    List of patterns in order.
+*    @access private
+*/
+WYMeditor.ParallelRegex.prototype._getCompoundedRegex = function()
+{
+  if (this._regex == null) {
+    for (var i = 0, count = this._patterns.length; i < count; i++) {
+      this._patterns[i] = '(' + this._untokenizeRegex(this._tokenizeRegex(this._patterns[i]).replace(/([\/\(\)])/g,'\\$1')) + ')';
+    }
+    this._regex = new RegExp(this._patterns.join("|") ,this._getPerlMatchingFlags());
+  }
+  return this._regex;
+};
+
+/**
+* Escape lookahead/lookbehind blocks
+*/
+WYMeditor.ParallelRegex.prototype._tokenizeRegex = function(regex)
+{
+  return regex.
+  replace(/\(\?(i|m|s|x|U)\)/,     '~~~~~~Tk1\$1~~~~~~').
+  replace(/\(\?(\-[i|m|s|x|U])\)/, '~~~~~~Tk2\$1~~~~~~').
+  replace(/\(\?\=(.*)\)/,          '~~~~~~Tk3\$1~~~~~~').
+  replace(/\(\?\!(.*)\)/,          '~~~~~~Tk4\$1~~~~~~').
+  replace(/\(\?\<\=(.*)\)/,        '~~~~~~Tk5\$1~~~~~~').
+  replace(/\(\?\<\!(.*)\)/,        '~~~~~~Tk6\$1~~~~~~').
+  replace(/\(\?\:(.*)\)/,          '~~~~~~Tk7\$1~~~~~~');
+};
+
+/**
+* Unscape lookahead/lookbehind blocks
+*/
+WYMeditor.ParallelRegex.prototype._untokenizeRegex = function(regex)
+{
+  return regex.
+  replace(/~~~~~~Tk1(.{1})~~~~~~/,    "(?\$1)").
+  replace(/~~~~~~Tk2(.{2})~~~~~~/,    "(?\$1)").
+  replace(/~~~~~~Tk3(.*)~~~~~~/,      "(?=\$1)").
+  replace(/~~~~~~Tk4(.*)~~~~~~/,      "(?!\$1)").
+  replace(/~~~~~~Tk5(.*)~~~~~~/,      "(?<=\$1)").
+  replace(/~~~~~~Tk6(.*)~~~~~~/,      "(?<!\$1)").
+  replace(/~~~~~~Tk7(.*)~~~~~~/,      "(?:\$1)");
+};
+
+
+/**
+*    Accessor for perl regex mode flags to use.
+*    @return string       Perl regex flags.
+*    @access private
+*/
+WYMeditor.ParallelRegex.prototype._getPerlMatchingFlags = function()
+{
+  return (this._case ? "m" : "mi");
+};
+
+
+
+/**
+*    States for a stack machine.
+*
+*    Constructor. Starts in named state.
+*    @param string start        Starting state name.
+*    @access public
+*    @author Marcus Baker (http://lastcraft.com)
+*    @author Bermi Ferrer (http://bermi.org)
+*/
+WYMeditor.StateStack = function(start)
+{
+  this._stack = [start];
+  return this;
+};
+
+/**
+*    Accessor for current state.
+*    @return string       State.
+*    @access public
+*/
+WYMeditor.StateStack.prototype.getCurrent = function()
+{
+  return this._stack[this._stack.length - 1];
+};
+
+/**
+*    Adds a state to the stack and sets it
+*    to be the current state.
+*    @param string state        New state.
+*    @access public
+*/
+WYMeditor.StateStack.prototype.enter = function(state)
+{
+  this._stack.push(state);
+};
+
+/**
+*    Leaves the current state and reverts
+*    to the previous one.
+*    @return boolean    False if we drop off
+*                       the bottom of the list.
+*    @access public
+*/
+WYMeditor.StateStack.prototype.leave = function()
+{
+  if (this._stack.length == 1) {
+    return false;
+  }
+  this._stack.pop();
+  return true;
+};
+
+
+// GLOBALS
+WYMeditor.LEXER_ENTER = 1;
+WYMeditor.LEXER_MATCHED = 2;
+WYMeditor.LEXER_UNMATCHED = 3;
+WYMeditor.LEXER_EXIT = 4;
+WYMeditor.LEXER_SPECIAL = 5;
+
+
+/**
+*    Accepts text and breaks it into tokens.
+*    Some optimisation to make the sure the
+*    content is only scanned by the PHP regex
+*    parser once. Lexer modes must not start
+*    with leading underscores.
+*
+*    Sets up the lexer in case insensitive matching
+*    by default.
+*    @param Parser parser  Handling strategy by reference.
+*    @param string start            Starting handler.
+*    @param boolean case            True for case sensitive.
+*    @access public
+*    @author Marcus Baker (http://lastcraft.com)
+*    @author Bermi Ferrer (http://bermi.org)
+*/
+WYMeditor.Lexer = function(parser, start, case_sensitive)
+{
+  start = start || 'accept';
+  this._case = case_sensitive || false;
+  this._regexes = {};
+  this._parser = parser;
+  this._mode = new WYMeditor.StateStack(start);
+  this._mode_handlers = {};
+  this._mode_handlers[start] = start;
+  return this;
+};
+
+/**
+*    Adds a token search pattern for a particular
+*    parsing mode. The pattern does not change the
+*    current mode.
+*    @param string pattern      Perl style regex, but ( and )
+*                                lose the usual meaning.
+*    @param string mode         Should only apply this
+*                                pattern when dealing with
+*                                this type of input.
+*    @access public
+*/
+WYMeditor.Lexer.prototype.addPattern = function(pattern, mode)
+{
+  var mode = mode || "accept";
+  if (typeof this._regexes[mode] == 'undefined') {
+    this._regexes[mode] = new WYMeditor.ParallelRegex(this._case);
+  }
+  this._regexes[mode].addPattern(pattern);
+  if (typeof this._mode_handlers[mode] == 'undefined') {
+    this._mode_handlers[mode] = mode;
+  }
+};
+
+/**
+*    Adds a pattern that will enter a new parsing
+*    mode. Useful for entering parenthesis, strings,
+*    tags, etc.
+*    @param string pattern      Perl style regex, but ( and )
+*                                lose the usual meaning.
+*    @param string mode         Should only apply this
+*                                pattern when dealing with
+*                                this type of input.
+*    @param string new_mode     Change parsing to this new
+*                                nested mode.
+*    @access public
+*/
+WYMeditor.Lexer.prototype.addEntryPattern = function(pattern, mode, new_mode)
+{
+  if (typeof this._regexes[mode] == 'undefined') {
+    this._regexes[mode] = new WYMeditor.ParallelRegex(this._case);
+  }
+  this._regexes[mode].addPattern(pattern, new_mode);
+  if (typeof this._mode_handlers[new_mode] == 'undefined') {
+    this._mode_handlers[new_mode] = new_mode;
+  }
+};
+
+/**
+*    Adds a pattern that will exit the current mode
+*    and re-enter the previous one.
+*    @param string pattern      Perl style regex, but ( and )
+*                                lose the usual meaning.
+*    @param string mode         Mode to leave.
+*    @access public
+*/
+WYMeditor.Lexer.prototype.addExitPattern = function(pattern, mode)
+{
+  if (typeof this._regexes[mode] == 'undefined') {
+    this._regexes[mode] = new WYMeditor.ParallelRegex(this._case);
+  }
+  this._regexes[mode].addPattern(pattern, "__exit");
+  if (typeof this._mode_handlers[mode] == 'undefined') {
+    this._mode_handlers[mode] = mode;
+  }
+};
+
+/**
+*    Adds a pattern that has a special mode. Acts as an entry
+*    and exit pattern in one go, effectively calling a special
+*    parser handler for this token only.
+*    @param string pattern      Perl style regex, but ( and )
+*                                lose the usual meaning.
+*    @param string mode         Should only apply this
+*                                pattern when dealing with
+*                                this type of input.
+*    @param string special      Use this mode for this one token.
+*    @access public
+*/
+WYMeditor.Lexer.prototype.addSpecialPattern =  function(pattern, mode, special)
+{
+  if (typeof this._regexes[mode] == 'undefined') {
+    this._regexes[mode] = new WYMeditor.ParallelRegex(this._case);
+  }
+  this._regexes[mode].addPattern(pattern, '_'+special);
+  if (typeof this._mode_handlers[special] == 'undefined') {
+    this._mode_handlers[special] = special;
+  }
+};
+
+/**
+*    Adds a mapping from a mode to another handler.
+*    @param string mode        Mode to be remapped.
+*    @param string handler     New target handler.
+*    @access public
+*/
+WYMeditor.Lexer.prototype.mapHandler = function(mode, handler)
+{
+  this._mode_handlers[mode] = handler;
+};
+
+/**
+*    Splits the page text into tokens. Will fail
+*    if the handlers report an error or if no
+*    content is consumed. If successful then each
+*    unparsed and parsed token invokes a call to the
+*    held listener.
+*    @param string raw        Raw HTML text.
+*    @return boolean           True on success, else false.
+*    @access public
+*/
+WYMeditor.Lexer.prototype.parse = function(raw)
+{
+  if (typeof this._parser == 'undefined') {
+    return false;
+  }
+
+  var length = raw.length;
+  var parsed;
+  while (typeof (parsed = this._reduce(raw)) == 'object') {
+    var raw = parsed[0];
+    var unmatched = parsed[1];
+    var matched = parsed[2];
+    var mode = parsed[3];
+
+    if (! this._dispatchTokens(unmatched, matched, mode)) {
+      return false;
+    }
+
+    if (raw == '') {
+      return true;
+    }
+    if (raw.length == length) {
+      return false;
+    }
+    length = raw.length;
+  }
+  if (! parsed ) {
+    return false;
+  }
+
+  return this._invokeParser(raw, WYMeditor.LEXER_UNMATCHED);
+};
+
+/**
+*    Sends the matched token and any leading unmatched
+*    text to the parser changing the lexer to a new
+*    mode if one is listed.
+*    @param string unmatched    Unmatched leading portion.
+*    @param string matched      Actual token match.
+*    @param string mode         Mode after match. A boolean
+*                                false mode causes no change.
+*    @return boolean             False if there was any error
+*                                from the parser.
+*    @access private
+*/
+WYMeditor.Lexer.prototype._dispatchTokens = function(unmatched, matched, mode)
+{
+  mode = mode || false;
+
+  if (! this._invokeParser(unmatched, WYMeditor.LEXER_UNMATCHED)) {
+    return false;
+  }
+
+  if (typeof mode == 'boolean') {
+    return this._invokeParser(matched, WYMeditor.LEXER_MATCHED);
+  }
+  if (this._isModeEnd(mode)) {
+    if (! this._invokeParser(matched, WYMeditor.LEXER_EXIT)) {
+      return false;
+    }
+    return this._mode.leave();
+  }
+  if (this._isSpecialMode(mode)) {
+    this._mode.enter(this._decodeSpecial(mode));
+    if (! this._invokeParser(matched, WYMeditor.LEXER_SPECIAL)) {
+      return false;
+    }
+    return this._mode.leave();
+  }
+  this._mode.enter(mode);
+
+  return this._invokeParser(matched, WYMeditor.LEXER_ENTER);
+};
+
+/**
+*    Tests to see if the new mode is actually to leave
+*    the current mode and pop an item from the matching
+*    mode stack.
+*    @param string mode    Mode to test.
+*    @return boolean        True if this is the exit mode.
+*    @access private
+*/
+WYMeditor.Lexer.prototype._isModeEnd = function(mode)
+{
+  return (mode === "__exit");
+};
+
+/**
+*    Test to see if the mode is one where this mode
+*    is entered for this token only and automatically
+*    leaves immediately afterwoods.
+*    @param string mode    Mode to test.
+*    @return boolean        True if this is the exit mode.
+*    @access private
+*/
+WYMeditor.Lexer.prototype._isSpecialMode = function(mode)
+{
+  return (mode.substring(0,1) == "_");
+};
+
+/**
+*    Strips the magic underscore marking single token
+*    modes.
+*    @param string mode    Mode to decode.
+*    @return string         Underlying mode name.
+*    @access private
+*/
+WYMeditor.Lexer.prototype._decodeSpecial = function(mode)
+{
+  return mode.substring(1);
+};
+
+/**
+*    Calls the parser method named after the current
+*    mode. Empty content will be ignored. The lexer
+*    has a parser handler for each mode in the lexer.
+*    @param string content        Text parsed.
+*    @param boolean is_match      Token is recognised rather
+*                                  than unparsed data.
+*    @access private
+*/
+WYMeditor.Lexer.prototype._invokeParser = function(content, is_match)
+{
+
+  if (!/ +/.test(content) && ((content === '') || (content == false))) {
+    return true;
+  }
+  var current = this._mode.getCurrent();
+  var handler = this._mode_handlers[current];
+  var result;
+  eval('result = this._parser.' + handler + '(content, is_match);');
+  return result;
+};
+
+/**
+*    Tries to match a chunk of text and if successful
+*    removes the recognised chunk and any leading
+*    unparsed data. Empty strings will not be matched.
+*    @param string raw         The subject to parse. This is the
+*                               content that will be eaten.
+*    @return array/boolean      Three item list of unparsed
+*                               content followed by the
+*                               recognised token and finally the
+*                               action the parser is to take.
+*                               True if no match, false if there
+*                               is a parsing error.
+*    @access private
+*/
+WYMeditor.Lexer.prototype._reduce = function(raw)
+{
+  var matched = this._regexes[this._mode.getCurrent()].match(raw);
+  var match = matched[1];
+  var action = matched[0];
+  if (action) {
+    var unparsed_character_count = raw.indexOf(match);
+    var unparsed = raw.substr(0, unparsed_character_count);
+    raw = raw.substring(unparsed_character_count + match.length);
+    return [raw, unparsed, match, action];
+  }
+  return true;
+};
+
+
+
+/**
+* This are the rules for breaking the XHTML code into events
+* handled by the provided parser.
+*
+*    @author Marcus Baker (http://lastcraft.com)
+*    @author Bermi Ferrer (http://bermi.org)
+*/
+WYMeditor.XhtmlLexer = function(parser)
+{
+  jQuery.extend(this, new WYMeditor.Lexer(parser, 'Text'));
+
+  this.mapHandler('Text', 'Text');
+
+  this.addTokens();
+
+  this.init();
+
+  return this;
+};
+
+
+WYMeditor.XhtmlLexer.prototype.init = function()
+{
+};
+
+WYMeditor.XhtmlLexer.prototype.addTokens = function()
+{
+  this.addCommentTokens('Text');
+  this.addScriptTokens('Text');
+  this.addCssTokens('Text');
+  this.addTagTokens('Text');
+};
+
+WYMeditor.XhtmlLexer.prototype.addCommentTokens = function(scope)
+{
+  this.addEntryPattern("<!--", scope, 'Comment');
+  this.addExitPattern("-->", 'Comment');
+};
+
+WYMeditor.XhtmlLexer.prototype.addScriptTokens = function(scope)
+{
+  this.addEntryPattern("<script", scope, 'Script');
+  this.addExitPattern("</script>", 'Script');
+};
+
+WYMeditor.XhtmlLexer.prototype.addCssTokens = function(scope)
+{
+  this.addEntryPattern("<style", scope, 'Css');
+  this.addExitPattern("</style>", 'Css');
+};
+
+WYMeditor.XhtmlLexer.prototype.addTagTokens = function(scope)
+{
+  this.addSpecialPattern("<\\s*[a-z0-9:\-]+\\s*>", scope, 'OpeningTag');
+  this.addEntryPattern("<[a-z0-9:\-]+"+'[\\\/ \\\>]+', scope, 'OpeningTag');
+  this.addInTagDeclarationTokens('OpeningTag');
+
+  this.addSpecialPattern("</\\s*[a-z0-9:\-]+\\s*>", scope, 'ClosingTag');
+
+};
+
+WYMeditor.XhtmlLexer.prototype.addInTagDeclarationTokens = function(scope)
+{
+  this.addSpecialPattern('\\s+', scope, 'Ignore');
+
+  this.addAttributeTokens(scope);
+
+  this.addExitPattern('/>', scope);
+  this.addExitPattern('>', scope);
+
+};
+
+WYMeditor.XhtmlLexer.prototype.addAttributeTokens = function(scope)
+{
+  this.addSpecialPattern("\\s*[a-z-_0-9]*:?[a-z-_0-9]+\\s*(?=\=)\\s*", scope, 'TagAttributes');
+
+  this.addEntryPattern('=\\s*"', scope, 'DoubleQuotedAttribute');
+  this.addPattern("\\\\\"", 'DoubleQuotedAttribute');
+  this.addExitPattern('"', 'DoubleQuotedAttribute');
+
+  this.addEntryPattern("=\\s*'", scope, 'SingleQuotedAttribute');
+  this.addPattern("\\\\'", 'SingleQuotedAttribute');
+  this.addExitPattern("'", 'SingleQuotedAttribute');
+
+  this.addSpecialPattern('=\\s*[^>\\s]*', scope, 'UnquotedAttribute');
+};
+
+
+
+/**
+* XHTML Parser.
+*
+* This XHTML parser will trigger the events available on on
+* current SaxListener
+*
+*    @author Bermi Ferrer (http://bermi.org)
+*/
+WYMeditor.XhtmlParser = function(Listener, mode)
+{
+  var mode = mode || 'Text';
+  this._Lexer = new WYMeditor.XhtmlLexer(this);
+  this._Listener = Listener;
+  this._mode = mode;
+  this._matches = [];
+  this._last_match = '';
+  this._current_match = '';
+
+  return this;
+};
+
+WYMeditor.XhtmlParser.prototype.parse = function(raw)
+{
+  this._Lexer.parse(this.beforeParsing(raw));
+  return this.afterParsing(this._Listener.getResult());
+};
+
+WYMeditor.XhtmlParser.prototype.beforeParsing = function(raw)
+{
+  if(raw.match(/class="MsoNormal"/) || raw.match(/ns = "urn:schemas-microsoft-com/)){
+    // Usefull for cleaning up content pasted from other sources (MSWord)
+    this._Listener.avoidStylingTagsAndAttributes();
+  }
+  return this._Listener.beforeParsing(raw);
+};
+
+WYMeditor.XhtmlParser.prototype.afterParsing = function(parsed)
+{
+  if(this._Listener._avoiding_tags_implicitly){
+    this._Listener.allowStylingTagsAndAttributes();
+  }
+  return this._Listener.afterParsing(parsed);
+};
+
+
+WYMeditor.XhtmlParser.prototype.Ignore = function(match, state)
+{
+  return true;
+};
+
+WYMeditor.XhtmlParser.prototype.Text = function(text)
+{
+  this._Listener.addContent(text);
+  return true;
+};
+
+WYMeditor.XhtmlParser.prototype.Comment = function(match, status)
+{
+  return this._addNonTagBlock(match, status, 'addComment');
+};
+
+WYMeditor.XhtmlParser.prototype.Script = function(match, status)
+{
+  return this._addNonTagBlock(match, status, 'addScript');
+};
+
+WYMeditor.XhtmlParser.prototype.Css = function(match, status)
+{
+  return this._addNonTagBlock(match, status, 'addCss');
+};
+
+WYMeditor.XhtmlParser.prototype._addNonTagBlock = function(match, state, type)
+{
+  switch (state){
+    case WYMeditor.LEXER_ENTER:
+    this._non_tag = match;
+    break;
+    case WYMeditor.LEXER_UNMATCHED:
+    this._non_tag += match;
+    break;
+    case WYMeditor.LEXER_EXIT:
+    switch(type) {
+      case 'addComment':
+      this._Listener.addComment(this._non_tag+match);
+      break;
+      case 'addScript':
+      this._Listener.addScript(this._non_tag+match);
+      break;
+      case 'addCss':
+      this._Listener.addCss(this._non_tag+match);
+      break;
+    }
+  }
+  return true;
+};
+
+WYMeditor.XhtmlParser.prototype.OpeningTag = function(match, state)
+{
+  switch (state){
+    case WYMeditor.LEXER_ENTER:
+    this._tag = this.normalizeTag(match);
+    this._tag_attributes = {};
+    break;
+    case WYMeditor.LEXER_SPECIAL:
+    this._callOpenTagListener(this.normalizeTag(match));
+    break;
+    case WYMeditor.LEXER_EXIT:
+    this._callOpenTagListener(this._tag, this._tag_attributes);
+  }
+  return true;
+};
+
+WYMeditor.XhtmlParser.prototype.ClosingTag = function(match, state)
+{
+  this._callCloseTagListener(this.normalizeTag(match));
+  return true;
+};
+
+WYMeditor.XhtmlParser.prototype._callOpenTagListener = function(tag, attributes)
+{
+  var  attributes = attributes || {};
+  this.autoCloseUnclosedBeforeNewOpening(tag);
+
+  if(this._Listener.isBlockTag(tag)){
+    this._Listener._tag_stack.push(tag);
+    this._Listener.fixNestingBeforeOpeningBlockTag(tag, attributes);
+    this._Listener.openBlockTag(tag, attributes);
+    this._increaseOpenTagCounter(tag);
+  }else if(this._Listener.isInlineTag(tag)){
+    this._Listener.inlineTag(tag, attributes);
+  }else{
+    this._Listener.openUnknownTag(tag, attributes);
+    this._increaseOpenTagCounter(tag);
+  }
+  this._Listener.last_tag = tag;
+  this._Listener.last_tag_opened = true;
+  this._Listener.last_tag_attributes = attributes;
+};
+
+WYMeditor.XhtmlParser.prototype._callCloseTagListener = function(tag)
+{
+  if(this._decreaseOpenTagCounter(tag)){
+    this.autoCloseUnclosedBeforeTagClosing(tag);
+
+    if(this._Listener.isBlockTag(tag)){
+      var expected_tag = this._Listener._tag_stack.pop();
+      if(expected_tag == false){
+        return;
+      }else if(expected_tag != tag){
+        tag = expected_tag;
+      }
+      this._Listener.closeBlockTag(tag);
+    }else{
+      this._Listener.closeUnknownTag(tag);
+    }
+  }else{
+    this._Listener.closeUnopenedTag(tag);
+  }
+  this._Listener.last_tag = tag;
+  this._Listener.last_tag_opened = false;
+};
+
+WYMeditor.XhtmlParser.prototype._increaseOpenTagCounter = function(tag)
+{
+  this._Listener._open_tags[tag] = this._Listener._open_tags[tag] || 0;
+  this._Listener._open_tags[tag]++;
+};
+
+WYMeditor.XhtmlParser.prototype._decreaseOpenTagCounter = function(tag)
+{
+  if(this._Listener._open_tags[tag]){
+    this._Listener._open_tags[tag]--;
+    if(this._Listener._open_tags[tag] == 0){
+      this._Listener._open_tags[tag] = undefined;
+    }
+    return true;
+  }
+  return false;
+};
+
+WYMeditor.XhtmlParser.prototype.autoCloseUnclosedBeforeNewOpening = function(new_tag)
+{
+  this._autoCloseUnclosed(new_tag, false);
+};
+
+WYMeditor.XhtmlParser.prototype.autoCloseUnclosedBeforeTagClosing = function(tag)
+{
+  this._autoCloseUnclosed(tag, true);
+};
+
+WYMeditor.XhtmlParser.prototype._autoCloseUnclosed = function(new_tag, closing)
+{
+  var closing = closing || false;
+  if(this._Listener._open_tags){
+    for (var tag in this._Listener._open_tags) {
+      var counter = this._Listener._open_tags[tag];
+      if(counter > 0 && this._Listener.shouldCloseTagAutomatically(tag, new_tag, closing)){
+        this._callCloseTagListener(tag, true);
+      }
+    }
+  }
+};
+
+WYMeditor.XhtmlParser.prototype.getTagReplacements = function()
+{
+  return this._Listener.getTagReplacements();
+};
+
+WYMeditor.XhtmlParser.prototype.normalizeTag = function(tag)
+{
+  tag = tag.replace(/^([\s<\/>]*)|([\s<\/>]*)$/gm,'').toLowerCase();
+  var tags = this._Listener.getTagReplacements();
+  if(tags[tag]){
+    return tags[tag];
+  }
+  return tag;
+};
+
+WYMeditor.XhtmlParser.prototype.TagAttributes = function(match, state)
+{
+  if(WYMeditor.LEXER_SPECIAL == state){
+    this._current_attribute = match;
+  }
+  return true;
+};
+
+WYMeditor.XhtmlParser.prototype.DoubleQuotedAttribute = function(match, state)
+{
+  if(WYMeditor.LEXER_UNMATCHED == state){
+    this._tag_attributes[this._current_attribute] = match;
+  }
+  return true;
+};
+
+WYMeditor.XhtmlParser.prototype.SingleQuotedAttribute = function(match, state)
+{
+  if(WYMeditor.LEXER_UNMATCHED == state){
+    this._tag_attributes[this._current_attribute] = match;
+  }
+  return true;
+};
+
+WYMeditor.XhtmlParser.prototype.UnquotedAttribute = function(match, state)
+{
+  this._tag_attributes[this._current_attribute] = match.replace(/^=/,'');
+  return true;
+};
+
+
+
+/**
+* XHTML Sax parser.
+*
+*    @author Bermi Ferrer (http://bermi.org)
+*/
+WYMeditor.XhtmlSaxListener = function()
+{
+  this.output = '';
+  this.helper = new WYMeditor.XmlHelper();
+  this._open_tags = {};
+  this.validator = WYMeditor.XhtmlValidator;
+  this._tag_stack = [];
+  this.avoided_tags = [];
+
+  this.entities = {
+    '&nbsp;':'&#160;','&iexcl;':'&#161;','&cent;':'&#162;',
+    '&pound;':'&#163;','&curren;':'&#164;','&yen;':'&#165;',
+    '&brvbar;':'&#166;','&sect;':'&#167;','&uml;':'&#168;',
+    '&copy;':'&#169;','&ordf;':'&#170;','&laquo;':'&#171;',
+    '&not;':'&#172;','&shy;':'&#173;','&reg;':'&#174;',
+    '&macr;':'&#175;','&deg;':'&#176;','&plusmn;':'&#177;',
+    '&sup2;':'&#178;','&sup3;':'&#179;','&acute;':'&#180;',
+    '&micro;':'&#181;','&para;':'&#182;','&middot;':'&#183;',
+    '&cedil;':'&#184;','&sup1;':'&#185;','&ordm;':'&#186;',
+    '&raquo;':'&#187;','&frac14;':'&#188;','&frac12;':'&#189;',
+    '&frac34;':'&#190;','&iquest;':'&#191;','&Agrave;':'&#192;',
+    '&Aacute;':'&#193;','&Acirc;':'&#194;','&Atilde;':'&#195;',
+    '&Auml;':'&#196;','&Aring;':'&#197;','&AElig;':'&#198;',
+    '&Ccedil;':'&#199;','&Egrave;':'&#200;','&Eacute;':'&#201;',
+    '&Ecirc;':'&#202;','&Euml;':'&#203;','&Igrave;':'&#204;',
+    '&Iacute;':'&#205;','&Icirc;':'&#206;','&Iuml;':'&#207;',
+    '&ETH;':'&#208;','&Ntilde;':'&#209;','&Ograve;':'&#210;',
+    '&Oacute;':'&#211;','&Ocirc;':'&#212;','&Otilde;':'&#213;',
+    '&Ouml;':'&#214;','&times;':'&#215;','&Oslash;':'&#216;',
+    '&Ugrave;':'&#217;','&Uacute;':'&#218;','&Ucirc;':'&#219;',
+    '&Uuml;':'&#220;','&Yacute;':'&#221;','&THORN;':'&#222;',
+    '&szlig;':'&#223;','&agrave;':'&#224;','&aacute;':'&#225;',
+    '&acirc;':'&#226;','&atilde;':'&#227;','&auml;':'&#228;',
+    '&aring;':'&#229;','&aelig;':'&#230;','&ccedil;':'&#231;',
+    '&egrave;':'&#232;','&eacute;':'&#233;','&ecirc;':'&#234;',
+    '&euml;':'&#235;','&igrave;':'&#236;','&iacute;':'&#237;',
+    '&icirc;':'&#238;','&iuml;':'&#239;','&eth;':'&#240;',
+    '&ntilde;':'&#241;','&ograve;':'&#242;','&oacute;':'&#243;',
+    '&ocirc;':'&#244;','&otilde;':'&#245;','&ouml;':'&#246;',
+    '&divide;':'&#247;','&oslash;':'&#248;','&ugrave;':'&#249;',
+    '&uacute;':'&#250;','&ucirc;':'&#251;','&uuml;':'&#252;',
+    '&yacute;':'&#253;','&thorn;':'&#254;','&yuml;':'&#255;',
+    '&OElig;':'&#338;','&oelig;':'&#339;','&Scaron;':'&#352;',
+    '&scaron;':'&#353;','&Yuml;':'&#376;','&fnof;':'&#402;',
+    '&circ;':'&#710;','&tilde;':'&#732;','&Alpha;':'&#913;',
+    '&Beta;':'&#914;','&Gamma;':'&#915;','&Delta;':'&#916;',
+    '&Epsilon;':'&#917;','&Zeta;':'&#918;','&Eta;':'&#919;',
+    '&Theta;':'&#920;','&Iota;':'&#921;','&Kappa;':'&#922;',
+    '&Lambda;':'&#923;','&Mu;':'&#924;','&Nu;':'&#925;',
+    '&Xi;':'&#926;','&Omicron;':'&#927;','&Pi;':'&#928;',
+    '&Rho;':'&#929;','&Sigma;':'&#931;','&Tau;':'&#932;',
+    '&Upsilon;':'&#933;','&Phi;':'&#934;','&Chi;':'&#935;',
+    '&Psi;':'&#936;','&Omega;':'&#937;','&alpha;':'&#945;',
+    '&beta;':'&#946;','&gamma;':'&#947;','&delta;':'&#948;',
+    '&epsilon;':'&#949;','&zeta;':'&#950;','&eta;':'&#951;',
+    '&theta;':'&#952;','&iota;':'&#953;','&kappa;':'&#954;',
+    '&lambda;':'&#955;','&mu;':'&#956;','&nu;':'&#957;',
+    '&xi;':'&#958;','&omicron;':'&#959;','&pi;':'&#960;',
+    '&rho;':'&#961;','&sigmaf;':'&#962;','&sigma;':'&#963;',
+    '&tau;':'&#964;','&upsilon;':'&#965;','&phi;':'&#966;',
+    '&chi;':'&#967;','&psi;':'&#968;','&omega;':'&#969;',
+    '&thetasym;':'&#977;','&upsih;':'&#978;','&piv;':'&#982;',
+    '&ensp;':'&#8194;','&emsp;':'&#8195;','&thinsp;':'&#8201;',
+    '&zwnj;':'&#8204;','&zwj;':'&#8205;','&lrm;':'&#8206;',
+    '&rlm;':'&#8207;','&ndash;':'&#8211;','&mdash;':'&#8212;',
+    '&lsquo;':'&#8216;','&rsquo;':'&#8217;','&sbquo;':'&#8218;',
+    '&ldquo;':'&#8220;','&rdquo;':'&#8221;','&bdquo;':'&#8222;',
+    '&dagger;':'&#8224;','&Dagger;':'&#8225;','&bull;':'&#8226;',
+    '&hellip;':'&#8230;','&permil;':'&#8240;','&prime;':'&#8242;',
+    '&Prime;':'&#8243;','&lsaquo;':'&#8249;','&rsaquo;':'&#8250;',
+    '&oline;':'&#8254;','&frasl;':'&#8260;','&euro;':'&#8364;',
+    '&image;':'&#8465;','&weierp;':'&#8472;','&real;':'&#8476;',
+    '&trade;':'&#8482;','&alefsym;':'&#8501;','&larr;':'&#8592;',
+    '&uarr;':'&#8593;','&rarr;':'&#8594;','&darr;':'&#8595;',
+    '&harr;':'&#8596;','&crarr;':'&#8629;','&lArr;':'&#8656;',
+    '&uArr;':'&#8657;','&rArr;':'&#8658;','&dArr;':'&#8659;',
+    '&hArr;':'&#8660;','&forall;':'&#8704;','&part;':'&#8706;',
+    '&exist;':'&#8707;','&empty;':'&#8709;','&nabla;':'&#8711;',
+    '&isin;':'&#8712;','&notin;':'&#8713;','&ni;':'&#8715;',
+    '&prod;':'&#8719;','&sum;':'&#8721;','&minus;':'&#8722;',
+    '&lowast;':'&#8727;','&radic;':'&#8730;','&prop;':'&#8733;',
+    '&infin;':'&#8734;','&ang;':'&#8736;','&and;':'&#8743;',
+    '&or;':'&#8744;','&cap;':'&#8745;','&cup;':'&#8746;',
+    '&int;':'&#8747;','&there4;':'&#8756;','&sim;':'&#8764;',
+    '&cong;':'&#8773;','&asymp;':'&#8776;','&ne;':'&#8800;',
+    '&equiv;':'&#8801;','&le;':'&#8804;','&ge;':'&#8805;',
+    '&sub;':'&#8834;','&sup;':'&#8835;','&nsub;':'&#8836;',
+    '&sube;':'&#8838;','&supe;':'&#8839;','&oplus;':'&#8853;',
+    '&otimes;':'&#8855;','&perp;':'&#8869;','&sdot;':'&#8901;',
+    '&lceil;':'&#8968;','&rceil;':'&#8969;','&lfloor;':'&#8970;',
+    '&rfloor;':'&#8971;','&lang;':'&#9001;','&rang;':'&#9002;',
+    '&loz;':'&#9674;','&spades;':'&#9824;','&clubs;':'&#9827;',
+    '&hearts;':'&#9829;','&diams;':'&#9830;'};
+
+    this.block_tags = ["a", "abbr", "acronym", "address", "area", "b",
+    "base", "bdo", "big", "blockquote", "body", "button",
+    "caption", "cite", "code", "col", "colgroup", "dd", "del", "div",
+    "dfn", "dl", "dt", "em", "fieldset", "form", "head", "h1", "h2",
+    "h3", "h4", "h5", "h6", "html", "i", "ins",
+    "kbd", "label", "legend", "li", "map", "noscript",
+    "object", "ol", "optgroup", "option", "p", "param", "pre", "q",
+    "samp", "script", "select", "small", "span", "strong", "style",
+    "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th",
+    "thead", "title", "tr", "tt", "ul", "var", "extends"];
+
+
+    this.inline_tags = ["br", "hr", "img", "input"];
+
+    return this;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.shouldCloseTagAutomatically = function(tag, now_on_tag, closing)
+{
+  var closing = closing || false;
+  if(tag == 'td'){
+    if((closing && now_on_tag == 'tr') || (!closing && now_on_tag == 'td')){
+      return true;
+    }
+  }
+  if(tag == 'option'){
+    if((closing && now_on_tag == 'select') || (!closing && now_on_tag == 'option')){
+      return true;
+    }
+  }
+  return false;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.beforeParsing = function(raw)
+{
+  this.output = '';
+  return raw;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.afterParsing = function(xhtml)
+{
+  xhtml = this.replaceNamedEntities(xhtml);
+  xhtml = this.joinRepeatedEntities(xhtml);
+  xhtml = this.removeEmptyTags(xhtml);
+  xhtml = this.removeBrInPre(xhtml);
+  return xhtml;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.replaceNamedEntities = function(xhtml)
+{
+  for (var entity in this.entities) {
+    xhtml = xhtml.replace(new RegExp(entity, 'g'), this.entities[entity]);
+  }
+  return xhtml;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.joinRepeatedEntities = function(xhtml)
+{
+  var tags = 'em|strong|sub|sup|acronym|pre|del|address';
+  return xhtml.replace(new RegExp('<\/('+tags+')><\\1>' ,''),'').
+  replace(new RegExp('(\s*<('+tags+')>\s*){2}(.*)(\s*<\/\\2>\s*){2}' ,''),'<\$2>\$3<\$2>');
+};
+
+WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags = function(xhtml)
+{
+  return xhtml.replace(new RegExp('<('+this.block_tags.join("|").replace(/\|td/,'').replace(/\|th/, '')+')>(<br \/>|&#160;|&nbsp;|\\s)*<\/\\1>' ,'g'),'');
+};
+
+WYMeditor.XhtmlSaxListener.prototype.removeBrInPre = function(xhtml)
+{
+  var matches = xhtml.match(new RegExp('<pre[^>]*>(.*?)<\/pre>','gmi'));
+  if(matches) {
+    for(var i=0; i<matches.length; i++) {
+      xhtml = xhtml.replace(matches[i], matches[i].replace(new RegExp('<br \/>', 'g'), String.fromCharCode(13,10)));
+    }
+  }
+  return xhtml;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.getResult = function()
+{
+  return this.output;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.getTagReplacements = function()
+{
+  return {'b':'strong', 'i':'em'};
+};
+
+WYMeditor.XhtmlSaxListener.prototype.addContent = function(text)
+{
+  this.output += text;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.addComment = function(text)
+{
+  if(this.remove_comments){
+    this.output += text;
+  }
+};
+
+WYMeditor.XhtmlSaxListener.prototype.addScript = function(text)
+{
+  if(!this.remove_scripts){
+    this.output += text;
+  }
+};
+
+WYMeditor.XhtmlSaxListener.prototype.addCss = function(text)
+{
+  if(!this.remove_embeded_styles){
+    this.output += text;
+  }
+};
+
+WYMeditor.XhtmlSaxListener.prototype.openBlockTag = function(tag, attributes)
+{
+  this.output += this.helper.tag(tag, this.validator.getValidTagAttributes(tag, attributes), true);
+};
+
+WYMeditor.XhtmlSaxListener.prototype.inlineTag = function(tag, attributes)
+{
+  this.output += this.helper.tag(tag, this.validator.getValidTagAttributes(tag, attributes));
+};
+
+WYMeditor.XhtmlSaxListener.prototype.openUnknownTag = function(tag, attributes)
+{
+  //this.output += this.helper.tag(tag, attributes, true);
+};
+
+WYMeditor.XhtmlSaxListener.prototype.closeBlockTag = function(tag)
+{
+  this.output = this.output.replace(/<br \/>$/, '')+this._getClosingTagContent('before', tag)+"</"+tag+">"+this._getClosingTagContent('after', tag);
+};
+
+WYMeditor.XhtmlSaxListener.prototype.closeUnknownTag = function(tag)
+{
+  //this.output += "</"+tag+">";
+};
+
+WYMeditor.XhtmlSaxListener.prototype.closeUnopenedTag = function(tag)
+{
+  this.output += "</"+tag+">";
+};
+
+WYMeditor.XhtmlSaxListener.prototype.avoidStylingTagsAndAttributes = function()
+{
+  this.avoided_tags = ['div','span'];
+  this.validator.skiped_attributes = ['style'];
+  this.validator.skiped_attribute_values = ['MsoNormal','main1']; // MS Word attributes for class
+  this._avoiding_tags_implicitly = true;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.allowStylingTagsAndAttributes = function()
+{
+  this.avoided_tags = [];
+  this.validator.skiped_attributes = [];
+  this.validator.skiped_attribute_values = [];
+  this._avoiding_tags_implicitly = false;
+};
+
+WYMeditor.XhtmlSaxListener.prototype.isBlockTag = function(tag)
+{
+  return !WYMeditor.Helper.contains(this.avoided_tags, tag) && WYMeditor.Helper.contains(this.block_tags, tag);
+};
+
+WYMeditor.XhtmlSaxListener.prototype.isInlineTag = function(tag)
+{
+  return !WYMeditor.Helper.contains(this.avoided_tags, tag) && WYMeditor.Helper.contains(this.inline_tags, tag);
+};
+
+WYMeditor.XhtmlSaxListener.prototype.insertContentAfterClosingTag = function(tag, content)
+{
+  this._insertContentWhenClosingTag('after', tag, content);
+};
+
+WYMeditor.XhtmlSaxListener.prototype.insertContentBeforeClosingTag = function(tag, content)
+{
+  this._insertContentWhenClosingTag('before', tag, content);
+};
+
+WYMeditor.XhtmlSaxListener.prototype.fixNestingBeforeOpeningBlockTag = function(tag, attributes)
+{
+    if(tag != 'li' && (tag == 'ul' || tag == 'ol') && this.last_tag && !this.last_tag_opened && this.last_tag == 'li'){
+      this.output = this.output.replace(/<\/li>$/, '');
+      this.insertContentAfterClosingTag(tag, '</li>');
+    }
+};
+
+WYMeditor.XhtmlSaxListener.prototype._insertContentWhenClosingTag = function(position, tag, content)
+{
+  if(!this['_insert_'+position+'_closing']){
+    this['_insert_'+position+'_closing'] = [];
+  }
+  if(!this['_insert_'+position+'_closing'][tag]){
+    this['_insert_'+position+'_closing'][tag] = [];
+  }
+  this['_insert_'+position+'_closing'][tag].push(content);
+};
+
+WYMeditor.XhtmlSaxListener.prototype._getClosingTagContent = function(position, tag)
+{
+  if( this['_insert_'+position+'_closing'] &&
+      this['_insert_'+position+'_closing'][tag] &&
+      this['_insert_'+position+'_closing'][tag].length > 0){
+        return this['_insert_'+position+'_closing'][tag].pop();
+  }
+  return '';
+};
+
+
+/********** CSS PARSER **********/
+
+
+WYMeditor.WymCssLexer = function(parser, only_wym_blocks)
+{
+  var only_wym_blocks = (typeof only_wym_blocks == 'undefined' ? true : only_wym_blocks);
+
+  jQuery.extend(this, new WYMeditor.Lexer(parser, (only_wym_blocks?'Ignore':'WymCss')));
+
+  this.mapHandler('WymCss', 'Ignore');
+
+  if(only_wym_blocks == true){
+    this.addEntryPattern("/\\\x2a[<\\s]*WYMeditor[>\\s]*\\\x2a/", 'Ignore', 'WymCss');
+    this.addExitPattern("/\\\x2a[<\/\\s]*WYMeditor[>\\s]*\\\x2a/", 'WymCss');
+  }
+
+  this.addSpecialPattern("[\\sa-z1-6]*\\\x2e[a-z-_0-9]+", 'WymCss', 'WymCssStyleDeclaration');
+
+  this.addEntryPattern("/\\\x2a", 'WymCss', 'WymCssComment');
+  this.addExitPattern("\\\x2a/", 'WymCssComment');
+
+  this.addEntryPattern("\x7b", 'WymCss', 'WymCssStyle');
+  this.addExitPattern("\x7d", 'WymCssStyle');
+
+  this.addEntryPattern("/\\\x2a", 'WymCssStyle', 'WymCssFeedbackStyle');
+  this.addExitPattern("\\\x2a/", 'WymCssFeedbackStyle');
+
+  return this;
+};
+
+WYMeditor.WymCssParser = function()
+{
+  this._in_style = false;
+  this._has_title = false;
+  this.only_wym_blocks = true;
+  this.css_settings = {'classesItems':[], 'editorStyles':[], 'dialogStyles':[]};
+  return this;
+};
+
+WYMeditor.WymCssParser.prototype.parse = function(raw, only_wym_blocks)
+{
+  var only_wym_blocks = (typeof only_wym_blocks == 'undefined' ? this.only_wym_blocks : only_wym_blocks);
+  this._Lexer = new WYMeditor.WymCssLexer(this, only_wym_blocks);
+  this._Lexer.parse(raw);
+};
+
+WYMeditor.WymCssParser.prototype.Ignore = function(match, state)
+{
+  return true;
+};
+
+WYMeditor.WymCssParser.prototype.WymCssComment = function(text, status)
+{
+  if(text.match(/end[a-z0-9\s]*wym[a-z0-9\s]*/mi)){
+    return false;
+  }
+  if(status == WYMeditor.LEXER_UNMATCHED){
+    if(!this._in_style){
+      this._has_title = true;
+      this._current_item = {'title':WYMeditor.Helper.trim(text)};
+    }else{
+      if(this._current_item[this._current_element]){
+        if(!this._current_item[this._current_element].expressions){
+          this._current_item[this._current_element].expressions = [text];
+        }else{
+          this._current_item[this._current_element].expressions.push(text);
+        }
+      }
+    }
+    this._in_style = true;
+  }
+  return true;
+};
+
+WYMeditor.WymCssParser.prototype.WymCssStyle = function(match, status)
+{
+  if(status == WYMeditor.LEXER_UNMATCHED){
+    match = WYMeditor.Helper.trim(match);
+    if(match != ''){
+      this._current_item[this._current_element].style = match;
+    }
+  }else if (status == WYMeditor.LEXER_EXIT){
+    this._in_style = false;
+    this._has_title = false;
+    this.addStyleSetting(this._current_item);
+  }
+  return true;
+};
+
+WYMeditor.WymCssParser.prototype.WymCssFeedbackStyle = function(match, status)
+{
+  if(status == WYMeditor.LEXER_UNMATCHED){
+    this._current_item[this._current_element].feedback_style = match.replace(/^([\s\/\*]*)|([\s\/\*]*)$/gm,'');
+  }
+  return true;
+};
+
+WYMeditor.WymCssParser.prototype.WymCssStyleDeclaration = function(match)
+{
+  match = match.replace(/^([\s\.]*)|([\s\.*]*)$/gm, '');
+
+  var tag = '';
+  if(match.indexOf('.') > 0){
+    var parts = match.split('.');
+    this._current_element = parts[1];
+    var tag = parts[0];
+  }else{
+    this._current_element = match;
+  }
+
+  if(!this._has_title){
+    this._current_item = {'title':(!tag?'':tag.toUpperCase()+': ')+this._current_element};
+    this._has_title = true;
+  }
+
+  if(!this._current_item[this._current_element]){
+    this._current_item[this._current_element] = {'name':this._current_element};
+  }
+  if(tag){
+    if(!this._current_item[this._current_element].tags){
+      this._current_item[this._current_element].tags = [tag];
+    }else{
+      this._current_item[this._current_element].tags.push(tag);
+    }
+  }
+  return true;
+};
+
+WYMeditor.WymCssParser.prototype.addStyleSetting = function(style_details)
+{
+  for (var name in style_details){
+    var details = style_details[name];
+    if(typeof details == 'object' && name != 'title'){
+
+      this.css_settings.classesItems.push({
+        'name': WYMeditor.Helper.trim(details.name),
+        'title': style_details.title,
+        'expr' : WYMeditor.Helper.trim((details.expressions||details.tags).join(', '))
+      });
+      if(details.feedback_style){
+        this.css_settings.editorStyles.push({
+          'name': '.'+ WYMeditor.Helper.trim(details.name),
+          'css': details.feedback_style
+        });
+      }
+      if(details.style){
+        this.css_settings.dialogStyles.push({
+          'name': '.'+ WYMeditor.Helper.trim(details.name),
+          'css': details.style
+        });
+      }
+    }
+  }
+};
+
+/********** HELPERS **********/
+
+// Returns true if it is a text node with whitespaces only
+jQuery.fn.isPhantomNode = function() {
+  if (this[0].nodeType == 3)
+    return !(/[^\t\n\r ]/.test(this[0].data));
+
+  return false;
+};
+
+WYMeditor.isPhantomNode = function(n) {
+  if (n.nodeType == 3)
+    return !(/[^\t\n\r ]/.test(n.data));
+
+  return false;
+};
+
+WYMeditor.isPhantomString = function(str) {
+    return !(/[^\t\n\r ]/.test(str));
+};
+
+// Returns the Parents or the node itself
+// jqexpr = a jQuery expression
+jQuery.fn.parentsOrSelf = function(jqexpr) {
+  var n = this;
+
+  if (n[0].nodeType == 3)
+    n = n.parents().slice(0,1);
+
+//  if (n.is(jqexpr)) // XXX should work, but doesn't (probably a jQuery bug)
+  if (n.filter(jqexpr).size() == 1)
+    return n;
+  else
+    return n.parents(jqexpr).slice(0,1);
+};
+
+// String & array helpers
+
+WYMeditor.Helper = {
+
+    //replace all instances of 'old' by 'rep' in 'str' string
+    replaceAll: function(str, old, rep) {
+        var rExp = new RegExp(old, "g");
+        return(str.replace(rExp, rep));
+    },
+
+    //insert 'inserted' at position 'pos' in 'str' string
+    insertAt: function(str, inserted, pos) {
+        return(str.substr(0,pos) + inserted + str.substring(pos));
+    },
+
+    //trim 'str' string
+    trim: function(str) {
+        return str.replace(/^(\s*)|(\s*)$/gm,'');
+    },
+
+    //return true if 'arr' array contains 'elem', or false
+    contains: function(arr, elem) {
+        for (var i = 0; i < arr.length; i++) {
+            if (arr[i] === elem) return true;
+        }
+        return false;
+    },
+
+    //return 'item' position in 'arr' array, or -1
+    indexOf: function(arr, item) {
+        var ret=-1;
+        for(var i = 0; i < arr.length; i++) {
+            if (arr[i] == item) {
+                ret = i;
+                break;
+            }
+        }
+           return(ret);
+    },
+
+    //return 'item' object in 'arr' array, checking its 'name' property, or null
+    findByName: function(arr, name) {
+        for(var i = 0; i < arr.length; i++) {
+            var item = arr[i];
+            if(item.name == name) return(item);
+        }
+        return(null);
+    }
+};
+
+
+/*
+ * WYMeditor : what you see is What You Mean web-based editor
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
+ * Dual licensed under the MIT (MIT-license.txt)
+ * and GPL (GPL-license.txt) licenses.
+ *
+ * For further information visit:
+ *        http://www.wymeditor.org/
+ *
+ * File Name:
+ *        jquery.wymeditor.explorer.js
+ *        MSIE specific class and functions.
+ *        See the documentation for more info.
+ *
+ * File Authors:
+ *        Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
+ *        Bermi Ferrer (wymeditor a-t bermi dotorg)
+ *        Frédéric Palluel-Lafleur (fpalluel a-t gmail dotcom)
+ *        Jonatan Lundin (jonatan.lundin _at_ gmail.com)
+ */
+
+WYMeditor.WymClassExplorer = function(wym) {
+
+    this._wym = wym;
+    this._class = "className";
+    this._newLine = "\r\n";
+
+};
+
+WYMeditor.WymClassExplorer.prototype.initIframe = function(iframe) {
+
+    //This function is executed twice, though it is called once!
+    //But MSIE needs that, otherwise designMode won't work.
+    //Weird.
+    
+    this._iframe = iframe;
+    this._doc = iframe.contentWindow.document;
+    
+    //add css rules from options
+    var styles = this._doc.styleSheets[0];
+    var aCss = eval(this._options.editorStyles);
+
+    this.addCssRules(this._doc, aCss);
+
+    this._doc.title = this._wym._index;
+
+    //set the text direction
+    jQuery('html', this._doc).attr('dir', this._options.direction);
+    
+    //init html value
+    jQuery(this._doc.body).html(this._wym._html);
+    
+    //handle events
+    var wym = this;
+    
+    this._doc.body.onfocus = function()
+      {wym._doc.designMode = "on"; wym._doc = iframe.contentWindow.document;};
+    this._doc.onbeforedeactivate = function() {wym.saveCaret();};
+    this._doc.onkeyup = function() {
+      wym.saveCaret();
+      wym.keyup();
+    };
+    this._doc.onclick = function() {wym.saveCaret();};
+    
+    this._doc.body.onbeforepaste = function() {
+      wym._iframe.contentWindow.event.returnValue = false;
+    };
+    
+    this._doc.body.onpaste = function() {
+      wym._iframe.contentWindow.event.returnValue = false;
+      wym.paste(window.clipboardData.getData("Text"));
+    };
+    
+    //callback can't be executed twice, so we check
+    if(this._initialized) {
+      
+      //pre-bind functions
+      if(jQuery.isFunction(this._options.preBind)) this._options.preBind(this);
+      
+      //bind external events
+      this._wym.bindEvents();
+      
+      //post-init functions
+      if(jQuery.isFunction(this._options.postInit)) this._options.postInit(this);
+      
+      //add event listeners to doc elements, e.g. images
+      this.listen();
+    }
+    
+    this._initialized = true;
+    
+    //init designMode
+    this._doc.designMode="on";
+    try{
+        // (bermi's note) noticed when running unit tests on IE6
+        // Is this really needed, it trigger an unexisting property on IE6
+        this._doc = iframe.contentWindow.document; 
+    }catch(e){}
+};
+
+WYMeditor.WymClassExplorer.prototype._exec = function(cmd,param) {
+
+    switch(cmd) {
+    
+    case WYMeditor.INDENT: case WYMeditor.OUTDENT:
+    
+        var container = this.findUp(this.container(), WYMeditor.LI);
+        if(container) {
+            var ancestor = container.parentNode.parentNode;
+            if(container.parentNode.childNodes.length>1
+              || ancestor.tagName.toLowerCase() == WYMeditor.OL
+              || ancestor.tagName.toLowerCase() == WYMeditor.UL)
+              this._doc.execCommand(cmd);
+        }
+    break;
+    default:
+        if(param) this._doc.execCommand(cmd,false,param);
+        else this._doc.execCommand(cmd);
+    break;
+       }
+    
+    this.listen();
+};
+
+WYMeditor.WymClassExplorer.prototype.selected = function() {
+
+    var caretPos = this._iframe.contentWindow.document.caretPos;
+        if(caretPos!=null) {
+            if(caretPos.parentElement!=undefined)
+              return(caretPos.parentElement());
+        }
+};
+
+WYMeditor.WymClassExplorer.prototype.saveCaret = function() {
+
+    this._doc.caretPos = this._doc.selection.createRange();
+};
+
+WYMeditor.WymClassExplorer.prototype.addCssRule = function(styles, oCss) {
+
+    styles.addRule(oCss.name, oCss.css);
+};
+
+WYMeditor.WymClassExplorer.prototype.insert = function(html) {
+
+    // Get the current selection
+    var range = this._doc.selection.createRange();
+
+    // Check if the current selection is inside the editor
+    if ( jQuery(range.parentElement()).parents( this._options.iframeBodySelector ).is('*') ) {
+        try {
+            // Overwrite selection with provided html
+            range.pasteHTML(html);
+        } catch (e) { }
+    } else {
+        // Fall back to the internal paste function if there's no selection
+        this.paste(html);
+    }
+};
+
+WYMeditor.WymClassExplorer.prototype.wrap = function(left, right) {
+
+    // Get the current selection
+    var range = this._doc.selection.createRange();
+
+    // Check if the current selection is inside the editor
+    if ( jQuery(range.parentElement()).parents( this._options.iframeBodySelector ).is('*') ) {
+        try {
+            // Overwrite selection with provided html
+            range.pasteHTML(left + range.text + right);
+        } catch (e) { }
+    }
+};
+
+WYMeditor.WymClassExplorer.prototype.unwrap = function() {
+
+    // Get the current selection
+    var range = this._doc.selection.createRange();
+
+    // Check if the current selection is inside the editor
+    if ( jQuery(range.parentElement()).parents( this._options.iframeBodySelector ).is('*') ) {
+        try {
+            // Unwrap selection
+            var text = range.text;
+            this._exec( 'Cut' );
+            range.pasteHTML( text );
+        } catch (e) { }
+    }
+};
+
+//keyup handler
+WYMeditor.WymClassExplorer.prototype.keyup = function() {
+  this._selected_image = null;
+};
+
+WYMeditor.WymClassExplorer.prototype.setFocusToNode = function(node) {
+    var range = this._doc.selection.createRange();
+    range.moveToElementText(node);
+    range.collapse(false);
+    range.move('character',-1);
+    range.select();
+    node.focus();
+};
+
+/*
+ * WYMeditor : what you see is What You Mean web-based editor
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
+ * Dual licensed under the MIT (MIT-license.txt)
+ * and GPL (GPL-license.txt) licenses.
+ *
+ * For further information visit:
+ *        http://www.wymeditor.org/
+ *
+ * File Name:
+ *        jquery.wymeditor.mozilla.js
+ *        Gecko specific class and functions.
+ *        See the documentation for more info.
+ *
+ * File Authors:
+ *        Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
+ *        Volker Mische (vmx a-t gmx dotde)
+ *        Bermi Ferrer (wymeditor a-t bermi dotorg)
+ *        Frédéric Palluel-Lafleur (fpalluel a-t gmail dotcom)
+ */
+
+WYMeditor.WymClassMozilla = function(wym) {
+
+    this._wym = wym;
+    this._class = "class";
+    this._newLine = "\n";
+};
+
+WYMeditor.WymClassMozilla.prototype.initIframe = function(iframe) {
+
+    this._iframe = iframe;
+    this._doc = iframe.contentDocument;
+    
+    //add css rules from options
+    
+    var styles = this._doc.styleSheets[0];    
+    var aCss = eval(this._options.editorStyles);
+    
+    this.addCssRules(this._doc, aCss);
+
+    this._doc.title = this._wym._index;
+
+    //set the text direction
+    jQuery('html', this._doc).attr('dir', this._options.direction);
+    
+    //init html value
+    this.html(this._wym._html);
+    
+    //init designMode
+    this.enableDesignMode();
+    
+    //pre-bind functions
+    if(jQuery.isFunction(this._options.preBind)) this._options.preBind(this);
+    
+    //bind external events
+    this._wym.bindEvents();
+    
+    //bind editor keydown events
+    jQuery(this._doc).bind("keydown", this.keydown);
+    
+    //bind editor keyup events
+    jQuery(this._doc).bind("keyup", this.keyup);
+    
+    //bind editor focus events (used to reset designmode - Gecko bug)
+    jQuery(this._doc).bind("focus", this.enableDesignMode);
+    
+    //post-init functions
+    if(jQuery.isFunction(this._options.postInit)) this._options.postInit(this);
+    
+    //add event listeners to doc elements, e.g. images
+    this.listen();
+};
+
+/* @name html
+ * @description Get/Set the html value
+ */
+WYMeditor.WymClassMozilla.prototype.html = function(html) {
+
+  if(typeof html === 'string') {
+  
+    //disable designMode
+    try { this._doc.designMode = "off"; } catch(e) { };
+    
+    //replace em by i and strong by bold
+    //(designMode issue)
+    html = html.replace(/<em(\b[^>]*)>/gi, "<i$1>")
+      .replace(/<\/em>/gi, "</i>")
+      .replace(/<strong(\b[^>]*)>/gi, "<b$1>")
+      .replace(/<\/strong>/gi, "</b>");
+
+    //update the html body
+    jQuery(this._doc.body).html(html);
+    
+    //re-init designMode
+    this.enableDesignMode();
+  }
+  else return(jQuery(this._doc.body).html());
+};
+
+WYMeditor.WymClassMozilla.prototype._exec = function(cmd,param) {
+
+    if(!this.selected()) return(false);
+
+    switch(cmd) {
+    
+    case WYMeditor.INDENT: case WYMeditor.OUTDENT:
+    
+        var focusNode = this.selected();    
+        var sel = this._iframe.contentWindow.getSelection();
+        var anchorNode = sel.anchorNode;
+        if(anchorNode.nodeName == "#text") anchorNode = anchorNode.parentNode;
+        
+        focusNode = this.findUp(focusNode, WYMeditor.BLOCKS);
+        anchorNode = this.findUp(anchorNode, WYMeditor.BLOCKS);
+        
+        if(focusNode && focusNode == anchorNode
+          && focusNode.tagName.toLowerCase() == WYMeditor.LI) {
+
+            var ancestor = focusNode.parentNode.parentNode;
+
+            if(focusNode.parentNode.childNodes.length>1
+              || ancestor.tagName.toLowerCase() == WYMeditor.OL
+              || ancestor.tagName.toLowerCase() == WYMeditor.UL)
+                this._doc.execCommand(cmd,'',null);
+        }
+
+    break;
+    
+    default:
+
+        if(param) this._doc.execCommand(cmd,'',param);
+        else this._doc.execCommand(cmd,'',null);
+    }
+    
+    //set to P if parent = BODY
+    var container = this.selected();
+    if(container.tagName.toLowerCase() == WYMeditor.BODY)
+        this._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P);
+    
+    //add event handlers on doc elements
+
+    this.listen();
+};
+
+/* @name selected
+ * @description Returns the selected container
+ */
+WYMeditor.WymClassMozilla.prototype.selected = function() {
+
+    var sel = this._iframe.contentWindow.getSelection();
+    var node = sel.focusNode;
+    if(node) {
+        if(node.nodeName == "#text") return(node.parentNode);
+        else return(node);
+    } else return(null);
+};
+
+WYMeditor.WymClassMozilla.prototype.addCssRule = function(styles, oCss) {
+
+    styles.insertRule(oCss.name + " {" + oCss.css + "}",
+        styles.cssRules.length);
+};
+
+
+//keydown handler, mainly used for keyboard shortcuts
+WYMeditor.WymClassMozilla.prototype.keydown = function(evt) {
+  
+  //'this' is the doc
+  var wym = WYMeditor.INSTANCES[this.title];
+  var container = null;  
+
+  if(evt.ctrlKey){
+    if(evt.keyCode == 66){
+      //CTRL+b => STRONG
+      wym._exec(WYMeditor.BOLD);
+      return false;
+    }
+    if(evt.keyCode == 73){
+      //CTRL+i => EMPHASIS
+      wym._exec(WYMeditor.ITALIC);
+      return false;
+    }
+  }
+
+  else if(evt.keyCode == 13) {
+    if(!evt.shiftKey){
+      //fix PRE bug #73
+      container = wym.selected();
+      if(container && container.tagName.toLowerCase() == WYMeditor.PRE) {
+        evt.preventDefault();
+        wym.insert('<p></p>');
+      }
+    }
+  }
+};
+
+//keyup handler, mainly used for cleanups
+WYMeditor.WymClassMozilla.prototype.keyup = function(evt) {
+
+  //'this' is the doc
+  var wym = WYMeditor.INSTANCES[this.title];
+  
+  wym._selected_image = null;
+  var container = null;
+
+  if(evt.keyCode == 13 && !evt.shiftKey) {
+  
+    //RETURN key
+    //cleanup <br><br> between paragraphs
+    jQuery(wym._doc.body).children(WYMeditor.BR).remove();
+  }
+  
+  else if(evt.keyCode != 8
+       && evt.keyCode != 17
+       && evt.keyCode != 46
+       && evt.keyCode != 224
+       && !evt.metaKey
+       && !evt.ctrlKey) {
+      
+    //NOT BACKSPACE, NOT DELETE, NOT CTRL, NOT COMMAND
+    //text nodes replaced by P
+    
+    container = wym.selected();
+    var name = container.tagName.toLowerCase();
+
+    //fix forbidden main containers
+    if(
+      name == "strong" ||
+      name == "b" ||
+      name == "em" ||
+      name == "i" ||
+      name == "sub" ||
+      name == "sup" ||
+      name == "a"
+
+    ) name = container.parentNode.tagName.toLowerCase();
+
+    if(name == WYMeditor.BODY) wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P);
+  }
+};
+
+WYMeditor.WymClassMozilla.prototype.enableDesignMode = function() {
+    if(this.designMode == "off") {
+      try {
+        this.designMode = "on";
+        this.execCommand("styleWithCSS", '', false);
+      } catch(e) { }
+    }
+};
+
+WYMeditor.WymClassMozilla.prototype.setFocusToNode = function(node) {
+    var range = document.createRange();
+    range.selectNode(node);
+    var selected = this._iframe.contentWindow.getSelection();
+    selected.addRange(range);
+    selected.collapse(node, node.childNodes.length);
+    this._iframe.contentWindow.focus();
+};
+
+WYMeditor.WymClassMozilla.prototype.openBlockTag = function(tag, attributes)
+{
+  var attributes = this.validator.getValidTagAttributes(tag, attributes);
+
+  // Handle Mozilla styled spans
+  if(tag == 'span' && attributes.style){
+    var new_tag = this.getTagForStyle(attributes.style);
+    if(new_tag){
+      this._tag_stack.pop();
+      var tag = new_tag;
+      this._tag_stack.push(new_tag);
+      attributes.style = '';
+    }else{
+      return;
+    }
+  }
+  
+  this.output += this.helper.tag(tag, attributes, true);
+};
+
+WYMeditor.WymClassMozilla.prototype.getTagForStyle = function(style) {
+
+  if(/bold/.test(style)) return 'strong';
+  if(/italic/.test(style)) return 'em';
+  if(/sub/.test(style)) return 'sub';
+  if(/sub/.test(style)) return 'super';
+  return false;
+};
+
+/*
+ * WYMeditor : what you see is What You Mean web-based editor
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
+ * Dual licensed under the MIT (MIT-license.txt)
+ * and GPL (GPL-license.txt) licenses.
+ *
+ * For further information visit:
+ *        http://www.wymeditor.org/
+ *
+ * File Name:
+ *        jquery.wymeditor.opera.js
+ *        Opera specific class and functions.
+ *        See the documentation for more info.
+ *
+ * File Authors:
+ *        Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
+ */
+
+WYMeditor.WymClassOpera = function(wym) {
+
+    this._wym = wym;
+    this._class = "class";
+    this._newLine = "\r\n";
+};
+
+WYMeditor.WymClassOpera.prototype.initIframe = function(iframe) {
+
+    this._iframe = iframe;
+    this._doc = iframe.contentWindow.document;
+    
+    //add css rules from options
+    var styles = this._doc.styleSheets[0];    
+    var aCss = eval(this._options.editorStyles);
+
+    this.addCssRules(this._doc, aCss);
+
+    this._doc.title = this._wym._index;
+
+    //set the text direction
+    jQuery('html', this._doc).attr('dir', this._options.direction);
+    
+    //init designMode
+    this._doc.designMode = "on";
+
+    //init html value
+    this.html(this._wym._html);
+    
+    //pre-bind functions
+    if(jQuery.isFunction(this._options.preBind)) this._options.preBind(this);
+    
+    //bind external events
+    this._wym.bindEvents();
+    
+    //bind editor keydown events
+    jQuery(this._doc).bind("keydown", this.keydown);
+    
+    //bind editor events
+    jQuery(this._doc).bind("keyup", this.keyup);
+    
+    //post-init functions
+    if(jQuery.isFunction(this._options.postInit)) this._options.postInit(this);
+    
+    //add event listeners to doc elements, e.g. images
+    this.listen();
+};
+
+WYMeditor.WymClassOpera.prototype._exec = function(cmd,param) {
+
+    if(param) this._doc.execCommand(cmd,false,param);
+    else this._doc.execCommand(cmd);
+    
+    this.listen();
+};
+
+WYMeditor.WymClassOpera.prototype.selected = function() {
+
+    var sel=this._iframe.contentWindow.getSelection();
+    var node=sel.focusNode;
+    if(node) {
+        if(node.nodeName=="#text")return(node.parentNode);
+        else return(node);
+    } else return(null);
+};
+
+WYMeditor.WymClassOpera.prototype.addCssRule = function(styles, oCss) {
+
+    styles.insertRule(oCss.name + " {" + oCss.css + "}",
+        styles.cssRules.length);
+};
+
+//keydown handler
+WYMeditor.WymClassOpera.prototype.keydown = function(evt) {
+  
+  //'this' is the doc
+  var wym = WYMeditor.INSTANCES[this.title];
+  var sel = wym._iframe.contentWindow.getSelection();
+  startNode = sel.getRangeAt(0).startContainer;
+
+  //Get a P instead of no container
+  if(!jQuery(startNode).parentsOrSelf(
+                WYMeditor.MAIN_CONTAINERS.join(","))[0]
+      && !jQuery(startNode).parentsOrSelf('li')
+      && evt.keyCode != WYMeditor.KEY.ENTER
+      && evt.keyCode != WYMeditor.KEY.LEFT
+      && evt.keyCode != WYMeditor.KEY.UP
+      && evt.keyCode != WYMeditor.KEY.RIGHT
+      && evt.keyCode != WYMeditor.KEY.DOWN
+      && evt.keyCode != WYMeditor.KEY.BACKSPACE
+      && evt.keyCode != WYMeditor.KEY.DELETE)
+      wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P);
+
+};
+
+//keyup handler
+WYMeditor.WymClassOpera.prototype.keyup = function(evt) {
+
+  //'this' is the doc
+  var wym = WYMeditor.INSTANCES[this.title];
+  wym._selected_image = null;
+};
+
+// TODO: implement me
+WYMeditor.WymClassOpera.prototype.setFocusToNode = function(node) {
+
+};
+
+/*
+ * WYMeditor : what you see is What You Mean web-based editor
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
+ * Dual licensed under the MIT (MIT-license.txt)
+ * and GPL (GPL-license.txt) licenses.
+ *
+ * For further information visit:
+ *        http://www.wymeditor.org/
+ *
+ * File Name:
+ *        jquery.wymeditor.safari.js
+ *        Safari specific class and functions.
+ *        See the documentation for more info.
+ *
+ * File Authors:
+ *        Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
+ *        Scott Lewis (lewiscot a-t gmail dotcom)
+ */
+
+WYMeditor.WymClassSafari = function(wym) {
+
+    this._wym = wym;
+    this._class = "class";
+    this._newLine = "\n";
+};
+
+WYMeditor.WymClassSafari.prototype.initIframe = function(iframe) {
+
+    this._iframe = iframe;
+    this._doc = iframe.contentDocument;
+    
+    //add css rules from options
+    
+    var styles = this._doc.styleSheets[0];    
+    var aCss = eval(this._options.editorStyles);
+    
+    this.addCssRules(this._doc, aCss);
+
+    this._doc.title = this._wym._index;
+
+    //set the text direction
+    jQuery('html', this._doc).attr('dir', this._options.direction);
+
+    //init designMode
+    this._doc.designMode = "on";
+    
+    //init html value
+    this.html(this._wym._html);
+    
+    //pre-bind functions
+    if(jQuery.isFunction(this._options.preBind)) this._options.preBind(this);
+    
+    //bind external events
+    this._wym.bindEvents();
+    
+    //bind editor keydown events
+    jQuery(this._doc).bind("keydown", this.keydown);
+    
+    //bind editor keyup events
+    jQuery(this._doc).bind("keyup", this.keyup);
+    
+    //post-init functions
+    if(jQuery.isFunction(this._options.postInit)) this._options.postInit(this);
+    
+    //add event listeners to doc elements, e.g. images
+    this.listen();
+};
+
+WYMeditor.WymClassSafari.prototype._exec = function(cmd,param) {
+
+    if(!this.selected()) return(false);
+
+    switch(cmd) {
+    
+    case WYMeditor.INDENT: case WYMeditor.OUTDENT:
+    
+        var focusNode = this.selected();    
+        var sel = this._iframe.contentWindow.getSelection();
+        var anchorNode = sel.anchorNode;
+        if(anchorNode.nodeName == "#text") anchorNode = anchorNode.parentNode;
+        
+        focusNode = this.findUp(focusNode, WYMeditor.BLOCKS);
+        anchorNode = this.findUp(anchorNode, WYMeditor.BLOCKS);
+        
+        if(focusNode && focusNode == anchorNode
+          && focusNode.tagName.toLowerCase() == WYMeditor.LI) {
+
+            var ancestor = focusNode.parentNode.parentNode;
+
+            if(focusNode.parentNode.childNodes.length>1
+              || ancestor.tagName.toLowerCase() == WYMeditor.OL
+              || ancestor.tagName.toLowerCase() == WYMeditor.UL)
+                this._doc.execCommand(cmd,'',null);
+        }
+
+    break;
+
+    case WYMeditor.INSERT_ORDEREDLIST: case WYMeditor.INSERT_UNORDEREDLIST:
+
+        this._doc.execCommand(cmd,'',null);
+
+        //Safari creates lists in e.g. paragraphs.
+        //Find the container, and remove it.
+        var focusNode = this.selected();
+        var container = this.findUp(focusNode, WYMeditor.MAIN_CONTAINERS);
+        if(container) jQuery(container).replaceWith(jQuery(container).html());
+
+    break;
+    
+    default:
+
+        if(param) this._doc.execCommand(cmd,'',param);
+        else this._doc.execCommand(cmd,'',null);
+    }
+    
+    //set to P if parent = BODY
+    var container = this.selected();
+    if(container && container.tagName.toLowerCase() == WYMeditor.BODY)
+        this._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P);
+
+    //add event handlers on doc elements
+    this.listen();
+};
+
+/* @name selected
+ * @description Returns the selected container
+ */
+WYMeditor.WymClassSafari.prototype.selected = function() {
+
+    var sel = this._iframe.contentWindow.getSelection();
+    var node = sel.focusNode;
+    if(node) {
+        if(node.nodeName == "#text") return(node.parentNode);
+        else return(node);
+    } else return(null);
+};
+
+WYMeditor.WymClassSafari.prototype.addCssRule = function(styles, oCss) {
+
+    styles.insertRule(oCss.name + " {" + oCss.css + "}",
+        styles.cssRules.length);
+};
+
+
+//keydown handler, mainly used for keyboard shortcuts
+WYMeditor.WymClassSafari.prototype.keydown = function(evt) {
+  
+  //'this' is the doc
+  var wym = WYMeditor.INSTANCES[this.title];
+  
+  if(evt.ctrlKey){
+    if(evt.keyCode == 66){
+      //CTRL+b => STRONG
+      wym._exec(WYMeditor.BOLD);
+      return false;
+    }
+    if(evt.keyCode == 73){
+      //CTRL+i => EMPHASIS
+      wym._exec(WYMeditor.ITALIC);
+      return false;
+    }
+  }
+};
+
+//keyup handler, mainly used for cleanups
+WYMeditor.WymClassSafari.prototype.keyup = function(evt) {
+
+  //'this' is the doc
+  var wym = WYMeditor.INSTANCES[this.title];
+  
+  wym._selected_image = null;
+  var container = null;
+
+  if(evt.keyCode == 13 && !evt.shiftKey) {
+  
+    //RETURN key
+    //cleanup <br><br> between paragraphs
+    jQuery(wym._doc.body).children(WYMeditor.BR).remove();
+    
+    //fix PRE bug #73
+    container = wym.selected();
+    if(container && container.tagName.toLowerCase() == WYMeditor.PRE)
+        wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P); //create P after PRE
+  }
+
+  //fix #112
+  if(evt.keyCode == 13 && evt.shiftKey) {
+    wym._exec('InsertLineBreak');
+  }
+  
+  if(evt.keyCode != 8
+       && evt.keyCode != 17
+       && evt.keyCode != 46
+       && evt.keyCode != 224
+       && !evt.metaKey
+       && !evt.ctrlKey) {
+      
+    //NOT BACKSPACE, NOT DELETE, NOT CTRL, NOT COMMAND
+    //text nodes replaced by P
+    
+    container = wym.selected();
+    var name = container.tagName.toLowerCase();
+
+    //fix forbidden main containers
+    if(
+      name == "strong" ||
+      name == "b" ||
+      name == "em" ||
+      name == "i" ||
+      name == "sub" ||
+      name == "sup" ||
+      name == "a" ||
+      name == "span" //fix #110
+
+    ) name = container.parentNode.tagName.toLowerCase();
+
+    if(name == WYMeditor.BODY || name == WYMeditor.DIV) wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P); //fix #110 for DIV
+  }
+};
+
+WYMeditor.WymClassSafari.prototype.setFocusToNode = function(node) {
+    var range = this._iframe.contentDocument.createRange();
+    range.selectNode(node);
+    var selected = this._iframe.contentWindow.getSelection();
+    selected.addRange(range);
+    selected.collapse(node, node.childNodes.length);
+    this._iframe.contentWindow.focus();
+};
+
+WYMeditor.WymClassSafari.prototype.openBlockTag = function(tag, attributes)
+{
+  var attributes = this.validator.getValidTagAttributes(tag, attributes);
+
+  // Handle Safari styled spans
+  if(tag == 'span' && attributes.style) {
+    var new_tag = this.getTagForStyle(attributes.style);
+    if(new_tag){
+      this._tag_stack.pop();
+      var tag = new_tag;
+      this._tag_stack.push(new_tag);
+      attributes.style = '';
+      
+      //should fix #125 - also removed the xhtml() override
+      if(typeof attributes['class'] == 'string')
+        attributes['class'] = attributes['class'].replace(/apple-style-span/gi, '');
+    
+    } else {
+      return;
+    }
+  }
+  
+  this.output += this.helper.tag(tag, attributes, true);
+};
+
+WYMeditor.WymClassSafari.prototype.getTagForStyle = function(style) {
+
+  if(/bold/.test(style)) return 'strong';
+  if(/italic/.test(style)) return 'em';
+  if(/sub/.test(style)) return 'sub';
+  if(/super/.test(style)) return 'sup';
+  return false;
+};
index b13e2d0..09409d8 100644 (file)
@@ -203,6 +203,8 @@ jQuery.extend(WYMeditor, {
     UNLINK                             : "Unlink",
     INSERT_UNORDEREDLIST: "InsertUnorderedList",
     INSERT_ORDEREDLIST : "InsertOrderedList",
+    // hack
+    TARGET              : "target",
 
     MAIN_CONTAINERS : new Array("p","h1","h2","h3","h4","h5","h6","pre","blockquote"),
 
@@ -513,6 +515,9 @@ jQuery.fn.wymeditor = function(options) {
     updateSelector:    ".wymupdate",
     updateEvent:       "click",
     
+    // hack
+    targetSelector:    ".wym_target",
+    
     dialogFeatures:    "menubar=no,titlebar=no,toolbar=no,resizable=no"
                       + ",width=560,height=300,top=0,left=0",
     dialogFeaturesPreview: "menubar=no,titlebar=no,toolbar=no,resizable=no"
@@ -559,6 +564,12 @@ jQuery.fn.wymeditor = function(options) {
                + "<label>{Title}</label>"
                + "<input type='text' class='wym_title' value='' size='40' />"
                + "</div>"
+               // hack
+               + "<div class='row'>"
+               + "<label>Target</label>"
+               + "<input type='checkbox' class='wym_target' value='_blank' size='40' /> New window"
+               + "</div>"
+               // hack end
                + "<div class='row row-indent'>"
                + "<input class='wym_submit' type='button'"
                + " value='{Submit}' />"
@@ -1435,6 +1446,7 @@ WYMeditor.INIT_DIALOG = function(index) {
     //fix MSIE selection if link image has been clicked
     if(!selected && wym._selected_image)
       selected = jQuery(wym._selected_image).parentsOrSelf(WYMeditor.A);
+    
   break;
 
   }
@@ -1455,6 +1467,9 @@ WYMeditor.INIT_DIALOG = function(index) {
     jQuery(wym._options.srcSelector).val(jQuery(selected).attr(WYMeditor.SRC));
     jQuery(wym._options.titleSelector).val(jQuery(selected).attr(WYMeditor.TITLE));
     jQuery(wym._options.altSelector).val(jQuery(selected).attr(WYMeditor.ALT));
+    // hack
+    if (jQuery(selected).attr(WYMeditor.TARGET) == "_blank")
+        jQuery(wym._options.targetSelector).attr("checked", "checked");
   }
 
   //auto populate image fields if selected image
@@ -1470,16 +1485,27 @@ WYMeditor.INIT_DIALOG = function(index) {
   jQuery(wym._options.dialogLinkSelector + " "
     + wym._options.submitSelector).click(function() {
 
+       // hack
       var sUrl = jQuery(wym._options.hrefSelector).val();
-      if(sUrl.length > 0) {
+      var target = jQuery(wym._options.targetSelector).attr('checked');
+      if(sUrl.length > 0 && target) {
 
         wym._exec(WYMeditor.CREATE_LINK, sStamp);
-
         jQuery("a[href=" + sStamp + "]", wym._doc.body)
             .attr(WYMeditor.HREF, sUrl)
-            .attr(WYMeditor.TITLE, jQuery(wym._options.titleSelector).val());
-
+            .attr(WYMeditor.TITLE, jQuery(wym._options.titleSelector).val())
+            .attr(WYMeditor.TARGET, "_blank");
+        
+      } else {
+         
+          wym._exec(WYMeditor.CREATE_LINK, sStamp);
+          jQuery("a[href=" + sStamp + "]", wym._doc.body)
+              .attr(WYMeditor.HREF, sUrl)
+              .attr(WYMeditor.TITLE, jQuery(wym._options.titleSelector).val())
+              .removeAttr(WYMeditor.TARGET);
+              
       }
+      // hack end
       window.close();
   });
 
@@ -1891,7 +1917,9 @@ WYMeditor.XhtmlValidator = {
         "rel":/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/,
         "rev":/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/,
         "shape":/^(rect|rectangle|circ|circle|poly|polygon)$/,
-        "5":"type"
+        "5":"type",
+        // HACKING PARSER!
+        "6":"target"
       }
     },
     "0":"abbr",