more osx fixes
more osx fixes

// ============== Formatting extensions ============================ // ============== Formatting extensions ============================
// A common storage for all mode-specific formatting features // A common storage for all mode-specific formatting features
if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {}; if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {};
   
// Returns the extension of the editor's current mode // Returns the extension of the editor's current mode
CodeMirror.defineExtension("getModeExt", function () { CodeMirror.defineExtension("getModeExt", function () {
return CodeMirror.modeExtensions[this.getOption("mode")]; return CodeMirror.modeExtensions[this.getOption("mode")];
}); });
   
// If the current mode is 'htmlmixed', returns the extension of a mode located at // If the current mode is 'htmlmixed', returns the extension of a mode located at
// the specified position (can be htmlmixed, css or javascript). Otherwise, simply // the specified position (can be htmlmixed, css or javascript). Otherwise, simply
// returns the extension of the editor's current mode. // returns the extension of the editor's current mode.
CodeMirror.defineExtension("getModeExtAtPos", function (pos) { CodeMirror.defineExtension("getModeExtAtPos", function (pos) {
var token = this.getTokenAt(pos); var token = this.getTokenAt(pos);
if (token && token.state && token.state.mode) if (token && token.state && token.state.mode)
return CodeMirror.modeExtensions[token.state.mode == "html" ? "htmlmixed" : token.state.mode]; return CodeMirror.modeExtensions[token.state.mode == "html" ? "htmlmixed" : token.state.mode];
else else
return this.getModeExt(); return this.getModeExt();
}); });
   
// Comment/uncomment the specified range // Comment/uncomment the specified range
CodeMirror.defineExtension("commentRange", function (isComment, from, to) { CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
var curMode = this.getModeExtAtPos(this.getCursor()); var curMode = this.getModeExtAtPos(this.getCursor());
if (isComment) { // Comment range if (isComment) { // Comment range
var commentedText = this.getRange(from, to); var commentedText = this.getRange(from, to);
this.replaceRange(curMode.commentStart + this.getRange(from, to) + curMode.commentEnd this.replaceRange(curMode.commentStart + this.getRange(from, to) + curMode.commentEnd
, from, to); , from, to);
if (from.line == to.line && from.ch == to.ch) { // An empty comment inserted - put cursor inside if (from.line == to.line && from.ch == to.ch) { // An empty comment inserted - put cursor inside
this.setCursor(from.line, from.ch + curMode.commentStart.length); this.setCursor(from.line, from.ch + curMode.commentStart.length);
} }
} }
else { // Uncomment range else { // Uncomment range
var selText = this.getRange(from, to); var selText = this.getRange(from, to);
var startIndex = selText.indexOf(curMode.commentStart); var startIndex = selText.indexOf(curMode.commentStart);
var endIndex = selText.lastIndexOf(curMode.commentEnd); var endIndex = selText.lastIndexOf(curMode.commentEnd);
if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) { if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
// Take string till comment start // Take string till comment start
selText = selText.substr(0, startIndex) selText = selText.substr(0, startIndex)
// From comment start till comment end // From comment start till comment end
+ selText.substring(startIndex + curMode.commentStart.length, endIndex) + selText.substring(startIndex + curMode.commentStart.length, endIndex)
// From comment end till string end // From comment end till string end
+ selText.substr(endIndex + curMode.commentEnd.length); + selText.substr(endIndex + curMode.commentEnd.length);
} }
this.replaceRange(selText, from, to); this.replaceRange(selText, from, to);
} }
}); });
   
// Applies automatic mode-aware indentation to the specified range // Applies automatic mode-aware indentation to the specified range
CodeMirror.defineExtension("autoIndentRange", function (from, to) { CodeMirror.defineExtension("autoIndentRange", function (from, to) {
var cmInstance = this; var cmInstance = this;
this.operation(function () { this.operation(function () {
for (var i = from.line; i <= to.line; i++) { for (var i = from.line; i <= to.line; i++) {
cmInstance.indentLine(i); cmInstance.indentLine(i);
} }
}); });
}); });
   
