includes/clientside/tinymce/tiny_mce_src.js
changeset 778 57ce13805b6f
parent 588 20484deb89cd
child 1193 e3b94bd055dc
equal deleted inserted replaced
777:488665d49417 778:57ce13805b6f
     1 
     1 
     2 /* file:jscripts/tiny_mce/classes/tinymce.js */
     2 /* file:jscripts/tiny_mce/classes/tinymce.js */
     3 
     3 
     4 var tinymce = {
     4 var tinymce = {
     5 	majorVersion : '3',
     5 	majorVersion : '3',
     6 	minorVersion : '1.0.1',
     6 	minorVersion : '2.1.1',
     7 	releaseDate : '2008-06-18',
     7 	releaseDate : '2008-11-27',
     8 
     8 
     9 	_init : function() {
     9 	_init : function() {
    10 		var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
    10 		var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
    11 
    11 
    12 		// Browser checks
    12 		// Browser checks
    15 		t.isOldWebKit = t.isWebKit && !w.getSelection().getRangeAt;
    15 		t.isOldWebKit = t.isWebKit && !w.getSelection().getRangeAt;
    16 		t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
    16 		t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
    17 		t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
    17 		t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
    18 		t.isGecko = !t.isWebKit && /Gecko/.test(ua);
    18 		t.isGecko = !t.isWebKit && /Gecko/.test(ua);
    19 		t.isMac = ua.indexOf('Mac') != -1;
    19 		t.isMac = ua.indexOf('Mac') != -1;
       
    20 		t.isAir = /adobeair/i.test(ua);
    20 
    21 
    21 		// TinyMCE .NET webcontrol might be setting the values for TinyMCE
    22 		// TinyMCE .NET webcontrol might be setting the values for TinyMCE
    22 		if (w.tinyMCEPreInit) {
    23 		if (w.tinyMCEPreInit) {
    23 			t.suffix = tinyMCEPreInit.suffix;
    24 			t.suffix = tinyMCEPreInit.suffix;
    24 			t.baseURL = tinyMCEPreInit.base;
    25 			t.baseURL = tinyMCEPreInit.base;
   509 			// Absolute path with no host, fake host and protocol
   510 			// Absolute path with no host, fake host and protocol
   510 			if (u.indexOf('/') === 0 && u.indexOf('//') !== 0)
   511 			if (u.indexOf('/') === 0 && u.indexOf('//') !== 0)
   511 				u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u;
   512 				u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u;
   512 
   513 
   513 			// Relative path
   514 			// Relative path
   514 			if (u.indexOf('://') === -1 && u.indexOf('//') !== 0)
   515 			if (u.indexOf(':/') === -1 && u.indexOf('//') !== 0)
   515 				u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u);
   516 				u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u);
   516 
   517 
   517 			// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
   518 			// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
   518 			u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
   519 			u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
   519 			u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);
   520 			u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);
   562 		},
   563 		},
   563 
   564 
   564 		toRelative : function(u) {
   565 		toRelative : function(u) {
   565 			var t = this, o;
   566 			var t = this, o;
   566 
   567 
       
   568 			if (u === "./")
       
   569 				return u;
       
   570 
   567 			u = new tinymce.util.URI(u, {base_uri : t});
   571 			u = new tinymce.util.URI(u, {base_uri : t});
   568 
   572 
   569 			// Not on same domain/port or protocol
   573 			// Not on same domain/port or protocol
   570 			if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol)
   574 			if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol)
   571 				return u.getURI();
   575 				return u.getURI();
   588 
   592 
   589 			return u.getURI(this.host == u.host ? nh : 0);
   593 			return u.getURI(this.host == u.host ? nh : 0);
   590 		},
   594 		},
   591 
   595 
   592 		toRelPath : function(base, path) {
   596 		toRelPath : function(base, path) {
   593 			var items, bp = 0, out = '', i;
   597 			var items, bp = 0, out = '', i, l;
   594 
   598 
   595 			// Split the paths
   599 			// Split the paths
   596 			base = base.substring(0, base.lastIndexOf('/'));
   600 			base = base.substring(0, base.lastIndexOf('/'));
   597 			base = base.split('/');
   601 			base = base.split('/');
   598 			items = path.split('/');
   602 			items = path.split('/');
   599 
   603 
   600 			if (base.length >= items.length) {
   604 			if (base.length >= items.length) {
   601 				for (i = 0; i < base.length; i++) {
   605 				for (i = 0, l = base.length; i < l; i++) {
   602 					if (i >= items.length || base[i] != items[i]) {
   606 					if (i >= items.length || base[i] != items[i]) {
   603 						bp = i + 1;
   607 						bp = i + 1;
   604 						break;
   608 						break;
   605 					}
   609 					}
   606 				}
   610 				}
   607 			}
   611 			}
   608 
   612 
   609 			if (base.length < items.length) {
   613 			if (base.length < items.length) {
   610 				for (i = 0; i < items.length; i++) {
   614 				for (i = 0, l = items.length; i < l; i++) {
   611 					if (i >= base.length || base[i] != items[i]) {
   615 					if (i >= base.length || base[i] != items[i]) {
   612 						bp = i + 1;
   616 						bp = i + 1;
   613 						break;
   617 						break;
   614 					}
   618 					}
   615 				}
   619 				}
   616 			}
   620 			}
   617 
   621 
   618 			if (bp == 1)
   622 			if (bp == 1)
   619 				return path;
   623 				return path;
   620 
   624 
   621 			for (i = 0; i < base.length - (bp - 1); i++)
   625 			for (i = 0, l = base.length - (bp - 1); i < l; i++)
   622 				out += "../";
   626 				out += "../";
   623 
   627 
   624 			for (i = bp - 1; i < items.length; i++) {
   628 			for (i = bp - 1, l = items.length; i < l; i++) {
   625 				if (i != bp - 1)
   629 				if (i != bp - 1)
   626 					out += "/" + items[i];
   630 					out += "/" + items[i];
   627 				else
   631 				else
   628 					out += items[i];
   632 					out += items[i];
   629 			}
   633 			}
   801 		t = typeof o;
   805 		t = typeof o;
   802 
   806 
   803 		if (t == 'string') {
   807 		if (t == 'string') {
   804 			v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
   808 			v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
   805 
   809 
   806 			return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g, function(a, b) {
   810 			return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) {
   807 				i = v.indexOf(b);
   811 				i = v.indexOf(b);
   808 
   812 
   809 				if (i + 1)
   813 				if (i + 1)
   810 					return '\\' + v.charAt(i + 1);
   814 					return '\\' + v.charAt(i + 1);
   811 
   815 
   975 		pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,
   979 		pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,
   976 		cache : {},
   980 		cache : {},
   977 		idPattern : /^#[\w]+$/,
   981 		idPattern : /^#[\w]+$/,
   978 		elmPattern : /^[\w_*]+$/,
   982 		elmPattern : /^[\w_*]+$/,
   979 		elmClassPattern : /^([\w_]*)\.([\w_]+)$/,
   983 		elmClassPattern : /^([\w_]*)\.([\w_]+)$/,
       
   984 		props : {
       
   985 			"for" : "htmlFor",
       
   986 			"class" : "className",
       
   987 			className : "className",
       
   988 			checked : "checked",
       
   989 			disabled : "disabled",
       
   990 			maxlength : "maxLength",
       
   991 			readonly : "readOnly",
       
   992 			selected : "selected",
       
   993 			value : "value",
       
   994 			id : "id",
       
   995 			name : "name",
       
   996 			type : "type"
       
   997 		},
   980 
   998 
   981 		DOMUtils : function(d, s) {
   999 		DOMUtils : function(d, s) {
   982 			var t = this;
  1000 			var t = this;
   983 
  1001 
   984 			t.doc = d;
  1002 			t.doc = d;
  1028 				h : w.innerHeight || b.clientHeight
  1046 				h : w.innerHeight || b.clientHeight
  1029 			};
  1047 			};
  1030 		},
  1048 		},
  1031 
  1049 
  1032 		getRect : function(e) {
  1050 		getRect : function(e) {
  1033 			var p, t = this, w, h;
  1051 			var p, t = this, sr;
  1034 
  1052 
  1035 			e = t.get(e);
  1053 			e = t.get(e);
  1036 			p = t.getPos(e);
  1054 			p = t.getPos(e);
       
  1055 			sr = t.getSize(e);
       
  1056 
       
  1057 			return {
       
  1058 				x : p.x,
       
  1059 				y : p.y,
       
  1060 				w : sr.w,
       
  1061 				h : sr.h
       
  1062 			};
       
  1063 		},
       
  1064 
       
  1065 		getSize : function(e) {
       
  1066 			var t = this, w, h;
       
  1067 
       
  1068 			e = t.get(e);
  1037 			w = t.getStyle(e, 'width');
  1069 			w = t.getStyle(e, 'width');
  1038 			h = t.getStyle(e, 'height');
  1070 			h = t.getStyle(e, 'height');
  1039 
  1071 
  1040 			// Non pixel value, then force offset/clientWidth
  1072 			// Non pixel value, then force offset/clientWidth
  1041 			if (w.indexOf('px') === -1)
  1073 			if (w.indexOf('px') === -1)
  1044 			// Non pixel value, then force offset/clientWidth
  1076 			// Non pixel value, then force offset/clientWidth
  1045 			if (h.indexOf('px') === -1)
  1077 			if (h.indexOf('px') === -1)
  1046 				h = 0;
  1078 				h = 0;
  1047 
  1079 
  1048 			return {
  1080 			return {
  1049 				x : p.x,
       
  1050 				y : p.y,
       
  1051 				w : parseInt(w) || e.offsetWidth || e.clientWidth,
  1081 				w : parseInt(w) || e.offsetWidth || e.clientWidth,
  1052 				h : parseInt(h) || e.offsetHeight || e.clientHeight
  1082 				h : parseInt(h) || e.offsetHeight || e.clientHeight
  1053 			};
  1083 			};
  1054 		},
  1084 		},
  1055 
  1085 
  1111 			}
  1141 			}
  1112 
  1142 
  1113 			return e;
  1143 			return e;
  1114 		},
  1144 		},
  1115 
  1145 
       
  1146 		
  1116 		// #if !jquery
  1147 		// #if !jquery
  1117 
  1148 
  1118 		select : function(pa, s) {
  1149 		select : function(pa, s) {
  1119 			var t = this, cs, c, pl, o = [], x, i, l, n;
  1150 			var t = this, cs, c, pl, o = [], x, i, l, n, xp;
  1120 
  1151 
  1121 			s = t.get(s) || t.doc;
  1152 			s = t.get(s) || t.doc;
  1122 
  1153 
  1123 			// Look for native support and use that if it's found
  1154 			// Look for native support and use that if it's found
  1124 			if (s.querySelectorAll) {
  1155 			if (s.querySelectorAll) {
  1138 				s.id = i;
  1169 				s.id = i;
  1139 
  1170 
  1140 				return l;
  1171 				return l;
  1141 			}
  1172 			}
  1142 
  1173 
       
  1174 			if (!t.selectorRe)
       
  1175 				t.selectorRe = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;;
       
  1176 
       
  1177 			// Air doesn't support eval due to security sandboxing and querySelectorAll isn't supported yet
       
  1178 			if (tinymce.isAir) {
       
  1179 				each(tinymce.explode(pa), function(v) {
       
  1180 					if (!(xp = t.cache[v])) {
       
  1181 						xp = '';
       
  1182 
       
  1183 						each(v.split(' '), function(v) {
       
  1184 							v = t.selectorRe.exec(v);
       
  1185 
       
  1186 							xp += v[1] ? '//' + v[1] : '//*';
       
  1187 
       
  1188 							// Id
       
  1189 							if (v[2])
       
  1190 								xp += "[@id='" + v[2] + "']";
       
  1191 
       
  1192 							// Class
       
  1193 							if (v[3]) {
       
  1194 								each(v[3].split('.'), function(n) {
       
  1195 									xp += "[@class = '" + n + "' or contains(concat(' ', @class, ' '), ' " + n + " ')]";
       
  1196 								});
       
  1197 							}
       
  1198 						});
       
  1199 
       
  1200 						t.cache[v] = xp;
       
  1201 					}
       
  1202 
       
  1203 					xp = t.doc.evaluate(xp, s, null, 4, null);
       
  1204 
       
  1205 					while (n = xp.iterateNext())
       
  1206 						o.push(n);
       
  1207 				});
       
  1208 
       
  1209 				return o;
       
  1210 			}
       
  1211 
  1143 			if (t.settings.strict) {
  1212 			if (t.settings.strict) {
  1144 				function get(s, n) {
  1213 				function get(s, n) {
  1145 					return s.getElementsByTagName(n.toLowerCase());
  1214 					return s.getElementsByTagName(n.toLowerCase());
  1146 				};
  1215 				};
  1147 			} else {
  1216 			} else {
  1224 				if (!(cs = t.cache[pa])) {
  1293 				if (!(cs = t.cache[pa])) {
  1225 					cs = 'x=(function(cf, s) {';
  1294 					cs = 'x=(function(cf, s) {';
  1226 					pl = v.split(' ');
  1295 					pl = v.split(' ');
  1227 
  1296 
  1228 					each(pl, function(v) {
  1297 					each(pl, function(v) {
  1229 						var p = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.exec(v);
  1298 						var p = t.selectorRe.exec(v);
  1230 
  1299 
  1231 						// Find elements
  1300 						// Find elements
  1232 						p[1] = p[1] || '*';
  1301 						p[1] = p[1] || '*';
  1233 						cs += 'find("' + p[1] + '", function(n) {';
  1302 						cs += 'find("' + p[1] + '", function(n) {';
  1234 
  1303 
  1282 
  1351 
  1283 			return this.run(p, function(p) {
  1352 			return this.run(p, function(p) {
  1284 				var e, k;
  1353 				var e, k;
  1285 
  1354 
  1286 				e = is(n, 'string') ? t.doc.createElement(n) : n;
  1355 				e = is(n, 'string') ? t.doc.createElement(n) : n;
  1287 
  1356 				t.setAttribs(e, a);
  1288 				if (a) {
       
  1289 					for (k in a) {
       
  1290 						if (a.hasOwnProperty(k) && !is(a[k], 'object'))
       
  1291 							t.setAttrib(e, k, '' + a[k]);
       
  1292 					}
       
  1293 
       
  1294 					if (a.style && !is(a.style, 'string')) {
       
  1295 						each(a.style, function(v, n) {
       
  1296 							t.setStyle(e, n, v);
       
  1297 						});
       
  1298 					}
       
  1299 				}
       
  1300 
  1357 
  1301 				if (h) {
  1358 				if (h) {
  1302 					if (h.nodeType)
  1359 					if (h.nodeType)
  1303 						e.appendChild(h);
  1360 						e.appendChild(h);
  1304 					else
  1361 					else
  1456 		},
  1513 		},
  1457 
  1514 
  1458 		setAttrib : function(e, n, v) {
  1515 		setAttrib : function(e, n, v) {
  1459 			var t = this;
  1516 			var t = this;
  1460 
  1517 
       
  1518 			// Whats the point
       
  1519 			if (!e || !n)
       
  1520 				return;
       
  1521 
  1461 			// Strict XML mode
  1522 			// Strict XML mode
  1462 			if (t.settings.strict)
  1523 			if (t.settings.strict)
  1463 				n = n.toLowerCase();
  1524 				n = n.toLowerCase();
  1464 
  1525 
  1465 			return this.run(e, function(e) {
  1526 			return this.run(e, function(e) {
  1466 				var s = t.settings;
  1527 				var s = t.settings;
  1467 
  1528 
  1468 				switch (n) {
  1529 				switch (n) {
  1469 					case "style":
  1530 					case "style":
       
  1531 						if (!is(v, 'string')) {
       
  1532 							each(v, function(v, n) {
       
  1533 								t.setStyle(e, n, v);
       
  1534 							});
       
  1535 
       
  1536 							return;
       
  1537 						}
       
  1538 
  1470 						// No mce_style for elements with these since they might get resized by the user
  1539 						// No mce_style for elements with these since they might get resized by the user
  1471 						if (s.keep_values) {
  1540 						if (s.keep_values) {
  1472 							if (v && !t._isRes(v))
  1541 							if (v && !t._isRes(v))
  1473 								e.setAttribute('mce_style', v, 2);
  1542 								e.setAttribute('mce_style', v, 2);
  1474 							else
  1543 							else
  1524 
  1593 
  1525 			if (!e || e.nodeType !== 1)
  1594 			if (!e || e.nodeType !== 1)
  1526 				return false;
  1595 				return false;
  1527 
  1596 
  1528 			if (!is(dv))
  1597 			if (!is(dv))
  1529 				dv = "";
  1598 				dv = '';
  1530 
  1599 
  1531 			// Try the mce variant for these
  1600 			// Try the mce variant for these
  1532 			if (/^(src|href|style|coords|shape)$/.test(n)) {
  1601 			if (/^(src|href|style|coords|shape)$/.test(n)) {
  1533 				v = e.getAttribute("mce_" + n);
  1602 				v = e.getAttribute("mce_" + n);
  1534 
  1603 
  1535 				if (v)
  1604 				if (v)
  1536 					return v;
  1605 					return v;
  1537 			}
  1606 			}
  1538 
  1607 
  1539 			v = e.getAttribute(n, 2);
  1608 			if (isIE && t.props[n]) {
  1540 
  1609 				v = e[t.props[n]];
  1541 			if (!v) {
  1610 				v = v && v.nodeValue ? v.nodeValue : v;
  1542 				switch (n) {
  1611 			}
  1543 					case 'class':
  1612 
  1544 						v = e.className;
  1613 			if (!v)
  1545 						break;
  1614 				v = e.getAttribute(n, 2);
  1546 
  1615 
  1547 					default:
  1616 			if (n === 'style') {
  1548 						// Fix for IE crash Bug: #1884376 probably due to invalid DOM structure
  1617 				v = v || e.style.cssText;
  1549 						if (isIE && n === 'name' && e.nodeName === 'A') {
  1618 
  1550 							v = e.name;
  1619 				if (v) {
  1551 							break;
  1620 					v = t.serializeStyle(t.parseStyle(v));
  1552 						}
  1621 
  1553 
  1622 					if (t.settings.keep_values && !t._isRes(v))
  1554 						v = e.attributes[n];
  1623 						e.setAttribute('mce_style', v);
  1555 						v = v && is(v.nodeValue) ? v.nodeValue : v;
  1624 				}
  1556 				}
       
  1557 			}
       
  1558 
       
  1559 			switch (n) {
       
  1560 				case 'style':
       
  1561 					v = v || e.style.cssText;
       
  1562 
       
  1563 					if (v) {
       
  1564 						v = t.serializeStyle(t.parseStyle(v));
       
  1565 
       
  1566 						if (t.settings.keep_values && !t._isRes(v))
       
  1567 							e.setAttribute('mce_style', v);
       
  1568 					}
       
  1569 
       
  1570 					break;
       
  1571 			}
  1625 			}
  1572 
  1626 
  1573 			// Remove Apple and WebKit stuff
  1627 			// Remove Apple and WebKit stuff
  1574 			if (isWebKit && n === "class" && v)
  1628 			if (isWebKit && n === "class" && v)
  1575 				v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');
  1629 				v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');
  1585 
  1639 
  1586 						break;
  1640 						break;
  1587 
  1641 
  1588 					case 'size':
  1642 					case 'size':
  1589 						// IE returns +0 as default value for size
  1643 						// IE returns +0 as default value for size
  1590 						if (v === '+0')
  1644 						if (v === '+0' || v === 20)
       
  1645 							v = '';
       
  1646 
       
  1647 						break;
       
  1648 
       
  1649 					case 'width':
       
  1650 					case 'height':
       
  1651 					case 'vspace':
       
  1652 					case 'checked':
       
  1653 					case 'disabled':
       
  1654 					case 'readonly':
       
  1655 						if (v === 0)
  1591 							v = '';
  1656 							v = '';
  1592 
  1657 
  1593 						break;
  1658 						break;
  1594 
  1659 
  1595 					case 'hspace':
  1660 					case 'hspace':
  1597 						if (v === -1)
  1662 						if (v === -1)
  1598 							v = '';
  1663 							v = '';
  1599 
  1664 
  1600 						break;
  1665 						break;
  1601 
  1666 
       
  1667 					case 'maxlength':
  1602 					case 'tabindex':
  1668 					case 'tabindex':
  1603 						// IE returns default value
  1669 						// IE returns default value
  1604 						if (v === 32768)
  1670 						if (v === 32768 || v === 2147483647 || v === '32768')
  1605 							v = '';
  1671 							v = '';
  1606 
  1672 
  1607 						break;
  1673 						break;
  1608 
  1674 
  1609 					case 'maxlength':
  1675 					case 'compact':
  1610 						// IE returns  default value
  1676 					case 'noshade':
  1611 						if (v === 2147483647)
  1677 					case 'nowrap':
  1612 							v = '';
  1678 						if (v === 65535)
  1613 
  1679 							return n;
  1614 						break;
  1680 
       
  1681 						return dv;
  1615 
  1682 
  1616 					case 'shape':
  1683 					case 'shape':
  1617 						v = v.toLowerCase();
  1684 						v = v.toLowerCase();
  1618 						break;
  1685 						break;
  1619 
  1686 
  1622 						if (n.indexOf('on') === 0 && v)
  1689 						if (n.indexOf('on') === 0 && v)
  1623 							v = ('' + v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/, '$1');
  1690 							v = ('' + v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/, '$1');
  1624 				}
  1691 				}
  1625 			}
  1692 			}
  1626 
  1693 
  1627 			return (v && v != '') ? '' + v : dv;
  1694 			return (v !== undefined && v !== null && v !== '') ? '' + v : dv;
  1628 		},
  1695 		},
  1629 
  1696 
  1630 		getPos : function(n) {
  1697 		getPos : function(n) {
  1631 			var t = this, x = 0, y = 0, e, d = t.doc, r;
  1698 			var t = this, x = 0, y = 0, e, d = t.doc, r;
  1632 
  1699 
  1858 		},
  1925 		},
  1859 
  1926 
  1860 		isHidden : function(e) {
  1927 		isHidden : function(e) {
  1861 			e = this.get(e);
  1928 			e = this.get(e);
  1862 
  1929 
  1863 			return e.style.display == 'none' || this.getStyle(e, 'display') == 'none';
  1930 			return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';
  1864 		},
  1931 		},
  1865 
  1932 
  1866 		// #endif
  1933 		// #endif
  1867 
  1934 
  1868 		uniqueId : function(p) {
  1935 		uniqueId : function(p) {
  1932 
  1999 
  1933 					// Time to fix the madness IE left us
  2000 					// Time to fix the madness IE left us
  1934 					if (x) {
  2001 					if (x) {
  1935 						// So if we replace the p elements with divs and mark them and then replace them back to paragraphs
  2002 						// So if we replace the p elements with divs and mark them and then replace them back to paragraphs
  1936 						// after we use innerHTML we can fix the DOM tree
  2003 						// after we use innerHTML we can fix the DOM tree
  1937 						h = h.replace(/<p([^>]+)>|<p>/g, '<div$1 mce_tmp="1">');
  2004 						h = h.replace(/<p ([^>]+)>|<p>/g, '<div $1 mce_tmp="1">');
  1938 						h = h.replace(/<\/p>/g, '</div>');
  2005 						h = h.replace(/<\/p>/g, '</div>');
  1939 
  2006 
  1940 						// Set the new HTML with DIVs
  2007 						// Set the new HTML with DIVs
  1941 						set();
  2008 						set();
  1942 
  2009 
  1992 
  2059 
  1993 			// Convert strong and em to b and i in FF since it can't handle them
  2060 			// Convert strong and em to b and i in FF since it can't handle them
  1994 			if (tinymce.isGecko) {
  2061 			if (tinymce.isGecko) {
  1995 				h = h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi, '<$1b$2>');
  2062 				h = h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi, '<$1b$2>');
  1996 				h = h.replace(/<(\/?)em>|<em( [^>]+)>/gi, '<$1i$2>');
  2063 				h = h.replace(/<(\/?)em>|<em( [^>]+)>/gi, '<$1i$2>');
  1997 			} else if (isIE)
  2064 			} else if (isIE) {
  1998 				h = h.replace(/&apos;/g, '&#39;'); // IE can't handle apos
  2065 				h = h.replace(/&apos;/g, '&#39;'); // IE can't handle apos
       
  2066 				h = h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi, ''); // IE doesn't handle default values correct
       
  2067 			}
  1999 
  2068 
  2000 			// Fix some issues
  2069 			// Fix some issues
  2001 			h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open
  2070 			h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open
  2002 
  2071 
  2003 			// Store away src and href in mce_src and mce_href since browsers mess them up
  2072 			// Store away src and href in mce_src and mce_href since browsers mess them up
  2004 			if (s.keep_values) {
  2073 			if (s.keep_values) {
  2005 				// Wrap scripts and styles in comments for serialization purposes
  2074 				// Wrap scripts and styles in comments for serialization purposes
  2006 				if (/<script|style/.test(h)) {
  2075 				if (/<script|style/.test(h)) {
  2007 					function trim(s) {
  2076 					function trim(s) {
  2008 						// Remove prefix and suffix code for element
  2077 						// Remove prefix and suffix code for element
       
  2078 						s = s.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n');
  2009 						s = s.replace(/^[\r\n]*|[\r\n]*$/g, '');
  2079 						s = s.replace(/^[\r\n]*|[\r\n]*$/g, '');
  2010 						s = s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<\[CDATA\[|<!--|<\[CDATA\[)[\r\n]*/g, '');
  2080 						s = s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g, '');
  2011 						s = s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->)\s*$/g, '');
  2081 						s = s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g, '');
  2012 
  2082 
  2013 						return s;
  2083 						return s;
  2014 					};
  2084 					};
  2015 
  2085 
  2016 					// Preserve script elements
  2086 					// Preserve script elements
  2034 					h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g, function(v, a, b) {
  2104 					h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g, function(v, a, b) {
  2035 						b = trim(b);
  2105 						b = trim(b);
  2036 						return '<mce:style' + a + '><!--\n' + b + '\n--></mce:style><style' + a + ' mce_bogus="1">' + b + '</style>';
  2106 						return '<mce:style' + a + '><!--\n' + b + '\n--></mce:style><style' + a + ' mce_bogus="1">' + b + '</style>';
  2037 					});
  2107 					});
  2038 				}
  2108 				}
       
  2109 
       
  2110 				h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->');
  2039 
  2111 
  2040 				// Process all tags with src, href or style
  2112 				// Process all tags with src, href or style
  2041 				h = h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi, function(a, n) {
  2113 				h = h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi, function(a, n) {
  2042 					function handle(m, b, c) {
  2114 					function handle(m, b, c) {
  2043 						var u = c;
  2115 						var u = c;
  2126 				}
  2198 				}
  2127 			});
  2199 			});
  2128 		},
  2200 		},
  2129 
  2201 
  2130 		decode : function(s) {
  2202 		decode : function(s) {
  2131 			var e;
  2203 			var e, n, v;
  2132 
  2204 
  2133 			// Look for entities to decode
  2205 			// Look for entities to decode
  2134 			if (/&[^;]+;/.test(s)) {
  2206 			if (/&[^;]+;/.test(s)) {
  2135 				// Decode the entities using a div element not super efficient but less code
  2207 				// Decode the entities using a div element not super efficient but less code
  2136 				e = this.doc.createElement("div");
  2208 				e = this.doc.createElement("div");
  2137 				e.innerHTML = s;
  2209 				e.innerHTML = s;
  2138 
  2210 				n = e.firstChild;
  2139 				return !e.firstChild ? s : e.firstChild.nodeValue;
  2211 				v = '';
       
  2212 
       
  2213 				if (n) {
       
  2214 					do {
       
  2215 						v += n.nodeValue;
       
  2216 					} while (n.nextSibling);
       
  2217 				}
       
  2218 
       
  2219 				return v || s;
  2140 			}
  2220 			}
  2141 
  2221 
  2142 			return s;
  2222 			return s;
  2143 		},
  2223 		},
  2144 
  2224 
  2303 
  2383 
  2304 		run : function(e, f, s) {
  2384 		run : function(e, f, s) {
  2305 			var t = this, o;
  2385 			var t = this, o;
  2306 
  2386 
  2307 			if (t.doc && typeof(e) === 'string')
  2387 			if (t.doc && typeof(e) === 'string')
  2308 				e = t.doc.getElementById(e);
  2388 				e = t.get(e);
  2309 
  2389 
  2310 			if (!e)
  2390 			if (!e)
  2311 				return false;
  2391 				return false;
  2312 
  2392 
  2313 			s = s || this;
  2393 			s = s || this;
  2591 			}
  2671 			}
  2592 		},
  2672 		},
  2593 
  2673 
  2594 		_pageInit : function() {
  2674 		_pageInit : function() {
  2595 			var e = Event;
  2675 			var e = Event;
       
  2676 
       
  2677 			// Safari on Mac fires this twice
       
  2678 			if (e.domLoaded)
       
  2679 				return;
  2596 
  2680 
  2597 			e._remove(window, 'DOMContentLoaded', e._pageInit);
  2681 			e._remove(window, 'DOMContentLoaded', e._pageInit);
  2598 			e.domLoaded = true;
  2682 			e.domLoaded = true;
  2599 
  2683 
  2600 			each(e.inits, function(c) {
  2684 			each(e.inits, function(c) {
  2799 
  2883 
  2800 			t.dom = dom;
  2884 			t.dom = dom;
  2801 			t.win = win;
  2885 			t.win = win;
  2802 			t.serializer = serializer;
  2886 			t.serializer = serializer;
  2803 
  2887 
       
  2888 			// Add events
       
  2889 			each([
       
  2890 				'onBeforeSetContent',
       
  2891 				'onBeforeGetContent',
       
  2892 				'onSetContent',
       
  2893 				'onGetContent'
       
  2894 			], function(e) {
       
  2895 				t[e] = new tinymce.util.Dispatcher(t);
       
  2896 			});
       
  2897 
  2804 			// Prevent leaks
  2898 			// Prevent leaks
  2805 			tinymce.addUnload(t.destroy, t);
  2899 			tinymce.addUnload(t.destroy, t);
  2806 		},
  2900 		},
  2807 
  2901 
  2808 		getContent : function(s) {
  2902 		getContent : function(s) {
  2810 
  2904 
  2811 			s = s || {};
  2905 			s = s || {};
  2812 			wb = wa = '';
  2906 			wb = wa = '';
  2813 			s.get = true;
  2907 			s.get = true;
  2814 			s.format = s.format || 'html';
  2908 			s.format = s.format || 'html';
       
  2909 			t.onBeforeGetContent.dispatch(t, s);
  2815 
  2910 
  2816 			if (s.format == 'text')
  2911 			if (s.format == 'text')
  2817 				return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));
  2912 				return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));
  2818 
  2913 
  2819 			if (r.cloneContents) {
  2914 			if (r.cloneContents) {
  2833 			if (/\s+$/.test(e.innerHTML))
  2928 			if (/\s+$/.test(e.innerHTML))
  2834 				wa = ' ';
  2929 				wa = ' ';
  2835 
  2930 
  2836 			s.getInner = true;
  2931 			s.getInner = true;
  2837 
  2932 
  2838 			return t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;
  2933 			s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;
       
  2934 			t.onGetContent.dispatch(t, s);
       
  2935 
       
  2936 			return s.content;
  2839 		},
  2937 		},
  2840 
  2938 
  2841 		setContent : function(h, s) {
  2939 		setContent : function(h, s) {
  2842 			var t = this, r = t.getRng(), d = t.win.document;
  2940 			var t = this, r = t.getRng(), c, d = t.win.document;
  2843 
  2941 
  2844 			s = s || {format : 'html'};
  2942 			s = s || {format : 'html'};
  2845 			s.set = true;
  2943 			s.set = true;
  2846 			h = t.dom.processHTML(h);
  2944 			h = s.content = t.dom.processHTML(h);
       
  2945 
       
  2946 			// Dispatch before set content event
       
  2947 			t.onBeforeSetContent.dispatch(t, s);
       
  2948 			h = s.content;
  2847 
  2949 
  2848 			if (r.insertNode) {
  2950 			if (r.insertNode) {
  2849 				// Gecko has a bug where if you insert &nbsp; using InsertHTML it will insert a space instead
  2951 				// Make caret marker since insertNode places the caret in the beginning of text after insert
  2850 				// So we simply check if the input is HTML or text and then insert text using the insertNode method
  2952 				h += '<span id="__caret">_</span>';
  2851 				if (tinymce.isGecko && h.indexOf('<') == -1) {
  2953 
  2852 					r.deleteContents();
  2954 				// Delete and insert new node
  2853 					r.insertNode(t.getRng().createContextualFragment(h + '<span id="__caret">_</span>'));
  2955 				r.deleteContents();
  2854 					t.select(t.dom.get('__caret'));
  2956 				r.insertNode(t.getRng().createContextualFragment(h));
  2855 					t.getRng().deleteContents();
  2957 
  2856 					return;
  2958 				// Move to caret marker
  2857 				}
  2959 				c = t.dom.get('__caret');
  2858 
  2960 
  2859 				// Use insert HTML if it exists (places cursor after content)
  2961 				// Make sure we wrap it compleatly, Opera fails with a simple select call
  2860 				try {
  2962 				r = d.createRange();
  2861 					// This might fail with an exception see bug #1893736
  2963 				r.setStartBefore(c);
  2862 					if (d.queryCommandEnabled('InsertHTML'))
  2964 				r.setEndAfter(c);
  2863 						return d.execCommand('InsertHTML', false, h);
  2965 				t.setRng(r);
  2864 				} catch (ex) {
  2966 
  2865 					// Use old school method
  2967 				// Delete the marker, and hopefully the caret gets placed in the right location
  2866 					r.deleteContents();
  2968 				d.execCommand('Delete', false, null);
  2867 					r.insertNode(t.getRng().createContextualFragment(h));
  2969 
  2868 				}
  2970 				// In case it's still there
       
  2971 				t.dom.remove('__caret');
  2869 			} else {
  2972 			} else {
  2870 				if (r.item) {
  2973 				if (r.item) {
  2871 					// Delete content and get caret text selection
  2974 					// Delete content and get caret text selection
  2872 					d.execCommand('Delete', false, null);
  2975 					d.execCommand('Delete', false, null);
  2873 					r = t.getRng();
  2976 					r = t.getRng();
  2874 				}
  2977 				}
  2875 
  2978 
  2876 				r.pasteHTML(h);
  2979 				r.pasteHTML(h);
  2877 			}
  2980 			}
       
  2981 
       
  2982 			// Dispatch set content event
       
  2983 			t.onSetContent.dispatch(t, s);
  2878 		},
  2984 		},
  2879 
  2985 
  2880 		getStart : function() {
  2986 		getStart : function() {
  2881 			var t = this, r = t.getRng(), e;
  2987 			var t = this, r = t.getRng(), e;
  2882 
  2988 
  3233 			var t = this, r = t.getRng(), s = t.getSel();
  3339 			var t = this, r = t.getRng(), s = t.getSel();
  3234 
  3340 
  3235 			if (!r || r.item)
  3341 			if (!r || r.item)
  3236 				return false;
  3342 				return false;
  3237 
  3343 
  3238 			return !s || r.boundingWidth == 0 || s.isCollapsed;
  3344 			return !s || r.boundingWidth == 0 || r.collapsed;
  3239 		},
  3345 		},
  3240 
  3346 
  3241 		collapse : function(b) {
  3347 		collapse : function(b) {
  3242 			var t = this, r = t.getRng(), n;
  3348 			var t = this, r = t.getRng(), n;
  3243 
  3349 
  3314 
  3420 
  3315 				e = r.commonAncestorContainer;
  3421 				e = r.commonAncestorContainer;
  3316 
  3422 
  3317 				// Handle selection a image or other control like element such as anchors
  3423 				// Handle selection a image or other control like element such as anchors
  3318 				if (!r.collapsed) {
  3424 				if (!r.collapsed) {
  3319 					if (r.startContainer == r.endContainer || (tinymce.isWebKit && r.startContainer == r.endContainer.parentNode)) {
  3425 					// If the anchor node is a element instead of a text node then return this element
  3320 						if (r.startOffset - r.endOffset < 2 || tinymce.isWebKit) {
  3426 					if (tinymce.isWebKit && s.anchorNode && s.anchorNode.nodeType == 1) 
       
  3427 						return s.anchorNode.childNodes[s.anchorOffset]; 
       
  3428 
       
  3429 					if (r.startContainer == r.endContainer) {
       
  3430 						if (r.startOffset - r.endOffset < 2) {
  3321 							if (r.startContainer.hasChildNodes())
  3431 							if (r.startContainer.hasChildNodes())
  3322 								e = r.startContainer.childNodes[r.startOffset];
  3432 								e = r.startContainer.childNodes[r.startOffset];
  3323 						}
  3433 						}
  3324 					}
  3434 					}
  3325 				}
  3435 				}
  3415 		writeCDATA : function(v) {
  3525 		writeCDATA : function(v) {
  3416 			this.node.appendChild(this.doc.createCDATA(v));
  3526 			this.node.appendChild(this.doc.createCDATA(v));
  3417 		},
  3527 		},
  3418 
  3528 
  3419 		writeComment : function(v) {
  3529 		writeComment : function(v) {
       
  3530 			// Fix for bug #2035694
       
  3531 			if (tinymce.isIE)
       
  3532 				v = v.replace(/^\-|\-$/g, ' ');
       
  3533 
  3420 			this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' ')));
  3534 			this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' ')));
  3421 		},
  3535 		},
  3422 
  3536 
  3423 		getContent : function() {
  3537 		getContent : function() {
  3424 			var h;
  3538 			var h;
  3619 				attr_filter : 0,
  3733 				attr_filter : 0,
  3620 				invalid_attrs : /^(mce_|_moz_)/,
  3734 				invalid_attrs : /^(mce_|_moz_)/,
  3621 				closed : /(br|hr|input|meta|img|link|param)/,
  3735 				closed : /(br|hr|input|meta|img|link|param)/,
  3622 				entity_encoding : 'named',
  3736 				entity_encoding : 'named',
  3623 				entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',
  3737 				entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',
       
  3738 				bool_attrs : /(checked|disabled|readonly|selected|nowrap)/,
  3624 				valid_elements : '*[*]',
  3739 				valid_elements : '*[*]',
  3625 				extended_valid_elements : 0,
  3740 				extended_valid_elements : 0,
  3626 				valid_child_elements : 0,
  3741 				valid_child_elements : 0,
  3627 				invalid_elements : 0,
  3742 				invalid_elements : 0,
  3628 				fix_table_elements : 0,
  3743 				fix_table_elements : 0,
  3633 				font_size_style_values : 0,
  3748 				font_size_style_values : 0,
  3634 				apply_source_formatting : 0,
  3749 				apply_source_formatting : 0,
  3635 				indent_mode : 'simple',
  3750 				indent_mode : 'simple',
  3636 				indent_char : '\t',
  3751 				indent_char : '\t',
  3637 				indent_levels : 1,
  3752 				indent_levels : 1,
  3638 				remove_linebreaks : 1
  3753 				remove_linebreaks : 1,
       
  3754 				remove_redundant_brs : 1,
       
  3755 				element_format : 'xhtml'
  3639 			}, s);
  3756 			}, s);
  3640 
  3757 
  3641 			t.dom = s.dom;
  3758 			t.dom = s.dom;
       
  3759 
       
  3760 			if (s.remove_redundant_brs) {
       
  3761 				t.onPostProcess.add(function(se, o) {
       
  3762 					// Remove BR elements at end of list elements since they get rendered in IE
       
  3763 					o.content = o.content.replace(/<br \/>(\s*<\/li>)/g, '$1');
       
  3764 				});
       
  3765 			}
       
  3766 
       
  3767 			// Remove XHTML element endings i.e. produce crap :) XHTML is better
       
  3768 			if (s.element_format == 'html') {
       
  3769 				t.onPostProcess.add(function(se, o) {
       
  3770 					o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>');
       
  3771 				});
       
  3772 			}
  3642 
  3773 
  3643 			if (s.fix_list_elements) {
  3774 			if (s.fix_list_elements) {
  3644 				t.onPreProcess.add(function(se, o) {
  3775 				t.onPreProcess.add(function(se, o) {
  3645 					var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np;
  3776 					var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np;
  3646 
  3777 
  4074 				p = t._protect({
  4205 				p = t._protect({
  4075 					content : h,
  4206 					content : h,
  4076 					patterns : [
  4207 					patterns : [
  4077 						{pattern : /(<script[^>]*>)(.*?)(<\/script>)/g},
  4208 						{pattern : /(<script[^>]*>)(.*?)(<\/script>)/g},
  4078 						{pattern : /(<style[^>]*>)(.*?)(<\/style>)/g},
  4209 						{pattern : /(<style[^>]*>)(.*?)(<\/style>)/g},
  4079 						{pattern : /(<pre[^>]*>)(.*?)(<\/pre>)/g, encode : 1}
  4210 						{pattern : /(<pre[^>]*>)(.*?)(<\/pre>)/g, encode : 1},
       
  4211 						{pattern : /(<!--\[CDATA\[)(.*?)(\]\]-->)/g}
  4080 					]
  4212 					]
  4081 				});
  4213 				});
  4082 
  4214 
  4083 				h = p.content;
  4215 				h = p.content;
  4084 
  4216 
  4118 					}
  4250 					}
  4119 				}
  4251 				}
  4120 
  4252 
  4121 				h = t._unprotect(h, p);
  4253 				h = t._unprotect(h, p);
  4122 
  4254 
       
  4255 				// Restore CDATA sections
       
  4256 				h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>');
       
  4257 
  4123 				// Restore the \u00a0 character if raw mode is enabled
  4258 				// Restore the \u00a0 character if raw mode is enabled
  4124 				if (s.entity_encoding == 'raw')
  4259 				if (s.entity_encoding == 'raw')
  4125 					h = h.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g, '<p$1>\u00a0</p>');
  4260 					h = h.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g, '<p$1>\u00a0</p>');
  4126 			}
  4261 			}
  4127 
  4262 
  4245 								}
  4380 								}
  4246 							}
  4381 							}
  4247 						}
  4382 						}
  4248 
  4383 
  4249 						// Padd empty nodes with a &nbsp;
  4384 						// Padd empty nodes with a &nbsp;
  4250 						if (!hc && ru.padd)
  4385 						if (ru.padd) {
  4251 							w.writeText('\u00a0');
  4386 							// If it has only one bogus child, padd it anyway workaround for <td><br /></td> bug
       
  4387 							if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) {
       
  4388 								if (cn.hasAttribute ? cn.hasAttribute('mce_bogus') : cn.getAttribute('mce_bogus'))
       
  4389 									w.writeText('\u00a0');
       
  4390 							} else if (!hc)
       
  4391 								w.writeText('\u00a0'); // No children then padd it
       
  4392 						}
  4252 
  4393 
  4253 						break;
  4394 						break;
  4254 
  4395 
  4255 					case 3: // Text
  4396 					case 3: // Text
  4256 						// Check if valid child
  4397 						// Check if valid child
  4401 				return v;
  4542 				return v;
  4402 			}
  4543 			}
  4403 
  4544 
  4404 			v = this.dom.getAttrib(n, na);
  4545 			v = this.dom.getAttrib(n, na);
  4405 
  4546 
       
  4547 			// Bool attr
       
  4548 			if (this.settings.bool_attrs.test(na) && v) {
       
  4549 				v = ('' + v).toLowerCase();
       
  4550 
       
  4551 				if (v === 'false' || v === '0')
       
  4552 					return null;
       
  4553 
       
  4554 				v = na;
       
  4555 			}
       
  4556 
  4406 			switch (na) {
  4557 			switch (na) {
  4407 				case 'rowspan':
  4558 				case 'rowspan':
  4408 				case 'colspan':
  4559 				case 'colspan':
  4409 					// Whats the point? Remove usless attribute value
  4560 					// Whats the point? Remove usless attribute value
  4410 					if (v == '1')
  4561 					if (v == '1')
  4450 })();
  4601 })();
  4451 
  4602 
  4452 /* file:jscripts/tiny_mce/classes/dom/ScriptLoader.js */
  4603 /* file:jscripts/tiny_mce/classes/dom/ScriptLoader.js */
  4453 
  4604 
  4454 (function() {
  4605 (function() {
  4455 	var each = tinymce.each;
  4606 	var each = tinymce.each, Event = tinymce.dom.Event;
  4456 
  4607 
  4457 	tinymce.create('tinymce.dom.ScriptLoader', {
  4608 	tinymce.create('tinymce.dom.ScriptLoader', {
  4458 		ScriptLoader : function(s) {
  4609 		ScriptLoader : function(s) {
  4459 			this.settings = s || {};
  4610 			this.settings = s || {};
  4460 			this.queue = [];
  4611 			this.queue = [];
  4502 
  4653 
  4503 				return o;
  4654 				return o;
  4504 			}
  4655 			}
  4505 
  4656 
  4506 			function loadScript(u) {
  4657 			function loadScript(u) {
  4507 				if (tinymce.dom.Event.domLoaded || t.settings.strict_mode) {
  4658 				if (Event.domLoaded || t.settings.strict_mode) {
  4508 					tinymce.util.XHR.send({
  4659 					tinymce.util.XHR.send({
  4509 						url : tinymce._addVer(u),
  4660 						url : tinymce._addVer(u),
  4510 						error : t.settings.error,
  4661 						error : t.settings.error,
  4511 						async : false,
  4662 						async : false,
  4512 						success : function(co) {
  4663 						success : function(co) {
  4604 				if (o.state > 0)
  4755 				if (o.state > 0)
  4605 					return;
  4756 					return;
  4606 
  4757 
  4607 				o.state = 1; // Is loading
  4758 				o.state = 1; // Is loading
  4608 
  4759 
       
  4760 				tinymce.dom.ScriptLoader.loadScript(o.url, function() {
       
  4761 					done(o);
       
  4762 					allDone();
       
  4763 				});
       
  4764 
       
  4765 				/*
  4609 				tinymce.util.XHR.send({
  4766 				tinymce.util.XHR.send({
  4610 					url : o.url,
  4767 					url : o.url,
  4611 					error : t.settings.error,
  4768 					error : t.settings.error,
  4612 					success : function(co) {
  4769 					success : function(co) {
  4613 						t.eval(co);
  4770 						t.eval(co);
  4614 						done(o);
  4771 						done(o);
  4615 						allDone();
  4772 						allDone();
  4616 					}
  4773 					}
  4617 				});
  4774 				});
       
  4775 				*/
  4618 			};
  4776 			};
  4619 
  4777 
  4620 			each(sc, function(o) {
  4778 			each(sc, function(o) {
  4621 				var u = o.url;
  4779 				var u = o.url;
  4622 
  4780 
  4629 
  4787 
  4630 				// Is already loading or has been loaded
  4788 				// Is already loading or has been loaded
  4631 				if (o.state > 0)
  4789 				if (o.state > 0)
  4632 					return;
  4790 					return;
  4633 
  4791 
  4634 				if (!tinymce.dom.Event.domLoaded && !t.settings.strict_mode) {
  4792 				if (!Event.domLoaded && !t.settings.strict_mode) {
  4635 					var ix, ol = '';
  4793 					var ix, ol = '';
  4636 
  4794 
  4637 					// Add onload events
  4795 					// Add onload events
  4638 					if (cb || o.func) {
  4796 					if (cb || o.func) {
  4639 						o.state = 1; // Is loading
  4797 						o.state = 1; // Is loading
  4674 			},
  4832 			},
  4675 
  4833 
  4676 			_onLoad : function(e, u, ix) {
  4834 			_onLoad : function(e, u, ix) {
  4677 				if (!tinymce.isIE || e.readyState == 'complete')
  4835 				if (!tinymce.isIE || e.readyState == 'complete')
  4678 					this._funcs[ix].call(this);
  4836 					this._funcs[ix].call(this);
       
  4837 			},
       
  4838 
       
  4839 			loadScript : function(u, cb) {
       
  4840 				var id = tinymce.DOM.uniqueId(), e;
       
  4841 
       
  4842 				function done() {
       
  4843 					Event.clear(id);
       
  4844 					tinymce.DOM.remove(id);
       
  4845 
       
  4846 					if (cb) {
       
  4847 						cb.call(document, u);
       
  4848 						cb = 0;
       
  4849 					}
       
  4850 				};
       
  4851 
       
  4852 				if (tinymce.isIE) {
       
  4853 /*					Event.add(e, 'readystatechange', function(e) {
       
  4854 						if (e.target && e.target.readyState == 'complete')
       
  4855 							done();
       
  4856 					});*/
       
  4857 
       
  4858 					tinymce.util.XHR.send({
       
  4859 						url : tinymce._addVer(u),
       
  4860 						async : false,
       
  4861 						success : function(co) {
       
  4862 							window.execScript(co);
       
  4863 							done();
       
  4864 						}
       
  4865 					});
       
  4866 				} else {
       
  4867 					e = tinymce.DOM.create('script', {id : id, type : 'text/javascript', src : tinymce._addVer(u)});
       
  4868 					Event.add(e, 'load', done);
       
  4869 
       
  4870 					// Check for head or body
       
  4871 					(document.getElementsByTagName('head')[0] || document.body).appendChild(e);
       
  4872 				}
  4679 			}
  4873 			}
  4680 		}
  4874 		}
  4681 
  4875 
  4682 		});
  4876 		});
  4683 
  4877 
  5243 					return this.hideMenu();
  5437 					return this.hideMenu();
  5244 			}
  5438 			}
  5245 		},
  5439 		},
  5246 
  5440 
  5247 		_add : function(tb, o) {
  5441 		_add : function(tb, o) {
  5248 			var n, s = o.settings, a, ro, it, cp = this.classPrefix;
  5442 			var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic;
  5249 
  5443 
  5250 			if (s.separator) {
  5444 			if (s.separator) {
  5251 				ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'});
  5445 				ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'});
  5252 				DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'});
  5446 				DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'});
  5253 
  5447 
  5261 			n = it = DOM.add(n, 'td');
  5455 			n = it = DOM.add(n, 'td');
  5262 			n = a = DOM.add(n, 'a', {href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});
  5456 			n = a = DOM.add(n, 'a', {href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});
  5263 
  5457 
  5264 			DOM.addClass(it, s['class']);
  5458 			DOM.addClass(it, s['class']);
  5265 //			n = DOM.add(n, 'span', {'class' : 'item'});
  5459 //			n = DOM.add(n, 'span', {'class' : 'item'});
  5266 			DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});
  5460 
       
  5461 			ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});
       
  5462 
       
  5463 			if (s.icon_src)
       
  5464 				DOM.add(ic, 'img', {src : s.icon_src});
       
  5465 
  5267 			n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title);
  5466 			n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title);
  5268 
  5467 
  5269 			if (o.settings.style)
  5468 			if (o.settings.style)
  5270 				DOM.setAttrib(n, 'style', o.settings.style);
  5469 				DOM.setAttrib(n, 'style', o.settings.style);
  5271 
  5470 
  5339 			t.onAdd = new Dispatcher(t);
  5538 			t.onAdd = new Dispatcher(t);
  5340 			t.onRenderMenu = new tinymce.util.Dispatcher(this);
  5539 			t.onRenderMenu = new tinymce.util.Dispatcher(this);
  5341 			t.classPrefix = 'mceListBox';
  5540 			t.classPrefix = 'mceListBox';
  5342 		},
  5541 		},
  5343 
  5542 
  5344 		select : function(v) {
  5543 		select : function(va) {
  5345 			var t = this, e, fv;
  5544 			var t = this, fv, f;
       
  5545 
       
  5546 			if (va == undefined)
       
  5547 				return t.selectByIndex(-1);
       
  5548 
       
  5549 			// Is string or number make function selector
       
  5550 			if (va && va.call)
       
  5551 				f = va;
       
  5552 			else {
       
  5553 				f = function(v) {
       
  5554 					return v == va;
       
  5555 				};
       
  5556 			}
  5346 
  5557 
  5347 			// Do we need to do something?
  5558 			// Do we need to do something?
  5348 			if (v != t.selectedValue) {
  5559 			if (va != t.selectedValue) {
  5349 				e = DOM.get(t.id + '_text');
       
  5350 				t.selectedValue = v;
       
  5351 
       
  5352 				// Find item
  5560 				// Find item
  5353 				each(t.items, function(o) {
  5561 				each(t.items, function(o, i) {
  5354 					if (o.value == v) {
  5562 					if (f(o.value)) {
  5355 						DOM.setHTML(e, DOM.encode(o.title));
       
  5356 						fv = 1;
  5563 						fv = 1;
       
  5564 						t.selectByIndex(i);
  5357 						return false;
  5565 						return false;
  5358 					}
  5566 					}
  5359 				});
  5567 				});
  5360 
  5568 
  5361 				// If no item was found then present title
  5569 				if (!fv)
  5362 				if (!fv) {
  5570 					t.selectByIndex(-1);
       
  5571 			}
       
  5572 		},
       
  5573 
       
  5574 		selectByIndex : function(idx) {
       
  5575 			var t = this, e, o;
       
  5576 
       
  5577 			if (idx != t.selectedIndex) {
       
  5578 				e = DOM.get(t.id + '_text');
       
  5579 				o = t.items[idx];
       
  5580 
       
  5581 				if (o) {
       
  5582 					t.selectedValue = o.value;
       
  5583 					t.selectedIndex = idx;
       
  5584 					DOM.setHTML(e, DOM.encode(o.title));
       
  5585 					DOM.removeClass(e, 'mceTitle');
       
  5586 				} else {
  5363 					DOM.setHTML(e, DOM.encode(t.settings.title));
  5587 					DOM.setHTML(e, DOM.encode(t.settings.title));
  5364 					DOM.addClass(e, 'mceTitle');
  5588 					DOM.addClass(e, 'mceTitle');
  5365 					e = 0;
  5589 					t.selectedValue = t.selectedIndex = null;
  5366 					return;
  5590 				}
  5367 				} else
  5591 
  5368 					DOM.removeClass(e, 'mceTitle');
  5592 				e = 0;
  5369 			}
  5593 			} else
  5370 
  5594 				t.selectedValue = t.selectedIndex = null;
  5371 			e = 0;
       
  5372 		},
  5595 		},
  5373 
  5596 
  5374 		add : function(n, v, o) {
  5597 		add : function(n, v, o) {
  5375 			var t = this;
  5598 			var t = this;
  5376 
  5599 
  5571 
  5794 
  5572 		isDisabled : function() {
  5795 		isDisabled : function() {
  5573 			return DOM.get(this.id).disabled;
  5796 			return DOM.get(this.id).disabled;
  5574 		},
  5797 		},
  5575 
  5798 
  5576 		select : function(v) {
  5799 		select : function(va) {
  5577 			var e = DOM.get(this.id), ol = e.options;
  5800 			var t = this, fv, f;
  5578 
  5801 
  5579 			v = '' + (v || '');
  5802 			if (va == undefined)
  5580 
  5803 				return t.selectByIndex(-1);
  5581 			e.selectedIndex = 0;
  5804 
  5582 			each(ol, function(o, i) {
  5805 			// Is string or number make function selector
  5583 				if (o.value == v) {
  5806 			if (va && va.call)
  5584 					e.selectedIndex = i;
  5807 				f = va;
  5585 					return false;
  5808 			else {
  5586 				}
  5809 				f = function(v) {
  5587 			});
  5810 					return v == va;
       
  5811 				};
       
  5812 			}
       
  5813 
       
  5814 			// Do we need to do something?
       
  5815 			if (va != t.selectedValue) {
       
  5816 				// Find item
       
  5817 				each(t.items, function(o, i) {
       
  5818 					if (f(o.value)) {
       
  5819 						fv = 1;
       
  5820 						t.selectByIndex(i);
       
  5821 						return false;
       
  5822 					}
       
  5823 				});
       
  5824 
       
  5825 				if (!fv)
       
  5826 					t.selectByIndex(-1);
       
  5827 			}
       
  5828 		},
       
  5829 
       
  5830 		selectByIndex : function(idx) {
       
  5831 			DOM.get(this.id).selectedIndex = idx + 1;
       
  5832 			this.selectedValue = this.items[idx] ? this.items[idx].value : null;
  5588 		},
  5833 		},
  5589 
  5834 
  5590 		add : function(n, v, a) {
  5835 		add : function(n, v, a) {
  5591 			var o, t = this;
  5836 			var o, t = this;
  5592 
  5837 
  5628 			var t = this, ch;
  5873 			var t = this, ch;
  5629 
  5874 
  5630 			t.rendered = true;
  5875 			t.rendered = true;
  5631 
  5876 
  5632 			function onChange(e) {
  5877 			function onChange(e) {
  5633 				var v = e.target.options[e.target.selectedIndex].value;
  5878 				var v = t.items[e.target.selectedIndex - 1];
  5634 
  5879 
  5635 				t.onChange.dispatch(t, v);
  5880 				if (v && (v = v.value)) {
  5636 
  5881 					t.onChange.dispatch(t, v);
  5637 				if (t.settings.onselect)
  5882 
  5638 					t.settings.onselect(v);
  5883 					if (t.settings.onselect)
       
  5884 						t.settings.onselect(v);
       
  5885 				}
  5639 			};
  5886 			};
  5640 
  5887 
  5641 			Event.add(t.id, 'change', onChange);
  5888 			Event.add(t.id, 'change', onChange);
  5642 
  5889 
  5643 			// Accessibility keyhandler
  5890 			// Accessibility keyhandler
  5976 		postRender : function() {
  6223 		postRender : function() {
  5977 			var t = this, id = t.id;
  6224 			var t = this, id = t.id;
  5978 
  6225 
  5979 			t.parent();
  6226 			t.parent();
  5980 			DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'});
  6227 			DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'});
       
  6228 			DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value);
  5981 		},
  6229 		},
  5982 
  6230 
  5983 		destroy : function() {
  6231 		destroy : function() {
  5984 			this.parent();
  6232 			this.parent();
  5985 
  6233 
  6071 		get : function(n) {
  6319 		get : function(n) {
  6072 			return this.lookup[n];
  6320 			return this.lookup[n];
  6073 		},
  6321 		},
  6074 
  6322 
  6075 		requireLangPack : function(n) {
  6323 		requireLangPack : function(n) {
  6076 			var u, s;
  6324 			var u, s = tinymce.EditorManager.settings;
  6077 
  6325 
  6078 			if (tinymce.EditorManager.settings) {
  6326 			if (s && s.language) {
  6079 				u = this.urls[n] + '/langs/' + tinymce.EditorManager.settings.language + '.js';
  6327 				u = this.urls[n] + '/langs/' + s.language + '.js';
  6080 				s = tinymce.EditorManager.settings;
  6328 
  6081 
  6329 				if (!tinymce.dom.Event.domLoaded && !s.strict_mode)
  6082 				if (s) {
  6330 					tinymce.ScriptLoader.load(u);
  6083 					if (!tinymce.dom.Event.domLoaded && !s.strict_mode)
  6331 				else
  6084 						tinymce.ScriptLoader.load(u);
  6332 					tinymce.ScriptLoader.add(u);
  6085 					else
       
  6086 						tinymce.ScriptLoader.add(u);
       
  6087 				}
       
  6088 			}
  6333 			}
  6089 		},
  6334 		},
  6090 
  6335 
  6091 		add : function(id, o) {
  6336 		add : function(id, o) {
  6092 			this.items.push(o);
  6337 			this.items.push(o);
  6135 				tinymce.documentBaseURL += '/';
  6380 				tinymce.documentBaseURL += '/';
  6136 
  6381 
  6137 			tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
  6382 			tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
  6138 			tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL);
  6383 			tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL);
  6139 
  6384 
  6140 			// Setup document domain
  6385 			// User already specified a document.domain value
  6141 			if (tinymce.EditorManager.baseURI.host != lo.hostname && lo.hostname)
  6386 			if (document.domain && lo.hostname != document.domain)
       
  6387 				tinymce.relaxedDomain = document.domain;
       
  6388 
       
  6389 			// Setup document domain if tinymce is loaded from other domain
       
  6390 			if (!tinymce.relaxedDomain && tinymce.EditorManager.baseURI.host != lo.hostname && lo.hostname)
  6142 				document.domain = tinymce.relaxedDomain = lo.hostname.replace(/.*\.(.+\..+)$/, '$1');
  6391 				document.domain = tinymce.relaxedDomain = lo.hostname.replace(/.*\.(.+\..+)$/, '$1');
  6143 
  6392 
  6144 			// Add before unload listener
  6393 			// Add before unload listener
  6145 			// This was required since IE was leaking memory if you added and removed beforeunload listeners
  6394 			// This was required since IE was leaking memory if you added and removed beforeunload listeners
  6146 			// with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event
  6395 			// with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event
  6151 				t.onBeforeUnload.dispatch(t, e);
  6400 				t.onBeforeUnload.dispatch(t, e);
  6152 			});
  6401 			});
  6153 		},
  6402 		},
  6154 
  6403 
  6155 		init : function(s) {
  6404 		init : function(s) {
  6156 			var t = this, pl, sl = tinymce.ScriptLoader, c, e;
  6405 			var t = this, pl, sl = tinymce.ScriptLoader, c, e, el = [], ed;
  6157 
  6406 
  6158 			function execCallback(se, n, s) {
  6407 			function execCallback(se, n, s) {
  6159 				var f = se[n];
  6408 				var f = se[n];
  6160 
  6409 
  6161 				if (!f)
  6410 				if (!f)
  6257 					case "exact":
  6506 					case "exact":
  6258 						l = s.elements || '';
  6507 						l = s.elements || '';
  6259 
  6508 
  6260 						if(l.length > 0) {
  6509 						if(l.length > 0) {
  6261 							each(explode(l), function(v) {
  6510 							each(explode(l), function(v) {
  6262 								if (DOM.get(v))
  6511 								if (DOM.get(v)) {
  6263 									new tinymce.Editor(v, s).render(1);
  6512 									ed = new tinymce.Editor(v, s);
  6264 								else {
  6513 									el.push(ed);
       
  6514 									ed.render(1);
       
  6515 								} else {
  6265 									c = 0;
  6516 									c = 0;
  6266 
  6517 
  6267 									each(document.forms, function(f) {
  6518 									each(document.forms, function(f) {
  6268 										each(f.elements, function(e) {
  6519 										each(f.elements, function(e) {
  6269 											if (e.name === v) {
  6520 											if (e.name === v) {
  6270 												v = 'mce_editor_' + c;
  6521 												v = 'mce_editor_' + c;
  6271 												DOM.setAttrib(e, 'id', v);
  6522 												DOM.setAttrib(e, 'id', v);
  6272 												new tinymce.Editor(v, s).render(1);
  6523 
       
  6524 												ed = new tinymce.Editor(v, s);
       
  6525 												el.push(ed);
       
  6526 												ed.render(1);
  6273 											}
  6527 											}
  6274 										});
  6528 										});
  6275 									});
  6529 									});
  6276 								}
  6530 								}
  6277 							});
  6531 							});
  6296 
  6550 
  6297 								// Generate unique name if missing or already exists
  6551 								// Generate unique name if missing or already exists
  6298 								if (!v.id || t.get(v.id))
  6552 								if (!v.id || t.get(v.id))
  6299 									v.id = DOM.uniqueId();
  6553 									v.id = DOM.uniqueId();
  6300 
  6554 
  6301 								new tinymce.Editor(v.id, s).render(1);
  6555 								ed = new tinymce.Editor(v.id, s);
       
  6556 								el.push(ed);
       
  6557 								ed.render(1);
  6302 							}
  6558 							}
  6303 						});
  6559 						});
  6304 						break;
  6560 						break;
  6305 				}
  6561 				}
  6306 
  6562 
  6307 				// Call onInit when all editors are initialized
  6563 				// Call onInit when all editors are initialized
  6308 				if (s.oninit) {
  6564 				if (s.oninit) {
  6309 					l = co = 0;
  6565 					l = co = 0;
  6310 
  6566 
  6311 					each (t.editors, function(ed) {
  6567 					each (el, function(ed) {
  6312 						co++;
  6568 						co++;
  6313 
  6569 
  6314 						if (!ed.initialized) {
  6570 						if (!ed.initialized) {
  6315 							// Wait for it
  6571 							// Wait for it
  6316 							ed.onInit.add(function() {
  6572 							ed.onInit.add(function() {
  6412 
  6668 
  6413 					return true;
  6669 					return true;
  6414 
  6670 
  6415 				case "mceRemoveEditor":
  6671 				case "mceRemoveEditor":
  6416 				case "mceRemoveControl":
  6672 				case "mceRemoveControl":
  6417 					ed.remove();
  6673 					if (ed)
       
  6674 						ed.remove();
       
  6675 
  6418 					return true;
  6676 					return true;
  6419 
  6677 
  6420 				case 'mceToggleEditor':
  6678 				case 'mceToggleEditor':
  6421 					if (!ed) {
  6679 					if (!ed) {
  6422 						t.execCommand('mceAddControl', 0, v);
  6680 						t.execCommand('mceAddControl', 0, v);
  6580 				convert_fonts_to_spans : true,
  6838 				convert_fonts_to_spans : true,
  6581 				font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
  6839 				font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
  6582 				apply_source_formatting : 1,
  6840 				apply_source_formatting : 1,
  6583 				directionality : 'ltr',
  6841 				directionality : 'ltr',
  6584 				forced_root_block : 'p',
  6842 				forced_root_block : 'p',
  6585 				valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',
  6843 				valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',
  6586 				hidden_input : 1,
  6844 				hidden_input : 1,
  6587 				padd_empty_editor : 1,
  6845 				padd_empty_editor : 1,
  6588 				render_ui : 1,
  6846 				render_ui : 1,
  6589 				init_theme : 1,
  6847 				init_theme : 1,
  6590 				force_p_newlines : 1,
  6848 				force_p_newlines : 1,
  6591 				indentation : '30px'
  6849 				indentation : '30px',
       
  6850 				keep_styles : 1
  6592 			}, s);
  6851 			}, s);
  6593 
  6852 
  6594 			// Setup URIs
  6853 			// Setup URIs
  6595 			t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
  6854 			t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
  6596 				base_uri : tinyMCE.baseURI
  6855 				base_uri : tinyMCE.baseURI
  6762 						po.init(t, u);
  7021 						po.init(t, u);
  6763 				}
  7022 				}
  6764 			});
  7023 			});
  6765 
  7024 
  6766 			// Setup popup CSS path(s)
  7025 			// Setup popup CSS path(s)
  6767 			if (s.popup_css)
  7026 			if (s.popup_css !== false) {
  6768 				s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css);
  7027 				if (s.popup_css)
  6769 			else
  7028 					s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css);
  6770 				s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");
  7029 				else
       
  7030 					s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");
       
  7031 			}
  6771 
  7032 
  6772 			if (s.popup_css_add)
  7033 			if (s.popup_css_add)
  6773 				s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);
  7034 				s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);
  6774 
  7035 
  6775 			// Setup control factory
  7036 			// Setup control factory
  6848 			DOM.setStyles(o.sizeContainer || o.editorContainer, {
  7109 			DOM.setStyles(o.sizeContainer || o.editorContainer, {
  6849 				width : w,
  7110 				width : w,
  6850 				height : h
  7111 				height : h
  6851 			});
  7112 			});
  6852 
  7113 
  6853 			h = (o.iframeHeight || h) + ((h + '').indexOf('%') == -1 ? (o.deltaHeight || 0) : '');
  7114 			h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');
  6854 			if (h < 100)
  7115 			if (h < 100)
  6855 				h = 100;
  7116 				h = 100;
  6856 
  7117 
  6857 			t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + t.documentBaseURI.getURI() + '" />';
  7118 			t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + t.documentBaseURI.getURI() + '" />';
  6858 			t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
  7119 			t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
  6875 			t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>';
  7136 			t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>';
  6876 
  7137 
  6877 			// Domain relaxing enabled, then set document domain
  7138 			// Domain relaxing enabled, then set document domain
  6878 			if (tinymce.relaxedDomain) {
  7139 			if (tinymce.relaxedDomain) {
  6879 				// We need to write the contents here in IE since multiple writes messes up refresh button and back button
  7140 				// We need to write the contents here in IE since multiple writes messes up refresh button and back button
  6880 				if (isIE)
  7141 				if (isIE || (tinymce.isOpera && parseFloat(opera.version()) >= 9.5))
  6881 					u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';
  7142 					u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';
  6882 				else if (tinymce.isOpera)
  7143 				else if (tinymce.isOpera)
  6883 					u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()';					
  7144 					u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()';					
  6884 			}
  7145 			}
  6885 
  7146 
  6921 			}
  7182 			}
  6922 
  7183 
  6923 			// Design mode needs to be added here Ctrl+A will fail otherwise
  7184 			// Design mode needs to be added here Ctrl+A will fail otherwise
  6924 			if (!isIE) {
  7185 			if (!isIE) {
  6925 				try {
  7186 				try {
  6926 					d.designMode = 'On';
  7187 					if (!s.readonly)
       
  7188 						d.designMode = 'On';
  6927 				} catch (ex) {
  7189 				} catch (ex) {
  6928 					// Will fail on Gecko if the editor is placed in an hidden container element
  7190 					// Will fail on Gecko if the editor is placed in an hidden container element
  6929 					// The design mode will be set ones the editor is focused
  7191 					// The design mode will be set ones the editor is focused
  6930 				}
  7192 				}
  6931 			}
  7193 			}
  6933 			// IE needs to use contentEditable or it will display non secure items for HTTPS
  7195 			// IE needs to use contentEditable or it will display non secure items for HTTPS
  6934 			if (isIE) {
  7196 			if (isIE) {
  6935 				// It will not steal focus if we hide it while setting contentEditable
  7197 				// It will not steal focus if we hide it while setting contentEditable
  6936 				b = t.getBody();
  7198 				b = t.getBody();
  6937 				DOM.hide(b);
  7199 				DOM.hide(b);
  6938 				b.contentEditable = true;
  7200 
       
  7201 				if (!s.readonly)
       
  7202 					b.contentEditable = true;
       
  7203 
  6939 				DOM.show(b);
  7204 				DOM.show(b);
  6940 			}
  7205 			}
  6941 
  7206 
  6942 			// Setup objects
  7207 			// Setup objects
  6943 			t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), {
  7208 			t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), {
  6963 				convert_fonts_to_spans : s.convert_fonts_to_spans,
  7228 				convert_fonts_to_spans : s.convert_fonts_to_spans,
  6964 				font_size_classes  : s.font_size_classes,
  7229 				font_size_classes  : s.font_size_classes,
  6965 				font_size_style_values : s.font_size_style_values,
  7230 				font_size_style_values : s.font_size_style_values,
  6966 				apply_source_formatting : s.apply_source_formatting,
  7231 				apply_source_formatting : s.apply_source_formatting,
  6967 				remove_linebreaks : s.remove_linebreaks,
  7232 				remove_linebreaks : s.remove_linebreaks,
       
  7233 				element_format : s.element_format,
  6968 				dom : t.dom
  7234 				dom : t.dom
  6969 			});
  7235 			});
  6970 
  7236 
  6971 			t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
  7237 			t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
  6972 			t.forceBlocks = new tinymce.ForceBlocks(t, {
  7238 			t.forceBlocks = new tinymce.ForceBlocks(t, {
  6986 			t.onPreInit.dispatch(t);
  7252 			t.onPreInit.dispatch(t);
  6987 
  7253 
  6988 			if (!s.gecko_spellcheck)
  7254 			if (!s.gecko_spellcheck)
  6989 				t.getBody().spellcheck = 0;
  7255 				t.getBody().spellcheck = 0;
  6990 
  7256 
  6991 			t._addEvents();
  7257 			if (!s.readonly)
       
  7258 				t._addEvents();
  6992 
  7259 
  6993 			t.controlManager.onPostRender.dispatch(t, t.controlManager);
  7260 			t.controlManager.onPostRender.dispatch(t, t.controlManager);
  6994 			t.onPostRender.dispatch(t);
  7261 			t.onPostRender.dispatch(t);
  6995 
  7262 
  6996 			if (s.directionality)
  7263 			if (s.directionality)
  7147 			});
  7414 			});
  7148 
  7415 
  7149 			// Remove empty contents
  7416 			// Remove empty contents
  7150 			if (s.padd_empty_editor) {
  7417 			if (s.padd_empty_editor) {
  7151 				t.onPostProcess.add(function(ed, o) {
  7418 				t.onPostProcess.add(function(ed, o) {
  7152 					o.content = o.content.replace(/^(<p>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');
  7419 					o.content = o.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');
  7153 				});
  7420 				});
  7154 			}
  7421 			}
  7155 
  7422 
  7156 			if (isGecko) {
  7423 			if (isGecko && !s.readonly) {
  7157 				try {
  7424 				try {
  7158 					// Design mode must be set here once again to fix a bug where
  7425 					// Design mode must be set here once again to fix a bug where
  7159 					// Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again
  7426 					// Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again
  7160 					d.designMode = 'Off';
  7427 					d.designMode = 'Off';
  7161 					d.designMode = 'On';
  7428 					d.designMode = 'On';
  7248 
  7515 
  7249 			return f.apply(s || t, Array.prototype.slice.call(arguments, 1));
  7516 			return f.apply(s || t, Array.prototype.slice.call(arguments, 1));
  7250 		},
  7517 		},
  7251 
  7518 
  7252 		translate : function(s) {
  7519 		translate : function(s) {
  7253 			var c = this.settings.language, i18n = EditorManager.i18n;
  7520 			var c = this.settings.language || 'en', i18n = EditorManager.i18n;
  7254 
  7521 
  7255 			if (!s)
  7522 			if (!s)
  7256 				return '';
  7523 				return '';
  7257 
  7524 
  7258 			return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
  7525 			return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
  7259 				return i18n[c + '.' + b] || '{#' + b + '}';
  7526 				return i18n[c + '.' + b] || '{#' + b + '}';
  7260 			});
  7527 			});
  7261 		},
  7528 		},
  7262 
  7529 
  7263 		getLang : function(n, dv) {
  7530 		getLang : function(n, dv) {
  7264 			return EditorManager.i18n[this.settings.language + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
  7531 			return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
  7265 		},
  7532 		},
  7266 
  7533 
  7267 		getParam : function(n, dv, ty) {
  7534 		getParam : function(n, dv, ty) {
  7268 			var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o;
  7535 			var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o;
  7269 
  7536 
  7529 		},
  7796 		},
  7530 
  7797 
  7531 		load : function(o) {
  7798 		load : function(o) {
  7532 			var t = this, e = t.getElement(), h;
  7799 			var t = this, e = t.getElement(), h;
  7533 
  7800 
  7534 			o = o || {};
  7801 			if (e) {
  7535 			o.load = true;
  7802 				o = o || {};
  7536 
  7803 				o.load = true;
  7537 			h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);
  7804 
  7538 			o.element = e;
  7805 				h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);
  7539 
  7806 				o.element = e;
  7540 			if (!o.no_events)
  7807 
  7541 				t.onLoadContent.dispatch(t, o);
  7808 				if (!o.no_events)
  7542 
  7809 					t.onLoadContent.dispatch(t, o);
  7543 			o.element = e = null;
  7810 
  7544 
  7811 				o.element = e = null;
  7545 			return h;
  7812 
       
  7813 				return h;
       
  7814 			}
  7546 		},
  7815 		},
  7547 
  7816 
  7548 		save : function(o) {
  7817 		save : function(o) {
  7549 			var t = this, e = t.getElement(), h, f;
  7818 			var t = this, e = t.getElement(), h, f;
  7550 
  7819 
  7551 			if (!t.initialized)
  7820 			if (!e || !t.initialized)
  7552 				return;
  7821 				return;
  7553 
  7822 
  7554 			o = o || {};
  7823 			o = o || {};
  7555 			o.save = true;
  7824 			o.save = true;
  7556 
  7825 
  7934 			// Set various midas options in Gecko
  8203 			// Set various midas options in Gecko
  7935 			if (isGecko) {
  8204 			if (isGecko) {
  7936 				function setOpts() {
  8205 				function setOpts() {
  7937 					var t = this, d = t.getDoc(), s = t.settings;
  8206 					var t = this, d = t.getDoc(), s = t.settings;
  7938 
  8207 
  7939 					if (isGecko) {
  8208 					if (isGecko && !s.readonly) {
  7940 						if (t._isHidden()) {
  8209 						if (t._isHidden()) {
  7941 							try {
  8210 							try {
  7942 								if (!s.content_editable)
  8211 								if (!s.content_editable)
  7943 									d.designMode = 'On';
  8212 									d.designMode = 'On';
  7944 							} catch (ex) {
  8213 							} catch (ex) {
  7969 
  8238 
  7970 			// Add node change handlers
  8239 			// Add node change handlers
  7971 			t.onMouseUp.add(t.nodeChanged);
  8240 			t.onMouseUp.add(t.nodeChanged);
  7972 			t.onClick.add(t.nodeChanged);
  8241 			t.onClick.add(t.nodeChanged);
  7973 			t.onKeyUp.add(function(ed, e) {
  8242 			t.onKeyUp.add(function(ed, e) {
  7974 				if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.keyCode == 46 || e.keyCode == 8 || e.ctrlKey)
  8243 				var c = e.keyCode;
       
  8244 
       
  8245 				if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey)
  7975 					t.nodeChanged();
  8246 					t.nodeChanged();
  7976 			});
  8247 			});
  7977 
  8248 
  7978 			// Add reset handler
  8249 			// Add reset handler
  7979 			t.onReset.add(function() {
  8250 			t.onReset.add(function() {
  8085 
  8356 
  8086 					if (!e.altKey && !e.ctrlKey && !e.metaKey)
  8357 					if (!e.altKey && !e.ctrlKey && !e.metaKey)
  8087 						return v;
  8358 						return v;
  8088 
  8359 
  8089 					each(t.shortcuts, function(o) {
  8360 					each(t.shortcuts, function(o) {
  8090 						if (o.ctrl != e.ctrlKey && (!tinymce.isMac || o.ctrl == e.metaKey))
  8361 						if (tinymce.isMac && o.ctrl != e.metaKey)
       
  8362 							return;
       
  8363 						else if (!tinymce.isMac && o.ctrl != e.ctrlKey)
  8091 							return;
  8364 							return;
  8092 
  8365 
  8093 						if (o.alt != e.altKey)
  8366 						if (o.alt != e.altKey)
  8094 							return;
  8367 							return;
  8095 
  8368 
  8327 				sl = explode(sl);
  8600 				sl = explode(sl);
  8328 
  8601 
  8329 			if (cl = s.font_size_classes)
  8602 			if (cl = s.font_size_classes)
  8330 				cl = explode(cl);
  8603 				cl = explode(cl);
  8331 
  8604 
  8332 			function convertToFonts(no) {
  8605 			function process(no) {
  8333 				var n, f, nl, x, i, v, st;
  8606 				var n, sp, nl, x;
  8334 
  8607 
  8335 				// Convert spans to fonts on non WebKit browsers
  8608 				// Keep unit tests happy
  8336 				if (tinymce.isWebKit || !s.inline_styles)
  8609 				if (!s.inline_styles)
  8337 					return;
  8610 					return;
  8338 
  8611 
  8339 				nl = t.dom.select('span', no);
  8612 				nl = t.dom.select('font', no);
  8340 				for (x = nl.length - 1; x >= 0; x--) {
  8613 				for (x = nl.length - 1; x >= 0; x--) {
  8341 					n = nl[x];
  8614 					n = nl[x];
  8342 
  8615 
  8343 					f = dom.create('font', {
  8616 					sp = dom.create('span', {
  8344 						color : dom.toHex(dom.getStyle(n, 'color')),
       
  8345 						face : dom.getStyle(n, 'fontFamily'),
       
  8346 						style : dom.getAttrib(n, 'style'),
  8617 						style : dom.getAttrib(n, 'style'),
  8347 						'class' : dom.getAttrib(n, 'class')
  8618 						'class' : dom.getAttrib(n, 'class')
  8348 					});
  8619 					});
  8349 
  8620 
  8350 					// Clear color and font family
  8621 					dom.setStyles(sp, {
  8351 					st = f.style;
  8622 						fontFamily : dom.getAttrib(n, 'face'),
  8352 					if (st.color || st.fontFamily) {
  8623 						color : dom.getAttrib(n, 'color'),
  8353 						st.color = st.fontFamily = '';
  8624 						backgroundColor : n.style.backgroundColor
  8354 						dom.setAttrib(f, 'mce_style', ''); // Remove cached style data
  8625 					});
       
  8626 
       
  8627 					if (n.size) {
       
  8628 						if (sl)
       
  8629 							dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]);
       
  8630 						else
       
  8631 							dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]);
  8355 					}
  8632 					}
  8356 
  8633 
  8357 					if (sl) {
  8634 					dom.setAttrib(sp, 'mce_style', '');
  8358 						i = inArray(sl, dom.getStyle(n, 'fontSize'));
  8635 					dom.replace(sp, n, 1);
  8359 
       
  8360 						if (i != -1) {
       
  8361 							dom.setAttrib(f, 'size', '' + (i + 1 || 1));
       
  8362 							//f.style.fontSize = '';
       
  8363 						}
       
  8364 					} else if (cl) {
       
  8365 						i = inArray(cl, dom.getAttrib(n, 'class'));
       
  8366 						v = dom.getStyle(n, 'fontSize');
       
  8367 
       
  8368 						if (i == -1 && v.indexOf('pt') > 0)
       
  8369 							i = inArray(fz, parseInt(v));
       
  8370 
       
  8371 						if (i == -1)
       
  8372 							i = inArray(fzn, v);
       
  8373 
       
  8374 						if (i != -1) {
       
  8375 							dom.setAttrib(f, 'size', '' + (i + 1 || 1));
       
  8376 							f.style.fontSize = '';
       
  8377 						}
       
  8378 					}
       
  8379 
       
  8380 					if (f.color || f.face || f.size) {
       
  8381 						f.style.fontFamily = '';
       
  8382 						dom.setAttrib(f, 'mce_style', '');
       
  8383 						dom.replace(f, n, 1);
       
  8384 					}
       
  8385 
       
  8386 					f = n = null;
       
  8387 				}
  8636 				}
  8388 			};
  8637 			};
  8389 
       
  8390 			// Run on setup
       
  8391 			t.onSetContent.add(function(ed, o) {
       
  8392 				convertToFonts(ed.getBody());
       
  8393 			});
       
  8394 
  8638 
  8395 			// Run on cleanup
  8639 			// Run on cleanup
  8396 			t.onPreProcess.add(function(ed, o) {
  8640 			t.onPreProcess.add(function(ed, o) {
  8397 				var n, sp, nl, x;
  8641 				if (o.get)
  8398 
  8642 					process(o.node);
  8399 				// Keep unit tests happy
  8643 			});
  8400 				if (!s.inline_styles)
  8644 
  8401 					return;
  8645 			t.onSetContent.add(function(ed, o) {
  8402 
  8646 				if (o.initial)
  8403 				if (o.get) {
  8647 					process(o.node);
  8404 					nl = t.dom.select('font', o.node);
       
  8405 					for (x = nl.length - 1; x >= 0; x--) {
       
  8406 						n = nl[x];
       
  8407 
       
  8408 						sp = dom.create('span', {
       
  8409 							style : dom.getAttrib(n, 'style'),
       
  8410 							'class' : dom.getAttrib(n, 'class')
       
  8411 						});
       
  8412 
       
  8413 						dom.setStyles(sp, {
       
  8414 							fontFamily : dom.getAttrib(n, 'face'),
       
  8415 							color : dom.getAttrib(n, 'color'),
       
  8416 							backgroundColor : n.style.backgroundColor
       
  8417 						});
       
  8418 
       
  8419 						if (n.size) {
       
  8420 							if (sl)
       
  8421 								dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]);
       
  8422 							else
       
  8423 								dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]);
       
  8424 						}
       
  8425 
       
  8426 						dom.setAttrib(sp, 'mce_style', '');
       
  8427 						dom.replace(sp, n, 1);
       
  8428 					}
       
  8429 				}
       
  8430 			});
  8648 			});
  8431 		},
  8649 		},
  8432 
  8650 
  8433 		_isHidden : function() {
  8651 		_isHidden : function() {
  8434 			var s;
  8652 			var s;
  8497 
  8715 
  8498 /* file:jscripts/tiny_mce/classes/EditorCommands.js */
  8716 /* file:jscripts/tiny_mce/classes/EditorCommands.js */
  8499 
  8717 
  8500 (function() {
  8718 (function() {
  8501 	var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit;
  8719 	var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit;
       
  8720 
       
  8721 	function isBlock(n) {
       
  8722 		return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName);
       
  8723 	};
  8502 
  8724 
  8503 	tinymce.create('tinymce.EditorCommands', {
  8725 	tinymce.create('tinymce.EditorCommands', {
  8504 		EditorCommands : function(ed) {
  8726 		EditorCommands : function(ed) {
  8505 			this.editor = ed;
  8727 			this.editor = ed;
  8506 		},
  8728 		},
  8674 			if (!v) {
  8896 			if (!v) {
  8675 				if (s.isCollapsed())
  8897 				if (s.isCollapsed())
  8676 					s.select(s.getNode());
  8898 					s.select(s.getNode());
  8677 
  8899 
  8678 				t.RemoveFormat();
  8900 				t.RemoveFormat();
  8679 			} else
  8901 			} else {
  8680 				ed.getDoc().execCommand('FontName', false, v);
  8902 				if (ed.settings.convert_fonts_to_spans)
       
  8903 					t._applyInlineStyle('span', {style : {fontFamily : v}});
       
  8904 				else
       
  8905 					ed.getDoc().execCommand('FontName', false, v);
       
  8906 			}
  8681 		},
  8907 		},
  8682 
  8908 
  8683 		FontSize : function(u, v) {
  8909 		FontSize : function(u, v) {
  8684 			var ed = this.editor, s = ed.settings, fz = tinymce.explode(s.font_size_style_values), fzc = tinymce.explode(s.font_size_classes), h, bm;
  8910 			var ed = this.editor, s = ed.settings, fc, fs;
  8685 
  8911 
  8686 			// Remove style sizes
  8912 			// Use style options instead
  8687 			each(ed.dom.select('font'), function(e) {
  8913 			if (s.convert_fonts_to_spans && v >= 1 && v <= 7) {
  8688 				e.style.fontSize = '';
  8914 				fs = tinymce.explode(s.font_size_style_values);
  8689 			});
  8915 				fc = tinymce.explode(s.font_size_classes);
  8690 
  8916 
  8691 			// Let the browser add new size it will remove unneded ones in some browsers
  8917 				if (fc)
  8692 			ed.getDoc().execCommand('FontSize', false, v);
  8918 					v = fc[v - 1] || v;
  8693 
  8919 				else
  8694 			// Add style values
  8920 					v = fs[v - 1] || v;
  8695 			if (s.inline_styles) {
  8921 			}
  8696 				each(ed.dom.select('font'), function(e) {
  8922 
  8697 					// Try remove redundant font elements
  8923 			if (v >= 1 && v <= 7)
  8698 					if (e.parentNode.nodeName == 'FONT' && e.size == e.parentNode.size) {
  8924 				ed.getDoc().execCommand('FontSize', false, v);
  8699 						if (!bm)
  8925 			else
  8700 							bm = ed.selection.getBookmark();
  8926 				this._applyInlineStyle('span', {style : {fontSize : v}});
  8701 
       
  8702 						ed.dom.remove(e, 1);
       
  8703 						return;
       
  8704 					}
       
  8705 
       
  8706 					// Setup font size based on font size value
       
  8707 					if (v = e.size) {
       
  8708 						if (fzc && fzc.length > 0)
       
  8709 							ed.dom.setAttrib(e, 'class', fzc[parseInt(v) - 1]);
       
  8710 						else
       
  8711 							ed.dom.setStyle(e, 'fontSize', fz[parseInt(v) - 1]);
       
  8712 					}
       
  8713 				});
       
  8714 			}
       
  8715 
       
  8716 			ed.selection.moveToBookmark(bm);
       
  8717 		},
  8927 		},
  8718 
  8928 
  8719 		queryCommandValue : function(c) {
  8929 		queryCommandValue : function(c) {
  8720 			var f = this['queryValue' + c];
  8930 			var f = this['queryValue' + c];
  8721 
  8931 
  8761 		},
  8971 		},
  8762 
  8972 
  8763 		queryValueFontSize : function() {
  8973 		queryValueFontSize : function() {
  8764 			var ed = this.editor, v = 0, p;
  8974 			var ed = this.editor, v = 0, p;
  8765 
  8975 
  8766 			if (isOpera || isWebKit) {
  8976 			if (p = ed.dom.getParent(ed.selection.getNode(), 'SPAN'))
       
  8977 				v = p.style.fontSize;
       
  8978 
       
  8979 			if (!v && (isOpera || isWebKit)) {
  8767 				if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT'))
  8980 				if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT'))
  8768 					v = p.size;
  8981 					v = p.size;
  8769 
  8982 
  8770 				return v;
  8983 				return v;
  8771 			}
  8984 			}
  8772 
  8985 
  8773 			return this._queryVal('FontSize');
  8986 			return v || this._queryVal('FontSize');
  8774 		},
  8987 		},
  8775 
  8988 
  8776 		queryValueFontName : function() {
  8989 		queryValueFontName : function() {
  8777 			var ed = this.editor, v = 0, p;
  8990 			var ed = this.editor, v = 0, p;
  8778 
  8991 
  8779 			if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT'))
  8992 			if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT'))
  8780 				v = p.face;
  8993 				v = p.face;
       
  8994 
       
  8995 			if (p = ed.dom.getParent(ed.selection.getNode(), 'SPAN'))
       
  8996 				v = p.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();
  8781 
  8997 
  8782 			if (!v)
  8998 			if (!v)
  8783 				v = this._queryVal('FontName');
  8999 				v = this._queryVal('FontName');
  8784 
  9000 
  8785 			return v;
  9001 			return v;
  8797 				if (v == 'full')
  9013 				if (v == 'full')
  8798 					return;
  9014 					return;
  8799 
  9015 
  8800 				if (rm) {
  9016 				if (rm) {
  8801 					if (v == 'center')
  9017 					if (v == 'center')
  8802 						dom.setStyle(n.parentNode, 'textAlign', '');
  9018 						dom.setStyle(bl || n.parentNode, 'textAlign', '');
  8803 
  9019 
  8804 					dom.setStyle(n, 'float', '');
  9020 					dom.setStyle(n, 'float', '');
  8805 					this.mceRepaint();
  9021 					this.mceRepaint();
  8806 					return;
  9022 					return;
  8807 				}
  9023 				}
  8808 
  9024 
  8809 				if (v == 'center') {
  9025 				if (v == 'center') {
  8810 					// Do not change table elements
  9026 					// Do not change table elements
  8811 					if (/^(TD|TH)$/.test(bl.nodeName))
  9027 					if (bl && /^(TD|TH)$/.test(bl.nodeName))
  8812 						bl = 0;
  9028 						bl = 0;
  8813 
  9029 
  8814 					if (!bl || bl.childNodes.length > 1) {
  9030 					if (!bl || bl.childNodes.length > 1) {
  8815 						nb = dom.create('p');
  9031 						nb = dom.create('p');
  8816 						nb.appendChild(n.cloneNode(false));
  9032 						nb.appendChild(n.cloneNode(false));
  8827 
  9043 
  8828 					dom.setStyle(bl, 'textAlign', v);
  9044 					dom.setStyle(bl, 'textAlign', v);
  8829 					dom.setStyle(n, 'float', '');
  9045 					dom.setStyle(n, 'float', '');
  8830 				} else {
  9046 				} else {
  8831 					dom.setStyle(n, 'float', v);
  9047 					dom.setStyle(n, 'float', v);
  8832 					dom.setStyle(n.parentNode, 'textAlign', '');
  9048 					dom.setStyle(bl || n.parentNode, 'textAlign', '');
  8833 				}
  9049 				}
  8834 
  9050 
  8835 				this.mceRepaint();
  9051 				this.mceRepaint();
  8836 				return;
  9052 				return;
  8837 			}
  9053 			}
  9013 			re = ed.settings.merge_styles_invalid_parents;
  9229 			re = ed.settings.merge_styles_invalid_parents;
  9014 			if (tinymce.is(re, 'string'))
  9230 			if (tinymce.is(re, 'string'))
  9015 				re = new RegExp(re, 'i');
  9231 				re = new RegExp(re, 'i');
  9016 
  9232 
  9017 			// Set style info on selected element
  9233 			// Set style info on selected element
  9018 			if (e = t.getSelectedElement())
  9234 			if ((e = t.getSelectedElement()) && !ed.settings.force_span_wrappers)
  9019 				set(e, 1);
  9235 				set(e, 1);
  9020 			else {
  9236 			else {
  9021 				// Generate wrappers and set styles on them
  9237 				// Generate wrappers and set styles on them
  9022 				d.execCommand('FontName', false, '__');
  9238 				d.execCommand('FontName', false, '__');
  9023 				each(isWebKit ? dom.select('span') : dom.select('font'), function(n) {
  9239 				each(isWebKit ? dom.select('span') : dom.select('font'), function(n) {
  9058 				var p = n.parentNode;
  9274 				var p = n.parentNode;
  9059 
  9275 
  9060 				if (!p || !dom.getAttrib(n, 'mce_new'))
  9276 				if (!p || !dom.getAttrib(n, 'mce_new'))
  9061 					return;
  9277 					return;
  9062 
  9278 
       
  9279 				if (ed.settings.force_span_wrappers && p.nodeName != 'SPAN')
       
  9280 					return;
       
  9281 
  9063 				// Has parent of the same type and only child
  9282 				// Has parent of the same type and only child
  9064 				if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1)
  9283 				if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1)
  9065 					return dom.remove(p, 1);
  9284 					return dom.remove(p, 1);
  9066 
  9285 
  9067 				// Has parent that is more suitable to have the class and only child
  9286 				// Has parent that is more suitable to have the class and only child
  9105 				return (n && n.style.textAlign == v);
  9324 				return (n && n.style.textAlign == v);
  9106 
  9325 
  9107 			return this._queryState(c);
  9326 			return this._queryState(c);
  9108 		},
  9327 		},
  9109 
  9328 
       
  9329 		ForeColor : function(ui, v) {
       
  9330 			var ed = this.editor;
       
  9331 
       
  9332 			if (ed.settings.convert_fonts_to_spans) {
       
  9333 				this._applyInlineStyle('span', {style : {color : v}});
       
  9334 				return;
       
  9335 			} else
       
  9336 				ed.getDoc().execCommand('ForeColor', false, v);
       
  9337 		},
       
  9338 
  9110 		HiliteColor : function(ui, val) {
  9339 		HiliteColor : function(ui, val) {
  9111 			var t = this, ed = t.editor, d = ed.getDoc();
  9340 			var t = this, ed = t.editor, d = ed.getDoc();
       
  9341 
       
  9342 			if (ed.settings.convert_fonts_to_spans) {
       
  9343 				this._applyInlineStyle('span', {style : {backgroundColor : val}});
       
  9344 				return;
       
  9345 			}
  9112 
  9346 
  9113 			function set(s) {
  9347 			function set(s) {
  9114 				if (!isGecko)
  9348 				if (!isGecko)
  9115 					return;
  9349 					return;
  9116 
  9350 
  9273 				if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
  9507 				if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
  9274 					return true;
  9508 					return true;
  9275 
  9509 
  9276 				if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
  9510 				if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
  9277 					return true;
  9511 					return true;
  9278 			} else
  9512 			}
  9279 				return !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE');
  9513 
  9280 
  9514 			return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList() || (!ed.settings.inline_styles && !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE'));
  9281 			return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList();
       
  9282 		},
  9515 		},
  9283 
  9516 
  9284 		queryStateInsertUnorderedList : function() {
  9517 		queryStateInsertUnorderedList : function() {
  9285 			return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL');
  9518 			return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL');
  9286 		},
  9519 		},
  9299 			function getBQ(e) {
  9532 			function getBQ(e) {
  9300 				return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';});
  9533 				return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';});
  9301 			};
  9534 			};
  9302 
  9535 
  9303 			// Get start/end block
  9536 			// Get start/end block
  9304 			sb = dom.getParent(s.getStart(), dom.isBlock);
  9537 			sb = dom.getParent(s.getStart(), isBlock);
  9305 			eb = dom.getParent(s.getEnd(), dom.isBlock);
  9538 			eb = dom.getParent(s.getEnd(), isBlock);
  9306 
  9539 
  9307 			// Remove blockquote(s)
  9540 			// Remove blockquote(s)
  9308 			if (bq = getBQ(sb)) {
  9541 			if (bq = getBQ(sb)) {
  9309 				if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR'))
  9542 				if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR'))
  9310 					bm = s.getBookmark();
  9543 					bm = s.getBookmark();
  9345 					} else {
  9578 					} else {
  9346 						s.select(sb);
  9579 						s.select(sb);
  9347 						s.collapse(0);
  9580 						s.collapse(0);
  9348 
  9581 
  9349 						// IE misses the empty block some times element so we must move back the caret
  9582 						// IE misses the empty block some times element so we must move back the caret
  9350 						if (dom.getParent(s.getStart(), dom.isBlock) != sb) {
  9583 						if (dom.getParent(s.getStart(), isBlock) != sb) {
  9351 							r = s.getRng();
  9584 							r = s.getRng();
  9352 							r.move('character', -1);
  9585 							r.move('character', -1);
  9353 							r.select();
  9586 							r.select();
  9354 						}
  9587 						}
  9355 					}
  9588 					}
  9417 					s.collapse(1);
  9650 					s.collapse(1);
  9418 				}
  9651 				}
  9419 			} else
  9652 			} else
  9420 				s.moveToBookmark(bm);
  9653 				s.moveToBookmark(bm);
  9421 		},
  9654 		},
       
  9655 
       
  9656 		_applyInlineStyle : function(na, at, op) {
       
  9657 			var t = this, ed = t.editor, dom = ed.dom, bm, lo = {}, kh;
       
  9658 
       
  9659 			na = na.toUpperCase();
       
  9660 
       
  9661 			if (op && op.check_classes && at['class'])
       
  9662 				op.check_classes.push(at['class']);
       
  9663 
       
  9664 			function replaceFonts() {
       
  9665 				var bm;
       
  9666 
       
  9667 				each(dom.select(tinymce.isWebKit && !tinymce.isAir ? 'span' : 'font'), function(n) {
       
  9668 					if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') {
       
  9669 						if (!bm)
       
  9670 							bm = ed.selection.getBookmark();
       
  9671 
       
  9672 						at._mce_new = '1';
       
  9673 						dom.replace(dom.create(na, at), n, 1);
       
  9674 					}
       
  9675 				});
       
  9676 
       
  9677 				// Remove redundant elements
       
  9678 				each(dom.select(na), function(n) {
       
  9679 					if (n.getAttribute('_mce_new')) {
       
  9680 						function removeStyle(n) {
       
  9681 							if (n.nodeType == 1) {
       
  9682 								each(at.style, function(v, k) {
       
  9683 									dom.setStyle(n, k, '');
       
  9684 								});
       
  9685 
       
  9686 								// Remove spans with the same class or marked classes
       
  9687 								if (at['class'] && n.className && op) {
       
  9688 									each(op.check_classes, function(c) {
       
  9689 										if (dom.hasClass(n, c))
       
  9690 											dom.removeClass(n, c);
       
  9691 									});
       
  9692 								}
       
  9693 							}
       
  9694 						};
       
  9695 
       
  9696 						// Remove specified style information from child elements
       
  9697 						each(dom.select(na, n), removeStyle);
       
  9698 
       
  9699 						// Remove the specified style information on parent if current node is only child (IE)
       
  9700 						if (n.parentNode && n.parentNode.nodeType == 1 && n.parentNode.childNodes.length == 1)
       
  9701 							removeStyle(n.parentNode);
       
  9702 
       
  9703 						// Remove the child elements style info if a parent already has it
       
  9704 						dom.getParent(n.parentNode, function(pn) {
       
  9705 							if (pn.nodeType == 1) {
       
  9706 								if (at.style) {
       
  9707 									each(at.style, function(v, k) {
       
  9708 										var sv;
       
  9709 
       
  9710 										if (!lo[k] && (sv = dom.getStyle(pn, k))) {
       
  9711 											if (sv === v)
       
  9712 												dom.setStyle(n, k, '');
       
  9713 
       
  9714 											lo[k] = 1;
       
  9715 										}
       
  9716 									});
       
  9717 								}
       
  9718 
       
  9719 								// Remove spans with the same class or marked classes
       
  9720 								if (at['class'] && pn.className && op) {
       
  9721 									each(op.check_classes, function(c) {
       
  9722 										if (dom.hasClass(pn, c))
       
  9723 											dom.removeClass(n, c);
       
  9724 									});
       
  9725 								}
       
  9726 							}
       
  9727 
       
  9728 							return false;
       
  9729 						});
       
  9730 
       
  9731 						n.removeAttribute('_mce_new');
       
  9732 					}
       
  9733 				});
       
  9734 
       
  9735 				// Remove empty span elements
       
  9736 				each(dom.select(na).reverse(), function(n) {
       
  9737 					var c = 0;
       
  9738 
       
  9739 					// Check if there is any attributes
       
  9740 					each(dom.getAttribs(n), function(an) {
       
  9741 						if (an.nodeName.substring(0, 1) != '_' && dom.getAttrib(n, an.nodeName) != '') {
       
  9742 							//console.log(dom.getOuterHTML(n), dom.getAttrib(n, an.nodeName));
       
  9743 							c++;
       
  9744 						}
       
  9745 					});
       
  9746 
       
  9747 					// No attributes then remove the element and keep the children
       
  9748 					if (c == 0)
       
  9749 						dom.remove(n, 1);
       
  9750 				});
       
  9751 
       
  9752 				ed.selection.moveToBookmark(bm);
       
  9753 
       
  9754 				return !!bm;
       
  9755 			};
       
  9756 
       
  9757 			// Create inline elements
       
  9758 			ed.focus();
       
  9759 			ed.getDoc().execCommand('FontName', false, 'mceinline');
       
  9760 			replaceFonts();
       
  9761 
       
  9762 			if (kh = t._applyInlineStyle.keyhandler) {
       
  9763 				ed.onKeyUp.remove(kh);
       
  9764 				ed.onKeyPress.remove(kh);
       
  9765 				ed.onKeyDown.remove(kh);
       
  9766 				ed.onSetContent.remove(t._applyInlineStyle.chandler);
       
  9767 			}
       
  9768 
       
  9769 			if (ed.selection.isCollapsed()) {
       
  9770 				// Start collecting styles
       
  9771 				t._pendingStyles = tinymce.extend(t._pendingStyles || {}, at.style);
       
  9772 
       
  9773 				t._applyInlineStyle.chandler = ed.onSetContent.add(function() {
       
  9774 					delete t._pendingStyles;
       
  9775 				});
       
  9776 
       
  9777 				t._applyInlineStyle.keyhandler = kh = function(e) {
       
  9778 					// Use pending styles
       
  9779 					if (t._pendingStyles) {
       
  9780 						at.style = t._pendingStyles;
       
  9781 						delete t._pendingStyles;
       
  9782 					}
       
  9783 
       
  9784 					if (replaceFonts()) {
       
  9785 						ed.onKeyDown.remove(t._applyInlineStyle.keyhandler);
       
  9786 						ed.onKeyPress.remove(t._applyInlineStyle.keyhandler);
       
  9787 					}
       
  9788 
       
  9789 					if (e.type == 'keyup')
       
  9790 						ed.onKeyUp.remove(t._applyInlineStyle.keyhandler);
       
  9791 				};
       
  9792 
       
  9793 				ed.onKeyDown.add(kh);
       
  9794 				ed.onKeyPress.add(kh);
       
  9795 				ed.onKeyUp.add(kh);
       
  9796 			} else
       
  9797 				t._pendingStyles = 0;
       
  9798 		},
       
  9799 
  9422 /*
  9800 /*
  9423 		_mceBlockQuote : function() {
  9801 		_mceBlockQuote : function() {
  9424 			var t = this, s = t.editor.selection, b = s.getBookmark(), bq, dom = t.editor.dom;
  9802 			var t = this, s = t.editor.selection, b = s.getBookmark(), bq, dom = t.editor.dom;
  9425 
  9803 
  9426 			function findBQ(e) {
  9804 			function findBQ(e) {
  9476 		},
  9854 		},
  9477 */
  9855 */
  9478 		_getSelectedBlocks : function(st, en) {
  9856 		_getSelectedBlocks : function(st, en) {
  9479 			var ed = this.editor, dom = ed.dom, s = ed.selection, sb, eb, n, bl = [];
  9857 			var ed = this.editor, dom = ed.dom, s = ed.selection, sb, eb, n, bl = [];
  9480 
  9858 
  9481 			sb = dom.getParent(st || s.getStart(), dom.isBlock);
  9859 			sb = dom.getParent(st || s.getStart(), isBlock);
  9482 			eb = dom.getParent(en || s.getEnd(), dom.isBlock);
  9860 			eb = dom.getParent(en || s.getEnd(), isBlock);
  9483 
  9861 
  9484 			if (sb)
  9862 			if (sb)
  9485 				bl.push(sb);
  9863 				bl.push(sb);
  9486 
  9864 
  9487 			if (sb && eb && sb != eb) {
  9865 			if (sb && eb && sb != eb) {
  9488 				n = sb;
  9866 				n = sb;
  9489 
  9867 
  9490 				while ((n = n.nextSibling) && n != eb) {
  9868 				while ((n = n.nextSibling) && n != eb) {
  9491 					if (dom.isBlock(n))
  9869 					if (isBlock(n))
  9492 						bl.push(n);
  9870 						bl.push(n);
  9493 				}
  9871 				}
  9494 			}
  9872 			}
  9495 
  9873 
  9496 			if (eb && sb != eb)
  9874 			if (eb && sb != eb)
  9808 			return -1;
 10186 			return -1;
  9809 		},
 10187 		},
  9810 
 10188 
  9811 		forceRoots : function(ed, e) {
 10189 		forceRoots : function(ed, e) {
  9812 			var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF;
 10190 			var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF;
  9813 			var nx, bl, bp, sp, le, nl = b.childNodes, i;
 10191 			var nx, bl, bp, sp, le, nl = b.childNodes, i, n, eid;
  9814 
 10192 
  9815 			// Fix for bug #1863847
 10193 			// Fix for bug #1863847
  9816 			if (e && e.keyCode == 13)
 10194 			//if (e && e.keyCode == 13)
  9817 				return true;
 10195 			//	return true;
  9818 
 10196 
  9819 			// Wrap non blocks into blocks
 10197 			// Wrap non blocks into blocks
  9820 			for (i = nl.length - 1; i >= 0; i--) {
 10198 			for (i = nl.length - 1; i >= 0; i--) {
  9821 				nx = nl[i];
 10199 				nx = nl[i];
  9822 
 10200 
  9826 						// Create new block but ignore whitespace
 10204 						// Create new block but ignore whitespace
  9827 						if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) {
 10205 						if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) {
  9828 							// Store selection
 10206 							// Store selection
  9829 							if (si == -2 && r) {
 10207 							if (si == -2 && r) {
  9830 								if (!isIE) {
 10208 								if (!isIE) {
  9831 									// If element is inside body, might not be the case in contentEdiable mode
 10209 									// If selection is element then mark it
  9832 									if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) {
 10210 									if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) {
  9833 										so = r.startOffset;
 10211 										// Save the id of the selected element
  9834 										eo = r.endOffset;
 10212 										eid = n.getAttribute("id");
  9835 										si = t.find(b, 0, r.startContainer);
 10213 										n.setAttribute("id", "__mce");
  9836 										ei = t.find(b, 0, r.endContainer);
 10214 									} else {
       
 10215 										// If element is inside body, might not be the case in contentEdiable mode
       
 10216 										if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) {
       
 10217 											so = r.startOffset;
       
 10218 											eo = r.endOffset;
       
 10219 											si = t.find(b, 0, r.startContainer);
       
 10220 											ei = t.find(b, 0, r.endContainer);
       
 10221 										}
  9837 									}
 10222 									}
  9838 								} else {
 10223 								} else {
  9839 									tr = d.body.createTextRange();
 10224 									tr = d.body.createTextRange();
  9840 									tr.moveToElementText(b);
 10225 									tr.moveToElementText(b);
  9841 									tr.collapse(1);
 10226 									tr.collapse(1);
  9900 						r.select();
 10285 						r.select();
  9901 					} catch (ex) {
 10286 					} catch (ex) {
  9902 						// Ignore
 10287 						// Ignore
  9903 					}
 10288 					}
  9904 				}
 10289 				}
       
 10290 			} else if (!isIE && (n = ed.dom.get('__mce'))) {
       
 10291 				// Restore the id of the selected element
       
 10292 				if (eid)
       
 10293 					n.setAttribute('id', eid);
       
 10294 				else
       
 10295 					n.removeAttribute('id');
       
 10296 
       
 10297 				// Move caret before selected element
       
 10298 				r = d.createRange();
       
 10299 				r.setStartBefore(n);
       
 10300 				r.setEndBefore(n);
       
 10301 				se.setRng(r);
  9905 			}
 10302 			}
  9906 		},
 10303 		},
  9907 
 10304 
  9908 		getParentBlock : function(n) {
 10305 		getParentBlock : function(n) {
  9909 			var d = this.dom;
 10306 			var d = this.dom;
  9911 			return d.getParent(n, d.isBlock);
 10308 			return d.getParent(n, d.isBlock);
  9912 		},
 10309 		},
  9913 
 10310 
  9914 		insertPara : function(e) {
 10311 		insertPara : function(e) {
  9915 			var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body;
 10312 			var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body;
  9916 			var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch;
 10313 			var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car;
  9917 
 10314 
  9918 			function isEmpty(n) {
 10315 			function isEmpty(n) {
  9919 				n = n.innerHTML;
 10316 				n = n.innerHTML;
  9920 				n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars
 10317 				n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars
  9921 				n = n.replace(/<[^>]+>/g, ''); // Remove all tags
 10318 				n = n.replace(/<[^>]+>/g, ''); // Remove all tags
 10088 
 10485 
 10089 			// Padd empty blocks
 10486 			// Padd empty blocks
 10090 			if (isEmpty(bef))
 10487 			if (isEmpty(bef))
 10091 				bef.innerHTML = '<br />';
 10488 				bef.innerHTML = '<br />';
 10092 
 10489 
       
 10490 			function appendStyles(e, en) {
       
 10491 				var nl = [], nn, n, i;
       
 10492 
       
 10493 				e.innerHTML = '';
       
 10494 
       
 10495 				// Make clones of style elements
       
 10496 				if (se.keep_styles) {
       
 10497 					n = en;
       
 10498 					do {
       
 10499 						// We only want style specific elements
       
 10500 						if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) {
       
 10501 							nn = n.cloneNode(false);
       
 10502 							dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique
       
 10503 							nl.push(nn);
       
 10504 						}
       
 10505 					} while (n = n.parentNode);
       
 10506 				}
       
 10507 
       
 10508 				// Append style elements to aft
       
 10509 				if (nl.length > 0) {
       
 10510 					for (i = nl.length - 1, nn = e; i >= 0; i--)
       
 10511 						nn = nn.appendChild(nl[i]);
       
 10512 
       
 10513 					// Padd most inner style element
       
 10514 					nl[0].innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there
       
 10515 					return nl[0]; // Move caret to most inner element
       
 10516 				} else
       
 10517 					e.innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there
       
 10518 			};
       
 10519 
       
 10520 			// Fill empty afterblook with current style
 10093 			if (isEmpty(aft))
 10521 			if (isEmpty(aft))
 10094 				aft.innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there
 10522 				car = appendStyles(aft, en);
 10095 
 10523 
 10096 			// Opera needs this one backwards for older versions
 10524 			// Opera needs this one backwards for older versions
 10097 			if (isOpera && parseFloat(opera.version()) < 9.5) {
 10525 			if (isOpera && parseFloat(opera.version()) < 9.5) {
 10098 				r.insertNode(bef);
 10526 				r.insertNode(bef);
 10099 				r.insertNode(aft);
 10527 				r.insertNode(aft);
 10110 				return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() || n;
 10538 				return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() || n;
 10111 			};
 10539 			};
 10112 
 10540 
 10113 			// Move cursor and scroll into view
 10541 			// Move cursor and scroll into view
 10114 			r = d.createRange();
 10542 			r = d.createRange();
 10115 			r.selectNodeContents(isGecko ? first(aft) : aft);
 10543 			r.selectNodeContents(isGecko ? first(car || aft) : car || aft);
 10116 			r.collapse(1);
 10544 			r.collapse(1);
 10117 			s.removeAllRanges();
 10545 			s.removeAllRanges();
 10118 			s.addRange(r);
 10546 			s.addRange(r);
 10119 
 10547 
 10120 			// scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs
 10548 			// scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs
 10121 			y = ed.dom.getPos(aft).y;
 10549 			y = ed.dom.getPos(aft).y;
 10122 			ch = aft.clientHeight;
 10550 			ch = aft.clientHeight;
 10123 
 10551 
 10124 			// Is element within viewport
 10552 			// Is element within viewport
 10125 			if (y < vp.y || y + ch > vp.y + vp.h) {
 10553 			if (y < vp.y || y + ch > vp.y + vp.h) {
 10126 				ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + ch);
 10554 				ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks
 10127 				//console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight));
 10555 				//console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight));
 10128 			}
 10556 			}
 10129 
 10557 
 10130 			return false;
 10558 			return false;
 10131 		},
 10559 		},
 10163 				}
 10591 				}
 10164 			}
 10592 			}
 10165 
 10593 
 10166 			// Gecko generates BR elements here and there, we don't like those so lets remove them
 10594 			// Gecko generates BR elements here and there, we don't like those so lets remove them
 10167 			function handler(e) {
 10595 			function handler(e) {
       
 10596 				var pr;
       
 10597 
 10168 				e = e.target;
 10598 				e = e.target;
 10169 
 10599 
 10170 				// A new BR was created in a block element, remove it
 10600 				// A new BR was created in a block element, remove it
 10171 				if (e && e.parentNode && e.nodeName == 'BR' && (n = t.getParentBlock(e))) {
 10601 				if (e && e.parentNode && e.nodeName == 'BR' && (n = t.getParentBlock(e))) {
       
 10602 					pr = e.previousSibling;
       
 10603 
 10172 					Event.remove(b, 'DOMNodeInserted', handler);
 10604 					Event.remove(b, 'DOMNodeInserted', handler);
       
 10605 
       
 10606 					// Is there whitespace at the end of the node before then we might need the pesky BR
       
 10607 					// to place the caret at a correct location see bug: #2013943
       
 10608 					if (pr && pr.nodeType == 3 && /\s+$/.test(pr.nodeValue))
       
 10609 						return;
 10173 
 10610 
 10174 					// Only remove BR elements that got inserted in the middle of the text
 10611 					// Only remove BR elements that got inserted in the middle of the text
 10175 					if (e.previousSibling || e.nextSibling)
 10612 					if (e.previousSibling || e.nextSibling)
 10176 						ed.dom.remove(e);
 10613 						ed.dom.remove(e);
 10177 				}
 10614 				}
 10407 			}
 10844 			}
 10408 
 10845 
 10409 			return t.add(c);
 10846 			return t.add(c);
 10410 		},
 10847 		},
 10411 
 10848 
 10412 		createMenuButton : function(id, s) {
 10849 		createMenuButton : function(id, s, cc) {
 10413 			s = s || {};
 10850 			s = s || {};
 10414 			s.menu_button = 1;
 10851 			s.menu_button = 1;
 10415 
 10852 
 10416 			return this.createButton(id, s);
 10853 			return this.createButton(id, s, cc);
 10417 		},
 10854 		},
 10418 
 10855 
 10419 		createSplitButton : function(id, s, cc) {
 10856 		createSplitButton : function(id, s, cc) {
 10420 			var t = this, ed = t.editor, cmd, c, cls;
 10857 			var t = this, ed = t.editor, cmd, c, cls;
 10421 
 10858 
 10633 			var f = tinymce.resolve(cl);
 11070 			var f = tinymce.resolve(cl);
 10634 
 11071 
 10635 			return new f(a, b, c, d, e);
 11072 			return new f(a, b, c, d, e);
 10636 		},
 11073 		},
 10637 
 11074 
 10638 		confirm : function(t, cb, s) {
 11075 		confirm : function(t, cb, s, w) {
 10639 			cb.call(s || this, confirm(this._decode(this.editor.getLang(t, t))));
 11076 			w = w || window;
 10640 		},
 11077 
 10641 
 11078 			cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t))));
 10642 		alert : function(tx, cb, s) {
 11079 		},
       
 11080 
       
 11081 		alert : function(tx, cb, s, w) {
 10643 			var t = this;
 11082 			var t = this;
 10644 	
 11083 
 10645 			alert(t._decode(t.editor.getLang(tx, tx)));
 11084 			w = w || window;
       
 11085 			w.alert(t._decode(t.editor.getLang(tx, tx)));
 10646 
 11086 
 10647 			if (cb)
 11087 			if (cb)
 10648 				cb.call(s || t);
 11088 				cb.call(s || t);
 10649 		},
 11089 		},
 10650 
 11090