// Applies automatic formatting to the specified range // Applies automatic formatting to the specified range
CodeMirror.defineExtension("autoFormatRange", function (from, to) { CodeMirror.defineExtension("autoFormatRange", function (from, to) {
var absStart = this.indexFromPos(from); var absStart = this.indexFromPos(from);
var absEnd = this.indexFromPos(to); var absEnd = this.indexFromPos(to);
// Insert additional line breaks where necessary according to the // Insert additional line breaks where necessary according to the
// mode's syntax // mode's syntax
var res = this.getModeExt().autoFormatLineBreaks(this.getValue(), absStart, absEnd); var res = this.getModeExt().autoFormatLineBreaks(this.getValue(), absStart, absEnd);
var cmInstance = this; var cmInstance = this;
   
// Replace and auto-indent the range // Replace and auto-indent the range
this.operation(function () { this.operation(function () {
cmInstance.replaceRange(res, from, to); cmInstance.replaceRange(res, from, to);
var startLine = cmInstance.posFromIndex(absStart).line; var startLine = cmInstance.posFromIndex(absStart).line;
var endLine = cmInstance.posFromIndex(absStart + res.length).line; var endLine = cmInstance.posFromIndex(absStart + res.length).line;
for (var i = startLine; i <= endLine; i++) { for (var i = startLine; i <= endLine; i++) {
cmInstance.indentLine(i); cmInstance.indentLine(i);
} }
}); });
}); });
   
// Define extensions for a few modes // Define extensions for a few modes
   
CodeMirror.modeExtensions["css"] = { CodeMirror.modeExtensions["css"] = {
commentStart: "/*", commentStart: "/*",
commentEnd: "*/", commentEnd: "*/",
wordWrapChars: [";", "\\{", "\\}"], wordWrapChars: [";", "\\{", "\\}"],
autoFormatLineBreaks: function (text) { autoFormatLineBreaks: function (text) {
return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2"); return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2");
} }
}; };
   
CodeMirror.modeExtensions["javascript"] = { CodeMirror.modeExtensions["javascript"] = {
commentStart: "/*", commentStart: "/*",
commentEnd: "*/", commentEnd: "*/",
wordWrapChars: [";", "\\{", "\\}"], wordWrapChars: [";", "\\{", "\\}"],
   
getNonBreakableBlocks: function (text) { getNonBreakableBlocks: function (text) {
var nonBreakableRegexes = [ var nonBreakableRegexes = [
new RegExp("for\\s*?\\(([\\s\\S]*?)\\)"), new RegExp("for\\s*?\\(([\\s\\S]*?)\\)"),
new RegExp("'([\\s\\S]*?)('|$)"), new RegExp("'([\\s\\S]*?)('|$)"),
new RegExp("\"([\\s\\S]*?)(\"|$)"), new RegExp("\"([\\s\\S]*?)(\"|$)"),
new RegExp("//.*([\r\n]|$)") new RegExp("//.*([\r\n]|$)")
]; ];
var nonBreakableBlocks = new Array(); var nonBreakableBlocks = new Array();
for (var i = 0; i < nonBreakableRegexes.length; i++) { for (var i = 0; i < nonBreakableRegexes.length; i++) {
var curPos = 0; var curPos = 0;
while (curPos < text.length) { while (curPos < text.length) {
var m = text.substr(curPos).match(nonBreakableRegexes[i]); var m = text.substr(curPos).match(nonBreakableRegexes[i]);
if (m != null) { if (m != null) {
nonBreakableBlocks.push({ nonBreakableBlocks.push({
start: curPos + m.index, start: curPos + m.index,
end: curPos + m.index + m[0].length end: curPos + m.index + m[0].length
}); });
curPos += m.index + Math.max(1, m[0].length); curPos += m.index + Math.max(1, m[0].length);
} }
else { // No more matches else { // No more matches
break; break;
} }
} }
} }
nonBreakableBlocks.sort(function (a, b) { nonBreakableBlocks.sort(function (a, b) {
return a.start - b.start; return a.start - b.start;
}); });
   
return nonBreakableBlocks; return nonBreakableBlocks;
}, },
   
autoFormatLineBreaks: function (text) { autoFormatLineBreaks: function (text) {
var curPos = 0; var curPos = 0;
var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n])", "g"); var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n])", "g");
var nonBreakableBlocks = this.getNonBreakableBlocks(text); var nonBreakableBlocks = this.getNonBreakableBlocks(text);
if (nonBreakableBlocks != null) { if (nonBreakableBlocks != null) {
var res = ""; var res = "";
for (var i = 0; i < nonBreakableBlocks.length; i++) { for (var i = 0; i < nonBreakableBlocks.length; i++) {
if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block
res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2"); res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2");
curPos = nonBreakableBlocks[i].start; curPos = nonBreakableBlocks[i].start;
} }
if (nonBreakableBlocks[i].start <= curPos if (nonBreakableBlocks[i].start <= curPos
&& nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block && nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block
res += text.substring(curPos, nonBreakableBlocks[i].end); res += text.substring(curPos, nonBreakableBlocks[i].end);
curPos = nonBreakableBlocks[i].end; curPos = nonBreakableBlocks[i].end;
} }
} }
if (curPos < text.length - 1) { if (curPos < text.length - 1) {
res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2"); res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2");
} }
return res; return res;
} }
else { else {
return text.replace(reLinesSplitter, "$1\n$2"); return text.replace(reLinesSplitter, "$1\n$2");
} }
} }
}; };
   
CodeMirror.modeExtensions["xml"] = { CodeMirror.modeExtensions["xml"] = {
commentStart: "<!--", commentStart: "<!--",
commentEnd: "-->", commentEnd: "-->",
wordWrapChars: [">"], wordWrapChars: [">"],
   
autoFormatLineBreaks: function (text) { autoFormatLineBreaks: function (text) {
var lines = text.split("\n"); var lines = text.split("\n");
var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)"); var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)");
var reOpenBrackets = new RegExp("<", "g"); var reOpenBrackets = new RegExp("<", "g");
var reCloseBrackets = new RegExp("(>)([^\r\n])", "g"); var reCloseBrackets = new RegExp("(>)([^\r\n])", "g");
for (var i = 0; i < lines.length; i++) { for (var i = 0; i < lines.length; i++) {
var mToProcess = lines[i].match(reProcessedPortion); var mToProcess = lines[i].match(reProcessedPortion);
if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces
lines[i] = mToProcess[1] lines[i] = mToProcess[1]
+ mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2") + mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2")
+ mToProcess[3]; + mToProcess[3];
continue; continue;
} }
} }
   
return lines.join("\n"); return lines.join("\n");
} }
}; };
   
CodeMirror.modeExtensions["htmlmixed"] = { CodeMirror.modeExtensions["htmlmixed"] = {
commentStart: "<!--", commentStart: "<!--",
commentEnd: "-->", commentEnd: "-->",
wordWrapChars: [">", ";", "\\{", "\\}"], wordWrapChars: [">", ";", "\\{", "\\}"],
   
getModeInfos: function (text, absPos) { getModeInfos: function (text, absPos) {
var modeInfos = new Array(); var modeInfos = new Array();
modeInfos[0] = modeInfos[0] =
{ {
pos: 0, pos: 0,
modeExt: CodeMirror.modeExtensions["xml"], modeExt: CodeMirror.modeExtensions["xml"],
modeName: "xml" modeName: "xml"
}; };
   
var modeMatchers = new Array(); var modeMatchers = new Array();
modeMatchers[0] = modeMatchers[0] =
{ {
regex: new RegExp("<style[^>]*>([\\s\\S]*?)(</style[^>]*>|$)", "i"), regex: new RegExp("<style[^>]*>([\\s\\S]*?)(</style[^>]*>|$)", "i"),
modeExt: CodeMirror.modeExtensions["css"], modeExt: CodeMirror.modeExtensions["css"],
modeName: "css" modeName: "css"
}; };
modeMatchers[1] = modeMatchers[1] =
{ {
regex: new RegExp("<script[^>]*>([\\s\\S]*?)(</script[^>]*>|$)", "i"), regex: new RegExp("<script[^>]*>([\\s\\S]*?)(</script[^>]*>|$)", "i"),
modeExt: CodeMirror.modeExtensions["javascript"], modeExt: CodeMirror.modeExtensions["javascript"],
modeName: "javascript" modeName: "javascript"
}; };
   
var lastCharPos = (typeof (absPos) !== "undefined" ? absPos : text.length - 1); var lastCharPos = (typeof (absPos) !== "undefined" ? absPos : text.length - 1);
// Detect modes for the entire text // Detect modes for the entire text
for (var i = 0; i < modeMatchers.length; i++) { for (var i = 0; i < modeMatchers.length; i++) {
var curPos = 0; var curPos = 0;
while (curPos <= lastCharPos) { while (curPos <= lastCharPos) {
var m = text.substr(curPos).match(modeMatchers[i].regex); var m = text.substr(curPos).match(modeMatchers[i].regex);
if (m != null) { if (m != null) {
if (m.length > 1 && m[1].length > 0) { if (m.length > 1 && m[1].length > 0) {
// Push block begin pos // Push block begin pos
var blockBegin = curPos + m.index + m[0].indexOf(m[1]); var blockBegin = curPos + m.index + m[0].indexOf(m[1]);
modeInfos.push( modeInfos.push(
{ {
pos: blockBegin, pos: blockBegin,
modeExt: modeMatchers[i].modeExt, modeExt: modeMatchers[i].modeExt,
modeName: modeMatchers[i].modeName modeName: modeMatchers[i].modeName
}); });
// Push block end pos // Push block end pos
modeInfos.push( modeInfos.push(
{ {
pos: blockBegin + m[1].length, pos: blockBegin + m[1].length,
modeExt: modeInfos[0].modeExt, modeExt: modeInfos[0].modeExt,
modeName: modeInfos[0].modeName modeName: modeInfos[0].modeName
}); });
curPos += m.index + m[0].length; curPos += m.index + m[0].length;
continue; continue;
} }
else { else {
curPos += m.index + Math.max(m[0].length, 1); curPos += m.index + Math.max(m[0].length, 1);
} }
} }
else { // No more matches else { // No more matches
break; break;
} }
} }
} }
// Sort mode infos // Sort mode infos
modeInfos.sort(function sortModeInfo(a, b) { modeInfos.sort(function sortModeInfo(a, b) {
return a.pos - b.pos; return a.pos - b.pos;
}); });
   
return modeInfos; return modeInfos;
}, },
   
autoFormatLineBreaks: function (text, startPos, endPos) { autoFormatLineBreaks: function (text, startPos, endPos) {
var modeInfos = this.getModeInfos(text); var modeInfos = this.getModeInfos(text);
var reBlockStartsWithNewline = new RegExp("^\\s*?\n"); var reBlockStartsWithNewline = new RegExp("^\\s*?\n");
var reBlockEndsWithNewline = new RegExp("\n\\s*?$"); var reBlockEndsWithNewline = new RegExp("\n\\s*?$");
var res = ""; var res = "";
// Use modes info to break lines correspondingly // Use modes info to break lines correspondingly
if (modeInfos.length > 1) { // Deal with multi-mode text if (modeInfos.length > 1) { // Deal with multi-mode text
for (var i = 1; i <= modeInfos.length; i++) { for (var i = 1; i <= modeInfos.length; i++) {
var selStart = modeInfos[i - 1].pos; var selStart = modeInfos[i - 1].pos;
var selEnd = (i < modeInfos.length ? modeInfos[i].pos : endPos); var selEnd = (i < modeInfos.length ? modeInfos[i].pos : endPos);
   
if (selStart >= endPos) { // The block starts later than the needed fragment if (selStart >= endPos) { // The block starts later than the needed fragment
break; break;
} }
if (selStart < startPos) { if (selStart < startPos) {
if (selEnd <= startPos) { // The block starts earlier than the needed fragment if (selEnd <= startPos) { // The block starts earlier than the needed fragment
continue; continue;
} }
selStart = startPos; selStart = startPos;
} }
if (selEnd > endPos) { if (selEnd > endPos) {
selEnd = endPos; selEnd = endPos;
} }
var textPortion = text.substring(selStart, selEnd); var textPortion = text.substring(selStart, selEnd);
if (modeInfos[i - 1].modeName != "xml") { // Starting a CSS or JavaScript block if (modeInfos[i - 1].modeName != "xml") { // Starting a CSS or JavaScript block
if (!reBlockStartsWithNewline.test(textPortion) if (!reBlockStartsWithNewline.test(textPortion)
&& selStart > 0) { // The block does not start with a line break && selStart > 0) { // The block does not start with a line break
textPortion = "\n" + textPortion; textPortion = "\n" + textPortion;
} }
if (!reBlockEndsWithNewline.test(textPortion) if (!reBlockEndsWithNewline.test(textPortion)
&& selEnd < text.length - 1) { // The block does not end with a line break && selEnd < text.length - 1) { // The block does not end with a line break
textPortion += "\n"; textPortion += "\n";
} }
} }
res += modeInfos[i - 1].modeExt.autoFormatLineBreaks(textPortion); res += modeInfos[i - 1].modeExt.autoFormatLineBreaks(textPortion);
} }
} }
else { // Single-mode text else { // Single-mode text
res = modeInfos[0].modeExt.autoFormatLineBreaks(text.substring(startPos, endPos)); res = modeInfos[0].modeExt.autoFormatLineBreaks(text.substring(startPos, endPos));
} }
   
return res; return res;
} }
}; };
   
/*! jQuery v1.8.2 jquery.com | jquery.org/license */ /*! jQuery v1.8.2 jquery.com | jquery.org/license */
(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d&