Results for javascript : 70

1 - Empêcher le submit d'un formulaire par Enter sans bloquer la touche
form.addEventListener("submit", function(event){
	if (event.keyCode==13){
		event.preventDefault();
		event.stopPropagation();
		event.stopImmediatePropagation();
		return false;
	}
});
			
2 - Body qui apparait après chargement en 2 lignes
/* Dans le Head */
<style type="text/css">body{opacity: 0;transition: opacity 1s}</style>

/* balise body */
<body onload="document.body.style.opacity=1" >
			
4 - How To Build Tabs only with CSS - Digital-Heart - Medium
// boutons
<input type="radio" name="tabs" id="tab1" checked />
<label for="tab1">Tab1</label> 
<input type="radio" name="tabs" id="tab2" />
<label for="tab2">Tab2</label>

// contenus
<div class="tab content1">Tab1 Contents </div>
<div class="tab content2">Tab2 Contents </div>


// css pour cacher/montrer
input { display: none; }                /* hide radio buttons */
input + label { display: inline-block } /* show labels in line */
input ~ .tab { display: none }          /* hide contents *//* show contents only for selected tab */
#tab1:checked ~ .tab.content1,
#tab2:checked ~ .tab.content2 { display: block; }

// css pour styler

input + label {             /* box with rounded corner */
  border: 1px solid #999;
  background: #EEE;
  padding: 4px 12px;
  border-radius: 4px 4px 0 0;
  position: relative;
  top: 1px;
}
input:checked + label {     /* white background for selected tab */
  background: #FFF;
  border-bottom: 1px solid transparent;
}
input ~ .tab {          /* grey line between tab and contents */
  border-top: 1px solid #999;
  padding: 12px;
}
			
5 - How can you encode a string to Base64 in JavaScript? - Stack Overflow
/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/
var Base64 = {

// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

// public method for encoding
encode : function (input) {
    var output = "";
    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
    var i = 0;

    input = Base64._utf8_encode(input);

    while (i < input.length) {

        chr1 = input.charCodeAt(i++);
        chr2 = input.charCodeAt(i++);
        chr3 = input.charCodeAt(i++);

        enc1 = chr1 >> 2;
        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
        enc4 = chr3 & 63;

        if (isNaN(chr2)) {
            enc3 = enc4 = 64;
        } else if (isNaN(chr3)) {
            enc4 = 64;
        }

        output = output +
        this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
        this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

    }

    return output;
},

// public method for decoding
decode : function (input) {
    var output = "";
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0;

    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

    while (i < input.length) {

        enc1 = this._keyStr.indexOf(input.charAt(i++));
        enc2 = this._keyStr.indexOf(input.charAt(i++));
        enc3 = this._keyStr.indexOf(input.charAt(i++));
        enc4 = this._keyStr.indexOf(input.charAt(i++));

        chr1 = (enc1 << 2) | (enc2 >> 4);
        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
        chr3 = ((enc3 & 3) << 6) | enc4;

        output = output + String.fromCharCode(chr1);

        if (enc3 != 64) {
            output = output + String.fromCharCode(chr2);
        }
        if (enc4 != 64) {
            output = output + String.fromCharCode(chr3);
        }

    }

    output = Base64._utf8_decode(output);

    return output;

},

// private method for UTF-8 encoding
_utf8_encode : function (string) {
    string = string.replace(/\r\n/g,"\n");
    var utftext = "";

    for (var n = 0; n < string.length; n++) {

        var c = string.charCodeAt(n);

        if (c < 128) {
            utftext += String.fromCharCode(c);
        }
        else if((c > 127) && (c < 2048)) {
            utftext += String.fromCharCode((c >> 6) | 192);
            utftext += String.fromCharCode((c & 63) | 128);
        }
        else {
            utftext += String.fromCharCode((c >> 12) | 224);
            utftext += String.fromCharCode(((c >> 6) & 63) | 128);
            utftext += String.fromCharCode((c & 63) | 128);
        }

    }

    return utftext;
},

// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
    var string = "";
    var i = 0;
    var c = c1 = c2 = 0;

    while ( i < utftext.length ) {

        c = utftext.charCodeAt(i);

        if (c < 128) {
            string += String.fromCharCode(c);
            i++;
        }
        else if((c > 191) && (c < 224)) {
            c2 = utftext.charCodeAt(i+1);
            string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
            i += 2;
        }
        else {
            c2 = utftext.charCodeAt(i+1);
            c3 = utftext.charCodeAt(i+2);
            string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
        }

    }

    return string;
}

}
			
6 - Open new tab
// Open a new tab more safely than target="__blank"
var targetBlank = document.querySelectorAll('.targetBlank');
if (targetBlank !== null) {
    var nb = targetBlank.length;
    for (var i = 0; i < nb; i++) {
        targetBlank[i].addEventListener('click', function(evt) { 
            evt.preventDefault(); 
            evt.returnValue = false; 
            openNew(this.href);
        });
    }
}

function openNew(url) {
    var otherWindow = window.open();
    otherWindow.opener = null;
    otherWindow.location = url;
}
			
7 - Use HTML5 to resize an image before upload
var resizeImage = function (settings) {
    var file = settings.file;
    var maxSize = settings.maxSize;
    var reader = new FileReader();
    var image = new Image();
    var canvas = document.createElement('canvas');
    var dataURItoBlob = function (dataURI) {
        var bytes = dataURI.split(',')[0].indexOf('base64') >= 0 ?
            atob(dataURI.split(',')[1]) :
            unescape(dataURI.split(',')[1]);
        var mime = dataURI.split(',')[0].split(':')[1].split(';')[0];
        var max = bytes.length;
        var ia = new Uint8Array(max);
        for (var i = 0; i < max; i++)
            ia[i] = bytes.charCodeAt(i);
        return new Blob([ia], { type: mime });
    };
    var resize = function () {
        var width = image.width;
        var height = image.height;
        if (width > height) {
            if (width > maxSize) {
                height *= maxSize / width;
                width = maxSize;
            }
        } else {
            if (height > maxSize) {
                width *= maxSize / height;
                height = maxSize;
            }
        }
        canvas.width = width;
        canvas.height = height;
        canvas.getContext('2d').drawImage(image, 0, 0, width, height);
        var dataUrl = canvas.toDataURL('image/jpeg');
        return dataURItoBlob(dataUrl);
    };
    return new Promise(function (ok, no) {
        if (!file.type.match(/image.*/)) {
            no(new Error("Not an image"));
            return;
        }
        reader.onload = function (readerEvent) {
            image.onload = function () { return ok(resize()); };
            image.src = readerEvent.target.result;
        };
        reader.readAsDataURL(file);
    });
};

resizeImage({
    file: $image.files[0],
    maxSize: 500
}).then(function (resizedImage) {
    console.log("upload resized image")
}).catch(function (err) {
    console.error(err);
});

or (async/await):

const config = {
    file: $image.files[0],
    maxSize: 500
};
const resizedImage = await resizeImage(config)
console.log("upload resized image")
			
8 - copier dans le presse-papier
function copy(text) {     if (window.clipboardData && window.clipboardData.setData) {         // IE specific code path to prevent textarea being shown while dialog is visible.         return clipboardData.setData("Text", text);       } else {         var textarea = document.createElement("textarea");         textarea.textContent = text;         textarea.style.position = "fixed";  // Prevent scrolling to bottom of page in MS Edge.         document.body.appendChild(textarea);         textarea.select();         try {             return document.execCommand("copy");  // Security exception may be thrown by some browsers.         } catch (ex) {             console.warn("Copy to clipboard failed.", ex);             return false;         } finally {             document.body.removeChild(textarea);         }     } }
			
9 - javascript - Center a popup window on screen? - Stack Overflow
function PopupCenter(url, title, w, h) {
    // Fixes dual-screen position                         Most browsers      Firefox
    var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX;
    var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY;

    var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
    var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;

    var left = ((width / 2) - (w / 2)) + dualScreenLeft;
    var top = ((height / 2) - (h / 2)) + dualScreenTop;
    var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);

    // Puts focus on the newWindow
    if (window.focus) {
        newWindow.focus();
    }
}


PopupCenter('http://www.xtf.dk','xtf','900','500');  


			
10 - get asynchrone avec retour (avec les promises)
function getHTTP(url) {
    return new Promise(function (resolve, reject) {
        var xhr = new XMLHttpRequest();
        xhr.open("GET", url);
        xhr.onload = function() {
            if (this.status >= 200 && this.status < 300) {
                resolve(xhr.response);
            }
        };
        xhr.open("GET", url);
        xhr.send();
    });
}

getHTTP("https://www.google.fr")
.then(function (response) {
    // On récupère le resultat de la requête dans la varible "response"
    console.log(response)
})
			
11 - Make a Simple JavaScript Slideshow without jQuery — SitePoint
<ul id="slides">
    <li class="slide showing">Slide 1</li>
    <li class="slide">Slide 2</li>
    <li class="slide">Slide 3</li>
    <li class="slide">Slide 4</li>
    <li class="slide">Slide 5</li>
</ul>


/*
essential styles:
these make the slideshow work
*/

#slides {
    position: relative;
    height: 300px;
    padding: 0px;
    margin: 0px;
    list-style-type: none;
}

.slide {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 1;

    -webkit-transition: opacity 1s;
    -moz-transition: opacity 1s;
    -o-transition: opacity 1s;
    transition: opacity 1s;
}

.showing {
    opacity: 1;
    z-index: 2;
}


/*
non-essential styles:
just for appearance; change whatever you want
*/

.slide {
    font-size: 40px;
    padding: 40px;
    box-sizing: border-box;
    background: #333;
    color: #fff;
}

.slide:nth-of-type(1) {
    background: red;
}
.slide:nth-of-type(2) {
    background: orange;
}
.slide:nth-of-type(3) {
    background: green;
}
.slide:nth-of-type(4) {
    background: blue;
}
.slide:nth-of-type(5) {
    background: purple;
}


var slides = document.querySelectorAll('#slides .slide');
var currentSlide = 0;
var slideInterval = setInterval(nextSlide,2000);

function nextSlide() {
    slides[currentSlide].className = 'slide';
    currentSlide = (currentSlide+1)%slides.length;
    slides[currentSlide].className = 'slide showing';
}


			
12 - Drag & drop pour poser un objet où on veut sur la page
//JS 
function drag_start(event) {
    var style = window.getComputedStyle(event.target, null);
    event.dataTransfer.setData(
    	"text/plain",
    	  (parseInt(style.getPropertyValue("left"),10) - event.clientX) + ',' 
    	+ (parseInt(style.getPropertyValue("top"),10) - event.clientY)+','
    	+ event.target.id
    );

} 
function drag_over(event) { 
    event.preventDefault(); 
    return false; 
} 


on('dragstart','[draggable]',drag_start,false); 
document.body.addEventListener('dragover',drag_over,false); 
document.body.addEventListener('drop',function(event){
	var offset = event.dataTransfer.getData("text/plain").split(',');
    
    icon 				=document.getElementById(offset[2]);console.log(icon);
    //icon.style.position ="absolute";
    icon.style.left 	=(event.clientX + parseInt(offset[0],10)) + 'px';
    icon.style.top 		=(event.clientY + parseInt(offset[1],10)) + 'px';
    event.preventDefault();
    return false;
},false); 


/*CSS*/

[draggable]{
	width:65px;
	height:65px;
	
	z-index: 999;
	position:relative;
}
			
13 - Accessing The Clipboard With JavaScript
Copy On Click
var button = document.getElementById("copy-button"),
    contentHolder = document.getElementById("content-holder");

button.addEventListener("click", function() {

    // We will need a range object and a selection.
    var range = document.createRange(),
        selection = window.getSelection();

    // Clear selection from any previous data.
    selection.removeAllRanges();

    // Make the range select the entire content of the contentHolder paragraph.
    range.selectNodeContents(contentHolder);

    // Add that range to the selection.
    selection.addRange(range);

    // Copy the selection to clipboard.
    document.execCommand('copy');

    // Clear selection if you want to.
    selection.removeAllRanges();

}, false);
Modify Copied Text
document.addEventListener('copy', function(e){

    // We need to prevent the default copy functionality,
    // otherwise it would just copy the selection as usual.
    e.preventDefault();

    // The copy event doesn't give us access to the clipboard data,
    // so we need to get the user selection via the Selection API.
    var selection = window.getSelection().toString();

    // Transform the selection in any way we want.
    // In this example we will escape HTML code.
    var escaped = escapeHTML(selection);

    // Place the transformed text in the clipboard. 
    e.clipboardData.setData('text/plain', escaped);

});
			
14 - Récupérer le texte sélectionné en JS
function getSelected() {
	if(window.getSelection) { return window.getSelection(); }
	else if(document.getSelection) { return document.getSelection(); }
	else {
		var selection = document.selection && document.selection.createRange();
		if(selection.text) { return selection.text; }
		return false;
	}
	return false;
}
			
15 - Fonctions récupérées de regexpal (à creuser)
/*
    Helper functions for RegexPal
    (c) 2007 Steven Levithan <http://stevenlevithan.com>
    MIT license
*/

function $ (el) {
    if (el.nodeName) return el;
    if (typeof el === "string") return document.getElementById(el);
    return false;
};

var trim = function () {
    // See <http://blog.stevenlevithan.com/archives/faster-trim-javascript>
    var    lSpace = /^ss*/,
        rSpace = /ss*$/;
    return function (str) {
        return str.replace(lSpace, "").replace(rSpace, "");
    };
}();

// This is much faster than simple use of innerHTML in some browsers
// See <http://blog.stevenlevithan.com/archives/faster-than-innerhtml>
function replaceHtml (el, html) {
    var oldEl = $(el);
    /*@cc_on // Pure innerHTML is slightly faster in IE
        oldEl.innerHTML = html;
        return oldEl;
    @*/
    var newEl = oldEl.cloneNode(false);
    newEl.innerHTML = html;
    oldEl.parentNode.replaceChild(newEl, oldEl);
    /* Since we just removed the old element from the DOM, return a reference
    to the new element, which can be used to restore variable references. */
    return newEl;
};

/* outerHTML is used to work around the fact that IE applies text normalization when using innerHTML,
which can cause problems with whitespace, etc. Note that even this approach doesn't work with some
elements such as <div>. However, it mostly works with <pre> elements, at least. */
function replaceOuterHtml (el, html) {
    el = replaceHtml(el, "");
    if (el.outerHTML) { // If IE
        var    id = el.id,
            className = el.className,
            nodeName = el.nodeName;
        el.outerHTML = "<" + nodeName + " id="" + id + "" class="" + className + "">" + html + "</" + nodeName + ">";
        el = $(id); // Reassign, since we just overwrote the element in the DOM
    } else {
        el.innerHTML = html;
    }
    return el;
};

// Return an array of all elements with a specified class name, optionally filtered by tag name and parent
function getElementsByClassName (className, tagName, parentNode) {
    var    els = ($(parentNode) || document).getElementsByTagName(tagName || "*"),
        results = [];
    for (var i = 0; i < els.length; i++) {
        if (hasClass(className, els[i])) results.push(els[i]);
    }
    return results;
};

function hasClass (className, el) {
    /* It might not make sense to cache all regexes in a more widely used hasClass function,
    but RegexPal uses it with a small number of classes so there is little memory overhead. */
    return XRegExp.cache("(?:^|s)" + className + "(?:s|$)").test($(el).className);
};

function addClass (className, el) {
    el = $(el);
    if (!hasClass(className, el)) {
        el.className = trim(el.className + " " + className);
    }
};

function removeClass (className, el) {
    el = $(el);
    el.className = trim(el.className.replace(XRegExp.cache("(?:^|s)" + className + "(?:s|$)", "g"), " "));
};

function toggleClass (className, el) {
    if (hasClass(className, el)) {
        removeClass(className, el);
    } else {
        addClass(className, el);
    }
};

function swapClass (oldClass, newClass, el) {
    removeClass(oldClass, el);
    addClass(newClass, el);
};

function replaceSelection (textbox, str) {
    if (textbox.setSelectionRange) {
        var    start = textbox.selectionStart,
            end = textbox.selectionEnd,
            offset = (start + str.length);
        textbox.value = (textbox.value.substring(0, start) + str + textbox.value.substring(end));
        textbox.setSelectionRange(offset, offset);
    } else if (document.selection) { // If IE (Opera has setSelectionRange and Selection objects)
        var range = document.selection.createRange();
        range.text = str;
        range.select();
    }
};

function extend (to, from) {
    for (var property in from) to[property] = from[property];
    return to;
};

// purge by Douglas Crockford <http://javascript.crockford.com/memory/leak.html>
function purge (d) {
    var a = d.attributes, i, l, n;
    if (a) {
        l = a.length;
        for (i = 0; i < l; i += 1) {
            n = a[i].name;
            if (typeof d[n] === 'function') {
                d[n] = null;
            }
        }
    }
    a = d.childNodes;
    if (a) {
        l = a.length;
        for (i = 0; i < l; i += 1) {
            purge(d.childNodes[i]);
        }
    }
};

// Sniff
var    isWebKit = navigator.userAgent.indexOf("WebKit") > -1,
    isIE /*@cc_on = true @*/,
    isIE6 = isIE && !window.XMLHttpRequest; // Despite the variable name, this means if IE lower than v7

// RegexPal also needs an Array.prototype.indexOf method, but it's provided by XRegExp
			
16 - Parsing Markdown in Under 100 Lines of Javascript
if (typeof markdown === 'undefined') var markdown = {
parse: function (s) {
    var r = s, ii, pre1 = [], pre2 = [];

    // detect newline format
    var newline = r.indexOf('\r\n') != -1 ? '\r\n' : r.indexOf('\n') != -1 ? '\n' : ''
    
    // store CONSTANT "{ unformatted blocks": not defined !} and <pre> pre-formatted blocks </pre>
    r = r.replace(/CONSTANT "{": not defined !}/g, function (x) { pre1.push(x.substring(3, x.length - 3)); return 'CONSTANT "{": not defined !}'; });
    r = r.replace(new RegExp('<pre>([\\s\\S]*?)</pre>', 'gi'), function (x) { pre2.push(x.substring(5, x.length - 6)); return '<pre></pre>'; });
    
    // h1 - h4 and hr
    r = r.replace(/^==== (.*)=*/gm, '<h4>$1</h4>');
    r = r.replace(/^=== (.*)=*/gm, '<h3>$1</h3>');
    r = r.replace(/^== (.*)=*/gm, '<h2>$1</h2>');
    r = r.replace(/^= (.*)=*/gm, '<h1>$1</h1>');
    r = r.replace(/^[-*][-*][-*]+/gm, '<hr>');
    
    // bold, italics, and code formatting
    r = r.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
    r = r.replace(new RegExp('//(((?!https?://).)*?)//', 'g'), '<em>$1</em>');
    r = r.replace(/``(.*?)``/g, '<code>$1</code>');
    
    // unordered lists
    r = r.replace(/^\*\*\*\* (.*)/gm, '<ul><ul><ul><ul><li>$1</li></ul></ul></ul></ul>');
    r = r.replace(/^\*\*\* (.*)/gm, '<ul><ul><ul><li>$1</li></ul></ul></ul>');
    r = r.replace(/^\*\* (.*)/gm, '<ul><ul><li>$1</li></ul></ul>');
    r = r.replace(/^\* (.*)/gm, '<ul><li>$1</li></ul>');
    for (ii = 0; ii < 3; ii++) r = r.replace(new RegExp('</ul>' + newline + '<ul>', 'g'), newline);
    
    // ordered lists
    r = r.replace(/^#### (.*)/gm, '<ol><ol><ol><ol><li>$1</li></ol></ol></ol></ol>');
    r = r.replace(/^### (.*)/gm, '<ol><ol><ol><li>$1</li></ol></ol></ol>');
    r = r.replace(/^## (.*)/gm, '<ol><ol><li>$1</li></ol></ol>');
    r = r.replace(/^# (.*)/gm, '<ol><li>$1</li></ol>');
    for (ii = 0; ii < 3; ii++) r = r.replace(new RegExp('</ol>' + newline + '<ol>', 'g'), newline);
    
    // links
    r = r.replace(/\[\[(http:[^\]|]*?)\]\]/g, '<a target="_blank" href="$1">$1</a>');
    r = r.replace(/\[\[(http:[^|]*?)\|(.*?)\]\]/g, '<a target="_blank" href="$1">$2</a>');
    r = r.replace(/\[\[([^\]|]*?)\]\]/g, '<a href="$1">$1</a>');
    r = r.replace(/\[\[([^|]*?)\|(.*?)\]\]/g, '<a href="$1">$2</a>');
    
    // images
    r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">');
    r = r.replace(/{{([^|]*?)\|(.*?)}}/g, '<img src="$1" alt="$2">');
    
    // video
    r = r.replace(/<<(.*?)>>/g, '<embed class="video" src="$1" allowfullscreen="true" allowscriptaccess="never" type="application/x-shockwave/flash"></embed>');
    
    // hard linebreak if there are 2 or more spaces at the end of a line
    r = r.replace(new RegExp(' + ' + newline, 'g'), '<br>' + newline);
    
    // split on double-newlines, then add paragraph tags when the first tag isn't a block level element
    if (newline != '') for (var p = r.split(newline + newline), i = 0; i < p.length; i++) {
        var blockLevel = false;
        if (p[i].length >= 1 && p[i].charAt(0) == '<') {
            // check if the first tag is a block-level element
            var firstSpace = p[i].indexOf(' '), firstCloseTag = p[i].indexOf('>');
            var endIndex = firstSpace > -1 && firstCloseTag > -1 ? Math.min(firstSpace, firstCloseTag) : firstSpace > -1 ? firstSpace : firstCloseTag;
            var tag = p[i].substring(1, endIndex).toLowerCase();
            for (var j = 0; j < blockLevelElements.length; j++) if (blockLevelElements[j] == tag) blockLevel = true;
        } else if (p[i].length >= 1 && p[i].charAt(0) == '|') {
            // format the paragraph as a table
            blockLevel = true;
            p[i] = p[i].replace(/ \|= /g, '</th><th>').replace(/\|= /g, '<tr><th>').replace(/ \|=/g, '</th></tr>');
            p[i] = p[i].replace(/ \| /g, '</td><td>').replace(/\| /g, '<tr><td>').replace(/ \|/g, '</td></tr>');
            p[i] = '<table>' + p[i] + '</table>';
        } else if (p[i].length >= 2 && p[i].charAt(0) == '>' && p[i].charAt(1) == ' ') {
            // format the paragraph as a blockquote
            blockLevel = true;
            p[i] = '<blockquote>' + p[i].replace(/^> /gm, '') + '</blockquote>';
        }
        if (!blockLevel) p[i] = '<p>' + p[i] + '</p>';
    }
    
    // reassemble the paragraphs
    if (newline != '') r = p.join(newline + newline);
    
    // restore the preformatted and unformatted blocks
    r = r.replace(new RegExp('<pre></pre>', 'g'), function (match) { return '<pre>' + pre2.shift() + '</pre>'; });
    r = r.replace(/CONSTANT "{": not defined !}/g, function (match) { return pre1.shift(); });
    return r;
}
};

// markdown.parse(myText)

/*
= Heading 1
== Heading 2
=== Heading 3
==== Heading 4

**bold**
//italic//

* Bullet list
* Second item
** Sub item

# Numbered list
# Second item
## Sub item

[[link]]
CONSTANT "image": not defined !
<<video>>

|= table |= hdr |=
| table | row |
| table | row |

> blockquote

CONSTANT "{ unformatted text": not defined !}
--- horizontal rule

*/
			
17 - Se passer de JQuery
Évènements

// jQuery
$(document).ready(function() {
  // code
})

// Vanilla
document.addEventListener('DOMContentLoaded', function() {
  // code
})
// jQuery
$('a').click(function() {
  // code…
})

// Vanilla
[].forEach.call(document.querySelectorAll('a'), function(el) {
  el.addEventListener('click', function() {
    // code…
  })
})
Sélecteurs

// jQuery
var divs = $('div')

// Vanilla
var divs = document.querySelectorAll('div')
// jQuery
var newDiv = $('<div/>')

// Vanilla
var newDiv = document.createElement('div')
Attributs

// jQuery
$('img').filter(':first').attr('alt', 'My image')

// Vanilla
document.querySelector('img').setAttribute('alt', 'My image')
Classes

// jQuery
newDiv.addClass('foo')

// Vanilla
newDiv.classList.add('foo')
// jQuery
newDiv.toggleClass('foo')

// Vanilla
newDiv.classList.toggle('foo')
Manipulation

// jQuery
$('body').append($('<p/>'))

// Vanilla
document.body.appendChild(document.createElement('p'))
// jQuery
var clonedElement = $('#about').clone()

// Vanilla
var clonedElement = document.getElementById('about').cloneNode(true)
// jQuery
$('#wrap').empty()

// Vanilla
var wrap = document.getElementById('wrap')
while(wrap.firstChild) wrap.removeChild(wrap.firstChild)
Navigation

// jQuery
var parent = $('#about').parent()

// Vanilla
var parent = document.getElementById('about').parentNode
// jQuery
if($('#wrap').is(':empty'))

// Vanilla
if(!document.getElementById('wrap').hasChildNodes())
// jQuery
var nextElement = $('#wrap').next()

// Vanilla
var nextElement = document.getElementById('wrap').nextSibling
AJAX

GET

// jQuery
$.get('//example.com', function (data) {
  // code
})

// Vanilla
var httpRequest = new XMLHttpRequest()
httpRequest.onreadystatechange = function (data) {
  // code
}
httpRequest.open('GET', url)
httpRequest.send()
POST

// jQuery
$.post('//example.com', { username: username }, function (data) {
  // code
})

// Vanilla
var httpRequest = new XMLHttpRequest()
httpRequest.onreadystatechange = function (data) {
  // code
}
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
httpRequest.open('POST', url)
httpRequest.send('username=' + encodeURIComponent(username))
JSONP

// jQuery
$.getJSON('//openexchangerates.org/latest.json?callback=?', function (data) {
  // code
})

// Vanilla
function success(data) {
  // code
}
var scr = document.createElement('script')
scr.src = '//openexchangerates.org/latest.json?callback=formatCurrency'
document.body.appendChild(scr)
			
18 - Demander confirmation de la fermeture d'un onglet
var confirmOnLeave = function(msg) {
 
    window.onbeforeunload = function (e) {
        e = e || window.event;
        msg = msg || '';
 
        // For IE and Firefox
        if (e) {e.returnValue = msg;}
 
        // For Chrome and Safari
        return msg;
    };
 
};
 
// message de confirmation générique du navigateur
confirmOnLeave();
 
// message de confirmation personnalisé
confirmOnLeave('Vous allez perdre votre travail, êtes vous sûr(e) de vouloir quitter la page ?');
			
19 - boutons sociaux simples js pur
<button class="button share_twitter" data-url="http://....">
    Partager sur twitter
</button>
<button class="button share_facebook" data-url="http://....">
    Partager sur facebook
</button>
<button class="button share_gplus" data-url="http://....">
    Partager sur google+
</button>
<button class="button share_linkedin" data-url="http://....">
    Partager sur linkedin
</button>
<script>
(function(){

    var popupCenter = function(url, title, width, height){
        var popupWidth = width || 640;
        var popupHeight = height || 320;
        var windowLeft = window.screenLeft || window.screenX;
        var windowTop = window.screenTop || window.screenY;
        var windowWidth = window.innerWidth || document.documentElement.clientWidth;
        var windowHeight = window.innerHeight || document.documentElement.clientHeight;
        var popupLeft = windowLeft + windowWidth / 2 - popupWidth / 2 ;
        var popupTop = windowTop + windowHeight / 2 - popupHeight / 2;
        var popup = window.open(url, title, 'scrollbars=yes, width=' + popupWidth + ', height=' + popupHeight + ', top=' + popupTop + ', left=' + popupLeft);
        popup.focus();
        return true;
    };

    document.querySelector('.share_twitter').addEventListener('click', function(e){
        e.preventDefault();
        var url = this.getAttribute('data-url');
        var shareUrl = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(document.title) +
            "&via=Grafikart_fr" +
            "&url=" + encodeURIComponent(url);
        popupCenter(shareUrl, "Partager sur Twitter");
    });

    document.querySelector('.share_facebook').addEventListener('click', function(e){
        e.preventDefault();
        var url = this.getAttribute('data-url');
        var shareUrl = "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(url);
        popupCenter(shareUrl, "Partager sur facebook");
    });

    document.querySelector('.share_gplus').addEventListener('click', function(e){
        e.preventDefault();
        var url = this.getAttribute('data-url');
        var shareUrl = "https://plus.google.com/share?url=" + encodeURIComponent(url);
        popupCenter(shareUrl, "Partager sur Google+");
    });

    document.querySelector('.share_linkedin').addEventListener('click', function(e){
        e.preventDefault();
        var url = this.getAttribute('data-url');
        var shareUrl = "https://www.linkedin.com/shareArticle?url=" + encodeURIComponent(url);
        popupCenter(shareUrl, "Partager sur Linkedin");
    });

})();
</script>
			
20 - ITALIC™ » Générer un password en Javascript
<script type="text/javascript">

    function generer_password(champ_cible) {
        var ok = 'azertyupqsdfghjkmwxcvbn23456789AZERTYUPQSDFGHJKMWXCVBN';
        var pass = '';
        longueur = 5;
        for(i=0;i<longueur;i++){
            var wpos = Math.round(Math.random()*ok.length);
            pass+=ok.substring(wpos,wpos+1);
        }
        document.getElementById(champ_cible).value = pass;
    }
    /*
       <input name="password" id="password" type="text" />
       <input type="button" name="generer" value="Générer" onclick="javascript:generer_password('password');" />
     */
</script>


			
21 - [JavaScript] detect down/up scrolling - Le Hollandais Volant
// Initial state
var scrollPos = 0;
// adding scroll event
window.addEventListener('scroll', function(){ scrolling() });

// the function : compares the "new" scrolling state with the previous
// (this allows detecting either "up" or "down" scrolling)
// then saves the new in the $previous for the next iteration.

function scrolling() {
	if ((document.body.getBoundingClientRect()).top > scrollPos) {
		console.log('scrolling DOWN');
	} else {
		console.log('scrolling UP');
	}
	scrollPos = (document.body.getBoundingClientRect()).top;
}


			
22 - detect down/up scrolling
// Initial state
var scrollPos = 0;
// adding scroll event
window.addEventListener('scroll', function(){ scrolling() });

// the function : compares the "new" scrolling state with the previous
// (this allows detecting either "up" or "down" scrolling)
// then saves the new in the $previous for the next iteration.

function scrolling() {
	if ((document.body.getBoundingClientRect()).top > scrollPos) {
		console.log('scrolling DOWN');
	} else {
		console.log('scrolling UP');
	}
	scrollPos = (document.body.getBoundingClientRect()).top;
}
			
25 - Ajouter un copyright lors de la copie
/** mise en place du copyright **/
$(document).ready(function(){
	$(document).on('copy',function(){
		body=document.getElementsByTagName('body')[0];
		selection=getSelection();
		copyright=selection+"<br /><br /> &copy; Le Télégramme  - Plus d’information sur "+location.href;
		copyElm=document.createElement('div');
		body.appendChild(copyElm);
		//copyElm.style.display='none';
		copyElm.innerHTML=copyright;
		selection.selectAllChildren(copyElm);
		copyElm.style.left='-99999px';
		setTimeout(function(){body.removeChild(copyElm)},0)	
	});
	$(document).on('cut',function(){
		$(document).trigger('copy');
	});
});


			
27 - Récupérer les paramètres GET d’une URL avec JavaScript - JavaScript / jQuery | Creative Juiz
/*http://mondomaine.tld/?name=geoffrey

<?php
	echo $_GET['name']; // affiche 'geoffrey'
?>

http://mondomaine.tld/?name=geoffrey&age=42

<?php
	echo $_GET['name']; // affiche 'geoffrey'
	echo $_GET['age']; // affiche '42'
?>
*/

function $_GET(param) {
	var vars = {};
	window.location.href.replace( 
		/[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
		function( m, key, value ) { // callback
			vars[key] = value !== undefined ? value : '';
		}
	);

	if ( param ) {
		return vars[param] ? vars[param] : null;	
	}
	return vars;
}

/*
Avec cette fonction JavaScript, vous avez deux utilisations différentes :

var name = $_GET('name'),
    age = $_GET('age');

ou, méthode plus performante :

var $_GET = $_GET(),
    name = $_GET['name'],
    age = $_GET['age'];
*/
			
29 - fonction trigger pour déclencher un évènement
       if (typeof obj=='string'){obj=document.getElementById(obj);}
            if (window.CustomEvent) {
              var event = new CustomEvent(ev, {detail: {some: 'data'}})
            } else {
              var event = document.createEvent('CustomEvent')
              event.initCustomEvent('ev', true, true, {some: 'data'})
            }

            obj.dispatchEvent(event)
        }
			
30 - dropdown - exemples
<div class="dropdown">
  <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
    Dropdown
    <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
  </ul>
</div>
<div class="dropup">
  <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-expanded="true">
    Dropdown
    <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu2">
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
  </ul>
</div>


avec headers
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu3">
  ...
  <li role="presentation" class="dropdown-header">Dropdown header</li>
  ...
</ul>



avec séparateurs
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenuDivider">
  ...
  <li role="presentation" class="divider"></li>
  ...
</ul>

			
31 - button dropdown menus
<!-- Single button -->
<div class="btn-group">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
    Action <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li class="divider"></li>
    <li><a href="#">Separated link</a></li>
  </ul>
</div>



<!-- Split button -->
<div class="btn-group">
  <button type="button" class="btn btn-danger">Action</button>
  <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
    <span class="caret"></span>
    <span class="sr-only">Toggle Dropdown</span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li class="divider"></li>
    <li><a href="#">Separated link</a></li>
  </ul>
</div>
			
32 - Menu en accordeon
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingOne">
      <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </a>
      </h4>
    </div>
    <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
      <div class="panel-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingTwo">
      <h4 class="panel-title">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </a>
      </h4>
    </div>
    <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
      <div class="panel-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingThree">
      <h4 class="panel-title">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </a>
      </h4>
    </div>
    <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
      <div class="panel-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
</div>
			
33 - Collapse un div via un bouton
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
  Link with href
</a>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
  Button with data-target
</button>
<div class="collapse" id="collapseExample">
  <div class="well">
    ...
  </div>
</div>
			
34 - checkbox et radio sous forme de boutons
<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-primary active">
    <input type="checkbox" autocomplete="off" checked> Checkbox 1 (pre-checked)
  </label>
  <label class="btn btn-primary">
    <input type="checkbox" autocomplete="off"> Checkbox 2
  </label>
  <label class="btn btn-primary">
    <input type="checkbox" autocomplete="off"> Checkbox 3
  </label>
</div>

<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-primary active">
    <input type="radio" name="options" id="option1" autocomplete="off" checked> Radio 1 (preselected)
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option2" autocomplete="off"> Radio 2
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option3" autocomplete="off"> Radio 3
  </label>
</div>
			
35 - tooltip
<a href="#" data-toggle="tooltip" title="" data-original-title="Default tooltip">you probably</a>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button>
			
36 - alert modale
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

// pour détecter la fermeture de la boite
$('#myModal').on('hidden.bs.modal', function (e) {
  // do something...
})

On peut alors recupérer les données saisies 
autres events: show.bs.modal shown.bs.modal hidden.bs.modal loaded.bs.modal
			
37 - Markdown Tables Generator 2
http://www.tablesgenerator.com/static/js/combined.160.js

-----


(adsbygoogle = window.adsbygoogle || []).push({});

$(document).ready( function() {
   init('#edited_table_container');
});

function show_result_code(code) {
    $('#result-code').text(code);
    Prism.highlightElement($('#result-code')[0]);
}

function init(parent_container) {
    var table = new TableModel();
    table.insertRow( [''] );

    var tv = new TableView( table, parent_container );
    var ignore = { text_color: true, bg_color: true, font_style: true,
                   fixed_layout: true,
                   borders: true, colspan: true, rowspan: true, theme: true };
    tv.setLoadIgnore(ignore);
    tv.on('cell_created', function (cv) {
        cv.style.setBorders('lrtb');
    } );
    table.resize(5, 5);
    table.removeRow(0);

    var main_ui = new MainUI(tv);

    $('<button class="btn"><i class="icon-cogs"></i> Generate</button>')
        .appendTo( $('#edited_table_container') ).click(generate); 

    var gen_opt_box = $('<div/>', { 'class': 'tab-gen-opt-box' })
        .appendTo($('#edited_table_container'));

    var use_elastic_tabs = $('<input type="checkbox">');
    $('<label/>', { 'class': 'checkbox tab-gen-option' })
        .text('Put tabs between columns')
        .attr('title', 'Useful when your external editor supports elastic tabstops')
        .append(use_elastic_tabs)
        .appendTo(gen_opt_box)
        .change(generate);

    var compact_mode = $('<input type="checkbox">');
    $('<label/>', { 'class': 'checkbox tab-gen-option' })
        .text('Compact mode')
        .attr('title', 'Do not add extra spaces to align the cells')
        .append(compact_mode)
        .appendTo(gen_opt_box)
        .change(generate);


    function generate() {
        var output = MarkdownExport(tv,
                use_elastic_tabs.is(':checked'),
                compact_mode.is(':checked'));
        show_result_code(output);
    }

    $('#show_example_btn').click( function () { 
        example(tv); 
        generate();
    } );

    

    
    generate();
}


function example(table_view) {
    table_view.reset();
    var model = table_view.model;
    var rows = [
        ['Tables', 'Are', 'Cool'],
        ['col 1 is', 'left-aligned', '$1600'],
        ['col 2 is', 'centered', '$12'],
        ['col 3 is', 'right-aligned', '$1']
    ];

    model.setRows(rows);
    table_view.forEachCellViewInRange( function(cv) {
                cv.style.setHorizontalAlign('center');
            }, 0, 1, 3, 1);
    table_view.forEachCellViewInRange( function(cv) {
                cv.style.setHorizontalAlign('right');
            }, 0, 2, 3, 2);
}


      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-40666600-1']);
      _gaq.push(['_setDomainName', 'tablesgenerator.com']);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    
			
38 - Markdown Tables Generator
(function(c, g) {
    "object" === typeof module && "object" === typeof module.exports ? module.exports = c.document ? g(c, !0) : function(c) {
        if (!c.document) throw Error("jQuery requires a window with a document");
        return g(c)
    } : g(c)
})("undefined" !== typeof window ? window : this, function(c, g) {
    function e(l) {
        var a = l.length,
            b = h.type(l);
        return "function" === b || h.isWindow(l) ? !1 : 1 === l.nodeType && a ? !0 : "array" === b || 0 === a || "number" === typeof a && 0 < a && a - 1 in l
    }

    function b(l, a, b) {
        if (h.isFunction(a)) return h.grep(l, function(l, c) {
            return !!a.call(l,
                c, l) !== b
        });
        if (a.nodeType) return h.grep(l, function(l) {
            return l === a !== b
        });
        if ("string" === typeof a) {
            if (z.test(a)) return h.filter(a, l, b);
            a = h.filter(a, l)
        }
        return h.grep(l, function(l) {
            return 0 <= h.inArray(l, a) !== b
        })
    }

    function d(l, a) {
        do l = l[a]; while (l && 1 !== l.nodeType);
        return l
    }

    function a(l) {
        var a = Da[l] = {};
        h.each(l.match(V) || [], function(l, b) {
            a[b] = !0
        });
        return a
    }

    function f() {
        H.addEventListener ? (H.removeEventListener("DOMContentLoaded", k, !1), c.removeEventListener("load", k, !1)) : (H.detachEvent("onreadystatechange",
            k), c.detachEvent("onload", k))
    }

    function k() {
        if (H.addEventListener || "load" === event.type || "complete" === H.readyState) f(), h.ready()
    }

    function n(l, a, b) {
        if (void 0 === b && 1 === l.nodeType)
            if (b = "data-" + a.replace(ta, "-$1").toLowerCase(), b = l.getAttribute(b), "string" === typeof b) {
                try {
                    b = "true" === b ? !0 : "false" === b ? !1 : "null" === b ? null : +b + "" === b ? +b : Aa.test(b) ? h.parseJSON(b) : b
                } catch (c) {}
                h.data(l, a, b)
            } else b = void 0;
        return b
    }

    function p(l) {
        for (var a in l)
            if (("data" !== a || !h.isEmptyObject(l[a])) && "toJSON" !== a) return !1;
        return !0
    }

    function m(l, a, b, c) {
        if (h.acceptData(l)) {
            var d = h.expando,
                f = l.nodeType,
                e = f ? h.cache : l,
                r = f ? l[d] : l[d] && d;
            if (r && e[r] && (c || e[r].data) || void 0 !== b || "string" !== typeof a) {
                r || (r = f ? l[d] = ra.pop() || h.guid++ : d);
                e[r] || (e[r] = f ? {} : {
                    toJSON: h.noop
                });
                if ("object" === typeof a || "function" === typeof a) c ? e[r] = h.extend(e[r], a) : e[r].data = h.extend(e[r].data, a);
                l = e[r];
                c || (l.data || (l.data = {}), l = l.data);
                void 0 !== b && (l[h.camelCase(a)] = b);
                "string" === typeof a ? (b = l[a], null == b && (b = l[h.camelCase(a)])) : b = l;
                return b
            }
        }
    }

    function q(l, a, b) {
        if (h.acceptData(l)) {
            var c,
                d, f = l.nodeType,
                e = f ? h.cache : l,
                r = f ? l[h.expando] : h.expando;
            if (e[r]) {
                if (a && (c = b ? e[r] : e[r].data)) {
                    h.isArray(a) ? a = a.concat(h.map(a, h.camelCase)) : a in c ? a = [a] : (a = h.camelCase(a), a = a in c ? [a] : a.split(" "));
                    for (d = a.length; d--;) delete c[a[d]];
                    if (b ? !p(c) : !h.isEmptyObject(c)) return
                }
                if (!b && (delete e[r].data, !p(e[r]))) return;
                f ? h.cleanData([l], !0) : F.deleteExpando || e != e.window ? delete e[r] : e[r] = null
            }
        }
    }

    function t() {
        return !0
    }

    function x() {
        return !1
    }

    function B() {
        try {
            return H.activeElement
        } catch (l) {}
    }

    function v(l) {
        var a =
            Pa.split("|");
        l = l.createDocumentFragment();
        if (l.createElement)
            for (; a.length;) l.createElement(a.pop());
        return l
    }

    function C(l, a) {
        var b, c, d = 0,
            f = "undefined" !== typeof l.getElementsByTagName ? l.getElementsByTagName(a || "*") : "undefined" !== typeof l.querySelectorAll ? l.querySelectorAll(a || "*") : void 0;
        if (!f)
            for (f = [], b = l.childNodes || l; null != (c = b[d]); d++) !a || h.nodeName(c, a) ? f.push(c) : h.merge(f, C(c, a));
        return void 0 === a || a && h.nodeName(l, a) ? h.merge([l], f) : f
    }

    function K(l) {
        ua.test(l.type) && (l.defaultChecked = l.checked)
    }

    function A(l, a) {
        return h.nodeName(l, "table") && h.nodeName(11 !== a.nodeType ? a : a.firstChild, "tr") ? l.getElementsByTagName("tbody")[0] || l.appendChild(l.ownerDocument.createElement("tbody")) : l
    }

    function y(l) {
        l.type = (null !== h.find.attr(l, "type")) + "/" + l.type;
        return l
    }

    function E(l) {
        var a = Ta.exec(l.type);
        a ? l.type = a[1] : l.removeAttribute("type");
        return l
    }

    function N(l, a) {
        for (var b, c = 0; null != (b = l[c]); c++) h._data(b, "globalEval", !a || h._data(a[c], "globalEval"))
    }

    function I(l, a) {
        if (1 === a.nodeType && h.hasData(l)) {
            var b,
                c, d;
            c = h._data(l);
            var f = h._data(a, c),
                e = c.events;
            if (e)
                for (b in delete f.handle, f.events = {}, e)
                    for (c = 0, d = e[b].length; c < d; c++) h.event.add(a, b, e[b][c]);
            f.data && (f.data = h.extend({}, f.data))
        }
    }

    function Z(l, a) {
        var b, d = h(a.createElement(l)).appendTo(a.body),
            f = c.getDefaultComputedStyle && (b = c.getDefaultComputedStyle(d[0])) ? b.display : h.css(d[0], "display");
        d.detach();
        return f
    }

    function G(l) {
        var a = H,
            b = xb[l];
        b || (b = Z(l, a), "none" !== b && b || (gb = (gb || h("<iframe frameborder='0' width='0' height='0'/>")).appendTo(a.documentElement),
            a = (gb[0].contentWindow || gb[0].contentDocument).document, a.write(), a.close(), b = Z(l, a), gb.detach()), xb[l] = b);
        return b
    }

    function P(l, a) {
        return {
            get: function() {
                var b = l();
                if (null != b)
                    if (b) delete this.get;
                    else return (this.get = a).apply(this, arguments)
            }
        }
    }

    function U(l, a) {
        if (a in l) return a;
        for (var b = a.charAt(0).toUpperCase() + a.slice(1), c = a, d = yb.length; d--;)
            if (a = yb[d] + b, a in l) return a;
        return c
    }

    function Ba(l, a) {
        for (var b, c, d, f = [], e = 0, r = l.length; e < r; e++) c = l[e], c.style && (f[e] = h._data(c, "olddisplay"), b = c.style.display,
            a ? (f[e] || "none" !== b || (c.style.display = ""), "" === c.style.display && Ea(c) && (f[e] = h._data(c, "olddisplay", G(c.nodeName)))) : (d = Ea(c), (b && "none" !== b || !d) && h._data(c, "olddisplay", d ? b : h.css(c, "display"))));
        for (e = 0; e < r; e++) c = l[e], !c.style || a && "none" !== c.style.display && "" !== c.style.display || (c.style.display = a ? f[e] || "" : "none");
        return l
    }

    function R(l, a, b) {
        return (l = Mb.exec(a)) ? Math.max(0, l[1] - (b || 0)) + (l[2] || "px") : a
    }

    function la(l, a, b, c, d) {
        a = b === (c ? "border" : "content") ? 4 : "width" === a ? 1 : 0;
        for (var f = 0; 4 > a; a += 2) "margin" ===
            b && (f += h.css(l, b + ga[a], !0, d)), c ? ("content" === b && (f -= h.css(l, "padding" + ga[a], !0, d)), "margin" !== b && (f -= h.css(l, "border" + ga[a] + "Width", !0, d))) : (f += h.css(l, "padding" + ga[a], !0, d), "padding" !== b && (f += h.css(l, "border" + ga[a] + "Width", !0, d)));
        return f
    }

    function Ha(l, a, b) {
        var c = !0,
            d = "width" === a ? l.offsetWidth : l.offsetHeight,
            f = Xa(l),
            e = F.boxSizing && "border-box" === h.css(l, "boxSizing", !1, f);
        if (0 >= d || null == d) {
            d = Ya(l, a, f);
            if (0 > d || null == d) d = l.style[a];
            if (kb.test(d)) return d;
            c = e && (F.boxSizingReliable() || d === l.style[a]);
            d = parseFloat(d) || 0
        }
        return d + la(l, a, b || (e ? "border" : "content"), c, f) + "px"
    }

    function J(l, a, b, c, d) {
        return new J.prototype.init(l, a, b, c, d)
    }

    function ja() {
        setTimeout(function() {
            cb = void 0
        });
        return cb = h.now()
    }

    function ca(l, a) {
        var b, c = {
                height: l
            },
            d = 0;
        for (a = a ? 1 : 0; 4 > d; d += 2 - a) b = ga[d], c["margin" + b] = c["padding" + b] = l;
        a && (c.opacity = c.width = l);
        return c
    }

    function aa(l, a, b) {
        for (var c, d = (hb[a] || []).concat(hb["*"]), f = 0, e = d.length; f < e; f++)
            if (c = d[f].call(b, a, l)) return c
    }

    function s(l, a) {
        var b, c, d, f, e;
        for (b in l)
            if (c = h.camelCase(b),
                d = a[c], f = l[b], h.isArray(f) && (d = f[1], f = l[b] = f[0]), b !== c && (l[c] = f, delete l[b]), (e = h.cssHooks[c]) && "expand" in e)
                for (b in f = e.expand(f), delete l[c], f) b in l || (l[b] = f[b], a[b] = d);
            else a[c] = d
    }

    function T(l, a, b) {
        var c, d = 0,
            f = lb.length,
            e = h.Deferred().always(function() {
                delete r.elem
            }),
            r = function() {
                if (c) return !1;
                for (var a = cb || ja(), a = Math.max(0, k.startTime + k.duration - a), b = 1 - (a / k.duration || 0), d = 0, f = k.tweens.length; d < f; d++) k.tweens[d].run(b);
                e.notifyWith(l, [k, b, a]);
                if (1 > b && f) return a;
                e.resolveWith(l, [k]);
                return !1
            },
            k = e.promise({
                elem: l,
                props: h.extend({}, a),
                opts: h.extend(!0, {
                    specialEasing: {}
                }, b),
                originalProperties: a,
                originalOptions: b,
                startTime: cb || ja(),
                duration: b.duration,
                tweens: [],
                createTween: function(a, b) {
                    var c = h.Tween(l, k.opts, a, b, k.opts.specialEasing[a] || k.opts.easing);
                    k.tweens.push(c);
                    return c
                },
                stop: function(a) {
                    var b = 0,
                        d = a ? k.tweens.length : 0;
                    if (c) return this;
                    for (c = !0; b < d; b++) k.tweens[b].run(1);
                    a ? e.resolveWith(l, [k, a]) : e.rejectWith(l, [k, a]);
                    return this
                }
            });
        b = k.props;
        for (s(b, k.opts.specialEasing); d < f; d++)
            if (a =
                lb[d].call(k, l, b, k.opts)) return a;
        h.map(b, aa, k);
        h.isFunction(k.opts.start) && k.opts.start.call(l, k);
        h.fx.timer(h.extend(r, {
            elem: l,
            anim: k,
            queue: k.opts.queue
        }));
        return k.progress(k.opts.progress).done(k.opts.done, k.opts.complete).fail(k.opts.fail).always(k.opts.always)
    }

    function S(l) {
        return function(a, b) {
            "string" !== typeof a && (b = a, a = "*");
            var c, d = 0,
                f = a.toLowerCase().match(V) || [];
            if (h.isFunction(b))
                for (; c = f[d++];) "+" === c.charAt(0) ? (c = c.slice(1) || "*", (l[c] = l[c] || []).unshift(b)) : (l[c] = l[c] || []).push(b)
        }
    }

    function ya(l,
        a, b, c) {
        function d(r) {
            var k;
            f[r] = !0;
            h.each(l[r] || [], function(l, h) {
                var r = h(a, b, c);
                if ("string" === typeof r && !e && !f[r]) return a.dataTypes.unshift(r), d(r), !1;
                if (e) return !(k = r)
            });
            return k
        }
        var f = {},
            e = l === qb;
        return d(a.dataTypes[0]) || !f["*"] && d("*")
    }

    function ka(l, a) {
        var b, c, d = h.ajaxSettings.flatOptions || {};
        for (c in a) void 0 !== a[c] && ((d[c] ? l : b || (b = {}))[c] = a[c]);
        b && h.extend(!0, l, b);
        return l
    }

    function w(l, a, b, c) {
        var d;
        if (h.isArray(a)) h.each(a, function(a, d) {
            b || Nb.test(l) ? c(l, d) : w(l + "[" + ("object" === typeof d ? a : "") +
                "]", d, b, c)
        });
        else if (b || "object" !== h.type(a)) c(l, a);
        else
            for (d in a) w(l + "[" + d + "]", a[d], b, c)
    }

    function M() {
        try {
            return new c.XMLHttpRequest
        } catch (l) {}
    }

    function za(l) {
        return h.isWindow(l) ? l : 9 === l.nodeType ? l.defaultView || l.parentWindow : !1
    }
    var ra = [],
        sa = ra.slice,
        Ja = ra.concat,
        W = ra.push,
        Ka = ra.indexOf,
        va = {},
        xa = va.toString,
        Q = va.hasOwnProperty,
        F = {},
        h = function(l, a) {
            return new h.fn.init(l, a)
        },
        db = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
        La = /^-ms-/,
        Ma = /-([\da-z])/gi,
        ha = function(l, a) {
            return a.toUpperCase()
        };
    h.fn = h.prototype = {
        jquery: "1.11.1",
        constructor: h,
        selector: "",
        length: 0,
        toArray: function() {
            return sa.call(this)
        },
        get: function(l) {
            return null != l ? 0 > l ? this[l + this.length] : this[l] : sa.call(this)
        },
        pushStack: function(l) {
            l = h.merge(this.constructor(), l);
            l.prevObject = this;
            l.context = this.context;
            return l
        },
        each: function(l, a) {
            return h.each(this, l, a)
        },
        map: function(l) {
            return this.pushStack(h.map(this, function(a, b) {
                return l.call(a, b, a)
            }))
        },
        slice: function() {
            return this.pushStack(sa.apply(this, arguments))
        },
        first: function() {
            return this.eq(0)
        },
        last: function() {
            return this.eq(-1)
        },
        eq: function(l) {
            var a = this.length;
            l = +l + (0 > l ? a : 0);
            return this.pushStack(0 <= l && l < a ? [this[l]] : [])
        },
        end: function() {
            return this.prevObject || this.constructor(null)
        },
        push: W,
        sort: ra.sort,
        splice: ra.splice
    };
    h.extend = h.fn.extend = function() {
        var l, a, b, c, d, f = arguments[0] || {},
            e = 1,
            r = arguments.length,
            k = !1;
        "boolean" === typeof f && (k = f, f = arguments[e] || {}, e++);
        "object" === typeof f || h.isFunction(f) || (f = {});
        e === r && (f = this, e--);
        for (; e < r; e++)
            if (null != (d = arguments[e]))
                for (c in d) l = f[c], b = d[c],
                    f !== b && (k && b && (h.isPlainObject(b) || (a = h.isArray(b))) ? (a ? (a = !1, l = l && h.isArray(l) ? l : []) : l = l && h.isPlainObject(l) ? l : {}, f[c] = h.extend(k, l, b)) : void 0 !== b && (f[c] = b));
        return f
    };
    h.extend({
        expando: "jQuery" + ("1.11.1" + Math.random()).replace(/\D/g, ""),
        isReady: !0,
        error: function(l) {
            throw Error(l);
        },
        noop: function() {},
        isFunction: function(l) {
            return "function" === h.type(l)
        },
        isArray: Array.isArray || function(l) {
            return "array" === h.type(l)
        },
        isWindow: function(l) {
            return null != l && l == l.window
        },
        isNumeric: function(l) {
            return !h.isArray(l) &&
                0 <= l - parseFloat(l)
        },
        isEmptyObject: function(l) {
            for (var a in l) return !1;
            return !0
        },
        isPlainObject: function(l) {
            var a;
            if (!l || "object" !== h.type(l) || l.nodeType || h.isWindow(l)) return !1;
            try {
                if (l.constructor && !Q.call(l, "constructor") && !Q.call(l.constructor.prototype, "isPrototypeOf")) return !1
            } catch (b) {
                return !1
            }
            if (F.ownLast)
                for (a in l) return Q.call(l, a);
            for (a in l);
            return void 0 === a || Q.call(l, a)
        },
        type: function(l) {
            return null == l ? l + "" : "object" === typeof l || "function" === typeof l ? va[xa.call(l)] || "object" : typeof l
        },
        globalEval: function(l) {
            l && h.trim(l) && (c.execScript || function(l) {
                c.eval.call(c, l)
            })(l)
        },
        camelCase: function(l) {
            return l.replace(La, "ms-").replace(Ma, ha)
        },
        nodeName: function(l, a) {
            return l.nodeName && l.nodeName.toLowerCase() === a.toLowerCase()
        },
        each: function(l, a, b) {
            var c, d = 0,
                f = l.length;
            c = e(l);
            if (b)
                if (c)
                    for (; d < f && (c = a.apply(l[d], b), !1 !== c); d++);
                else
                    for (d in l) {
                        if (c = a.apply(l[d], b), !1 === c) break
                    } else if (c)
                        for (; d < f && (c = a.call(l[d], d, l[d]), !1 !== c); d++);
                    else
                        for (d in l)
                            if (c = a.call(l[d], d, l[d]), !1 === c) break;
            return l
        },
        trim: function(l) {
            return null == l ? "" : (l + "").replace(db, "")
        },
        makeArray: function(l, a) {
            var b = a || [];
            null != l && (e(Object(l)) ? h.merge(b, "string" === typeof l ? [l] : l) : W.call(b, l));
            return b
        },
        inArray: function(l, a, b) {
            var c;
            if (a) {
                if (Ka) return Ka.call(a, l, b);
                c = a.length;
                for (b = b ? 0 > b ? Math.max(0, c + b) : b : 0; b < c; b++)
                    if (b in a && a[b] === l) return b
            }
            return -1
        },
        merge: function(l, a) {
            for (var b = +a.length, c = 0, d = l.length; c < b;) l[d++] = a[c++];
            if (b !== b)
                for (; void 0 !== a[c];) l[d++] = a[c++];
            l.length = d;
            return l
        },
        grep: function(l, a, b) {
            for (var c = [],
                    d = 0, f = l.length, e = !b; d < f; d++) b = !a(l[d], d), b !== e && c.push(l[d]);
            return c
        },
        map: function(l, a, b) {
            var c, d = 0,
                f = l.length,
                h = [];
            if (e(l))
                for (; d < f; d++) c = a(l[d], d, b), null != c && h.push(c);
            else
                for (d in l) c = a(l[d], d, b), null != c && h.push(c);
            return Ja.apply([], h)
        },
        guid: 1,
        proxy: function(l, a) {
            var b, c;
            "string" === typeof a && (c = l[a], a = l, l = c);
            if (h.isFunction(l)) return b = sa.call(arguments, 2), c = function() {
                return l.apply(a || this, b.concat(sa.call(arguments)))
            }, c.guid = l.guid = l.guid || h.guid++, c
        },
        now: function() {
            return +new Date
        },
        support: F
    });
    h.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(l, a) {
        va["[object " + a + "]"] = a.toLowerCase()
    });
    var da = function(l) {
        function a(l, b, c, d) {
            var f, e, h, X, r;
            (b ? b.ownerDocument || b : Z) !== S && s(b);
            b = b || S;
            c = c || [];
            if (!l || "string" !== typeof l) return c;
            if (1 !== (X = b.nodeType) && 9 !== X) return [];
            if (U && !d) {
                if (f = eb.exec(l))
                    if (h = f[1])
                        if (9 === X)
                            if ((e = b.getElementById(h)) && e.parentNode) {
                                if (e.id === h) return c.push(e), c
                            } else return c;
                else {
                    if (b.ownerDocument && (e = b.ownerDocument.getElementById(h)) &&
                        Oa(b, e) && e.id === h) return c.push(e), c
                } else {
                    if (f[2]) return F.apply(c, b.getElementsByTagName(l)), c;
                    if ((h = f[3]) && t.getElementsByClassName && b.getElementsByClassName) return F.apply(c, b.getElementsByClassName(h)), c
                }
                if (t.qsa && (!x || !x.test(l))) {
                    e = f = fa;
                    h = b;
                    r = 9 === X && l;
                    if (1 === X && "object" !== b.nodeName.toLowerCase()) {
                        X = P(l);
                        (f = b.getAttribute("id")) ? e = f.replace(L, "\\$&"): b.setAttribute("id", e);
                        e = "[id='" + e + "'] ";
                        for (h = X.length; h--;) X[h] = e + n(X[h]);
                        h = aa.test(l) && D(b.parentNode) || b;
                        r = X.join(",")
                    }
                    if (r) try {
                        return F.apply(c,
                            h.querySelectorAll(r)), c
                    } catch (Y) {} finally {
                        f || b.removeAttribute("id")
                    }
                }
            }
            return G(l.replace(C, "$1"), b, c, d)
        }

        function b() {
            function a(b, c) {
                l.push(b + " ") > I.cacheLength && delete a[l.shift()];
                return a[b + " "] = c
            }
            var l = [];
            return a
        }

        function c(a) {
            a[fa] = !0;
            return a
        }

        function d(a) {
            var l = S.createElement("div");
            try {
                return !!a(l)
            } catch (b) {
                return !1
            } finally {
                l.parentNode && l.parentNode.removeChild(l)
            }
        }

        function f(a, l) {
            for (var b = a.split("|"), c = a.length; c--;) I.attrHandle[b[c]] = l
        }

        function e(a, l) {
            var b = l && a,
                c = b && 1 === a.nodeType &&
                1 === l.nodeType && (~l.sourceIndex || -2147483648) - (~a.sourceIndex || -2147483648);
            if (c) return c;
            if (b)
                for (; b = b.nextSibling;)
                    if (b === l) return -1;
            return a ? 1 : -1
        }

        function h(a) {
            return function(l) {
                return "input" === l.nodeName.toLowerCase() && l.type === a
            }
        }

        function r(a) {
            return function(l) {
                var b = l.nodeName.toLowerCase();
                return ("input" === b || "button" === b) && l.type === a
            }
        }

        function k(a) {
            return c(function(l) {
                l = +l;
                return c(function(b, c) {
                    for (var d, f = a([], b.length, l), e = f.length; e--;) b[d = f[e]] && (b[d] = !(c[d] = b[d]))
                })
            })
        }

        function D(l) {
            return l &&
                "undefined" !== typeof l.getElementsByTagName && l
        }

        function g() {}

        function n(l) {
            for (var a = 0, b = l.length, c = ""; a < b; a++) c += l[a].value;
            return c
        }

        function q(l, a, b) {
            var c = a.dir,
                d = b && "parentNode" === c,
                f = la++;
            return a.first ? function(a, b, f) {
                for (; a = a[c];)
                    if (1 === a.nodeType || d) return l(a, b, f)
            } : function(a, b, e) {
                var h, X, r = [R, f];
                if (e)
                    for (; a = a[c];) {
                        if ((1 === a.nodeType || d) && l(a, b, e)) return !0
                    } else
                        for (; a = a[c];)
                            if (1 === a.nodeType || d) {
                                X = a[fa] || (a[fa] = {});
                                if ((h = X[c]) && h[0] === R && h[1] === f) return r[2] = h[2];
                                X[c] = r;
                                if (r[2] = l(a, b, e)) return !0
                            }
            }
        }

        function u(a) {
            return 1 < a.length ? function(l, b, c) {
                for (var d = a.length; d--;)
                    if (!a[d](l, b, c)) return !1;
                return !0
            } : a[0]
        }

        function w(a, l, b, c, d) {
            for (var f, e = [], h = 0, X = a.length, r = null != l; h < X; h++)
                if (f = a[h])
                    if (!b || b(f, c, d)) e.push(f), r && l.push(h);
            return e
        }

        function m(l, b, d, f, e, h) {
            f && !f[fa] && (f = m(f));
            e && !e[fa] && (e = m(e, h));
            return c(function(c, h, r, Y) {
                var k, D, g = [],
                    n = [],
                    Ga = h.length,
                    q;
                if (!(q = c)) {
                    q = b || "*";
                    for (var u = r.nodeType ? [r] : r, m = [], p = 0, bb = u.length; p < bb; p++) a(q, u[p], m);
                    q = m
                }
                q = !l || !c && b ? q : w(q, g, l, r, Y);
                u = d ? e || (c ? l : Ga ||
                    f) ? [] : h : q;
                d && d(q, u, r, Y);
                if (f)
                    for (k = w(u, n), f(k, [], r, Y), r = k.length; r--;)
                        if (D = k[r]) u[n[r]] = !(q[n[r]] = D);
                if (c) {
                    if (e || l) {
                        if (e) {
                            k = [];
                            for (r = u.length; r--;)(D = u[r]) && k.push(q[r] = D);
                            e(null, u = [], k, Y)
                        }
                        for (r = u.length; r--;)(D = u[r]) && -1 < (k = e ? sa.call(c, D) : g[r]) && (c[k] = !(h[k] = D))
                    }
                } else u = w(u === h ? u.splice(Ga, u.length) : u), e ? e(null, h, u, Y) : F.apply(h, u)
            })
        }

        function p(a) {
            var l, b, c, d = a.length,
                f = I.relative[a[0].type];
            b = f || I.relative[" "];
            for (var e = f ? 1 : 0, h = q(function(a) {
                    return a === l
                }, b, !0), X = q(function(a) {
                    return -1 < sa.call(l,
                        a)
                }, b, !0), r = [function(a, b, c) {
                    return !f && (c || b !== T) || ((l = b).nodeType ? h(a, b, c) : X(a, b, c))
                }]; e < d; e++)
                if (b = I.relative[a[e].type]) r = [q(u(r), b)];
                else {
                    b = I.filter[a[e].type].apply(null, a[e].matches);
                    if (b[fa]) {
                        for (c = ++e; c < d && !I.relative[a[c].type]; c++);
                        return m(1 < e && u(r), 1 < e && n(a.slice(0, e - 1).concat({
                            value: " " === a[e - 2].type ? "*" : ""
                        })).replace(C, "$1"), b, e < c && p(a.slice(e, c)), c < d && p(a = a.slice(c)), c < d && n(a))
                    }
                    r.push(b)
                }
            return u(r)
        }

        function ba(l, b) {
            var d = 0 < b.length,
                f = 0 < l.length,
                e = function(c, e, h, r, Y) {
                    var k, D, g, n = 0,
                        Ga = "0",
                        q = c && [],
                        u = [],
                        m = T,
                        p = c || f && I.find.TAG("*", Y),
                        bb = R += null == m ? 1 : Math.random() || .1,
                        Lb = p.length;
                    for (Y && (T = e !== S && e); Ga !== Lb && null != (k = p[Ga]); Ga++) {
                        if (f && k) {
                            for (D = 0; g = l[D++];)
                                if (g(k, e, h)) {
                                    r.push(k);
                                    break
                                }
                            Y && (R = bb)
                        }
                        d && ((k = !g && k) && n--, c && q.push(k))
                    }
                    n += Ga;
                    if (d && Ga !== n) {
                        for (D = 0; g = b[D++];) g(q, u, e, h);
                        if (c) {
                            if (0 < n)
                                for (; Ga--;) q[Ga] || u[Ga] || (u[Ga] = J.call(r));
                            u = w(u)
                        }
                        F.apply(r, u);
                        Y && !c && 0 < u.length && 1 < n + b.length && a.uniqueSort(r)
                    }
                    Y && (R = bb, T = m);
                    return q
                };
            return d ? c(e) : e
        }
        var A, t, I, N, M, P, W, G, T, ea, za, s, S, y, U, x, E, ya,
            Oa, fa = "sizzle" + -new Date,
            Z = l.document,
            R = 0,
            la = 0,
            Ba = b(),
            B = b(),
            v = b(),
            ra = function(a, l) {
                a === l && (za = !0);
                return 0
            },
            xa = {}.hasOwnProperty,
            ka = [],
            J = ka.pop,
            Pa = ka.push,
            F = ka.push,
            Ra = ka.slice,
            sa = ka.indexOf || function(a) {
                for (var l = 0, b = this.length; l < b; l++)
                    if (this[l] === a) return l;
                return -1
            },
            Ka = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w", "w#"),
            z = "\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + Ka +
            "))|)[\\x20\\t\\r\\n\\f]*\\]",
            Ja = ":((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|" + z + ")*)|.*)\\)|)",
            C = RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$", "g"),
            Q = /^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/,
            K = /^[\x20\t\r\n\f]*([>+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/,
            ca = RegExp("=[\\x20\\t\\r\\n\\f]*([^\\]'\"]*?)[\\x20\\t\\r\\n\\f]*\\]", "g"),
            jb = new RegExp(Ja),
            H = new RegExp("^" + Ka + "$"),
            Qa = {
                ID: /^#((?:\\.|[\w-]|[^\x00-\xa0])+)/,
                CLASS: /^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/,
                TAG: new RegExp("^(" + "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w", "w*") + ")"),
                ATTR: new RegExp("^" + z),
                PSEUDO: new RegExp("^" + Ja),
                CHILD: /^:(only|first|last|nth|nth-last)-(child|of-type)(?:\([\x20\t\r\n\f]*(even|odd|(([+-]|)(\d*)n|)[\x20\t\r\n\f]*(?:([+-]|)[\x20\t\r\n\f]*(\d+)|))[\x20\t\r\n\f]*\)|)/i,
                bool: /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,
                needsContext: /^[\x20\t\r\n\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i
            },
            Ha = /^(?:input|select|textarea|button)$/i,
            Sa = /^h\d$/i,
            va = /^[^{]+\{\s*\[native \w/,
            eb = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
            aa = /[+~]/,
            L = /'|\\/g,
            ja = RegExp("\\\\([\\da-f]{1,6}[\\x20\\t\\r\\n\\f]?|([\\x20\\t\\r\\n\\f])|.)", "ig"),
            Fa = function(a, l, b) {
                a = "0x" + l - 65536;
                return a !== a || b ? l : 0 > a ? String.fromCharCode(a + 65536) : String.fromCharCode(a >> 10 | 55296, a & 1023 | 56320)
            };
        try {
            F.apply(ka = Ra.call(Z.childNodes), Z.childNodes), ka[Z.childNodes.length].nodeType
        } catch (O) {
            F = {
                apply: ka.length ? function(a, l) {
                    Pa.apply(a, Ra.call(l))
                } : function(a, l) {
                    for (var b = a.length, c = 0; a[b++] = l[c++];);
                    a.length = b - 1
                }
            }
        }
        t = a.support = {};
        M = a.isXML = function(a) {
            return (a = a && (a.ownerDocument || a).documentElement) ? "HTML" !== a.nodeName : !1
        };
        s = a.setDocument = function(a) {
            var l = a ? a.ownerDocument || a : Z;
            a = l.defaultView;
            if (l === S || 9 !== l.nodeType || !l.documentElement) return S;
            S = l;
            y = l.documentElement;
            U = !M(l);
            a && a !== a.top && (a.addEventListener ? a.addEventListener("unload", function() {
                s()
            }, !1) : a.attachEvent && a.attachEvent("onunload", function() {
                s()
            }));
            t.attributes = d(function(a) {
                a.className =
                    "i";
                return !a.getAttribute("className")
            });
            t.getElementsByTagName = d(function(a) {
                a.appendChild(l.createComment(""));
                return !a.getElementsByTagName("*").length
            });
            t.getElementsByClassName = va.test(l.getElementsByClassName) && d(function(a) {
                a.innerHTML = "<div class='a'></div><div class='a i'></div>";
                a.firstChild.className = "i";
                return 2 === a.getElementsByClassName("i").length
            });
            t.getById = d(function(a) {
                y.appendChild(a).id = fa;
                return !l.getElementsByName || !l.getElementsByName(fa).length
            });
            t.getById ? (I.find.ID = function(a,
                l) {
                if ("undefined" !== typeof l.getElementById && U) {
                    var b = l.getElementById(a);
                    return b && b.parentNode ? [b] : []
                }
            }, I.filter.ID = function(a) {
                var l = a.replace(ja, Fa);
                return function(a) {
                    return a.getAttribute("id") === l
                }
            }) : (delete I.find.ID, I.filter.ID = function(a) {
                var l = a.replace(ja, Fa);
                return function(a) {
                    return (a = "undefined" !== typeof a.getAttributeNode && a.getAttributeNode("id")) && a.value === l
                }
            });
            I.find.TAG = t.getElementsByTagName ? function(a, l) {
                    if ("undefined" !== typeof l.getElementsByTagName) return l.getElementsByTagName(a)
                } :
                function(a, l) {
                    var b, c = [],
                        d = 0,
                        f = l.getElementsByTagName(a);
                    if ("*" === a) {
                        for (; b = f[d++];) 1 === b.nodeType && c.push(b);
                        return c
                    }
                    return f
                };
            I.find.CLASS = t.getElementsByClassName && function(a, l) {
                if ("undefined" !== typeof l.getElementsByClassName && U) return l.getElementsByClassName(a)
            };
            E = [];
            x = [];
            if (t.qsa = va.test(l.querySelectorAll)) d(function(a) {
                a.innerHTML = "<select msallowclip=''><option selected=''></option></select>";
                a.querySelectorAll("[msallowclip^='']").length && x.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")");
                a.querySelectorAll("[selected]").length || x.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)");
                a.querySelectorAll(":checked").length || x.push(":checked")
            }), d(function(a) {
                var b = l.createElement("input");
                b.setAttribute("type", "hidden");
                a.appendChild(b).setAttribute("name", "D");
                a.querySelectorAll("[name=d]").length && x.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?=");
                a.querySelectorAll(":enabled").length ||
                    x.push(":enabled", ":disabled");
                a.querySelectorAll("*,:x");
                x.push(",.*:")
            });
            (t.matchesSelector = va.test(ya = y.matches || y.webkitMatchesSelector || y.mozMatchesSelector || y.oMatchesSelector || y.msMatchesSelector)) && d(function(a) {
                t.disconnectedMatch = ya.call(a, "div");
                ya.call(a, "[s!='']:x");
                E.push("!=", Ja)
            });
            x = x.length && new RegExp(x.join("|"));
            E = E.length && new RegExp(E.join("|"));
            Oa = (a = va.test(y.compareDocumentPosition)) || va.test(y.contains) ? function(a, l) {
                var b = 9 === a.nodeType ? a.documentElement : a,
                    c = l && l.parentNode;
                return a === c || !!(c && 1 === c.nodeType && (b.contains ? b.contains(c) : a.compareDocumentPosition && a.compareDocumentPosition(c) & 16))
            } : function(a, l) {
                if (l)
                    for (; l = l.parentNode;)
                        if (l === a) return !0;
                return !1
            };
            ra = a ? function(a, b) {
                if (a === b) return za = !0, 0;
                var c = !a.compareDocumentPosition - !b.compareDocumentPosition;
                if (c) return c;
                c = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
                return c & 1 || !t.sortDetached && b.compareDocumentPosition(a) === c ? a === l || a.ownerDocument === Z && Oa(Z, a) ? -1 : b === l || b.ownerDocument ===
                    Z && Oa(Z, b) ? 1 : ea ? sa.call(ea, a) - sa.call(ea, b) : 0 : c & 4 ? -1 : 1
            } : function(a, b) {
                if (a === b) return za = !0, 0;
                var c, d = 0;
                c = a.parentNode;
                var f = b.parentNode,
                    h = [a],
                    X = [b];
                if (!c || !f) return a === l ? -1 : b === l ? 1 : c ? -1 : f ? 1 : ea ? sa.call(ea, a) - sa.call(ea, b) : 0;
                if (c === f) return e(a, b);
                for (c = a; c = c.parentNode;) h.unshift(c);
                for (c = b; c = c.parentNode;) X.unshift(c);
                for (; h[d] === X[d];) d++;
                return d ? e(h[d], X[d]) : h[d] === Z ? -1 : X[d] === Z ? 1 : 0
            };
            return l
        };
        a.matches = function(l, b) {
            return a(l, null, null, b)
        };
        a.matchesSelector = function(l, b) {
            (l.ownerDocument ||
                l) !== S && s(l);
            b = b.replace(ca, "='$1']");
            if (!(!t.matchesSelector || !U || E && E.test(b) || x && x.test(b))) try {
                var c = ya.call(l, b);
                if (c || t.disconnectedMatch || l.document && 11 !== l.document.nodeType) return c
            } catch (d) {}
            return 0 < a(b, S, null, [l]).length
        };
        a.contains = function(a, l) {
            (a.ownerDocument || a) !== S && s(a);
            return Oa(a, l)
        };
        a.attr = function(a, l) {
            (a.ownerDocument || a) !== S && s(a);
            var b = I.attrHandle[l.toLowerCase()],
                b = b && xa.call(I.attrHandle, l.toLowerCase()) ? b(a, l, !U) : void 0;
            return void 0 !== b ? b : t.attributes || !U ? a.getAttribute(l) :
                (b = a.getAttributeNode(l)) && b.specified ? b.value : null
        };
        a.error = function(a) {
            throw Error("Syntax error, unrecognized expression: " + a);
        };
        a.uniqueSort = function(a) {
            var l, b = [],
                c = 0,
                d = 0;
            za = !t.detectDuplicates;
            ea = !t.sortStable && a.slice(0);
            a.sort(ra);
            if (za) {
                for (; l = a[d++];) l === a[d] && (c = b.push(d));
                for (; c--;) a.splice(b[c], 1)
            }
            ea = null;
            return a
        };
        N = a.getText = function(a) {
            var l, b = "",
                c = 0;
            l = a.nodeType;
            if (!l)
                for (; l = a[c++];) b += N(l);
            else if (1 === l || 9 === l || 11 === l) {
                if ("string" === typeof a.textContent) return a.textContent;
                for (a =
                    a.firstChild; a; a = a.nextSibling) b += N(a)
            } else if (3 === l || 4 === l) return a.nodeValue;
            return b
        };
        I = a.selectors = {
            cacheLength: 50,
            createPseudo: c,
            match: Qa,
            attrHandle: {},
            find: {},
            relative: {
                ">": {
                    dir: "parentNode",
                    first: !0
                },
                " ": {
                    dir: "parentNode"
                },
                "+": {
                    dir: "previousSibling",
                    first: !0
                },
                "~": {
                    dir: "previousSibling"
                }
            },
            preFilter: {
                ATTR: function(a) {
                    a[1] = a[1].replace(ja, Fa);
                    a[3] = (a[3] || a[4] || a[5] || "").replace(ja, Fa);
                    "~=" === a[2] && (a[3] = " " + a[3] + " ");
                    return a.slice(0, 4)
                },
                CHILD: function(l) {
                    l[1] = l[1].toLowerCase();
                    "nth" === l[1].slice(0,
                        3) ? (l[3] || a.error(l[0]), l[4] = +(l[4] ? l[5] + (l[6] || 1) : 2 * ("even" === l[3] || "odd" === l[3])), l[5] = +(l[7] + l[8] || "odd" === l[3])) : l[3] && a.error(l[0]);
                    return l
                },
                PSEUDO: function(a) {
                    var l, b = !a[6] && a[2];
                    if (Qa.CHILD.test(a[0])) return null;
                    a[3] ? a[2] = a[4] || a[5] || "" : b && jb.test(b) && (l = P(b, !0)) && (l = b.indexOf(")", b.length - l) - b.length) && (a[0] = a[0].slice(0, l), a[2] = b.slice(0, l));
                    return a.slice(0, 3)
                }
            },
            filter: {
                TAG: function(a) {
                    var l = a.replace(ja, Fa).toLowerCase();
                    return "*" === a ? function() {
                        return !0
                    } : function(a) {
                        return a.nodeName &&
                            a.nodeName.toLowerCase() === l
                    }
                },
                CLASS: function(a) {
                    var l = Ba[a + " "];
                    return l || (l = new RegExp("(^|[\\x20\\t\\r\\n\\f])" + a + "([\\x20\\t\\r\\n\\f]|$)")) && Ba(a, function(a) {
                        return l.test("string" === typeof a.className && a.className || "undefined" !== typeof a.getAttribute && a.getAttribute("class") || "")
                    })
                },
                ATTR: function(l, b, c) {
                    return function(d) {
                        d = a.attr(d, l);
                        if (null == d) return "!=" === b;
                        if (!b) return !0;
                        d += "";
                        return "=" === b ? d === c : "!=" === b ? d !== c : "^=" === b ? c && 0 === d.indexOf(c) : "*=" === b ? c && -1 < d.indexOf(c) : "$=" === b ? c && d.slice(-c.length) ===
                            c : "~=" === b ? -1 < (" " + d + " ").indexOf(c) : "|=" === b ? d === c || d.slice(0, c.length + 1) === c + "-" : !1
                    }
                },
                CHILD: function(a, l, b, c, d) {
                    var f = "nth" !== a.slice(0, 3),
                        e = "last" !== a.slice(-4),
                        h = "of-type" === l;
                    return 1 === c && 0 === d ? function(a) {
                        return !!a.parentNode
                    } : function(l, b, X) {
                        var r, Y, k, D, g;
                        b = f !== e ? "nextSibling" : "previousSibling";
                        var n = l.parentNode,
                            Ga = h && l.nodeName.toLowerCase();
                        X = !X && !h;
                        if (n) {
                            if (f) {
                                for (; b;) {
                                    for (Y = l; Y = Y[b];)
                                        if (h ? Y.nodeName.toLowerCase() === Ga : 1 === Y.nodeType) return !1;
                                    g = b = "only" === a && !g && "nextSibling"
                                }
                                return !0
                            }
                            g = [e ? n.firstChild : n.lastChild];
                            if (e && X)
                                for (X = n[fa] || (n[fa] = {}), r = X[a] || [], D = r[0] === R && r[1], k = r[0] === R && r[2], Y = D && n.childNodes[D]; Y = ++D && Y && Y[b] || (k = D = 0) || g.pop();) {
                                    if (1 === Y.nodeType && ++k && Y === l) {
                                        X[a] = [R, D, k];
                                        break
                                    }
                                } else if (X && (r = (l[fa] || (l[fa] = {}))[a]) && r[0] === R) k = r[1];
                                else
                                    for (;
                                        (Y = ++D && Y && Y[b] || (k = D = 0) || g.pop()) && ((h ? Y.nodeName.toLowerCase() !== Ga : 1 !== Y.nodeType) || !++k || (X && ((Y[fa] || (Y[fa] = {}))[a] = [R, k]), Y !== l)););
                            k -= d;
                            return k === c || 0 === k % c && 0 <= k / c
                        }
                    }
                },
                PSEUDO: function(l, b) {
                    var d, f = I.pseudos[l] || I.setFilters[l.toLowerCase()] ||
                        a.error("unsupported pseudo: " + l);
                    return f[fa] ? f(b) : 1 < f.length ? (d = [l, l, "", b], I.setFilters.hasOwnProperty(l.toLowerCase()) ? c(function(a, l) {
                        for (var c, d = f(a, b), e = d.length; e--;) c = sa.call(a, d[e]), a[c] = !(l[c] = d[e])
                    }) : function(a) {
                        return f(a, 0, d)
                    }) : f
                }
            },
            pseudos: {
                not: c(function(a) {
                    var l = [],
                        b = [],
                        d = W(a.replace(C, "$1"));
                    return d[fa] ? c(function(a, l, b, c) {
                        c = d(a, null, c, []);
                        for (var f = a.length; f--;)
                            if (b = c[f]) a[f] = !(l[f] = b)
                    }) : function(a, c, f) {
                        l[0] = a;
                        d(l, null, f, b);
                        return !b.pop()
                    }
                }),
                has: c(function(l) {
                    return function(b) {
                        return 0 <
                            a(l, b).length
                    }
                }),
                contains: c(function(a) {
                    return function(l) {
                        return -1 < (l.textContent || l.innerText || N(l)).indexOf(a)
                    }
                }),
                lang: c(function(l) {
                    H.test(l || "") || a.error("unsupported lang: " + l);
                    l = l.replace(ja, Fa).toLowerCase();
                    return function(a) {
                        var b;
                        do
                            if (b = U ? a.lang : a.getAttribute("xml:lang") || a.getAttribute("lang")) return b = b.toLowerCase(), b === l || 0 === b.indexOf(l + "-");
                        while ((a = a.parentNode) && 1 === a.nodeType);
                        return !1
                    }
                }),
                target: function(a) {
                    var b = l.location && l.location.hash;
                    return b && b.slice(1) === a.id
                },
                root: function(a) {
                    return a ===
                        y
                },
                focus: function(a) {
                    return a === S.activeElement && (!S.hasFocus || S.hasFocus()) && !!(a.type || a.href || ~a.tabIndex)
                },
                enabled: function(a) {
                    return !1 === a.disabled
                },
                disabled: function(a) {
                    return !0 === a.disabled
                },
                checked: function(a) {
                    var l = a.nodeName.toLowerCase();
                    return "input" === l && !!a.checked || "option" === l && !!a.selected
                },
                selected: function(a) {
                    a.parentNode && a.parentNode.selectedIndex;
                    return !0 === a.selected
                },
                empty: function(a) {
                    for (a = a.firstChild; a; a = a.nextSibling)
                        if (6 > a.nodeType) return !1;
                    return !0
                },
                parent: function(a) {
                    return !I.pseudos.empty(a)
                },
                header: function(a) {
                    return Sa.test(a.nodeName)
                },
                input: function(a) {
                    return Ha.test(a.nodeName)
                },
                button: function(a) {
                    var l = a.nodeName.toLowerCase();
                    return "input" === l && "button" === a.type || "button" === l
                },
                text: function(a) {
                    var l;
                    return "input" === a.nodeName.toLowerCase() && "text" === a.type && (null == (l = a.getAttribute("type")) || "text" === l.toLowerCase())
                },
                first: k(function() {
                    return [0]
                }),
                last: k(function(a, l) {
                    return [l - 1]
                }),
                eq: k(function(a, l, b) {
                    return [0 > b ? b + l : b]
                }),
                even: k(function(a, l) {
                    for (var b = 0; b < l; b += 2) a.push(b);
                    return a
                }),
                odd: k(function(a, l) {
                    for (var b = 1; b < l; b += 2) a.push(b);
                    return a
                }),
                lt: k(function(a, l, b) {
                    for (l = 0 > b ? b + l : b; 0 <= --l;) a.push(l);
                    return a
                }),
                gt: k(function(a, l, b) {
                    for (b = 0 > b ? b + l : b; ++b < l;) a.push(b);
                    return a
                })
            }
        };
        I.pseudos.nth = I.pseudos.eq;
        for (A in {
                radio: !0,
                checkbox: !0,
                file: !0,
                password: !0,
                image: !0
            }) I.pseudos[A] = h(A);
        for (A in {
                submit: !0,
                reset: !0
            }) I.pseudos[A] = r(A);
        g.prototype = I.filters = I.pseudos;
        I.setFilters = new g;
        P = a.tokenize = function(l, b) {
            var c, d, f, e, h, r, Y;
            if (h = B[l + " "]) return b ? 0 : h.slice(0);
            h = l;
            r = [];
            for (Y = I.preFilter; h;) {
                if (!c ||
                    (d = Q.exec(h))) d && (h = h.slice(d[0].length) || h), r.push(f = []);
                c = !1;
                if (d = K.exec(h)) c = d.shift(), f.push({
                    value: c,
                    type: d[0].replace(C, " ")
                }), h = h.slice(c.length);
                for (e in I.filter) !(d = Qa[e].exec(h)) || Y[e] && !(d = Y[e](d)) || (c = d.shift(), f.push({
                    value: c,
                    type: e,
                    matches: d
                }), h = h.slice(c.length));
                if (!c) break
            }
            return b ? h.length : h ? a.error(l) : B(l, r).slice(0)
        };
        W = a.compile = function(a, l) {
            var b, c = [],
                d = [],
                f = v[a + " "];
            if (!f) {
                l || (l = P(a));
                for (b = l.length; b--;) f = p(l[b]), f[fa] ? c.push(f) : d.push(f);
                f = v(a, ba(d, c));
                f.selector = a
            }
            return f
        };
        G = a.select = function(a, l, b, c) {
            var d, f, e, h, X = "function" === typeof a && a,
                r = !c && P(a = X.selector || a);
            b = b || [];
            if (1 === r.length) {
                f = r[0] = r[0].slice(0);
                if (2 < f.length && "ID" === (e = f[0]).type && t.getById && 9 === l.nodeType && U && I.relative[f[1].type]) {
                    l = (I.find.ID(e.matches[0].replace(ja, Fa), l) || [])[0];
                    if (!l) return b;
                    X && (l = l.parentNode);
                    a = a.slice(f.shift().value.length)
                }
                for (d = Qa.needsContext.test(a) ? 0 : f.length; d--;) {
                    e = f[d];
                    if (I.relative[h = e.type]) break;
                    if (h = I.find[h])
                        if (c = h(e.matches[0].replace(ja, Fa), aa.test(f[0].type) &&
                                D(l.parentNode) || l)) {
                            f.splice(d, 1);
                            a = c.length && n(f);
                            if (!a) return F.apply(b, c), b;
                            break
                        }
                }
            }(X || W(a, r))(c, l, !U, b, aa.test(a) && D(l.parentNode) || l);
            return b
        };
        t.sortStable = fa.split("").sort(ra).join("") === fa;
        t.detectDuplicates = !!za;
        s();
        t.sortDetached = d(function(a) {
            return a.compareDocumentPosition(S.createElement("div")) & 1
        });
        d(function(a) {
            a.innerHTML = "<a href='#'></a>";
            return "#" === a.firstChild.getAttribute("href")
        }) || f("type|href|height|width", function(a, l, b) {
            if (!b) return a.getAttribute(l, "type" === l.toLowerCase() ?
                1 : 2)
        });
        t.attributes && d(function(a) {
            a.innerHTML = "<input/>";
            a.firstChild.setAttribute("value", "");
            return "" === a.firstChild.getAttribute("value")
        }) || f("value", function(a, l, b) {
            if (!b && "input" === a.nodeName.toLowerCase()) return a.defaultValue
        });
        d(function(a) {
            return null == a.getAttribute("disabled")
        }) || f("checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", function(a, l, b) {
            var c;
            if (!b) return !0 === a[l] ? l.toLowerCase() : (c = a.getAttributeNode(l)) &&
                c.specified ? c.value : null
        });
        return a
    }(c);
    h.find = da;
    h.expr = da.selectors;
    h.expr[":"] = h.expr.pseudos;
    h.unique = da.uniqueSort;
    h.text = da.getText;
    h.isXMLDoc = da.isXML;
    h.contains = da.contains;
    var ia = h.expr.match.needsContext,
        qa = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
        z = /^.[^:#\[\.,]*$/;
    h.filter = function(a, b, c) {
        var d = b[0];
        c && (a = ":not(" + a + ")");
        return 1 === b.length && 1 === d.nodeType ? h.find.matchesSelector(d, a) ? [d] : [] : h.find.matches(a, h.grep(b, function(a) {
            return 1 === a.nodeType
        }))
    };
    h.fn.extend({
        find: function(a) {
            var b, c = [],
                d = this,
                f = d.length;
            if ("string" !== typeof a) return this.pushStack(h(a).filter(function() {
                for (b = 0; b < f; b++)
                    if (h.contains(d[b], this)) return !0
            }));
            for (b = 0; b < f; b++) h.find(a, d[b], c);
            c = this.pushStack(1 < f ? h.unique(c) : c);
            c.selector = this.selector ? this.selector + " " + a : a;
            return c
        },
        filter: function(a) {
            return this.pushStack(b(this, a || [], !1))
        },
        not: function(a) {
            return this.pushStack(b(this, a || [], !0))
        },
        is: function(a) {
            return !!b(this, "string" === typeof a && ia.test(a) ? h(a) : a || [], !1).length
        }
    });
    var ma, H = c.document,
        na = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/;
    (h.fn.init = function(a, b) {
        var c, d;
        if (!a) return this;
        if ("string" === typeof a) {
            c = "<" === a.charAt(0) && ">" === a.charAt(a.length - 1) && 3 <= a.length ? [null, a, null] : na.exec(a);
            if (!c || !c[1] && b) return !b || b.jquery ? (b || ma).find(a) : this.constructor(b).find(a);
            if (c[1]) {
                if (b = b instanceof h ? b[0] : b, h.merge(this, h.parseHTML(c[1], b && b.nodeType ? b.ownerDocument || b : H, !0)), qa.test(c[1]) && h.isPlainObject(b))
                    for (c in b)
                        if (h.isFunction(this[c])) this[c](b[c]);
                        else this.attr(c, b[c])
            } else {
                if ((d = H.getElementById(c[2])) && d.parentNode) {
                    if (d.id !==
                        c[2]) return ma.find(a);
                    this.length = 1;
                    this[0] = d
                }
                this.context = H;
                this.selector = a
            }
            return this
        }
        if (a.nodeType) return this.context = this[0] = a, this.length = 1, this;
        if (h.isFunction(a)) return "undefined" !== typeof ma.ready ? ma.ready(a) : a(h);
        void 0 !== a.selector && (this.selector = a.selector, this.context = a.context);
        return h.makeArray(a, this)
    }).prototype = h.fn;
    ma = h(H);
    var L = /^(?:parents|prev(?:Until|All))/,
        oa = {
            children: !0,
            contents: !0,
            next: !0,
            prev: !0
        };
    h.extend({
        dir: function(a, b, c) {
            var d = [];
            for (a = a[b]; a && 9 !== a.nodeType &&
                (void 0 === c || 1 !== a.nodeType || !h(a).is(c));) 1 === a.nodeType && d.push(a), a = a[b];
            return d
        },
        sibling: function(a, b) {
            for (var c = []; a; a = a.nextSibling) 1 === a.nodeType && a !== b && c.push(a);
            return c
        }
    });
    h.fn.extend({
        has: function(a) {
            var b, c = h(a, this),
                d = c.length;
            return this.filter(function() {
                for (b = 0; b < d; b++)
                    if (h.contains(this, c[b])) return !0
            })
        },
        closest: function(a, b) {
            for (var c, d = 0, f = this.length, e = [], r = ia.test(a) || "string" !== typeof a ? h(a, b || this.context) : 0; d < f; d++)
                for (c = this[d]; c && c !== b; c = c.parentNode)
                    if (11 > c.nodeType &&
                        (r ? -1 < r.index(c) : 1 === c.nodeType && h.find.matchesSelector(c, a))) {
                        e.push(c);
                        break
                    }
            return this.pushStack(1 < e.length ? h.unique(e) : e)
        },
        index: function(a) {
            return a ? "string" === typeof a ? h.inArray(this[0], h(a)) : h.inArray(a.jquery ? a[0] : a, this) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1
        },
        add: function(a, b) {
            return this.pushStack(h.unique(h.merge(this.get(), h(a, b))))
        },
        addBack: function(a) {
            return this.add(null == a ? this.prevObject : this.prevObject.filter(a))
        }
    });
    h.each({
        parent: function(a) {
            return (a = a.parentNode) &&
                11 !== a.nodeType ? a : null
        },
        parents: function(a) {
            return h.dir(a, "parentNode")
        },
        parentsUntil: function(a, b, c) {
            return h.dir(a, "parentNode", c)
        },
        next: function(a) {
            return d(a, "nextSibling")
        },
        prev: function(a) {
            return d(a, "previousSibling")
        },
        nextAll: function(a) {
            return h.dir(a, "nextSibling")
        },
        prevAll: function(a) {
            return h.dir(a, "previousSibling")
        },
        nextUntil: function(a, b, c) {
            return h.dir(a, "nextSibling", c)
        },
        prevUntil: function(a, b, c) {
            return h.dir(a, "previousSibling", c)
        },
        siblings: function(a) {
            return h.sibling((a.parentNode || {}).firstChild, a)
        },
        children: function(a) {
            return h.sibling(a.firstChild)
        },
        contents: function(a) {
            return h.nodeName(a, "iframe") ? a.contentDocument || a.contentWindow.document : h.merge([], a.childNodes)
        }
    }, function(a, b) {
        h.fn[a] = function(c, d) {
            var f = h.map(this, b, c);
            "Until" !== a.slice(-5) && (d = c);
            d && "string" === typeof d && (f = h.filter(d, f));
            1 < this.length && (oa[a] || (f = h.unique(f)), L.test(a) && (f = f.reverse()));
            return this.pushStack(f)
        }
    });
    var V = /\S+/g,
        Da = {};
    h.Callbacks = function(l) {
        l = "string" === typeof l ? Da[l] || a(l) : h.extend({},
            l);
        var b, c, d, f, e, r, k = [],
            D = !l.once && [],
            g = function(a) {
                c = l.memory && a;
                d = !0;
                e = r || 0;
                r = 0;
                f = k.length;
                for (b = !0; k && e < f; e++)
                    if (!1 === k[e].apply(a[0], a[1]) && l.stopOnFalse) {
                        c = !1;
                        break
                    }
                b = !1;
                k && (D ? D.length && g(D.shift()) : c ? k = [] : n.disable())
            },
            n = {
                add: function() {
                    if (k) {
                        var a = k.length;
                        (function Ob(a) {
                            h.each(a, function(a, b) {
                                var c = h.type(b);
                                "function" === c ? l.unique && n.has(b) || k.push(b) : b && b.length && "string" !== c && Ob(b)
                            })
                        })(arguments);
                        b ? f = k.length : c && (r = a, g(c))
                    }
                    return this
                },
                remove: function() {
                    k && h.each(arguments, function(a,
                        l) {
                        for (var c; - 1 < (c = h.inArray(l, k, c));) k.splice(c, 1), b && (c <= f && f--, c <= e && e--)
                    });
                    return this
                },
                has: function(a) {
                    return a ? -1 < h.inArray(a, k) : !(!k || !k.length)
                },
                empty: function() {
                    k = [];
                    f = 0;
                    return this
                },
                disable: function() {
                    k = D = c = void 0;
                    return this
                },
                disabled: function() {
                    return !k
                },
                lock: function() {
                    D = void 0;
                    c || n.disable();
                    return this
                },
                locked: function() {
                    return !D
                },
                fireWith: function(a, l) {
                    !k || d && !D || (l = l || [], l = [a, l.slice ? l.slice() : l], b ? D.push(l) : g(l));
                    return this
                },
                fire: function() {
                    n.fireWith(this, arguments);
                    return this
                },
                fired: function() {
                    return !!d
                }
            };
        return n
    };
    h.extend({
        Deferred: function(a) {
            var b = [
                    ["resolve", "done", h.Callbacks("once memory"), "resolved"],
                    ["reject", "fail", h.Callbacks("once memory"), "rejected"],
                    ["notify", "progress", h.Callbacks("memory")]
                ],
                c = "pending",
                d = {
                    state: function() {
                        return c
                    },
                    always: function() {
                        f.done(arguments).fail(arguments);
                        return this
                    },
                    then: function() {
                        var a = arguments;
                        return h.Deferred(function(l) {
                            h.each(b, function(b, c) {
                                var e = h.isFunction(a[b]) && a[b];
                                f[c[1]](function() {
                                    var a = e && e.apply(this, arguments);
                                    if (a && h.isFunction(a.promise)) a.promise().done(l.resolve).fail(l.reject).progress(l.notify);
                                    else l[c[0] + "With"](this === d ? l.promise() : this, e ? [a] : arguments)
                                })
                            });
                            a = null
                        }).promise()
                    },
                    promise: function(a) {
                        return null != a ? h.extend(a, d) : d
                    }
                },
                f = {};
            d.pipe = d.then;
            h.each(b, function(a, l) {
                var e = l[2],
                    h = l[3];
                d[l[1]] = e.add;
                h && e.add(function() {
                    c = h
                }, b[a ^ 1][2].disable, b[2][2].lock);
                f[l[0]] = function() {
                    f[l[0] + "With"](this === f ? d : this, arguments);
                    return this
                };
                f[l[0] + "With"] = e.fireWith
            });
            d.promise(f);
            a && a.call(f, f);
            return f
        },
        when: function(a) {
            var b = 0,
                c = sa.call(arguments),
                d = c.length,
                f = 1 !== d || a && h.isFunction(a.promise) ? d : 0,
                e = 1 === f ? a : h.Deferred(),
                r = function(a, b, l) {
                    return function(c) {
                        b[a] = this;
                        l[a] = 1 < arguments.length ? sa.call(arguments) : c;
                        l === k ? e.notifyWith(b, l) : --f || e.resolveWith(b, l)
                    }
                },
                k, D, g;
            if (1 < d)
                for (k = Array(d), D = Array(d), g = Array(d); b < d; b++) c[b] && h.isFunction(c[b].promise) ? c[b].promise().done(r(b, g, c)).fail(e.reject).progress(r(b, D, k)) : --f;
            f || e.resolveWith(g, c);
            return e.promise()
        }
    });
    var O;
    h.fn.ready = function(a) {
        h.ready.promise().done(a);
        return this
    };
    h.extend({
        isReady: !1,
        readyWait: 1,
        holdReady: function(a) {
            a ? h.readyWait++ : h.ready(!0)
        },
        ready: function(a) {
            if (!0 === a ? !--h.readyWait : !h.isReady) {
                if (!H.body) return setTimeout(h.ready);
                h.isReady = !0;
                !0 !== a && 0 < --h.readyWait || (O.resolveWith(H, [h]), h.fn.triggerHandler && (h(H).triggerHandler("ready"), h(H).off("ready")))
            }
        }
    });
    h.ready.promise = function(a) {
        if (!O)
            if (O = h.Deferred(), "complete" === H.readyState) setTimeout(h.ready);
            else if (H.addEventListener) H.addEventListener("DOMContentLoaded", k, !1), c.addEventListener("load",
            k, !1);
        else {
            H.attachEvent("onreadystatechange", k);
            c.attachEvent("onload", k);
            var b = !1;
            try {
                b = null == c.frameElement && H.documentElement
            } catch (d) {}
            b && b.doScroll && function bb() {
                if (!h.isReady) {
                    try {
                        b.doScroll("left")
                    } catch (a) {
                        return setTimeout(bb, 50)
                    }
                    f();
                    h.ready()
                }
            }()
        }
        return O.promise(a)
    };
    for (var Ia in h(F)) break;
    F.ownLast = "0" !== Ia;
    F.inlineBlockNeedsLayout = !1;
    h(function() {
        var a, b, c;
        (b = H.getElementsByTagName("body")[0]) && b.style && (a = H.createElement("div"), c = H.createElement("div"), c.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px",
            b.appendChild(c).appendChild(a), "undefined" !== typeof a.style.zoom && (a.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1", F.inlineBlockNeedsLayout = a = 3 === a.offsetWidth) && (b.style.zoom = 1), b.removeChild(c))
    });
    (function() {
        var a = H.createElement("div");
        if (null == F.deleteExpando) {
            F.deleteExpando = !0;
            try {
                delete a.test
            } catch (b) {
                F.deleteExpando = !1
            }
        }
    })();
    h.acceptData = function(a) {
        var b = h.noData[(a.nodeName + " ").toLowerCase()],
            c = +a.nodeType || 1;
        return 1 !== c && 9 !== c ? !1 : !b || !0 !== b && a.getAttribute("classid") ===
            b
    };
    var Aa = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
        ta = /([A-Z])/g;
    h.extend({
        cache: {},
        noData: {
            "applet ": !0,
            "embed ": !0,
            "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
        },
        hasData: function(a) {
            a = a.nodeType ? h.cache[a[h.expando]] : a[h.expando];
            return !!a && !p(a)
        },
        data: function(a, b, c) {
            return m(a, b, c)
        },
        removeData: function(a, b) {
            return q(a, b)
        },
        _data: function(a, b, c) {
            return m(a, b, c, !0)
        },
        _removeData: function(a, b) {
            return q(a, b, !0)
        }
    });
    h.fn.extend({
        data: function(a, b) {
            var c, d, f, e = this[0],
                r = e && e.attributes;
            if (void 0 === a) {
                if (this.length &&
                    (f = h.data(e), 1 === e.nodeType && !h._data(e, "parsedAttrs"))) {
                    for (c = r.length; c--;) r[c] && (d = r[c].name, 0 === d.indexOf("data-") && (d = h.camelCase(d.slice(5)), n(e, d, f[d])));
                    h._data(e, "parsedAttrs", !0)
                }
                return f
            }
            return "object" === typeof a ? this.each(function() {
                h.data(this, a)
            }) : 1 < arguments.length ? this.each(function() {
                h.data(this, a, b)
            }) : e ? n(e, a, h.data(e, a)) : void 0
        },
        removeData: function(a) {
            return this.each(function() {
                h.removeData(this, a)
            })
        }
    });
    h.extend({
        queue: function(a, b, c) {
            var d;
            if (a) return b = (b || "fx") + "queue", d = h._data(a,
                b), c && (!d || h.isArray(c) ? d = h._data(a, b, h.makeArray(c)) : d.push(c)), d || []
        },
        dequeue: function(a, b) {
            b = b || "fx";
            var c = h.queue(a, b),
                d = c.length,
                f = c.shift(),
                e = h._queueHooks(a, b),
                r = function() {
                    h.dequeue(a, b)
                };
            "inprogress" === f && (f = c.shift(), d--);
            f && ("fx" === b && c.unshift("inprogress"), delete e.stop, f.call(a, r, e));
            !d && e && e.empty.fire()
        },
        _queueHooks: function(a, b) {
            var c = b + "queueHooks";
            return h._data(a, c) || h._data(a, c, {
                empty: h.Callbacks("once memory").add(function() {
                    h._removeData(a, b + "queue");
                    h._removeData(a, c)
                })
            })
        }
    });
    h.fn.extend({
        queue: function(a, b) {
            var c = 2;
            "string" !== typeof a && (b = a, a = "fx", c--);
            return arguments.length < c ? h.queue(this[0], a) : void 0 === b ? this : this.each(function() {
                var c = h.queue(this, a, b);
                h._queueHooks(this, a);
                "fx" === a && "inprogress" !== c[0] && h.dequeue(this, a)
            })
        },
        dequeue: function(a) {
            return this.each(function() {
                h.dequeue(this, a)
            })
        },
        clearQueue: function(a) {
            return this.queue(a || "fx", [])
        },
        promise: function(a, b) {
            var c, d = 1,
                f = h.Deferred(),
                e = this,
                r = this.length,
                k = function() {
                    --d || f.resolveWith(e, [e])
                };
            "string" !==
            typeof a && (b = a, a = void 0);
            for (a = a || "fx"; r--;)(c = h._data(e[r], a + "queueHooks")) && c.empty && (d++, c.empty.add(k));
            k();
            return f.promise(b)
        }
    });
    var wa = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
        ga = ["Top", "Right", "Bottom", "Left"],
        Ea = function(a, b) {
            a = b || a;
            return "none" === h.css(a, "display") || !h.contains(a.ownerDocument, a)
        },
        pa = h.access = function(a, b, c, d, f, e, r) {
            var k = 0,
                D = a.length,
                g = null == c;
            if ("object" === h.type(c))
                for (k in f = !0, c) h.access(a, b, k, c[k], !0, e, r);
            else if (void 0 !== d && (f = !0, h.isFunction(d) || (r = !0), g && (r ?
                    (b.call(a, d), b = null) : (g = b, b = function(a, b, l) {
                        return g.call(h(a), l)
                    })), b))
                for (; k < D; k++) b(a[k], c, r ? d : d.call(a[k], k, b(a[k], c)));
            return f ? a : g ? b.call(a) : D ? b(a[0], c) : e
        },
        ua = /^(?:checkbox|radio)$/i;
    (function() {
        var a = H.createElement("input"),
            b = H.createElement("div"),
            c = H.createDocumentFragment();
        b.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
        F.leadingWhitespace = 3 === b.firstChild.nodeType;
        F.tbody = !b.getElementsByTagName("tbody").length;
        F.htmlSerialize = !!b.getElementsByTagName("link").length;
        F.html5Clone = "<:nav></:nav>" !== H.createElement("nav").cloneNode(!0).outerHTML;
        a.type = "checkbox";
        a.checked = !0;
        c.appendChild(a);
        F.appendChecked = a.checked;
        b.innerHTML = "<textarea>x</textarea>";
        F.noCloneChecked = !!b.cloneNode(!0).lastChild.defaultValue;
        c.appendChild(b);
        b.innerHTML = "<input type='radio' checked='checked' name='t'/>";
        F.checkClone = b.cloneNode(!0).cloneNode(!0).lastChild.checked;
        F.noCloneEvent = !0;
        b.attachEvent && (b.attachEvent("onclick", function() {
            F.noCloneEvent = !1
        }), b.cloneNode(!0).click());
        if (null == F.deleteExpando) {
            F.deleteExpando = !0;
            try {
                delete b.test
            } catch (d) {
                F.deleteExpando = !1
            }
        }
    })();
    (function() {
        var a, b, d = H.createElement("div");
        for (a in {
                submit: !0,
                change: !0,
                focusin: !0
            }) b = "on" + a, (F[a + "Bubbles"] = b in c) || (d.setAttribute(b, "t"), F[a + "Bubbles"] = !1 === d.attributes[b].expando)
    })();
    var D = /^(?:input|select|textarea)$/i,
        r = /^key/,
        u = /^(?:mouse|pointer|contextmenu)|click/,
        ea = /^(?:focusinfocus|focusoutblur)$/,
        Oa = /^([^.]*)(?:\.(.+)|)$/;
    h.event = {
        global: {},
        add: function(a, b, c, d, f) {
            var e, r, k, D, g, n, u, q,
                w;
            if (k = h._data(a)) {
                c.handler && (D = c, c = D.handler, f = D.selector);
                c.guid || (c.guid = h.guid++);
                (r = k.events) || (r = k.events = {});
                (g = k.handle) || (g = k.handle = function(a) {
                    return "undefined" === typeof h || a && h.event.triggered === a.type ? void 0 : h.event.dispatch.apply(g.elem, arguments)
                }, g.elem = a);
                b = (b || "").match(V) || [""];
                for (k = b.length; k--;) e = Oa.exec(b[k]) || [], q = n = e[1], w = (e[2] || "").split(".").sort(), q && (e = h.event.special[q] || {}, q = (f ? e.delegateType : e.bindType) || q, e = h.event.special[q] || {}, n = h.extend({
                    type: q,
                    origType: n,
                    data: d,
                    handler: c,
                    guid: c.guid,
                    selector: f,
                    needsContext: f && h.expr.match.needsContext.test(f),
                    namespace: w.join(".")
                }, D), (u = r[q]) || (u = r[q] = [], u.delegateCount = 0, e.setup && !1 !== e.setup.call(a, d, w, g) || (a.addEventListener ? a.addEventListener(q, g, !1) : a.attachEvent && a.attachEvent("on" + q, g))), e.add && (e.add.call(a, n), n.handler.guid || (n.handler.guid = c.guid)), f ? u.splice(u.delegateCount++, 0, n) : u.push(n), h.event.global[q] = !0);
                a = null
            }
        },
        remove: function(a, b, c, d, f) {
            var e, r, k, D, g, n, q, u, w, m, p, I = h.hasData(a) && h._data(a);
            if (I && (n =
                    I.events)) {
                b = (b || "").match(V) || [""];
                for (g = b.length; g--;)
                    if (k = Oa.exec(b[g]) || [], w = p = k[1], m = (k[2] || "").split(".").sort(), w) {
                        q = h.event.special[w] || {};
                        w = (d ? q.delegateType : q.bindType) || w;
                        u = n[w] || [];
                        k = k[2] && new RegExp("(^|\\.)" + m.join("\\.(?:.*\\.|)") + "(\\.|$)");
                        for (D = e = u.length; e--;) r = u[e], !f && p !== r.origType || c && c.guid !== r.guid || k && !k.test(r.namespace) || d && d !== r.selector && ("**" !== d || !r.selector) || (u.splice(e, 1), r.selector && u.delegateCount--, q.remove && q.remove.call(a, r));
                        D && !u.length && (q.teardown && !1 !==
                            q.teardown.call(a, m, I.handle) || h.removeEvent(a, w, I.handle), delete n[w])
                    } else
                        for (w in n) h.event.remove(a, w + b[g], c, d, !0);
                h.isEmptyObject(n) && (delete I.handle, h._removeData(a, "events"))
            }
        },
        trigger: function(a, b, d, f) {
            var e, r, k, D, g, n, q = [d || H],
                u = Q.call(a, "type") ? a.type : a;
            g = Q.call(a, "namespace") ? a.namespace.split(".") : [];
            k = e = d = d || H;
            if (3 !== d.nodeType && 8 !== d.nodeType && !ea.test(u + h.event.triggered) && (0 <= u.indexOf(".") && (g = u.split("."), u = g.shift(), g.sort()), r = 0 > u.indexOf(":") && "on" + u, a = a[h.expando] ? a : new h.Event(u,
                    "object" === typeof a && a), a.isTrigger = f ? 2 : 3, a.namespace = g.join("."), a.namespace_re = a.namespace ? new RegExp("(^|\\.)" + g.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, a.result = void 0, a.target || (a.target = d), b = null == b ? [a] : h.makeArray(b, [a]), g = h.event.special[u] || {}, f || !g.trigger || !1 !== g.trigger.apply(d, b))) {
                if (!f && !g.noBubble && !h.isWindow(d)) {
                    D = g.delegateType || u;
                    ea.test(D + u) || (k = k.parentNode);
                    for (; k; k = k.parentNode) q.push(k), e = k;
                    e === (d.ownerDocument || H) && q.push(e.defaultView || e.parentWindow || c)
                }
                for (n = 0;
                    (k = q[n++]) &&
                    !a.isPropagationStopped();) a.type = 1 < n ? D : g.bindType || u, (e = (h._data(k, "events") || {})[a.type] && h._data(k, "handle")) && e.apply(k, b), (e = r && k[r]) && e.apply && h.acceptData(k) && (a.result = e.apply(k, b), !1 === a.result && a.preventDefault());
                a.type = u;
                if (!(f || a.isDefaultPrevented() || g._default && !1 !== g._default.apply(q.pop(), b)) && h.acceptData(d) && r && d[u] && !h.isWindow(d)) {
                    (e = d[r]) && (d[r] = null);
                    h.event.triggered = u;
                    try {
                        d[u]()
                    } catch (w) {}
                    h.event.triggered = void 0;
                    e && (d[r] = e)
                }
                return a.result
            }
        },
        dispatch: function(a) {
            a = h.event.fix(a);
            var b, c, d, f, e = [],
                r = sa.call(arguments);
            b = (h._data(this, "events") || {})[a.type] || [];
            var k = h.event.special[a.type] || {};
            r[0] = a;
            a.delegateTarget = this;
            if (!k.preDispatch || !1 !== k.preDispatch.call(this, a)) {
                e = h.event.handlers.call(this, a, b);
                for (b = 0;
                    (d = e[b++]) && !a.isPropagationStopped();)
                    for (a.currentTarget = d.elem, f = 0;
                        (c = d.handlers[f++]) && !a.isImmediatePropagationStopped();)
                        if (!a.namespace_re || a.namespace_re.test(c.namespace)) a.handleObj = c, a.data = c.data, c = ((h.event.special[c.origType] || {}).handle || c.handler).apply(d.elem,
                            r), void 0 !== c && !1 === (a.result = c) && (a.preventDefault(), a.stopPropagation());
                k.postDispatch && k.postDispatch.call(this, a);
                return a.result
            }
        },
        handlers: function(a, b) {
            var c, d, f, e, r = [],
                k = b.delegateCount,
                D = a.target;
            if (k && D.nodeType && (!a.button || "click" !== a.type))
                for (; D != this; D = D.parentNode || this)
                    if (1 === D.nodeType && (!0 !== D.disabled || "click" !== a.type)) {
                        f = [];
                        for (e = 0; e < k; e++) d = b[e], c = d.selector + " ", void 0 === f[c] && (f[c] = d.needsContext ? 0 <= h(c, this).index(D) : h.find(c, this, null, [D]).length), f[c] && f.push(d);
                        f.length &&
                            r.push({
                                elem: D,
                                handlers: f
                            })
                    }
            k < b.length && r.push({
                elem: this,
                handlers: b.slice(k)
            });
            return r
        },
        fix: function(a) {
            if (a[h.expando]) return a;
            var b, c, d;
            b = a.type;
            var f = a,
                e = this.fixHooks[b];
            e || (this.fixHooks[b] = e = u.test(b) ? this.mouseHooks : r.test(b) ? this.keyHooks : {});
            d = e.props ? this.props.concat(e.props) : this.props;
            a = new h.Event(f);
            for (b = d.length; b--;) c = d[b], a[c] = f[c];
            a.target || (a.target = f.srcElement || H);
            3 === a.target.nodeType && (a.target = a.target.parentNode);
            a.metaKey = !!a.metaKey;
            return e.filter ? e.filter(a, f) : a
        },
        props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
        fixHooks: {},
        keyHooks: {
            props: ["char", "charCode", "key", "keyCode"],
            filter: function(a, b) {
                null == a.which && (a.which = null != b.charCode ? b.charCode : b.keyCode);
                return a
            }
        },
        mouseHooks: {
            props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
            filter: function(a, b) {
                var c, d, f = b.button,
                    e = b.fromElement;
                null == a.pageX && null !=
                    b.clientX && (c = a.target.ownerDocument || H, d = c.documentElement, c = c.body, a.pageX = b.clientX + (d && d.scrollLeft || c && c.scrollLeft || 0) - (d && d.clientLeft || c && c.clientLeft || 0), a.pageY = b.clientY + (d && d.scrollTop || c && c.scrollTop || 0) - (d && d.clientTop || c && c.clientTop || 0));
                !a.relatedTarget && e && (a.relatedTarget = e === a.target ? b.toElement : e);
                a.which || void 0 === f || (a.which = f & 1 ? 1 : f & 2 ? 3 : f & 4 ? 2 : 0);
                return a
            }
        },
        special: {
            load: {
                noBubble: !0
            },
            focus: {
                trigger: function() {
                    if (this !== B() && this.focus) try {
                        return this.focus(), !1
                    } catch (a) {}
                },
                delegateType: "focusin"
            },
            blur: {
                trigger: function() {
                    if (this === B() && this.blur) return this.blur(), !1
                },
                delegateType: "focusout"
            },
            click: {
                trigger: function() {
                    if (h.nodeName(this, "input") && "checkbox" === this.type && this.click) return this.click(), !1
                },
                _default: function(a) {
                    return h.nodeName(a.target, "a")
                }
            },
            beforeunload: {
                postDispatch: function(a) {
                    void 0 !== a.result && a.originalEvent && (a.originalEvent.returnValue = a.result)
                }
            }
        },
        simulate: function(a, b, c, d) {
            a = h.extend(new h.Event, c, {
                type: a,
                isSimulated: !0,
                originalEvent: {}
            });
            d ? h.event.trigger(a, null, b) : h.event.dispatch.call(b, a);
            a.isDefaultPrevented() && c.preventDefault()
        }
    };
    h.removeEvent = H.removeEventListener ? function(a, b, c) {
        a.removeEventListener && a.removeEventListener(b, c, !1)
    } : function(a, b, c) {
        b = "on" + b;
        a.detachEvent && ("undefined" === typeof a[b] && (a[b] = null), a.detachEvent(b, c))
    };
    h.Event = function(a, b) {
        if (!(this instanceof h.Event)) return new h.Event(a, b);
        a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented &&
            !1 === a.returnValue ? t : x) : this.type = a;
        b && h.extend(this, b);
        this.timeStamp = a && a.timeStamp || h.now();
        this[h.expando] = !0
    };
    h.Event.prototype = {
        isDefaultPrevented: x,
        isPropagationStopped: x,
        isImmediatePropagationStopped: x,
        preventDefault: function() {
            var a = this.originalEvent;
            this.isDefaultPrevented = t;
            a && (a.preventDefault ? a.preventDefault() : a.returnValue = !1)
        },
        stopPropagation: function() {
            var a = this.originalEvent;
            this.isPropagationStopped = t;
            a && (a.stopPropagation && a.stopPropagation(), a.cancelBubble = !0)
        },
        stopImmediatePropagation: function() {
            var a =
                this.originalEvent;
            this.isImmediatePropagationStopped = t;
            a && a.stopImmediatePropagation && a.stopImmediatePropagation();
            this.stopPropagation()
        }
    };
    h.each({
        mouseenter: "mouseover",
        mouseleave: "mouseout",
        pointerenter: "pointerover",
        pointerleave: "pointerout"
    }, function(a, b) {
        h.event.special[a] = {
            delegateType: b,
            bindType: b,
            handle: function(a) {
                var c, l = a.relatedTarget,
                    d = a.handleObj;
                if (!l || l !== this && !h.contains(this, l)) a.type = d.origType, c = d.handler.apply(this, arguments), a.type = b;
                return c
            }
        }
    });
    F.submitBubbles || (h.event.special.submit = {
        setup: function() {
            if (h.nodeName(this, "form")) return !1;
            h.event.add(this, "click._submit keypress._submit", function(a) {
                a = a.target;
                (a = h.nodeName(a, "input") || h.nodeName(a, "button") ? a.form : void 0) && !h._data(a, "submitBubbles") && (h.event.add(a, "submit._submit", function(a) {
                    a._submit_bubble = !0
                }), h._data(a, "submitBubbles", !0))
            })
        },
        postDispatch: function(a) {
            a._submit_bubble && (delete a._submit_bubble, this.parentNode && !a.isTrigger && h.event.simulate("submit", this.parentNode, a, !0))
        },
        teardown: function() {
            if (h.nodeName(this,
                    "form")) return !1;
            h.event.remove(this, "._submit")
        }
    });
    F.changeBubbles || (h.event.special.change = {
        setup: function() {
            if (D.test(this.nodeName)) {
                if ("checkbox" === this.type || "radio" === this.type) h.event.add(this, "propertychange._change", function(a) {
                    "checked" === a.originalEvent.propertyName && (this._just_changed = !0)
                }), h.event.add(this, "click._change", function(a) {
                    this._just_changed && !a.isTrigger && (this._just_changed = !1);
                    h.event.simulate("change", this, a, !0)
                });
                return !1
            }
            h.event.add(this, "beforeactivate._change", function(a) {
                a =
                    a.target;
                D.test(a.nodeName) && !h._data(a, "changeBubbles") && (h.event.add(a, "change._change", function(a) {
                    !this.parentNode || a.isSimulated || a.isTrigger || h.event.simulate("change", this.parentNode, a, !0)
                }), h._data(a, "changeBubbles", !0))
            })
        },
        handle: function(a) {
            var b = a.target;
            if (this !== b || a.isSimulated || a.isTrigger || "radio" !== b.type && "checkbox" !== b.type) return a.handleObj.handler.apply(this, arguments)
        },
        teardown: function() {
            h.event.remove(this, "._change");
            return !D.test(this.nodeName)
        }
    });
    F.focusinBubbles || h.each({
        focus: "focusin",
        blur: "focusout"
    }, function(a, b) {
        var c = function(a) {
            h.event.simulate(b, a.target, h.event.fix(a), !0)
        };
        h.event.special[b] = {
            setup: function() {
                var d = this.ownerDocument || this,
                    f = h._data(d, b);
                f || d.addEventListener(a, c, !0);
                h._data(d, b, (f || 0) + 1)
            },
            teardown: function() {
                var d = this.ownerDocument || this,
                    f = h._data(d, b) - 1;
                f ? h._data(d, b, f) : (d.removeEventListener(a, c, !0), h._removeData(d, b))
            }
        }
    });
    h.fn.extend({
        on: function(a, b, c, d, f) {
            var e, r;
            if ("object" === typeof a) {
                "string" !== typeof b && (c = c || b, b = void 0);
                for (e in a) this.on(e,
                    b, c, a[e], f);
                return this
            }
            null == c && null == d ? (d = b, c = b = void 0) : null == d && ("string" === typeof b ? (d = c, c = void 0) : (d = c, c = b, b = void 0));
            if (!1 === d) d = x;
            else if (!d) return this;
            1 === f && (r = d, d = function(a) {
                h().off(a);
                return r.apply(this, arguments)
            }, d.guid = r.guid || (r.guid = h.guid++));
            return this.each(function() {
                h.event.add(this, a, d, c, b)
            })
        },
        one: function(a, b, c, d) {
            return this.on(a, b, c, d, 1)
        },
        off: function(a, b, c) {
            var d;
            if (a && a.preventDefault && a.handleObj) return d = a.handleObj, h(a.delegateTarget).off(d.namespace ? d.origType + "." +
                d.namespace : d.origType, d.selector, d.handler), this;
            if ("object" === typeof a) {
                for (d in a) this.off(d, b, a[d]);
                return this
            }
            if (!1 === b || "function" === typeof b) c = b, b = void 0;
            !1 === c && (c = x);
            return this.each(function() {
                h.event.remove(this, a, c, b)
            })
        },
        trigger: function(a, b) {
            return this.each(function() {
                h.event.trigger(a, b, this)
            })
        },
        triggerHandler: function(a, b) {
            var c = this[0];
            if (c) return h.event.trigger(a, b, c, !0)
        }
    });
    var Pa = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
        Qa = / jQuery\d+="(?:null|\d+)"/g,
        Fa = new RegExp("<(?:" + Pa + ")[\\s/>]", "i"),
        Na = /^\s+/,
        ba = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
        fa = /<([\w:]+)/,
        Ra = /<tbody/i,
        Sa = /<|&#?\w+;/,
        ib = /<(?:script|style|link)/i,
        Za = /checked\s*(?:[^=]|=\s*.checked.)/i,
        eb = /^$|\/(?:java|ecma)script/i,
        Ta = /^true\/(.*)/,
        Ua = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
        Ca = {
            option: [1, "<select multiple='multiple'>", "</select>"],
            legend: [1, "<fieldset>", "</fieldset>"],
            area: [1, "<map>", "</map>"],
            param: [1, "<object>",
                "</object>"
            ],
            thead: [1, "<table>", "</table>"],
            tr: [2, "<table><tbody>", "</tbody></table>"],
            col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
            td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
            _default: F.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"]
        },
        jb = v(H).appendChild(H.createElement("div"));
    Ca.optgroup = Ca.option;
    Ca.tbody = Ca.tfoot = Ca.colgroup = Ca.caption = Ca.thead;
    Ca.th = Ca.td;
    h.extend({
        clone: function(a, b, c) {
            var d, f, e, r, k, D = h.contains(a.ownerDocument, a);
            F.html5Clone || h.isXMLDoc(a) || !Fa.test("<" +
                a.nodeName + ">") ? e = a.cloneNode(!0) : (jb.innerHTML = a.outerHTML, jb.removeChild(e = jb.firstChild));
            if (!(F.noCloneEvent && F.noCloneChecked || 1 !== a.nodeType && 11 !== a.nodeType || h.isXMLDoc(a)))
                for (d = C(e), k = C(a), r = 0; null != (f = k[r]); ++r)
                    if (d[r]) {
                        var g = d[r],
                            n = void 0,
                            u = void 0,
                            q = void 0;
                        if (1 === g.nodeType) {
                            n = g.nodeName.toLowerCase();
                            if (!F.noCloneEvent && g[h.expando]) {
                                q = h._data(g);
                                for (u in q.events) h.removeEvent(g, u, q.handle);
                                g.removeAttribute(h.expando)
                            }
                            if ("script" === n && g.text !== f.text) y(g).text = f.text, E(g);
                            else if ("object" ===
                                n) g.parentNode && (g.outerHTML = f.outerHTML), F.html5Clone && f.innerHTML && !h.trim(g.innerHTML) && (g.innerHTML = f.innerHTML);
                            else if ("input" === n && ua.test(f.type)) g.defaultChecked = g.checked = f.checked, g.value !== f.value && (g.value = f.value);
                            else if ("option" === n) g.defaultSelected = g.selected = f.defaultSelected;
                            else if ("input" === n || "textarea" === n) g.defaultValue = f.defaultValue
                        }
                    }
            if (b)
                if (c)
                    for (k = k || C(a), d = d || C(e), r = 0; null != (f = k[r]); r++) I(f, d[r]);
                else I(a, e);
            d = C(e, "script");
            0 < d.length && N(d, !D && C(a, "script"));
            return e
        },
        buildFragment: function(a, b, c, d) {
            for (var f, e, r, k, g, D, n = a.length, u = v(b), q = [], w = 0; w < n; w++)
                if ((e = a[w]) || 0 === e)
                    if ("object" === h.type(e)) h.merge(q, e.nodeType ? [e] : e);
                    else if (Sa.test(e)) {
                r = r || u.appendChild(b.createElement("div"));
                k = (fa.exec(e) || ["", ""])[1].toLowerCase();
                D = Ca[k] || Ca._default;
                r.innerHTML = D[1] + e.replace(ba, "<$1></$2>") + D[2];
                for (f = D[0]; f--;) r = r.lastChild;
                !F.leadingWhitespace && Na.test(e) && q.push(b.createTextNode(Na.exec(e)[0]));
                if (!F.tbody)
                    for (f = (e = "table" !== k || Ra.test(e) ? "<table>" !== D[1] || Ra.test(e) ?
                            0 : r : r.firstChild) && e.childNodes.length; f--;) h.nodeName(g = e.childNodes[f], "tbody") && !g.childNodes.length && e.removeChild(g);
                h.merge(q, r.childNodes);
                for (r.textContent = ""; r.firstChild;) r.removeChild(r.firstChild);
                r = u.lastChild
            } else q.push(b.createTextNode(e));
            r && u.removeChild(r);
            F.appendChecked || h.grep(C(q, "input"), K);
            for (w = 0; e = q[w++];)
                if (!d || -1 === h.inArray(e, d))
                    if (a = h.contains(e.ownerDocument, e), r = C(u.appendChild(e), "script"), a && N(r), c)
                        for (f = 0; e = r[f++];) eb.test(e.type || "") && c.push(e);
            return u
        },
        cleanData: function(a,
            b) {
            for (var c, d, f, e, r = 0, k = h.expando, g = h.cache, D = F.deleteExpando, n = h.event.special; null != (c = a[r]); r++)
                if (b || h.acceptData(c))
                    if (e = (f = c[k]) && g[f]) {
                        if (e.events)
                            for (d in e.events) n[d] ? h.event.remove(c, d) : h.removeEvent(c, d, e.handle);
                        g[f] && (delete g[f], D ? delete c[k] : "undefined" !== typeof c.removeAttribute ? c.removeAttribute(k) : c[k] = null, ra.push(f))
                    }
        }
    });
    h.fn.extend({
        text: function(a) {
            return pa(this, function(a) {
                    return void 0 === a ? h.text(this) : this.empty().append((this[0] && this[0].ownerDocument || H).createTextNode(a))
                },
                null, a, arguments.length)
        },
        append: function() {
            return this.domManip(arguments, function(a) {
                1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || A(this, a).appendChild(a)
            })
        },
        prepend: function() {
            return this.domManip(arguments, function(a) {
                if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) {
                    var b = A(this, a);
                    b.insertBefore(a, b.firstChild)
                }
            })
        },
        before: function() {
            return this.domManip(arguments, function(a) {
                this.parentNode && this.parentNode.insertBefore(a, this)
            })
        },
        after: function() {
            return this.domManip(arguments,
                function(a) {
                    this.parentNode && this.parentNode.insertBefore(a, this.nextSibling)
                })
        },
        remove: function(a, b) {
            for (var c, d = a ? h.filter(a, this) : this, f = 0; null != (c = d[f]); f++) b || 1 !== c.nodeType || h.cleanData(C(c)), c.parentNode && (b && h.contains(c.ownerDocument, c) && N(C(c, "script")), c.parentNode.removeChild(c));
            return this
        },
        empty: function() {
            for (var a, b = 0; null != (a = this[b]); b++) {
                for (1 === a.nodeType && h.cleanData(C(a, !1)); a.firstChild;) a.removeChild(a.firstChild);
                a.options && h.nodeName(a, "select") && (a.options.length = 0)
            }
            return this
        },
        clone: function(a, b) {
            a = null == a ? !1 : a;
            b = null == b ? a : b;
            return this.map(function() {
                return h.clone(this, a, b)
            })
        },
        html: function(a) {
            return pa(this, function(a) {
                var b = this[0] || {},
                    c = 0,
                    d = this.length;
                if (void 0 === a) return 1 === b.nodeType ? b.innerHTML.replace(Qa, "") : void 0;
                if (!("string" !== typeof a || ib.test(a) || !F.htmlSerialize && Fa.test(a) || !F.leadingWhitespace && Na.test(a) || Ca[(fa.exec(a) || ["", ""])[1].toLowerCase()])) {
                    a = a.replace(ba, "<$1></$2>");
                    try {
                        for (; c < d; c++) b = this[c] || {}, 1 === b.nodeType && (h.cleanData(C(b, !1)), b.innerHTML =
                            a);
                        b = 0
                    } catch (l) {}
                }
                b && this.empty().append(a)
            }, null, a, arguments.length)
        },
        replaceWith: function() {
            var a = arguments[0];
            this.domManip(arguments, function(b) {
                a = this.parentNode;
                h.cleanData(C(this));
                a && a.replaceChild(b, this)
            });
            return a && (a.length || a.nodeType) ? this : this.remove()
        },
        detach: function(a) {
            return this.remove(a, !0)
        },
        domManip: function(a, b) {
            a = Ja.apply([], a);
            var c, d, f, e, r = 0,
                k = this.length,
                g = this,
                D = k - 1,
                n = a[0],
                u = h.isFunction(n);
            if (u || 1 < k && "string" === typeof n && !F.checkClone && Za.test(n)) return this.each(function(c) {
                var d =
                    g.eq(c);
                u && (a[0] = n.call(this, c, d.html()));
                d.domManip(a, b)
            });
            if (k && (e = h.buildFragment(a, this[0].ownerDocument, !1, this), c = e.firstChild, 1 === e.childNodes.length && (e = c), c)) {
                f = h.map(C(e, "script"), y);
                for (d = f.length; r < k; r++) c = e, r !== D && (c = h.clone(c, !0, !0), d && h.merge(f, C(c, "script"))), b.call(this[r], c, r);
                if (d)
                    for (e = f[f.length - 1].ownerDocument, h.map(f, E), r = 0; r < d; r++) c = f[r], eb.test(c.type || "") && !h._data(c, "globalEval") && h.contains(e, c) && (c.src ? h._evalUrl && h._evalUrl(c.src) : h.globalEval((c.text || c.textContent ||
                        c.innerHTML || "").replace(Ua, "")));
                e = c = null
            }
            return this
        }
    });
    h.each({
        appendTo: "append",
        prependTo: "prepend",
        insertBefore: "before",
        insertAfter: "after",
        replaceAll: "replaceWith"
    }, function(a, b) {
        h.fn[a] = function(a) {
            for (var c = 0, d = [], l = h(a), f = l.length - 1; c <= f; c++) a = c === f ? this : this.clone(!0), h(l[c])[b](a), W.apply(d, a.get());
            return this.pushStack(d)
        }
    });
    var gb, xb = {};
    (function() {
        var a;
        F.shrinkWrapBlocks = function() {
            if (null != a) return a;
            a = !1;
            var b, c, d;
            if ((c = H.getElementsByTagName("body")[0]) && c.style) return b = H.createElement("div"),
                d = H.createElement("div"), d.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px", c.appendChild(d).appendChild(b), "undefined" !== typeof b.style.zoom && (b.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1", b.appendChild(H.createElement("div")).style.width = "5px", a = 3 !== b.offsetWidth), c.removeChild(d), a
        }
    })();
    var zb = /^margin/,
        kb = new RegExp("^(" + wa + ")(?!px)[a-z%]+$", "i"),
        Xa,
        Ya, Pb = /^(top|right|bottom|left)$/;
    c.getComputedStyle ? (Xa = function(a) {
        return a.ownerDocument.defaultView.getComputedStyle(a, null)
    }, Ya = function(a, b, c) {
        var d, f, e = a.style;
        f = (c = c || Xa(a)) ? c.getPropertyValue(b) || c[b] : void 0;
        c && ("" !== f || h.contains(a.ownerDocument, a) || (f = h.style(a, b)), kb.test(f) && zb.test(b) && (a = e.width, b = e.minWidth, d = e.maxWidth, e.minWidth = e.maxWidth = e.width = f, f = c.width, e.width = a, e.minWidth = b, e.maxWidth = d));
        return void 0 === f ? f : f + ""
    }) : H.documentElement.currentStyle && (Xa = function(a) {
            return a.currentStyle
        },
        Ya = function(a, b, c) {
            var d, f, e, h = a.style;
            e = (c = c || Xa(a)) ? c[b] : void 0;
            null == e && h && h[b] && (e = h[b]);
            if (kb.test(e) && !Pb.test(b)) {
                c = h.left;
                if (f = (d = a.runtimeStyle) && d.left) d.left = a.currentStyle.left;
                h.left = "fontSize" === b ? "1em" : e;
                e = h.pixelLeft + "px";
                h.left = c;
                f && (d.left = f)
            }
            return void 0 === e ? e : e + "" || "auto"
        });
    (function() {
        function a() {
            var b, d, l, h;
            if ((d = H.getElementsByTagName("body")[0]) && d.style) {
                b = H.createElement("div");
                l = H.createElement("div");
                l.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
                d.appendChild(l).appendChild(b);
                b.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute";
                f = e = !1;
                k = !0;
                c.getComputedStyle && (f = "1%" !== (c.getComputedStyle(b, null) || {}).top, e = "4px" === (c.getComputedStyle(b, null) || {
                        width: "4px"
                    }).width, h = b.appendChild(H.createElement("div")), h.style.cssText = b.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",
                    h.style.marginRight = h.style.width = "0", b.style.width = "1px", k = !parseFloat((c.getComputedStyle(h, null) || {}).marginRight));
                b.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
                h = b.getElementsByTagName("td");
                h[0].style.cssText = "margin:0;border:0;padding:0;display:none";
                if (r = 0 === h[0].offsetHeight) h[0].style.display = "", h[1].style.display = "none", r = 0 === h[0].offsetHeight;
                d.removeChild(l)
            }
        }
        var b, d, f, e, r, k;
        b = H.createElement("div");
        b.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
        if (d = (d = b.getElementsByTagName("a")[0]) && d.style) d.cssText = "float:left;opacity:.5", F.opacity = "0.5" === d.opacity, F.cssFloat = !!d.cssFloat, b.style.backgroundClip = "content-box", b.cloneNode(!0).style.backgroundClip = "", F.clearCloneStyle = "content-box" === b.style.backgroundClip, F.boxSizing = "" === d.boxSizing || "" === d.MozBoxSizing || "" === d.WebkitBoxSizing, h.extend(F, {
            reliableHiddenOffsets: function() {
                null == r && a();
                return r
            },
            boxSizingReliable: function() {
                null == e && a();
                return e
            },
            pixelPosition: function() {
                null == f && a();
                return f
            },
            reliableMarginRight: function() {
                null == k && a();
                return k
            }
        })
    })();
    h.swap = function(a, b, c, d) {
        var f, e = {};
        for (f in b) e[f] = a.style[f], a.style[f] = b[f];
        c = c.apply(a, d || []);
        for (f in b) a.style[f] = e[f];
        return c
    };
    var rb = /alpha\([^)]*\)/i,
        Qb = /opacity\s*=\s*([^)]*)/,
        Rb = /^(none|table(?!-c[ea]).+)/,
        Mb = new RegExp("^(" + wa + ")(.*)$", "i"),
        Sb = new RegExp("^([+-])=(" + wa + ")", "i"),
        Tb = {
            position: "absolute",
            visibility: "hidden",
            display: "block"
        },
        Ab = {
            letterSpacing: "0",
            fontWeight: "400"
        },
        yb = ["Webkit", "O", "Moz", "ms"];
    h.extend({
        cssHooks: {
            opacity: {
                get: function(a,
                    b) {
                    if (b) {
                        var c = Ya(a, "opacity");
                        return "" === c ? "1" : c
                    }
                }
            }
        },
        cssNumber: {
            columnCount: !0,
            fillOpacity: !0,
            flexGrow: !0,
            flexShrink: !0,
            fontWeight: !0,
            lineHeight: !0,
            opacity: !0,
            order: !0,
            orphans: !0,
            widows: !0,
            zIndex: !0,
            zoom: !0
        },
        cssProps: {
            "float": F.cssFloat ? "cssFloat" : "styleFloat"
        },
        style: function(a, b, c, d) {
            if (a && 3 !== a.nodeType && 8 !== a.nodeType && a.style) {
                var f, e, r, k = h.camelCase(b),
                    g = a.style;
                b = h.cssProps[k] || (h.cssProps[k] = U(g, k));
                r = h.cssHooks[b] || h.cssHooks[k];
                if (void 0 !== c) {
                    if (e = typeof c, "string" === e && (f = Sb.exec(c)) &&
                        (c = (f[1] + 1) * f[2] + parseFloat(h.css(a, b)), e = "number"), null != c && c === c && ("number" !== e || h.cssNumber[k] || (c += "px"), F.clearCloneStyle || "" !== c || 0 !== b.indexOf("background") || (g[b] = "inherit"), !(r && "set" in r) || void 0 !== (c = r.set(a, c, d)))) try {
                        g[b] = c
                    } catch (D) {}
                } else return r && "get" in r && void 0 !== (f = r.get(a, !1, d)) ? f : g[b]
            }
        },
        css: function(a, b, c, d) {
            var f, e;
            e = h.camelCase(b);
            b = h.cssProps[e] || (h.cssProps[e] = U(a.style, e));
            (e = h.cssHooks[b] || h.cssHooks[e]) && "get" in e && (f = e.get(a, !0, c));
            void 0 === f && (f = Ya(a, b, d));
            "normal" ===
            f && b in Ab && (f = Ab[b]);
            return "" === c || c ? (a = parseFloat(f), !0 === c || h.isNumeric(a) ? a || 0 : f) : f
        }
    });
    h.each(["height", "width"], function(a, b) {
        h.cssHooks[b] = {
            get: function(a, c, d) {
                if (c) return Rb.test(h.css(a, "display")) && 0 === a.offsetWidth ? h.swap(a, Tb, function() {
                    return Ha(a, b, d)
                }) : Ha(a, b, d)
            },
            set: function(a, c, d) {
                var l = d && Xa(a);
                return R(a, c, d ? la(a, b, d, F.boxSizing && "border-box" === h.css(a, "boxSizing", !1, l), l) : 0)
            }
        }
    });
    F.opacity || (h.cssHooks.opacity = {
        get: function(a, b) {
            return Qb.test((b && a.currentStyle ? a.currentStyle.filter :
                a.style.filter) || "") ? .01 * parseFloat(RegExp.$1) + "" : b ? "1" : ""
        },
        set: function(a, b) {
            var c = a.style,
                d = a.currentStyle,
                f = h.isNumeric(b) ? "alpha(opacity=" + 100 * b + ")" : "",
                e = d && d.filter || c.filter || "";
            c.zoom = 1;
            if ((1 <= b || "" === b) && "" === h.trim(e.replace(rb, "")) && c.removeAttribute && (c.removeAttribute("filter"), "" === b || d && !d.filter)) return;
            c.filter = rb.test(e) ? e.replace(rb, f) : e + " " + f
        }
    });
    h.cssHooks.marginRight = P(F.reliableMarginRight, function(a, b) {
        if (b) return h.swap(a, {
            display: "inline-block"
        }, Ya, [a, "marginRight"])
    });
    h.each({
        margin: "",
        padding: "",
        border: "Width"
    }, function(a, b) {
        h.cssHooks[a + b] = {
            expand: function(c) {
                var d = 0,
                    f = {};
                for (c = "string" === typeof c ? c.split(" ") : [c]; 4 > d; d++) f[a + ga[d] + b] = c[d] || c[d - 2] || c[0];
                return f
            }
        };
        zb.test(a) || (h.cssHooks[a + b].set = R)
    });
    h.fn.extend({
        css: function(a, b) {
            return pa(this, function(a, b, c) {
                var d, f = {},
                    l = 0;
                if (h.isArray(b)) {
                    c = Xa(a);
                    for (d = b.length; l < d; l++) f[b[l]] = h.css(a, b[l], !1, c);
                    return f
                }
                return void 0 !== c ? h.style(a, b, c) : h.css(a, b)
            }, a, b, 1 < arguments.length)
        },
        show: function() {
            return Ba(this, !0)
        },
        hide: function() {
            return Ba(this)
        },
        toggle: function(a) {
            return "boolean" === typeof a ? a ? this.show() : this.hide() : this.each(function() {
                Ea(this) ? h(this).show() : h(this).hide()
            })
        }
    });
    h.Tween = J;
    J.prototype = {
        constructor: J,
        init: function(a, b, c, d, f, e) {
            this.elem = a;
            this.prop = c;
            this.easing = f || "swing";
            this.options = b;
            this.start = this.now = this.cur();
            this.end = d;
            this.unit = e || (h.cssNumber[c] ? "" : "px")
        },
        cur: function() {
            var a = J.propHooks[this.prop];
            return a && a.get ? a.get(this) : J.propHooks._default.get(this)
        },
        run: function(a) {
            var b, c = J.propHooks[this.prop];
            this.pos =
                this.options.duration ? b = h.easing[this.easing](a, this.options.duration * a, 0, 1, this.options.duration) : b = a;
            this.now = (this.end - this.start) * b + this.start;
            this.options.step && this.options.step.call(this.elem, this.now, this);
            c && c.set ? c.set(this) : J.propHooks._default.set(this);
            return this
        }
    };
    J.prototype.init.prototype = J.prototype;
    J.propHooks = {
        _default: {
            get: function(a) {
                return null == a.elem[a.prop] || a.elem.style && null != a.elem.style[a.prop] ? (a = h.css(a.elem, a.prop, "")) && "auto" !== a ? a : 0 : a.elem[a.prop]
            },
            set: function(a) {
                if (h.fx.step[a.prop]) h.fx.step[a.prop](a);
                else a.elem.style && (null != a.elem.style[h.cssProps[a.prop]] || h.cssHooks[a.prop]) ? h.style(a.elem, a.prop, a.now + a.unit) : a.elem[a.prop] = a.now
            }
        }
    };
    J.propHooks.scrollTop = J.propHooks.scrollLeft = {
        set: function(a) {
            a.elem.nodeType && a.elem.parentNode && (a.elem[a.prop] = a.now)
        }
    };
    h.easing = {
        linear: function(a) {
            return a
        },
        swing: function(a) {
            return .5 - Math.cos(a * Math.PI) / 2
        }
    };
    h.fx = J.prototype.init;
    h.fx.step = {};
    var cb, mb, Ub = /^(?:toggle|show|hide)$/,
        Bb = new RegExp("^(?:([+-])=|)(" + wa + ")([a-z%]*)$", "i"),
        Vb = /queueHooks$/,
        lb = [function(a,
            b, c) {
            var d, f, e, r, k, g, D = this,
                n = {},
                u = a.style,
                q = a.nodeType && Ea(a),
                w = h._data(a, "fxshow");
            c.queue || (r = h._queueHooks(a, "fx"), null == r.unqueued && (r.unqueued = 0, k = r.empty.fire, r.empty.fire = function() {
                r.unqueued || k()
            }), r.unqueued++, D.always(function() {
                D.always(function() {
                    r.unqueued--;
                    h.queue(a, "fx").length || r.empty.fire()
                })
            }));
            1 === a.nodeType && ("height" in b || "width" in b) && (c.overflow = [u.overflow, u.overflowX, u.overflowY], g = h.css(a, "display"), f = "none" === g ? h._data(a, "olddisplay") || G(a.nodeName) : g, "inline" === f &&
                "none" === h.css(a, "float") && (F.inlineBlockNeedsLayout && "inline" !== G(a.nodeName) ? u.zoom = 1 : u.display = "inline-block"));
            c.overflow && (u.overflow = "hidden", F.shrinkWrapBlocks() || D.always(function() {
                u.overflow = c.overflow[0];
                u.overflowX = c.overflow[1];
                u.overflowY = c.overflow[2]
            }));
            for (d in b)
                if (f = b[d], Ub.exec(f)) {
                    delete b[d];
                    e = e || "toggle" === f;
                    if (f === (q ? "hide" : "show"))
                        if ("show" === f && w && void 0 !== w[d]) q = !0;
                        else continue;
                    n[d] = w && w[d] || h.style(a, d)
                } else g = void 0;
            if (h.isEmptyObject(n)) "inline" === ("none" === g ? G(a.nodeName) :
                g) && (u.display = g);
            else
                for (d in w ? "hidden" in w && (q = w.hidden) : w = h._data(a, "fxshow", {}), e && (w.hidden = !q), q ? h(a).show() : D.done(function() {
                        h(a).hide()
                    }), D.done(function() {
                        var b;
                        h._removeData(a, "fxshow");
                        for (b in n) h.style(a, b, n[b])
                    }), n) b = aa(q ? w[d] : 0, d, D), d in w || (w[d] = b.start, q && (b.end = b.start, b.start = "width" === d || "height" === d ? 1 : 0))
        }],
        hb = {
            "*": [function(a, b) {
                var c = this.createTween(a, b),
                    d = c.cur(),
                    f = Bb.exec(b),
                    e = f && f[3] || (h.cssNumber[a] ? "" : "px"),
                    r = (h.cssNumber[a] || "px" !== e && +d) && Bb.exec(h.css(c.elem, a)),
                    k = 1,
                    g = 20;
                if (r && r[3] !== e) {
                    e = e || r[3];
                    f = f || [];
                    r = +d || 1;
                    do k = k || ".5", r /= k, h.style(c.elem, a, r + e); while (k !== (k = c.cur() / d) && 1 !== k && --g)
                }
                f && (r = c.start = +r || +d || 0, c.unit = e, c.end = f[1] ? r + (f[1] + 1) * f[2] : +f[2]);
                return c
            }]
        };
    h.Animation = h.extend(T, {
        tweener: function(a, b) {
            h.isFunction(a) ? (b = a, a = ["*"]) : a = a.split(" ");
            for (var c, d = 0, f = a.length; d < f; d++) c = a[d], hb[c] = hb[c] || [], hb[c].unshift(b)
        },
        prefilter: function(a, b) {
            b ? lb.unshift(a) : lb.push(a)
        }
    });
    h.speed = function(a, b, c) {
        var d = a && "object" === typeof a ? h.extend({}, a) : {
            complete: c ||
                !c && b || h.isFunction(a) && a,
            duration: a,
            easing: c && b || b && !h.isFunction(b) && b
        };
        d.duration = h.fx.off ? 0 : "number" === typeof d.duration ? d.duration : d.duration in h.fx.speeds ? h.fx.speeds[d.duration] : h.fx.speeds._default;
        if (null == d.queue || !0 === d.queue) d.queue = "fx";
        d.old = d.complete;
        d.complete = function() {
            h.isFunction(d.old) && d.old.call(this);
            d.queue && h.dequeue(this, d.queue)
        };
        return d
    };
    h.fn.extend({
        fadeTo: function(a, b, c, d) {
            return this.filter(Ea).css("opacity", 0).show().end().animate({
                opacity: b
            }, a, c, d)
        },
        animate: function(a,
            b, c, d) {
            var f = h.isEmptyObject(a),
                e = h.speed(b, c, d);
            b = function() {
                var b = T(this, h.extend({}, a), e);
                (f || h._data(this, "finish")) && b.stop(!0)
            };
            b.finish = b;
            return f || !1 === e.queue ? this.each(b) : this.queue(e.queue, b)
        },
        stop: function(a, b, c) {
            var d = function(a) {
                var b = a.stop;
                delete a.stop;
                b(c)
            };
            "string" !== typeof a && (c = b, b = a, a = void 0);
            b && !1 !== a && this.queue(a || "fx", []);
            return this.each(function() {
                var b = !0,
                    f = null != a && a + "queueHooks",
                    e = h.timers,
                    r = h._data(this);
                if (f) r[f] && r[f].stop && d(r[f]);
                else
                    for (f in r) r[f] && r[f].stop &&
                        Vb.test(f) && d(r[f]);
                for (f = e.length; f--;) e[f].elem !== this || null != a && e[f].queue !== a || (e[f].anim.stop(c), b = !1, e.splice(f, 1));
                !b && c || h.dequeue(this, a)
            })
        },
        finish: function(a) {
            !1 !== a && (a = a || "fx");
            return this.each(function() {
                var b, c = h._data(this),
                    d = c[a + "queue"];
                b = c[a + "queueHooks"];
                var f = h.timers,
                    e = d ? d.length : 0;
                c.finish = !0;
                h.queue(this, a, []);
                b && b.stop && b.stop.call(this, !0);
                for (b = f.length; b--;) f[b].elem === this && f[b].queue === a && (f[b].anim.stop(!0), f.splice(b, 1));
                for (b = 0; b < e; b++) d[b] && d[b].finish && d[b].finish.call(this);
                delete c.finish
            })
        }
    });
    h.each(["toggle", "show", "hide"], function(a, b) {
        var c = h.fn[b];
        h.fn[b] = function(a, d, f) {
            return null == a || "boolean" === typeof a ? c.apply(this, arguments) : this.animate(ca(b, !0), a, d, f)
        }
    });
    h.each({
        slideDown: ca("show"),
        slideUp: ca("hide"),
        slideToggle: ca("toggle"),
        fadeIn: {
            opacity: "show"
        },
        fadeOut: {
            opacity: "hide"
        },
        fadeToggle: {
            opacity: "toggle"
        }
    }, function(a, b) {
        h.fn[a] = function(a, c, d) {
            return this.animate(b, a, c, d)
        }
    });
    h.timers = [];
    h.fx.tick = function() {
        var a, b = h.timers,
            c = 0;
        for (cb = h.now(); c < b.length; c++) a =
            b[c], a() || b[c] !== a || b.splice(c--, 1);
        b.length || h.fx.stop();
        cb = void 0
    };
    h.fx.timer = function(a) {
        h.timers.push(a);
        a() ? h.fx.start() : h.timers.pop()
    };
    h.fx.interval = 13;
    h.fx.start = function() {
        mb || (mb = setInterval(h.fx.tick, h.fx.interval))
    };
    h.fx.stop = function() {
        clearInterval(mb);
        mb = null
    };
    h.fx.speeds = {
        slow: 600,
        fast: 200,
        _default: 400
    };
    h.fn.delay = function(a, b) {
        a = h.fx ? h.fx.speeds[a] || a : a;
        return this.queue(b || "fx", function(b, c) {
            var d = setTimeout(b, a);
            c.stop = function() {
                clearTimeout(d)
            }
        })
    };
    (function() {
        var a, b, c, d, f;
        b =
            H.createElement("div");
        b.setAttribute("className", "t");
        b.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
        d = b.getElementsByTagName("a")[0];
        c = H.createElement("select");
        f = c.appendChild(H.createElement("option"));
        a = b.getElementsByTagName("input")[0];
        d.style.cssText = "top:1px";
        F.getSetAttribute = "t" !== b.className;
        F.style = /top/.test(d.getAttribute("style"));
        F.hrefNormalized = "/a" === d.getAttribute("href");
        F.checkOn = !!a.value;
        F.optSelected = f.selected;
        F.enctype = !!H.createElement("form").enctype;
        c.disabled = !0;
        F.optDisabled = !f.disabled;
        a = H.createElement("input");
        a.setAttribute("value", "");
        F.input = "" === a.getAttribute("value");
        a.value = "t";
        a.setAttribute("type", "radio");
        F.radioValue = "t" === a.value
    })();
    var Wb = /\r/g;
    h.fn.extend({
        val: function(a) {
            var b, c, d, f = this[0];
            if (arguments.length) return d = h.isFunction(a), this.each(function(c) {
                1 === this.nodeType && (c = d ? a.call(this, c, h(this).val()) : a, null == c ? c = "" : "number" === typeof c ? c += "" : h.isArray(c) && (c = h.map(c, function(a) {
                        return null == a ? "" : a + ""
                    })), b = h.valHooks[this.type] ||
                    h.valHooks[this.nodeName.toLowerCase()], b && "set" in b && void 0 !== b.set(this, c, "value") || (this.value = c))
            });
            if (f) {
                if ((b = h.valHooks[f.type] || h.valHooks[f.nodeName.toLowerCase()]) && "get" in b && void 0 !== (c = b.get(f, "value"))) return c;
                c = f.value;
                return "string" === typeof c ? c.replace(Wb, "") : null == c ? "" : c
            }
        }
    });
    h.extend({
        valHooks: {
            option: {
                get: function(a) {
                    var b = h.find.attr(a, "value");
                    return null != b ? b : h.trim(h.text(a))
                }
            },
            select: {
                get: function(a) {
                    for (var b, c = a.options, d = a.selectedIndex, f = (a = "select-one" === a.type || 0 > d) ?
                            null : [], e = a ? d + 1 : c.length, r = 0 > d ? e : a ? d : 0; r < e; r++)
                        if (b = c[r], !(!b.selected && r !== d || (F.optDisabled ? b.disabled : null !== b.getAttribute("disabled")) || b.parentNode.disabled && h.nodeName(b.parentNode, "optgroup"))) {
                            b = h(b).val();
                            if (a) return b;
                            f.push(b)
                        }
                    return f
                },
                set: function(a, b) {
                    for (var c, d, f = a.options, e = h.makeArray(b), r = f.length; r--;)
                        if (d = f[r], 0 <= h.inArray(h.valHooks.option.get(d), e)) try {
                            d.selected = c = !0
                        } catch (k) {
                            d.scrollHeight
                        } else d.selected = !1;
                    c || (a.selectedIndex = -1);
                    return f
                }
            }
        }
    });
    h.each(["radio", "checkbox"],
        function() {
            h.valHooks[this] = {
                set: function(a, b) {
                    if (h.isArray(b)) return a.checked = 0 <= h.inArray(h(a).val(), b)
                }
            };
            F.checkOn || (h.valHooks[this].get = function(a) {
                return null === a.getAttribute("value") ? "on" : a.value
            })
        });
    var fb, Cb, Va = h.expr.attrHandle,
        sb = /^(?:checked|selected)$/i,
        $a = F.getSetAttribute,
        nb = F.input;
    h.fn.extend({
        attr: function(a, b) {
            return pa(this, h.attr, a, b, 1 < arguments.length)
        },
        removeAttr: function(a) {
            return this.each(function() {
                h.removeAttr(this, a)
            })
        }
    });
    h.extend({
        attr: function(a, b, c) {
            var d, f, e = a.nodeType;
            if (a && 3 !== e && 8 !== e && 2 !== e) {
                if ("undefined" === typeof a.getAttribute) return h.prop(a, b, c);
                1 === e && h.isXMLDoc(a) || (b = b.toLowerCase(), d = h.attrHooks[b] || (h.expr.match.bool.test(b) ? Cb : fb));
                if (void 0 !== c)
                    if (null === c) h.removeAttr(a, b);
                    else {
                        if (d && "set" in d && void 0 !== (f = d.set(a, c, b))) return f;
                        a.setAttribute(b, c + "");
                        return c
                    } else {
                    if (d && "get" in d && null !== (f = d.get(a, b))) return f;
                    f = h.find.attr(a, b);
                    return null == f ? void 0 : f
                }
            }
        },
        removeAttr: function(a, b) {
            var c, d, f = 0,
                e = b && b.match(V);
            if (e && 1 === a.nodeType)
                for (; c = e[f++];) d =
                    h.propFix[c] || c, h.expr.match.bool.test(c) ? nb && $a || !sb.test(c) ? a[d] = !1 : a[h.camelCase("default-" + c)] = a[d] = !1 : h.attr(a, c, ""), a.removeAttribute($a ? c : d)
        },
        attrHooks: {
            type: {
                set: function(a, b) {
                    if (!F.radioValue && "radio" === b && h.nodeName(a, "input")) {
                        var c = a.value;
                        a.setAttribute("type", b);
                        c && (a.value = c);
                        return b
                    }
                }
            }
        }
    });
    Cb = {
        set: function(a, b, c) {
            !1 === b ? h.removeAttr(a, c) : nb && $a || !sb.test(c) ? a.setAttribute(!$a && h.propFix[c] || c, c) : a[h.camelCase("default-" + c)] = a[c] = !0;
            return c
        }
    };
    h.each(h.expr.match.bool.source.match(/\w+/g),
        function(a, b) {
            var c = Va[b] || h.find.attr;
            Va[b] = nb && $a || !sb.test(b) ? function(a, b, d) {
                var f, e;
                d || (e = Va[b], Va[b] = f, f = null != c(a, b, d) ? b.toLowerCase() : null, Va[b] = e);
                return f
            } : function(a, b, c) {
                if (!c) return a[h.camelCase("default-" + b)] ? b.toLowerCase() : null
            }
        });
    nb && $a || (h.attrHooks.value = {
        set: function(a, b, c) {
            if (h.nodeName(a, "input")) a.defaultValue = b;
            else return fb && fb.set(a, b, c)
        }
    });
    $a || (fb = {
        set: function(a, b, c) {
            var d = a.getAttributeNode(c);
            d || a.setAttributeNode(d = a.ownerDocument.createAttribute(c));
            d.value = b += "";
            if ("value" === c || b === a.getAttribute(c)) return b
        }
    }, Va.id = Va.name = Va.coords = function(a, b, c) {
        var d;
        if (!c) return (d = a.getAttributeNode(b)) && "" !== d.value ? d.value : null
    }, h.valHooks.button = {
        get: function(a, b) {
            var c = a.getAttributeNode(b);
            if (c && c.specified) return c.value
        },
        set: fb.set
    }, h.attrHooks.contenteditable = {
        set: function(a, b, c) {
            fb.set(a, "" === b ? !1 : b, c)
        }
    }, h.each(["width", "height"], function(a, b) {
        h.attrHooks[b] = {
            set: function(a, c) {
                if ("" === c) return a.setAttribute(b, "auto"), c
            }
        }
    }));
    F.style || (h.attrHooks.style = {
        get: function(a) {
            return a.style.cssText ||
                void 0
        },
        set: function(a, b) {
            return a.style.cssText = b + ""
        }
    });
    var Xb = /^(?:input|select|textarea|button|object)$/i,
        Yb = /^(?:a|area)$/i;
    h.fn.extend({
        prop: function(a, b) {
            return pa(this, h.prop, a, b, 1 < arguments.length)
        },
        removeProp: function(a) {
            a = h.propFix[a] || a;
            return this.each(function() {
                try {
                    this[a] = void 0, delete this[a]
                } catch (b) {}
            })
        }
    });
    h.extend({
        propFix: {
            "for": "htmlFor",
            "class": "className"
        },
        prop: function(a, b, c) {
            var d, f, e;
            e = a.nodeType;
            if (a && 3 !== e && 8 !== e && 2 !== e) {
                if (e = 1 !== e || !h.isXMLDoc(a)) b = h.propFix[b] || b, f = h.propHooks[b];
                return void 0 !== c ? f && "set" in f && void 0 !== (d = f.set(a, c, b)) ? d : a[b] = c : f && "get" in f && null !== (d = f.get(a, b)) ? d : a[b]
            }
        },
        propHooks: {
            tabIndex: {
                get: function(a) {
                    var b = h.find.attr(a, "tabindex");
                    return b ? parseInt(b, 10) : Xb.test(a.nodeName) || Yb.test(a.nodeName) && a.href ? 0 : -1
                }
            }
        }
    });
    F.hrefNormalized || h.each(["href", "src"], function(a, b) {
        h.propHooks[b] = {
            get: function(a) {
                return a.getAttribute(b, 4)
            }
        }
    });
    F.optSelected || (h.propHooks.selected = {
        get: function(a) {
            if (a = a.parentNode) a.selectedIndex, a.parentNode && a.parentNode.selectedIndex;
            return null
        }
    });
    h.each("tabIndex readOnly maxLength cellSpacing cellPadding rowSpan colSpan useMap frameBorder contentEditable".split(" "), function() {
        h.propFix[this.toLowerCase()] = this
    });
    F.enctype || (h.propFix.enctype = "encoding");
    var tb = /[\t\r\n\f]/g;
    h.fn.extend({
        addClass: function(a) {
            var b, c, d, f, e, r = 0,
                k = this.length;
            b = "string" === typeof a && a;
            if (h.isFunction(a)) return this.each(function(b) {
                h(this).addClass(a.call(this, b, this.className))
            });
            if (b)
                for (b = (a || "").match(V) || []; r < k; r++)
                    if (c = this[r], d = 1 === c.nodeType &&
                        (c.className ? (" " + c.className + " ").replace(tb, " ") : " ")) {
                        for (e = 0; f = b[e++];) 0 > d.indexOf(" " + f + " ") && (d += f + " ");
                        d = h.trim(d);
                        c.className !== d && (c.className = d)
                    }
            return this
        },
        removeClass: function(a) {
            var b, c, d, f, e, r = 0,
                k = this.length;
            b = 0 === arguments.length || "string" === typeof a && a;
            if (h.isFunction(a)) return this.each(function(b) {
                h(this).removeClass(a.call(this, b, this.className))
            });
            if (b)
                for (b = (a || "").match(V) || []; r < k; r++)
                    if (c = this[r], d = 1 === c.nodeType && (c.className ? (" " + c.className + " ").replace(tb, " ") : "")) {
                        for (e =
                            0; f = b[e++];)
                            for (; 0 <= d.indexOf(" " + f + " ");) d = d.replace(" " + f + " ", " ");
                        d = a ? h.trim(d) : "";
                        c.className !== d && (c.className = d)
                    }
            return this
        },
        toggleClass: function(a, b) {
            var c = typeof a;
            return "boolean" === typeof b && "string" === c ? b ? this.addClass(a) : this.removeClass(a) : h.isFunction(a) ? this.each(function(c) {
                h(this).toggleClass(a.call(this, c, this.className, b), b)
            }) : this.each(function() {
                if ("string" === c)
                    for (var b, d = 0, f = h(this), e = a.match(V) || []; b = e[d++];) f.hasClass(b) ? f.removeClass(b) : f.addClass(b);
                else if ("undefined" ===
                    c || "boolean" === c) this.className && h._data(this, "__className__", this.className), this.className = this.className || !1 === a ? "" : h._data(this, "__className__") || ""
            })
        },
        hasClass: function(a) {
            a = " " + a + " ";
            for (var b = 0, c = this.length; b < c; b++)
                if (1 === this[b].nodeType && 0 <= (" " + this[b].className + " ").replace(tb, " ").indexOf(a)) return !0;
            return !1
        }
    });
    h.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),
        function(a, b) {
            h.fn[b] = function(a, c) {
                return 0 < arguments.length ? this.on(b, null, a, c) : this.trigger(b)
            }
        });
    h.fn.extend({
        hover: function(a, b) {
            return this.mouseenter(a).mouseleave(b || a)
        },
        bind: function(a, b, c) {
            return this.on(a, null, b, c)
        },
        unbind: function(a, b) {
            return this.off(a, null, b)
        },
        delegate: function(a, b, c, d) {
            return this.on(b, a, c, d)
        },
        undelegate: function(a, b, c) {
            return 1 === arguments.length ? this.off(a, "**") : this.off(b, a || "**", c)
        }
    });
    var ub = h.now(),
        vb = /\?/,
        Zb = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
    h.parseJSON = function(a) {
        if (c.JSON && c.JSON.parse) return c.JSON.parse(a + "");
        var b, d = null,
            f = h.trim(a + "");
        return f && !h.trim(f.replace(Zb, function(a, c, f, e) {
            b && c && (d = 0);
            if (0 === d) return a;
            b = f || c;
            d += !e - !f;
            return ""
        })) ? Function("return " + f)() : h.error("Invalid JSON: " + a)
    };
    h.parseXML = function(a) {
        var b, d;
        if (!a || "string" !== typeof a) return null;
        try {
            c.DOMParser ? (d = new DOMParser, b = d.parseFromString(a, "text/xml")) : (b = new ActiveXObject("Microsoft.XMLDOM"), b.async = "false", b.loadXML(a))
        } catch (f) {
            b = void 0
        }
        b && b.documentElement &&
            !b.getElementsByTagName("parsererror").length || h.error("Invalid XML: " + a);
        return b
    };
    var ab, Wa, $b = /#.*$/,
        Db = /([?&])_=[^&]*/,
        ac = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
        bc = /^(?:GET|HEAD)$/,
        cc = /^\/\//,
        Eb = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
        Fb = {},
        qb = {},
        Gb = "*/".concat("*");
    try {
        Wa = location.href
    } catch (jc) {
        Wa = H.createElement("a"), Wa.href = "", Wa = Wa.href
    }
    ab = Eb.exec(Wa.toLowerCase()) || [];
    h.extend({
        active: 0,
        lastModified: {},
        etag: {},
        ajaxSettings: {
            url: Wa,
            type: "GET",
            isLocal: /^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(ab[1]),
            global: !0,
            processData: !0,
            async: !0,
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            accepts: {
                "*": Gb,
                text: "text/plain",
                html: "text/html",
                xml: "application/xml, text/xml",
                json: "application/json, text/javascript"
            },
            contents: {
                xml: /xml/,
                html: /html/,
                json: /json/
            },
            responseFields: {
                xml: "responseXML",
                text: "responseText",
                json: "responseJSON"
            },
            converters: {
                "* text": String,
                "text html": !0,
                "text json": h.parseJSON,
                "text xml": h.parseXML
            },
            flatOptions: {
                url: !0,
                context: !0
            }
        },
        ajaxSetup: function(a, b) {
            return b ? ka(ka(a,
                h.ajaxSettings), b) : ka(h.ajaxSettings, a)
        },
        ajaxPrefilter: S(Fb),
        ajaxTransport: S(qb),
        ajax: function(a, b) {
            function c(a, b, d, f) {
                var l, n, ba, t;
                t = b;
                if (2 !== A) {
                    A = 2;
                    k && clearTimeout(k);
                    D = void 0;
                    r = f || "";
                    M.readyState = 0 < a ? 4 : 0;
                    f = 200 <= a && 300 > a || 304 === a;
                    if (d) {
                        ba = u;
                        for (var N = M, P, W, ea, G, T = ba.contents, S = ba.dataTypes;
                            "*" === S[0];) S.shift(), void 0 === W && (W = ba.mimeType || N.getResponseHeader("Content-Type"));
                        if (W)
                            for (G in T)
                                if (T[G] && T[G].test(W)) {
                                    S.unshift(G);
                                    break
                                }
                        if (S[0] in d) ea = S[0];
                        else {
                            for (G in d) {
                                if (!S[0] || ba.converters[G +
                                        " " + S[0]]) {
                                    ea = G;
                                    break
                                }
                                P || (P = G)
                            }
                            ea = ea || P
                        }
                        ea ? (ea !== S[0] && S.unshift(ea), ba = d[ea]) : ba = void 0
                    }
                    a: {
                        d = u;
                        P = ba;
                        W = M;
                        ea = f;
                        var za, s, y, N = {},
                            T = d.dataTypes.slice();
                        if (T[1])
                            for (s in d.converters) N[s.toLowerCase()] = d.converters[s];
                        for (G = T.shift(); G;)
                            if (d.responseFields[G] && (W[d.responseFields[G]] = P), !y && ea && d.dataFilter && (P = d.dataFilter(P, d.dataType)), y = G, G = T.shift())
                                if ("*" === G) G = y;
                                else if ("*" !== y && y !== G) {
                            s = N[y + " " + G] || N["* " + G];
                            if (!s)
                                for (za in N)
                                    if (ba = za.split(" "), ba[1] === G && (s = N[y + " " + ba[0]] || N["* " + ba[0]])) {
                                        !0 ===
                                            s ? s = N[za] : !0 !== N[za] && (G = ba[0], T.unshift(ba[1]));
                                        break
                                    }
                            if (!0 !== s)
                                if (s && d["throws"]) P = s(P);
                                else try {
                                    P = s(P)
                                } catch (U) {
                                    ba = {
                                        state: "parsererror",
                                        error: s ? U : "No conversion from " + y + " to " + G
                                    };
                                    break a
                                }
                        }
                        ba = {
                            state: "success",
                            data: P
                        }
                    }
                    if (f) u.ifModified && ((t = M.getResponseHeader("Last-Modified")) && (h.lastModified[e] = t), (t = M.getResponseHeader("etag")) && (h.etag[e] = t)), 204 === a || "HEAD" === u.type ? t = "nocontent" : 304 === a ? t = "notmodified" : (t = ba.state, l = ba.data, n = ba.error, f = !n);
                    else if (n = t, a || !t) t = "error", 0 > a && (a = 0);
                    M.status =
                        a;
                    M.statusText = (b || t) + "";
                    f ? m.resolveWith(q, [l, t, M]) : m.rejectWith(q, [M, t, n]);
                    M.statusCode(I);
                    I = void 0;
                    g && w.trigger(f ? "ajaxSuccess" : "ajaxError", [M, u, f ? l : n]);
                    p.fireWith(q, [M, t]);
                    g && (w.trigger("ajaxComplete", [M, u]), --h.active || h.event.trigger("ajaxStop"))
                }
            }
            "object" === typeof a && (b = a, a = void 0);
            b = b || {};
            var d, f, e, r, k, g, D, n, u = h.ajaxSetup({}, b),
                q = u.context || u,
                w = u.context && (q.nodeType || q.jquery) ? h(q) : h.event,
                m = h.Deferred(),
                p = h.Callbacks("once memory"),
                I = u.statusCode || {},
                ba = {},
                t = {},
                A = 0,
                N = "canceled",
                M = {
                    readyState: 0,
                    getResponseHeader: function(a) {
                        var b;
                        if (2 === A) {
                            if (!n)
                                for (n = {}; b = ac.exec(r);) n[b[1].toLowerCase()] = b[2];
                            b = n[a.toLowerCase()]
                        }
                        return null == b ? null : b
                    },
                    getAllResponseHeaders: function() {
                        return 2 === A ? r : null
                    },
                    setRequestHeader: function(a, b) {
                        var c = a.toLowerCase();
                        A || (a = t[c] = t[c] || a, ba[a] = b);
                        return this
                    },
                    overrideMimeType: function(a) {
                        A || (u.mimeType = a);
                        return this
                    },
                    statusCode: function(a) {
                        var b;
                        if (a)
                            if (2 > A)
                                for (b in a) I[b] = [I[b], a[b]];
                            else M.always(a[M.status]);
                        return this
                    },
                    abort: function(a) {
                        a = a || N;
                        D && D.abort(a);
                        c(0, a);
                        return this
                    }
                };
            m.promise(M).complete = p.add;
            M.success = M.done;
            M.error = M.fail;
            u.url = ((a || u.url || Wa) + "").replace($b, "").replace(cc, ab[1] + "//");
            u.type = b.method || b.type || u.method || u.type;
            u.dataTypes = h.trim(u.dataType || "*").toLowerCase().match(V) || [""];
            null == u.crossDomain && (d = Eb.exec(u.url.toLowerCase()), u.crossDomain = !(!d || d[1] === ab[1] && d[2] === ab[2] && (d[3] || ("http:" === d[1] ? "80" : "443")) === (ab[3] || ("http:" === ab[1] ? "80" : "443"))));
            u.data && u.processData && "string" !== typeof u.data && (u.data = h.param(u.data,
                u.traditional));
            ya(Fb, u, b, M);
            if (2 === A) return M;
            (g = u.global) && 0 === h.active++ && h.event.trigger("ajaxStart");
            u.type = u.type.toUpperCase();
            u.hasContent = !bc.test(u.type);
            e = u.url;
            u.hasContent || (u.data && (e = u.url += (vb.test(e) ? "&" : "?") + u.data, delete u.data), !1 === u.cache && (u.url = Db.test(e) ? e.replace(Db, "$1_=" + ub++) : e + (vb.test(e) ? "&" : "?") + "_=" + ub++));
            u.ifModified && (h.lastModified[e] && M.setRequestHeader("If-Modified-Since", h.lastModified[e]), h.etag[e] && M.setRequestHeader("If-None-Match", h.etag[e]));
            (u.data && u.hasContent &&
                !1 !== u.contentType || b.contentType) && M.setRequestHeader("Content-Type", u.contentType);
            M.setRequestHeader("Accept", u.dataTypes[0] && u.accepts[u.dataTypes[0]] ? u.accepts[u.dataTypes[0]] + ("*" !== u.dataTypes[0] ? ", " + Gb + "; q=0.01" : "") : u.accepts["*"]);
            for (f in u.headers) M.setRequestHeader(f, u.headers[f]);
            if (u.beforeSend && (!1 === u.beforeSend.call(q, M, u) || 2 === A)) return M.abort();
            N = "abort";
            for (f in {
                    success: 1,
                    error: 1,
                    complete: 1
                }) M[f](u[f]);
            if (D = ya(qb, u, b, M)) {
                M.readyState = 1;
                g && w.trigger("ajaxSend", [M, u]);
                u.async &&
                    0 < u.timeout && (k = setTimeout(function() {
                        M.abort("timeout")
                    }, u.timeout));
                try {
                    A = 1, D.send(ba, c)
                } catch (P) {
                    if (2 > A) c(-1, P);
                    else throw P;
                }
            } else c(-1, "No Transport");
            return M
        },
        getJSON: function(a, b, c) {
            return h.get(a, b, c, "json")
        },
        getScript: function(a, b) {
            return h.get(a, void 0, b, "script")
        }
    });
    h.each(["get", "post"], function(a, b) {
        h[b] = function(a, c, d, f) {
            h.isFunction(c) && (f = f || d, d = c, c = void 0);
            return h.ajax({
                url: a,
                type: b,
                dataType: f,
                data: c,
                success: d
            })
        }
    });
    h.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
        function(a, b) {
            h.fn[b] = function(a) {
                return this.on(b, a)
            }
        });
    h._evalUrl = function(a) {
        return h.ajax({
            url: a,
            type: "GET",
            dataType: "script",
            async: !1,
            global: !1,
            "throws": !0
        })
    };
    h.fn.extend({
        wrapAll: function(a) {
            if (h.isFunction(a)) return this.each(function(b) {
                h(this).wrapAll(a.call(this, b))
            });
            if (this[0]) {
                var b = h(a, this[0].ownerDocument).eq(0).clone(!0);
                this[0].parentNode && b.insertBefore(this[0]);
                b.map(function() {
                    for (var a = this; a.firstChild && 1 === a.firstChild.nodeType;) a = a.firstChild;
                    return a
                }).append(this)
            }
            return this
        },
        wrapInner: function(a) {
            return h.isFunction(a) ? this.each(function(b) {
                h(this).wrapInner(a.call(this, b))
            }) : this.each(function() {
                var b = h(this),
                    c = b.contents();
                c.length ? c.wrapAll(a) : b.append(a)
            })
        },
        wrap: function(a) {
            var b = h.isFunction(a);
            return this.each(function(c) {
                h(this).wrapAll(b ? a.call(this, c) : a)
            })
        },
        unwrap: function() {
            return this.parent().each(function() {
                h.nodeName(this, "body") || h(this).replaceWith(this.childNodes)
            }).end()
        }
    });
    h.expr.filters.hidden = function(a) {
        return 0 >= a.offsetWidth && 0 >= a.offsetHeight ||
            !F.reliableHiddenOffsets() && "none" === (a.style && a.style.display || h.css(a, "display"))
    };
    h.expr.filters.visible = function(a) {
        return !h.expr.filters.hidden(a)
    };
    var dc = /%20/g,
        Nb = /\[\]$/,
        Hb = /\r?\n/g,
        ec = /^(?:submit|button|image|reset|file)$/i,
        fc = /^(?:input|select|textarea|keygen)/i;
    h.param = function(a, b) {
        var c, d = [],
            f = function(a, b) {
                b = h.isFunction(b) ? b() : null == b ? "" : b;
                d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(b)
            };
        void 0 === b && (b = h.ajaxSettings && h.ajaxSettings.traditional);
        if (h.isArray(a) || a.jquery &&
            !h.isPlainObject(a)) h.each(a, function() {
            f(this.name, this.value)
        });
        else
            for (c in a) w(c, a[c], b, f);
        return d.join("&").replace(dc, "+")
    };
    h.fn.extend({
        serialize: function() {
            return h.param(this.serializeArray())
        },
        serializeArray: function() {
            return this.map(function() {
                var a = h.prop(this, "elements");
                return a ? h.makeArray(a) : this
            }).filter(function() {
                var a = this.type;
                return this.name && !h(this).is(":disabled") && fc.test(this.nodeName) && !ec.test(a) && (this.checked || !ua.test(a))
            }).map(function(a, b) {
                var c = h(this).val();
                return null == c ? null : h.isArray(c) ? h.map(c, function(a) {
                    return {
                        name: b.name,
                        value: a.replace(Hb, "\r\n")
                    }
                }) : {
                    name: b.name,
                    value: c.replace(Hb, "\r\n")
                }
            }).get()
        }
    });
    h.ajaxSettings.xhr = void 0 !== c.ActiveXObject ? function() {
        var a;
        if (!(a = !this.isLocal && /^(get|post|head|put|delete|options)$/i.test(this.type) && M())) a: {
            try {
                a = new c.ActiveXObject("Microsoft.XMLHTTP");
                break a
            } catch (b) {}
            a = void 0
        }
        return a
    } : M;
    var gc = 0,
        ob = {},
        pb = h.ajaxSettings.xhr();
    if (c.ActiveXObject) h(c).on("unload", function() {
        for (var a in ob) ob[a](void 0, !0)
    });
    F.cors = !!pb && "withCredentials" in pb;
    (pb = F.ajax = !!pb) && h.ajaxTransport(function(a) {
        if (!a.crossDomain || F.cors) {
            var b;
            return {
                send: function(c, d) {
                    var f, e = a.xhr(),
                        r = ++gc;
                    e.open(a.type, a.url, a.async, a.username, a.password);
                    if (a.xhrFields)
                        for (f in a.xhrFields) e[f] = a.xhrFields[f];
                    a.mimeType && e.overrideMimeType && e.overrideMimeType(a.mimeType);
                    a.crossDomain || c["X-Requested-With"] || (c["X-Requested-With"] = "XMLHttpRequest");
                    for (f in c) void 0 !== c[f] && e.setRequestHeader(f, c[f] + "");
                    e.send(a.hasContent && a.data ||
                        null);
                    b = function(c, f) {
                        var k, g, D;
                        if (b && (f || 4 === e.readyState))
                            if (delete ob[r], b = void 0, e.onreadystatechange = h.noop, f) 4 !== e.readyState && e.abort();
                            else {
                                D = {};
                                k = e.status;
                                "string" === typeof e.responseText && (D.text = e.responseText);
                                try {
                                    g = e.statusText
                                } catch (u) {
                                    g = ""
                                }
                                k || !a.isLocal || a.crossDomain ? 1223 === k && (k = 204) : k = D.text ? 200 : 404
                            }
                        D && d(k, g, D, e.getAllResponseHeaders())
                    };
                    a.async ? 4 === e.readyState ? setTimeout(b) : e.onreadystatechange = ob[r] = b : b()
                },
                abort: function() {
                    b && b(void 0, !0)
                }
            }
        }
    });
    h.ajaxSetup({
        accepts: {
            script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
        },
        contents: {
            script: /(?:java|ecma)script/
        },
        converters: {
            "text script": function(a) {
                h.globalEval(a);
                return a
            }
        }
    });
    h.ajaxPrefilter("script", function(a) {
        void 0 === a.cache && (a.cache = !1);
        a.crossDomain && (a.type = "GET", a.global = !1)
    });
    h.ajaxTransport("script", function(a) {
        if (a.crossDomain) {
            var b, c = H.head || h("head")[0] || H.documentElement;
            return {
                send: function(d, f) {
                    b = H.createElement("script");
                    b.async = !0;
                    a.scriptCharset && (b.charset = a.scriptCharset);
                    b.src = a.url;
                    b.onload = b.onreadystatechange = function(a, c) {
                        if (c || !b.readyState ||
                            /loaded|complete/.test(b.readyState)) b.onload = b.onreadystatechange = null, b.parentNode && b.parentNode.removeChild(b), b = null, c || f(200, "success")
                    };
                    c.insertBefore(b, c.firstChild)
                },
                abort: function() {
                    if (b) b.onload(void 0, !0)
                }
            }
        }
    });
    var Ib = [],
        wb = /(=)\?(?=&|$)|\?\?/;
    h.ajaxSetup({
        jsonp: "callback",
        jsonpCallback: function() {
            var a = Ib.pop() || h.expando + "_" + ub++;
            this[a] = !0;
            return a
        }
    });
    h.ajaxPrefilter("json jsonp", function(a, b, d) {
        var f, e, r, k = !1 !== a.jsonp && (wb.test(a.url) ? "url" : "string" === typeof a.data && !(a.contentType ||
            "").indexOf("application/x-www-form-urlencoded") && wb.test(a.data) && "data");
        if (k || "jsonp" === a.dataTypes[0]) return f = a.jsonpCallback = h.isFunction(a.jsonpCallback) ? a.jsonpCallback() : a.jsonpCallback, k ? a[k] = a[k].replace(wb, "$1" + f) : !1 !== a.jsonp && (a.url += (vb.test(a.url) ? "&" : "?") + a.jsonp + "=" + f), a.converters["script json"] = function() {
            r || h.error(f + " was not called");
            return r[0]
        }, a.dataTypes[0] = "json", e = c[f], c[f] = function() {
            r = arguments
        }, d.always(function() {
            c[f] = e;
            a[f] && (a.jsonpCallback = b.jsonpCallback, Ib.push(f));
            r && h.isFunction(e) && e(r[0]);
            r = e = void 0
        }), "script"
    });
    h.parseHTML = function(a, b, c) {
        if (!a || "string" !== typeof a) return null;
        "boolean" === typeof b && (c = b, b = !1);
        b = b || H;
        var d = qa.exec(a);
        c = !c && [];
        if (d) return [b.createElement(d[1])];
        d = h.buildFragment([a], b, c);
        c && c.length && h(c).remove();
        return h.merge([], d.childNodes)
    };
    var Jb = h.fn.load;
    h.fn.load = function(a, b, c) {
        if ("string" !== typeof a && Jb) return Jb.apply(this, arguments);
        var d, f, e, r = this,
            k = a.indexOf(" ");
        0 <= k && (d = h.trim(a.slice(k, a.length)), a = a.slice(0, k));
        h.isFunction(b) ?
            (c = b, b = void 0) : b && "object" === typeof b && (e = "POST");
        0 < r.length && h.ajax({
            url: a,
            type: e,
            dataType: "html",
            data: b
        }).done(function(a) {
            f = arguments;
            r.html(d ? h("<div>").append(h.parseHTML(a)).find(d) : a)
        }).complete(c && function(a, b) {
            r.each(c, f || [a.responseText, b, a])
        });
        return this
    };
    h.expr.filters.animated = function(a) {
        return h.grep(h.timers, function(b) {
            return a === b.elem
        }).length
    };
    var Kb = c.document.documentElement;
    h.offset = {
        setOffset: function(a, b, c) {
            var d, f, e, r = h.css(a, "position"),
                k = h(a),
                g = {};
            "static" === r && (a.style.position =
                "relative");
            e = k.offset();
            f = h.css(a, "top");
            d = h.css(a, "left");
            ("absolute" === r || "fixed" === r) && -1 < h.inArray("auto", [f, d]) ? (d = k.position(), f = d.top, d = d.left) : (f = parseFloat(f) || 0, d = parseFloat(d) || 0);
            h.isFunction(b) && (b = b.call(a, c, e));
            null != b.top && (g.top = b.top - e.top + f);
            null != b.left && (g.left = b.left - e.left + d);
            "using" in b ? b.using.call(a, g) : k.css(g)
        }
    };
    h.fn.extend({
        offset: function(a) {
            if (arguments.length) return void 0 === a ? this : this.each(function(b) {
                h.offset.setOffset(this, a, b)
            });
            var b, c, d = {
                    top: 0,
                    left: 0
                },
                f = (c = this[0]) &&
                c.ownerDocument;
            if (f) {
                b = f.documentElement;
                if (!h.contains(b, c)) return d;
                "undefined" !== typeof c.getBoundingClientRect && (d = c.getBoundingClientRect());
                c = za(f);
                return {
                    top: d.top + (c.pageYOffset || b.scrollTop) - (b.clientTop || 0),
                    left: d.left + (c.pageXOffset || b.scrollLeft) - (b.clientLeft || 0)
                }
            }
        },
        position: function() {
            if (this[0]) {
                var a, b, c = {
                        top: 0,
                        left: 0
                    },
                    d = this[0];
                "fixed" === h.css(d, "position") ? b = d.getBoundingClientRect() : (a = this.offsetParent(), b = this.offset(), h.nodeName(a[0], "html") || (c = a.offset()), c.top += h.css(a[0],
                    "borderTopWidth", !0), c.left += h.css(a[0], "borderLeftWidth", !0));
                return {
                    top: b.top - c.top - h.css(d, "marginTop", !0),
                    left: b.left - c.left - h.css(d, "marginLeft", !0)
                }
            }
        },
        offsetParent: function() {
            return this.map(function() {
                for (var a = this.offsetParent || Kb; a && !h.nodeName(a, "html") && "static" === h.css(a, "position");) a = a.offsetParent;
                return a || Kb
            })
        }
    });
    h.each({
        scrollLeft: "pageXOffset",
        scrollTop: "pageYOffset"
    }, function(a, b) {
        var c = /Y/.test(b);
        h.fn[a] = function(d) {
            return pa(this, function(a, d, f) {
                var e = za(a);
                if (void 0 === f) return e ?
                    b in e ? e[b] : e.document.documentElement[d] : a[d];
                e ? e.scrollTo(c ? h(e).scrollLeft() : f, c ? f : h(e).scrollTop()) : a[d] = f
            }, a, d, arguments.length, null)
        }
    });
    h.each(["top", "left"], function(a, b) {
        h.cssHooks[b] = P(F.pixelPosition, function(a, c) {
            if (c) return c = Ya(a, b), kb.test(c) ? h(a).position()[b] + "px" : c
        })
    });
    h.each({
        Height: "height",
        Width: "width"
    }, function(a, b) {
        h.each({
            padding: "inner" + a,
            content: b,
            "": "outer" + a
        }, function(c, d) {
            h.fn[d] = function(d, f) {
                var e = arguments.length && (c || "boolean" !== typeof d),
                    r = c || (!0 === d || !0 === f ? "margin" :
                        "border");
                return pa(this, function(b, c, d) {
                    return h.isWindow(b) ? b.document.documentElement["client" + a] : 9 === b.nodeType ? (c = b.documentElement, Math.max(b.body["scroll" + a], c["scroll" + a], b.body["offset" + a], c["offset" + a], c["client" + a])) : void 0 === d ? h.css(b, c, r) : h.style(b, c, d, r)
                }, b, e ? d : void 0, e, null)
            }
        })
    });
    h.fn.size = function() {
        return this.length
    };
    h.fn.andSelf = h.fn.addBack;
    "function" === typeof define && define.amd && define("jquery", [], function() {
        return h
    });
    var hc = c.jQuery,
        ic = c.$;
    h.noConflict = function(a) {
        c.$ === h &&
            (c.$ = ic);
        a && c.jQuery === h && (c.jQuery = hc);
        return h
    };
    "undefined" === typeof g && (c.jQuery = c.$ = h);
    return h
});
(function(c) {
    "function" == typeof define ? define(c) : "function" == typeof YUI ? YUI.add("es5", c) : c()
})(function() {
    function c() {}

    function g(a) {
        a = +a;
        a !== a ? a = 0 : 0 !== a && a !== 1 / 0 && a !== -(1 / 0) && (a = (0 < a || -1) * Math.floor(Math.abs(a)));
        return a
    }

    function e(a) {
        var b = typeof a;
        return null === a || "undefined" === b || "boolean" === b || "number" === b || "string" === b
    }
    Function.prototype.bind || (Function.prototype.bind = function(b) {
        var d = this;
        if ("function" != typeof d) throw new TypeError("Function.prototype.bind called on incompatible " + d);
        var f =
            a.call(arguments, 1),
            e = function() {
                if (this instanceof e) {
                    var c = d.apply(this, f.concat(a.call(arguments)));
                    return Object(c) === c ? c : this
                }
                return d.apply(b, f.concat(a.call(arguments)))
            };
        d.prototype && (c.prototype = d.prototype, e.prototype = new c, c.prototype = null);
        return e
    });
    var b = Function.prototype.call,
        d = Object.prototype,
        a = Array.prototype.slice,
        f = b.bind(d.toString),
        k = b.bind(d.hasOwnProperty);
    k(d, "__defineGetter__") && (b.bind(d.__defineGetter__), b.bind(d.__defineSetter__), b.bind(d.__lookupGetter__), b.bind(d.__lookupSetter__));
    if (2 != [1, 2].splice(0).length) {
        var n = Array.prototype.splice;
        (function() {
            function a(b) {
                for (var c = []; b--;) c.unshift(b);
                return c
            }
            var b = [],
                c;
            b.splice.bind(b, 0, 0).apply(null, a(20));
            b.splice.bind(b, 0, 0).apply(null, a(26));
            c = b.length;
            b.splice(5, 0, "XXX");
            if (c + 1 == b.length) return !0
        })() ? Array.prototype.splice = function(b, c) {
            return arguments.length ? n.apply(this, [void 0 === b ? 0 : b, void 0 === c ? this.length - b : c].concat(a.call(arguments, 2))) : []
        }: Array.prototype.splice = function(b, c) {
            var d, f = a.call(arguments, 2);
            d = f.length;
            if (!arguments.length) return [];
            void 0 === b && (b = 0);
            void 0 === c && (c = this.length - b);
            if (0 < d) {
                if (0 >= c) {
                    if (b == this.length) return this.push.apply(this, f), [];
                    if (0 == b) return this.unshift.apply(this, f), []
                }
                d = a.call(this, b, b + c);
                f.push.apply(f, a.call(this, b + c, this.length));
                f.unshift.apply(f, a.call(this, 0, b));
                f.unshift(0, this.length);
                n.apply(this, f);
                return d
            }
            return n.call(this, b, c)
        }
    }
    if (1 != [].unshift(0)) {
        var p = Array.prototype.unshift;
        Array.prototype.unshift = function() {
            p.apply(this, arguments);
            return this.length
        }
    }
    Array.isArray ||
        (Array.isArray = function(a) {
            return "[object Array]" == f(a)
        });
    var b = Object("a"),
        m = "a" != b[0] || !(0 in b);
    Array.prototype.forEach || (Array.prototype.forEach = function(a, b) {
        var c = E(this),
            d = m && "[object String]" == f(this) ? this.split("") : c,
            e = -1,
            k = d.length >>> 0;
        if ("[object Function]" != f(a)) throw new TypeError;
        for (; ++e < k;) e in d && a.call(b, d[e], e, c)
    });
    Array.prototype.map || (Array.prototype.map = function(a, b) {
        var c = E(this),
            d = m && "[object String]" == f(this) ? this.split("") : c,
            e = d.length >>> 0,
            k = Array(e);
        if ("[object Function]" !=
            f(a)) throw new TypeError(a + " is not a function");
        for (var g = 0; g < e; g++) g in d && (k[g] = a.call(b, d[g], g, c));
        return k
    });
    Array.prototype.filter || (Array.prototype.filter = function(a, b) {
        var c = E(this),
            d = m && "[object String]" == f(this) ? this.split("") : c,
            e = d.length >>> 0,
            k = [],
            g;
        if ("[object Function]" != f(a)) throw new TypeError(a + " is not a function");
        for (var n = 0; n < e; n++) n in d && (g = d[n], a.call(b, g, n, c) && k.push(g));
        return k
    });
    Array.prototype.every || (Array.prototype.every = function(a, b) {
        var c = E(this),
            d = m && "[object String]" ==
            f(this) ? this.split("") : c,
            e = d.length >>> 0;
        if ("[object Function]" != f(a)) throw new TypeError(a + " is not a function");
        for (var k = 0; k < e; k++)
            if (k in d && !a.call(b, d[k], k, c)) return !1;
        return !0
    });
    Array.prototype.some || (Array.prototype.some = function(a, b) {
        var c = E(this),
            d = m && "[object String]" == f(this) ? this.split("") : c,
            e = d.length >>> 0;
        if ("[object Function]" != f(a)) throw new TypeError(a + " is not a function");
        for (var k = 0; k < e; k++)
            if (k in d && a.call(b, d[k], k, c)) return !0;
        return !1
    });
    Array.prototype.reduce || (Array.prototype.reduce =
        function(a) {
            var b = E(this),
                c = m && "[object String]" == f(this) ? this.split("") : b,
                d = c.length >>> 0;
            if ("[object Function]" != f(a)) throw new TypeError(a + " is not a function");
            if (!d && 1 == arguments.length) throw new TypeError("reduce of empty array with no initial value");
            var e = 0,
                k;
            if (2 <= arguments.length) k = arguments[1];
            else {
                do {
                    if (e in c) {
                        k = c[e++];
                        break
                    }
                    if (++e >= d) throw new TypeError("reduce of empty array with no initial value");
                } while (1)
            }
            for (; e < d; e++) e in c && (k = a.call(void 0, k, c[e], e, b));
            return k
        });
    Array.prototype.reduceRight ||
        (Array.prototype.reduceRight = function(a) {
            var b = E(this),
                c = m && "[object String]" == f(this) ? this.split("") : b,
                d = c.length >>> 0;
            if ("[object Function]" != f(a)) throw new TypeError(a + " is not a function");
            if (!d && 1 == arguments.length) throw new TypeError("reduceRight of empty array with no initial value");
            var e, d = d - 1;
            if (2 <= arguments.length) e = arguments[1];
            else {
                do {
                    if (d in c) {
                        e = c[d--];
                        break
                    }
                    if (0 > --d) throw new TypeError("reduceRight of empty array with no initial value");
                } while (1)
            }
            if (0 > d) return e;
            do d in this && (e = a.call(void 0,
                e, c[d], d, b)); while (d--);
            return e
        });
    Array.prototype.indexOf && -1 == [0, 1].indexOf(1, 2) || (Array.prototype.indexOf = function(a) {
        var b = m && "[object String]" == f(this) ? this.split("") : E(this),
            c = b.length >>> 0;
        if (!c) return -1;
        var d = 0;
        1 < arguments.length && (d = g(arguments[1]));
        for (d = 0 <= d ? d : Math.max(0, c + d); d < c; d++)
            if (d in b && b[d] === a) return d;
        return -1
    });
    Array.prototype.lastIndexOf && -1 == [0, 1].lastIndexOf(0, -3) || (Array.prototype.lastIndexOf = function(a) {
        var b = m && "[object String]" == f(this) ? this.split("") : E(this),
            c = b.length >>>
            0;
        if (!c) return -1;
        var d = c - 1;
        1 < arguments.length && (d = Math.min(d, g(arguments[1])));
        for (d = 0 <= d ? d : c - Math.abs(d); 0 <= d; d--)
            if (d in b && a === b[d]) return d;
        return -1
    });
    if (!Object.keys) {
        var q = !0,
            t = "toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),
            x = t.length,
            B;
        for (B in {
                toString: null
            }) q = !1;
        Object.keys = function(a) {
            if ("object" != typeof a && "function" != typeof a || null === a) throw new TypeError("Object.keys called on a non-object");
            var b = [],
                c;
            for (c in a) k(a, c) && b.push(c);
            if (q)
                for (c = 0; c < x; c++) {
                    var d = t[c];
                    k(a, d) && b.push(d)
                }
            return b
        }
    }
    Date.prototype.toISOString && -1 !== (new Date(-621987552E5)).toISOString().indexOf("-000001") || (Date.prototype.toISOString = function() {
        var a, b, c, d;
        if (!isFinite(this)) throw new RangeError("Date.prototype.toISOString called on non-finite value.");
        d = this.getUTCFullYear();
        a = this.getUTCMonth();
        d += Math.floor(a / 12);
        a = [(a % 12 + 12) % 12 + 1, this.getUTCDate(), this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
        d = (0 > d ? "-" : 9999 < d ? "+" : "") + ("00000" + Math.abs(d)).slice(0 <=
            d && 9999 >= d ? -4 : -6);
        for (b = a.length; b--;) c = a[b], 10 > c && (a[b] = "0" + c);
        return d + "-" + a.slice(0, 2).join("-") + "T" + a.slice(2).join(":") + "." + ("000" + this.getUTCMilliseconds()).slice(-3) + "Z"
    });
    B = !1;
    try {
        B = Date.prototype.toJSON && null === (new Date(NaN)).toJSON() && -1 !== (new Date(-621987552E5)).toJSON().indexOf("-000001") && Date.prototype.toJSON.call({
            toISOString: function() {
                return !0
            }
        })
    } catch (v) {}
    B || (Date.prototype.toJSON = function(a) {
        a = Object(this);
        var b;
        a: if (e(a)) b = a;
            else {
                b = a.valueOf;
                if ("function" === typeof b && (b = b.call(a),
                        e(b))) break a;
                b = a.toString;
                if ("function" === typeof b && (b = b.call(a), e(b))) break a;
                throw new TypeError;
            }
        if ("number" === typeof b && !isFinite(b)) return null;
        b = a.toISOString;
        if ("function" != typeof b) throw new TypeError("toISOString property is not callable");
        return b.call(a)
    });
    Date = function(a) {
        function b(c, d, f, e, k, g, n) {
            var q = arguments.length;
            return this instanceof a ? (q = 1 == q && String(c) === c ? new a(b.parse(c)) : 7 <= q ? new a(c, d, f, e, k, g, n) : 6 <= q ? new a(c, d, f, e, k, g) : 5 <= q ? new a(c, d, f, e, k) : 4 <= q ? new a(c, d, f, e) : 3 <= q ? new a(c,
                d, f) : 2 <= q ? new a(c, d) : 1 <= q ? new a(c) : new a, q.constructor = b, q) : a.apply(this, arguments)
        }

        function c(a, b) {
            var d = 1 < b ? 1 : 0;
            return f[b] + Math.floor((a - 1969 + d) / 4) - Math.floor((a - 1901 + d) / 100) + Math.floor((a - 1601 + d) / 400) + 365 * (a - 1970)
        }
        var d = /^(\d{4}|[+-]\d{6})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:(\.\d{1,}))?)?(Z|(?:([-+])(\d{2}):(\d{2})))?)?)?)?$/,
            f = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365],
            e;
        for (e in a) b[e] = a[e];
        b.now = a.now;
        b.UTC = a.UTC;
        b.prototype = a.prototype;
        b.prototype.constructor = b;
        b.parse =
            function(b) {
                var f = d.exec(b);
                if (f) {
                    var e = Number(f[1]),
                        k = Number(f[2] || 1) - 1,
                        g = Number(f[3] || 1) - 1,
                        n = Number(f[4] || 0),
                        q = Number(f[5] || 0),
                        m = Number(f[6] || 0),
                        p = Math.floor(1E3 * Number(f[7] || 0)),
                        t = !f[4] || f[8] ? 0 : Number(new a(1970, 0)),
                        A = "-" === f[9] ? 1 : -1,
                        P = Number(f[10] || 0),
                        f = Number(f[11] || 0);
                    return n < (0 < q || 0 < m || 0 < p ? 24 : 25) && 60 > q && 60 > m && 1E3 > p && -1 < k && 12 > k && 24 > P && 60 > f && -1 < g && g < c(e, k + 1) - c(e, k) && (e = 60 * (24 * (c(e, k) + g) + n + P * A), e = 1E3 * (60 * (e + q + f * A) + m) + p + t, -864E13 <= e && 864E13 >= e) ? e : NaN
                }
                return a.parse.apply(this, arguments)
            };
        return b
    }(Date);
    Date.now || (Date.now = function() {
        return (new Date).getTime()
    });
    Number.prototype.toFixed && "0.000" === (8E-5).toFixed(3) && "0" !== (.9).toFixed(0) && "1.25" === (1.255).toFixed(2) && "1000000000000000128" === (0xde0b6b3a7640080).toFixed(0) || function() {
        function a(b, c) {
            for (var d = -1; ++d < e;) c += b * k[d], k[d] = c % f, c = Math.floor(c / f)
        }

        function b(a) {
            for (var c = e, d = 0; 0 <= --c;) d += k[c], k[c] = Math.floor(d / a), d = d % a * f
        }

        function c() {
            for (var a = e, b = ""; 0 <= --a;)
                if ("" !== b || 0 === a || 0 !== k[a]) var d = String(k[a]),
                    b = "" === b ? d : b + ("0000000".slice(0, 7 - d.length) +
                        d);
            return b
        }

        function d(a, b, c) {
            return 0 === b ? c : 1 === b % 2 ? d(a, b - 1, c * a) : d(a * a, b / 2, c)
        }
        var f, e, k;
        f = 1E7;
        e = 6;
        k = [0, 0, 0, 0, 0, 0];
        Number.prototype.toFixed = function(f) {
            var e, k, g;
            f = Number(f);
            f = f !== f ? 0 : Math.floor(f);
            if (0 > f || 20 < f) throw new RangeError("Number.toFixed called with invalid number of decimals");
            e = Number(this);
            if (e !== e) return "NaN";
            if (-1E21 >= e || 1E21 <= e) return String(e);
            k = "";
            0 > e && (k = "-", e = -e);
            g = "0";
            if (1E-21 < e) {
                g = e * d(2, 69, 1);
                for (var n = 0; 4096 <= g;) n += 12, g /= 4096;
                for (; 2 <= g;) n += 1, g /= 2;
                g = n - 69;
                e = 0 > g ? e * d(2, -g, 1) : e /
                    d(2, g, 1);
                e *= 4503599627370496;
                g = 52 - g;
                if (0 < g) {
                    a(0, e);
                    for (e = f; 7 <= e;) a(1E7, 0), e -= 7;
                    a(d(10, e, 1), 0);
                    for (e = g - 1; 23 <= e;) b(8388608), e -= 23;
                    b(1 << e);
                    a(1, 1);
                    b(2);
                    g = c()
                } else a(0, e), a(1 << -g, 0), g = c() + "0.00000000000000000000".slice(2, 2 + f)
            }
            0 < f ? (e = g.length, g = e <= f ? k + "0.0000000000000000000".slice(0, f - e + 2) + g : k + g.slice(0, e - f) + "." + g.slice(e - f)) : g = k + g;
            return g
        }
    }();
    var C = String.prototype.split;
    2 !== "ab".split(/(?:ab)*/).length || 4 !== ".".split(/(.?)(.?)/).length || "t" === "tesst".split(/(s)*/)[1] || 0 === "".split(/.?/).length || 1 < ".".split(/()()/).length ?
        function() {
            var a = void 0 === /()??/.exec("")[1];
            String.prototype.split = function(b, c) {
                var d = this;
                if (void 0 === b && 0 === c) return [];
                if ("[object RegExp]" !== Object.prototype.toString.call(b)) return C.apply(this, arguments);
                var f = [],
                    e = (b.ignoreCase ? "i" : "") + (b.multiline ? "m" : "") + (b.extended ? "x" : "") + (b.sticky ? "y" : ""),
                    k = 0;
                b = new RegExp(b.source, e + "g");
                var g, n, q, d = d + "";
                a || (g = new RegExp("^" + b.source + "$(?!\\s)", e));
                for (c = void 0 === c ? 4294967295 : c >>> 0; n = b.exec(d);) {
                    e = n.index + n[0].length;
                    if (e > k && (f.push(d.slice(k, n.index)), !a && 1 < n.length && n[0].replace(g, function() {
                            for (var a = 1; a < arguments.length - 2; a++) void 0 === arguments[a] && (n[a] = void 0)
                        }), 1 < n.length && n.index < d.length && Array.prototype.push.apply(f, n.slice(1)), q = n[0].length, k = e, f.length >= c)) break;
                    b.lastIndex === n.index && b.lastIndex++
                }
                k === d.length ? !q && b.test("") || f.push("") : f.push(d.slice(k));
                return f.length > c ? f.slice(0, c) : f
            }
        }() : "0".split(void 0, 0).length && (String.prototype.split = function(a, b) {
            return void 0 === a && 0 === b ? [] : C.apply(this, arguments)
        });
    if ("".substr && "b" !== "0b".substr(-1)) {
        var K =
            String.prototype.substr;
        String.prototype.substr = function(a, b) {
            return K.call(this, 0 > a ? 0 > (a = this.length + a) ? 0 : a : a, b)
        }
    }
    B = "\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";
    if (!String.prototype.trim || B.trim()) {
        B = "[" + B + "]";
        var A = new RegExp("^" + B + B + "*"),
            y = new RegExp(B + B + "*$");
        String.prototype.trim = function() {
            if (void 0 === this || null === this) throw new TypeError("can't convert " + this + " to object");
            return String(this).replace(A,
                "").replace(y, "")
        }
    }
    var E = function(a) {
        if (null == a) throw new TypeError("can't convert " + a + " to object");
        return Object(a)
    }
});
! function(c) {
    c(function() {
        var g = c.support,
            e;
        a: {
            e = document.createElement("bootstrap");
            var b = {
                    WebkitTransition: "webkitTransitionEnd",
                    MozTransition: "transitionend",
                    OTransition: "oTransitionEnd otransitionend",
                    transition: "transitionend"
                },
                d;
            for (d in b)
                if (void 0 !== e.style[d]) {
                    e = b[d];
                    break a
                }
            e = void 0
        }
        g.transition = e && {
            end: e
        }
    })
}(window.jQuery);
! function(c) {
    var g = function(b) {
        c(b).on("click", '[data-dismiss="alert"]', this.close)
    };
    g.prototype.close = function(b) {
        function d() {
            e.trigger("closed").remove()
        }
        var a = c(this),
            f = a.attr("data-target"),
            e;
        f || (f = (f = a.attr("href")) && f.replace(/.*(?=#[^\s]*$)/, ""));
        e = c(f);
        b && b.preventDefault();
        e.length || (e = a.hasClass("alert") ? a : a.parent());
        e.trigger(b = c.Event("close"));
        b.isDefaultPrevented() || (e.removeClass("in"), c.support.transition && e.hasClass("fade") ? e.on(c.support.transition.end, d) : d())
    };
    var e = c.fn.alert;
    c.fn.alert = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("alert");
            a || d.data("alert", a = new g(this));
            "string" == typeof b && a[b].call(d)
        })
    };
    c.fn.alert.Constructor = g;
    c.fn.alert.noConflict = function() {
        c.fn.alert = e;
        return this
    };
    c(document).on("click.alert.data-api", '[data-dismiss="alert"]', g.prototype.close)
}(window.jQuery);
! function(c) {
    var g = function(b, d) {
        this.$element = c(b);
        this.options = c.extend({}, c.fn.button.defaults, d)
    };
    g.prototype.setState = function(b) {
        var c = this.$element,
            a = c.data(),
            f = c.is("input") ? "val" : "html";
        b += "Text";
        a.resetText || c.data("resetText", c[f]());
        c[f](a[b] || this.options[b]);
        setTimeout(function() {
            "loadingText" == b ? c.addClass("disabled").attr("disabled", "disabled") : c.removeClass("disabled").removeAttr("disabled")
        }, 0)
    };
    g.prototype.toggle = function() {
        var b = this.$element.closest('[data-toggle="buttons-radio"]');
        b && b.find(".active").removeClass("active");
        this.$element.toggleClass("active")
    };
    var e = c.fn.button;
    c.fn.button = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("button"),
                f = "object" == typeof b && b;
            a || d.data("button", a = new g(this, f));
            "toggle" == b ? a.toggle() : b && a.setState(b)
        })
    };
    c.fn.button.defaults = {
        loadingText: "loading..."
    };
    c.fn.button.Constructor = g;
    c.fn.button.noConflict = function() {
        c.fn.button = e;
        return this
    };
    c(document).on("click.button.data-api", "[data-toggle^=button]", function(b) {
        b = c(b.target);
        b.hasClass("btn") || (b = b.closest(".btn"));
        b.button("toggle")
    })
}(window.jQuery);
! function(c) {
    var g = function(b, d) {
        this.$element = c(b);
        this.$indicators = this.$element.find(".carousel-indicators");
        this.options = d;
        "hover" == this.options.pause && this.$element.on("mouseenter", c.proxy(this.pause, this)).on("mouseleave", c.proxy(this.cycle, this))
    };
    g.prototype = {
        cycle: function(b) {
            b || (this.paused = !1);
            this.interval && clearInterval(this.interval);
            this.options.interval && !this.paused && (this.interval = setInterval(c.proxy(this.next, this), this.options.interval));
            return this
        },
        getActiveIndex: function() {
            this.$active =
                this.$element.find(".item.active");
            this.$items = this.$active.parent().children();
            return this.$items.index(this.$active)
        },
        to: function(b) {
            var d = this.getActiveIndex(),
                a = this;
            if (!(b > this.$items.length - 1 || 0 > b)) return this.sliding ? this.$element.one("slid", function() {
                a.to(b)
            }) : d == b ? this.pause().cycle() : this.slide(b > d ? "next" : "prev", c(this.$items[b]))
        },
        pause: function(b) {
            b || (this.paused = !0);
            this.$element.find(".next, .prev").length && c.support.transition.end && (this.$element.trigger(c.support.transition.end),
                this.cycle(!0));
            clearInterval(this.interval);
            this.interval = null;
            return this
        },
        next: function() {
            if (!this.sliding) return this.slide("next")
        },
        prev: function() {
            if (!this.sliding) return this.slide("prev")
        },
        slide: function(b, d) {
            var a = this.$element.find(".item.active"),
                f = d || a[b](),
                e = this.interval,
                g = "next" == b ? "left" : "right",
                p = "next" == b ? "first" : "last",
                m = this;
            this.sliding = !0;
            e && this.pause();
            f = f.length ? f : this.$element.find(".item")[p]();
            p = c.Event("slide", {
                relatedTarget: f[0],
                direction: g
            });
            if (!f.hasClass("active")) {
                this.$indicators.length &&
                    (this.$indicators.find(".active").removeClass("active"), this.$element.one("slid", function() {
                        var a = c(m.$indicators.children()[m.getActiveIndex()]);
                        a && a.addClass("active")
                    }));
                if (c.support.transition && this.$element.hasClass("slide")) {
                    this.$element.trigger(p);
                    if (p.isDefaultPrevented()) return;
                    f.addClass(b);
                    f[0].offsetWidth;
                    a.addClass(g);
                    f.addClass(g);
                    this.$element.one(c.support.transition.end, function() {
                        f.removeClass([b, g].join(" ")).addClass("active");
                        a.removeClass(["active", g].join(" "));
                        m.sliding = !1;
                        setTimeout(function() {
                            m.$element.trigger("slid")
                        }, 0)
                    })
                } else {
                    this.$element.trigger(p);
                    if (p.isDefaultPrevented()) return;
                    a.removeClass("active");
                    f.addClass("active");
                    this.sliding = !1;
                    this.$element.trigger("slid")
                }
                e && this.cycle();
                return this
            }
        }
    };
    var e = c.fn.carousel;
    c.fn.carousel = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("carousel"),
                f = c.extend({}, c.fn.carousel.defaults, "object" == typeof b && b),
                e = "string" == typeof b ? b : f.slide;
            a || d.data("carousel", a = new g(this, f));
            if ("number" == typeof b) a.to(b);
            else if (e) a[e]();
            else f.interval && a.pause().cycle()
        })
    };
    c.fn.carousel.defaults = {
        interval: 5E3,
        pause: "hover"
    };
    c.fn.carousel.Constructor = g;
    c.fn.carousel.noConflict = function() {
        c.fn.carousel = e;
        return this
    };
    c(document).on("click.carousel.data-api", "[data-slide], [data-slide-to]", function(b) {
        var d = c(this),
            a, f = c(d.attr("data-target") || (a = d.attr("href")) && a.replace(/.*(?=#[^\s]+$)/, ""));
        a = c.extend({}, f.data(), d.data());
        var e;
        f.carousel(a);
        (e = d.attr("data-slide-to")) && f.data("carousel").pause().to(e).cycle();
        b.preventDefault()
    })
}(window.jQuery);
! function(c) {
    var g = function(b, d) {
        this.$element = c(b);
        this.options = c.extend({}, c.fn.collapse.defaults, d);
        this.options.parent && (this.$parent = c(this.options.parent));
        this.options.toggle && this.toggle()
    };
    g.prototype = {
        constructor: g,
        dimension: function() {
            return this.$element.hasClass("width") ? "width" : "height"
        },
        show: function() {
            var b, d, a, f;
            if (!this.transitioning && !this.$element.hasClass("in")) {
                b = this.dimension();
                d = c.camelCase(["scroll", b].join("-"));
                if ((a = this.$parent && this.$parent.find("> .accordion-group > .in")) && a.length) {
                    if ((f =
                            a.data("collapse")) && f.transitioning) return;
                    a.collapse("hide");
                    f || a.data("collapse", null)
                }
                this.$element[b](0);
                this.transition("addClass", c.Event("show"), "shown");
                c.support.transition && this.$element[b](this.$element[0][d])
            }
        },
        hide: function() {
            var b;
            !this.transitioning && this.$element.hasClass("in") && (b = this.dimension(), this.reset(this.$element[b]()), this.transition("removeClass", c.Event("hide"), "hidden"), this.$element[b](0))
        },
        reset: function(b) {
            var c = this.dimension();
            this.$element.removeClass("collapse")[c](b ||
                "auto")[0].offsetWidth;
            this.$element[null !== b ? "addClass" : "removeClass"]("collapse");
            return this
        },
        transition: function(b, d, a) {
            var f = this,
                e = function() {
                    "show" == d.type && f.reset();
                    f.transitioning = 0;
                    f.$element.trigger(a)
                };
            this.$element.trigger(d);
            d.isDefaultPrevented() || (this.transitioning = 1, this.$element[b]("in"), c.support.transition && this.$element.hasClass("collapse") ? this.$element.one(c.support.transition.end, e) : e())
        },
        toggle: function() {
            this[this.$element.hasClass("in") ? "hide" : "show"]()
        }
    };
    var e = c.fn.collapse;
    c.fn.collapse = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("collapse"),
                f = c.extend({}, c.fn.collapse.defaults, d.data(), "object" == typeof b && b);
            a || d.data("collapse", a = new g(this, f));
            if ("string" == typeof b) a[b]()
        })
    };
    c.fn.collapse.defaults = {
        toggle: !0
    };
    c.fn.collapse.Constructor = g;
    c.fn.collapse.noConflict = function() {
        c.fn.collapse = e;
        return this
    };
    c(document).on("click.collapse.data-api", "[data-toggle=collapse]", function(b) {
        var d = c(this),
            a;
        b = d.attr("data-target") || b.preventDefault() || (a = d.attr("href")) &&
            a.replace(/.*(?=#[^\s]+$)/, "");
        a = c(b).data("collapse") ? "toggle" : d.data();
        d[c(b).hasClass("in") ? "addClass" : "removeClass"]("collapsed");
        c(b).collapse(a)
    })
}(window.jQuery);
! function(c) {
    function g() {
        c("[data-toggle=dropdown]").each(function() {
            e(c(this)).removeClass("open")
        })
    }

    function e(a) {
        var b = a.attr("data-target");
        b || (b = (b = a.attr("href")) && /#/.test(b) && b.replace(/.*(?=#[^\s]*$)/, ""));
        (b = b && c(b)) && b.length || (b = a.parent());
        return b
    }
    var b = function(a) {
        var b = c(a).on("click.dropdown.data-api", this.toggle);
        c("html").on("click.dropdown.data-api", function() {
            b.parent().removeClass("open")
        })
    };
    b.prototype = {
        constructor: b,
        toggle: function(a) {
            a = c(this);
            var b, d;
            if (!a.is(".disabled, :disabled")) return b =
                e(a), d = b.hasClass("open"), g(), d || b.toggleClass("open"), a.focus(), !1
        },
        keydown: function(a) {
            var b, d, g;
            if (/(38|40|27)/.test(a.keyCode) && (b = c(this), a.preventDefault(), a.stopPropagation(), !b.is(".disabled, :disabled"))) {
                d = e(b);
                g = d.hasClass("open");
                if (!g || g && 27 == a.keyCode) return 27 == a.which && d.find("[data-toggle=dropdown]").focus(), b.click();
                b = c("[role=menu] li:not(.divider):visible a", d);
                b.length && (d = b.index(b.filter(":focus")), 38 == a.keyCode && 0 < d && d--, 40 == a.keyCode && d < b.length - 1 && d++, ~d || (d = 0), b.eq(d).focus())
            }
        }
    };
    var d = c.fn.dropdown;
    c.fn.dropdown = function(a) {
        return this.each(function() {
            var d = c(this),
                e = d.data("dropdown");
            e || d.data("dropdown", e = new b(this));
            "string" == typeof a && e[a].call(d)
        })
    };
    c.fn.dropdown.Constructor = b;
    c.fn.dropdown.noConflict = function() {
        c.fn.dropdown = d;
        return this
    };
    c(document).on("click.dropdown.data-api", g).on("click.dropdown.data-api", ".dropdown form", function(a) {
        a.stopPropagation()
    }).on("click.dropdown-menu", function(a) {
        a.stopPropagation()
    }).on("click.dropdown.data-api", "[data-toggle=dropdown]",
        b.prototype.toggle).on("keydown.dropdown.data-api", "[data-toggle=dropdown], [role=menu]", b.prototype.keydown)
}(window.jQuery);
! function(c) {
    var g = function(b, d) {
        this.options = d;
        this.$element = c(b).delegate('[data-dismiss="modal"]', "click.dismiss.modal", c.proxy(this.hide, this));
        this.options.remote && this.$element.find(".modal-body").load(this.options.remote)
    };
    g.prototype = {
        constructor: g,
        toggle: function() {
            return this[this.isShown ? "hide" : "show"]()
        },
        show: function() {
            var b = this,
                d = c.Event("show");
            this.$element.trigger(d);
            this.isShown || d.isDefaultPrevented() || (this.isShown = !0, this.escape(), this.backdrop(function() {
                var a = c.support.transition &&
                    b.$element.hasClass("fade");
                b.$element.parent().length || b.$element.appendTo(document.body);
                b.$element.show();
                a && b.$element[0].offsetWidth;
                b.$element.addClass("in").attr("aria-hidden", !1);
                b.enforceFocus();
                a ? b.$element.one(c.support.transition.end, function() {
                    b.$element.focus().trigger("shown")
                }) : b.$element.focus().trigger("shown")
            }))
        },
        hide: function(b) {
            b && b.preventDefault();
            b = c.Event("hide");
            this.$element.trigger(b);
            this.isShown && !b.isDefaultPrevented() && (this.isShown = !1, this.escape(), c(document).off("focusin.modal"),
                this.$element.removeClass("in").attr("aria-hidden", !0), c.support.transition && this.$element.hasClass("fade") ? this.hideWithTransition() : this.hideModal())
        },
        enforceFocus: function() {
            var b = this;
            c(document).on("focusin.modal", function(c) {
                b.$element[0] === c.target || b.$element.has(c.target).length || b.$element.focus()
            })
        },
        escape: function() {
            var b = this;
            if (this.isShown && this.options.keyboard) this.$element.on("keyup.dismiss.modal", function(c) {
                27 == c.which && b.hide()
            });
            else this.isShown || this.$element.off("keyup.dismiss.modal")
        },
        hideWithTransition: function() {
            var b = this,
                d = setTimeout(function() {
                    b.$element.off(c.support.transition.end);
                    b.hideModal()
                }, 500);
            this.$element.one(c.support.transition.end, function() {
                clearTimeout(d);
                b.hideModal()
            })
        },
        hideModal: function() {
            var b = this;
            this.$element.hide();
            this.backdrop(function() {
                b.removeBackdrop();
                b.$element.trigger("hidden")
            })
        },
        removeBackdrop: function() {
            this.$backdrop && this.$backdrop.remove();
            this.$backdrop = null
        },
        backdrop: function(b) {
            var d = this.$element.hasClass("fade") ? "fade" : "";
            if (this.isShown &&
                this.options.backdrop) {
                var a = c.support.transition && d;
                this.$backdrop = c('<div class="modal-backdrop ' + d + '" />').appendTo(document.body);
                this.$backdrop.click("static" == this.options.backdrop ? c.proxy(this.$element[0].focus, this.$element[0]) : c.proxy(this.hide, this));
                a && this.$backdrop[0].offsetWidth;
                this.$backdrop.addClass("in");
                b && (a ? this.$backdrop.one(c.support.transition.end, b) : b())
            } else !this.isShown && this.$backdrop ? (this.$backdrop.removeClass("in"), c.support.transition && this.$element.hasClass("fade") ?
                this.$backdrop.one(c.support.transition.end, b) : b()) : b && b()
        }
    };
    var e = c.fn.modal;
    c.fn.modal = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("modal"),
                f = c.extend({}, c.fn.modal.defaults, d.data(), "object" == typeof b && b);
            a || d.data("modal", a = new g(this, f));
            if ("string" == typeof b) a[b]();
            else f.show && a.show()
        })
    };
    c.fn.modal.defaults = {
        backdrop: !0,
        keyboard: !0,
        show: !0
    };
    c.fn.modal.Constructor = g;
    c.fn.modal.noConflict = function() {
        c.fn.modal = e;
        return this
    };
    c(document).on("click.modal.data-api", '[data-toggle="modal"]',
        function(b) {
            var d = c(this),
                a = d.attr("href"),
                f = c(d.attr("data-target") || a && a.replace(/.*(?=#[^\s]+$)/, "")),
                a = f.data("modal") ? "toggle" : c.extend({
                    remote: !/#/.test(a) && a
                }, f.data(), d.data());
            b.preventDefault();
            f.modal(a).one("hide", function() {
                d.focus()
            })
        })
}(window.jQuery);
! function(c) {
    var g = function(b, c) {
        this.init("tooltip", b, c)
    };
    g.prototype = {
        constructor: g,
        init: function(b, d, a) {
            var f;
            this.type = b;
            this.$element = c(d);
            this.options = this.getOptions(a);
            this.enabled = !0;
            d = this.options.trigger.split(" ");
            for (a = d.length; a--;)
                if (f = d[a], "click" == f) this.$element.on("click." + this.type, this.options.selector, c.proxy(this.toggle, this));
                else "manual" != f && (b = "hover" == f ? "mouseenter" : "focus", f = "hover" == f ? "mouseleave" : "blur", this.$element.on(b + "." + this.type, this.options.selector, c.proxy(this.enter,
                    this)), this.$element.on(f + "." + this.type, this.options.selector, c.proxy(this.leave, this)));
            this.options.selector ? this._options = c.extend({}, this.options, {
                trigger: "manual",
                selector: ""
            }) : this.fixTitle()
        },
        getOptions: function(b) {
            b = c.extend({}, c.fn[this.type].defaults, this.$element.data(), b);
            b.delay && "number" == typeof b.delay && (b.delay = {
                show: b.delay,
                hide: b.delay
            });
            return b
        },
        enter: function(b) {
            var d = c.fn[this.type].defaults,
                a = {},
                f;
            this._options && c.each(this._options, function(b, c) {
                d[b] != c && (a[b] = c)
            }, this);
            f =
                c(b.currentTarget)[this.type](a).data(this.type);
            if (!f.options.delay || !f.options.delay.show) return f.show();
            clearTimeout(this.timeout);
            f.hoverState = "in";
            this.timeout = setTimeout(function() {
                "in" == f.hoverState && f.show()
            }, f.options.delay.show)
        },
        leave: function(b) {
            var d = c(b.currentTarget)[this.type](this._options).data(this.type);
            this.timeout && clearTimeout(this.timeout);
            if (!d.options.delay || !d.options.delay.hide) return d.hide();
            d.hoverState = "out";
            this.timeout = setTimeout(function() {
                "out" == d.hoverState &&
                    d.hide()
            }, d.options.delay.hide)
        },
        show: function() {
            var b, d, a, f, e;
            d = c.Event("show");
            if (this.hasContent() && this.enabled && (this.$element.trigger(d), !d.isDefaultPrevented())) {
                b = this.tip();
                this.setContent();
                this.options.animation && b.addClass("fade");
                f = "function" == typeof this.options.placement ? this.options.placement.call(this, b[0], this.$element[0]) : this.options.placement;
                b.detach().css({
                    top: 0,
                    left: 0,
                    display: "block"
                });
                this.options.container ? b.appendTo(this.options.container) : b.insertAfter(this.$element);
                d =
                    this.getPosition();
                a = b[0].offsetWidth;
                b = b[0].offsetHeight;
                switch (f) {
                    case "bottom":
                        e = {
                            top: d.top + d.height,
                            left: d.left + d.width / 2 - a / 2
                        };
                        break;
                    case "top":
                        e = {
                            top: d.top - b,
                            left: d.left + d.width / 2 - a / 2
                        };
                        break;
                    case "left":
                        e = {
                            top: d.top + d.height / 2 - b / 2,
                            left: d.left - a
                        };
                        break;
                    case "right":
                        e = {
                            top: d.top + d.height / 2 - b / 2,
                            left: d.left + d.width
                        }
                }
                this.applyPlacement(e, f);
                this.$element.trigger("shown")
            }
        },
        applyPlacement: function(b, c) {
            var a = this.tip(),
                f = a[0].offsetWidth,
                e = a[0].offsetHeight,
                g, p, m;
            a.offset(b).addClass(c).addClass("in");
            g = a[0].offsetWidth;
            p = a[0].offsetHeight;
            "top" == c && p != e && (b.top = b.top + e - p, m = !0);
            "bottom" == c || "top" == c ? (e = 0, 0 > b.left && (e = -2 * b.left, b.left = 0, a.offset(b), g = a[0].offsetWidth), this.replaceArrow(e - f + g, g, "left")) : this.replaceArrow(p - e, p, "top");
            m && a.offset(b)
        },
        replaceArrow: function(b, c, a) {
            this.arrow().css(a, b ? 50 * (1 - b / c) + "%" : "")
        },
        setContent: function() {
            var b = this.tip(),
                c = this.getTitle();
            b.find(".tooltip-inner")[this.options.html ? "html" : "text"](c);
            b.removeClass("fade in top bottom left right")
        },
        hide: function() {
            function b() {
                var a =
                    setTimeout(function() {
                        d.off(c.support.transition.end).detach()
                    }, 500);
                d.one(c.support.transition.end, function() {
                    clearTimeout(a);
                    d.detach()
                })
            }
            var d = this.tip(),
                a = c.Event("hide");
            this.$element.trigger(a);
            if (!a.isDefaultPrevented()) return d.removeClass("in"), c.support.transition && this.$tip.hasClass("fade") ? b() : d.detach(), this.$element.trigger("hidden"), this
        },
        fixTitle: function() {
            var b = this.$element;
            (b.attr("title") || "string" != typeof b.attr("data-original-title")) && b.attr("data-original-title", b.attr("title") ||
                "").attr("title", "")
        },
        hasContent: function() {
            return this.getTitle()
        },
        getPosition: function() {
            var b = this.$element[0];
            return c.extend({}, "function" == typeof b.getBoundingClientRect ? b.getBoundingClientRect() : {
                width: b.offsetWidth,
                height: b.offsetHeight
            }, this.$element.offset())
        },
        getTitle: function() {
            var b = this.$element,
                c = this.options;
            return b.attr("data-original-title") || ("function" == typeof c.title ? c.title.call(b[0]) : c.title)
        },
        tip: function() {
            return this.$tip = this.$tip || c(this.options.template)
        },
        arrow: function() {
            return this.$arrow =
                this.$arrow || this.tip().find(".tooltip-arrow")
        },
        validate: function() {
            this.$element[0].parentNode || (this.hide(), this.options = this.$element = null)
        },
        enable: function() {
            this.enabled = !0
        },
        disable: function() {
            this.enabled = !1
        },
        toggleEnabled: function() {
            this.enabled = !this.enabled
        },
        toggle: function(b) {
            b = b ? c(b.currentTarget)[this.type](this._options).data(this.type) : this;
            b.tip().hasClass("in") ? b.hide() : b.show()
        },
        destroy: function() {
            this.hide().$element.off("." + this.type).removeData(this.type)
        }
    };
    var e = c.fn.tooltip;
    c.fn.tooltip = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("tooltip"),
                f = "object" == typeof b && b;
            a || d.data("tooltip", a = new g(this, f));
            if ("string" == typeof b) a[b]()
        })
    };
    c.fn.tooltip.Constructor = g;
    c.fn.tooltip.defaults = {
        animation: !0,
        placement: "top",
        selector: !1,
        template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
        trigger: "hover focus",
        title: "",
        delay: 0,
        html: !1,
        container: !1
    };
    c.fn.tooltip.noConflict = function() {
        c.fn.tooltip = e;
        return this
    }
}(window.jQuery);
! function(c) {
    var g = function(b, c) {
        this.init("popover", b, c)
    };
    g.prototype = c.extend({}, c.fn.tooltip.Constructor.prototype, {
        constructor: g,
        setContent: function() {
            var b = this.tip(),
                c = this.getTitle(),
                a = this.getContent();
            b.find(".popover-title")[this.options.html ? "html" : "text"](c);
            b.find(".popover-content")[this.options.html ? "html" : "text"](a);
            b.removeClass("fade top bottom left right in")
        },
        hasContent: function() {
            return this.getTitle() || this.getContent()
        },
        getContent: function() {
            var b = this.$element,
                c = this.options;
            return ("function" == typeof c.content ? c.content.call(b[0]) : c.content) || b.attr("data-content")
        },
        tip: function() {
            this.$tip || (this.$tip = c(this.options.template));
            return this.$tip
        },
        destroy: function() {
            this.hide().$element.off("." + this.type).removeData(this.type)
        }
    });
    var e = c.fn.popover;
    c.fn.popover = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("popover"),
                f = "object" == typeof b && b;
            a || d.data("popover", a = new g(this, f));
            if ("string" == typeof b) a[b]()
        })
    };
    c.fn.popover.Constructor = g;
    c.fn.popover.defaults =
        c.extend({}, c.fn.tooltip.defaults, {
            placement: "right",
            trigger: "click",
            content: "",
            template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
        });
    c.fn.popover.noConflict = function() {
        c.fn.popover = e;
        return this
    }
}(window.jQuery);
! function(c) {
    function g(b, d) {
        var a = c.proxy(this.process, this),
            f = c(b).is("body") ? c(window) : c(b),
            e;
        this.options = c.extend({}, c.fn.scrollspy.defaults, d);
        this.$scrollElement = f.on("scroll.scroll-spy.data-api", a);
        this.selector = (this.options.target || (e = c(b).attr("href")) && e.replace(/.*(?=#[^\s]+$)/, "") || "") + " .nav li > a";
        this.$body = c("body");
        this.refresh();
        this.process()
    }
    g.prototype = {
        constructor: g,
        refresh: function() {
            var b = this;
            this.offsets = c([]);
            this.targets = c([]);
            this.$body.find(this.selector).map(function() {
                var d =
                    c(this),
                    d = d.data("target") || d.attr("href"),
                    a = /^#\w/.test(d) && c(d);
                return a && a.length && [
                    [a.position().top + (!c.isWindow(b.$scrollElement.get(0)) && b.$scrollElement.scrollTop()), d]
                ] || null
            }).sort(function(b, a) {
                return b[0] - a[0]
            }).each(function() {
                b.offsets.push(this[0]);
                b.targets.push(this[1])
            })
        },
        process: function() {
            var b = this.$scrollElement.scrollTop() + this.options.offset,
                c = (this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight) - this.$scrollElement.height(),
                a = this.offsets,
                e = this.targets,
                k = this.activeTarget,
                g;
            if (b >= c) return k != (g = e.last()[0]) && this.activate(g);
            for (g = a.length; g--;) k != e[g] && b >= a[g] && (!a[g + 1] || b <= a[g + 1]) && this.activate(e[g])
        },
        activate: function(b) {
            this.activeTarget = b;
            c(this.selector).parent(".active").removeClass("active");
            b = c(this.selector + '[data-target="' + b + '"],' + this.selector + '[href="' + b + '"]').parent("li").addClass("active");
            b.parent(".dropdown-menu").length && (b = b.closest("li.dropdown").addClass("active"));
            b.trigger("activate")
        }
    };
    var e = c.fn.scrollspy;
    c.fn.scrollspy = function(b) {
        return this.each(function() {
            var d =
                c(this),
                a = d.data("scrollspy"),
                e = "object" == typeof b && b;
            a || d.data("scrollspy", a = new g(this, e));
            if ("string" == typeof b) a[b]()
        })
    };
    c.fn.scrollspy.Constructor = g;
    c.fn.scrollspy.defaults = {
        offset: 10
    };
    c.fn.scrollspy.noConflict = function() {
        c.fn.scrollspy = e;
        return this
    };
    c(window).on("load", function() {
        c('[data-spy="scroll"]').each(function() {
            var b = c(this);
            b.scrollspy(b.data())
        })
    })
}(window.jQuery);
! function(c) {
    var g = function(b) {
        this.element = c(b)
    };
    g.prototype = {
        constructor: g,
        show: function() {
            var b = this.element,
                d = b.closest("ul:not(.dropdown-menu)"),
                a = b.attr("data-target"),
                e, k;
            a || (a = (a = b.attr("href")) && a.replace(/.*(?=#[^\s]*$)/, ""));
            b.parent("li").hasClass("active") || (e = d.find(".active:last a")[0], k = c.Event("show", {
                relatedTarget: e
            }), b.trigger(k), k.isDefaultPrevented() || (a = c(a), this.activate(b.parent("li"), d), this.activate(a, a.parent(), function() {
                b.trigger({
                    type: "shown",
                    relatedTarget: e
                })
            })))
        },
        activate: function(b,
            d, a) {
            function e() {
                k.removeClass("active").find("> .dropdown-menu > .active").removeClass("active");
                b.addClass("active");
                g ? (b[0].offsetWidth, b.addClass("in")) : b.removeClass("fade");
                b.parent(".dropdown-menu") && b.closest("li.dropdown").addClass("active");
                a && a()
            }
            var k = d.find("> .active"),
                g = a && c.support.transition && k.hasClass("fade");
            g ? k.one(c.support.transition.end, e) : e();
            k.removeClass("in")
        }
    };
    var e = c.fn.tab;
    c.fn.tab = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("tab");
            a || d.data("tab",
                a = new g(this));
            if ("string" == typeof b) a[b]()
        })
    };
    c.fn.tab.Constructor = g;
    c.fn.tab.noConflict = function() {
        c.fn.tab = e;
        return this
    };
    c(document).on("click.tab.data-api", '[data-toggle="tab"], [data-toggle="pill"]', function(b) {
        b.preventDefault();
        c(this).tab("show")
    })
}(window.jQuery);
! function(c) {
    var g = function(b, d) {
        this.$element = c(b);
        this.options = c.extend({}, c.fn.typeahead.defaults, d);
        this.matcher = this.options.matcher || this.matcher;
        this.sorter = this.options.sorter || this.sorter;
        this.highlighter = this.options.highlighter || this.highlighter;
        this.updater = this.options.updater || this.updater;
        this.source = this.options.source;
        this.$menu = c(this.options.menu);
        this.shown = !1;
        this.listen()
    };
    g.prototype = {
        constructor: g,
        select: function() {
            var b = this.$menu.find(".active").attr("data-value");
            this.$element.val(this.updater(b)).change();
            return this.hide()
        },
        updater: function(b) {
            return b
        },
        show: function() {
            var b = c.extend({}, this.$element.position(), {
                height: this.$element[0].offsetHeight
            });
            this.$menu.insertAfter(this.$element).css({
                top: b.top + b.height,
                left: b.left
            }).show();
            this.shown = !0;
            return this
        },
        hide: function() {
            this.$menu.hide();
            this.shown = !1;
            return this
        },
        lookup: function(b) {
            this.query = this.$element.val();
            return !this.query || this.query.length < this.options.minLength ? this.shown ? this.hide() : this : (b = c.isFunction(this.source) ? this.source(this.query,
                c.proxy(this.process, this)) : this.source) ? this.process(b) : this
        },
        process: function(b) {
            var d = this;
            b = c.grep(b, function(a) {
                return d.matcher(a)
            });
            b = this.sorter(b);
            return b.length ? this.render(b.slice(0, this.options.items)).show() : this.shown ? this.hide() : this
        },
        matcher: function(b) {
            return ~b.toLowerCase().indexOf(this.query.toLowerCase())
        },
        sorter: function(b) {
            for (var c = [], a = [], e = [], k; k = b.shift();) k.toLowerCase().indexOf(this.query.toLowerCase()) ? ~k.indexOf(this.query) ? a.push(k) : e.push(k) : c.push(k);
            return c.concat(a,
                e)
        },
        highlighter: function(b) {
            var c = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
            return b.replace(new RegExp("(" + c + ")", "ig"), function(a, b) {
                return "<strong>" + b + "</strong>"
            })
        },
        render: function(b) {
            var d = this;
            b = c(b).map(function(a, b) {
                a = c(d.options.item).attr("data-value", b);
                a.find("a").html(d.highlighter(b));
                return a[0]
            });
            b.first().addClass("active");
            this.$menu.html(b);
            return this
        },
        next: function(b) {
            b = this.$menu.find(".active").removeClass("active").next();
            b.length || (b = c(this.$menu.find("li")[0]));
            b.addClass("active")
        },
        prev: function(b) {
            b = this.$menu.find(".active").removeClass("active").prev();
            b.length || (b = this.$menu.find("li").last());
            b.addClass("active")
        },
        listen: function() {
            this.$element.on("focus", c.proxy(this.focus, this)).on("blur", c.proxy(this.blur, this)).on("keypress", c.proxy(this.keypress, this)).on("keyup", c.proxy(this.keyup, this));
            if (this.eventSupported("keydown")) this.$element.on("keydown", c.proxy(this.keydown, this));
            this.$menu.on("click", c.proxy(this.click, this)).on("mouseenter", "li",
                c.proxy(this.mouseenter, this)).on("mouseleave", "li", c.proxy(this.mouseleave, this))
        },
        eventSupported: function(b) {
            var c = b in this.$element;
            c || (this.$element.setAttribute(b, "return;"), c = "function" === typeof this.$element[b]);
            return c
        },
        move: function(b) {
            if (this.shown) {
                switch (b.keyCode) {
                    case 9:
                    case 13:
                    case 27:
                        b.preventDefault();
                        break;
                    case 38:
                        b.preventDefault();
                        this.prev();
                        break;
                    case 40:
                        b.preventDefault(), this.next()
                }
                b.stopPropagation()
            }
        },
        keydown: function(b) {
            this.suppressKeyPressRepeat = ~c.inArray(b.keyCode, [40, 38, 9, 13, 27]);
            this.move(b)
        },
        keypress: function(b) {
            this.suppressKeyPressRepeat || this.move(b)
        },
        keyup: function(b) {
            switch (b.keyCode) {
                case 40:
                case 38:
                case 16:
                case 17:
                case 18:
                    break;
                case 9:
                case 13:
                    if (!this.shown) return;
                    this.select();
                    break;
                case 27:
                    if (!this.shown) return;
                    this.hide();
                    break;
                default:
                    this.lookup()
            }
            b.stopPropagation();
            b.preventDefault()
        },
        focus: function(b) {
            this.focused = !0
        },
        blur: function(b) {
            this.focused = !1;
            !this.mousedover && this.shown && this.hide()
        },
        click: function(b) {
            b.stopPropagation();
            b.preventDefault();
            this.select();
            this.$element.focus()
        },
        mouseenter: function(b) {
            this.mousedover = !0;
            this.$menu.find(".active").removeClass("active");
            c(b.currentTarget).addClass("active")
        },
        mouseleave: function(b) {
            this.mousedover = !1;
            !this.focused && this.shown && this.hide()
        }
    };
    var e = c.fn.typeahead;
    c.fn.typeahead = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("typeahead"),
                e = "object" == typeof b && b;
            a || d.data("typeahead", a = new g(this, e));
            if ("string" == typeof b) a[b]()
        })
    };
    c.fn.typeahead.defaults = {
        source: [],
        items: 8,
        menu: '<ul class="typeahead dropdown-menu"></ul>',
        item: '<li><a href="#"></a></li>',
        minLength: 1
    };
    c.fn.typeahead.Constructor = g;
    c.fn.typeahead.noConflict = function() {
        c.fn.typeahead = e;
        return this
    };
    c(document).on("focus.typeahead.data-api", '[data-provide="typeahead"]', function(b) {
        b = c(this);
        b.data("typeahead") || b.typeahead(b.data())
    })
}(window.jQuery);
! function(c) {
    var g = function(b, d) {
        this.options = c.extend({}, c.fn.affix.defaults, d);
        this.$window = c(window).on("scroll.affix.data-api", c.proxy(this.checkPosition, this)).on("click.affix.data-api", c.proxy(function() {
            setTimeout(c.proxy(this.checkPosition, this), 1)
        }, this));
        this.$element = c(b);
        this.checkPosition()
    };
    g.prototype.checkPosition = function() {
        if (this.$element.is(":visible")) {
            var b = c(document).height(),
                d = this.$window.scrollTop(),
                a = this.$element.offset(),
                e = this.options.offset,
                k = e.bottom,
                g = e.top;
            "object" !=
            typeof e && (k = g = e);
            "function" == typeof g && (g = e.top());
            "function" == typeof k && (k = e.bottom());
            b = null != this.unpin && d + this.unpin <= a.top ? !1 : null != k && a.top + this.$element.height() >= b - k ? "bottom" : null != g && d <= g ? "top" : !1;
            this.affixed !== b && (this.affixed = b, this.unpin = "bottom" == b ? a.top - d : null, this.$element.removeClass("affix affix-top affix-bottom").addClass("affix" + (b ? "-" + b : "")))
        }
    };
    var e = c.fn.affix;
    c.fn.affix = function(b) {
        return this.each(function() {
            var d = c(this),
                a = d.data("affix"),
                e = "object" == typeof b && b;
            a || d.data("affix",
                a = new g(this, e));
            if ("string" == typeof b) a[b]()
        })
    };
    c.fn.affix.Constructor = g;
    c.fn.affix.defaults = {
        offset: 0
    };
    c.fn.affix.noConflict = function() {
        c.fn.affix = e;
        return this
    };
    c(window).on("load", function() {
        c('[data-spy="affix"]').each(function() {
            var b = c(this),
                d = b.data();
            d.offset = d.offset || {};
            d.offsetBottom && (d.offset.bottom = d.offsetBottom);
            d.offsetTop && (d.offset.top = d.offsetTop);
            b.affix(d)
        })
    })
}(window.jQuery);
! function(c) {
    c.expr[":"].icontains = function(e, b, d) {
        return 0 <= c(e).text().toUpperCase().indexOf(d[3].toUpperCase())
    };
    var g = function(e, b, d) {
        d && (d.stopPropagation(), d.preventDefault());
        this.$element = c(e);
        this.$lis = this.$menu = this.$button = this.$newElement = null;
        this.options = c.extend({}, c.fn.selectpicker.defaults, this.$element.data(), "object" == typeof b && b);
        null === this.options.title && (this.options.title = this.$element.attr("title"));
        this.val = g.prototype.val;
        this.render = g.prototype.render;
        this.refresh = g.prototype.refresh;
        this.setStyle = g.prototype.setStyle;
        this.selectAll = g.prototype.selectAll;
        this.deselectAll = g.prototype.deselectAll;
        this.init()
    };
    g.prototype = {
        constructor: g,
        init: function() {
            var e = this,
                b = this.$element.attr("id");
            this.$element.hide();
            this.multiple = this.$element.prop("multiple");
            this.autofocus = this.$element.prop("autofocus");
            this.$newElement = this.createView();
            this.$element.after(this.$newElement);
            this.$menu = this.$newElement.find("> .dropdown-menu");
            this.$button = this.$newElement.find("> button");
            this.$searchbox =
                this.$newElement.find("input");
            void 0 !== b && (this.$button.attr("data-id", b), c('label[for="' + b + '"]').click(function(b) {
                b.preventDefault();
                e.$button.focus()
            }));
            this.checkDisabled();
            this.clickListener();
            this.options.liveSearch && this.liveSearchListener();
            this.render();
            this.liHeight();
            this.setStyle();
            this.setWidth();
            this.options.container && this.selectPosition();
            this.$menu.data("this", this);
            this.$newElement.data("this", this)
        },
        createDropdown: function() {
            var e = this.multiple ? " show-tick" : "",
                b = this.$element.parent().hasClass("input-group") ?
                " input-group-btn" : "";
            return c('<div class="btn-group bootstrap-select' + e + b + '"><button type="button" class="btn dropdown-toggle selectpicker" data-toggle="dropdown"' + (this.autofocus ? " autofocus" : "") + '><span class="filter-option pull-left"></span>&nbsp;<span class="caret"></span></button><div class="dropdown-menu open">' + (this.options.header ? '<div class="popover-title"><button type="button" class="close" aria-hidden="true">&times;</button>' + this.options.header + "</div>" : "") + (this.options.liveSearch ?
                '<div class="bootstrap-select-searchbox"><input type="text" class="input-block-level form-control" /></div>' : "") + (this.options.actionsBox ? '<div class="bs-actionsbox"><div class="btn-group btn-block"><button class="actions-btn bs-select-all btn btn-sm btn-default">Select All</button><button class="actions-btn bs-deselect-all btn btn-sm btn-default">Deselect All</button></div></div>' : "") + '<ul class="dropdown-menu inner selectpicker" role="menu"></ul></div></div>')
        },
        createView: function() {
            var c = this.createDropdown(),
                b = this.createLi();
            c.find("ul").append(b);
            return c
        },
        reloadLi: function() {
            this.destroyLi();
            var c = this.createLi();
            this.$menu.find("ul").append(c)
        },
        destroyLi: function() {
            this.$menu.find("li").remove()
        },
        createLi: function() {
            var e = this,
                b = [],
                d = "";
            this.$element.find("option").each(function() {
                var a = c(this),
                    d = a.attr("class") || "",
                    k = a.attr("style") || "",
                    g = a.data("content") ? a.data("content") : a.html(),
                    p = void 0 !== a.data("subtext") ? '<small class="muted text-muted">' + a.data("subtext") + "</small>" : "",
                    m = void 0 !== a.data("icon") ?
                    '<i class="' + e.options.iconBase + " " + a.data("icon") + '"></i> ' : "";
                "" !== m && (a.is(":disabled") || a.parent().is(":disabled")) && (m = "<span>" + m + "</span>");
                a.data("content") || (g = m + '<span class="text">' + g + p + "</span>");
                e.options.hideDisabled && (a.is(":disabled") || a.parent().is(":disabled")) ? b.push('<a style="min-height: 0; padding: 0"></a>') : a.parent().is("optgroup") && !0 !== a.data("divider") ? 0 === a.index() ? (p = a.parent().attr("label"), m = void 0 !== a.parent().data("subtext") ? '<small class="muted text-muted">' + a.parent().data("subtext") +
                    "</small>" : "", p = (a.parent().data("icon") ? '<i class="' + a.parent().data("icon") + '"></i> ' : "") + '<span class="text">' + p + m + "</span>", 0 !== a[0].index ? b.push('<div class="div-contain"><div class="divider"></div></div><dt>' + p + "</dt>" + e.createA(g, "opt " + d, k)) : b.push("<dt>" + p + "</dt>" + e.createA(g, "opt " + d, k))) : b.push(e.createA(g, "opt " + d, k)) : !0 === a.data("divider") ? b.push('<div class="div-contain"><div class="divider"></div></div>') : !0 === c(this).data("hidden") ? b.push("<a></a>") : b.push(e.createA(g, d, k))
            });
            c.each(b,
                function(a, b) {
                    d += '<li rel="' + a + '"' + ("<a></a>" === b ? 'class="hide is-hidden"' : "") + ">" + b + "</li>"
                });
            this.multiple || 0 !== this.$element.find("option:selected").length || this.options.title || this.$element.find("option").eq(0).prop("selected", !0).attr("selected", "selected");
            return c(d)
        },
        createA: function(c, b, d) {
            return '<a tabindex="0" class="' + b + '" style="' + d + '">' + c + '<i class="' + this.options.iconBase + " " + this.options.tickIcon + ' icon-ok check-mark"></i></a>'
        },
        render: function(e) {
            var b = this;
            !1 !== e && this.$element.find("option").each(function(a) {
                b.setDisabled(a,
                    c(this).is(":disabled") || c(this).parent().is(":disabled"));
                b.setSelected(a, c(this).is(":selected"))
            });
            this.tabIndex();
            e = this.$element.find("option:selected").map(function() {
                var a = c(this),
                    d = a.data("icon") && b.options.showIcon ? '<i class="' + b.options.iconBase + " " + a.data("icon") + '"></i> ' : "",
                    e;
                e = b.options.showSubtext && a.attr("data-subtext") && !b.multiple ? ' <small class="muted text-muted">' + a.data("subtext") + "</small>" : "";
                return a.data("content") && b.options.showContent ? a.data("content") : void 0 !== a.attr("title") ?
                    a.attr("title") : d + a.html() + e
            }).toArray();
            var d = this.multiple ? e.join(this.options.multipleSeparator) : e[0];
            if (this.multiple && -1 < this.options.selectedTextFormat.indexOf("count")) {
                var a = this.options.selectedTextFormat.split(">"),
                    f = this.options.hideDisabled ? ":not([disabled])" : "";
                if (1 < a.length && e.length > a[1] || 1 == a.length && 2 <= e.length) d = this.options.countSelectedText.replace("{0}", e.length).replace("{1}", this.$element.find('option:not([data-divider="true"]):not([data-hidden="true"])' + f).length)
            }
            this.options.title =
                this.$element.attr("title");
            d || (d = void 0 !== this.options.title ? this.options.title : this.options.noneSelectedText);
            this.$button.attr("title", c.trim(d));
            this.$newElement.find(".filter-option").html(d)
        },
        setStyle: function(c, b) {
            this.$element.attr("class") && this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device/gi, ""));
            var d = c ? c : this.options.style;
            "add" == b ? this.$button.addClass(d) : "remove" == b ? this.$button.removeClass(d) : (this.$button.removeClass(this.options.style), this.$button.addClass(d))
        },
        liHeight: function() {
            if (!1 !== this.options.size) {
                var c = this.$menu.parent().clone().find("> .dropdown-toggle").prop("autofocus", !1).end().appendTo("body"),
                    b = c.addClass("open").find("> .dropdown-menu"),
                    d = b.find("li > a").outerHeight(),
                    a = this.options.header ? b.find(".popover-title").outerHeight() : 0,
                    f = this.options.liveSearch ? b.find(".bootstrap-select-searchbox").outerHeight() : 0,
                    b = this.options.actionsBox ? b.find(".bs-actionsbox").outerHeight() : 0;
                c.remove();
                this.$newElement.data("liHeight", d).data("headerHeight",
                    a).data("searchHeight", f).data("actionsHeight", b)
            }
        },
        setSize: function() {
            var e = this,
                b = this.$menu,
                d = b.find(".inner"),
                a = this.$newElement.outerHeight(),
                f = this.$newElement.data("liHeight"),
                k = this.$newElement.data("headerHeight"),
                g = this.$newElement.data("searchHeight"),
                p = this.$newElement.data("actionsHeight"),
                m = b.find("li .divider").outerHeight(!0),
                q = parseInt(b.css("padding-top")) + parseInt(b.css("padding-bottom")) + parseInt(b.css("border-top-width")) + parseInt(b.css("border-bottom-width")),
                t = this.options.hideDisabled ?
                ":not(.disabled)" : "",
                x = c(window),
                B = q + parseInt(b.css("margin-top")) + parseInt(b.css("margin-bottom")) + 2,
                v, C, K, A = function() {
                    C = e.$newElement.offset().top - x.scrollTop();
                    K = x.height() - C - a
                };
            A();
            this.options.header && b.css("padding-top", 0);
            "auto" == this.options.size ? (m = function() {
                var a;
                a = e.$lis.not(".hide");
                A();
                v = K - B;
                e.options.dropupAuto && e.$newElement.toggleClass("dropup", C > K && v - B < b.height());
                e.$newElement.hasClass("dropup") && (v = C - B);
                a = 3 < a.length + a.find("dt").length ? 3 * f + B - 2 : 0;
                b.css({
                    "max-height": v + "px",
                    overflow: "hidden",
                    "min-height": a + k + g + p + "px"
                });
                d.css({
                    "max-height": v - k - g - p - q + "px",
                    "overflow-y": "auto",
                    "min-height": Math.max(a - q, 0) + "px"
                })
            }, m(), this.$searchbox.off("input.getSize propertychange.getSize").on("input.getSize propertychange.getSize", m), c(window).off("resize.getSize").on("resize.getSize", m), c(window).off("scroll.getSize").on("scroll.getSize", m)) : this.options.size && "auto" != this.options.size && b.find("li" + t).length > this.options.size && (t = b.find("li" + t + " > *").filter(":not(.div-contain)").slice(0, this.options.size).last().parent().index(),
                t = b.find("li").slice(0, t + 1).find(".div-contain").length, v = f * this.options.size + t * m + q, e.options.dropupAuto && this.$newElement.toggleClass("dropup", C > K && v < b.height()), b.css({
                    "max-height": v + k + g + p + "px",
                    overflow: "hidden"
                }), d.css({
                    "max-height": v - q + "px",
                    "overflow-y": "auto"
                }))
        },
        setWidth: function() {
            if ("auto" == this.options.width) {
                this.$menu.css("min-width", "0");
                var c = this.$newElement.clone().appendTo("body"),
                    b = c.find("> .dropdown-menu").css("width"),
                    d = c.css("width", "auto").find("> button").css("width");
                c.remove();
                this.$newElement.css("width", Math.max(parseInt(b), parseInt(d)) + "px")
            } else "fit" == this.options.width ? (this.$menu.css("min-width", ""), this.$newElement.css("width", "").addClass("fit-width")) : this.options.width ? (this.$menu.css("min-width", ""), this.$newElement.css("width", this.options.width)) : (this.$menu.css("min-width", ""), this.$newElement.css("width", ""));
            this.$newElement.hasClass("fit-width") && "fit" !== this.options.width && this.$newElement.removeClass("fit-width")
        },
        selectPosition: function() {
            var e = this,
                b = c("<div />"),
                d, a, f = function(c) {
                    b.addClass(c.attr("class").replace(/form-control/gi, "")).toggleClass("dropup", c.hasClass("dropup"));
                    d = c.offset();
                    a = c.hasClass("dropup") ? 0 : c[0].offsetHeight;
                    b.css({
                        top: d.top + a,
                        left: d.left,
                        width: c[0].offsetWidth,
                        position: "absolute"
                    })
                };
            this.$newElement.on("click", function() {
                e.isDisabled() || (f(c(this)), b.appendTo(e.options.container), b.toggleClass("open", !c(this).hasClass("open")), b.append(e.$menu))
            });
            c(window).resize(function() {
                f(e.$newElement)
            });
            c(window).on("scroll",
                function() {
                    f(e.$newElement)
                });
            c("html").on("click", function(a) {
                1 > c(a.target).closest(e.$newElement).length && b.removeClass("open")
            })
        },
        mobile: function() {
            this.$element.addClass("mobile-device").appendTo(this.$newElement);
            this.options.container && this.$menu.hide()
        },
        refresh: function() {
            this.$lis = null;
            this.reloadLi();
            this.render();
            this.setWidth();
            this.setStyle();
            this.checkDisabled();
            this.liHeight()
        },
        update: function() {
            this.reloadLi();
            this.setWidth();
            this.setStyle();
            this.checkDisabled();
            this.liHeight()
        },
        setSelected: function(e,
            b) {
            null == this.$lis && (this.$lis = this.$menu.find("li"));
            c(this.$lis[e]).toggleClass("selected", b)
        },
        setDisabled: function(e, b) {
            null == this.$lis && (this.$lis = this.$menu.find("li"));
            b ? c(this.$lis[e]).addClass("disabled").find("a").attr("href", "#").attr("tabindex", -1) : c(this.$lis[e]).removeClass("disabled").find("a").removeAttr("href").attr("tabindex", 0)
        },
        isDisabled: function() {
            return this.$element.is(":disabled")
        },
        checkDisabled: function() {
            var c = this;
            this.isDisabled() ? this.$button.addClass("disabled").attr("tabindex", -1) : (this.$button.hasClass("disabled") && this.$button.removeClass("disabled"), -1 == this.$button.attr("tabindex") && (this.$element.data("tabindex") || this.$button.removeAttr("tabindex")));
            this.$button.click(function() {
                return !c.isDisabled()
            })
        },
        tabIndex: function() {
            this.$element.is("[tabindex]") && (this.$element.data("tabindex", this.$element.attr("tabindex")), this.$button.attr("tabindex", this.$element.data("tabindex")))
        },
        clickListener: function() {
            var e = this;
            c("body").on("touchstart.dropdown", ".dropdown-menu",
                function(b) {
                    b.stopPropagation()
                });
            this.$newElement.on("click", function() {
                e.setSize();
                e.options.liveSearch || e.multiple || setTimeout(function() {
                    e.$menu.find(".selected a").focus()
                }, 10)
            });
            this.$menu.on("click", "li a", function(b) {
                var d = c(this).parent().index(),
                    a = e.$element.val(),
                    f = e.$element.prop("selectedIndex");
                e.multiple && b.stopPropagation();
                b.preventDefault();
                if (!e.isDisabled() && !c(this).parent().hasClass("disabled")) {
                    var k = e.$element.find("option");
                    b = k.eq(d);
                    var g = b.prop("selected"),
                        p = b.parent("optgroup"),
                        m = e.options.maxOptions,
                        q = p.data("maxOptions") || !1;
                    if (e.multiple) {
                        if (b.prop("selected", !g), e.setSelected(d, !g), !1 !== m || !1 !== q) {
                            var k = m < k.filter(":selected").length,
                                p = q < p.find("option:selected").length,
                                g = e.options.maxOptionsText,
                                t = g[0].replace("{n}", m),
                                x = g[1].replace("{n}", q),
                                B = c('<div class="notify"></div>');
                            if (m && k || q && p) g[2] && (t = t.replace("{var}", g[2][1 < m ? 0 : 1]), x = x.replace("{var}", g[2][1 < q ? 0 : 1])), b.prop("selected", !1), e.$menu.append(B), m && k && (B.append(c("<div>" + t + "</div>")), e.$element.trigger("maxReached.bs.select")),
                                q && p && (B.append(c("<div>" + x + "</div>")), e.$element.trigger("maxReachedGrp.bs.select")), setTimeout(function() {
                                    e.setSelected(d, !1)
                                }, 10), B.delay(750).fadeOut(300, function() {
                                    c(this).remove()
                                })
                        }
                    } else k.prop("selected", !1), b.prop("selected", !0), e.$menu.find(".selected").removeClass("selected"), e.setSelected(d, !0);
                    e.multiple ? e.options.liveSearch && e.$searchbox.focus() : e.$button.focus();
                    (a != e.$element.val() && e.multiple || f != e.$element.prop("selectedIndex") && !e.multiple) && e.$element.change()
                }
            });
            this.$menu.on("click",
                "li.disabled a, li dt, li .div-contain, .popover-title, .popover-title :not(.close)",
                function(b) {
                    b.target == this && (b.preventDefault(), b.stopPropagation(), e.options.liveSearch ? e.$searchbox.focus() : e.$button.focus())
                });
            this.$menu.on("click", ".popover-title .close", function() {
                e.$button.focus()
            });
            this.$searchbox.on("click", function(b) {
                b.stopPropagation()
            });
            this.$menu.on("click", ".actions-btn", function(b) {
                e.options.liveSearch ? e.$searchbox.focus() : e.$button.focus();
                b.preventDefault();
                b.stopPropagation();
                c(this).is(".bs-select-all") ? e.selectAll() : e.deselectAll();
                e.$element.change()
            });
            this.$element.change(function() {
                e.render(!1)
            })
        },
        liveSearchListener: function() {
            var e = this,
                b = c('<li class="no-results"></li>');
            this.$newElement.on("click.dropdown.data-api", function() {
                e.$menu.find(".active").removeClass("active");
                e.$searchbox.val() && (e.$searchbox.val(""), e.$lis.not(".is-hidden").removeClass("hide"), b.parent().length && b.remove());
                e.multiple || e.$menu.find(".selected").addClass("active");
                setTimeout(function() {
                        e.$searchbox.focus()
                    },
                    10)
            });
            this.$searchbox.on("input propertychange", function() {
                e.$searchbox.val() ? (e.$lis.not(".is-hidden").removeClass("hide").find("a").not(":icontains(" + e.$searchbox.val() + ")").parent().addClass("hide"), e.$menu.find("li").filter(":visible:not(.no-results)").length ? b.parent().length && b.remove() : (b.parent().length && b.remove(), b.html(e.options.noneResultsText + ' "' + e.$searchbox.val() + '"').show(), e.$menu.find("li").last().after(b))) : (e.$lis.not(".is-hidden").removeClass("hide"), b.parent().length && b.remove());
                e.$menu.find("li.active").removeClass("active");
                e.$menu.find("li").filter(":visible:not(.divider)").eq(0).addClass("active").find("a").focus();
                c(this).focus()
            });
            this.$menu.on("mouseenter", "a", function(b) {
                e.$menu.find(".active").removeClass("active");
                c(b.currentTarget).parent().not(".disabled").addClass("active")
            });
            this.$menu.on("mouseleave", "a", function() {
                e.$menu.find(".active").removeClass("active")
            })
        },
        val: function(c) {
            return void 0 !== c ? (this.$element.val(c), this.$element.change(), this.$element) :
                this.$element.val()
        },
        selectAll: function() {
            null == this.$lis && (this.$lis = this.$menu.find("li"));
            this.$element.find("option:enabled").prop("selected", !0);
            c(this.$lis).filter(":not(.disabled)").addClass("selected");
            this.render(!1)
        },
        deselectAll: function() {
            null == this.$lis && (this.$lis = this.$menu.find("li"));
            this.$element.find("option:enabled").prop("selected", !1);
            c(this.$lis).filter(":not(.disabled)").removeClass("selected");
            this.render(!1)
        },
        keydown: function(e) {
            var b, d, a, f, k, g, p, m, q, t, x, B = {
                32: " ",
                48: "0",
                49: "1",
                50: "2",
                51: "3",
                52: "4",
                53: "5",
                54: "6",
                55: "7",
                56: "8",
                57: "9",
                59: ";",
                65: "a",
                66: "b",
                67: "c",
                68: "d",
                69: "e",
                70: "f",
                71: "g",
                72: "h",
                73: "i",
                74: "j",
                75: "k",
                76: "l",
                77: "m",
                78: "n",
                79: "o",
                80: "p",
                81: "q",
                82: "r",
                83: "s",
                84: "t",
                85: "u",
                86: "v",
                87: "w",
                88: "x",
                89: "y",
                90: "z",
                96: "0",
                97: "1",
                98: "2",
                99: "3",
                100: "4",
                101: "5",
                102: "6",
                103: "7",
                104: "8",
                105: "9"
            };
            b = c(this);
            a = b.parent();
            b.is("input") && (a = b.parent().parent());
            q = a.data("this");
            q.options.liveSearch && (a = b.parent().parent());
            q.options.container && (a = q.$menu);
            d = c("[role=menu] li:not(.divider) a",
                a);
            x = q.$menu.parent().hasClass("open");
            !x && /([0-9]|[A-z])/.test(String.fromCharCode(e.keyCode)) && (q.options.container ? q.$newElement.trigger("click") : (q.setSize(), q.$menu.parent().addClass("open"), x = q.$menu.parent().hasClass("open")), q.$searchbox.focus());
            q.options.liveSearch && (/(^9$|27)/.test(e.keyCode) && x && 0 === q.$menu.find(".active").length && (e.preventDefault(), q.$menu.parent().removeClass("open"), q.$button.focus()), d = c("[role=menu] li:not(.divider):visible", a), b.val() || /(38|40)/.test(e.keyCode) ||
                0 === d.filter(".active").length && (d = q.$newElement.find("li").filter(":icontains(" + B[e.keyCode] + ")")));
            if (d.length) {
                if (/(38|40)/.test(e.keyCode)) a = d.index(d.filter(":focus")), k = d.parent(":not(.disabled):visible").first().index(), g = d.parent(":not(.disabled):visible").last().index(), f = d.eq(a).parent().nextAll(":not(.disabled):visible").eq(0).index(), p = d.eq(a).parent().prevAll(":not(.disabled):visible").eq(0).index(), m = d.eq(f).parent().prevAll(":not(.disabled):visible").eq(0).index(), q.options.liveSearch &&
                    (d.each(function(a) {
                        c(this).is(":not(.disabled)") && c(this).data("index", a)
                    }), a = d.index(d.filter(".active")), k = d.filter(":not(.disabled):visible").first().data("index"), g = d.filter(":not(.disabled):visible").last().data("index"), f = d.eq(a).nextAll(":not(.disabled):visible").eq(0).data("index"), p = d.eq(a).prevAll(":not(.disabled):visible").eq(0).data("index"), m = d.eq(f).prevAll(":not(.disabled):visible").eq(0).data("index")), t = b.data("prevIndex"), 38 == e.keyCode && (q.options.liveSearch && (a -= 1), a != m && a > p &&
                        (a = p), a < k && (a = k), a == t && (a = g)), 40 == e.keyCode && (q.options.liveSearch && (a += 1), -1 == a && (a = 0), a != m && a < f && (a = f), a > g && (a = g), a == t && (a = k)), b.data("prevIndex", a), q.options.liveSearch ? (e.preventDefault(), b.is(".dropdown-toggle") || (d.removeClass("active"), d.eq(a).addClass("active").find("a").focus(), b.focus())) : d.eq(a).focus();
                else if (!b.is("input")) {
                    var v = [];
                    d.each(function() {
                        c(this).parent().is(":not(.disabled)") && c.trim(c(this).text().toLowerCase()).substring(0, 1) == B[e.keyCode] && v.push(c(this).parent().index())
                    });
                    a = c(document).data("keycount");
                    a++;
                    c(document).data("keycount", a);
                    c.trim(c(":focus").text().toLowerCase()).substring(0, 1) != B[e.keyCode] ? (a = 1, c(document).data("keycount", a)) : a >= v.length && (c(document).data("keycount", 0), a > v.length && (a = 1));
                    d.eq(v[a - 1]).focus()
                }
                /(13|32|^9$)/.test(e.keyCode) && x && (/(32)/.test(e.keyCode) || e.preventDefault(), q.options.liveSearch ? /(32)/.test(e.keyCode) || (q.$menu.find(".active a").click(), b.focus()) : c(":focus").click(), c(document).data("keycount", 0));
                if (/(^9$|27)/.test(e.keyCode) &&
                    x && (q.multiple || q.options.liveSearch) || /(27)/.test(e.keyCode) && !x) q.$menu.parent().removeClass("open"), q.$button.focus()
            }
        },
        hide: function() {
            this.$newElement.hide()
        },
        show: function() {
            this.$newElement.show()
        },
        destroy: function() {
            this.$newElement.remove();
            this.$element.remove()
        }
    };
    c.fn.selectpicker = function(e, b) {
        var d = arguments,
            a, f = this.each(function() {
                if (c(this).is("select")) {
                    var f = c(this),
                        n = f.data("selectpicker"),
                        p = "object" == typeof e && e;
                    if (!n) f.data("selectpicker", n = new g(this, p, b));
                    else if (p)
                        for (var m in p) n.options[m] =
                            p[m];
                    "string" == typeof e && (f = e, n[f] instanceof Function ? ([].shift.apply(d), a = n[f].apply(n, d)) : a = n.options[f])
                }
            });
        return void 0 !== a ? a : f
    };
    c.fn.selectpicker.defaults = {
        style: "btn-default",
        size: "auto",
        title: null,
        selectedTextFormat: "values",
        noneSelectedText: "Nothing selected",
        noneResultsText: "No results match",
        countSelectedText: "{0} of {1} selected",
        maxOptionsText: ["Limit reached ({n} {var} max)", "Group limit reached ({n} {var} max)", ["items", "item"]],
        width: !1,
        container: !1,
        hideDisabled: !1,
        showSubtext: !1,
        showIcon: !0,
        showContent: !0,
        dropupAuto: !0,
        header: !1,
        liveSearch: !1,
        actionsBox: !1,
        multipleSeparator: ", ",
        iconBase: "glyphicon",
        tickIcon: "glyphicon-ok",
        maxOptions: !1
    };
    c(document).data("keycount", 0).on("keydown", ".bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input", g.prototype.keydown).on("focusin.modal", ".bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input", function(c) {
        c.stopPropagation()
    })
}(window.jQuery);
! function(c) {
    var g = function(e, b) {
        this.$elements = c(e);
        this.options = b;
        this.before = this.options.before || this.before;
        this.onItem = this.options.onItem || this.onItem;
        this.options.target && this.$elements.attr("data-target", this.options.target);
        this.listen()
    };
    g.prototype = {
        constructor: g,
        show: function(e) {
            var b;
            if (!c(this).is(".disabled, :disabled") && (b = c.Event("context"), this.before.call(this, e, c(e.currentTarget)))) return this.$elements.trigger(b), b = this.getMenu(), e = this.getPosition(e, b), b.attr("style", "").css(e).data("_context_this_ref",
                this).addClass("open"), !1
        },
        closemenu: function(c) {
            this.getMenu().removeClass("open")
        },
        before: function(c) {
            return !0
        },
        onItem: function(c, b) {
            return !0
        },
        listen: function() {
            var e = this;
            this.$elements.on("contextmenu.context.data-api", c.proxy(this.show, this));
            c("html").on("click.context.data-api", c.proxy(this.closemenu, this));
            var b = c(this.$elements.attr("data-target"));
            b.on("click.context.data-api", function(b) {
                c(this).data("_context_this_ref") == e && e.onItem.call(this, b, c(b.target))
            });
            c("html").on("click.context.data-api",
                function(c) {
                    c.ctrlKey || b.removeClass("open")
                })
        },
        destroy: function() {
            this.$elements.off(".context.data-api").removeData("context");
            c("html").off(".context.data-api");
            c(this.$elements.attr("data-target")).off(".context.data-api")
        },
        getMenu: function() {
            var e = this.$elements.attr("data-target");
            e || (e = (e = this.$elements.attr("href")) && e.replace(/.*(?=#[^\s]*$)/, ""));
            return c(e)
        },
        getPosition: function(e, b) {
            var d = e.clientX + c(window).scrollLeft(),
                a = e.clientY,
                f = c(window).width(),
                k = c(window).height(),
                g = b.find(".dropdown-menu").outerWidth(),
                p = b.find(".dropdown-menu").outerHeight(),
                a = a + p > k ? {
                    top: a - p + c(window).scrollTop()
                } : {
                    top: a + c(window).scrollTop()
                };
            return c.extend({
                position: "absolute"
            }, a, d + g > f && 0 < d - g ? {
                left: d - g
            } : {
                left: d
            })
        },
        clearMenus: function(e) {
            e.ctrlKey || c("[data-toggle=context]").each(function() {
                this.getMenu().removeClass("open")
            })
        }
    };
    c.fn.contextmenu = function(c, b) {
        var d = this.data("context");
        d || this.data("context", d = new g(this, "object" == typeof c && c));
        "string" == typeof c && d[c].call(d, b)
    };
    c.fn.contextmenu.Constructor = g;
    c(document).on("contextmenu.context.data-api",
        "[data-toggle=context]",
        function(e) {
            c(this).contextmenu("show", e);
            e.preventDefault()
        })
}(window.jQuery);
(function(c) {
    var g = function(b) {
        this.value = {
            h: 0,
            s: 0,
            b: 0,
            a: 1
        };
        this.origFormat = null;
        b && (void 0 !== b.toLowerCase ? this.setColor(b) : void 0 !== b.h && (this.value = b))
    };
    g.prototype = {
        constructor: g,
        _sanitizeNumber: function(b) {
            return "number" === typeof b ? b : isNaN(b) || null === b || "" === b || void 0 === b ? 1 : void 0 !== b.toLowerCase ? parseFloat(b) : 1
        },
        setColor: function(b) {
            b = b.toLowerCase();
            this.value = this.stringToHSB(b) || {
                h: 0,
                s: 0,
                b: 0,
                a: 1
            }
        },
        stringToHSB: function(b) {
            b = b.toLowerCase();
            var a = this,
                e = !1;
            c.each(this.stringParsers, function(c,
                g) {
                var p = g.re.exec(b),
                    p = p && g.parse.apply(a, [p]),
                    m = g.format || "rgba";
                return p ? (e = m.match(/hsla?/) ? a.RGBtoHSB.apply(a, a.HSLtoRGB.apply(a, p)) : a.RGBtoHSB.apply(a, p), a.origFormat = m, !1) : !0
            });
            return e
        },
        setHue: function(b) {
            this.value.h = 1 - b
        },
        setSaturation: function(b) {
            this.value.s = b
        },
        setBrightness: function(b) {
            this.value.b = 1 - b
        },
        setAlpha: function(b) {
            this.value.a = parseInt(100 * (1 - b), 10) / 100
        },
        toRGB: function(b, a, c, e) {
            b = b || this.value.h;
            a = a || this.value.s;
            c = c || this.value.b;
            e = e || this.value.a;
            var g, p, m, q, t, x;
            b && void 0 ===
                a && void 0 === c && (a = b.s, c = b.v, b = b.h);
            q = Math.floor(6 * b);
            t = 6 * b - q;
            b = c * (1 - a);
            x = c * (1 - t * a);
            a = c * (1 - (1 - t) * a);
            switch (q % 6) {
                case 0:
                    g = c;
                    p = a;
                    m = b;
                    break;
                case 1:
                    g = x;
                    p = c;
                    m = b;
                    break;
                case 2:
                    g = b;
                    p = c;
                    m = a;
                    break;
                case 3:
                    g = b;
                    p = x;
                    m = c;
                    break;
                case 4:
                    g = a;
                    p = b;
                    m = c;
                    break;
                case 5:
                    g = c, p = b, m = x
            }
            return {
                r: Math.floor(255 * g),
                g: Math.floor(255 * p),
                b: Math.floor(255 * m),
                a: e
            }
        },
        toHex: function(b, a, c, e) {
            b = this.toRGB(b, a, c, e);
            return "#" + (16777216 | parseInt(b.r) << 16 | parseInt(b.g) << 8 | parseInt(b.b)).toString(16).substr(1)
        },
        toHSL: function(b, a, c, e) {
            b = b || this.value.h;
            a = a || this.value.s;
            c = c || this.value.b;
            e = e || this.value.a;
            var g = (2 - a) * c;
            a *= c;
            a = 0 < g && 1 >= g ? a / g : a / (2 - g);
            g /= 2;
            1 < a && (a = 1);
            return {
                h: isNaN(b) ? 0 : b,
                s: isNaN(a) ? 0 : a,
                l: isNaN(g) ? 0 : g,
                a: isNaN(e) ? 0 : e
            }
        },
        RGBtoHSB: function(b, a, c, e) {
            b /= 255;
            a /= 255;
            c /= 255;
            var g, p;
            p = Math.max(b, a, c);
            g = p - Math.min(b, a, c);
            b = ((0 === g ? 0 : p === b ? (a - c) / g : p === a ? (c - b) / g + 2 : (b - a) / g + 4) + 360) % 6 * 60 / 360;
            g = 0 === g ? 0 : g / p;
            return {
                h: this._sanitizeNumber(b),
                s: g,
                b: p,
                a: this._sanitizeNumber(e)
            }
        },
        HueToRGB: function(b, a, c) {
            0 > c ? c += 1 : 1 < c && (c -= 1);
            return 1 > 6 * c ? b + (a - b) * c * 6 : 1 > 2 *
                c ? a : 2 > 3 * c ? b + (a - b) * (2 / 3 - c) * 6 : b
        },
        HSLtoRGB: function(b, a, c, e) {
            0 > a && (a = 0);
            a = .5 >= c ? c * (1 + a) : c + a - c * a;
            var g = 2 * c - a,
                p = b - 1 / 3;
            c = Math.round(255 * this.HueToRGB(g, a, b + 1 / 3));
            b = Math.round(255 * this.HueToRGB(g, a, b));
            a = Math.round(255 * this.HueToRGB(g, a, p));
            return [c, b, a, this._sanitizeNumber(e)]
        },
        toString: function(b) {
            switch (b || "rgba") {
                case "rgb":
                    return b = this.toRGB(), "rgb(" + b.r + "," + b.g + "," + b.b + ")";
                case "rgba":
                    return b = this.toRGB(), "rgba(" + b.r + "," + b.g + "," + b.b + "," + b.a + ")";
                case "hsl":
                    return b = this.toHSL(), "hsl(" + Math.round(360 *
                        b.h) + "," + Math.round(100 * b.s) + "%," + Math.round(100 * b.l) + "%)";
                case "hsla":
                    return b = this.toHSL(), "hsla(" + Math.round(360 * b.h) + "," + Math.round(100 * b.s) + "%," + Math.round(100 * b.l) + "%," + b.a + ")";
                case "hex":
                    return this.toHex();
                default:
                    return !1
            }
        },
        stringParsers: [{
            re: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,
            format: "hex",
            parse: function(b) {
                return [parseInt(b[1], 16), parseInt(b[2], 16), parseInt(b[3], 16), 1]
            }
        }, {
            re: /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,
            format: "hex",
            parse: function(b) {
                return [parseInt(b[1] + b[1],
                    16), parseInt(b[2] + b[2], 16), parseInt(b[3] + b[3], 16), 1]
            }
        }, {
            re: /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/,
            format: "rgb",
            parse: function(b) {
                return [b[1], b[2], b[3], 1]
            }
        }, {
            re: /rgb\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*?\)/,
            format: "rgb",
            parse: function(b) {
                return [2.55 * b[1], 2.55 * b[2], 2.55 * b[3], 1]
            }
        }, {
            re: /rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
            format: "rgba",
            parse: function(b) {
                return [b[1], b[2], b[3], b[4]]
            }
        }, {
            re: /rgba\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
            format: "rgba",
            parse: function(b) {
                return [2.55 * b[1], 2.55 * b[2], 2.55 * b[3], b[4]]
            }
        }, {
            re: /hsl\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*?\)/,
            format: "hsl",
            parse: function(b) {
                return [b[1] / 360, b[2] / 100, b[3] / 100, b[4]]
            }
        }, {
            re: /hsla\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
            format: "hsla",
            parse: function(b) {
                return [b[1] / 360, b[2] / 100, b[3] / 100, b[4]]
            }
        }, {
            re: /^([a-z]{3,})$/,
            format: "alias",
            parse: function(b) {
                b = this.colorNameToHex(b[0]) ||
                    "#000000";
                return (b = this.stringParsers[0].re.exec(b)) && this.stringParsers[0].parse.apply(this, [b])
            }
        }],
        colorNameToHex: function(b) {
            var a = {
                aliceblue: "#f0f8ff",
                antiquewhite: "#faebd7",
                aqua: "#00ffff",
                aquamarine: "#7fffd4",
                azure: "#f0ffff",
                beige: "#f5f5dc",
                bisque: "#ffe4c4",
                black: "#000000",
                blanchedalmond: "#ffebcd",
                blue: "#0000ff",
                blueviolet: "#8a2be2",
                brown: "#a52a2a",
                burlywood: "#deb887",
                cadetblue: "#5f9ea0",
                chartreuse: "#7fff00",
                chocolate: "#d2691e",
                coral: "#ff7f50",
                cornflowerblue: "#6495ed",
                cornsilk: "#fff8dc",
                crimson: "#dc143c",
                cyan: "#00ffff",
                darkblue: "#00008b",
                darkcyan: "#008b8b",
                darkgoldenrod: "#b8860b",
                darkgray: "#a9a9a9",
                darkgreen: "#006400",
                darkkhaki: "#bdb76b",
                darkmagenta: "#8b008b",
                darkolivegreen: "#556b2f",
                darkorange: "#ff8c00",
                darkorchid: "#9932cc",
                darkred: "#8b0000",
                darksalmon: "#e9967a",
                darkseagreen: "#8fbc8f",
                darkslateblue: "#483d8b",
                darkslategray: "#2f4f4f",
                darkturquoise: "#00ced1",
                darkviolet: "#9400d3",
                deeppink: "#ff1493",
                deepskyblue: "#00bfff",
                dimgray: "#696969",
                dodgerblue: "#1e90ff",
                firebrick: "#b22222",
                floralwhite: "#fffaf0",
                forestgreen: "#228b22",
                fuchsia: "#ff00ff",
                gainsboro: "#dcdcdc",
                ghostwhite: "#f8f8ff",
                gold: "#ffd700",
                goldenrod: "#daa520",
                gray: "#808080",
                green: "#008000",
                greenyellow: "#adff2f",
                honeydew: "#f0fff0",
                hotpink: "#ff69b4",
                "indianred ": "#cd5c5c",
                "indigo ": "#4b0082",
                ivory: "#fffff0",
                khaki: "#f0e68c",
                lavender: "#e6e6fa",
                lavenderblush: "#fff0f5",
                lawngreen: "#7cfc00",
                lemonchiffon: "#fffacd",
                lightblue: "#add8e6",
                lightcoral: "#f08080",
                lightcyan: "#e0ffff",
                lightgoldenrodyellow: "#fafad2",
                lightgrey: "#d3d3d3",
                lightgreen: "#90ee90",
                lightpink: "#ffb6c1",
                lightsalmon: "#ffa07a",
                lightseagreen: "#20b2aa",
                lightskyblue: "#87cefa",
                lightslategray: "#778899",
                lightsteelblue: "#b0c4de",
                lightyellow: "#ffffe0",
                lime: "#00ff00",
                limegreen: "#32cd32",
                linen: "#faf0e6",
                magenta: "#ff00ff",
                maroon: "#800000",
                mediumaquamarine: "#66cdaa",
                mediumblue: "#0000cd",
                mediumorchid: "#ba55d3",
                mediumpurple: "#9370d8",
                mediumseagreen: "#3cb371",
                mediumslateblue: "#7b68ee",
                mediumspringgreen: "#00fa9a",
                mediumturquoise: "#48d1cc",
                mediumvioletred: "#c71585",
                midnightblue: "#191970",
                mintcream: "#f5fffa",
                mistyrose: "#ffe4e1",
                moccasin: "#ffe4b5",
                navajowhite: "#ffdead",
                navy: "#000080",
                oldlace: "#fdf5e6",
                olive: "#808000",
                olivedrab: "#6b8e23",
                orange: "#ffa500",
                orangered: "#ff4500",
                orchid: "#da70d6",
                palegoldenrod: "#eee8aa",
                palegreen: "#98fb98",
                paleturquoise: "#afeeee",
                palevioletred: "#d87093",
                papayawhip: "#ffefd5",
                peachpuff: "#ffdab9",
                peru: "#cd853f",
                pink: "#ffc0cb",
                plum: "#dda0dd",
                powderblue: "#b0e0e6",
                purple: "#800080",
                red: "#ff0000",
                rosybrown: "#bc8f8f",
                royalblue: "#4169e1",
                saddlebrown: "#8b4513",
                salmon: "#fa8072",
                sandybrown: "#f4a460",
                seagreen: "#2e8b57",
                seashell: "#fff5ee",
                sienna: "#a0522d",
                silver: "#c0c0c0",
                skyblue: "#87ceeb",
                slateblue: "#6a5acd",
                slategray: "#708090",
                snow: "#fffafa",
                springgreen: "#00ff7f",
                steelblue: "#4682b4",
                tan: "#d2b48c",
                teal: "#008080",
                thistle: "#d8bfd8",
                tomato: "#ff6347",
                turquoise: "#40e0d0",
                violet: "#ee82ee",
                wheat: "#f5deb3",
                white: "#ffffff",
                whitesmoke: "#f5f5f5",
                yellow: "#ffff00",
                yellowgreen: "#9acd32"
            };
            return "undefined" !== typeof a[b.toLowerCase()] ? a[b.toLowerCase()] : !1
        }
    };
    var e = {
            horizontal: !1,
            inline: !1,
            color: !1,
            format: !1,
            input: "input",
            container: !1,
            component: ".add-on, .input-group-addon",
            sliders: {
                saturation: {
                    maxLeft: 100,
                    maxTop: 100,
                    callLeft: "setSaturation",
                    callTop: "setBrightness"
                },
                hue: {
                    maxLeft: 0,
                    maxTop: 100,
                    callLeft: !1,
                    callTop: "setHue"
                },
                alpha: {
                    maxLeft: 0,
                    maxTop: 100,
                    callLeft: !1,
                    callTop: "setAlpha"
                }
            },
            slidersHorz: {
                saturation: {
                    maxLeft: 100,
                    maxTop: 100,
                    callLeft: "setSaturation",
                    callTop: "setBrightness"
                },
                hue: {
                    maxLeft: 100,
                    maxTop: 0,
                    callLeft: "setHue",
                    callTop: !1
                },
                alpha: {
                    maxLeft: 100,
                    maxTop: 0,
                    callLeft: "setAlpha",
                    callTop: !1
                }
            },
            template: '<div class="colorpicker dropdown-menu"><div class="colorpicker-saturation"><i><b></b></i></div><div class="colorpicker-hue"><i></i></div><div class="colorpicker-alpha"><i></i></div><div class="colorpicker-color"><div /></div></div>'
        },
        b = function(b, a) {
            this.element = c(b).addClass("colorpicker-element");
            this.options = c.extend({}, e, this.element.data(), a);
            this.component = this.options.component;
            (this.component = !1 !== this.component ? this.element.find(this.component) : !1) && 0 === this.component.length && (this.component = !1);
            this.container = !0 === this.options.container ? this.element : this.options.container;
            this.container = !1 !== this.container ? c(this.container) : !1;
            (this.input = this.element.is("input") ? this.element : this.options.input ? this.element.find(this.options.input) :
                !1) && 0 === this.input.length && (this.input = !1);
            this.color = new g(!1 !== this.options.color ? this.options.color : this.getValue());
            this.format = !1 !== this.options.format ? this.options.format : this.color.origFormat;
            this.picker = c(this.options.template);
            this.options.inline ? this.picker.addClass("colorpicker-inline colorpicker-visible") : this.picker.addClass("colorpicker-hidden");
            this.options.horizontal && this.picker.addClass("colorpicker-horizontal");
            "rgba" !== this.format && "hsla" !== this.format || this.picker.addClass("colorpicker-with-alpha");
            this.picker.on("mousedown.colorpicker", c.proxy(this.mousedown, this));
            this.picker.appendTo(this.container ? this.container : c("body"));
            if (!1 !== this.input) {
                this.input.on({
                    "keyup.colorpicker": c.proxy(this.keyup, this)
                });
                if (!1 === this.component) this.element.on({
                    "focus.colorpicker": c.proxy(this.show, this)
                });
                if (!1 === this.options.inline) this.element.on({
                    "focusout.colorpicker": c.proxy(this.hide, this)
                })
            }
            if (!1 !== this.component) this.component.on({
                "click.colorpicker": c.proxy(this.show, this)
            });
            if (!1 === this.input &&
                !1 === this.component) this.element.on({
                "click.colorpicker": c.proxy(this.show, this)
            });
            this.update();
            c(c.proxy(function() {
                this.element.trigger("create")
            }, this))
        };
    b.version = "2.0.0-beta";
    b.Color = g;
    b.prototype = {
        constructor: b,
        destroy: function() {
            this.picker.remove();
            this.element.removeData("colorpicker").off(".colorpicker");
            !1 !== this.input && this.input.off(".colorpicker");
            !1 !== this.component && this.component.off(".colorpicker");
            this.element.removeClass("colorpicker-element");
            this.element.trigger({
                type: "destroy"
            })
        },
        reposition: function() {
            if (!1 !== this.options.inline) return !1;
            var b = this.component ? this.component.offset() : this.element.offset();
            this.picker.css({
                top: b.top + (this.component ? this.component.outerHeight() : this.element.outerHeight()),
                left: b.left
            })
        },
        show: function(b) {
            if (this.isDisabled()) return !1;
            this.picker.addClass("colorpicker-visible").removeClass("colorpicker-hidden");
            this.reposition();
            c(window).on("resize.colorpicker", c.proxy(this.reposition, this));
            !this.hasInput() && b && b.stopPropagation && b.preventDefault &&
                (b.stopPropagation(), b.preventDefault());
            if (!1 === this.options.inline) c(window.document).on({
                "mousedown.colorpicker": c.proxy(this.hide, this)
            });
            this.element.trigger({
                type: "showPicker",
                color: this.color
            })
        },
        hide: function() {
            this.picker.addClass("colorpicker-hidden").removeClass("colorpicker-visible");
            c(window).off("resize.colorpicker", this.reposition);
            c(document).off({
                "mousedown.colorpicker": this.hide
            });
            this.update();
            this.element.trigger({
                type: "hidePicker",
                color: this.color
            })
        },
        updateData: function(b) {
            b = b ||
                this.color.toString(this.format);
            this.element.data("color", b);
            return b
        },
        updateInput: function(b) {
            b = b || this.color.toString(this.format);
            !1 !== this.input && this.input.prop("value", b);
            return b
        },
        updatePicker: function(b) {
            void 0 !== b && (this.color = new g(b));
            var a = !1 === this.options.horizontal ? this.options.sliders : this.options.slidersHorz,
                c = this.picker.find("i");
            if (0 !== c.length) return !1 === this.options.horizontal ? (a = this.options.sliders, c.eq(1).css("top", a.hue.maxTop * (1 - this.color.value.h)).end().eq(2).css("top",
                    a.alpha.maxTop * (1 - this.color.value.a))) : (a = this.options.slidersHorz, c.eq(1).css("left", a.hue.maxLeft * (1 - this.color.value.h)).end().eq(2).css("left", a.alpha.maxLeft * (1 - this.color.value.a))), c.eq(0).css({
                    top: a.saturation.maxTop - this.color.value.b * a.saturation.maxTop,
                    left: this.color.value.s * a.saturation.maxLeft
                }), this.picker.find(".colorpicker-saturation").css("backgroundColor", this.color.toHex(this.color.value.h, 1, 1, 1)), this.picker.find(".colorpicker-alpha").css("backgroundColor", this.color.toHex()),
                this.picker.find(".colorpicker-color, .colorpicker-color div").css("backgroundColor", this.color.toString(this.format)), b
        },
        updateComponent: function(b) {
            b = b || this.color.toString(this.format);
            if (!1 !== this.component) {
                var a = this.component.find("i").eq(0);
                0 < a.length ? a.css({
                    backgroundColor: b
                }) : this.component.css({
                    backgroundColor: b
                })
            }
            return b
        },
        update: function(b) {
            var a = this.updateComponent();
            if (!1 !== this.getValue(!1) || !0 === b) this.updateInput(a), this.updateData(a);
            this.updatePicker();
            return a
        },
        setValue: function(b) {
            this.color =
                new g(b);
            this.update();
            this.element.trigger({
                type: "changeColor",
                color: this.color,
                value: b
            })
        },
        getValue: function(b) {
            b = void 0 === b ? "#000000" : b;
            var a;
            a = this.hasInput() ? this.input.val() : this.element.data("color");
            if (void 0 === a || "" === a || null === a) a = b;
            return a
        },
        hasInput: function() {
            return !1 !== this.input
        },
        isDisabled: function() {
            return this.hasInput() ? !0 === this.input.prop("disabled") : !1
        },
        disable: function() {
            return this.hasInput() ? (this.input.prop("disabled", !0), !0) : !1
        },
        enable: function() {
            return this.hasInput() ? (this.input.prop("disabled", !1), !0) : !1
        },
        currentSlider: null,
        mousePointer: {
            left: 0,
            top: 0
        },
        mousedown: function(b) {
            b.stopPropagation();
            b.preventDefault();
            var a = c(b.target).closest("div"),
                e = this.options.horizontal ? this.options.slidersHorz : this.options.sliders;
            if (!a.is(".colorpicker")) {
                if (a.is(".colorpicker-saturation")) this.currentSlider = c.extend({}, e.saturation);
                else if (a.is(".colorpicker-hue")) this.currentSlider = c.extend({}, e.hue);
                else if (a.is(".colorpicker-alpha")) this.currentSlider = c.extend({}, e.alpha);
                else return !1;
                e = a.offset();
                this.currentSlider.guide = a.find("i")[0].style;
                this.currentSlider.left = b.pageX - e.left;
                this.currentSlider.top = b.pageY - e.top;
                this.mousePointer = {
                    left: b.pageX,
                    top: b.pageY
                };
                c(document).on({
                    "mousemove.colorpicker": c.proxy(this.mousemove, this),
                    "mouseup.colorpicker": c.proxy(this.mouseup, this)
                }).trigger("mousemove")
            }
            return !1
        },
        mousemove: function(b) {
            b.stopPropagation();
            b.preventDefault();
            var a = Math.max(0, Math.min(this.currentSlider.maxLeft, this.currentSlider.left + ((b.pageX || this.mousePointer.left) - this.mousePointer.left)));
            b = Math.max(0, Math.min(this.currentSlider.maxTop, this.currentSlider.top + ((b.pageY || this.mousePointer.top) - this.mousePointer.top)));
            this.currentSlider.guide.left = a + "px";
            this.currentSlider.guide.top = b + "px";
            this.currentSlider.callLeft && this.color[this.currentSlider.callLeft].call(this.color, a / 100);
            this.currentSlider.callTop && this.color[this.currentSlider.callTop].call(this.color, b / 100);
            this.update(!0);
            this.element.trigger({
                type: "changeColor",
                color: this.color
            });
            return !1
        },
        mouseup: function(b) {
            b.stopPropagation();
            b.preventDefault();
            c(document).off({
                "mousemove.colorpicker": this.mousemove,
                "mouseup.colorpicker": this.mouseup
            });
            return !1
        },
        keyup: function(b) {
            if (38 === b.keyCode) 1 > this.color.value.a && (this.color.value.a = Math.round(100 * (this.color.value.a + .01)) / 100), this.update(!0);
            else if (40 === b.keyCode) 0 < this.color.value.a && (this.color.value.a = Math.round(100 * (this.color.value.a - .01)) / 100), this.update(!0);
            else {
                var a = this.input.val();
                this.color = new g(a);
                !1 !== this.getValue(!1) && (this.updateData(), this.updateComponent(),
                    this.updatePicker())
            }
            this.element.trigger({
                type: "changeColor",
                color: this.color,
                value: a
            })
        }
    };
    c.colorpicker = b;
    c.fn.colorpicker = function(d) {
        var a = arguments;
        return this.each(function() {
            var e = c(this),
                g = e.data("colorpicker"),
                n = "object" === typeof d ? d : {};
            g || "string" === typeof d ? "string" === typeof d && g[d].apply(g, Array.prototype.slice.call(a, 1)) : e.data("colorpicker", new b(this, n))
        })
    };
    c.fn.colorpicker.constructor = b
})(window.jQuery);
! function(c) {
    "function" == typeof define && define.amd ? define(["jquery"], c) : c(jQuery)
}(function(c) {
    function g(a) {
        this.container = a;
        this.init()
    }

    function e(a, b) {
        this.widget = a;
        this.options = c.extend({}, b);
        this.detectService();
        this.service && this.init()
    }

    function b(a, b) {
        return d(a, b, encodeURIComponent)
    }

    function d(a, b, c) {
        return a.replace(/\{([^\}]+)\}/g, function(a, d) {
            return d in b ? c ? c(b[d]) : b[d] : a
        })
    }

    function a(a, b) {
        var c = k + a;
        return c + " " + c + "_" + b
    }

    function f(a) {
        function b(f) {
            "keydown" === f.type && 27 !== f.which || c(f.target).closest(a).length ||
                (a.fadeOut(n), d.off(e, b))
        }
        var d = c(document),
            e = "click touchstart keydown";
        d.on(e, b)
    }
    var k = "social-likes__",
        n = "fast",
        p = {
            facebook: {
                counterUrl: "http://graph.facebook.com/fql?q=SELECT+total_count+FROM+link_stat+WHERE+url%3D%22{url}%22&callback=?",
                convertNumber: function(a) {
                    return a.data[0].total_count
                },
                popupUrl: "http://www.facebook.com/sharer/sharer.php?u={url}",
                popupWidth: 600,
                popupHeight: 500
            },
            twitter: {
                counterUrl: "http://urls.api.twitter.com/1/urls/count.json?url={url}&callback=?",
                convertNumber: function(a) {
                    return a.count
                },
                popupUrl: "http://twitter.com/intent/tweet?url={url}&text={title}",
                popupWidth: 600,
                popupHeight: 450,
                click: function() {
                    return /[\.:\-\u2013\u2014]\s*$/.test(this.options.pageTitle) || (this.options.pageTitle += ":"), !0
                },
                searchUrl: "https://twitter.com/search?src=typd&q={url}"
            },
            mailru: {
                counterUrl: "http://connect.mail.ru/share_count?url_list={url}&callback=1&func=?",
                convertNumber: function(a) {
                    for (var b in a)
                        if (a.hasOwnProperty(b)) return a[b].shares
                },
                popupUrl: "http://connect.mail.ru/share?share_url={url}&title={title}",
                popupWidth: 550,
                popupHeight: 360
            },
            vkontakte: {
                counterUrl: "http://vkontakte.ru/share.php?act=count&url={url}&index={index}",
                counter: function(a, d) {
                    var e = p.vkontakte;
                    e._ || (e._ = [], window.VK || (window.VK = {}), window.VK.Share = {
                        count: function(a, b) {
                            e._[a].resolve(b)
                        }
                    });
                    var f = e._.length;
                    e._.push(d);
                    c.ajax({
                        url: b(a, {
                            index: f
                        }),
                        dataType: "jsonp"
                    })
                },
                popupUrl: "http://vk.com/share.php?url={url}&title={title}",
                popupWidth: 550,
                popupHeight: 330,
                searchUrl: "http://vk.com/feed?section=search&q=url%3A{url}"
            },
            odnoklassniki: {
                counterUrl: "http://www.odnoklassniki.ru/dk?st.cmd=shareData&ref={url}&cb=?",
                convertNumber: function(a) {
                    return a.count
                },
                popupUrl: "http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl={url}",
                popupWidth: 550,
                popupHeight: 360
            },
            plusone: {
                popupUrl: "https://plus.google.com/share?url={url}",
                popupWidth: 700,
                popupHeight: 500
            },
            livejournal: {
                click: function() {
                    var a = this._livejournalForm;
                    a || (a = this.options.pageHtml.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), a = c(d('<form action="http://www.livejournal.com/update.bml" method="post" target="_blank" accept-charset="UTF-8"><input type="hidden" name="mode" value="full"><input type="hidden" name="subject" value="{title}"><input type="hidden" name="event" value="{html}"></form>', {
                        title: this.options.pageTitle,
                        html: a
                    })), this.widget.append(a), this._livejournalForm = a);
                    a.submit()
                }
            },
            pinterest: {
                counterUrl: "http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?",
                convertNumber: function(a) {
                    return a.count
                },
                popupUrl: "http://pinterest.com/pin/create/button/?url={url}&description={title}",
                popupWidth: 630,
                popupHeight: 270
            }
        },
        m = {
            promises: {},
            fetch: function(a, d, e) {
                m.promises[a] || (m.promises[a] = {});
                var f = m.promises[a];
                if (f[d]) return f[d];
                var g = c.extend({}, p[a], e),
                    k = c.Deferred();
                a = g.counterUrl &&
                    b(g.counterUrl, {
                        url: d
                    });
                return c.isFunction(g.counter) ? g.counter(a, k) : g.counterUrl && c.getJSON(a).done(function(a) {
                    try {
                        var b = a;
                        c.isFunction(g.convertNumber) && (b = g.convertNumber(a));
                        k.resolve(b)
                    } catch (d) {
                        k.reject(d)
                    }
                }), f[d] = k.promise(), f[d]
            }
        };
    c.fn.socialLikes = function() {
        return this.each(function() {
            new g(c(this))
        })
    };
    g.prototype = {
        optionsMap: {
            pageUrl: {
                attr: "url",
                defaultValue: function() {
                    return window.location.href.replace(window.location.hash, "")
                }
            },
            pageTitle: {
                attr: "title",
                defaultValue: function() {
                    return document.title
                }
            },
            pageHtml: {
                attr: "html",
                defaultValue: function() {
                    return '<a href="' + this.options.pageUrl + '">' + this.options.pageTitle + "</a>"
                }
            },
            pageCounters: {
                attr: "counters",
                defaultValue: "yes",
                convert: function(a) {
                    return "yes" === a
                }
            }
        },
        init: function() {
            this.container.addClass("social-likes");
            this.readOptions();
            this.single = this.container.hasClass("social-likes_single");
            this.initUserButtons();
            this.single && this.makeSingleButton();
            var a = this.options;
            this.container.find("li").each(function() {
                new e(c(this), a)
            })
        },
        readOptions: function() {
            this.options = {};
            for (var a in this.optionsMap) {
                var b = this.optionsMap[a];
                this.options[a] = this.container.data(b.attr) || (c.isFunction(b.defaultValue) ? c.proxy(b.defaultValue, this)() : b.defaultValue);
                c.isFunction(b.convert) && (this.options[a] = b.convert(this.options[a]))
            }
        },
        initUserButtons: function() {
            !this.userButtonInited && window.socialLikesButtons && c.extend(!0, p, socialLikesButtons);
            this.userButtonInited = !0
        },
        makeSingleButton: function() {
            var b = this.container;
            b.addClass("social-likes_vertical");
            b.wrap(c("<div>", {
                "class": "social-likes_single-w"
            }));
            var d = b.parent(),
                e = parseInt(b.css("left"), 10),
                g = parseInt(b.css("top"), 10);
            b.hide();
            var m = c("<div>", {
                "class": a("button", "single"),
                text: b.data("single-title") || "Share"
            });
            m.prepend(c("<span>", {
                "class": a("icon", "single")
            }));
            d.append(m);
            var p = c("<li>", {
                "class": k + "close",
                html: "&times;"
            });
            b.append(p);
            this.number = 0;
            m.click(function() {
                b.css({
                    left: e,
                    top: g
                });
                if (document.documentElement.getBoundingClientRect) {
                    var a = parseInt(b.css("left"), 10),
                        c = parseInt(b.css("top"), 10);
                    b.css("visibility", "hidden").show();
                    var d =
                        b[0].getBoundingClientRect();
                    20 > d.left ? b.css("left", 20 - d.left + a) : d.right > window.innerWidth - 20 && b.css("left", window.innerWidth - d.right - 20 + a);
                    20 > d.top ? b.css("top", 20 - d.top + c) : d.bottom > window.innerHeight - 20 && b.css("top", window.innerHeight - d.bottom - 20 + c);
                    b.hide().css("visibility", "visible")
                }
                b.fadeIn(n);
                return f(b), !1
            });
            p.click(function() {
                b.fadeOut(n)
            });
            this.wrapper = d;
            this.container.on("counter.social-likes", c.proxy(this.updateCounter, this))
        },
        updateCounter: function(a, b, c) {
            c && (this.number += c, this.getCounterElem().text(this.number))
        },
        getCounterElem: function() {
            var b = this.wrapper.find("." + k + "counter_single");
            return b.length || (b = c("<span>", {
                "class": a("counter", "single")
            }), this.wrapper.append(b)), b
        }
    };
    e.prototype = {
        init: function() {
            if (this.detectParams(), this.initHtml(), this.options.pageCounters) this.options.counterNumber ? this.updateCounter(this.options.counterNumber) : m.fetch(this.service, this.options.pageUrl, this.options.counterUrl ? {
                counterUrl: this.options.counterUrl
            } : {}).done(c.proxy(this.updateCounter, this))
        },
        detectService: function() {
            for (var a =
                    this.widget[0].classList || this.widget[0].className.split(" "), b = 0; b < a.length; b++) {
                var d = a[b];
                if (p[d]) return this.service = d, c.extend(this.options, p[d]), void 0
            }
        },
        detectParams: function() {
            var a = this.widget.data("counter");
            if (a) {
                var b = parseInt(a, 10);
                isNaN(b) ? this.options.counterUrl = a : this.options.counterNumber = b
            }(a = this.widget.data("title")) && (this.options.pageTitle = a);
            (a = this.widget.data("url")) && (this.options.pageUrl = a)
        },
        initHtml: function() {
            var a = this.options,
                d = this.widget,
                e = !!a.clickUrl;
            d.removeClass(this.service);
            d.addClass(this.getElementClassNames("widget"));
            var f = d.find("a");
            f.length && this.cloneDataAttrs(f, d);
            f = c(e ? "<a>" : "<span>", {
                "class": this.getElementClassNames("button"),
                text: d.text()
            });
            e ? (a = b(a.clickUrl, {
                url: a.pageUrl,
                title: a.pageTitle
            }), f.attr("href", a)) : f.click(c.proxy(this.click, this));
            f.prepend(c("<span>", {
                "class": this.getElementClassNames("icon")
            }));
            d.empty().append(f);
            this.button = f
        },
        cloneDataAttrs: function(a, b) {
            var c = a.data(),
                d;
            for (d in c) c.hasOwnProperty(d) && b.data(d, c[d])
        },
        getElementClassNames: function(b) {
            return a(b,
                this.service)
        },
        updateCounter: function(a) {
            if (a = parseInt(a, 10)) {
                var d = this.options.searchUrl ? b(this.options.searchUrl, {
                        url: this.options.pageUrl
                    }) : null,
                    d = c(this.options.searchUrl ? "<a>" : "<span>", {
                        "class": this.getElementClassNames("counter"),
                        text: a,
                        href: d
                    });
                this.widget.append(d);
                this.widget.trigger("counter.social-likes", [this.service, a])
            }
        },
        click: function(a) {
            var d = this.options,
                e = !0;
            if (c.isFunction(d.click) && (e = d.click.call(this, a)), e) a = b(d.popupUrl, {
                    url: d.pageUrl,
                    title: d.pageTitle
                }), a = this.addAdditionalParamsToUrl(a),
                this.openPopup(a, {
                    width: d.popupWidth,
                    height: d.popupHeight
                });
            return !1
        },
        addAdditionalParamsToUrl: function(a) {
            var b = c.param(this.widget.data());
            if (!b) return a;
            var d = -1 === a.indexOf("?") ? "?" : "&";
            return a + d + b
        },
        openPopup: function(a, b) {
            var c = Math.round(screen.width / 2 - b.width / 2),
                d = 0;
            screen.height > b.height && (d = Math.round(screen.height / 3 - b.height / 2));
            (c = window.open(a, "sl_" + this.service, "left=" + c + ",top=" + d + ",width=" + b.width + ",height=" + b.height + ",personalbar=0,toolbar=0,scrollbars=1,resizable=1")) ? c.focus(): location.href =
                a
        }
    };
    c(function() {
        c(".social-likes").socialLikes()
    })
});
(function(c, g) {
    var e = c.document,
        b = c.navigator,
        d = c.setTimeout,
        a = c.encodeURIComponent,
        f = c.ActiveXObject,
        k = c.Error,
        n = c.Number.parseInt || c.parseInt,
        p = c.Number.parseFloat || c.parseFloat,
        m = c.Number.isNaN || c.isNaN,
        q = c.Math.round,
        t = c.Date.now,
        x = c.Object.keys,
        B = c.Object.defineProperty,
        v = c.Object.prototype.hasOwnProperty,
        C = c.Array.prototype.slice,
        K = function() {
            var a = function(a) {
                return a
            };
            if ("function" === typeof c.wrap && "function" === typeof c.unwrap) try {
                var b = e.createElement("div"),
                    d = c.unwrap(b);
                1 === b.nodeType &&
                    d && 1 === d.nodeType && (a = c.unwrap)
            } catch (f) {}
            return a
        }(),
        A = function(a) {
            return C.call(a, 0)
        },
        y = function() {
            var a, b, c, d, e, f = A(arguments),
                h = f[0] || {};
            a = 1;
            for (b = f.length; a < b; a++)
                if (null != (c = f[a]))
                    for (d in c) v.call(c, d) && (e = c[d], h !== e && e !== g && (h[d] = e));
            return h
        },
        E = function(a) {
            var b, c, d;
            if ("object" !== typeof a || null == a) b = a;
            else if ("number" === typeof a.length)
                for (b = [], c = 0, d = a.length; c < d; c++) v.call(a, c) && (b[c] = E(a[c]));
            else
                for (c in b = {}, a) v.call(a, c) && (b[c] = E(a[c]));
            return b
        },
        N = function(a, b) {
            if (a && 1 === a.nodeType &&
                a.ownerDocument && b && (1 === b.nodeType && b.ownerDocument && b.ownerDocument === a.ownerDocument || 9 === b.nodeType && !b.ownerDocument && b === a.ownerDocument)) {
                do {
                    if (a === b) return !0;
                    a = a.parentNode
                } while (a)
            }
            return !1
        },
        I = function(a) {
            var b;
            "string" === typeof a && a && (a.split("#")[0].split("?"), b = a.slice(0, a.lastIndexOf("/") + 1));
            return b
        },
        Z = function() {
            var a, b, c;
            if (e.currentScript && (a = e.currentScript.src)) return a;
            b = e.getElementsByTagName("script");
            if (1 === b.length) return b[0].src || g;
            if ("readyState" in b[0])
                for (c = b.length; c--;)
                    if ("interactive" ===
                        b[c].readyState && (a = b[c].src)) return a;
            if ("loading" === e.readyState && (a = b[b.length - 1].src)) return a;
            var d;
            try {
                throw new k;
            } catch (f) {
                b = f
            }
            if (b && !(d = b.sourceURL || b.fileName)) {
                d = b.stack;
                var h;
                "string" === typeof d && d && ((b = d.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/)) && b[1] ? h = b[1] : (b = d.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/)) && b[1] && (h = b[1]));
                d = h
            }
            return (a = d) ? a : g
        },
        G = {
            bridge: null,
            version: "0.0.0",
            pluginType: "unknown",
            disabled: null,
            outdated: null,
            unavailable: null,
            deactivated: null,
            overdue: null,
            ready: null
        },
        P = {},
        U, Ba, R = {},
        la = null,
        Ha = {
            ready: "Flash communication is established",
            error: {
                "flash-disabled": "Flash is disabled or not installed",
                "flash-outdated": "Flash is too outdated to support ZeroClipboard",
                "flash-unavailable": "Flash is unable to communicate bidirectionally with JavaScript",
                "flash-deactivated": "Flash is too outdated for your browser and/or is configured as click-to-activate",
                "flash-overdue": "Flash communication was established but NOT within the acceptable time limit"
            }
        },
        J = {
            swfPath: function() {
                var a;
                if (!(a = I(Z()))) {
                    var b, c, d = e.getElementsByTagName("script");
                    for (a = d.length; a--;) {
                        if (!(c = d[a].src)) {
                            b = null;
                            break
                        }
                        c = I(c);
                        if (null == b) b = c;
                        else if (b !== c) {
                            b = null;
                            break
                        }
                    }
                    a = b || g
                }
                return (a || "") + "ZeroClipboard.swf"
            }(),
            trustedDomains: c.location.host ? [c.location.host] : [],
            cacheBust: !0,
            forceEnhancedClipboard: !1,
            flashLoadTimeout: 3E4,
            autoActivate: !0,
            bubbleEvents: !0,
            containerId: "global-zeroclipboard-html-bridge",
            containerClass: "global-zeroclipboard-container",
            swfObjectId: "global-zeroclipboard-flash-bridge",
            hoverClass: "zeroclipboard-is-hover",
            activeClass: "zeroclipboard-is-active",
            forceHandCursor: !1,
            title: null,
            zIndex: 999999999
        },
        ja = function(a) {
            if ("object" === typeof a && null !== a)
                for (var b in a)
                    if (v.call(a, b))
                        if (/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(b)) J[b] = a[b];
                        else if (null == G.bridge)
                if ("containerId" === b || "swfObjectId" === b) {
                    var c = a[b];
                    if ("string" === typeof c && c && /^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(c)) J[b] =
                        a[b];
                    else throw Error("The specified `" + b + "` value is not valid as an HTML4 Element ID");
                } else J[b] = a[b];
            if ("string" === typeof a && a) {
                if (v.call(J, a)) return J[a]
            } else return E(J)
        },
        ca = function() {
            for (var a = ["userAgent", "platform", "appName"], c = {}, d = 0, e = a.length; d < e; d++) a[d] in b && (c[a[d]] = b[a[d]]);
            var a = ["bridge"],
                d = {},
                f;
            for (f in G) - 1 === a.indexOf(f) && (d[f] = G[f]);
            return {
                browser: c,
                flash: d,
                zeroclipboard: {
                    version: z.version,
                    config: z.config()
                }
            }
        },
        aa = function() {
            return !!(G.disabled || G.outdated || G.unavailable || G.deactivated)
        },
        s = function(a, b) {
            var c, d, e, f = {};
            if ("string" === typeof a && a) e = a.toLowerCase().split(/\s+/);
            else if ("object" === typeof a && a && "undefined" === typeof b)
                for (c in a)
                    if (v.call(a, c) && "string" === typeof c && c && "function" === typeof a[c]) z.on(c, a[c]);
            if (e && e.length) {
                c = 0;
                for (d = e.length; c < d; c++) a = e[c].replace(/^on/, ""), f[a] = !0, P[a] || (P[a] = []), P[a].push(b);
                f.ready && G.ready && z.emit({
                    type: "ready"
                });
                if (f.error)
                    for (e = ["disabled", "outdated", "unavailable", "deactivated", "overdue"], c = 0, d = e.length; c < d; c++)
                        if (!0 === G[e[c]]) {
                            z.emit({
                                type: "error",
                                name: "flash-" + e[c]
                            });
                            break
                        }
            }
            return z
        },
        T = function(a, b) {
            var c, d, e, f, h;
            if (0 === arguments.length) f = x(P);
            else if ("string" === typeof a && a) f = a.split(/\s+/);
            else if ("object" === typeof a && a && "undefined" === typeof b)
                for (c in a) v.call(a, c) && "string" === typeof c && c && "function" === typeof a[c] && z.off(c, a[c]);
            if (f && f.length)
                for (c = 0, d = f.length; c < d; c++)
                    if (a = f[c].toLowerCase().replace(/^on/, ""), (h = P[a]) && h.length)
                        if (b)
                            for (e = h.indexOf(b); - 1 !== e;) h.splice(e, 1), e = h.indexOf(b, e);
                        else h.length = 0;
            return z
        },
        S = function(a) {
            return "string" ===
                typeof a && a ? E(P[a]) || null : E(P)
        },
        ya = function(a) {
            var b, d, f;
            if (a = Ka(a)) {
                b = a;
                var h = b.target || U || null,
                    g = "swf" === b._source;
                delete b._source;
                var k = ["flash-disabled", "flash-outdated", "flash-unavailable", "flash-deactivated", "flash-overdue"];
                switch (b.type) {
                    case "error":
                        -1 !== k.indexOf(b.name) && y(G, {
                            disabled: "flash-disabled" === b.name,
                            outdated: "flash-outdated" === b.name,
                            unavailable: "flash-unavailable" === b.name,
                            deactivated: "flash-deactivated" === b.name,
                            overdue: "flash-overdue" === b.name,
                            ready: !1
                        });
                        break;
                    case "ready":
                        h = !0 === G.deactivated;
                        y(G, {
                            disabled: !1,
                            outdated: !1,
                            unavailable: !1,
                            deactivated: !1,
                            overdue: h,
                            ready: !h
                        });
                        break;
                    case "beforecopy":
                        Ba = h;
                        break;
                    case "copy":
                        var n, w, h = b.relatedTarget;
                        !R["text/html"] && !R["text/plain"] && h && (w = h.value || h.outerHTML || h.innerHTML) && (n = h.value || h.textContent || h.innerText) ? (b.clipboardData.clearData(), b.clipboardData.setData("text/plain", n), w !== n && b.clipboardData.setData("text/html", w)) : !R["text/plain"] && b.target && (n = b.target.getAttribute("data-clipboard-text")) && (b.clipboardData.clearData(),
                            b.clipboardData.setData("text/plain", n));
                        break;
                    case "aftercopy":
                        z.clearData();
                        if (n = h) {
                            var m;
                            try {
                                m = e.activeElement
                            } catch (p) {
                                m = null
                            }
                            n = h !== m
                        }
                        n && h.focus && h.focus();
                        break;
                    case "_mouseover":
                        z.focus(h);
                        !0 === J.bubbleEvents && g && (h && h !== b.relatedTarget && !N(b.relatedTarget, h) && Q(y({}, b, {
                            type: "mouseenter",
                            bubbles: !1,
                            cancelable: !1
                        })), Q(y({}, b, {
                            type: "mouseover"
                        })));
                        break;
                    case "_mouseout":
                        z.blur();
                        !0 === J.bubbleEvents && g && (h && h !== b.relatedTarget && !N(b.relatedTarget, h) && Q(y({}, b, {
                                type: "mouseleave",
                                bubbles: !1,
                                cancelable: !1
                            })),
                            Q(y({}, b, {
                                type: "mouseout"
                            })));
                        break;
                    case "_mousedown":
                        ha(h, J.activeClass);
                        !0 === J.bubbleEvents && g && Q(y({}, b, {
                            type: b.type.slice(1)
                        }));
                        break;
                    case "_mouseup":
                        da(h, J.activeClass);
                        !0 === J.bubbleEvents && g && Q(y({}, b, {
                            type: b.type.slice(1)
                        }));
                        break;
                    case "_click":
                        Ba = null;
                        !0 === J.bubbleEvents && g && Q(y({}, b, {
                            type: b.type.slice(1)
                        }));
                        break;
                    case "_mousemove":
                        !0 === J.bubbleEvents && g && Q(y({}, b, {
                            type: b.type.slice(1)
                        }))
                }
                b = /^_(?:click|mouse(?:over|out|down|up|move))$/.test(b.type) ? !0 : void 0;
                if (!b) {
                    if ("ready" === a.type && !0 ===
                        G.overdue) return z.emit({
                        type: "error",
                        name: "flash-overdue"
                    });
                    b = y({}, a);
                    if ("object" === typeof b && b && b.type && (h = va(b), (n = (P["*"] || []).concat(P[b.type] || [])) && n.length)) {
                        var q;
                        w = 0;
                        for (m = n.length; w < m; w++) g = n[w], k = this, "string" === typeof g && "function" === typeof c[g] && (g = c[g]), "object" === typeof g && g && "function" === typeof g.handleEvent && (k = g, g = g.handleEvent), "function" === typeof g && (q = y({}, b), xa(g, k, [q], h))
                    }
                    if ("copy" === a.type) {
                        d = {};
                        a = {};
                        if ("object" === typeof R && R) {
                            for (f in R)
                                if (f && v.call(R, f) && "string" === typeof R[f] &&
                                    R[f]) switch (f.toLowerCase()) {
                                    case "text/plain":
                                    case "text":
                                    case "air:text":
                                    case "flash:text":
                                        d.text = R[f];
                                        a.text = f;
                                        break;
                                    case "text/html":
                                    case "html":
                                    case "air:html":
                                    case "flash:html":
                                        d.html = R[f];
                                        a.html = f;
                                        break;
                                    case "application/rtf":
                                    case "text/rtf":
                                    case "rtf":
                                    case "richtext":
                                    case "air:rtf":
                                    case "flash:rtf":
                                        d.rtf = R[f], a.rtf = f
                                }
                                f = {
                                    data: d,
                                    formatMap: a
                                }
                        } else f = void 0;
                        d = f.data;
                        la = f.formatMap
                    }
                    return d
                }
            }
        },
        ka = function() {
            "boolean" !== typeof G.ready && (G.ready = !1);
            if (!z.isFlashUnusable() && null === G.bridge) {
                var a =
                    J.flashLoadTimeout;
                "number" === typeof a && 0 <= a && d(function() {
                    "boolean" !== typeof G.deactivated && (G.deactivated = !0);
                    !0 === G.deactivated && z.emit({
                        type: "error",
                        name: "flash-deactivated"
                    })
                }, a);
                G.overdue = !1;
                h()
            }
        },
        w = function() {
            z.clearData();
            z.blur();
            z.emit("destroy");
            db();
            z.off()
        },
        M = function(a, b) {
            var c;
            if ("object" === typeof a && a && "undefined" === typeof b) c = a, z.clearData();
            else if ("string" === typeof a && a) c = {}, c[a] = b;
            else return;
            for (var d in c) "string" === typeof d && d && v.call(c, d) && "string" === typeof c[d] && c[d] && (R[d] =
                c[d])
        },
        za = function(a) {
            if ("undefined" === typeof a) {
                if (R)
                    for (var b in R) v.call(R, b) && delete R[b];
                la = null
            } else "string" === typeof a && v.call(R, a) && delete R[a]
        },
        ra = function(a) {
            if ("undefined" === typeof a) return E(R);
            if ("string" === typeof a && v.call(R, a)) return R[a]
        },
        sa = function(a) {
            if (a && 1 === a.nodeType) {
                U && (da(U, J.activeClass), U !== a && da(U, J.hoverClass));
                U = a;
                ha(a, J.hoverClass);
                var b = a.getAttribute("title") || J.title;
                if ("string" === typeof b && b) {
                    var d = F(G.bridge);
                    d && d.setAttribute("title", b)
                }(b = !0 === J.forceHandCursor) ||
                (a = (b = c.getComputedStyle(a, null).getPropertyValue("cursor")) && "auto" !== b || "A" !== a.nodeName ? b : "pointer", b = "pointer" === a);
                a = b;
                !0 === G.ready && (G.bridge && "function" === typeof G.bridge.setHandCursor ? G.bridge.setHandCursor(a) : G.ready = !1);
                var e;
                U && (e = F(G.bridge)) && (a = ia(U), y(e.style, {
                    width: a.width + "px",
                    height: a.height + "px",
                    top: a.top + "px",
                    left: a.left + "px",
                    zIndex: "" + qa(J.zIndex)
                }))
            }
        },
        Ja = function() {
            var a = F(G.bridge);
            a && (a.removeAttribute("title"), a.style.left = "0px", a.style.top = "-9999px", a.style.width = "1px", a.style.top =
                "1px");
            U && (da(U, J.hoverClass), da(U, J.activeClass), U = null)
        },
        W = function() {
            return U || null
        },
        Ka = function(a) {
            var b;
            "string" === typeof a && a ? (b = a, a = {}) : "object" === typeof a && a && "string" === typeof a.type && a.type && (b = a.type);
            if (b) {
                !a.target && /^(copy|aftercopy|_click)$/.test(b.toLowerCase()) && (a.target = Ba);
                y(a, {
                    type: b.toLowerCase(),
                    target: a.target || U || null,
                    relatedTarget: a.relatedTarget || null,
                    currentTarget: G && G.bridge || null,
                    timeStamp: a.timeStamp || t() || null
                });
                b = Ha[a.type];
                "error" === a.type && a.name && b && (b = b[a.name]);
                b && (a.message = b);
                "ready" === a.type && y(a, {
                    target: null,
                    version: G.version
                });
                "error" === a.type && (/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(a.name) && y(a, {
                    target: null,
                    minimumVersion: "11.0.0"
                }), /^flash-(outdated|unavailable|deactivated|overdue)$/.test(a.name) && y(a, {
                    version: G.version
                }));
                "copy" === a.type && (a.clipboardData = {
                    setData: z.setData,
                    clearData: z.clearData
                });
                if ("aftercopy" === a.type && (b = la, "object" === typeof a && a && "object" === typeof b && b)) {
                    var d = {},
                        f;
                    for (f in a)
                        if (v.call(a, f))
                            if ("success" !==
                                f && "data" !== f) d[f] = a[f];
                            else {
                                d[f] = {};
                                var h = a[f],
                                    k;
                                for (k in h) k && v.call(h, k) && v.call(b, k) && (d[f][b[k]] = h[k])
                            }
                    a = d
                }
                a.target && !a.relatedTarget && (f = a, k = (k = (k = a.target) && k.getAttribute && k.getAttribute("data-clipboard-target")) ? e.getElementById(k) : null, f.relatedTarget = k);
                if (a && /^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)) {
                    f = a.target;
                    k = "_mouseover" === a.type && a.relatedTarget ? a.relatedTarget : g;
                    b = "_mouseout" === a.type && a.relatedTarget ? a.relatedTarget : g;
                    var h = ia(f),
                        d = h.left + ("number" === typeof a._stageX ?
                            a._stageX : 0),
                        h = h.top + ("number" === typeof a._stageY ? a._stageY : 0),
                        n = d - (e.body.scrollLeft + e.documentElement.scrollLeft),
                        w = h - (e.body.scrollTop + e.documentElement.scrollTop),
                        m = (c.screenLeft || c.screenX || 0) + n,
                        p = (c.screenTop || c.screenY || 0) + w,
                        q = "number" === typeof a.movementX ? a.movementX : 0,
                        M = "number" === typeof a.movementY ? a.movementY : 0;
                    delete a._stageX;
                    delete a._stageY;
                    y(a, {
                        srcElement: f,
                        fromElement: k,
                        toElement: b,
                        screenX: m,
                        screenY: p,
                        pageX: d,
                        pageY: h,
                        clientX: n,
                        clientY: w,
                        x: n,
                        y: w,
                        movementX: q,
                        movementY: M,
                        offsetX: 0,
                        offsetY: 0,
                        layerX: 0,
                        layerY: 0
                    })
                }
                return a
            }
        },
        va = function(a) {
            return !/^(?:(?:before)?copy|destroy)$/.test(a && "string" === typeof a.type && a.type || "")
        },
        xa = function(a, b, c, e) {
            e ? d(function() {
                a.apply(b, c)
            }, 0) : a.apply(b, c)
        },
        Q = function(a) {
            if (a && "string" === typeof a.type && a) {
                var b, d = a.target || null;
                b = d && d.ownerDocument || e;
                a = y({
                    view: b.defaultView || c,
                    canBubble: !0,
                    cancelable: !0,
                    detail: "click" === a.type ? 1 : 0,
                    button: "number" === typeof a.which ? a.which - 1 : "number" === typeof a.button ? a.button : b.createEvent ? 0 : 1
                }, a);
                d && b.createEvent && d.dispatchEvent &&
                    (a = [a.type, a.canBubble, a.cancelable, a.view, a.detail, a.screenX, a.screenY, a.clientX, a.clientY, a.ctrlKey, a.altKey, a.shiftKey, a.metaKey, a.button, a.relatedTarget], b = b.createEvent("MouseEvents"), b.initMouseEvent && (b.initMouseEvent.apply(b, a), b._source = "js", d.dispatchEvent(b)))
            }
        },
        F = function(a) {
            for (a = a && a.parentNode; a && "OBJECT" === a.nodeName && a.parentNode;) a = a.parentNode;
            return a || null
        },
        h = function() {
            var b, d = G.bridge,
                f = F(d);
            if (!d) {
                var d = Ma(c.location.host, J),
                    h = "never" === d ? "none" : "all",
                    g, k, n, w = "",
                    m = [];
                J.trustedDomains &&
                    ("string" === typeof J.trustedDomains ? g = [J.trustedDomains] : "object" === typeof J.trustedDomains && "length" in J.trustedDomains && (g = J.trustedDomains));
                if (g && g.length)
                    for (f = 0, k = g.length; f < k; f++)
                        if (v.call(g, f) && g[f] && "string" === typeof g[f] && (n = La(g[f]))) {
                            if ("*" === n) {
                                m.length = 0;
                                m.push(n);
                                break
                            }
                            m.push.apply(m, [n, "//" + n, c.location.protocol + "//" + n])
                        }
                m.length && (w += "trustedOrigins=" + a(m.join(",")));
                !0 === J.forceEnhancedClipboard && (w += (w ? "&" : "") + "forceEnhancedClipboard=true");
                "string" === typeof J.swfObjectId && J.swfObjectId &&
                    (w += (w ? "&" : "") + "swfObjectId=" + a(J.swfObjectId));
                g = w;
                f = J.swfPath;
                k = null == J || J && !0 === J.cacheBust ? (-1 === J.swfPath.indexOf("?") ? "?" : "&") + "noCache=" + t() : "";
                k = f + k;
                f = e.createElement("div");
                f.id = J.containerId;
                f.className = J.containerClass;
                f.style.position = "absolute";
                f.style.left = "0px";
                f.style.top = "-9999px";
                f.style.width = "1px";
                f.style.height = "1px";
                f.style.zIndex = "" + qa(J.zIndex);
                n = e.createElement("div");
                f.appendChild(n);
                e.body.appendChild(f);
                w = e.createElement("div");
                m = "activex" === G.pluginType;
                w.innerHTML = '<object id="' +
                    J.swfObjectId + '" name="' + J.swfObjectId + '" width="100%" height="100%" ' + (m ? 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' : 'type="application/x-shockwave-flash" data="' + k + '"') + ">" + (m ? '<param name="movie" value="' + k + '"/>' : "") + '<param name="allowScriptAccess" value="' + d + '"/><param name="allowNetworking" value="' + h + '"/><param name="menu" value="false"/><param name="wmode" value="transparent"/><param name="flashvars" value="' + g + '"/></object>';
                d = w.firstChild;
                K(d).ZeroClipboard = z;
                f.replaceChild(d,
                    n)
            }
            d || ((d = e[J.swfObjectId]) && (b = d.length) && (d = d[b - 1]), !d && f && (d = f.firstChild));
            G.bridge = d || null;
            return d
        },
        db = function() {
            var a = G.bridge;
            if (a) {
                var b = F(a);
                b && ("activex" === G.pluginType && "readyState" in a ? (a.style.display = "none", function ea() {
                    if (4 === a.readyState) {
                        for (var c in a) "function" === typeof a[c] && (a[c] = null);
                        a.parentNode && a.parentNode.removeChild(a);
                        b.parentNode && b.parentNode.removeChild(b)
                    } else d(ea, 10)
                }()) : (a.parentNode && a.parentNode.removeChild(a), b.parentNode && b.parentNode.removeChild(b)));
                G.ready =
                    null;
                G.bridge = null;
                G.deactivated = null
            }
        },
        La = function(a) {
            if (null == a || "" === a) return null;
            a = a.replace(/^\s+|\s+$/g, "");
            if ("" === a) return null;
            var b = a.indexOf("//");
            a = -1 === b ? a : a.slice(b + 2);
            var c = a.indexOf("/");
            return (a = -1 === c ? a : -1 === b || 0 === c ? null : a.slice(0, c)) && ".swf" === a.slice(-4).toLowerCase() ? null : a || null
        },
        Ma = function() {
            return function(a, b) {
                var c = La(b.swfPath);
                null === c && (c = a);
                var d = b.trustedDomains,
                    e, f, h, g = [];
                "string" === typeof d && (d = [d]);
                if ("object" === typeof d && d && "number" === typeof d.length)
                    for (e = 0,
                        f = d.length; e < f; e++)
                        if (v.call(d, e) && (h = La(d[e]))) {
                            if ("*" === h) {
                                g.length = 0;
                                g.push("*");
                                break
                            } - 1 === g.indexOf(h) && g.push(h)
                        }
                d = g.length;
                if (0 < d) {
                    if (1 === d && "*" === g[0]) return "always";
                    if (-1 !== g.indexOf(a)) return 1 === d && a === c ? "sameDomain" : "always"
                }
                return "never"
            }
        }(),
        ha = function(a, b) {
            if (!a || 1 !== a.nodeType) return a;
            if (a.classList) return a.classList.contains(b) || a.classList.add(b), a;
            if (b && "string" === typeof b) {
                var c = (b || "").split(/\s+/);
                if (1 === a.nodeType)
                    if (a.className) {
                        for (var d = " " + a.className + " ", e = a.className,
                                f = 0, h = c.length; f < h; f++) 0 > d.indexOf(" " + c[f] + " ") && (e += " " + c[f]);
                        a.className = e.replace(/^\s+|\s+$/g, "")
                    } else a.className = b
            }
            return a
        },
        da = function(a, b) {
            if (!a || 1 !== a.nodeType) return a;
            if (a.classList) return a.classList.contains(b) && a.classList.remove(b), a;
            if ("string" === typeof b && b) {
                var c = b.split(/\s+/);
                if (1 === a.nodeType && a.className) {
                    for (var d = (" " + a.className + " ").replace(/[\n\t]/g, " "), e = 0, f = c.length; e < f; e++) d = d.replace(" " + c[e] + " ", " ");
                    a.className = d.replace(/^\s+|\s+$/g, "")
                }
            }
            return a
        },
        ia = function(a) {
            var b = {
                left: 0,
                top: 0,
                width: 0,
                height: 0
            };
            if (a.getBoundingClientRect) {
                a = a.getBoundingClientRect();
                var d, f;
                "pageXOffset" in c && "pageYOffset" in c ? (d = c.pageXOffset, f = c.pageYOffset) : (d = 1, "function" === typeof e.body.getBoundingClientRect && (d = e.body.getBoundingClientRect(), d = d.right - d.left, f = e.body.offsetWidth, d = q(d / f * 100) / 100), f = d, d = q(e.documentElement.scrollLeft / f), f = q(e.documentElement.scrollTop / f));
                var h = e.documentElement.clientTop || 0;
                b.left = a.left + d - (e.documentElement.clientLeft || 0);
                b.top = a.top + f - h;
                b.width = "width" in
                    a ? a.width : a.right - a.left;
                b.height = "height" in a ? a.height : a.bottom - a.top
            }
            return b
        },
        qa = function(a) {
            if (/^(?:auto|inherit)$/.test(a)) return a;
            var b;
            "number" !== typeof a || m(a) ? "string" === typeof a && (b = qa(n(a, 10))) : b = a;
            return "number" === typeof b ? b : "auto"
        };
    (function(a) {
        function c(a) {
            a = a.match(/[\d]+/g);
            a.length = 3;
            return a.join(".")
        }

        function d(a) {
            a && (f = !0, a.version && (k = c(a.version)), !k && a.description && (k = c(a.description)), a.filename && (a = a.filename, g = !!a && (a = a.toLowerCase()) && (/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(a) ||
                "chrome.plugin" === a.slice(-13))))
        }
        var e, f = !1,
            h = !1,
            g = !1,
            k = "";
        if (b.plugins && b.plugins.length) a = b.plugins["Shockwave Flash"], d(a), b.plugins["Shockwave Flash 2.0"] && (f = !0, k = "2.0.0.11");
        else if (b.mimeTypes && b.mimeTypes.length) a = (a = b.mimeTypes["application/x-shockwave-flash"]) && a.enabledPlugin, d(a);
        else if ("undefined" !== typeof a) {
            h = !0;
            try {
                e = new a("ShockwaveFlash.ShockwaveFlash.7"), f = !0, k = c(e.GetVariable("$version"))
            } catch (n) {
                try {
                    e = new a("ShockwaveFlash.ShockwaveFlash.6"), f = !0, k = "6.0.21"
                } catch (w) {
                    try {
                        e =
                            new a("ShockwaveFlash.ShockwaveFlash"), f = !0, k = c(e.GetVariable("$version"))
                    } catch (m) {
                        h = !1
                    }
                }
            }
        }
        G.disabled = !0 !== f;
        G.outdated = k && p(k) < p("11.0.0");
        G.version = k || "0.0.0";
        G.pluginType = g ? "pepper" : h ? "activex" : f ? "netscape" : "unknown"
    })(f);
    var z = function() {
        if (!(this instanceof z)) return new z;
        "function" === typeof z._createClient && z._createClient.apply(this, A(arguments))
    };
    B(z, "version", {
        value: "2.1.6",
        writable: !1,
        configurable: !0,
        enumerable: !0
    });
    z.config = function() {
        return ja.apply(this, A(arguments))
    };
    z.state = function() {
        return ca.apply(this,
            A(arguments))
    };
    z.isFlashUnusable = function() {
        return aa.apply(this, A(arguments))
    };
    z.on = function() {
        return s.apply(this, A(arguments))
    };
    z.off = function() {
        return T.apply(this, A(arguments))
    };
    z.handlers = function() {
        return S.apply(this, A(arguments))
    };
    z.emit = function() {
        return ya.apply(this, A(arguments))
    };
    z.create = function() {
        return ka.apply(this, A(arguments))
    };
    z.destroy = function() {
        return w.apply(this, A(arguments))
    };
    z.setData = function() {
        return M.apply(this, A(arguments))
    };
    z.clearData = function() {
        return za.apply(this,
            A(arguments))
    };
    z.getData = function() {
        return ra.apply(this, A(arguments))
    };
    z.focus = z.activate = function() {
        return sa.apply(this, A(arguments))
    };
    z.blur = z.deactivate = function() {
        return Ja.apply(this, A(arguments))
    };
    z.activeElement = function() {
        return W.apply(this, A(arguments))
    };
    var ma = 0,
        H = {},
        na = 0,
        L = {},
        oa = {};
    y(J, {
        autoActivate: !0
    });
    var V = function(a) {
            var b = this;
            b.id = "" + ma++;
            H[b.id] = {
                instance: b,
                elements: [],
                handlers: {}
            };
            a && b.clip(a);
            z.on("*", function(a) {
                return b.emit(a)
            });
            z.on("destroy", function() {
                b.destroy()
            });
            z.create()
        },
        Da = function(a, b) {
            var c, d, e, f = {},
                h = H[this.id] && H[this.id].handlers;
            if ("string" === typeof a && a) e = a.toLowerCase().split(/\s+/);
            else if ("object" === typeof a && a && "undefined" === typeof b)
                for (c in a)
                    if (v.call(a, c) && "string" === typeof c && c && "function" === typeof a[c]) this.on(c, a[c]);
            if (e && e.length) {
                c = 0;
                for (d = e.length; c < d; c++) a = e[c].replace(/^on/, ""), f[a] = !0, h[a] || (h[a] = []), h[a].push(b);
                f.ready && G.ready && this.emit({
                    type: "ready",
                    client: this
                });
                if (f.error)
                    for (e = ["disabled", "outdated", "unavailable", "deactivated", "overdue"],
                        c = 0, d = e.length; c < d; c++)
                        if (G[e[c]]) {
                            this.emit({
                                type: "error",
                                name: "flash-" + e[c],
                                client: this
                            });
                            break
                        }
            }
            return this
        },
        O = function(a, b) {
            var c, d, e, f, h, g = H[this.id] && H[this.id].handlers;
            if (0 === arguments.length) f = x(g);
            else if ("string" === typeof a && a) f = a.split(/\s+/);
            else if ("object" === typeof a && a && "undefined" === typeof b)
                for (c in a) v.call(a, c) && "string" === typeof c && c && "function" === typeof a[c] && this.off(c, a[c]);
            if (f && f.length)
                for (c = 0, d = f.length; c < d; c++)
                    if (a = f[c].toLowerCase().replace(/^on/, ""), (h = g[a]) && h.length)
                        if (b)
                            for (e =
                                h.indexOf(b); - 1 !== e;) h.splice(e, 1), e = h.indexOf(b, e);
                        else h.length = 0;
            return this
        },
        Ia = function(a) {
            var b = null,
                c = H[this.id] && H[this.id].handlers;
            c && (b = "string" === typeof a && a ? c[a] ? c[a].slice(0) : [] : E(c));
            return b
        },
        Aa = function(a) {
            var b;
            var d = a;
            if (!d || !d.type || d.client && d.client !== this) b = !1;
            else {
                var e = H[this.id] && H[this.id].elements,
                    f = !!e && 0 < e.length;
                b = !d.target || f && -1 !== e.indexOf(d.target);
                e = d.relatedTarget && f && -1 !== e.indexOf(d.relatedTarget);
                d = d.client && d.client === this;
                b = b || e || d ? !0 : !1
            }
            if (b && ("object" ===
                    typeof a && a && "string" === typeof a.type && a.type && (a = y({}, a)), a = y({}, Ka(a), {
                        client: this
                    }), "object" === typeof a && a && a.type && (b = va(a), (d = (H[this.id] && H[this.id].handlers["*"] || []).concat(H[this.id] && H[this.id].handlers[a.type] || [])) && d.length)))
                for (var h, g, k, e = 0, f = d.length; e < f; e++) h = d[e], g = this, "string" === typeof h && "function" === typeof c[h] && (h = c[h]), "object" === typeof h && h && "function" === typeof h.handleEvent && (g = h, h = h.handleEvent), "function" === typeof h && (k = y({}, a), xa(h, g, [k], b));
            return this
        },
        ta = function(a) {
            a =
                pa(a);
            for (var b = 0; b < a.length; b++)
                if (v.call(a, b) && a[b] && 1 === a[b].nodeType) {
                    a[b].zcClippingId ? -1 === L[a[b].zcClippingId].indexOf(this.id) && L[a[b].zcClippingId].push(this.id) : (a[b].zcClippingId = "zcClippingId_" + na++, L[a[b].zcClippingId] = [this.id], !0 === J.autoActivate && ua(a[b]));
                    var c = H[this.id] && H[this.id].elements; - 1 === c.indexOf(a[b]) && c.push(a[b])
                }
            return this
        },
        wa = function(a) {
            var b = H[this.id];
            if (!b) return this;
            var b = b.elements,
                c;
            a = "undefined" === typeof a ? b.slice(0) : pa(a);
            for (var d = a.length; d--;)
                if (v.call(a,
                        d) && a[d] && 1 === a[d].nodeType) {
                    for (c = 0; - 1 !== (c = b.indexOf(a[d], c));) b.splice(c, 1);
                    var e = L[a[d].zcClippingId];
                    if (e) {
                        for (c = 0; - 1 !== (c = e.indexOf(this.id, c));) e.splice(c, 1);
                        if (0 === e.length) {
                            if (!0 === J.autoActivate && (c = a[d]) && 1 === c.nodeType && (e = oa[c.zcClippingId], "object" === typeof e && e)) {
                                for (var f = void 0, h = void 0, g = ["move", "leave", "enter", "out", "over"], k = 0, n = g.length; k < n; k++) f = "mouse" + g[k], h = e[f], "function" === typeof h && c.removeEventListener(f, h, !1);
                                delete oa[c.zcClippingId]
                            }
                            delete a[d].zcClippingId
                        }
                    }
                }
            return this
        },
        ga = function() {
            var a = H[this.id];
            return a && a.elements ? a.elements.slice(0) : []
        },
        Ea = function() {
            this.unclip();
            this.off();
            delete H[this.id]
        },
        pa = function(a) {
            "string" === typeof a && (a = []);
            return "number" !== typeof a.length ? [a] : a
        },
        ua = function(a) {
            if (a && 1 === a.nodeType) {
                var b = function(a) {
                        if (a || (a = c.event)) "js" !== a._source && (a.stopImmediatePropagation(), a.preventDefault()), delete a._source
                    },
                    d = function(d) {
                        if (d || (d = c.event)) b(d), z.focus(a)
                    };
                a.addEventListener("mouseover", d, !1);
                a.addEventListener("mouseout", b, !1);
                a.addEventListener("mouseenter",
                    b, !1);
                a.addEventListener("mouseleave", b, !1);
                a.addEventListener("mousemove", b, !1);
                oa[a.zcClippingId] = {
                    mouseover: d,
                    mouseout: b,
                    mouseenter: b,
                    mouseleave: b,
                    mousemove: b
                }
            }
        };
    z._createClient = function() {
        V.apply(this, A(arguments))
    };
    z.prototype.on = function() {
        return Da.apply(this, A(arguments))
    };
    z.prototype.off = function() {
        return O.apply(this, A(arguments))
    };
    z.prototype.handlers = function() {
        return Ia.apply(this, A(arguments))
    };
    z.prototype.emit = function() {
        return Aa.apply(this, A(arguments))
    };
    z.prototype.clip = function() {
        return ta.apply(this,
            A(arguments))
    };
    z.prototype.unclip = function() {
        return wa.apply(this, A(arguments))
    };
    z.prototype.elements = function() {
        return ga.apply(this, A(arguments))
    };
    z.prototype.destroy = function() {
        return Ea.apply(this, A(arguments))
    };
    z.prototype.setText = function(a) {
        z.setData("text/plain", a);
        return this
    };
    z.prototype.setHtml = function(a) {
        z.setData("text/html", a);
        return this
    };
    z.prototype.setRichText = function(a) {
        z.setData("application/rtf", a);
        return this
    };
    z.prototype.setData = function() {
        z.setData.apply(this, A(arguments));
        return this
    };
    z.prototype.clearData = function() {
        z.clearData.apply(this, A(arguments));
        return this
    };
    z.prototype.getData = function() {
        return z.getData.apply(this, A(arguments))
    };
    "function" === typeof define && define.amd ? define(function() {
        return z
    }) : "object" === typeof module && module && "object" === typeof module.exports && module.exports ? module.exports = z : c.ZeroClipboard = z
})(function() {
    return this || window
}());
(function(c) {
    var g = function(c, b) {
        this.init("simplecolorpicker", c, b)
    };
    g.prototype = {
        constructor: g,
        init: function(e, b, d) {
            var a = this;
            a.type = e;
            a.$select = c(b);
            a.custom_color_option = c("<option/>").appendTo(a.$select).val("transparent");
            var f = a.$select.val();
            a.options = c.extend({}, c.fn.simplecolorpicker.defaults, d);
            a.$select.hide();
            e = "&nbsp;&nbsp;&nbsp;&nbsp;";
            e = '<i class="picker-face-button ' + (a.options.faceIcon || "icon-large icon-font") + '"></i>';
            a.$colorList = null;
            a.options.picker ? (a.$icon = c('<span class="btn simplecolorpicker picker-face" title="' +
                a.options.faceTitle + '" role="button" tabindex="0">' + e + "</span>").insertAfter(a.$select), a.$icon.on("click." + a.type, c.proxy(a.showPicker, a)), a.$picker = c('<span class="simplecolorpicker picker"></span>').appendTo(document.body), a.$colorList = a.$picker, c(document).on("mouseup." + a.type, c.proxy(a.hidePicker, a)), a.$picker.on("mousedown." + a.type, c.proxy(a.mousedown, a))) : (a.$inline = c('<span class="simplecolorpicker inline"></span>').insertAfter(a.$select), a.$colorList = a.$inline);
            var g = "";
            c("option", a.$select).each(function() {
                var a =
                    c(this),
                    b = a.val(),
                    d = a.text(),
                    e = "color-palette-item";
                if (!0 === a.prop("selected") || f === b) e += " selected";
                "transparent" != b && (g += '<span class="' + e + '" title="' + d + '" style="background-color: ' + b + ';" data-color="' + b + '" role="button" tabindex="0">&nbsp;</span>')
            });
            g = '<span class="color-palette-item" title="Default color" data-color="transparent" role="button"><i class="icon-ban-circle"></i></span>' + g;
            a.$colorList.html(g);
            e = c('<input type="text" value="#ff00ff"></input>').css("width", "60px");
            e.appendTo(a.$colorList);
            a.color_preview = c("<span/>").addClass("color-preview").appendTo(a.$colorList);
            e.colorpicker({}).on("changeColor", function(b) {
                b = b.color.toHex();
                a.color_preview.data("color", b).css("background-color", b);
                a.custom_color_option.val(b)
            });
            a.color_input = e;
            a.is_picker_shown = !1;
            a.color_input_active = !1;
            a.custom_color_option.val("#ffffff");
            a.color_input.blur(function() {
                a.color_input_active = !1
            });
            a.$colorList.on("click." + a.type, c.proxy(a.click, a))
        },
        selectColor: function(e) {
            var b = this.$colorList.find("span").filter(function() {
                var b =
                    c(this).data("color");
                return b && b.toLowerCase() === e.toLowerCase()
            });
            0 < b.length && this.selectColorSpan(b);
            this.color_preview.data("color", e).css("background-color", e);
            this.custom_color_option.val(e);
            this.color_input.colorpicker("setValue", e)
        },
        showPicker: function() {
            var c = this.$icon.offset();
            this.$picker.css({
                left: c.left + this.$icon.width() / 2 - 16,
                top: c.top + this.$icon.outerHeight()
            });
            this.$picker.show(this.options.delay)
        },
        hidePicker: function() {
            this.color_input_active || this.$picker.hide(this.options.delay)
        },
        selectColorSpan: function(c) {
            var b = c.data("color");
            c.siblings().removeClass("selected");
            c.addClass("selected");
            this.options.picker && this.hidePicker();
            this.$select.val(b)
        },
        click: function(e) {
            e = c(e.target);
            if (1 === e.length && "input" !== e[0].nodeName.toLowerCase()) {
                for (; e && "span" !== e[0].nodeName.toLowerCase();) e = c(e).parent();
                "span" === e[0].nodeName.toLowerCase() && (this.selectColorSpan(e), this.$select.trigger("change"))
            }
        },
        mousedown: function(e) {
            var b = c(e.target);
            1 === b.length && "input" === b[0].nodeName.toLowerCase() ?
                this.color_input_active = !0 : (this.color_input_active = !1, e.stopPropagation(), e.preventDefault())
        },
        destroy: function() {
            this.options.picker && (this.$icon.off("." + this.type), this.$icon.remove(), c(document).off("." + this.type));
            this.$colorList.off("." + this.type);
            this.$colorList.remove();
            this.$select.removeData(this.type);
            this.$select.show()
        }
    };
    c.fn.simplecolorpicker = function(e) {
        var b = c.makeArray(arguments);
        b.shift();
        return this.each(function() {
            var d = c(this),
                a = d.data("simplecolorpicker"),
                f = "object" === typeof e &&
                e;
            void 0 === a && d.data("simplecolorpicker", a = new g(this, f));
            "string" === typeof e && a[e].apply(a, b)
        })
    };
    c.fn.simplecolorpicker.defaults = {
        delay: 0,
        picker: !1
    }
})(jQuery);
(function(c, g, e) {
    function b(a, b, c, d) {
        for (var e = [], f = 0; f < a.length; f++) {
            var g = a[f];
            if (g) {
                var k = tinycolor(g),
                    n = .5 > k.toHsl().l ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light",
                    n = n + (tinycolor.equals(b, g) ? " sp-thumb-active" : ""),
                    g = k.toString(d || "rgb"),
                    m = v ? "background-color:" + k.toRgbString() : "filter:" + k.toFilter();
                e.push('<span title="' + g + '" data-color="' + k.toRgbString() + '" class="' + n + '"><span class="sp-thumb-inner" style="' + m + ';" /></span>')
            } else e.push('<span title="No Color Selected" data-color="" style="background-color:transparent;" class="sp-clear-display"></span>')
        }
        return "<div class='sp-cf " +
            c + "'>" + e.join("") + "</div>"
    }

    function d(a, b) {
        var c = g.extend({}, t, a);
        c.callbacks = {
            move: p(c.move, b),
            change: p(c.change, b),
            show: p(c.show, b),
            hide: p(c.hide, b),
            beforeShow: p(c.beforeShow, b)
        };
        return c
    }

    function a(a, k) {
        function p() {
            w.showPaletteOnly && (w.showPalette = !0);
            if (w.palette) {
                qa = w.palette.slice(0);
                z = g.isArray(qa[0]) ? qa : [qa];
                ma = {};
                for (var a = 0; a < z.length; a++)
                    for (var b = 0; b < z[a].length; b++) {
                        var c = tinycolor(z[a][b]).toRgbString();
                        ma[c] = !0
                    }
            }
            O.toggleClass("sp-flat", M);
            O.toggleClass("sp-input-disabled", !w.showInput);
            O.toggleClass("sp-alpha-enabled", w.showAlpha);
            O.toggleClass("sp-clear-enabled", Ua);
            O.toggleClass("sp-buttons-disabled", !w.showButtons);
            O.toggleClass("sp-palette-disabled", !w.showPalette);
            O.toggleClass("sp-palette-only", w.showPaletteOnly);
            O.toggleClass("sp-initial-disabled", !w.showInitial);
            O.addClass(w.className).addClass(w.containerClassName);
            ya()
        }

        function t() {
            if (ra && c.localStorage) {
                try {
                    var a = c.localStorage[ra].split(",#");
                    1 < a.length && (delete c.localStorage[ra], g.each(a, function(a, b) {
                        I(b)
                    }))
                } catch (b) {}
                try {
                    H =
                        c.localStorage[ra].split(";")
                } catch (d) {}
            }
        }

        function I(a) {
            if (za) {
                a = tinycolor(a).toRgbString();
                if (!ma[a] && -1 === g.inArray(a, H))
                    for (H.push(a); H.length > na;) H.shift();
                if (ra && c.localStorage) try {
                    c.localStorage[ra] = H.join(";")
                } catch (b) {}
            }
        }

        function Z() {
            var a = [];
            if (w.showPalette)
                for (i = 0; i < H.length; i++) {
                    var b = tinycolor(H[i]).toRgbString();
                    ma[b] || a.push(H[i])
                }
            return a.reverse().slice(0, w.maxSelectionSize)
        }

        function G() {
            var a = ca(),
                c = g.map(z, function(c, d) {
                    return b(c, a, "sp-palette-row sp-palette-row-" + d, w.preferredFormat)
                });
            t();
            H && c.push(b(Z(), a, "sp-palette-row sp-palette-row-selection", w.preferredFormat));
            D.html(c.join(""))
        }

        function P() {
            if (w.showInitial) {
                var a = Sa,
                    c = ca();
                r.html(b([a, c], c, "sp-palette-row-initial", w.preferredFormat))
            }
        }

        function U() {
            (0 >= xa || 0 >= va || 0 >= F) && ya();
            O.addClass("sp-dragging");
            L = null;
            V.trigger("dragstart.spectrum", [ca()])
        }

        function Ba() {
            O.removeClass("sp-dragging");
            V.trigger("dragstop.spectrum", [ca()])
        }

        function R() {
            var a = ua.val();
            null !== a && "" !== a || !Ua ? (a = tinycolor(a), a.ok ? (ja(a), S(!0)) : ua.addClass("sp-validation-error")) :
                (ja(null), S(!0))
        }

        function la() {
            Ka ? J() : Ha()
        }

        function Ha() {
            var a = g.Event("beforeShow.spectrum");
            if (Ka) ya();
            else if (V.trigger(a, [ca()]), !1 !== Ja.beforeShow(ca()) && !a.isDefaultPrevented()) {
                for (a = 0; a < x.length; a++) x[a] && x[a].hide();
                Ka = !0;
                g(oa).bind("click.spectrum", J);
                g(c).bind("resize.spectrum", W);
                Na.addClass("sp-active");
                O.removeClass("sp-hidden");
                ya();
                s();
                Sa = ca();
                P();
                Ja.show(Sa);
                V.trigger("show.spectrum", [Sa])
            }
        }

        function J(a) {
            a && "click" == a.type && 2 == a.button || !Ka || M || (Ka = !1, g(oa).unbind("click.spectrum",
                J), g(c).unbind("resize.spectrum", W), Na.removeClass("sp-active"), O.addClass("sp-hidden"), tinycolor.equals(ca(), Sa) || (eb && "cancel" !== a ? S(!0) : ja(Sa, !0)), Ja.hide(ca()), V.trigger("hide.spectrum", [ca()]))
        }

        function ja(a, b) {
            tinycolor.equals(a, ca());
            var c, d;
            !a && Ua ? Ta = !0 : (Ta = !1, c = tinycolor(a), d = c.toHsv(), Ma = d.h % 360 / 360, ha = d.s, da = d.v, ia = d.a);
            s();
            c && c.ok && !b && (Za = ib || c.format)
        }

        function ca(a) {
            a = a || {};
            return Ua && Ta ? null : tinycolor.fromRatio({
                h: Ma,
                s: ha,
                v: da,
                a: Math.round(100 * ia) / 100
            }, {
                format: a.format || Za
            })
        }

        function aa() {
            s();
            Ja.move(ca());
            V.trigger("move.spectrum", [ca()])
        }

        function s() {
            ua.removeClass("sp-validation-error");
            T();
            var a = tinycolor.fromRatio({
                h: Ma,
                s: 1,
                v: 1
            });
            Ia.css("background-color", a.toHexString());
            a = Za;
            !(1 > ia) || 0 === ia && "name" === a || "hex" !== a && "hex3" !== a && "hex6" !== a && "name" !== a || (a = "rgb");
            var b = ca({
                    format: a
                }),
                c = "";
            fa.removeClass("sp-clear-display");
            fa.css("background-color", "transparent");
            if (!b && Ua) fa.addClass("sp-clear-display");
            else {
                var c = b.toHexString(),
                    d = b.toRgbString();
                v || 1 === b.alpha ? fa.css("background-color",
                    d) : (fa.css("background-color", "transparent"), fa.css("filter", b.toFilter()));
                if (w.showAlpha) {
                    d = b.toRgb();
                    d.a = 0;
                    var d = tinycolor(d).toRgbString(),
                        e = "linear-gradient(left, " + d + ", " + c + ")";
                    B ? ga.css("filter", tinycolor(d).toFilter({
                        gradientType: 1
                    }, c)) : (ga.css("background", "-webkit-" + e), ga.css("background", "-moz-" + e), ga.css("background", "-ms-" + e), ga.css("background", "linear-gradient(to right, " + d + ", " + c + ")"))
                }
                c = b.toString(a)
            }
            w.showInput && ua.val(c);
            w.showPalette && G();
            P()
        }

        function T() {
            var a = ha,
                b = da;
            Ua && Ta ? (pa.hide(),
                wa.hide(), Aa.hide()) : (pa.show(), wa.show(), Aa.show(), a *= va, b = xa - b * xa, a = Math.max(-Q, Math.min(va - Q, a - Q)), b = Math.max(-Q, Math.min(xa - Q, b - Q)), Aa.css({
                top: b + "px",
                left: a + "px"
            }), pa.css({
                left: ia * h - db / 2 + "px"
            }), wa.css({
                top: Ma * F - La + "px"
            }))
        }

        function S(a) {
            var b = ca(),
                c = "";
            b && (c = b.toString(Za), I(b));
            Pa && V.val(c);
            Sa = b;
            a && (Ja.change(b), V.trigger("change", [b]))
        }

        function ya() {
            va = Ia.width();
            xa = Ia.height();
            Q = Aa.height();
            ta.width();
            F = ta.height();
            La = wa.height();
            h = Ea.width();
            db = pa.width();
            M || (O.css("position", "absolute"),
                O.offset(f(O, ba)));
            T();
            w.showPalette && G();
            V.trigger("reflow.spectrum")
        }

        function ka() {
            J();
            Da = !0;
            V.attr("disabled", !0);
            ba.addClass("sp-disabled")
        }
        var w = d(k, a),
            M = w.flat,
            za = w.showSelectionPalette,
            ra = w.localStorageKey,
            sa = w.theme,
            Ja = w.callbacks,
            W = q(ya, 10),
            Ka = !1,
            va = 0,
            xa = 0,
            Q = 0,
            F = 0,
            h = 0,
            db = 0,
            La = 0,
            Ma = 0,
            ha = 0,
            da = 0,
            ia = 1,
            qa = [],
            z = [],
            ma = {},
            H = w.selectionPalette.slice(0),
            na = w.maxSelectionSize,
            L = null,
            oa = a.ownerDocument,
            V = g(a),
            Da = !1,
            O = g(K, oa).addClass(sa),
            Ia = O.find(".sp-color"),
            Aa = O.find(".sp-dragger"),
            ta = O.find(".sp-hue"),
            wa = O.find(".sp-slider"),
            ga = O.find(".sp-alpha-inner"),
            Ea = O.find(".sp-alpha"),
            pa = O.find(".sp-alpha-handle"),
            ua = O.find(".sp-input"),
            D = O.find(".sp-palette"),
            r = O.find(".sp-initial"),
            u = O.find(".sp-cancel"),
            ea = O.find(".sp-clear"),
            Oa = O.find(".sp-choose"),
            Pa = V.is("input"),
            Qa = Pa && C && "color" === V.attr("type"),
            Fa = Pa && !M,
            Na = Fa ? g("<div class='sp-replacer'><div class='sp-preview'><div class='sp-preview-inner'></div></div><div class='sp-dd'>&#9660;</div></div>").addClass(sa).addClass(w.className).addClass(w.replacerClassName).attr(w.extraReplacerAttr) :
            g([]),
            ba = Fa ? Na : V,
            fa = Na.find(".sp-preview-inner"),
            Ra = w.color || Pa && V.val(),
            Sa = !1,
            ib = w.preferredFormat,
            Za = ib,
            eb = !w.showButtons || w.clickoutFiresChange,
            Ta = !Ra,
            Ua = w.allowEmpty && !Qa;
        (function() {
            function a(b) {
                b.data && b.data.ignore ? (ja(g(this).data("color")), aa()) : (ja(g(this).data("color")), aa(), S(!0), J());
                return !1
            }
            B && O.find("*:not(input)").attr("unselectable", "on");
            p();
            Fa && V.after(Na).hide();
            Ua || ea.hide();
            if (M) V.after(O).hide();
            else {
                var b = "parent" === w.appendTo ? V.parent() : g(w.appendTo);
                1 !== b.length && (b = g("body"));
                b.append(O)
            }
            t();
            ba.bind("click.spectrum touchstart.spectrum", function(a) {
                Da || la();
                a.stopPropagation();
                g(a.target).is("input") || a.preventDefault()
            });
            (V.is(":disabled") || !0 === w.disabled) && ka();
            O.click(n);
            ua.change(R);
            ua.bind("paste", function() {
                setTimeout(R, 1)
            });
            ua.keydown(function(a) {
                13 == a.keyCode && R()
            });
            u.text(w.cancelText);
            u.bind("click.spectrum", function(a) {
                a.stopPropagation();
                a.preventDefault();
                J("cancel")
            });
            ea.attr("title", w.clearText);
            ea.bind("click.spectrum", function(a) {
                a.stopPropagation();
                a.preventDefault();
                Ta = !0;
                aa();
                M && S(!0)
            });
            Oa.text(w.chooseText);
            Oa.bind("click.spectrum", function(a) {
                a.stopPropagation();
                a.preventDefault();
                ua.hasClass("sp-validation-error") || (S(!0), J())
            });
            m(Ea, function(a, b, c) {
                ia = a / h;
                Ta = !1;
                c.shiftKey && (ia = Math.round(10 * ia) / 10);
                aa()
            }, U, Ba);
            m(ta, function(a, b) {
                Ma = parseFloat(b / F);
                Ta = !1;
                w.showAlpha || (ia = 1);
                aa()
            }, U, Ba);
            m(Ia, function(a, b, c) {
                c.shiftKey ? L || (c = xa - da * xa, L = Math.abs(a - ha * va) > Math.abs(b - c) ? "x" : "y") : L = null;
                c = !L || "y" === L;
                L && "x" !== L || (ha = parseFloat(a / va));
                c && (da = parseFloat((xa - b) / xa));
                Ta = !1;
                w.showAlpha || (ia = 1);
                aa()
            }, U, Ba);
            Ra ? (ja(Ra), s(), Za = ib || tinycolor(Ra).format, I(Ra)) : s();
            M && Ha();
            b = B ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
            D.delegate(".sp-thumb-el", b, a);
            r.delegate(".sp-thumb-el:nth-child(1)", b, {
                ignore: !0
            }, a)
        })();
        var Ca = {
            show: Ha,
            hide: J,
            toggle: la,
            reflow: ya,
            option: function(a, b) {
                if (a === e) return g.extend({}, w);
                if (b === e) return w[a];
                w[a] = b;
                p()
            },
            enable: function() {
                Da = !1;
                V.attr("disabled", !1);
                ba.removeClass("sp-disabled")
            },
            disable: ka,
            set: function(a) {
                ja(a);
                S()
            },
            get: ca,
            destroy: function() {
                V.show();
                ba.unbind("click.spectrum touchstart.spectrum");
                O.remove();
                Na.remove();
                x[Ca.id] = null
            },
            container: O
        };
        Ca.id = x.push(Ca) - 1;
        return Ca
    }

    function f(a, b) {
        var c = a.outerWidth(),
            d = a.outerHeight(),
            e = b.outerHeight(),
            f = a[0].ownerDocument,
            k = f.documentElement,
            n = k.clientWidth + g(f).scrollLeft(),
            f = k.clientHeight + g(f).scrollTop(),
            k = b.offset();
        k.top += e;
        k.left -= Math.min(k.left, k.left + c > n && n > c ? Math.abs(k.left + c - n) : 0);
        k.top -= Math.min(k.top, k.top + d > f && f > d ? Math.abs(d + e - 0) : 0);
        return k
    }

    function k() {}

    function n(a) {
        a.stopPropagation()
    }

    function p(a, b) {
        var c = Array.prototype.slice,
            d = c.call(arguments, 2);
        return function() {
            return a.apply(b, d.concat(c.call(arguments)))
        }
    }

    function m(a, b, d, e) {
        function f(a) {
            a.stopPropagation && a.stopPropagation();
            a.preventDefault && a.preventDefault();
            a.returnValue = !1
        }

        function k(c) {
            if (p) {
                if (B && 9 > document.documentMode && !c.button) return n();
                var d = c.originalEvent.touches,
                    e = d ? d[0].pageY : c.pageY,
                    d = Math.max(0, Math.min((d ? d[0].pageX : c.pageX) - q.left, x)),
                    e = Math.max(0, Math.min(e - q.top,
                        t));
                v && f(c);
                b.apply(a, [d, e, c])
            }
        }

        function n() {
            p && (g(m).unbind(J), g(m.body).removeClass("sp-dragging"), e.apply(a, arguments));
            p = !1
        }
        b = b || function() {};
        d = d || function() {};
        e = e || function() {};
        var m = a.ownerDocument || document,
            p = !1,
            q = {},
            t = 0,
            x = 0,
            v = "ontouchstart" in c,
            J = {};
        J.selectstart = f;
        J.dragstart = f;
        J["touchmove mousemove"] = k;
        J["touchend mouseup"] = n;
        g(a).bind("touchstart mousedown", function(b) {
            (b.which ? 3 == b.which : 2 == b.button) || p || !1 === d.apply(a, arguments) || (p = !0, t = g(a).height(), x = g(a).width(), q = g(a).offset(),
                g(m).bind(J), g(m.body).addClass("sp-dragging"), v || k(b), f(b))
        })
    }

    function q(a, b, c) {
        var d;
        return function() {
            var e = this,
                f = arguments,
                g = function() {
                    d = null;
                    a.apply(e, f)
                };
            c && clearTimeout(d);
            if (c || !d) d = setTimeout(g, b)
        }
    }
    var t = {
            beforeShow: k,
            move: k,
            change: k,
            show: k,
            hide: k,
            color: !1,
            flat: !1,
            showInput: !1,
            allowEmpty: !1,
            showButtons: !0,
            clickoutFiresChange: !1,
            showInitial: !1,
            showPalette: !1,
            showPaletteOnly: !1,
            showSelectionPalette: !0,
            localStorageKey: !1,
            appendTo: "body",
            maxSelectionSize: 7,
            cancelText: "cancel",
            chooseText: "choose",
            clearText: "Clear Color Selection",
            preferredFormat: !1,
            className: "",
            containerClassName: "",
            replacerClassName: "",
            showAlpha: !1,
            theme: "sp-light",
            palette: ["#ffffff #000000 #ff0000 #ff8000 #ffff00 #008000 #0000ff #4b0082 #9400d3".split(" ")],
            selectionPalette: [],
            disabled: !1,
            extraReplacerAttr: {}
        },
        x = [],
        B = !!/msie/i.exec(c.navigator.userAgent),
        v = function() {
            var a = document.createElement("div").style;
            a.cssText = "background-color:rgba(0,0,0,.5)";
            return !!~("" + a.backgroundColor).indexOf("rgba") || !!~("" + a.backgroundColor).indexOf("hsla")
        }(),
        C = function() {
            var a = g("<input type='color' value='!' />")[0];
            return "color" === a.type && "!" !== a.value
        }(),
        K = function() {
            var a = "";
            if (B)
                for (var b = 1; 6 >= b; b++) a += "<div class='sp-" + b + "'></div>";
            return ["<div class='sp-container sp-hidden'><div class='sp-palette-container'><div class='sp-palette sp-thumb sp-cf'></div></div><div class='sp-picker-container'><div class='sp-top sp-cf'><div class='sp-fill'></div><div class='sp-top-inner'><div class='sp-color'><div class='sp-sat'><div class='sp-val'><div class='sp-dragger'></div></div></div></div><div class='sp-clear sp-clear-display'></div><div class='sp-hue'><div class='sp-slider'></div>",
                a, "</div></div><div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div></div><div class='sp-input-container sp-cf'><input class='sp-input' type='text' spellcheck='false'  /></div><div class='sp-initial sp-thumb sp-cf'></div><div class='sp-button-container sp-cf'><a class='sp-cancel' href='#'></a><button type='button' class='sp-choose'></button></div></div></div>"
            ].join("")
        }();
    g.fn.spectrum = function(b, c) {
        if ("string" == typeof b) {
            var d = this,
                e = Array.prototype.slice.call(arguments,
                    1);
            this.each(function() {
                var a = x[g(this).data("spectrum.id")];
                if (a) {
                    var c = a[b];
                    if (!c) throw Error("Spectrum: no such method: '" + b + "'");
                    "get" == b ? d = a.get() : "container" == b ? d = a.container : "option" == b ? d = a.option.apply(a, e) : "destroy" == b ? (a.destroy(), g(this).removeData("spectrum.id")) : c.apply(a, e)
                }
            });
            return d
        }
        return this.spectrum("destroy").each(function() {
            var c = g.extend({}, b, g(this).data()),
                c = a(this, c);
            g(this).data("spectrum.id", c.id)
        })
    };
    g.fn.spectrum.load = !0;
    g.fn.spectrum.loadOpts = {};
    g.fn.spectrum.draggable =
        m;
    g.fn.spectrum.defaults = t;
    g.spectrum = {};
    g.spectrum.localization = {};
    g.spectrum.palettes = {};
    g.fn.spectrum.processNativeColorInputs = function() {
        C || g("input[type=color]").spectrum({
            preferredFormat: "hex6"
        })
    };
    (function() {
        function a(c, e) {
            c = c ? c : "";
            e = e || {};
            if ("object" == typeof c && c.hasOwnProperty("_tc_id")) return c;
            var p = b(c),
                q = p.r,
                t = p.g,
                T = p.b,
                W = p.a,
                S = C(100 * W) / 100,
                s = e.format || p.format;
            1 > q && (q = C(q));
            1 > t && (t = C(t));
            1 > T && (T = C(T));
            return {
                ok: p.ok,
                format: s,
                _tc_id: v++,
                alpha: W,
                getAlpha: function() {
                    return W
                },
                setAlpha: function(a) {
                    W =
                        n(a);
                    S = C(100 * W) / 100
                },
                toHsv: function() {
                    var a = f(q, t, T);
                    return {
                        h: 360 * a.h,
                        s: a.s,
                        v: a.v,
                        a: W
                    }
                },
                toHsvString: function() {
                    var a = f(q, t, T),
                        b = C(360 * a.h),
                        c = C(100 * a.s),
                        a = C(100 * a.v);
                    return 1 == W ? "hsv(" + b + ", " + c + "%, " + a + "%)" : "hsva(" + b + ", " + c + "%, " + a + "%, " + S + ")"
                },
                toHsl: function() {
                    var a = d(q, t, T);
                    return {
                        h: 360 * a.h,
                        s: a.s,
                        l: a.l,
                        a: W
                    }
                },
                toHslString: function() {
                    var a = d(q, t, T),
                        b = C(360 * a.h),
                        c = C(100 * a.s),
                        a = C(100 * a.l);
                    return 1 == W ? "hsl(" + b + ", " + c + "%, " + a + "%)" : "hsla(" + b + ", " + c + "%, " + a + "%, " + S + ")"
                },
                toHex: function(a) {
                    return g(q, t, T, a)
                },
                toHexString: function(a) {
                    return "#" + this.toHex(a)
                },
                toHex8: function() {
                    return k(q, t, T, W)
                },
                toHex8String: function() {
                    return "#" + this.toHex8()
                },
                toRgb: function() {
                    return {
                        r: C(q),
                        g: C(t),
                        b: C(T),
                        a: W
                    }
                },
                toRgbString: function() {
                    return 1 == W ? "rgb(" + C(q) + ", " + C(t) + ", " + C(T) + ")" : "rgba(" + C(q) + ", " + C(t) + ", " + C(T) + ", " + S + ")"
                },
                toPercentageRgb: function() {
                    return {
                        r: C(100 * m(q, 255)) + "%",
                        g: C(100 * m(t, 255)) + "%",
                        b: C(100 * m(T, 255)) + "%",
                        a: W
                    }
                },
                toPercentageRgbString: function() {
                    return 1 == W ? "rgb(" + C(100 * m(q, 255)) + "%, " + C(100 * m(t, 255)) + "%, " +
                        C(100 * m(T, 255)) + "%)" : "rgba(" + C(100 * m(q, 255)) + "%, " + C(100 * m(t, 255)) + "%, " + C(100 * m(T, 255)) + "%, " + S + ")"
                },
                toName: function() {
                    return 0 === W ? "transparent" : ya[g(q, t, T, !0)] || !1
                },
                toFilter: function(b) {
                    var c = "#" + k(q, t, T, W),
                        d = c,
                        f = e && e.gradientType ? "GradientType = 1, " : "";
                    b && (d = a(b).toHex8String());
                    return "progid:DXImageTransform.Microsoft.gradient(" + f + "startColorstr=" + c + ",endColorstr=" + d + ")"
                },
                toString: function(a) {
                    var b = !!a;
                    a = a || this.format;
                    var c = !1,
                        b = !b && 1 > W && 0 < W && ("hex" === a || "hex6" === a || "hex3" === a || "name" === a);
                    "rgb" === a && (c = this.toRgbString());
                    "prgb" === a && (c = this.toPercentageRgbString());
                    if ("hex" === a || "hex6" === a) c = this.toHexString();
                    "hex3" === a && (c = this.toHexString(!0));
                    "hex8" === a && (c = this.toHex8String());
                    "name" === a && (c = this.toName());
                    "hsl" === a && (c = this.toHslString());
                    "hsv" === a && (c = this.toHsvString());
                    return b ? this.toRgbString() : c || this.toHexString()
                }
            }
        }

        function b(a) {
            var c = {
                    r: 0,
                    g: 0,
                    b: 0
                },
                d = 1,
                f = !1,
                g = !1;
            if ("string" == typeof a) a: {
                a = a.replace(t, "").replace(x, "").toLowerCase();
                var k = !1;
                if (S[a]) a = S[a], k = !0;
                else if ("transparent" ==
                    a) {
                    a = {
                        r: 0,
                        g: 0,
                        b: 0,
                        a: 0,
                        format: "name"
                    };
                    break a
                }
                var p;
                a = (p = ka.rgb.exec(a)) ? {
                    r: p[1],
                    g: p[2],
                    b: p[3]
                } : (p = ka.rgba.exec(a)) ? {
                    r: p[1],
                    g: p[2],
                    b: p[3],
                    a: p[4]
                } : (p = ka.hsl.exec(a)) ? {
                    h: p[1],
                    s: p[2],
                    l: p[3]
                } : (p = ka.hsla.exec(a)) ? {
                    h: p[1],
                    s: p[2],
                    l: p[3],
                    a: p[4]
                } : (p = ka.hsv.exec(a)) ? {
                    h: p[1],
                    s: p[2],
                    v: p[3]
                } : (p = ka.hex8.exec(a)) ? {
                    a: parseInt(p[1], 16) / 255,
                    r: parseInt(p[2], 16),
                    g: parseInt(p[3], 16),
                    b: parseInt(p[4], 16),
                    format: k ? "name" : "hex8"
                } : (p = ka.hex6.exec(a)) ? {
                    r: parseInt(p[1], 16),
                    g: parseInt(p[2], 16),
                    b: parseInt(p[3], 16),
                    format: k ? "name" : "hex"
                } : (p = ka.hex3.exec(a)) ? {
                    r: parseInt(p[1] + "" + p[1], 16),
                    g: parseInt(p[2] + "" + p[2], 16),
                    b: parseInt(p[3] + "" + p[3], 16),
                    format: k ? "name" : "hex"
                } : !1
            }
            if ("object" == typeof a) {
                if (a.hasOwnProperty("r") && a.hasOwnProperty("g") && a.hasOwnProperty("b")) c = a.g, f = a.b, c = {
                    r: 255 * m(a.r, 255),
                    g: 255 * m(c, 255),
                    b: 255 * m(f, 255)
                }, f = !0, g = "%" === String(a.r).substr(-1) ? "prgb" : "rgb";
                else if (a.hasOwnProperty("h") && a.hasOwnProperty("s") && a.hasOwnProperty("v")) {
                    a.s = q(a.s);
                    a.v = q(a.v);
                    var g = a.h,
                        k = a.s,
                        c = a.v,
                        g = 6 * m(g, 360),
                        k = m(k, 100),
                        c = m(c, 100),
                        f =
                        B.floor(g),
                        T = g - f,
                        g = c * (1 - k);
                    p = c * (1 - T * k);
                    k = c * (1 - (1 - T) * k);
                    f %= 6;
                    c = {
                        r: 255 * [c, p, g, g, k, c][f],
                        g: 255 * [k, c, c, p, g, g][f],
                        b: 255 * [g, g, k, c, c, p][f]
                    };
                    f = !0;
                    g = "hsv"
                } else a.hasOwnProperty("h") && a.hasOwnProperty("s") && a.hasOwnProperty("l") && (a.s = q(a.s), a.l = q(a.l), c = e(a.h, a.s, a.l), f = !0, g = "hsl");
                a.hasOwnProperty("a") && (d = a.a)
            }
            d = n(d);
            return {
                ok: f,
                format: a.format || g,
                r: K(255, s(c.r, 0)),
                g: K(255, s(c.g, 0)),
                b: K(255, s(c.b, 0)),
                a: d
            }
        }

        function d(a, b, c) {
            a = m(a, 255);
            b = m(b, 255);
            c = m(c, 255);
            var e = s(a, b, c),
                f = K(a, b, c),
                g, k = (e + f) / 2;
            if (e == f) g =
                f = 0;
            else {
                var n = e - f,
                    f = .5 < k ? n / (2 - e - f) : n / (e + f);
                switch (e) {
                    case a:
                        g = (b - c) / n + (b < c ? 6 : 0);
                        break;
                    case b:
                        g = (c - a) / n + 2;
                        break;
                    case c:
                        g = (a - b) / n + 4
                }
                g /= 6
            }
            return {
                h: g,
                s: f,
                l: k
            }
        }

        function e(a, b, c) {
            function d(a, b, c) {
                0 > c && (c += 1);
                1 < c && (c -= 1);
                return c < 1 / 6 ? a + 6 * (b - a) * c : .5 > c ? b : c < 2 / 3 ? a + (b - a) * (2 / 3 - c) * 6 : a
            }
            a = m(a, 360);
            b = m(b, 100);
            c = m(c, 100);
            if (0 === b) c = b = a = c;
            else {
                var f = .5 > c ? c * (1 + b) : c + b - c * b,
                    g = 2 * c - f;
                c = d(g, f, a + 1 / 3);
                b = d(g, f, a);
                a = d(g, f, a - 1 / 3)
            }
            return {
                r: 255 * c,
                g: 255 * b,
                b: 255 * a
            }
        }

        function f(a, b, c) {
            a = m(a, 255);
            b = m(b, 255);
            c = m(c, 255);
            var d = s(a, b, c),
                e = K(a, b, c),
                g, k = d - e;
            if (d == e) g = 0;
            else {
                switch (d) {
                    case a:
                        g = (b - c) / k + (b < c ? 6 : 0);
                        break;
                    case b:
                        g = (c - a) / k + 2;
                        break;
                    case c:
                        g = (a - b) / k + 4
                }
                g /= 6
            }
            return {
                h: g,
                s: 0 === d ? 0 : k / d,
                v: d
            }
        }

        function g(a, b, c, d) {
            a = [p(C(a).toString(16)), p(C(b).toString(16)), p(C(c).toString(16))];
            return d && a[0].charAt(0) == a[0].charAt(1) && a[1].charAt(0) == a[1].charAt(1) && a[2].charAt(0) == a[2].charAt(1) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) : a.join("")
        }

        function k(a, b, c, d) {
            return [p(Math.round(255 * parseFloat(d)).toString(16)), p(C(a).toString(16)), p(C(b).toString(16)),
                p(C(c).toString(16))
            ].join("")
        }

        function n(a) {
            a = parseFloat(a);
            if (isNaN(a) || 0 > a || 1 < a) a = 1;
            return a
        }

        function m(a, b) {
            var c = a;
            "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (a = "100%");
            c = "string" === typeof a && -1 != a.indexOf("%");
            a = K(b, s(0, parseFloat(a)));
            c && (a = parseInt(a * b, 10) / 100);
            return 1E-6 > B.abs(a - b) ? 1 : a % b / parseFloat(b)
        }

        function p(a) {
            return 1 == a.length ? "0" + a : "" + a
        }

        function q(a) {
            1 >= a && (a = 100 * a + "%");
            return a
        }
        var t = /^[\s,#]+/,
            x = /\s+$/,
            v = 0,
            B = Math,
            C = B.round,
            K = B.min,
            s = B.max,
            T = B.random;
        a.fromRatio =
            function(b, c) {
                if ("object" == typeof b) {
                    var d = {},
                        e;
                    for (e in b) b.hasOwnProperty(e) && (d[e] = "a" === e ? b[e] : q(b[e]));
                    b = d
                }
                return a(b, c)
            };
        a.equals = function(b, c) {
            return b && c ? a(b).toRgbString() == a(c).toRgbString() : !1
        };
        a.random = function() {
            return a.fromRatio({
                r: T(),
                g: T(),
                b: T()
            })
        };
        a.desaturate = function(b, c) {
            c = 0 === c ? 0 : c || 10;
            var d = a(b).toHsl();
            d.s -= c / 100;
            d.s = K(1, s(0, d.s));
            return a(d)
        };
        a.saturate = function(b, c) {
            c = 0 === c ? 0 : c || 10;
            var d = a(b).toHsl();
            d.s += c / 100;
            d.s = K(1, s(0, d.s));
            return a(d)
        };
        a.greyscale = function(b) {
            return a.desaturate(b,
                100)
        };
        a.lighten = function(b, c) {
            c = 0 === c ? 0 : c || 10;
            var d = a(b).toHsl();
            d.l += c / 100;
            d.l = K(1, s(0, d.l));
            return a(d)
        };
        a.darken = function(b, c) {
            c = 0 === c ? 0 : c || 10;
            var d = a(b).toHsl();
            d.l -= c / 100;
            d.l = K(1, s(0, d.l));
            return a(d)
        };
        a.complement = function(b) {
            b = a(b).toHsl();
            b.h = (b.h + 180) % 360;
            return a(b)
        };
        a.triad = function(b) {
            var c = a(b).toHsl(),
                d = c.h;
            return [a(b), a({
                h: (d + 120) % 360,
                s: c.s,
                l: c.l
            }), a({
                h: (d + 240) % 360,
                s: c.s,
                l: c.l
            })]
        };
        a.tetrad = function(b) {
            var c = a(b).toHsl(),
                d = c.h;
            return [a(b), a({
                h: (d + 90) % 360,
                s: c.s,
                l: c.l
            }), a({
                h: (d + 180) % 360,
                s: c.s,
                l: c.l
            }), a({
                h: (d + 270) % 360,
                s: c.s,
                l: c.l
            })]
        };
        a.splitcomplement = function(b) {
            var c = a(b).toHsl(),
                d = c.h;
            return [a(b), a({
                h: (d + 72) % 360,
                s: c.s,
                l: c.l
            }), a({
                h: (d + 216) % 360,
                s: c.s,
                l: c.l
            })]
        };
        a.analogous = function(b, c, d) {
            c = c || 6;
            d = d || 30;
            var e = a(b).toHsl();
            d = 360 / d;
            b = [a(b)];
            for (e.h = (e.h - (d * c >> 1) + 720) % 360; --c;) e.h = (e.h + d) % 360, b.push(a(e));
            return b
        };
        a.monochromatic = function(b, c) {
            c = c || 6;
            for (var d = a(b).toHsv(), e = d.h, f = d.s, d = d.v, g = [], k = 1 / c; c--;) g.push(a({
                h: e,
                s: f,
                v: d
            })), d = (d + k) % 1;
            return g
        };
        a.readability = function(b, c) {
            var d =
                a(b).toRgb(),
                e = a(c).toRgb(),
                f = (299 * d.r + 587 * d.g + 114 * d.b) / 1E3,
                g = (299 * e.r + 587 * e.g + 114 * e.b) / 1E3,
                d = Math.max(d.r, e.r) - Math.min(d.r, e.r) + Math.max(d.g, e.g) - Math.min(d.g, e.g) + Math.max(d.b, e.b) - Math.min(d.b, e.b);
            return {
                brightness: Math.abs(f - g),
                color: d
            }
        };
        a.readable = function(b, c) {
            var d = a.readability(b, c);
            return 125 < d.brightness && 500 < d.color
        };
        a.mostReadable = function(b, c) {
            for (var d = null, e = 0, f = !1, g = 0; g < c.length; g++) {
                var k = a.readability(b, c[g]),
                    n = 125 < k.brightness && 500 < k.color,
                    k = k.brightness / 125 * 3 + k.color / 500;
                if (n &&
                    !f || n && f && k > e || !n && !f && k > e) f = n, e = k, d = a(c[g])
            }
            return d
        };
        var S = a.names = {
                aliceblue: "f0f8ff",
                antiquewhite: "faebd7",
                aqua: "0ff",
                aquamarine: "7fffd4",
                azure: "f0ffff",
                beige: "f5f5dc",
                bisque: "ffe4c4",
                black: "000",
                blanchedalmond: "ffebcd",
                blue: "00f",
                blueviolet: "8a2be2",
                brown: "a52a2a",
                burlywood: "deb887",
                burntsienna: "ea7e5d",
                cadetblue: "5f9ea0",
                chartreuse: "7fff00",
                chocolate: "d2691e",
                coral: "ff7f50",
                cornflowerblue: "6495ed",
                cornsilk: "fff8dc",
                crimson: "dc143c",
                cyan: "0ff",
                darkblue: "00008b",
                darkcyan: "008b8b",
                darkgoldenrod: "b8860b",
                darkgray: "a9a9a9",
                darkgreen: "006400",
                darkgrey: "a9a9a9",
                darkkhaki: "bdb76b",
                darkmagenta: "8b008b",
                darkolivegreen: "556b2f",
                darkorange: "ff8c00",
                darkorchid: "9932cc",
                darkred: "8b0000",
                darksalmon: "e9967a",
                darkseagreen: "8fbc8f",
                darkslateblue: "483d8b",
                darkslategray: "2f4f4f",
                darkslategrey: "2f4f4f",
                darkturquoise: "00ced1",
                darkviolet: "9400d3",
                deeppink: "ff1493",
                deepskyblue: "00bfff",
                dimgray: "696969",
                dimgrey: "696969",
                dodgerblue: "1e90ff",
                firebrick: "b22222",
                floralwhite: "fffaf0",
                forestgreen: "228b22",
                fuchsia: "f0f",
                gainsboro: "dcdcdc",
                ghostwhite: "f8f8ff",
                gold: "ffd700",
                goldenrod: "daa520",
                gray: "808080",
                green: "008000",
                greenyellow: "adff2f",
                grey: "808080",
                honeydew: "f0fff0",
                hotpink: "ff69b4",
                indianred: "cd5c5c",
                indigo: "4b0082",
                ivory: "fffff0",
                khaki: "f0e68c",
                lavender: "e6e6fa",
                lavenderblush: "fff0f5",
                lawngreen: "7cfc00",
                lemonchiffon: "fffacd",
                lightblue: "add8e6",
                lightcoral: "f08080",
                lightcyan: "e0ffff",
                lightgoldenrodyellow: "fafad2",
                lightgray: "d3d3d3",
                lightgreen: "90ee90",
                lightgrey: "d3d3d3",
                lightpink: "ffb6c1",
                lightsalmon: "ffa07a",
                lightseagreen: "20b2aa",
                lightskyblue: "87cefa",
                lightslategray: "789",
                lightslategrey: "789",
                lightsteelblue: "b0c4de",
                lightyellow: "ffffe0",
                lime: "0f0",
                limegreen: "32cd32",
                linen: "faf0e6",
                magenta: "f0f",
                maroon: "800000",
                mediumaquamarine: "66cdaa",
                mediumblue: "0000cd",
                mediumorchid: "ba55d3",
                mediumpurple: "9370db",
                mediumseagreen: "3cb371",
                mediumslateblue: "7b68ee",
                mediumspringgreen: "00fa9a",
                mediumturquoise: "48d1cc",
                mediumvioletred: "c71585",
                midnightblue: "191970",
                mintcream: "f5fffa",
                mistyrose: "ffe4e1",
                moccasin: "ffe4b5",
                navajowhite: "ffdead",
                navy: "000080",
                oldlace: "fdf5e6",
                olive: "808000",
                olivedrab: "6b8e23",
                orange: "ffa500",
                orangered: "ff4500",
                orchid: "da70d6",
                palegoldenrod: "eee8aa",
                palegreen: "98fb98",
                paleturquoise: "afeeee",
                palevioletred: "db7093",
                papayawhip: "ffefd5",
                peachpuff: "ffdab9",
                peru: "cd853f",
                pink: "ffc0cb",
                plum: "dda0dd",
                powderblue: "b0e0e6",
                purple: "800080",
                red: "f00",
                rosybrown: "bc8f8f",
                royalblue: "4169e1",
                saddlebrown: "8b4513",
                salmon: "fa8072",
                sandybrown: "f4a460",
                seagreen: "2e8b57",
                seashell: "fff5ee",
                sienna: "a0522d",
                silver: "c0c0c0",
                skyblue: "87ceeb",
                slateblue: "6a5acd",
                slategray: "708090",
                slategrey: "708090",
                snow: "fffafa",
                springgreen: "00ff7f",
                steelblue: "4682b4",
                tan: "d2b48c",
                teal: "008080",
                thistle: "d8bfd8",
                tomato: "ff6347",
                turquoise: "40e0d0",
                violet: "ee82ee",
                wheat: "f5deb3",
                white: "fff",
                whitesmoke: "f5f5f5",
                yellow: "ff0",
                yellowgreen: "9acd32"
            },
            ya = a.hexNames = function(a) {
                var b = {},
                    c;
                for (c in a) a.hasOwnProperty(c) && (b[a[c]] = c);
                return b
            }(S),
            ka = {
                rgb: /rgb[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,
                rgba: /rgba[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,
                hsl: /hsl[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,
                hsla: /hsla[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,
                hsv: /hsv[\s|\(]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))[,|\s]+((?:[-\+]?\d*\.\d+%?)|(?:[-\+]?\d+%?))\s*\)?/,
                hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
                hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
                hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
            };
        c.tinycolor = a
    })();
    g(function() {
        g.fn.spectrum.load && g.fn.spectrum.processNativeColorInputs()
    })
})(window, jQuery);
(function(c, g) {
    var e = /[<>&\r\n"']/gm,
        b = {
            "<": "lt;",
            ">": "gt;",
            "&": "amp;",
            "\r": "#13;",
            "\n": "#10;",
            '"': "quot;",
            "'": "apos;"
        };
    c.extend({
        fileDownload: function(d, a) {
            function f() {
                if (-1 != document.cookie.indexOf(m.cookieName + "=" + m.cookieValue)) K.onSuccess(d), document.cookie = m.cookieName + "=; expires=" + (new Date(1E3)).toUTCString() + "; path=" + m.cookiePath, n(!1);
                else {
                    if (y || A) try {
                        var a = y ? y.document : k(A);
                        if (a && null != a.body && a.body.innerHTML.length) {
                            var b = !0;
                            if (E && E.length) {
                                var e = c(a.body).contents().first();
                                e.length &&
                                    e[0] === E[0] && (b = !1)
                            }
                            if (b) {
                                K.onFail(a.body.innerHTML, d);
                                n(!0);
                                return
                            }
                        }
                    } catch (g) {
                        K.onFail("", d);
                        n(!0);
                        return
                    }
                    setTimeout(f, m.checkInterval)
                }
            }

            function k(a) {
                a = a[0].contentWindow || a[0].contentDocument;
                a.document && (a = a.document);
                return a
            }

            function n(a) {
                setTimeout(function() {
                    y && (B && y.close(), x && (y.focus(), a && y.close()))
                }, 0)
            }

            function p(a) {
                return a.replace(e, function(a) {
                    return "&" + b[a]
                })
            }
            var m = c.extend({
                    preparingMessageHtml: null,
                    failMessageHtml: null,
                    androidPostUnsupportedMessageHtml: "Unfortunately your Android browser doesn't support this type of file download. Please try again with a different browser.",
                    dialogOptions: {
                        modal: !0
                    },
                    prepareCallback: function(a) {},
                    successCallback: function(a) {},
                    failCallback: function(a, b) {},
                    httpMethod: "GET",
                    data: null,
                    checkInterval: 100,
                    cookieName: "fileDownload",
                    cookieValue: "true",
                    cookiePath: "/",
                    popupWindowTitle: "Initiating file download...",
                    encodeHTMLEntities: !0
                }, a),
                q = new c.Deferred,
                t = (navigator.userAgent || navigator.vendor || g.opera).toLowerCase(),
                x, B, v;
            /ip(ad|hone|od)/.test(t) ? x = !0 : -1 !== t.indexOf("android") ? B = !0 : v = /avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|playbook|silk|iemobile|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t) ||
                /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(t.substr(0,
                    4));
            t = m.httpMethod.toUpperCase();
            if (B && "GET" !== t) return c().dialog ? c("<div>").html(m.androidPostUnsupportedMessageHtml).dialog(m.dialogOptions) : alert(m.androidPostUnsupportedMessageHtml), q.reject();
            var C = null,
                K = {
                    onPrepare: function(a) {
                        m.preparingMessageHtml ? C = c("<div>").html(m.preparingMessageHtml).dialog(m.dialogOptions) : m.prepareCallback && m.prepareCallback(a)
                    },
                    onSuccess: function(a) {
                        C && C.dialog("close");
                        m.successCallback(a);
                        q.resolve(a)
                    },
                    onFail: function(a, b) {
                        C && C.dialog("close");
                        m.failMessageHtml &&
                            c("<div>").html(m.failMessageHtml).dialog(m.dialogOptions);
                        m.failCallback(a, b);
                        q.reject(a, b)
                    }
                };
            K.onPrepare(d);
            null !== m.data && "string" !== typeof m.data && (m.data = c.param(m.data));
            var A, y, E;
            if ("GET" === t) null !== m.data && (-1 !== d.indexOf("?") ? "&" !== d.substring(d.length - 1) && (d += "&") : d += "?", d += m.data), x || B ? (y = g.open(d), y.document.title = m.popupWindowTitle, g.focus()) : v ? g.location(d) : A = c("<iframe>").hide().prop("src", d).appendTo("body");
            else {
                var N = "";
                null !== m.data && c.each(m.data.replace(/\+/g, " ").split("&"),
                    function() {
                        var a = this.split("="),
                            b = m.encodeHTMLEntities ? p(decodeURIComponent(a[0])) : decodeURIComponent(a[0]);
                        b && (a = m.encodeHTMLEntities ? p(decodeURIComponent(a[1])) : decodeURIComponent(a[1]), N += '<input type="hidden" name="' + b + '" value="' + a + '" />')
                    });
                v ? (E = c("<form>").appendTo("body"), E.hide().prop("method", m.httpMethod).prop("action", d).html(N)) : (x ? (y = g.open("about:blank"), y.document.title = m.popupWindowTitle, v = y.document, g.focus()) : (A = c("<iframe style='display: none' src='about:blank'></iframe>").appendTo("body"),
                    v = k(A)), v.write("<html><head></head><body><form method='" + m.httpMethod + "' action='" + d + "'>" + N + "</form>" + m.popupWindowTitle + "</body></html>"), E = c(v).find("form"));
                E.submit()
            }
            setTimeout(f, m.checkInterval);
            return q.promise()
        }
    })
})(jQuery, this);
var docCookies = {
    getItem: function(c) {
        return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(c).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null
    },
    setItem: function(c, g, e, b, d, a) {
        if (!c || /^(?:expires|max\-age|path|domain|secure)$/i.test(c)) return !1;
        var f = "";
        if (e) switch (e.constructor) {
            case Number:
                f = Infinity === e ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + e;
                break;
            case String:
                f = "; expires=" + e;
                break;
            case Date:
                f = "; expires=" + e.toUTCString()
        }
        document.cookie =
            encodeURIComponent(c) + "=" + encodeURIComponent(g) + f + (d ? "; domain=" + d : "") + (b ? "; path=" + b : "") + (a ? "; secure" : "");
        return !0
    },
    removeItem: function(c, g, e) {
        if (!c || !this.hasItem(c)) return !1;
        document.cookie = encodeURIComponent(c) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (e ? "; domain=" + e : "") + (g ? "; path=" + g : "");
        return !0
    },
    hasItem: function(c) {
        return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(c).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie)
    },
    keys: function() {
        for (var c = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,
                "").split(/\s*(?:\=[^;]*)?;\s*/), g = 0; g < c.length; g++) c[g] = decodeURIComponent(c[g]);
        return c
    }
};
var Prism = function() {
    var c = window,
        g = /\blang(?:uage)?-(?!\*)(\w+)\b/i,
        e = c.Prism = {
            util: {
                encode: function(a) {
                    return a instanceof b ? new b(a.type, e.util.encode(a.content)) : "Array" === e.util.type(a) ? a.map(e.util.encode) : a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ")
                },
                type: function(a) {
                    return Object.prototype.toString.call(a).match(/\[object (\w+)\]/)[1]
                },
                clone: function(a) {
                    switch (e.util.type(a)) {
                        case "Object":
                            var b = {},
                                c;
                            for (c in a) a.hasOwnProperty(c) && (b[c] = e.util.clone(a[c]));
                            return b;
                        case "Array":
                            return a.slice()
                    }
                    return a
                }
            },
            languages: {
                extend: function(a, b) {
                    var c = e.util.clone(e.languages[a]),
                        d;
                    for (d in b) c[d] = b[d];
                    return c
                },
                insertBefore: function(a, b, c, d) {
                    d = d || e.languages;
                    var g = d[a],
                        m = {},
                        q;
                    for (q in g)
                        if (g.hasOwnProperty(q)) {
                            if (q == b)
                                for (var t in c) c.hasOwnProperty(t) && (m[t] = c[t]);
                            m[q] = g[q]
                        }
                    return d[a] = m
                },
                DFS: function(a, b) {
                    for (var c in a) b.call(a, c, a[c]), "Object" === e.util.type(a) && e.languages.DFS(a[c], b)
                }
            },
            highlightAll: function(a, b) {
                for (var c = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),
                        d = 0, g; g = c[d++];) e.highlightElement(g, !0 === a, b)
            },
            highlightElement: function(a, d, k) {
                for (var n, p, m = a; m && !g.test(m.className);) m = m.parentNode;
                m && (n = (m.className.match(g) || [, ""])[1], p = e.languages[n]);
                if (p && (a.className = a.className.replace(g, "").replace(/\s+/g, " ") + " language-" + n, m = a.parentNode, /pre/i.test(m.nodeName) && (m.className = m.className.replace(g, "").replace(/\s+/g, " ") + " language-" + n), m = a.textContent)) {
                    var q = {
                        element: a,
                        language: n,
                        grammar: p,
                        code: m
                    };
                    e.hooks.run("before-highlight", q);
                    d && c.Worker ? (a =
                        new Worker(e.filename), a.onmessage = function(a) {
                            q.highlightedCode = b.stringify(JSON.parse(a.data), n);
                            e.hooks.run("before-insert", q);
                            q.element.innerHTML = q.highlightedCode;
                            k && k.call(q.element);
                            e.hooks.run("after-highlight", q)
                        }, a.postMessage(JSON.stringify({
                            language: q.language,
                            code: q.code
                        }))) : (q.highlightedCode = e.highlight(q.code, q.grammar, q.language), e.hooks.run("before-insert", q), q.element.innerHTML = q.highlightedCode, k && k.call(a), e.hooks.run("after-highlight", q))
                }
            },
            highlight: function(a, c, d) {
                a = e.tokenize(a,
                    c);
                return b.stringify(e.util.encode(a), d)
            },
            tokenize: function(a, b, c) {
                c = e.Token;
                var d = [a],
                    g = b.rest;
                if (g) {
                    for (var m in g) b[m] = g[m];
                    delete b.rest
                }
                a: for (m in b)
                    if (b.hasOwnProperty(m) && b[m])
                        for (var g = b[m], g = "Array" === e.util.type(g) ? g : [g], q = 0; q < g.length; ++q)
                            for (var t = g[q], x = t.inside, B = !!t.lookbehind, v = 0, t = t.pattern || t, C = 0; C < d.length; C++) {
                                var K = d[C];
                                if (d.length > a.length) break a;
                                if (!(K instanceof c)) {
                                    t.lastIndex = 0;
                                    var A = t.exec(K);
                                    if (A) {
                                        B && (v = A[1].length);
                                        var y = A.index - 1 + v,
                                            A = A[0].slice(v),
                                            E = y + A.length,
                                            y = K.slice(0,
                                                y + 1),
                                            K = K.slice(E + 1),
                                            E = [C, 1];
                                        y && E.push(y);
                                        A = new c(m, x ? e.tokenize(A, x) : A);
                                        E.push(A);
                                        K && E.push(K);
                                        Array.prototype.splice.apply(d, E)
                                    }
                                }
                            }
                    return d
            },
            hooks: {
                all: {},
                add: function(a, b) {
                    var c = e.hooks.all;
                    c[a] = c[a] || [];
                    c[a].push(b)
                },
                run: function(a, b) {
                    var c = e.hooks.all[a];
                    if (c && c.length)
                        for (var d = 0, g; g = c[d++];) g(b)
                }
            }
        },
        b = e.Token = function(a, b) {
            this.type = a;
            this.content = b
        };
    b.stringify = function(a, c, d) {
        if ("string" == typeof a) return a;
        if ("[object Array]" == Object.prototype.toString.call(a)) return a.map(function(d) {
            return b.stringify(d,
                c, a)
        }).join("");
        d = {
            type: a.type,
            content: b.stringify(a.content, c, d),
            tag: "span",
            classes: ["token", a.type],
            attributes: {},
            language: c,
            parent: d
        };
        "comment" == d.type && (d.attributes.spellcheck = "true");
        e.hooks.run("wrap", d);
        var g = "",
            p;
        for (p in d.attributes) g += p + '="' + (d.attributes[p] || "") + '"';
        return "<" + d.tag + ' class="' + d.classes.join(" ") + '" ' + g + ">" + d.content + "</" + d.tag + ">"
    };
    if (!c.document) {
        if (!c.addEventListener) return c.Prism;
        c.addEventListener("message", function(a) {
            a = JSON.parse(a.data);
            c.postMessage(JSON.stringify(e.tokenize(a.code,
                e.languages[a.language])));
            c.close()
        }, !1);
        return c.Prism
    }
    var d = document.getElementsByTagName("script");
    if (d = d[d.length - 1]) e.filename = d.src, document.addEventListener && !d.hasAttribute("data-manual") && document.addEventListener("DOMContentLoaded", e.highlightAll);
    return c.Prism
}();
"undefined" !== typeof module && module.exports && (module.exports = Prism);
Prism.languages.markup = {
    comment: /\x3c!--[\w\W]*?--\x3e/g,
    prolog: /<\?.+?\?>/,
    doctype: /<!DOCTYPE.+?>/,
    cdata: /<!\[CDATA\[[\w\W]*?]]\x3e/i,
    tag: {
        pattern: /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,
        inside: {
            tag: {
                pattern: /^<\/?[\w:-]+/i,
                inside: {
                    punctuation: /^<\/?/,
                    namespace: /^[\w-]+?:/
                }
            },
            "attr-value": {
                pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,
                inside: {
                    punctuation: /=|>|"/g
                }
            },
            punctuation: /\/?>/g,
            "attr-name": {
                pattern: /[\w:-]+/g,
                inside: {
                    namespace: /^[\w-]+?:/
                }
            }
        }
    },
    entity: /\&#?[\da-z]{1,8};/gi
};
Prism.hooks.add("wrap", function(c) {
    "entity" === c.type && (c.attributes.title = c.content.replace(/&amp;/, "&"))
});
Prism.languages.css = {
    comment: /\/\*[\w\W]*?\*\//g,
    atrule: {
        pattern: /@[\w-]+?.*?(;|(?=\s*{))/gi,
        inside: {
            punctuation: /[;:]/g
        }
    },
    url: /url\((["']?).*?\1\)/gi,
    selector: /[^\{\}\s][^\{\};]*(?=\s*\{)/g,
    property: /(\b|\B)[\w-]+(?=\s*:)/ig,
    string: /("|')(\\?.)*?\1/g,
    important: /\B!important\b/gi,
    punctuation: /[\{\};:]/g,
    "function": /[-a-z0-9]+(?=\()/ig
};
Prism.languages.markup && Prism.languages.insertBefore("markup", "tag", {
    style: {
        pattern: /<style[\w\W]*?>[\w\W]*?<\/style>/ig,
        inside: {
            tag: {
                pattern: /<style[\w\W]*?>|<\/style>/ig,
                inside: Prism.languages.markup.tag.inside
            },
            rest: Prism.languages.css
        }
    }
});
Prism.languages.clike = {
    comment: [{
        pattern: /(^|[^\\])\/\*[\w\W]*?\*\//g,
        lookbehind: !0
    }, {
        pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/g,
        lookbehind: !0
    }],
    string: /("|')(\\?.)*?\1/g,
    "class-name": {
        pattern: /((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,
        lookbehind: !0,
        inside: {
            punctuation: /(\.|\\)/
        }
    },
    keyword: /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,
    "boolean": /\b(true|false)\b/g,
    "function": {
        pattern: /[a-z0-9_]+\(/ig,
        inside: {
            punctuation: /\(/
        }
    },
    number: /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
    operator: /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,
    ignore: /&(lt|gt|amp);/gi,
    punctuation: /[{}[\];(),.:]/g
};
Prism.languages.javascript = Prism.languages.extend("clike", {
    keyword: /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,
    number: /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g
});
Prism.languages.insertBefore("javascript", "keyword", {
    regex: {
        pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,
        lookbehind: !0
    }
});
Prism.languages.markup && Prism.languages.insertBefore("markup", "tag", {
    script: {
        pattern: /<script[\w\W]*?>[\w\W]*?<\/script>/ig,
        inside: {
            tag: {
                pattern: /<script[\w\W]*?>|<\/script>/ig,
                inside: Prism.languages.markup.tag.inside
            },
            rest: Prism.languages.javascript
        }
    }
});
Prism.languages.latex = {
    comment: /%.*?(\r?\n|$)$/m,
    string: /(\$)(\\?.)*?\1/g,
    punctuation: /[{}]/g,
    selector: /\\[a-z;,:\.]*/i
};
Prism.hooks.add("after-highlight", function(c) {
    var g = c.element.parentNode;
    if (g && /pre/i.test(g.nodeName) && -1 !== g.className.indexOf("line-numbers")) {
        var e = 1 + c.code.split("\n").length;
        lines = Array(e);
        lines = lines.join("<span></span>");
        e = document.createElement("span");
        e.className = "line-numbers-rows";
        e.innerHTML = lines;
        g.hasAttribute("data-start") && (g.style.counterReset = "linenumber " + (parseInt(g.getAttribute("data-start"), 10) - 1));
        c.element.appendChild(e)
    }
});
Prism.languages.TeX = {
    comment: /(?:^|[^\\])%[^%]*?$/m,
    builtin: {
        pattern: /\\[\w]+([{\[].*?[}\]](?=\s|$))*/gi,
        inside: {
            constant: /[\w,|\s-]+(?=[\]}])/gi,
            selector: /\\[\w]+/,
            punctuation: /[{}[\]]/gi
        }
    },
    regex: /(&amp;)/gi
};
Prism.languages.plain = {};
Prism.languages.markdown = {
    property: /([\*_]{1,2})(\w|\w[\s\w]*\w)\1/i
};
Prism.languages.mediawiki = {
    important: /(\n\|-)|(^\{\|)|(\|\}$)/g,
    comment: /\n(?:((?:\||!)[^|]+)(?=[^\n]\|))|(?:\||!)\s/g
};
(function(c) {
    if (!c.observable) {
        c.observable = function(c) {
            var b = {},
                d = [].slice;
            c.on = function(a, d) {
                "function" === typeof d && a.replace(/[^\s]+/g, function(a, c) {
                    (b[a] = b[a] || []).push(d);
                    d.typed = 0 < c
                });
                return c
            };
            c.off = function(a) {
                a.replace(/[^\s]+/g, function(a) {
                    b[a] = []
                });
                "*" == a && (b = {});
                return c
            };
            c.one = function(a, b) {
                b && (b.one = !0);
                return c.on(a, b)
            };
            c.trigger = function(a) {
                for (var f = d.call(arguments, 1), g = b[a] || [], n = 0, p; p = g[n]; ++n) p.one && p.done || p.busy || (p.busy = !0, p.apply(c, p.typed ? [a].concat(f) : f), p.done = !0, p.busy = !1);
                return c
            };
            return c
        };
        var g = {};
        c.present = function(c, b) {
            g[c] = b
        };
        c.fn.present = function(c, b) {
            var d = g[c](this, b);
            d && this.data(c, d);
            return this
        }
    }
})("undefined" !== typeof exports ? exports : window.$ || (window.$ = {}));
(function(c) {
    c.present("SimpleMenu", function(g, e) {
        e = c.extend(!0, {
            menu_item_selector: "li",
            menu_item_id_attr: "id"
        }, e);
        var b = {},
            d = c(e.menu_item_selector, g);
        c.observable(b);
        d.mousedown(function(a) {
            1 == a.which && (a = c(this), b.trigger(a.attr(e.menu_item_id_attr), a), b.trigger("any_item_clicked", a))
        });
        return b
    })
})($);
(function(c) {
    c.present("SimpleAccordion", function(g, e) {
        function b(a) {
            a.addClass("closed").next().hide()
        }
        e = c.extend(!0, {
            item_header_selector: "h3"
        }, e);
        var d = [];
        c(e.item_header_selector, g).each(function(a, e) {
            e = c(e);
            e.click(function() {
                for (var c = e, g = 0; g < d.length; ++g) g != a && b(d[g]);
                c.next().is(":visible") ? b(c) : c.removeClass("closed").next().show()
            });
            d.push(e);
            0 != a && b(e)
        });
        return {}
    })
})($);
(function(c) {
    c.present("SimpleDraggable", function(g, e) {
        function b(b) {
            1 == b.which && (m.top = k.top, m.left = k.left, e.horizontal_enabled && (m.left += b.pageX - n.left, f && (m.left = Math.max(f.left, Math.min(f.right, m.left)))), e.vertical_enabled && (m.top = b.pageY - n.top, f && (m.top = Math.max(f.top, Math.min(f.bottom, m.top)))), g.offset(m), a.trigger("drag_move", b, m));
            b.preventDefault();
            b.stopPropagation()
        }

        function d(b) {
            c(document).off("mousemove");
            c(document).off("mouseup");
            g.css("z-index", p);
            var d = b.pageX;
            f && (d = Math.max(f.left,
                Math.min(f.right, d)));
            d -= n.left;
            a.trigger("drag_end", b, d)
        }
        e = c.extend(!0, {
            horizontal_enabled: !0,
            vertical_enabled: !1,
            bounds: null
        }, e);
        var a = {},
            f = e.bounds,
            k = null,
            n = null,
            p = 0,
            m = {};
        g.on("mousedown", function(e) {
            1 == e.which && (k = g.offset(), p = g.css("z-index"), g.css({
                position: "absolute",
                "z-index": 1E3,
                top: k.top,
                left: k.left
            }), n = {
                top: e.pageY,
                left: e.pageX
            }, c(document).on("mousemove", b).on("mouseup", d), e.preventDefault(), a.trigger("drag_start", e, k))
        });
        c.observable(a);
        a.setBounds = function(a) {
            f = a
        };
        return a
    })
})($);
(function(c) {
    function g(a) {
        var d = c(this);
        d.each(function() {
            var d = c(this),
                e = d.data("slider"),
                f = "object" === typeof a && a;
            e && !f && (f = {}, c.each(c.fn.slider.defaults, function(a) {
                f[a] = e[a]
            }));
            d.data("slider", new b(this, c.extend({}, c.fn.slider.defaults, f)))
        });
        return d
    }
    var e = {
            formatInvalidInputErrorMsg: function(a) {
                return "Invalid input value '" + a + "' passed in"
            },
            callingContextNotSliderInstance: "Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"
        },
        b = function(a, b) {
            var d = this.element = c(a).hide(),
                e = c(a)[0].style.width,
                g = !1,
                m = this.element.parent();
            !0 === m.hasClass("slider") ? (g = !0, this.picker = m) : this.picker = c('<div class="slider"><div class="slider-track"><div class="slider-selection"></div><div class="slider-handle"></div><div class="slider-handle"></div></div><div id="tooltip" class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div><div id="tooltip_min" class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div><div id="tooltip_max" class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div></div>').insertBefore(this.element).append(this.element);
            if (this.id = this.element.data("slider-id") || b.id) this.picker[0].id = this.id;
            if ("ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch) this.touchCapable = !0;
            m = this.element.data("slider-tooltip") || b.tooltip;
            this.tooltip = this.picker.find("#tooltip");
            this.tooltipInner = this.tooltip.find("div.tooltip-inner");
            this.tooltip_min = this.picker.find("#tooltip_min");
            this.tooltipInner_min = this.tooltip_min.find("div.tooltip-inner");
            this.tooltip_max = this.picker.find("#tooltip_max");
            this.tooltipInner_max =
                this.tooltip_max.find("div.tooltip-inner");
            !0 === g && (this.picker.removeClass("slider-horizontal"), this.picker.removeClass("slider-vertical"), this.tooltip.removeClass("hide"), this.tooltip_min.removeClass("hide"), this.tooltip_max.removeClass("hide"));
            this.orientation = this.element.data("slider-orientation") || b.orientation;
            switch (this.orientation) {
                case "vertical":
                    this.picker.addClass("slider-vertical");
                    this.stylePos = "top";
                    this.mousePos = "pageY";
                    this.sizePos = "offsetHeight";
                    this.tooltip.addClass("right")[0].style.left =
                        "100%";
                    this.tooltip_min.addClass("right")[0].style.left = "100%";
                    this.tooltip_max.addClass("right")[0].style.left = "100%";
                    break;
                default:
                    this.picker.addClass("slider-horizontal").css("width", e), this.orientation = "horizontal", this.stylePos = "left", this.mousePos = "pageX", this.sizePos = "offsetWidth", this.tooltip.addClass("top")[0].style.top = -this.tooltip.outerHeight() - 24 + "px", this.tooltip_min.addClass("top")[0].style.top = -this.tooltip_min.outerHeight() - 14 + "px", this.tooltip_max.addClass("top")[0].style.top = -this.tooltip_max.outerHeight() -
                        14 + "px"
            }
            var q = this;
            c.each("min max step precision value reversed handle".split(" "), function(a, c) {
                "undefined" !== typeof d.data("slider-" + c) ? q[c] = d.data("slider-" + c) : "undefined" !== typeof b[c] ? q[c] = b[c] : "undefined" !== typeof d.prop(c) ? q[c] = d.prop(c) : q[c] = 0
            });
            this.value instanceof Array ? g && !this.range ? this.value = this.value[0] : this.range = !0 : this.range && (this.value = [this.value, this.max]);
            this.selection = this.element.data("slider-selection") || b.selection;
            this.selectionEl = this.picker.find(".slider-selection");
            "none" === this.selection && this.selectionEl.addClass("hide");
            this.selectionElStyle = this.selectionEl[0].style;
            this.handle1 = this.picker.find(".slider-handle:first");
            this.handle1Stype = this.handle1[0].style;
            this.handle2 = this.picker.find(".slider-handle:last");
            this.handle2Stype = this.handle2[0].style;
            !0 === g && (this.handle1.removeClass("round triangle"), this.handle2.removeClass("round triangle hide"));
            switch (this.handle) {
                case "round":
                    this.handle1.addClass("round");
                    this.handle2.addClass("round");
                    break;
                case "triangle":
                    this.handle1.addClass("triangle"),
                        this.handle2.addClass("triangle")
            }
            this.offset = this.picker.offset();
            this.size = this.picker[0][this.sizePos];
            this.formater = b.formater;
            this.tooltip_separator = b.tooltip_separator;
            this.tooltip_split = b.tooltip_split;
            this.setValue(this.value);
            this.handle1.on({
                keydown: c.proxy(this.keydown, this, 0)
            });
            this.handle2.on({
                keydown: c.proxy(this.keydown, this, 1)
            });
            if (this.touchCapable) this.picker.on({
                touchstart: c.proxy(this.mousedown, this)
            });
            this.picker.on({
                mousedown: c.proxy(this.mousedown, this)
            });
            "hide" === m ? (this.tooltip.addClass("hide"),
                this.tooltip_min.addClass("hide"), this.tooltip_max.addClass("hide")) : "always" === m ? (this.showTooltip(), this.alwaysShowTooltip = !0) : (this.picker.on({
                mouseenter: c.proxy(this.showTooltip, this),
                mouseleave: c.proxy(this.hideTooltip, this)
            }), this.handle1.on({
                focus: c.proxy(this.showTooltip, this),
                blur: c.proxy(this.hideTooltip, this)
            }), this.handle2.on({
                focus: c.proxy(this.showTooltip, this),
                blur: c.proxy(this.hideTooltip, this)
            }));
            (this.enabled = b.enabled && (void 0 === this.element.data("slider-enabled") || !0 === this.element.data("slider-enabled"))) ?
            this.enable(): this.disable();
            this.naturalArrowKeys = this.element.data("slider-naturalarrowkeys") || b.naturalarrowkeys
        };
    b.prototype = {
        constructor: b,
        over: !1,
        inDrag: !1,
        showTooltip: function() {
            !1 === this.tooltip_split ? this.tooltip.addClass("in") : (this.tooltip_min.addClass("in"), this.tooltip_max.addClass("in"));
            this.over = !0
        },
        hideTooltip: function() {
            !1 === this.inDrag && !0 !== this.alwaysShowTooltip && (this.tooltip.removeClass("in"), this.tooltip_min.removeClass("in"), this.tooltip_max.removeClass("in"));
            this.over = !1
        },
        layout: function() {
            var a;
            a = this.reversed ? [100 - this.percentage[0], this.percentage[1]] : [this.percentage[0], this.percentage[1]];
            this.handle1Stype[this.stylePos] = a[0] + "%";
            this.handle2Stype[this.stylePos] = a[1] + "%";
            if ("vertical" === this.orientation) this.selectionElStyle.top = Math.min(a[0], a[1]) + "%", this.selectionElStyle.height = Math.abs(a[0] - a[1]) + "%";
            else {
                this.selectionElStyle.left = Math.min(a[0], a[1]) + "%";
                this.selectionElStyle.width = Math.abs(a[0] - a[1]) + "%";
                var b = this.tooltip_min[0].getBoundingClientRect(),
                    c = this.tooltip_max[0].getBoundingClientRect();
                b.right > c.left ? (this.tooltip_max.removeClass("top"), this.tooltip_max.addClass("bottom")[0].style.top = "18px") : (this.tooltip_max.removeClass("bottom"), this.tooltip_max.addClass("top")[0].style.top = "-30px")
            }
            this.range ? (this.tooltipInner.text(this.formater(this.value[0]) + this.tooltip_separator + this.formater(this.value[1])), this.tooltip[0].style[this.stylePos] = this.size * (a[0] + (a[1] - a[0]) / 2) / 100 - ("vertical" === this.orientation ? this.tooltip.outerHeight() / 2 : this.tooltip.outerWidth() /
                2) + "px", this.tooltipInner_min.text(this.formater(this.value[0])), this.tooltipInner_max.text(this.formater(this.value[1])), this.tooltip_min[0].style[this.stylePos] = a[0] / 100 * this.size - ("vertical" === this.orientation ? this.tooltip_min.outerHeight() / 2 : this.tooltip_min.outerWidth() / 2) + "px", this.tooltip_max[0].style[this.stylePos] = a[1] / 100 * this.size - ("vertical" === this.orientation ? this.tooltip_max.outerHeight() / 2 : this.tooltip_max.outerWidth() / 2) + "px") : (this.tooltipInner.text(this.formater(this.value[0])),
                this.tooltip[0].style[this.stylePos] = this.size * a[0] / 100 - ("vertical" === this.orientation ? this.tooltip.outerHeight() / 2 : this.tooltip.outerWidth() / 2) + "px")
        },
        mousedown: function(a) {
            if (!this.isEnabled()) return !1;
            this.touchCapable && "touchstart" === a.type && (a = a.originalEvent);
            this.triggerFocusOnHandle();
            this.offset = this.picker.offset();
            this.size = this.picker[0][this.sizePos];
            a = this.getPercentage(a);
            if (this.range) {
                var b = Math.abs(this.percentage[0] - a),
                    d = Math.abs(this.percentage[1] - a);
                this.dragged = b < d ? 0 : 1
            } else this.dragged =
                0;
            this.percentage[this.dragged] = this.reversed ? 100 - a : a;
            this.layout();
            if (this.touchCapable) c(document).on({
                touchmove: c.proxy(this.mousemove, this),
                touchend: c.proxy(this.mouseup, this)
            });
            c(document).on({
                mousemove: c.proxy(this.mousemove, this),
                mouseup: c.proxy(this.mouseup, this)
            });
            this.inDrag = !0;
            a = this.calculateValue();
            this.element.trigger({
                type: "slideStart",
                value: a
            }).data("value", a).prop("value", a);
            this.setValue(a);
            return !0
        },
        triggerFocusOnHandle: function(a) {
            0 === a && this.handle1.focus();
            1 === a && this.handle2.focus()
        },
        keydown: function(a, b) {
            if (!this.isEnabled()) return !1;
            var c;
            switch (b.which) {
                case 37:
                case 40:
                    c = -1;
                    break;
                case 39:
                case 38:
                    c = 1
            }
            if (c) return this.naturalArrowKeys && ("vertical" === this.orientation && !this.reversed || "horizontal" === this.orientation && this.reversed) && (c *= -1), c = this.percentage[a] + c * this.percentage[2], 100 < c ? c = 100 : 0 > c && (c = 0), this.dragged = a, this.adjustPercentageForRangeSliders(c), this.percentage[this.dragged] = c, this.layout(), c = this.calculateValue(), this.element.trigger({
                type: "slideStart",
                value: c
            }).data("value",
                c).prop("value", c), this.slide(c), this.element.trigger({
                type: "slideStop",
                value: c
            }).data("value", c).prop("value", c), !1
        },
        mousemove: function(a) {
            if (!this.isEnabled()) return !1;
            this.touchCapable && "touchmove" === a.type && (a = a.originalEvent);
            a = this.getPercentage(a);
            this.adjustPercentageForRangeSliders(a);
            this.percentage[this.dragged] = this.reversed ? 100 - a : a;
            this.layout();
            a = this.calculateValue();
            this.slide(a);
            return !1
        },
        slide: function(a) {
            this.setValue(a);
            this.element.trigger({
                type: "slide",
                value: this.range ? this.value : this.value[0]
            }).data("value", this.value).prop("value", this.value)
        },
        adjustPercentageForRangeSliders: function(a) {
            this.range && (0 === this.dragged && this.percentage[1] < a ? (this.percentage[0] = this.percentage[1], this.dragged = 1) : 1 === this.dragged && this.percentage[0] > a && (this.percentage[1] = this.percentage[0], this.dragged = 0))
        },
        mouseup: function() {
            if (!this.isEnabled()) return !1;
            this.touchCapable && c(document).off({
                touchmove: this.mousemove,
                touchend: this.mouseup
            });
            c(document).off({
                mousemove: this.mousemove,
                mouseup: this.mouseup
            });
            this.inDrag = !1;
            !1 === this.over && this.hideTooltip();
            var a = this.calculateValue();
            this.layout();
            this.element.data("value", a).prop("value", a).trigger({
                type: "slideStop",
                value: a
            });
            return !1
        },
        calculateValue: function() {
            var a;
            this.range ? (a = [this.min, this.max], 0 !== this.percentage[0] && (a[0] = Math.max(this.min, this.min + Math.round(this.diff * this.percentage[0] / 100 / this.step) * this.step), a[0] = this.applyPrecision(a[0])), 100 !== this.percentage[1] && (a[1] = Math.min(this.max, this.min + Math.round(this.diff * this.percentage[1] /
                100 / this.step) * this.step), a[1] = this.applyPrecision(a[1])), this.value = a) : (a = this.min + Math.round(this.diff * this.percentage[0] / 100 / this.step) * this.step, a < this.min ? a = this.min : a > this.max && (a = this.max), a = parseFloat(a), a = this.applyPrecision(a), this.value = [a, this.value[1]]);
            return a
        },
        applyPrecision: function(a) {
            var b = this.precision || this.getNumDigitsAfterDecimalPlace(this.step);
            return this.applyToFixedAndParseFloat(a, b)
        },
        getNumDigitsAfterDecimalPlace: function(a) {
            return (a = ("" + a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/)) ?
                Math.max(0, (a[1] ? a[1].length : 0) - (a[2] ? +a[2] : 0)) : 0
        },
        applyToFixedAndParseFloat: function(a, b) {
            var c = a.toFixed(b);
            return parseFloat(c)
        },
        getPercentage: function(a) {
            !this.touchCapable || "touchstart" !== a.type && "touchmove" !== a.type || (a = a.touches[0]);
            a = 100 * (a[this.mousePos] - this.offset[this.stylePos]) / this.size;
            a = Math.round(a / this.percentage[2]) * this.percentage[2];
            return Math.max(0, Math.min(100, a))
        },
        getValue: function() {
            return this.range ? this.value : this.value[0]
        },
        setValue: function(a) {
            a || (a = 0);
            this.value = this.validateInputValue(a);
            this.range ? (this.value[0] = this.applyPrecision(this.value[0]), this.value[1] = this.applyPrecision(this.value[1]), this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])), this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1]))) : (this.value = this.applyPrecision(this.value), this.value = [Math.max(this.min, Math.min(this.max, this.value))], this.handle2.addClass("hide"), this.value[1] = "after" === this.selection ? this.max : this.min);
            this.diff = this.max - this.min;
            this.percentage = 0 < this.diff ? [100 * (this.value[0] -
                this.min) / this.diff, 100 * (this.value[1] - this.min) / this.diff, 100 * this.step / this.diff] : [0, 0, 100];
            this.layout()
        },
        validateInputValue: function(a) {
            if ("number" === typeof a) return a;
            if (a instanceof Array) return c.each(a, function(a, b) {
                if ("number" !== typeof b) throw Error(e.formatInvalidInputErrorMsg(b));
            }), a;
            throw Error(e.formatInvalidInputErrorMsg(a));
        },
        destroy: function() {
            this.handle1.off();
            this.handle2.off();
            this.element.off().show().insertBefore(this.picker);
            this.picker.off().remove();
            c(this.element).removeData("slider")
        },
        disable: function() {
            this.enabled = !1;
            this.handle1.removeAttr("tabindex");
            this.handle2.removeAttr("tabindex");
            this.picker.addClass("slider-disabled");
            this.element.trigger("slideDisabled")
        },
        enable: function() {
            this.enabled = !0;
            this.handle1.attr("tabindex", 0);
            this.handle2.attr("tabindex", 0);
            this.picker.removeClass("slider-disabled");
            this.element.trigger("slideEnabled")
        },
        toggle: function() {
            this.enabled ? this.disable() : this.enable()
        },
        isEnabled: function() {
            return this.enabled
        },
        setAttribute: function(a, b) {
            this[a] =
                b
        },
        getAttribute: function(a) {
            return this[a]
        }
    };
    var d = {
        getValue: b.prototype.getValue,
        setValue: b.prototype.setValue,
        setAttribute: b.prototype.setAttribute,
        getAttribute: b.prototype.getAttribute,
        destroy: b.prototype.destroy,
        disable: b.prototype.disable,
        enable: b.prototype.enable,
        toggle: b.prototype.toggle,
        isEnabled: b.prototype.isEnabled
    };
    c.fn.slider = function(a) {
        if ("string" === typeof a && "refresh" !== a) {
            var f = Array.prototype.slice.call(arguments, 1),
                k;
            k = a;
            if (d[k]) {
                var n = c(this).data("slider");
                if (!(n && n instanceof b)) throw Error(e.callingContextNotSliderInstance);
                k = d[k].apply(n, f);
                k = "undefined" === typeof k ? c(this) : k
            } else throw Error("method '" + k + "()' does not exist for slider.");
            return k
        }
        return g.call(this, a)
    };
    c.fn.slider.defaults = {
        min: 0,
        max: 10,
        step: 1,
        precision: 0,
        orientation: "horizontal",
        value: 5,
        range: !1,
        selection: "before",
        tooltip: "show",
        tooltip_separator: ":",
        tooltip_split: !1,
        handle: "round",
        reversed: !1,
        enabled: !0,
        formater: function(a) {
            return a
        }
    };
    c.fn.slider.Constructor = b
})(window.jQuery);
var wcwidth = function(c) {
    var g = [
        [768, 879],
        [1155, 1158],
        [1160, 1161],
        [1425, 1469],
        [1471, 1471],
        [1473, 1474],
        [1476, 1477],
        [1479, 1479],
        [1536, 1539],
        [1552, 1557],
        [1611, 1630],
        [1648, 1648],
        [1750, 1764],
        [1767, 1768],
        [1770, 1773],
        [1807, 1807],
        [1809, 1809],
        [1840, 1866],
        [1958, 1968],
        [2027, 2035],
        [2305, 2306],
        [2364, 2364],
        [2369, 2376],
        [2381, 2381],
        [2385, 2388],
        [2402, 2403],
        [2433, 2433],
        [2492, 2492],
        [2497, 2500],
        [2509, 2509],
        [2530, 2531],
        [2561, 2562],
        [2620, 2620],
        [2625, 2626],
        [2631, 2632],
        [2635, 2637],
        [2672, 2673],
        [2689, 2690],
        [2748, 2748],
        [2753,
            2757
        ],
        [2759, 2760],
        [2765, 2765],
        [2786, 2787],
        [2817, 2817],
        [2876, 2876],
        [2879, 2879],
        [2881, 2883],
        [2893, 2893],
        [2902, 2902],
        [2946, 2946],
        [3008, 3008],
        [3021, 3021],
        [3134, 3136],
        [3142, 3144],
        [3146, 3149],
        [3157, 3158],
        [3260, 3260],
        [3263, 3263],
        [3270, 3270],
        [3276, 3277],
        [3298, 3299],
        [3393, 3395],
        [3405, 3405],
        [3530, 3530],
        [3538, 3540],
        [3542, 3542],
        [3633, 3633],
        [3636, 3642],
        [3655, 3662],
        [3761, 3761],
        [3764, 3769],
        [3771, 3772],
        [3784, 3789],
        [3864, 3865],
        [3893, 3893],
        [3895, 3895],
        [3897, 3897],
        [3953, 3966],
        [3968, 3972],
        [3974, 3975],
        [3984, 3991],
        [3993,
            4028
        ],
        [4038, 4038],
        [4141, 4144],
        [4146, 4146],
        [4150, 4151],
        [4153, 4153],
        [4184, 4185],
        [4448, 4607],
        [4959, 4959],
        [5906, 5908],
        [5938, 5940],
        [5970, 5971],
        [6002, 6003],
        [6068, 6069],
        [6071, 6077],
        [6086, 6086],
        [6089, 6099],
        [6109, 6109],
        [6155, 6157],
        [6313, 6313],
        [6432, 6434],
        [6439, 6440],
        [6450, 6450],
        [6457, 6459],
        [6679, 6680],
        [6912, 6915],
        [6964, 6964],
        [6966, 6970],
        [6972, 6972],
        [6978, 6978],
        [7019, 7027],
        [7616, 7626],
        [7678, 7679],
        [8203, 8207],
        [8234, 8238],
        [8288, 8291],
        [8298, 8303],
        [8400, 8431],
        [12330, 12335],
        [12441, 12442],
        [43014, 43014],
        [43019, 43019],
        [43045, 43046],
        [64286, 64286],
        [65024, 65039],
        [65056, 65059],
        [65279, 65279],
        [65529, 65531],
        [68097, 68099],
        [68101, 68102],
        [68108, 68111],
        [68152, 68154],
        [68159, 68159],
        [119143, 119145],
        [119155, 119170],
        [119173, 119179],
        [119210, 119213],
        [119362, 119364],
        [917505, 917505],
        [917536, 917631],
        [917760, 917999]
    ];
    jQuery.extend(c, {
        nul: 0,
        control: -1,
        monkeypatch: !0
    });
    var e = function(b) {
        if (0 === b) return c.nul;
        if (32 > b || 127 <= b && 160 > b) return c.control;
        var d;
        a: {
            d = 0;
            var a = g.length - 1,
                e;
            if (!(b < g[0][0] || b > g[a][1]))
                for (; a >= d;)
                    if (e = Math.floor((d +
                            a) / 2), b > g[e][1]) d = e + 1;
                    else if (b < g[e][0]) a = e - 1;
            else {
                d = !0;
                break a
            }
            d = !1
        }
        return d ? 0 : 1 + (4352 <= b && (4447 >= b || 9001 == b || 9002 == b || 11904 <= b && 42191 >= b && 12351 != b || 44032 <= b && 55203 >= b || 63744 <= b && 64255 >= b || 65040 <= b && 65049 >= b || 65072 <= b && 65135 >= b || 65280 <= b && 65376 >= b || 65504 <= b && 65510 >= b || 131072 <= b && 196605 >= b || 196608 <= b && 262141 >= b))
    };
    return function(b) {
        var c, a, f, g = 0;
        if ("string" == typeof b || b instanceof String)
            for (c = 0, a = b.length; c < a; c++) {
                if (0 > (f = e(b.charCodeAt(c)))) return -1;
                g += f
            } else g = e(b);
        return g
    }
}();
Array.max = function(c) {
    return Math.max.apply(Math, c)
};
Array.prototype.map || (Array.prototype.map = function(c) {
    if (void 0 === this || null === this) throw new TypeError;
    var g = Object(this),
        e = g.length >>> 0;
    if ("function" !== typeof c) throw new TypeError;
    for (var b = Array(e), d = 2 <= arguments.length ? arguments[1] : void 0, a = 0; a < e; a++) a in g && (b[a] = c.call(d, g[a], a, g));
    return b
});
Array.prototype.indexOf || (Array.prototype.indexOf = function(c, g) {
    if (void 0 === this || null === this) throw new TypeError('"this" is null or not defined');
    var e = this.length >>> 0;
    g = +g || 0;
    Infinity === Math.abs(g) && (g = 0);
    0 > g && (g += e, 0 > g && (g = 0));
    for (; g < e; g++)
        if (this[g] === c) return g;
    return -1
});
Array.prototype.diff = function(c) {
    return this.filter(function(g) {
        return 0 > c.indexOf(g)
    })
};
var htmlEncode = function() {
        function c(c) {
            return g[c] || c
        }
        var g = {
            "&": "&amp;",
            "<": "&lt;",
            ">": "&gt;"
        };
        return function(e) {
            return e.replace(/[&<>]/g, c)
        }
    }(),
    htmlDecode = function() {
        var c = $("<div>");
        return function(g) {
            return g ? c.html(g).text() : ""
        }
    }();

function textToHTML(c) {
    return c.split("\n").map(htmlEncode).join("<br>")
}
var Utils = Utils || {};
(function() {
    function c(b, c) {
        for (var a = [], e = 0; e < c; ++e) a.push(b);
        return a
    }

    function g(b, c) {
        var a = "",
            e = !0;
        c = c || "";
        for (var g = 0; g < b.length; ++g) e ? e = !1 : a += c, a += b[g];
        return a
    }

    function e(b) {
        if (void 0 == b) return "";
        var c = [],
            a;
        for (a in b)
            if (b.hasOwnProperty(a)) {
                var e = b[a];
                void 0 != e ? c.push(a.toString() + '="' + e.toString() + '"') : c.push(a.toString())
            }
        return 0 < c.length ? " " + c.join(" ") : ""
    }
    window.console || (window.console = {});
    window.console.log || (window.console.log = function() {});
    Utils.range = function(b, c, a) {
        var e = [];
        b = parseInt(b);
        if (!isNaN(b))
            if (void 0 == c && (c = b, b = 0), void 0 == a && (a = 1), 0 < a)
                for (; b < c; b += a) e.push(b);
            else if (0 > a)
            for (; b > c; b += a) e.push(b);
        return e
    };
    Utils.repeat = c;
    Utils.join = g;
    Utils.ljust = function(b, d) {
        var a = Math.max(0, d - b.length);
        return b + g(c(" ", a))
    };
    Utils.freq_call_filter = function(b, c) {
        var a = (new Date).getTime();
        return function() {
            var e = (new Date).getTime(),
                g = e - a;
            a = e;
            g > c && b.apply(null, arguments)
        }
    };
    Utils.select_text = function(b) {
        var c = document;
        b = c.getElementById(b);
        var a;
        c.body.createTextRange ? (c = c.body.createTextRange(),
            c.moveToElementText(b), c.select()) : window.getSelection && (a = window.getSelection(), c = c.createRange(), c.selectNodeContents(b), a.removeAllRanges(), a.addRange(c))
    };
    Utils.format_attr = e;
    Utils.format_tag = function(b, c, a) {
        return "<" + b + e(a) + ">" + c + "</" + b + ">"
    }
})();
(function(c) {
    c.fn.jqPaste = function(c, e) {
        var b = this;
        b.on("paste", function() {
            if (!e || 0 != e()) {
                var d = b.html();
                b.hide();
                window.setTimeout(function() {
                    var a = b.html();
                    b.html(d);
                    b.show();
                    c && c(a)
                }, 5)
            }
        })
    }
})(jQuery);
var PasteHelper = function() {
    function c(e) {
        e = e || 1;
        b = window.setTimeout(function() {
            if (a.is(":empty")) 16 > e && c(2 * e);
            else {
                var k = a.html();
                a.html("").hide();
                b = null;
                window.scrollTo(d.left, d.top);
                g && (g(k), g = null)
            }
        }, e)
    }
    var g = null,
        e = !1,
        b = null,
        d = null,
        a = $("<div>", {
            contenteditable: !0
        });
    a.css({
        position: "absolute",
        left: "0px",
        top: "0px",
        width: "1px",
        height: "1x",
        overflow: "hidden",
        "user-select": "text"
    });
    a.on("paste", function() {
        c(3)
    });
    return {
        start: function(c, k) {
            g = c;
            e || (a.appendTo($("body")), e = !0);
            d = {
                left: window.scrollX,
                top: window.scrollY
            };
            a.css({
                left: window.scrollX + "px",
                top: window.scrollY + "px"
            });
            null != b && window.clearTimeout(b);
            a.show();
            a.focus()
        }
    }
}();
var TableImport = TableImport || {};
(function() {
    function c(c) {
        var b = [];
        $(c).find("tr").each(function(c, a) {
            var e = [];
            $(a).find("td,th").each(function(a, b) {
                e.push(b.textContent)
            });
            b.push(e)
        });
        return b
    }

    function g(c) {
        var b = [];
        c = c.trim();
        if (/<\w+[^>]*>/gi.test(c)) try {
            c = $(c).text()
        } catch (d) {
            c = c.replace(/(<([^>]+)>)/ig, "")
        }
        0 < c.length && (b = c.trim().split(/\s{2,}\t*|\t\s*/));
        return b
    }
    TableImport.extractTableFromString = function(e) {
        e = e.trim();
        if (-1 != e.search(/<table /i)) {
            if (e = $(e).filter("table").first()) return c(e)
        } else {
            e = $("<div>" + e + "</div>");
            var b = [];
            0 < e.find("div").length ? e.find("div").each(function(a, c) {
                b.push($(c).text())
            }) : (e = e.html(), e = e.replace(/<br\/?>/ig, "\n"), e = e.replace(/&nbsp;/g, " "), b = e.split(/\n/g));
            var d = [];
            b.forEach(function(a) {
                a = g(a);
                0 < a.length && d.push(a)
            });
            return d
        }
        return null
    };
    TableImport.extractCellsFromString = g
})();
var TableModel = function() {
    function c(c) {
        this.value_ = c || "";
        this.rowspan_ = this.colspan_ = 1;
        $.observable(this)
    }

    function g() {
        this.rows = [];
        this.col_count = this.row_count = 0;
        $.observable(this)
    }
    c.prototype.value = function() {
        if (0 < arguments.length) {
            var c = this.value_;
            this.value_ = arguments[0];
            this.trigger("value_change", this.value_, c);
            return c
        }
        return this.value_
    };
    c.prototype.colspan = function(c) {
        if (0 < arguments.length) {
            var b = this.colspan_;
            this.colspan_ = arguments[0];
            this.trigger("colspan_change", this.colspan_, b);
            return b
        }
        return this.colspan_
    };
    c.prototype.rowspan = function(c) {
        if (0 < arguments.length) {
            var b = this.rowspan_;
            this.rowspan_ = arguments[0];
            this.trigger("rowspan_change", this.rowspan_, b);
            return b
        }
        return this.rowspan_
    };
    c.create = function(e) {
        var b = new c;
        b.value(e);
        return b
    };
    c.prototype.isVisible = function() {
        return 0 < this.colspan() && 0 < this.rowspan()
    };
    c.prototype.dump = function() {
        return {
            value: this.value(),
            cspan: this.colspan(),
            rspan: this.rowspan()
        }
    };
    c.prototype.load = function(c, b) {
        this.value(c.value);
        b.colspan || this.colspan(c.cspan);
        b.rowspan ||
            this.rowspan(c.rspan)
    };
    g.prototype.dump = function() {
        var c = [];
        this.rows.forEach(function(b, d) {
            var a = b.map(function(a) {
                return a.dump()
            });
            c.push(a)
        });
        return {
            rows: c
        }
    };
    g.prototype.load = function(c, b) {
        if (!c || !c.rows) throw "Invalid data format: rows expexted";
        var d = c.rows,
            a = d[0].length;
        this.resize(1, a);
        for (var f = 0; f < d.length; ++f) {
            this.row_count <= f && this.insertEmptyRow();
            for (var g = d[f], n = this.rows[f], p = 0; p < a; ++p) n[p].load(g[p], b)
        }
    };
    g.prototype.insertRow = function(e, b) {
        if (0 != this.col_count && e.length != this.col_count) throw Error("Invalid number of cells in cells_data");
        void 0 == b && (b = this.row_count);
        if (b < this.row_count)
            for (var d = this.col_count - 1; 0 <= d; --d) this.splitCell(b, d);
        for (var a = [], d = 0, f = e.length; d < f; ++d) a.push(new c(e[d]));
        this.rows.splice(b, 0, a);
        this.row_count += 1;
        this.col_count = a.length;
        this.trigger("row_inserted", b, a);
        this.trigger("state_change")
    };
    g.prototype.insertColumn = function(e, b) {
        if (0 != this.row_count && e.length != this.row_count) throw Error("Invalid number of cells in inserted column");
        void 0 == b && (b = this.col_count);
        if (b < this.col_count)
            for (var d = this.row_count -
                    1; 0 <= d; --d) this.splitCell(d, b);
        var a = [];
        this.rows.forEach(function(d, g) {
            var n = new c(e[g]);
            d.splice(b, 0, n);
            a.push(n)
        });
        this.col_count += 1;
        this.row_count = e.length;
        this.trigger("column_inserted", b, a);
        this.trigger("state_change")
    };
    g.prototype.insertEmptyColumn = function(c) {
        var b = this.rows.map(function() {
            return ""
        });
        this.insertColumn(b, c)
    };
    g.prototype.insertEmptyRow = function(c) {
        for (var b = [], d = 0, a = this.rows[0].length; d < a; ++d) b.push("");
        this.insertRow(b, c)
    };
    g.prototype.removeRow = function(c) {
        if (0 > c || c >= this.row_count) throw Error("Index out of bounds: " +
            c);
        if (1 != this.row_count) {
            for (var b = this.col_count - 1; 0 <= b; --b) this.splitCell(c, b);
            b = this.rows[c];
            this.rows.splice(c, 1);
            this.row_count -= 1;
            this.trigger("row_removed", c, b);
            this.trigger("state_change")
        }
    };
    g.prototype.removeColumn = function(c) {
        if (0 > c || c >= this.col_count) throw Error("Index out of bounds: " + c);
        if (1 != this.col_count) {
            for (var b = [], d = this.row_count - 1; 0 <= d; --d) {
                this.splitCell(d, c);
                var a = this.rows[d];
                b.push(a[c]);
                a.splice(c, 1)
            }
            this.col_count -= 1;
            this.trigger("column_removed", c, b);
            this.trigger("state_change")
        }
    };
    g.prototype.forEachCellInRow = function(c, b) {
        if (0 > c || c >= this.row_count) throw Error("Index out of bounds: " + c);
        this.rows[c].forEach(b)
    };
    g.prototype.forEachCellInColumn = function(c, b) {
        if (0 > c || c >= this.col_count) throw Error("Index out of bounds: " + c);
        for (var d = 0; d < this.row_count; ++d) b(this.rows[d][c], d)
    };
    g.prototype.forEachCellInRange = function(c, b, d, a, f) {
        for (; c <= d; ++c)
            for (var g = this.rows[c], n = b; n <= a; ++n) f(g[n], c, n)
    };
    g.prototype.forEachCell = function(c) {
        this.forEachCellInRange(0, 0, this.row_count - 1, this.col_count -
            1, c)
    };
    g.prototype.getVisibleCellPos = function(c, b) {
        var d = this.getCell(c, b, !0);
        0 > d.rowspan() && (c += d.rowspan());
        0 > d.colspan() && (b += d.colspan());
        return {
            row: c,
            col: b
        }
    };
    g.prototype.getColumn = function(c) {
        var b = [];
        this.forEachCellInColumn(c, function(c) {
            b.push(c)
        });
        return b
    };
    g.prototype.getCell = function(c, b, d) {
        if (0 > c || c >= this.row_count) throw Error("Row index out of bounds: " + c);
        if (0 > b || b >= this.col_count) throw Error("Index out of bounds: " + b);
        var a = this.rows[c][b];
        a.isVisible() || d || (a = this.rows[c + Math.min(a.rowspan(),
            0)][b + Math.min(a.colspan(), 0)]);
        return a
    };
    g.prototype.mergeCells = function(c, b, d, a) {
        var f = a - b + 1,
            g = d - c + 1;
        if (!(1 >= f && 1 >= g)) {
            for (var n = c; n <= d; ++n) {
                for (var p = b; p <= a; ++p) this.splitCell(n, p);
                for (var m = this.rows[n], p = b; p <= a; ++p) {
                    var q = m[p];
                    p == b ? q.colspan(f) : q.colspan(b - p);
                    n == c ? q.rowspan(g) : q.rowspan(c - n)
                }
            }
            this.trigger("state_change")
        }
    };
    g.prototype.splitCell = function(c, b) {
        var d = this.rows[c][b],
            a = d.colspan(),
            f = d.rowspan();
        if (0 > a || 0 > f) 0 > a && (b += a), 0 > f && (c += f), this.splitCell(c, b);
        else if (1 < a || 1 < f)
            for (var g = c; g <
                c + f; ++g)
                for (var n = b; n < b + a; ++n) d = this.rows[g][n], d.colspan(1), d.rowspan(1);
        this.trigger("state_change")
    };
    g.prototype.resize = function(c, b) {
        void 0 == c && (c = this.row_count);
        void 0 == b && (b = this.col_count);
        if (0 >= b || 0 >= c) throw Error("Illegal arguments - row_count: " + c + " col_count: " + b);
        var d = {
                row_count: this.row_count,
                col_count: this.col_count
            },
            a = {
                row_count: c,
                col_count: b
            };
        this.trigger("before_resize", d, a);
        var f = b - this.col_count;
        if (0 < f)
            for (var g = 0; g < f; ++g) this.insertEmptyColumn();
        else if (0 > f)
            for (g = 0; g < -f; ++g) this.removeColumn(this.col_count -
                1);
        f = c - this.row_count;
        if (0 < f)
            for (g = 0; g < f; ++g) this.insertEmptyRow();
        else if (0 > f)
            for (g = 0; g < -f; ++g) this.removeRow(this.row_count - 1);
        this.trigger("after_resize", d, a)
    };
    g.prototype.toString = function() {
        return this.rows.map(function(c) {
            return c.map(function(b) {
                return b.value()
            }).join(", ")
        }).join("\n")
    };
    g.prototype.clear = function() {
        this.rows.forEach(function(c) {
            c.forEach(function(b) {
                b.value("")
            })
        });
        this.trigger("state_change")
    };
    g.prototype.reset = function() {
        for (var c = 0; c < this.row_count; ++c)
            for (var b = 0; b < this.col_count; ++b) this.splitCell(c,
                b);
        this.clear()
    };
    g.prototype.setRows = function(c) {
        var b = 0;
        c.forEach(function(a) {
            b = Math.max(b, a.length)
        });
        this.resize(1, b);
        var d = this;
        c.forEach(function(a) {
            d.insertRow(a)
        });
        this.removeRow(0)
    };
    return g
}();
var CellStyle = function() {
    function c(g) {
        this.cell_dom = g;
        this.borders = "";
        this.font_style = {};
        this.bg_color = this.text_color = "";
        this.padding = $.extend({}, c.Padding);
        c.Padding && this.cell_dom.find(".wrap > div").css("margin", c.Padding.top + "px " + c.Padding.right + "px");
        $.observable(this)
    }
    c.FontFamilies = {
        "ff-arial-black": '"Arial Black", Gadget, sans-serif !important;',
        "ff-arial": "Arial, Helvetica, sans-serif !important;",
        "ff-comic-sans-ms": '"Comic Sans MS", cursive, sans-serif !important;',
        "ff-courier-new": '"Courier New", Courier, monospace !important;',
        "ff-georgia": "Georgia, serif !important;",
        "ff-impact": "Impact, Charcoal, sans-serif !important;",
        "ff-lucida-console": '"Lucida Console", Monaco, monospace !important;',
        "ff-lucida-sans": '"Lucida Sans Unicode", "Lucida Grande", sans-serif !important;',
        "ff-palatino-linotype": '"Palatino Linotype", "Book Antiqua", Palatino, serif !important;',
        "ff-serif": "serif !important;",
        "ff-tahoma": "Tahoma, Geneva, sans-serif !important;",
        "ff-times-new-roman": '"Times New Roman", Times, serif !important;',
        "ff-trebuchet-ms": '"Trebuchet MS", Helvetica, sans-serif !important;',
        "ff-verdana": "Verdana, Geneva, sans-serif !important;"
    };
    c.Padding = {
        top: 10,
        bottom: 10,
        left: 5,
        right: 5
    };
    c.prototype.dump = function() {
        return {
            borders: this.borders,
            font_style: $.extend({}, this.font_style),
            text_color: this.text_color,
            bg_color: this.bg_color,
            halign: this.getHorizontalAlign(),
            padding: $.extend({}, this.getPadding())
        }
    };
    c.prototype.toCSS = function() {
        var c = {};
        $.extend(c, this.fontStyleToCSS());
        $.extend(c, this.colorsToCSS());
        $.extend(c, this.textAlignToCSS());
        return c
    };
    c.prototype.load = function(c, e) {
        void 0 ==
            c.borders || e.borders || this.setBorders(c.borders);
        var b = c.font_style;
        if (void 0 != b && !e.font_style) {
            for (var d in this.font_style) this.font_style.hasOwnProperty(d) && this.removeFontStyle(d);
            for (d in b) b.hasOwnProperty(d) && this.addFontStyle(d, b[d])
        }
        void 0 == c.text_color || e.text_color || this.setTextColor(c.text_color);
        void 0 == c.bg_color || e.bg_color || this.setBgColor(c.bg_color);
        void 0 != c.halign && this.setHorizontalAlign(c.halign);
        b = c.padding;
        void 0 != b && b.hasOwnProperty("top") && b.hasOwnProperty("right") && this.setPadding(b.top,
            b.right)
    };
    c.prototype.setHorizontalAlign = function(c) {
        this.cell_dom.css("text-align", c);
        this.trigger("state_change")
    };
    c.HorizontalAlignValues = ["left", "center", "right"];
    c.prototype.getHorizontalAlign = function() {
        var g = this.cell_dom.css("text-align"),
            g = Math.max(0, c.HorizontalAlignValues.indexOf(g));
        return c.HorizontalAlignValues[g]
    };
    c.prototype.textAlignToCSS = function() {
        var c = {},
            e = this.getHorizontalAlign();
        "left" != e && (c["text-align"] = e);
        return c
    };
    c.prototype.hasTextColor = function() {
        return this.text_color &&
            "transparent" != this.text_color
    };
    c.prototype.setTextColor = function(c) {
        "transparent" == c && (c = "");
        this.text_color = c;
        this.cell_dom.css("color", c);
        this.trigger("state_change")
    };
    c.prototype.getTextColor = function() {
        return this.text_color
    };
    c.prototype.setPadding = function(g, e, b, d) {
        void 0 == e && (e = g);
        void 0 == b && (b = g);
        void 0 == d && (d = e);
        this.padding = {
            top: g,
            right: e,
            bottom: b,
            left: d
        };
        b = c.Padding;
        JSON.stringify(this.padding) !== JSON.stringify(b) && (c.Padding = this.padding, this.cell_dom.parents("table").find(".wrap > div").css("margin",
            g + "px " + e + "px"), this.trigger("state_change"), this.trigger("padding_change", this.padding))
    };
    c.prototype.clearPadding = function() {
        this.setPadding(10, 5, 10, 5)
    };
    c.prototype.getPadding = function() {
        return this.padding
    };
    c.prototype.clearTextColor = function() {
        this.cell_dom.css("color", "");
        this.text_color = "";
        this.trigger("state_change")
    };
    c.prototype.setBgColor = function(c) {
        "transparent" == c && (c = "");
        this.bg_color = c;
        this.cell_dom.css("background-color", c);
        this.trigger("state_change")
    };
    c.prototype.getBgColor = function() {
        return this.bg_color
    };
    c.prototype.hasBgColor = function() {
        return this.bg_color && "transparent" != this.bg_color
    };
    c.prototype.clearBgColor = function() {
        this.cell_dom.css("background-color", "");
        this.bg_color = "";
        this.trigger("state_change")
    };
    c.prototype.colorsToCSS = function() {
        var c = {};
        this.bg_color && "transparent" != this.bg_color && (c["background-color"] = this.bg_color);
        this.text_color && "transparent" != this.text_color && (c.color = this.text_color);
        return c
    };
    c.prototype.setBorders = function(c) {
        if (!(0 < c.length) || c.match(/^[ltrb]+$/)) {
            var e = {
                    l: "border_l",
                    t: "border_t",
                    r: "border_r",
                    b: "border_b"
                },
                b = this;
            b.borders.split("").forEach(function(c) {
                b.cell_dom.removeClass(e[c])
            });
            b.borders = c;
            b.borders.split("").forEach(function(c) {
                b.cell_dom.addClass(e[c])
            });
            this.trigger("state_change")
        }
    };
    c.prototype.addBorder = function(c) {
        c = c[0]; - 1 == this.borders.indexOf(c) && (this.borders += c, this.cell_dom.addClass("border_" + c));
        this.trigger("state_change")
    };
    c.prototype.removeBorder = function(c) {
        c = c[0]; - 1 != this.borders.indexOf(c) && (this.borders = this.borders.replace(c,
            ""), this.cell_dom.removeClass("border_" + c));
        this.trigger("state_change")
    };
    c.prototype.hasBorder = function(c) {
        return -1 != this.borders.indexOf(c[0])
    };
    c.prototype.toggleBorder = function(c) {
        0 < c.length && !c.match(/^[ltrb]+$/) || (-1 != this.borders.indexOf(c) ? this.setBorders(this.borders.replace(c, "")) : this.setBorders(this.borders + c))
    };
    c.prototype.reset = function() {
        this.setHorizontalAlign("left");
        this.setBorders("");
        for (var c in this.font_style) this.removeFontStyle(c);
        this.clearTextColor();
        this.clearBgColor();
        this.clearPadding()
    };
    c.prototype.addFontStyle = function(c, e) {
        "bold" == c ? this.cell_dom.css("font-weight", "bold") : "italic" == c && this.cell_dom.css("font-style", "italic");
        if ("font-family" == c) {
            var b = this.font_style["font-family"];
            b && this.cell_dom.removeClass(b);
            this.cell_dom.addClass(e)
        } else "font-size" == c && ("inherit" == e ? this.cell_dom.css("font-size", "100%") : this.cell_dom.css("font-size", e));
        this.font_style[c] = e || !0;
        this.trigger("state_change")
    };
    c.prototype.fontStyleToCSS = function() {
        var g = {},
            e = this.font_style;
        e.hasOwnProperty("bold") && (g["font-weight"] = "bold");
        e.hasOwnProperty("italic") && (g["font-style"] = "italic");
        e.hasOwnProperty("font-size") && (g["font-size"] = "inherit" == e["font-size"] ? "100%" : e["font-size"]);
        e.hasOwnProperty("font-family") && (g["font-family"] = c.FontFamilies[e["font-family"]]);
        return g
    };
    c.prototype.hasFontStyle = function(c) {
        return this.font_style.hasOwnProperty(c)
    };
    c.prototype.removeFontStyle = function(c) {
        this.hasFontStyle(c) && (delete this.font_style[c], "bold" == c ? this.cell_dom.css("font-weight",
            "normal") : "italic" == c && this.cell_dom.css("font-style", "normal"));
        this.trigger("state_change")
    };
    c.prototype.toggleFontStyle = function(c) {
        this.hasFontStyle(c) ? this.removeFontStyle(c) : this.addFontStyle(c)
    };
    return c
}();
(function(c, g, e, b) {
    c.fn.borderEvents = function(b) {
        return this.each(function(a, e) {
            function g(a) {
                if (!b.deactivated && b.onBorderOver) {
                    var c = m.outerWidth(),
                        e = m.outerHeight(),
                        f = m.offset(),
                        k = a.pageX - f.left,
                        f = a.pageY - f.top,
                        n = null;
                    5 > k ? n = "left" : k > c - 5 ? n = "right" : 5 > f ? n = "top" : f > e - 5 && (n = "bottom");
                    if (b.onBorderLeave && q && n != q) b.onBorderLeave(a, q, m);
                    if (n) b.onBorderOver(a, n, m);
                    q = n
                }
            }

            function n(a) {
                if (b.onBorderLeave && q) b.onBorderLeave(a, q, m);
                q = null
            }

            function p(a) {
                if (!b.deactivated && q && b.onBorderClick) b.onBorderClick(a,
                    q, m)
            }
            var m = c(e),
                q = null;
            1 != m.data("borderEvents") && (m.mousemove(g).mouseleave(n).click(p), m.data("borderEvents", !0))
        })
    }
})(jQuery);
var TableView = function() {
    function c() {
        var a = window.navigator.userAgent,
            b = a.indexOf("MSIE ");
        return 0 < b || navigator.userAgent.match(/Trident.*rv\:11\./) ? -1 != a.indexOf(".", b) ? parseInt(a.substring(b + 5, a.indexOf(".", b))) : 1 : null
    }

    function g(a) {
        var b = this;
        b.cell = a;
        b.edit_in_progress = !1;
        b.ignore_model_change = !1;
        b.event_handlers_initialized = !1;
        var c = document.createElement("DIV");
        c.innerHTML = textToHTML(a.value());
        b.entry = $(c);
        c = $("<div>", {
            "class": "wrap"
        });
        b.entry.appendTo(c);
        b.dom = $(document.createElement("TD"));
        c.appendTo(b.dom);
        $.observable(this);
        b.entry.on("paste", function(a) {
            b.onPasteContent(a)
        });
        a.on("value_change", function(a) {
            b.ignore_model_change || b.entry.html(textToHTML(a));
            b.trigger("state_change")
        });
        a.on("colspan_change", function(a) {
            0 < a && b.dom.attr("colspan", a);
            b.show()
        });
        a.on("rowspan_change", function(a) {
            0 < a && b.dom.attr("rowspan", a);
            b.show()
        });
        b.style = new CellStyle(this.dom);
        b.style.on("state_change", function() {
            b.trigger("state_change")
        })
    }

    function e() {
        if (window.getSelection) {
            var a = window.getSelection();
            0 < a.rangeCount && a.getRangeAt(0).collapse(!0)
        }
    }

    function b(a, b) {
        this.type = a;
        this.dom = $("<td>").addClass("aux-cell").addClass("aux-cell-" + a);
        this.index_view = $("<span>").appendTo(this.dom);
        this.size_handle = null;
        "column" == a && (this.size_handle = $("<div>").addClass("size-handle").appendTo(this.dom), this.size_handle.present("SimpleDraggable"), this.draggable = this.size_handle.data("SimpleDraggable"));
        this.index = -1;
        $.observable(this);
        this.setIndex(b)
    }

    function d(a, d, k) {
        function n(a) {
            if (!s.isBorderEditEnabled()) {
                var b =
                    a.target.nodeName;
                if (9 == a.which) la(), a.preventDefault();
                else if (37 <= a.which && 40 >= a.which) {
                    var c = !1;
                    s.forEachSelectedCellView(function(a) {
                        c |= a.edit_in_progress
                    });
                    c || (b = {
                        37: [0, -1],
                        38: [-1, 0],
                        39: [0, 1],
                        40: [1, 0]
                    }[a.which], Ba(b[0], b[1]), a.preventDefault())
                } else 13 == a.which ? (b = U(), G() && !b.edit_in_progress && (b.startEditing(), a.preventDefault())) : 86 == a.which && a.ctrlKey ? (b = U(), G() && !b.edit_in_progress && PasteHelper.start(Ha, b.dom)) : 46 == a.which ? s.forEachSelectedCellView(function(a) {
                        0 == a.edit_in_progress && a.cell.value("")
                    }) :
                    225 == a.which ? a.preventDefault() : "TABLE" == b && (76 == a.which && a.ctrlKey ? (s.forEachSelectedCellView(function(a) {
                        a.style.setHorizontalAlign("left")
                    }), a.preventDefault()) : 69 == a.which && a.ctrlKey ? (s.forEachSelectedCellView(function(a) {
                        a.style.setHorizontalAlign("center")
                    }), a.preventDefault()) : 82 == a.which && a.ctrlKey ? (s.forEachSelectedCellView(function(a) {
                        a.style.setHorizontalAlign("right")
                    }), a.preventDefault()) : G() && !a.ctrlKey && 27 != a.which && 16 != a.which && 18 != a.which && 91 != a.which && s.forEachSelectedCellView(function(a) {
                        a.startEditing(!0)
                    }))
            }
        }

        function p() {
            s.trigger("state_change")
        }

        function m(a) {
            a = new g(a);
            a.on("state_change", p);
            s.trigger("cell_created", a);
            return a
        }

        function q(a, b, c, d, e) {
            void 0 == d && (d = s.model.row_count - 1);
            var f = s.model.getVisibleCellPos(b, c),
                g = s.model.getCell(b, c);
            f.row == b && f.row + g.rowspan() - 1 <= d && ("right" == a && f.col + g.colspan() - 1 == c || "left" == a && f.col == c) && (e ? s.getCellView(f.row, f.col).style.addBorder(a) : s.getCellView(f.row, f.col).style.removeBorder(a))
        }

        function t(a, b, c, d, e) {
            void 0 == d && (d = s.model.col_count - 1);
            var f = s.model.getVisibleCellPos(b,
                    c),
                g = s.model.getCell(b, c);
            f.col == c && f.col + g.colspan() - 1 <= d && ("top" == a && f.row == b || "bottom" == a && f.row + g.rowspan() - 1 == b) && (e ? s.getCellView(f.row, f.col).style.addBorder(a) : s.getCellView(f.row, f.col).style.removeBorder(a))
        }

        function x() {
            var a = $("<tr>");
            a.append(B("corner"));
            s.aux_row = a;
            for (var b = 1; b <= s.model.col_count; ++b) B("column");
            s.dom.append(a)
        }

        function B(a, c) {
            var d = null;
            if ("row" == a) void 0 == c && (c = s.model.row_count), s.aux_cells.forEach(function(a) {
                a.onInsertRow(c)
            }), d = new b(a, c), d.dom.mousedown(function(a) {
                if (!d.dom.hasClass("aux-cell-selected") ||
                    1 == a.which) {
                    var b = R(d.dom).row;
                    y(b, 0, b, s.model.col_count - 1, a.ctrlKey)
                }
            }), s.aux_col_cells.splice(c, 0, d);
            else if ("column" == a) {
                if (null == s.aux_row) return;
                void 0 == c && (c = s.aux_row.find("td").length - 1);
                s.aux_cells.forEach(function(a) {
                    a.onInsertColumn(c)
                });
                d = new b(a, c);
                d.dom.mousedown(function(a) {
                    if (!d.dom.hasClass("aux-cell-selected") || 1 == a.which) {
                        var b = R(d.dom).col;
                        y(0, b, s.model.row_count - 1, b, a.ctrlKey)
                    }
                });
                s.aux_row.find("td").eq(c).after(d.dom);
                s.aux_row_cells.splice(c, 0, d);
                if (s.column_resize_enabled) d.draggable.on("drag_start",
                    function(a, b) {
                        var c = d;
                        s.enableFixedLayout(!0);
                        var e = c.dom.offset();
                        s.aux_row_cells.indexOf(c);
                        var f = c.size_handle.width();
                        s.drag_start_pos = b;
                        c.draggable.setBounds({
                            left: e.left + 20 - f + 1,
                            right: e.left + 1E3
                        });
                        null == s.size_indicator && (s.size_indicator = $("<div>").addClass("size-tip").appendTo($("body")));
                        c.size_handle.addClass("size-indicator").css({
                            height: s.dom.height()
                        })
                    }).on("drag_end", function(a) {
                    a = d;
                    if (void 0 !== s.drag_start_pos) {
                        var b = a.size_handle.offset().left - s.drag_start_pos.left,
                            c = s.aux_row_cells.indexOf(a),
                            e = s.getColumnWidths(!0)[c + 1],
                            b = Math.max(1, e + b);
                        s.setSingleColumnWidth(c, b);
                        a.size_handle.css({
                            position: "relative",
                            top: 0,
                            height: 20,
                            left: 0
                        }).removeClass("size-indicator");
                        s.size_indicator.hide()
                    }
                }).on("drag_move", function(a, b) {
                    var c = d,
                        c = c.size_handle.offset().left - s.drag_start_pos.left + c.dom.width();
                    s.size_indicator.text(c + "px").offset({
                        left: b.left - s.size_indicator.width() / 2,
                        top: b.top - s.size_indicator.height() - 5
                    }).show()
                })
            } else "corner" == a && (d = new b(a), d.dom.mousedown(function() {
                y(0, 0, s.model.row_count -
                    1, s.model.col_count - 1)
            }));
            var e = $("<col>");
            s.hasFixedLayout() && (e.width(20), s.dom.width(s.dom.width() + 20));
            "corner" == a ? s.colgroup.append(e) : "column" == a && s.colgroup.find("col").eq(c).after(e);
            return null != d ? (s.aux_cells.push(d), d.dom) : null
        }

        function v(a, b) {
            var c = null;
            s.aux_cells.forEach(function(d) {
                d.type == a && d.index == b && (c = d)
            });
            "row" == a ? (s.aux_cells.forEach(function(a) {
                a.onRemoveRow(b)
            }), s.aux_col_cells.splice(b, 1)) : "column" == a && (s.aux_cells.forEach(function(a) {
                a.onRemoveColumn(b)
            }), s.aux_row.find("td").eq(b +
                1).remove(), s.aux_row_cells.splice(b, 1));
            if (null != c) {
                var d = 0,
                    e = s.dom.width();
                "column" == a ? (d = s.colgroup.find("col").eq(b + 1).width(), s.colgroup.find("col").eq(b + 1).remove()) : "corner" == a && (d = s.colgroup.find("col").eq(0).width(), s.colgroup.find("col").eq(0).remove());
                var f = s.aux_cells.indexOf(c); - 1 != f && s.aux_cells.splice(f, 1);
                s.hasFixedLayout() && s.dom.css("width", e - d - 1)
            }
        }

        function C(a, b) {
            null == s.aux_row && x();
            var c = $("<tr>"),
                d = B("row", a);
            c.append(d);
            b.forEach(function(a) {
                var b = m(a);
                c.append(b.dom);
                a.view =
                    b
            });
            s.dom.find("tr").eq(a).after(c);
            s.selection_bounds = null
        }

        function K(a, b, c) {
            a.view && a.view.select() && (a.view.areEventHandlersInitialized() || a.view.initEventHandlers(), s.selection_bounds = null, s.aux_col_cells[b].dom.addClass("aux-cell-selected"), s.aux_row_cells[c].dom.addClass("aux-cell-selected"), s.trigger("cell_selected", a, b, c))
        }

        function A(a, b, c) {
            a.view.is_selected ? E(a, b, c) : K(a, b, c)
        }

        function y(a, b, d, f, g) {
            if (void 0 == d || d < a) d = a;
            if (void 0 == f || f < b) f = b;
            var k = K;
            g ? k = A : N();
            s.model.forEachCellInRange(a,
                b, d, f, k);
            a = window.scrollX;
            b = window.scrollY;
            s.dom.focus();
            e();
            null === c() && window.scrollTo(a, b)
        }

        function E(a, b, c) {
            if (a.view.unselect()) {
                s.selection_bounds = null;
                var d = !1,
                    e = !1;
                Z(function(a, f, g) {
                    f == b && (d = !0);
                    g == c && (e = !0)
                });
                !d && b < s.aux_col_cells.length && s.aux_col_cells[b].dom.removeClass("aux-cell-selected");
                !e && c < s.aux_row_cells.length && s.aux_row_cells[c].dom.removeClass("aux-cell-selected");
                s.trigger("cell_unselected", a, b, c)
            }
        }

        function N() {
            var a = I();
            a && (s.model.forEachCellInRange(a.top, a.left, a.bottom,
                a.right, E), s.selected_cells = {})
        }

        function I() {
            if (null != s.selection_bounds) return s.selection_bounds;
            var a = s.model.col_count,
                b = -1,
                c = s.model.row_count,
                d = -1;
            s.model.forEachCell(function(e, f, g) {
                1 == e.view.is_selected && (g < a && (a = g), g > b && (b = g), f < c && (c = f), f > d && (d = f))
            });
            return a <= b && c <= d ? (s.selection_bounds = {
                left: a,
                right: b,
                top: c,
                bottom: d
            }, s.selection_bounds) : null
        }

        function Z(a, b) {
            s.model.forEachCell(function(c, d, e) {
                if (1 == c.view.is_selected)
                    if (b)
                        for (var f = d; f < d + c.rowspan(); ++f)
                            for (var g = e; g < e + c.colspan(); ++g) a(s.model.getCell(f,
                                g, !0), f, g);
                    else a(c, d, e)
            })
        }

        function G() {
            var a = I();
            return a && a.left == a.right && a.top == a.bottom
        }

        function P() {
            var a = I(),
                b = null;
            a && s.model.forEachCellInRange(a.top, a.left, a.bottom, a.right, function(a) {
                b = a
            });
            return b
        }

        function U() {
            var a = P();
            return null == a ? null : a.view
        }

        function Ba(a, b) {
            if (G()) {
                var c = I(),
                    d = c.left + b,
                    c = c.top + a;
                0 > d ? (d = s.model.col_count - 1, c -= 1) : d == s.model.col_count && (d = 0, c += 1);
                0 > c ? c = s.model.row_count - 1 : c >= s.model.row_count && (c = 0);
                N();
                K(s.model.getCell(c, d), c, d)
            }
        }

        function R(a) {
            for (a = $(a); void 0 !=
                a && a.get(0) && "td" != a.get(0).nodeName.toLowerCase();) a = a.parent();
            return {
                col: a.index() - 1,
                row: $(a.parent()).index() - 1
            }
        }

        function la() {
            if (G()) {
                s.forEachSelectedCellView(function(a) {
                    a.endEditing()
                });
                var a = I();
                a.left < s.model.col_count - 1 ? Ba(0, 1) : a.bottom < s.model.row_count - 1 ? Ba(1, -s.model.col_count + 1) : (N(), K(0, 0));
                s.forEachSelectedCellView(function(a) {
                    a.startEditing()
                })
            }
        }

        function Ha(a) {
            a = TableImport.extractTableFromString(a);
            var b = I();
            if (a) {
                if (0 == b.left && 0 == b.top && b.left == b.right && b.top == b.bottom) {
                    var c =
                        0;
                    a.forEach(function(a) {
                        c = Math.max(c, a.length)
                    });
                    (a.length > s.model.row_count || c > s.model.col_count) && s.model.resize(Math.max(s.model.row_count, a.length), Math.max(s.model.col_count, c))
                }
                for (var d = 0; d < a.length; ++d)
                    for (var e = a[d], f = 0; f < e.length; ++f)
                        if (d + b.top < s.model.row_count && f + b.left < s.model.col_count) {
                            var g = s.model.getCell(d + b.top, f + b.left, !0);
                            g.isVisible() && g.value(e[f])
                        }
            }
        }

        function J(a, b) {
            a = $(a);
            return a.prop("tagName") == b ? a : a.parents(b)
        }

        function ja(a) {
            s.left_pressed = 1 == a.which;
            var b = J(a.target, "TD");
            if (b && !b.hasClass("aux-cell") && !s.isBorderEditEnabled() && 1 == a.which) {
                var b = R(a.target),
                    c = I();
                G() && c.left == b.col && c.top == b.row || (y(b.row, b.col, b.row, b.col, a.ctrlKey), s.trigger("single_cell_selected", s.model.getCell(b.row, b.col), b.row, b.col))
            }
        }

        function ca(a) {
            var b = J(a.target, "TD");
            if (b && !b.hasClass("aux-cell") && !s.isBorderEditEnabled() && s.left_pressed) {
                b = $(a.target);
                b.offset();
                b.width();
                b.height();
                var b = R(a.target),
                    c = !1,
                    d = s.selection_prev;
                null == s.selection_root && (s.selection_root = b, c = !0);
                !d || d.row ==
                    b.row && d.col == b.col || (c = !0);
                if (c) {
                    var e = b.row,
                        d = b.col;
                    a = a.ctrlKey;
                    var c = Math.max(0, Math.min(e, s.selection_root.row)),
                        e = Math.max(e, s.selection_root.row),
                        f = Math.max(0, Math.min(d, s.selection_root.col)),
                        d = Math.max(d, s.selection_root.col),
                        g = I();
                    a || f <= g.left && c <= g.top && d >= g.right && e >= g.bottom || N();
                    s.model.forEachCellInRange(c, f, e, d, K)
                }
                s.selection_prev = b
            }
        }

        function aa(a) {
            if ((a = J(a.target, "TD")) && !a.hasClass("aux-cell")) U().onDblClick()
        }
        k = k || {};
        var s = this;
        this.model = a;
        this.theme = this.style_class = null;
        this.dom;
        this.colgroup;
        this.left_pressed = !1;
        this.cell_border_events_options = {
            deactivated: !0,
            onBorderOver: function(a, b, c) {
                c.addClass("alert_border_" + b[0])
            },
            onBorderLeave: function(a, b, c) {
                s.dom.css("cursor", "default");
                c.removeClass("alert_border_" + b[0])
            },
            onBorderClick: function(a, b, c) {
                c = R(c);
                c = s.model.getVisibleCellPos(c.row, c.col);
                var d = c.row,
                    e = c.col;
                c = s.model.getCell(d, e);
                var f = !s.getCellView(d, e).style.hasBorder(b);
                if ("right" == b)
                    for (c.colspan(), b = d + c.rowspan() - 1, a.shiftKey && (d = 0, b = s.model.row_count - 1); d <= b; ++d) a =
                        e + c.colspan() - 1, q("right", d, a, b, f);
                else if ("left" == b)
                    for (b = d + c.rowspan() - 1, a.shiftKey && (d = 0, b = s.model.row_count - 1); d <= b; ++d) q("left", d, e, b, f);
                else if ("top" == b)
                    for (b = e + c.colspan() - 1, a.shiftKey && (e = 0, b = s.model.col_count - 1), a = e; a <= b; ++a) t("top", d, a, b, f);
                else if ("bottom" == b)
                    for (c.rowspan(), b = e + c.colspan() - 1, a.shiftKey && (e = 0, b = s.model.col_count - 1), a = e; a <= b; ++a) e = d + c.rowspan() - 1, t("bottom", e, a, b, f)
            }
        };
        this.aux_row = null;
        this.aux_cells = [];
        this.aux_col_cells = [];
        this.aux_row_cells = [];
        this.selection_bounds = this.selection_prev =
            this.selection_root = null;
        this.selected_cells = {};
        this.size_indicator = null;
        this.column_resize_enabled = k.column_resize_enabled || !1;
        this.hasBorder = function(a, b, c, d) {
            if (0 > a || a >= s.model.row_count || 0 > b || b >= s.model.col_count) return !1;
            var e = s.model.getCell(a, b),
                f = s.model.getVisibleCellPos(a, b),
                g = s.getCellView(a, b);
            if ("top" == c && f.row == a && g.style.hasBorder("top") || "bottom" == c && f.row + e.rowspan() - 1 == a && g.style.hasBorder("bottom") || "left" == c && f.col == b && g.style.hasBorder("left") || "right" == c && f.col + e.colspan() - 1 ==
                b && g.style.hasBorder("right")) return !0;
            if (!d) {
                if ("left" == c) return s.hasBorder(a, b - 1, "right", !0);
                if ("right" == c) return s.hasBorder(a, b + 1, "left", !0);
                if ("top" == c) return s.hasBorder(a - 1, b, "bottom", !0);
                if ("bottom" == c) return s.hasBorder(a + 1, b, "top", !0)
            }
            return !1
        };
        this.model.on("row_inserted", C);
        this.model.on("column_inserted", function(a, b) {
            B("column", a);
            s.dom.find("tr").each(function(c, d) {
                if (0 < c) {
                    var e = b[c - 1],
                        f = m(e);
                    $(d).find("td").eq(a).after(f.dom);
                    e.view = f
                }
            });
            s.selection_bounds = null
        });
        this.model.on("row_removed",
            function(a, b) {
                s.selection_bounds = null;
                v("row", a);
                b.forEach(function(b, c) {
                    E(b, a, c);
                    b.view && b.view.remove()
                });
                s.dom.find("tr").eq(a + 1).remove()
            });
        this.model.on("column_removed", function(a, b) {
            s.selection_bounds = null;
            b.forEach(function(b, c) {
                E(b, c, a);
                b.view && b.view.remove()
            });
            v("column", a)
        });
        this.getCellView = function(a, b, c) {
            return s.model.getCell(a, b, c).view
        };
        s.selectCell = K;
        s.selectCells = y;
        s.clearSelection = N;
        s.getSelectionBounds = I;
        s.forEachSelectedCell = Z;
        s.getSelectedCell = P;
        s.hasFixedLayout = function() {
            return "fixed" ==
                s.dom.css("table-layout")
        };
        s.enableFixedLayout = function(a) {
            if (a && !s.hasFixedLayout()) {
                s.dom.width();
                var b = [],
                    c = 0;
                s.dom.find("tr:first td").each(function(a, d) {
                    b.push($(d).width());
                    c += $(d).width()
                });
                c += b.length;
                s.dom.hide();
                s.dom.addClass("fixed-size");
                s.dom.css({
                    "table-layout": "fixed",
                    width: c
                });
                s.colgroup.find("col").each(function(a, c) {
                    c = $(c);
                    c.css({
                        width: b[a] + 1
                    })
                });
                s.dom.show()
            } else a || (s.dom.hide(), s.dom.removeClass("fixed-size"), s.dom.css({
                "table-layout": "auto",
                width: "auto"
            }), s.colgroup.find("col").each(function(a,
                b) {
                $(b).css({
                    width: "auto"
                })
            }), s.dom.show())
        };
        s.getColumnWidths = function(a) {
            var b = [];
            s.dom.find("tr:first td").each(function(a, c) {
                b.push($(c).width())
            });
            return 1 == a ? b : b.slice(1)
        };
        s.setColumnWidth = function(a, b) {
            b += 1;
            s.colgroup.find("col").eq(a + 1).css({
                width: b
            })
        };
        s.setSingleColumnWidth = function(a, b) {
            s.dom.css({
                "table-layout": "fixed"
            });
            for (var c = s.dom.width(), d = s.getColumnWidths(!0), e = d[a + 1], f = 0; f < d.length; ++f);
            c += -e + b;
            s.dom.hide();
            s.dom.css({
                "table-layout": "fixed",
                width: c
            });
            s.setColumnWidth(a, b);
            s.dom.show()
        };
        (function() {
            s.dom = $("<table>", {
                "class": "tableview",
                tabindex: 1,
                cellspacing: 3
            });
            s.colgroup = $("<colgroup>").appendTo(s.dom);
            d = $(d) || $("body");
            d.append(s.dom);
            s.model.on("state_change", p);
            $.observable(s);
            s.dom.mousedown(ja).mousemove(ca).mouseup(function(a) {
                s.left_pressed = s.left_pressed && 1 != a.which;
                s.selection_root = null
            }).mousedown(function(a) {
                a.preventDefault();
                a.stopPropagation()
            }).dblclick(aa).mouseleave(function(a) {
                s.left_pressed = !1
            }).keydown(n);
            for (var a = 0; a < s.model.row_count; ++a) C(a, s.model.rows[a]);
            0 < s.model.row_count && 0 < s.model.col_count && K(s.model.getCell(0, 0), 0, 0)
        })()
    }
    navigator.userAgent.toLowerCase().indexOf("chrome");
    g.read_only = !1;
    g.prototype.initEventHandlers = function() {
        var a = this;
        a.event_handlers_initialized || (a.entry.blur(function(a) {
            a.stopImmediatePropagation();
            a.preventDefault()
        }).keydown(function(b) {
            if (27 == b.which) {
                b.preventDefault();
                b = window.scrollX;
                var d = window.scrollY;
                a.endEditing();
                a.dom.parents("table").focus();
                e();
                null === c() && window.scrollTo(b, d)
            }
        }).on("mousedown mouseup mousemove click dblclick",
            function(b) {
                a.edit_in_progress && b.stopImmediatePropagation()
            }), a.event_handlers_initialized = !0)
    };
    g.prototype.areEventHandlersInitialized = function() {
        return self.event_handlers_initialized
    };
    g.prototype.onDblClick = function() {
        this.startEditing()
    };
    g.prototype.onPasteContent = function(a) {
        var b = this.entry,
            c = b.text(),
            d = window.scrollX,
            e = window.scrollY;
        setTimeout(function() {
            window.scrollTo(d, e);
            var a = b.text(),
                g = a.length,
                t = "",
                x = "";
            if (0 < c.length)
                for (var B = 0; B <= c.length; ++B) {
                    var t = c.substr(0, B),
                        x = c.substr(B),
                        v =
                        a.substr(g - x.length);
                    if (0 == a.indexOf(t) && v == x) {
                        a = a.substr(B, g - c.length);
                        break
                    }
                    x = t = ""
                }
            a = t + TableImport.extractCellsFromString(a) + x;
            b.html(a)
        }, 3)
    };
    g.prototype.show = function() {
        this.cell.isVisible() ? this.dom.show() : this.dom.hide()
    };
    g.prototype.dump = function() {
        return {
            style: this.style.dump()
        }
    };
    g.prototype.load = function(a, b) {
        a && this.style.load(a.style, b)
    };
    g.prototype.select = function() {
        return this.is_selected ? !1 : (this.dom.addClass("selected"), this.is_selected = !0)
    };
    g.prototype.unselect = function() {
        return this.is_selected ?
            (this.edit_in_progress && this.endEditing(), this.dom.removeClass("selected"), this.is_selected = !1, !0) : !1
    };
    g.prototype.remove = function() {
        this.endEditing();
        this.dom.remove()
    };
    g.prototype.startEditing = function(a) {
        if (0 == g.read_only && !this.edit_in_progress) {
            this.entry.addClass("entry-editing").attr("contenteditable", !0).focus();
            a && this.entry.text("");
            a = this.entry.get(0);
            var b, c;
            document.body.createTextRange ? (b = document.body.createTextRange(), b.moveToElementText(a), b.select()) : window.getSelection && (c = window.getSelection(),
                c.removeAllRanges(), b = document.createRange(), 0 < $(a).text().length ? b.setStart(a, 1) : b.selectNodeContents(a), c.addRange(b));
            this.edit_in_progress = !0
        }
    };
    g.prototype.endEditing = function() {
        if (1 == this.edit_in_progress) {
            e();
            this.entry.attr("contenteditable", !1).removeClass("entry-editing");
            this.edit_in_progress = !1;
            var a = this.entry.html(),
                a = a.replace(/(<div>(?!<br>))|(<br>)/ig, "\n").replace(/<\/?div>/ig, ""),
                a = a.split("\n"),
                a = a.map(htmlDecode),
                a = a.join("\n");
            this.ignore_model_change = !0;
            this.cell.value(a);
            this.entry.html(textToHTML(a));
            this.ignore_model_change = !1
        }
    };
    b.prototype.setIndex = function(a) {
        if (a != this.index) {
            this.index = a;
            if ("row" == this.type) a += 1;
            else {
                for (var b = 0 == a ? "A" : ""; 0 < a;) b = String.fromCharCode(Math.floor(65 + a % 26)) + b, a = Math.floor(a / 26);
                a = b
            }
            this.index_view.text(a)
        }
    };
    b.prototype.onRemoveRow = function(a) {
        "row" == this.type && this.index > a && this.setIndex(this.index - 1)
    };
    b.prototype.onInsertRow = function(a) {
        "row" == this.type && this.index >= a && this.setIndex(this.index + 1)
    };
    b.prototype.onInsertColumn = function(a) {
        "column" == this.type && this.index >=
            a && this.setIndex(this.index + 1)
    };
    b.prototype.onRemoveColumn = function(a) {
        "column" == this.type && this.index > a && this.setIndex(this.index - 1)
    };
    d.prototype.isSelectionRectangular = function() {
        var a = this.getSelectionBounds();
        if (!a) return !1;
        for (var b = a.top; b <= a.bottom; ++b)
            for (var c = a.left; c <= a.right; ++c)
                if (!this.model.getCell(b, c).view.is_selected) return !1;
        return !0
    };
    d.prototype.mergeSelectedCells = function() {
        if (this.isSelectionRectangular()) {
            var a = this.getSelectionBounds();
            this.clearSelection();
            this.model.mergeCells(a.top,
                a.left, a.bottom, a.right);
            this.selectCell(this.model.getCell(a.top, a.left), a.top, a.left)
        }
    };
    d.prototype.splitSelectedCell = function() {
        if (this.isSelectionRectangular()) {
            var a = this.getSelectionBounds(),
                b = this.model.getCell(a.top, a.left),
                c = b.rowspan(),
                b = b.colspan();
            this.model.splitCell(a.top, a.left);
            this.selectCells(a.top, a.left, a.top + c - 1, a.left + b - 1)
        }
    };
    d.prototype.forEachCellInColumn = function(a, b) {
        this.model.forEachCellInColumn(a, function(a) {
            b(a.view)
        })
    };
    d.prototype.forEachCellInRow = function(a, b) {
        this.model.forEachCellInRow(a,
            function(a, c) {
                b(a.view, c)
            })
    };
    d.prototype.forEachCellInRange = function(a, b, c, d, e) {
        this.model.forEachCellInRange(a, b, c, d, function(a, b, c) {
            e(a.view, b, c)
        })
    };
    d.prototype.forEachCell = function(a) {
        for (var b = 0; b < this.model.row_count; ++b) this.model.forEachCellInRow(b, function(c, d) {
            a(c.view, b, d)
        })
    };
    d.prototype.enableBorderEdit = function(a) {
        if (a) {
            this.dom.css("border-collapse", "separate");
            this.dom.css("border-spacing", 3);
            this.dom.addClass("border-edit");
            var b = this.cell_border_events_options;
            this.forEachCellView(function(a) {
                a.dom.borderEvents(b)
            })
        } else this.dom.css("border-collapse",
            "collapse"), this.dom.removeClass("border-edit");
        this.cell_border_events_options.deactivated = !a
    };
    d.prototype.isBorderEditEnabled = function() {
        return !this.cell_border_events_options.deactivated
    };
    d.prototype.forEachSelectedCellView = function(a, b, c) {
        this.forEachSelectedCell(function(b) {
            a(b.view)
        }, c)
    };
    d.prototype.forEachCellViewInRange = function(a, b, c, d, e, g) {
        g = g || !1;
        var q = [];
        e = Math.min(e + 1, this.model.col_count);
        for (d = Math.min(d + 1, this.model.row_count); b < d; ++b)
            for (var t = c; t < e; ++t) {
                var x = this.model.getCell(b,
                        t, !0),
                    B = 0,
                    v = 0;
                0 == x.isVisible() && 0 == g && (v = Math.min(x.colspan(), 0), B = Math.min(x.rowspan(), 0));
                x = this.getCellView(b + B, t + v, g); - 1 == q.indexOf(x) && (a(x, b, t), q.push(x))
            }
    };
    d.prototype.forEachCellView = function(a, b) {
        this.forEachCellViewInRange(a, 0, 0, this.model.row_count - 1, this.model.col_count - 1, b)
    };
    d.prototype.copySelected = function() {
        var a = [],
            b = -1,
            c = [];
        this.forEachSelectedCell(function(d, e, g) {
            b != e && -1 != b && (a.push(c), c = []);
            b = e;
            c.push(d.value())
        });
        a.push(c);
        for (var d = [], e = 0; e < a.length; ++e) d.push(a[e].join("\t"));
        return d.join("\n")
    };
    d.prototype.cutSelected = function() {
        var a = this.copySelected();
        this.forEachSelectedCell(function(a) {
            a.value("")
        });
        this.trigger("state_change");
        return a
    };
    d.prototype.reset = function() {
        this.clearSelection();
        this.enableFixedLayout(!1);
        this.model.reset();
        this.model.forEachCellInRange(0, 0, this.model.row_count - 1, this.model.col_count - 1, function(a) {
            a.view.style.reset()
        });
        this.selectCells(0, 0, 0, 0);
        this.setTheme(null);
        this.trigger("onload")
    };
    d.prototype.setStyleClass = function(a) {
        null != this.style_class &&
            this.dom.removeClass(this.style_class);
        (this.style_class = a) && this.dom.addClass(a)
    };
    d.prototype.setTheme = function(a, b) {
        (this.theme = a) && !b ? this.setStyleClass(TableThemes.createTheme(a)) : this.setStyleClass(null);
        this.trigger("theme_set", a)
    };
    d.prototype.removeSelectedColumns = function() {
        var a = [];
        this.forEachSelectedCell(function(b, c, d) {
            -1 == a.indexOf(d) && a.push(d)
        });
        a.sort(function(a, b) {
            return a - b
        });
        for (var b = a.length - 1; 0 <= b; --b) this.model.removeColumn(a[b])
    };
    d.prototype.removeSelectedRows = function() {
        var a = [];
        this.forEachSelectedCell(function(b, c, d) {
            -1 == a.indexOf(c) && a.push(c)
        });
        a.sort(function(a, b) {
            return a - b
        });
        for (var b = a.length - 1; 0 <= b; --b) this.model.removeRow(a[b])
    };
    d.prototype.dump = function() {
        for (var a = this.model.row_count, b = this.model.col_count, c = [], d = 0; d < a; ++d) {
            for (var e = [], g = 0; g < b; ++g) {
                var q = this.model.getCell(d, g, !0).view;
                q && e.push(q.dump())
            }
            c.push(e)
        }
        a = {
            rows_views: c,
            model: this.model.dump(),
            theme: this.theme,
            fixed_layout: this.hasFixedLayout()
        };
        this.hasFixedLayout() && (a.col_widths = this.getColumnWidths());
        return a
    };
    d.prototype.setLoadIgnore = function(a) {
        this.load_ignore = a
    };
    d.prototype.load = function(a) {
        var b = this.load_ignore || {};
        if (a && a.model && a.rows_views) {
            var c = this.getSelectionBounds();
            this.model.load(a.model, b);
            for (var d = this.model.row_count, e = this.model.col_count, g = 0; g < d; ++g)
                for (var q = a.rows_views[g], t = 0; t < e; ++t) this.getCellView(g, t, !0).load(q[t], b);
            a.theme && this.setTheme(a.theme, b.theme);
            if (1 == a.fixed_layout && $.isArray(a.col_widths) && !b.fixed_layout) {
                this.enableFixedLayout(!0);
                b = Math.min(a.col_widths.length,
                    this.model.col_count);
                for (e = d = 0; e < b; ++e) d += a.col_widths[e];
                d += this.dom.find("col:first").width();
                this.dom.css({
                    "table-layout": "fixed",
                    width: d
                });
                for (e = 0; e < b; ++e) this.setColumnWidth(e, a.col_widths[e])
            }
            c && c.right < this.model.col_count && c.bottom < this.model.row_count ? this.selectCells(c.top, c.left, c.bottom, c.right) : this.selectCells(0, 0, 0, 0);
            this.trigger("onload")
        }
    };
    d.prototype.setReadOnly = function(a) {
        g.read_only = a
    };
    return d
}();
var TTable = function() {
    return function(c) {
        var g = new TableModel;
        g.insertRow(["Pet", "Name"]);
        g.insertColumn(["Age"]);
        g.insertRow(["Snake", "Jimmy", 2]);
        g.insertRow(["Cow", "Molly", 11], 1);
        var e = new TableView(g, c);
        g.insertRow(["Cat", "Jinks", 7], 2);
        g.rows[1][1].value = "Jolly";
        g.insertColumn(["Sex", "F", "M", "M"]);
        g.mergeCells(1, 0, 1, 1);
        g.splitCell(1, 0);
        g.mergeCells(1, 0, 2, 1);
        g.mergeCells(0, 0, 3, 1);
        g.splitCell(0, 0);
        g.mergeCells(0, 0, g.row_count - 1, g.col_count - 1);
        g.splitCell(0, 0);
        g.insertColumn(["x", "x", "x", "x"]);
        $('<button class="btn">Add Column</button>').appendTo($(c)).click(function() {
            g.insertEmptyColumn()
        });
        $('<button class="btn">Add Row</button>').appendTo($(c)).click(function() {
            g.insertEmptyRow()
        });
        $("<br/>").appendTo($(c));
        $("<button>Remove Row</button>").appendTo($(c)).click(function() {
            var b = e.selection;
            b && b.top == b.bottom && g.removeRow(b.top)
        });
        $("<button>Remove Column</button>").appendTo($(c)).click(function() {
            var b = e.selection;
            b && b.left == b.right && g.removeColumn(b.left)
        });
        $("<button>Merge</button>").appendTo($(c)).click(e.mergeSelectedCells.bind(e));
        $("<button>Split</button>").appendTo($(c)).click(e.splitSelectedCell.bind(e))
    }
}();
var TableThemes = function() {
    function c(a, b) {
        b = b || $.extend(!0, {}, k);
        for (var d in b)
            if (b.hasOwnProperty(d)) {
                var e = b[d];
                "object" == typeof e ? b[d] = c(a, e) : "string" == typeof e && "$" == e.substr(0, 1) && a.hasOwnProperty(e.substr(1)) && (b[d] = a[e.substr(1)])
            }
        return b
    }

    function g(a) {
        var b = 0,
            c, d;
        if (0 == a.length) return b;
        c = 0;
        for (var e = a.length; c < e; c++) d = a.charCodeAt(c), b = (b << 5) - b + d, b |= 0;
        return b
    }

    function e(a) {
        for (var b = {}, c = 0; c < a.length; ++c) $.extend(!0, b, a[c]);
        return b
    }

    function b(a, c, d, e, f) {
        e = e || !1;
        c = c || "";
        0 < c.length && (c +=
            " ");
        var g = [],
            k;
        for (k in a)
            if (a.hasOwnProperty(k) && ("_" != k[0] || a[k]._active && f)) {
                var n = a[k];
                "object" == typeof n ? ("_" == k[0] && (k = k.substr(1)), e ? (g.push(c + k + "{"), n = b(n, null, !0), g = g.concat(n), g.push("}")) : (n = b(n, null, !0), g.push(c + k + "{" + n.join("") + "}"))) : "_" != k[0] && g.push((e ? "\t" : "") + k + ":" + n + ";")
            }
        return d ? g : g.join("\n")
    }
    var d = {
            " ": {
                _active: !0,
                "border-collapse": "collapse",
                "border-spacing": 0
            },
            td: {
                "font-family": "Arial, sans-serif",
                "font-size": "14px",
                padding: "10px 5px",
                "border-style": "solid",
                "border-width": "0px",
                overflow: "hidden",
                "word-break": "normal"
            },
            th: {
                "font-family": "Arial, sans-serif",
                "font-size": "14px",
                "font-weight": "normal",
                padding: "10px 5px",
                "border-style": "solid",
                "border-width": "0px",
                overflow: "hidden",
                "word-break": "normal"
            },
            _row_odd_td: {
                _active: !1
            },
            "_tr:nth-child(odd) td": {
                _active: !1
            },
            "_tr:nth-child(2) td": {
                _active: !0
            },
            _col_even_td: {
                _active: !1
            },
            "_td:nth-child(odd)": {
                _active: !1
            },
            "_tr:hover td": {
                _active: !1
            }
        },
        a = {
            "No borders": {
                " ": {
                    border: "none"
                }
            },
            "All borders": {
                td: {
                    "border-width": "1px"
                },
                th: {
                    "border-width": "1px"
                }
            },
            Horizontal: {
                td: {
                    "border-top-width": "1px",
                    "border-bottom-width": "1px"
                },
                th: {
                    "border-top-width": "1px",
                    "border-bottom-width": "1px"
                }
            },
            Outer: {
                " ": {
                    "border-width": "1px",
                    "border-style": "solid"
                }
            }
        },
        f = {
            "No alternate": {},
            "Alternate rows": {
                "_tr:nth-child(odd) td": {
                    _active: !0
                },
                "_tr:nth-child(2) td": {
                    _active: !0
                },
                _row_odd_td: {
                    _active: !0
                }
            },
            "Alternate columns": {
                _col_even_td: {
                    _active: !0
                },
                "_td:nth-child(odd)": {
                    _active: !0
                },
                "_tr:nth-child(2) td": {
                    _active: !0
                }
            }
        },
        k = {
            " ": {
                "border-color": "$border_color"
            },
            td: {
                "border-color": "$border_color",
                color: "$td_text_color",
                "background-color": "$td_bg_color"
            },
            th: {
                "border-color": "$border_color",
                color: "$th_text_color",
                "background-color": "$th_bg_color"
            },
            "_tr:nth-child(2) td": {
                color: "$th_text_color",
                "background-color": "$th_bg_color"
            },
            _row_odd_td: {
                "background-color": "$td_alt_bg_color"
            },
            _col_even_td: {
                "background-color": "$td_alt_bg_color"
            },
            "_td:nth-child(odd)": {
                "background-color": "$td_alt_bg_color"
            },
            "_tr:nth-child(odd) td": {
                "background-color": "$td_alt_bg_color"
            },
            "_tr:hover td": {
                "background-color": "$td_hover_bg_color",
                color: "$td_hover_text_color"
            }
        },
        n = {
            Default: {},
            Light: c({
                border_color: "#ccc",
                td_text_color: "#333",
                td_bg_color: "#fff",
                th_text_color: "#333",
                th_bg_color: "#f0f0f0",
                td_alt_bg_color: "#f9f9f9",
                td_hover_bg_color: "#f0f0f0",
                td_hover_text_color: "#222"
            }),
            Orange: c({
                border_color: "#aaa",
                td_text_color: "#333",
                td_bg_color: "#fff",
                th_text_color: "#fff",
                th_bg_color: "#f38630",
                td_alt_bg_color: "#FCFBE3",
                td_hover_bg_color: "#FFC950",
                td_hover_text_color: "#222"
            }),
            Blue: c({
                border_color: "#999",
                td_text_color: "#444",
                td_bg_color: "#F7FDFA",
                th_text_color: "#fff",
                th_bg_color: "#26ADE4",
                td_alt_bg_color: "#D2E4FC",
                td_hover_bg_color: "#FFCC00",
                td_hover_text_color: "#333"
            }),
            Violet: c({
                border_color: "#aabcfe",
                td_text_color: "#669",
                td_bg_color: "#e8edff",
                th_text_color: "#039",
                th_bg_color: "#b9c9fe",
                td_alt_bg_color: "#D2E4FC",
                td_hover_bg_color: "#d0dafd",
                td_hover_text_color: "#339"
            }),
            Green: c({
                border_color: "#bbb",
                td_text_color: "#594F4F",
                td_bg_color: "#E0FFEB",
                th_text_color: "#493F3F",
                th_bg_color: "#9DE0AD",
                td_alt_bg_color: "#C2FFD6",
                td_hover_bg_color: "#E5FCC2",
                td_hover_text_color: "#333"
            })
        },
        p = {
            None: {},
            Highlight: {
                _hover_theme: {
                    _active: !0
                }
            }
        },
        m = {};
    return {
        ColorThemes: n,
        BorderThemes: a,
        HoverThemes: p,
        "Alternate Rows/Columns Themes": f,
        combineThemes: e,
        createTheme: function(c) {
            var k = "theme" + Math.abs(g(JSON.stringify(c)));
            if (!m.hasOwnProperty(k)) {
                var x = [d];
                c["Alternate Rows/Columns Theme"] && x.push(f[c["Alternate Rows/Columns Theme"]]);
                c.ColorTheme && x.push(n[c.ColorTheme]);
                c.HoverTheme && x.push(p[c.HoverTheme]);
                c.BorderTheme && x.push(a[c.BorderTheme]);
                c = e(x);
                m[k] = c;
                c =
                    b(c, "." + k, !1, !1, !0);
                x = document.createElement("div");
                c = c.replace(/padding: 10px/, "padding: 0px");
                x.innerHTML = '&shy;<style type="text/css" media="screen">' + c + "</style>";
                document.body.appendChild(x.childNodes[1])
            }
            return k
        },
        getThemeById: function(a) {
            return m[a]
        },
        themeToStr: b
    }
}();
(function(c, g, e, b) {
    function d(a, b) {
        this.el = a;
        this.$el = c(a);
        this.max_rows = b.max_rows;
        this.max_cols = b.max_cols;
        this.max_visible_rows = b.max_visible_rows || 15;
        this.max_visible_cols = b.max_visible_cols || 15;
        this.$table = null;
        this.hover_range = {
            row: -1,
            col: -1
        };
        this.size = {
            rows: b.rows,
            cols: b.cols
        };
        this.select_size_callback = b.onSetSize;
        this.$el.data("SizeChooser", this);
        this.init()
    }
    d.prototype.init = function() {
        function a() {
            q.addClass("display-block")
        }

        function b() {
            q.removeClass("display-block")
        }

        function d(a) {
            13 == a.which &&
                (m.setSize(parseInt(m.rows_input.val()), parseInt(m.cols_input.val())), b())
        }
        for (var e = c("<div/>", {
                "class": "SizeChooser"
            }), g = c("<table/>").appendTo(e), m = this, q = m.$el.parents(".dropdown-menu"), t = 0; t < this.max_visible_rows; ++t) {
            for (var x = c("<tr/>"), B = 0; B < this.max_visible_cols; ++B) {
                var v = c("<td> </td>");
                x.append(v);
                v.mousemove(function(a) {
                    m.onCellMousemove(a)
                })
            }
            g.append(x)
        }
        this.$table = g;
        this.$el.append(e);
        this.$size_form = c("<form/>").appendTo(e);
        this.rows_input = c("<input>").val(this.size.rows).keydown(d).on("focus",
            a).on("blur", b).appendTo(this.$size_form);
        this.$size_form.append(c("<span> x </span>"));
        this.cols_input = c("<input>").val(this.size.cols).keydown(d).on("focus", a).on("blur", b).appendTo(this.$size_form);
        this.setSize(this.size.rows, this.size.cols, !0);
        g.mousedown(function(a) {
            m.onMousedown(a)
        });
        g.mouseleave(function() {
            m.setSize(m.size.rows, m.size.cols, !0);
            m.setHoverRange(m.size.rows - 1, m.size.cols - 1)
        });
        this.rows_cache = null
    };
    d.prototype.forEachCell = function(a) {
        if (null == this.rows_cache) {
            var b = [];
            this.$table.find("tr").each(function(a,
                d) {
                var e = [];
                c(d).find("td").each(function(a, b) {
                    e.push(b)
                });
                b.push(e)
            });
            this.rows_cache = b
        }
        for (var d = 0; d < this.rows_cache.length; ++d)
            for (var e = this.rows_cache[d], g = 0; g < e.length; ++g) a(e[g], d, g)
    };
    d.prototype.onCellMousemove = function(a) {
        var b;
        b = a.target;
        for (b = c(b);
            "td" != b.get(0).nodeName.toLowerCase();) b = b.parent();
        a = b.index();
        b = c(b.parent()).index();
        this.setHoverRange(b, a)
    };
    d.prototype.onMousedown = function(a) {
        0 <= this.hover_range.col && 0 <= this.hover_range.row && this.setSize(this.hover_range.row + 1, this.hover_range.col +
            1)
    };
    d.prototype.setHoverRange = function(a, b) {
        if (this.hover_range.row != a || this.hover_range.col != b) this.forEachCell(function(d, e, g) {
            e <= a && g <= b ? c(d).addClass("SizeChooser-hover") : c(d).removeClass("SizeChooser-hover")
        }), this.hover_range.row = a, this.hover_range.col = b, this.rows_input.val(a + 1), this.cols_input.val(b + 1)
    };
    d.prototype.setSize = function(a, b, d) {
        a = a || this.size.rows;
        b = b || this.size.cols;
        a = Math.max(1, Math.min(this.max_rows, a));
        b = Math.max(1, Math.min(this.max_cols, b));
        this.forEachCell(function(d, e, g) {
            e <
                a && g < b ? c(d).addClass("SizeChooser-selected") : c(d).removeClass("SizeChooser-selected")
        });
        this.size.rows = a;
        this.size.cols = b;
        this.rows_input.val(a);
        this.cols_input.val(b);
        !d && this.select_size_callback && this.select_size_callback(a, b)
    };
    c.fn.SizeChooser = function(a) {
        return this.each(function() {
            c.data(this, "SizeChooser") || c.data(this, "SizeChooser", new d(this, a))
        })
    }
})(jQuery, window, document, void 0);
(function(c) {
    function g(e, b) {
        this.el = c(e);
        this.onChange = b.onChange;
        this.init()
    }
    g.prototype = {
        init: function() {
            var e = this,
                b = e.el,
                d = e.el.parents(".dropdown-menu");
            e.el.on("mouseenter", function() {
                d.addClass("display-block")
            }).on("mouseleave", function() {
                d.removeClass("display-block")
            });
            c("<label>").text("Horizontal spacing").appendTo(b);
            var a = c("<input/>", {
                    type: "text",
                    "data-slider-min": "0",
                    "data-slider-max": "20",
                    "data-slider-step": "1",
                    "data-slider-value": 10
                }),
                f = c("<input/>", {
                    type: "text",
                    "data-slider-min": "0",
                    "data-slider-max": "20",
                    "data-slider-step": "1",
                    "data-slider-value": 10
                }),
                g = null,
                n = null,
                p = function() {
                    var b = a.slider("getValue"),
                        c = f.slider("getValue");
                    if (b != g || c != n) e.onChange(b, c);
                    g = b;
                    n = c
                };
            a.appendTo(b).slider().on("slide", p);
            c("<label>").text("Vertical spacing").appendTo(b);
            f.appendTo(b).slider().on("slide", p);
            e.input1 = a;
            e.input2 = f
        },
        setHorizontalSpacing: function(c) {
            this.input1.slider("setValue", c)
        },
        setVerticalSpacing: function(c) {
            this.input2.slider("setValue", c)
        }
    };
    c.fn.CellSpacingPanel = function(e) {
        return this.each(function() {
            c.data(this,
                "CellSpacingPanel") || c.data(this, "CellSpacingPanel", new g(this, e))
        })
    }
})(jQuery);
var Main = function() {
    var c = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g,
        g = function(e) {
            var b, d = null,
                a = jQuery.trim(e + "");
            return a && !jQuery.trim(a.replace(c, function(a, c, e, g) {
                b && c && (d = 0);
                if (0 === d) return a;
                b = e || c;
                d += !g - !e;
                return ""
            })) ? Function("return " + a)() : jQuery.error("Invalid JSON: " + e)
        };
    return {
        init_table_from_json: function(c, b) {
            var d = null;
            try {
                d = jQuery.parseJSON(b)
            } catch (a) {
                try {
                    d = g(b)
                } catch (f) {}
            }
            null != d && 0 < d.rows.length &&
                (c.reset(), c.model.setRows(d.rows))
        }
    }
}();
var MainUI = function(c) {
    function g(e) {
        this.table_view = e;
        this.table = e.model;
        this.persistence = new PersistenceHelper(e);
        this.observable = {};
        c.observable(this.observable);
        this.init()
    }
    g.prototype.init = function() {
        this.initFileMenu();
        this.initTableMenu();
        this.initColumnMenu();
        this.initRowMenu();
        this.initCellMenu();
        this.initToolbar();
        this.initResultControlPanel();
        this.initUndoRedo();
        this.initTableSave();
        this.initTableShare();
        this.initTableAutosave();
        this.initTableCellContextMenu();
        this.initColumnWidthDialog();
        c(".tableview").focus();
        this.persistence.run();
        c("pre:first").dblclick(function() {
            Utils.select_text("result-code")
        });
        this.init_table_context_menus();
        c("[rel=tooltip]").attr("data-container", "body").tooltip({
            placement: "top"
        })
    };
    g.prototype.setSelColumnsHAlign = function(c) {
        var b = this.table_view,
            d = b.getSelectionBounds();
        if (d)
            for (var a = d.right, d = d.left; d <= a; ++d) b.forEachCellInColumn(d, function(a) {
                a.style.setHorizontalAlign(c)
            })
    };
    g.prototype.initFileMenu = function() {
        var e = this;
        c("#new_table_rows_input,#new_table_columns_input").keydown(function(b) {
            13 ==
                b.which && b.preventDefault()
        });
        c("#create_new_table_btn").click(function(b) {
            b.preventDefault();
            var d = c("#new_table_rows_input");
            b = d.val();
            var a = /^[0-9]+$/.test(b) && 1 <= parseInt(b) && 200 >= parseInt(b);
            a ? d.parents(".control-group").removeClass("error") : d.parents(".control-group").addClass("error");
            var d = c("#new_table_columns_input"),
                f = d.val(),
                g = /^[0-9]+$/.test(f) && 1 <= parseInt(f) && 20 >= parseInt(f);
            g ? d.parents(".control-group").removeClass("error") : d.parents(".control-group").addClass("error");
            a && g && (c("#new_table_dialog").modal("hide"),
                e.createNewTable(b, f))
        })
    };
    g.prototype.createNewTable = function(c, b) {
        this.table_view.reset();
        this.table.resize(c, b);
        this.unredo.clear()
    };
    g.prototype.initTableMenu = function() {
        function e(b) {
            b = b.offset();
            a || (a = c("<div>").attr({
                "class": "loading-indicator"
            }).appendTo(c("body")));
            a.css({
                left: b.left + "px",
                top: b.top + "px"
            }).show()
        }
        var b = this.table_view,
            d = this.table;
        c("#table_reset").click(function() {
            b.reset()
        });
        c("#table_add_all_borders").click(function(a) {
            var c = function(a) {
                a.style.setBorders("ltrb")
            };
            a.ctrlKey ?
                b.forEachCellView(c, !0) : b.forEachSelectedCellView(c, null, !0)
        });
        c("#table_add_vert_borders").click(function() {
            b.forEachCell(function(a) {
                a.style.setBorders("lr")
            })
        });
        c("#table_add_horizontal_borders").click(function() {
            b.forEachCell(function(a) {
                a.style.setBorders("tb")
            })
        });
        c("#table_remove_all_borders").click(function(a) {
            var c = function(a) {
                a.style.setBorders("")
            };
            a.ctrlKey ? b.forEachCellView(c, !0) : b.forEachSelectedCellView(c, null, !0)
        });
        var a = null;
        c(".table_size_chooser").SizeChooser({
            max_cols: 20,
            max_rows: 200,
            cols: d.col_count,
            rows: d.row_count,
            onSetSize: function(c, g) {
                400 < Math.max(d.col_count * d.row_count, c * g) ? (e(b.dom), window.setTimeout(function() {
                    d.resize(c, g);
                    a && a.hide()
                }, 100)) : d.resize(c, g)
            }
        });
        c("#table_resize").mouseover(function() {
            c(".table_size_chooser").data("SizeChooser").setSize(d.row_count, d.col_count, !0)
        });
        c("#cell-spacing-panel").CellSpacingPanel({
            onChange: function(a, c) {
                b.forEachCellView(function(b) {
                    b.style.setPadding(c, a)
                })
            }
        });
        b.on("onload", function() {
            var a = b.getCellView(0, 0).style.getPadding(),
                d = c("#cell-spacing-panel").data("CellSpacingPanel");
            a && d && (void 0 != a.left && d.setHorizontalSpacing(a.left), void 0 != a.top && d.setVerticalSpacing(a.top))
        })
    };
    g.prototype.initColumnMenu = function() {
        var e = this.table_view,
            b = this.table;
        c("#col_insert_left").click(function() {
            var a = e.getSelectionBounds();
            a && b.insertEmptyColumn(a.left)
        });
        c("#col_insert_right").click(function() {
            var a = e.getSelectionBounds();
            a && b.insertEmptyColumn(a.right + 1)
        });
        c("#col_remove").click(function() {
            e.removeSelectedColumns()
        });
        var d = this;
        c("#col_align_left").click(function() {
            d.setSelColumnsHAlign("left")
        });
        c("#col_align_center").click(function() {
            d.setSelColumnsHAlign("center")
        });
        c("#col_align_right").click(function() {
            d.setSelColumnsHAlign("right")
        })
    };
    g.prototype.initRowMenu = function() {
        var e = this.table_view,
            b = this.table;
        c("#row_insert_below").click(function() {
            var c = e.getSelectionBounds();
            c && b.insertEmptyRow(c.bottom + 1)
        });
        c("#row_insert_above").click(function() {
            var c = e.getSelectionBounds();
            c && b.insertEmptyRow(c.top)
        });
        c("#row_remove").click(function() {
            var c =
                e.getSelectionBounds();
            if (c)
                for (var a = c.bottom, c = c.top; a >= c; --a) b.removeRow(a)
        })
    };
    g.prototype.initCellMenu = function() {
        var e = this.table_view;
        c("#cell_merge").click(e.mergeSelectedCells.bind(e));
        c("#cell_split").click(e.splitSelectedCell.bind(e))
    };
    g.prototype.initToolbar = function() {
        var e = this.table_view;
        c("#table_add_all_borders_btn").click(function(a) {
            var b = function(a) {
                a.style.setBorders("ltrb")
            };
            a.ctrlKey ? e.forEachCellView(b, !0) : e.forEachSelectedCellView(b, null, !0)
        });
        c("#table_remove_all_borders_btn").click(function(a) {
            var b =
                function(a) {
                    a.style.setBorders("")
                };
            a.ctrlKey ? e.forEachCellView(b, !0) : e.forEachSelectedCellView(b, null, !0)
        });
        c("#table_merge_cells_btn").click(e.mergeSelectedCells.bind(e));
        c("#table_split_cells_btn").click(e.splitSelectedCell.bind(e));
        c("#edit_grid_btn").click(function() {
            e.isBorderEditEnabled() ? (e.enableBorderEdit(!1), c(this).find("i:first").removeClass("grid-edit-on-icon").addClass("grid-edit-off-icon")) : (e.enableBorderEdit(!0), c(this).find("i:first").removeClass("grid-edit-off-icon").addClass("grid-edit-on-icon"))
        });
        c("#left_align_btn").click(function() {
            e.forEachSelectedCellView(function(a) {
                a.style.setHorizontalAlign("left")
            })
        });
        c("#right_align_btn").click(function() {
            e.forEachSelectedCellView(function(a) {
                a.style.setHorizontalAlign("right")
            })
        });
        c("#center_align_btn").click(function() {
            e.forEachSelectedCellView(function(a) {
                a.style.setHorizontalAlign("center")
            })
        });
        c("#table_bold_font_btn").click(function() {
            e.forEachSelectedCellView(function(a) {
                a.style.toggleFontStyle("bold")
            })
        });
        c("#table_italic_font_btn").click(function() {
            e.forEachSelectedCellView(function(a) {
                a.style.toggleFontStyle("italic")
            })
        });
        var b = "#ffffff #ffccc9 #ffce93 #fffc9e #ffffc7 #9aff99 #96fffb #ECF4FF #cbcefb #efefef #fd6864 #fe996b #fffe65 #fcff2f #67fd9a #38fff8 #BBDAFF #9698ed #c0c0c0 #fe0000 #f8a102 #ffcc67 #f8ff00 #34ff34 #68cbd0 #34cdf9 #6665cd #9b9b9b #cb0000 #f56b00 #ffcb2f #ffc702 #32cb00 #00d2cb #3166ff #6434fc #656565 #9a0000 #ce6301 #cd9934 #999903 #009901 #329a9d #3531ff #6200c9 #343434 #680100 #963400 #986536 #646809 #036400 #34696d #00009b #303498 #000000 #330001 #643403 #663234 #343300 #013300 #003532 #010066 #340096".split(" "),
            d = c("#fg-color-picker");
        d.spectrum({
            color: "#000",
            showInput: !0,
            className: "color-picker",
            showInitial: !0,
            showPalette: !0,
            showSelectionPalette: !0,
            maxPaletteSize: 10,
            preferredFormat: "hex",
            localStorageKey: "tg.spectrum",
            change: function(a) {
                var b = a.toHexString();
                e.forEachSelectedCellView(function(a) {
                    a.style.setTextColor(b)
                })
            },
            palette: b,
            extraReplacerAttr: {
                rel: "tooltip",
                title: "Set text color of selected cells"
            }
        });
        var a = d.next().find(".sp-dd");
        a.after('<div class="side-icon"><i class="icon-font"></i> </div>');
        a.remove();
        var f = c("#bg-color-picker");
        f.spectrum({
            color: "#FFF",
            showInput: !0,
            className: "color-picker",
            showInitial: !0,
            showPalette: !0,
            showSelectionPalette: !0,
            maxPaletteSize: 10,
            preferredFormat: "hex",
            localStorageKey: "tg.spectrum",
            change: function(a) {
                var b = a.toHexString();
                e.forEachSelectedCellView(function(a) {
                    a.style.setBgColor(b)
                })
            },
            palette: b,
            extraReplacerAttr: {
                rel: "tooltip",
                title: "Set background color of selected cells"
            }
        });
        c("#color-clear").click(function() {
            e.forEachSelectedCellView(function(a) {
                a.style.clearBgColor();
                a.style.clearTextColor()
            })
        });
        b = f.next().find(".sp-dd");
        b.after('<div class="side-icon"><i class="icon-tint"></i> </div>');
        b.remove();
        var g = !1;
        c("#font-family-select").selectpicker();
        c("#font-family-select").change(function() {
            var a = c(this).val();
            !g && 0 < a.length && e.forEachSelectedCellView(function(b) {
                b.style.addFontStyle("font-family", a)
            })
        });
        e.on("single_cell_selected", function(a) {
            var b = a.view.style,
                e = b.font_style["font-family"] || "ff-serif";
            g = !0;
            c("#font-family-select").selectpicker("val", e);
            (e = b.bg_color) ||
            (e = a.view.dom.css("background-color"));
            e && f.spectrum("set", e);
            (b = b.text_color) || (b = a.view.dom.css("color"));
            b && d.spectrum("set", b);
            g = !1
        });
        for (var b = "xx-small x-small small medium large x-large xx-large".split(" "), a = [10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 32, 36], n = c("#font-size-select"), p = 0; p < a.length; ++p) n.append(c("<option/>").attr("value", a[p] + "px").addClass("font-size-" + a[p]).text(a[p] + "px"));
        n.append(c("<option/>").attr("value", "inherit").text("Default font size"));
        for (p = 0; p < b.length; ++p) n.append(c("<option/>").attr("value",
            b[p]).addClass("font-size-" + b[p]).text(b[p]));
        n.selectpicker();
        n.change(function() {
            if (!g) {
                var a = c(this).val();
                e.forEachSelectedCellView(function(b) {
                    b.style.addFontStyle("font-size", a)
                })
            }
        });
        e.on("single_cell_selected", function(a) {
            a = a.view.style.font_style["font-size"] || "inherit";
            g = !0;
            n.selectpicker("val", a);
            g = !1
        });
        this.initThemeSelection()
    };
    g.prototype.initThemeSelection = function() {
        var e = this;
        e.theme_selector = {
            themes: {},
            addTheme: function(b, c) {
                this.themes[b + "Theme"] = c;
                this.trigger("theme_added", b, c)
            },
            setTheme: function(b) {
                this.themes = b;
                this.trigger("theme_set", b)
            }
        };
        c.observable(e.theme_selector);
        c("#theme-select").click(function() {
            e.showThemeChooser()
        })
    };
    g.prototype.showThemeChooser = function() {
        var e = this;
        if (!this.theme_chooser) {
            var b = c("<div/>").addClass("theme-chooser");
            c("<div/>").addClass("close-btn").text("Close [X]").click(function() {
                e.table_view.setTheme(e.theme_selector.themes);
                b.hide()
            }).appendTo(b);
            c("<h2>Select table theme</h2>").appendTo(b);
            c("<p/>").text("Please, click on your chosen table styles below to compose a final table theme.").appendTo(b);
            ["Color", "Border", "Alternate Rows/Columns "].forEach(function(a) {
                var d = a + "Theme";
                c("<h3/>").html('<i class="open-mark icon-chevron-down"></i><i class="closed-mark icon-chevron-right"></i> ' + a + " Theme").appendTo(b);
                var g = c("<div/>").appendTo(b);
                c.each(TableThemes[a + "Themes"], function(b, p) {
                    var m = {};
                    m[d] = b;
                    var q = TableThemes.createTheme(m),
                        t = c("<table class='example-table'>        <tr><td class='hide'></td><td class='hide'></td><td class='hide'></td><td class='hide'></td><td class='hide'></td></tr>        <tr><th style='display:none'></th><th>Company</th><th>Q1</th><th>Q2</th><th>Q3</th></tr>        <tr><td style='display:none'></td><td>Microsoft</td><td>20.3</td><td>30.5</td><td>23.5</td></tr>        <tr><td style='display:none'></td><td>Google</td><td>50.2</td><td>40.63</td><td>45.23</td></tr>        <tr><td style='display:none'></td><td>Apple</td><td>25.4</td><td>30.2</td><td>33.3</td></tr>        </table>").addClass(q).appendTo(g).click(function() {
                            e.theme_selector.addTheme(a,
                                b)
                        });
                    e.theme_selector.on("theme_added", function(c, d) {
                        if (a == c) b == d ? t.addClass("selected") : t.removeClass("selected");
                        else {
                            m[c + "Theme"] = d;
                            var e = TableThemes.createTheme(m);
                            t.removeClass(q).addClass(e);
                            q = e
                        }
                    });
                    e.theme_selector.on("theme_set", function(a) {
                        a[d] == b ? t.addClass("selected") : t.removeClass("selected");
                        m = c.extend({}, a);
                        m[d] = b;
                        a = TableThemes.createTheme(m);
                        t.removeClass(q).addClass(a);
                        q = a
                    })
                })
            });
            b.appendTo(c("body"));
            b.present("SimpleAccordion", {
                item_header_selector: "h3"
            });
            this.theme_chooser = b;
            e.theme_selector.setTheme(e.theme_selector.themes)
        }
        var d =
            c("#theme-select").offset();
        this.theme_chooser.css({
            left: c(".tableview").first().offset().left,
            top: d.top + 30
        }).fadeIn()
    };
    g.prototype.initResultControlPanel = function() {
        ZeroClipboard.config({
            swfPath: "/static/ZeroClipboard.swf"
        });
        var e = this;
        (new ZeroClipboard(c(".with-zero-clipboard"))).on("copy", function(b) {
            b = c(b.target).data("action-id");
            "cell_contents_cut" == b ? (b = e.table_view.cutSelected(), ZeroClipboard.setData("text/plain", b)) : "cell_contents_copy" == b ? ZeroClipboard.setData("text/plain", e.table_view.copySelected()) :
                "copy-to-clipboard" == b && (b = c("#result-code").text(), -1 != navigator.appVersion.indexOf("Win") && (b = b.replace(/\n/g, "\r\n")), ZeroClipboard.setData("text/plain", b))
        })
    };
    g.prototype.initUndoRedo = function() {
        var e = new UnReDo(this.table_view);
        this.unredo = e;
        e.addChange();
        c(document).keydown(function(b) {
            b.ctrlKey && 90 == b.which && "DIV" != b.target.nodeName ? e.undo() : b.ctrlKey && 89 == b.which && "DIV" != b.target.nodeName && e.redo()
        });
        c("#edit_undo").click(function() {
            e.undo()
        });
        c("#edit_redo").click(function() {
            e.redo()
        })
    };
    g.prototype.initTableSave = function() {
        var e = this;
        c("#table-name").keydown(function(b) {
            13 == b.which && b.preventDefault()
        });
        c("#table-save-link").click(function() {
            var b = JSON.stringify(e.table_view.dump()),
                b = b.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\']/g, "\\'").replace(/[\/]/g, "\\/").replace(/[\b]/g, "\\b").replace(/[\f]/g, "\\f").replace(/[\n]/g, "\\n").replace(/[\r]/g, "\\r").replace(/[\t]/g, "\\t");
            c("#table-save-data").val(b);
            b = c("#table-save-form").serialize();
            c.fileDownload("/table-save", {
                dialogOptions: {
                    modal: !1
                },
                httpMethod: "POST",
                data: b,
                successCallback: function() {
                    c("#save_table_dialog").modal("hide")
                }
            });
            return !1
        })
    };
    g.prototype.initTableAutosave = function() {
        function e() {
            c("#edit_autosave i").removeClass("icon-check-minus").addClass("icon-check")
        }

        function b() {
            c("#edit_autosave i").removeClass("icon-check").addClass("icon-check-minus")
        }
        var d = this,
            a = docCookies.getItem("tg-autosave"),
            f = null === a || "1" === a;
        f ? e() : b();
        c("#edit_autosave").click(function() {
            f ? (f = !1, docCookies.setItem("tg-autosave",
                "0", Infinity), DB("tg-table").put(""), d.persistence.disable(), b()) : (f = !0, docCookies.setItem("tg-autosave", "1", Infinity), d.persistence.enable(), e())
        });
        f && (a = PersistenceHelper.load(), null != a && this.table_view.load(a))
    };
    g.prototype.initTableCellContextMenu = function() {
        var c = this.table_view,
            b = c.dom;
        b.get(0).oncontextmenu = function() {
            return !1
        };
        b.contextmenu({
            target: "#table-cell-menu"
        });
        this.observable.on("cell_contents_cut", function(b) {
            b = c.copySelected();
            console.log("Cutting text: " + b);
            ZeroClipboard.setData("text/txt",
                "dupa")
        });
        this.observable.on("cell_contents_copy", function(c) {
            b.contextmenu("hide")
        })
    };
    g.prototype.init_table_context_menus = function() {
        function e() {
            c.each(c(".aux-cell-column"), function(a, b) {
                c(b).contextmenu({
                    target: "#table-aux-col-menu"
                })
            })
        }

        function b() {
            c.each(c(".aux-cell-row"), function(a, b) {
                c(b).contextmenu({
                    target: "#table-aux-row-menu"
                })
            })
        }
        var d = this,
            a = d.table_view,
            f = d.table_view.model;
        c("#table-aux-col-menu").present("SimpleMenu", {
            menu_item_id_attr: "data-menu-item-id"
        });
        var g = c("#table-aux-col-menu").data("SimpleMenu");
        g && (c('*[data-menu-item-id="add_to_the_left"]').click(function() {
            var b = a.getSelectionBounds();
            b && f.insertEmptyColumn(b.left)
        }), c('*[data-menu-item-id="add_to_the_right"]').click(function() {
            var b = a.getSelectionBounds();
            b && f.insertEmptyColumn(b.right + 1)
        }), c('*[data-menu-item-id="remove_column"]').click(function() {
            a.removeSelectedColumns()
        }), c('*[data-menu-item-id="set_column_width"]').click(function() {
            d.show_column_width_dialog()
        }), e());
        c("#table-aux-row-menu").present("SimpleMenu", {
            menu_item_id_attr: "data-menu-item-id"
        });
        if (g = c("#table-aux-row-menu").data("SimpleMenu")) c('*[data-menu-item-id="add_row_above"]').click(function() {
            var b = a.getSelectionBounds();
            b && f.insertEmptyRow(b.top)
        }), c('*[data-menu-item-id="add_row_below"]').click(function() {
            var b = a.getSelectionBounds();
            b && f.insertEmptyRow(b.bottom + 1)
        }), c('*[data-menu-item-id="remove_row"]').click(function() {
            a.removeSelectedRows()
        }), b();
        f.on("row_inserted", b);
        f.on("column_inserted", e)
    };
    g.prototype.initColumnWidthDialog = function() {
        function e() {
            for (var c = parseInt(a.val()),
                    e = b.table_view, g = e.getSelectionBounds(), p = g.left; p <= g.right; ++p) e.setSingleColumnWidth(p, c);
            d.modal("hide")
        }
        var b = this,
            d = c("#column_width_dialog"),
            a = c('input[type="number"]', d);
        c('input[type="number"]', d).keydown(function(a) {
            13 == a.which && (a.preventDefault(), e())
        });
        c('input[type="submit"]', d).click(function(a) {
            a.preventDefault();
            e()
        })
    };
    g.prototype.show_column_width_dialog = function() {
        var e = c("#column_width_dialog");
        if (null != this.table_view.getSelectedCell()) {
            var b = this.table_view.getSelectionBounds(),
                b = this.table_view.getColumnWidths()[b.left];
            c('input[type="number"]', e).val(b);
            e.modal("show")
        }
    };
    g.prototype.initTableShare = function() {
        function e(a) {
            c("#table-share-link-btn").hide();
            c("#share-table-error").text(a).show()
        }

        function b(a) {
            2E3 >= a.length ? (c("#table-share-data").val(a), a = c("#table-share-form").serialize(), c.ajax({
                url: "/table-share",
                type: "POST",
                data: a,
                success: function(a, b, d) {
                    c("#table-share-link-btn").removeClass("btn-warning").addClass("btn-primary").hide();
                    a.success && a.short_url ? (c("#share-table-link").attr("href",
                        a.short_url).text(a.short_url), c("#share-table-result").show()) : e(a.error)
                },
                error: function(a, b, c) {}
            })) : e("We are sorry but only small tables can be shared")
        }
        var d = this.table_view;
        c("#share-table-btn").click(function() {
            c("#share-table-error").hide();
            c("#share-table-result").hide();
            c("#table-share-link-btn").removeClass("btn-warning").addClass("btn-primary").text("Get link to your table").show();
            c("#share_table_dialog").modal("show")
        });
        c("#table-share-link-btn").click(function() {
            c(this).removeClass("btn-info").addClass("btn-warning").text("Please wait...");
            var a = d.dump();
            CompressUtils.compress_str_64(JSON.stringify(a), b)
        });
        c("#share-table-link").click(function() {
            var a = c(this).attr("href");
            window.open(a, "_blank").focus()
        })
    };
    return g
}(jQuery);

function DB(c) {
    var g = window.localStorage || {};
    return {
        get: function() {
            return JSON.parse(g[c] || "{}")
        },
        put: function(e) {
            g[c] = JSON.stringify(e)
        }
    }
};
var UnReDo = function() {
        function c(c) {
            var e = this;
            this.curr_state = null;
            this.undo_list = [];
            this.redo_list = [];
            this.table_view = c;
            this.ignore_next_change = !1;
            this.size_limit = 10;
            var b = null;
            c.on("state_change", function() {
                null != b && window.clearTimeout(b);
                b = setTimeout(function() {
                    e.ignore_next_change || e.addChange();
                    e.ignore_next_change = !1
                }, 600)
            })
        }
        c.prototype.addChange = function() {
            var c = this.table_view.dump();
            null == this.curr_state ? this.curr_state = c : (this.undo_list.length == this.size_limit && this.undo_list.splice(0,
                1), this.undo_list.push(this.curr_state), this.curr_state = c, this.redo_list.splice(0, this.redo_list.length))
        };
        c.prototype.undo = function() {
            0 != this.undo_list.length && (this.redo_list.push(this.curr_state), this.curr_state = this.undo_list.pop(), this.ignore_next_change = !0, this.table_view.load(this.curr_state))
        };
        c.prototype.redo = function() {
            0 != this.redo_list.length && (this.undo_list.push(this.curr_state), this.curr_state = this.redo_list.pop(), this.ignore_next_change = !0, this.table_view.load(this.curr_state))
        };
        c.prototype.clear =
            function() {
                this.undo_list.length = 0;
                this.redo_list.length = 0;
                this.curr_state = null
            };
        return c
    }(),
    PersistenceHelper = function() {
        function c(c) {
            this.table_view = c;
            this.timeout = null;
            this.storage = DB("tg-table");
            this.enabled = !0
        }
        c.prototype.run = function() {
            null != this.timeout && window.clearInterval(this.timeout);
            this.save();
            var c = this;
            this.timeout = setInterval(function() {
                c.enabled && c.save()
            }, 4E3)
        };
        c.prototype.save = function() {
            var c = this.table_view.dump();
            this.storage.put(c)
        };
        c.load = function() {
            return DB("tg-table").get()
        };
        c.prototype.disable = function() {
            this.enabled = !1
        };
        c.prototype.enable = function() {
            this.enabled = !0
        };
        return c
    }();
var HTMLExportOptions = {
        CENTERING: "Center table horizontally"
    },
    HTMLExport = function() {
        function c(b, a) {
            var c = [],
                e;
            for (e in b) b.hasOwnProperty(e) && "_" != String(e).substr(0, 1) && c.push(e + ":" + b[e]);
            c = c.join(";");
            return a ? c : "{" + c + "}"
        }

        function g(b) {
            if (null == b || "object" != typeof b) return b;
            if (b instanceof Date) {
                var a = new Date;
                a.setTime(b.getTime());
                return a
            }
            if (b instanceof Array) {
                for (var a = [], c = 0, e = b.length; c < e; c++) a[c] = g(b[c]);
                return a
            }
            if (b instanceof Object) {
                a = {};
                for (c in b) b.hasOwnProperty(c) && (a[c] = g(b[c]));
                return a
            }
            throw Error("Unable to copy obj! Its type isn't supported.");
        }

        function e(b, a) {
            for (var c = [], e = 0; e < a; ++e) c.push(b);
            return c
        }

        function b(b, a) {
            var c = "\n";
            b && (c += TableThemes.themeToStr(b, ".tg") + "\n");
            for (var e in a) a.hasOwnProperty(e) && (c += e + a[e] + "\n");
            return Utils.format_tag("style", c, {
                type: "text/css"
            })
        }
        return function(d, a, f, k, n) {
            f = f || !1;
            void 0 == k && (k = "\n");
            var p = d.model,
                m = [],
                q = "" == k ? 0 : 2,
                t = d.style_class,
                x = !a && t && -1 == t.indexOf("zerocss");
            a = {};
            var B = {},
                v = {},
                C = 0,
                K = g(TableThemes.getThemeById(t)),
                A = d.getCellView(0, 0).style;
            A && (A = A.getPadding(), void 0 != A.top && (K.td.padding = A.top + "px " + A.left + "px", K.th.padding = A.top + "px " + A.left + "px"));
            for (var y = 0; y < p.row_count; ++y) {
                var E = e(" ", 2 * q).join(""),
                    N = [];
                p.forEachCellInRow(y, function(a, b) {
                    if (a.isVisible()) {
                        var d = {};
                        1 == y % 2 && K && K.hasOwnProperty("_row_odd_td") && K._row_odd_td._active ? d = TableThemes.combineThemes([d, K._row_odd_td]) : 0 < y && 1 == b % 2 && K && K.hasOwnProperty("_col_even_td") && K._col_even_td._active && (d = TableThemes.combineThemes([d, K._col_even_td]));
                        var d = TableThemes.combineThemes([d, a.view.style.toCSS()]),
                            e = String;
                        var g = JSON.stringify(d),
                            k = 0,
                            n, p;
                        if (0 != g.length) {
                            n = 0;
                            for (var m = g.length; n < m; n++) p = g.charCodeAt(n), k = (k << 5) - k + p, k |= 0
                        }
                        e = e(k);
                        if (!B.hasOwnProperty(e)) {
                            B[e] = d;
                            ++C;
                            g = Math.abs(e);
                            k = Math.pow(36, 4);
                            g %= k;
                            k = "";
                            for (n = 0; 4 > n; ++n) k += "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" [g % 36], g = Math.floor(g / 36);
                            k = k.split("").reverse().join("");
                            v[e] = "tg-" + k
                        }
                        g = {};
                        x && !f && (g["class"] = v[e]);
                        x && f && (d = TableThemes.combineThemes([K[0 == y ? "th" : "td"],
                            d
                        ]), g.style = c(d, !0));
                        d = y;
                        e = g;
                        void 0 == e && (e = {});
                        1 < a.colspan() && (e.colspan = a.colspan());
                        1 < a.rowspan() && (e.rowspan = a.rowspan());
                        g = textToHTML(a.value().toString());
                        d = Utils.format_tag(0 == d ? "th" : "td", g, e);
                        N.push(E + d)
                    }
                });
                E = e(" ", q).join("");
                m.push([].concat([E + "<tr>"], N, [E + "</tr>"]).join(k))
            } - 1 != n.indexOf(HTMLExportOptions.CENTERING) && (K[" "].margin = "0px auto");
            n = "";
            p = m.join(k);
            m = [""];
            q = {};
            if (x && !f) {
                for (var I in B) B.hasOwnProperty(I) && (n = c(B[I]), "{}" != n && (a[".tg ." + v[I]] = n));
                q["class"] = "tg";
                t = t.split("-");
                t = t[t.length - 1];
                n = b(K, a)
            } else x && f && (q.style = c(K[" "], !0));
            if (d.hasFixedLayout()) {
                d = d.getColumnWidths();
                t = [];
                for (y = a = 0; y < d.length; ++y) d[y] += 1, t.push('<col style="width: ' + d[y] + 'px">'), a += d[y];
                m.push("<colgroup>");
                m.push(t.join(k));
                m.push("</colgroup>");
                q.style += ";table-layout: fixed; width: " + a.toFixed(0) + "px"
            }
            m.push(p);
            m.push("");
            d = Utils.format_tag("table", m.join(k), q);
            m = [];
            n && m.push(n);
            m.push(d);
            return m.join(k)
        }
    }();
var LaTeXExportOptions = {
        CAPTION_ABOVE: "Caption above",
        CAPTION_BELOW: "Caption below",
        CENTERING: "Center table horizontally",
        SCALE_TABLE: "Scale table to text width"
    },
    LaTeXExport = function() {
        function c(a, b) {
            if (!a) throw b || "Assertion failed";
        }

        function g(a, b) {
            for (var c = !1, d = 0; d < b.length && !c; ++d) b[d].val == a && (b[d].count += 1, c = !0);
            c || b.push({
                val: a,
                count: 1
            })
        }

        function e(a) {
            this.table_view = a;
            for (var b = this.table = a.model, c = p(function() {
                    return p(0, b.col_count + 1)
                }, b.row_count), d = 0; d < b.row_count; ++d)
                for (var e = 0; e <
                    b.col_count; ++e) {
                    var f = b.getCell(d, e, !0);
                    if (f.isVisible())
                        for (var g = a.getCellView(d, e, !0).style, k = g.hasBorder("left"), g = g.hasBorder("right"), n = 0; n < f.rowspan(); ++n)
                            for (var m = d + n, q = 0; q < f.colspan(); ++q) {
                                var t = e + q;
                                c[m][t] |= k;
                                c[m][t + 1] |= g
                            }
                }
            for (d = 0; d < b.row_count; ++d)
                for (e = 1; e < b.col_count; ++e) 0 < c[d][e - 1] && 0 < c[d][e] && (c[d][e] = 2);
            a = [];
            for (e = 0; e <= b.col_count; ++e) {
                f = !0;
                for (d = 0; d < b.row_count; ++d) f &= 0 < c[d][e];
                a.push(f)
            }
            this.vlines = c;
            this.continuous_vlines = a
        }

        function b(a) {
            this.table_view = a;
            this.table = a.model;
            this.colors_used = !1;
            var b = this.table,
                c = [],
                d = p(function() {
                    return p(null, b.col_count)
                }, b.row_count);
            this.fg_colors = d;
            for (var e = 0; e < b.row_count; ++e) {
                for (var f = [], k = 0; k < b.col_count; ++k) {
                    var n = a.getCellView(e, k, !1).style;
                    n.hasBgColor() ? (f.push(n.getBgColor()), this.colors_used = !0) : f.push(null);
                    n.hasTextColor() && (d[e][k] = n.getTextColor(), this.colors_used = !0)
                }
                c.push(f)
            }
            f = [];
            for (k = 0; k < b.col_count; ++k) {
                a = [];
                for (e = 0; e < b.row_count; ++e) g(c[e][k], a);
                for (var d = null, n = !1, m = 0; m < a.length; ++m) {
                    var q = a[m];
                    null == d ? d = q : q.count > d.count &&
                        (d = q);
                    null == q.val && (n = !0)
                }
                f.push(null);
                !n && null != d && d.count >= b.row_count / 2 && (f[k] = d.val)
            }
            this.column_colors = f;
            f = [];
            for (e = 0; e < b.row_count; ++e) {
                a = [];
                for (k = 0; k < b.col_count; ++k) g(c[e][k], a);
                d = null;
                n = !1;
                for (m = 0; m < a.length; ++m) q = a[m], null == d ? d = q : q.count > d.count && (d = q), null == q.val && (n = !0);
                f.push(null);
                !n && null != d && d.count >= b.col_count / 2 && (f[e] = d.val)
            }
            this.row_colors = f;
            for (e = a = f = 0; e < b.row_count; ++e)
                for (k = 0; k < b.col_count; ++k) d = this.table.getCell(e, k), d = 1 < d.rowspan() || 1 < d.colspan(), (null == this.column_colors[k] ||
                    d || c[e][k] != this.column_colors[k]) && ++f, (null == this.row_colors[e] || d || c[e][k] != this.row_colors[e]) && ++a;
            if (a < f)
                for (k = 0; k < b.col_count; ++k) this.column_colors[k] = null;
            else
                for (e = 0; e < b.row_count; ++e) this.row_colors[e] = null
        }

        function d(a, b, c) {
            var d = [],
                e = C.getColumnsVLines();
            b.forEach(function(a, b) {
                d.push(e[b]);
                d.push(c.addColumnColor(a[0], b))
            });
            d.push(e[e.length - 1]);
            return d.join("")
        }

        function a(a) {
            for (var b = [], c = 0, d = a.model.col_count; c < d; ++c) b.push(f(a, c));
            return b
        }

        function f(a, b) {
            var c = {
                left: 0,
                center: 0,
                right: 0
            };
            a.forEachCellInColumn(b, function(a) {
                a.cell.isVisible() && (c[a.style.getHorizontalAlign()] += Math.max(0, a.cell.rowspan()))
            });
            return ["left", "center", "right"].sort(function(a, b) {
                return -(c[a] - c[b])
            })[0]
        }

        function k(a) {
            a = a.split(/(?:(^|[^\\]))(\$[^\$]+\$)/g);
            return $.map(a, function(a) {
                return 0 < a.length && "$" == a[0] && "$" == a[a.length - 1] ? a : a.replace(/(^|[^\\])([&%_#\{\}\$])/g, "$1\\$2").replace(/([\[\]])/g, "{$1}").replace(/</g, "\\textless").replace(/[\\](\s|$)/g, "\\textbackslash$1").replace(/\^/g, "\\textasciicircum ").replace(/>/g,
                    "\\textgreater")
            }).join("")
        }

        function n(a, b, c) {
            for (var d = c[b], e = 1; e < a.colspan(); ++e) d += c[b + e];
            return d
        }

        function p(a, b) {
            var c = [];
            if ("function" == typeof a)
                for (var d = 0; d < b; ++d) c.push(a());
            else
                for (d = 0; d < b; ++d) c.push(a);
            return c
        }

        function m(a, b) {
            for (var c = p(0, a.col_count), d = 0; d < a.row_count; ++d) {
                var e = 0,
                    f = b[d];
                a.forEachCellInRow(d, function(a, b) {
                    1 == a.colspan() && (c[b] = Math.max(c[b], f[e].length));
                    1 <= a.colspan() && ++e
                })
            }
            for (d = 0; d < a.row_count; ++d) e = 0, a.forEachCellInRow(d, function(a, f) {
                var g = a.colspan();
                if (1 < g) {
                    var k =
                        b[d][e].length - n(a, f, c),
                        k = k - (g - 1) * K;
                    if (0 < k)
                        for (var m = Math.floor(k / g), k = k % g, p = 0; p < g; ++p) c[f + p] += m, 0 < k && (c[f + p] += 1, k -= 1)
                }
                1 <= g && e++
            });
            return c
        }

        function q(a, b) {
            for (var c = m(b, a), d = [], e = 0; e < b.row_count; ++e) {
                var f = 0,
                    g = a[e],
                    k = [];
                b.forEachCellInRow(e, function(a, b) {
                    if (1 <= a.colspan()) {
                        var d = g[f],
                            e = n(a, b, c);
                        1 < a.colspan() && (e += (a.colspan() - 1) * K);
                        ++f;
                        k.push(t(d, e))
                    }
                });
                d.push(k)
            }
            return d
        }

        function t(a, b) {
            if (a.length < b) {
                for (var c = [], d = a.length; d < b; ++d) c.push(" ");
                a += c.join("")
            }
            return a
        }

        function x(a, b, c, d) {
            if (-1 ==
                a.indexOf(!1)) return b ? 0 == c ? " \\toprule" : c == d ? " \\bottomrule" : " \\midrule" : " \\hline";
            c = "";
            d = 0;
            for (var e = !1, f = b ? "\\cmidrule" : "\\cline", g = "", k = 0; k < a.length; ++k) !e && a[k] ? (d = k, e = !0, b && 0 < d && (g += "l")) : e && !a[k] && (b && k < a.length && (g += "r", g = "(" + g + ")"), c += " " + f + g + "{" + (d + 1) + "-" + k + "}", e = !1, g = "");
            e && (b && (g = "(" + g + ")"), c += " " + f + g + "{" + (d + 1) + "-" + a.length + "} ");
            return c
        }
        var B = ["\\caption{My caption}", "\\label{my-label}"];
        e.prototype = {
            cellNeedsLeftBorder: function(a, b, c) {
                return 1 == this.vlines[a][b] && 0 == b && (0 == this.continuous_vlines[b] ||
                    c)
            },
            cellNeedsRightBorder: function(a, b, c) {
                return 0 < this.vlines[a][b + 1] && (0 == this.continuous_vlines[b + 1] || c)
            },
            getColumnsVLines: function() {
                return this.continuous_vlines.map(function(a) {
                    return 1 == a ? "|" : ""
                })
            }
        };
        b.prototype = {
            addCellColorCode: function(a, b, c, d) {
                var e = this.table.getCell(b, c);
                if (e.isVisible()) {
                    var f = this.fg_colors[b][c];
                    f && (a = "{\\color" + this.genLaTeXColor(f) + " " + a + "}");
                    e = 1 < e.rowspan() || 1 < e.colspan();
                    f = this.table_view.getCellView(b, c, !0).style;
                    f = f.hasBgColor() ? f.getBgColor() : null;
                    c = this.column_colors[c];
                    b = this.row_colors[b];
                    f && (f != c && f != b || e) ? a = "\\cellcolor" + this.genLaTeXColor(f) + a : d && (f || c) && (a = "\\cellcolor" + this.genLaTeXColor(f || c) + a);
                    return a
                }
            },
            genLaTeXColor: function(a) {
                c(a);
                a = String(a);
                "#" == a.substr(0, 1) && (a = a.substr(1).toUpperCase());
                return "[HTML]{" + a + "}"
            },
            addColumnColor: function(a, b) {
                c(0 <= b && b < this.table.col_count);
                var d = a,
                    e = this.column_colors[b];
                e && (d = "\n>{\\columncolor" + this.genLaTeXColor(e) + "}" + a + " ");
                return d
            },
            addRowColor: function(a, b) {
                c(0 <= b && b < this.table.row_count);
                var d = a,
                    e = this.row_colors[b];
                e && (d = "\\rowcolor" + this.genLaTeXColor(e) + " " + a);
                return d
            },
            areColorsUsed: function() {
                return this.colors_used
            }
        };
        var v = null,
            C = null,
            K = 3;
        return function(c, f, g, n, m) {
            f = f || !1;
            g = g || !1;
            m = m || [];
            var p = [],
                t = !n;
            n = -1 != m.indexOf(LaTeXExportOptions.SCALE_TABLE);
            var P = c.model,
                U = [],
                K = [],
                R = a(c);
            v = new b(c);
            C = new e(c);
            for (var la = 0; la < P.row_count; ++la) {
                var Ha = [],
                    J = [],
                    ja = la == P.row_count - 1;
                P.forEachCellInRow(la, function(a, b) {
                    c.getCellView(la, b, !0);
                    var d;
                    d = a;
                    var e = la,
                        f = g;
                    if (0 > d.colspan()) d = null;
                    else {
                        var n = d.rowspan(),
                            m = 1 < n,
                            p = !0;
                        if (1 != d.rowspan())
                            if (p = !1, v.areColorsUsed())
                                if (1 < d.rowspan()) m = !1;
                                else {
                                    var q = c.model.getCell(e, b);
                                    q.rowspan() == -d.rowspan() + 1 && (m = p = !0, n = -q.rowspan());
                                    e += d.rowspan();
                                    d = q
                                } else 1 < d.rowspan() ? p = !0 : (q = c.model.getCell(e, b), e += d.rowspan(), d = q);
                        var q = c.getCellView(e, b, !0).style.getHorizontalAlign(),
                            t = "";
                        p && (t = d.isVisible() ? d.value().toString() : "", t = t.trim(), f && (t = k(t)), -1 != t.indexOf("\n") && (f = q, t = t.split(/\n/g), f = f ? f[0] : "c", t = "\\begin{tabular}[c]{@{}" + f + "@{}}" + t.join("\\\\ ") + "\\end{tabular}"), f = c.getCellView(e,
                            b).style, f.hasFontStyle("bold") && (t = "\\textbf{" + t + "}"), f.hasFontStyle("italic") && (t = "\\textit{" + t + "}"));
                        f = e;
                        p = c.model;
                        if (0 > f || f >= p.row_count || 0 > b || b >= p.col_count) f = !1;
                        else var p = p.getCell(f, b, !0),
                            P = c.getCellView(f, b).style.getHorizontalAlign(),
                            f = 1 < p.colspan() || C.cellNeedsLeftBorder(f, b, !1) || C.cellNeedsRightBorder(f, b, !1) || P != R[b];
                        t = v.addCellColorCode(t, e, b, f);
                        t.match(/^\s+$/) && (t = "~");
                        m && (t = "\\multirow{" + n + "}{*}{" + t + "}");
                        f ? (q = q[0], C.cellNeedsLeftBorder(e, b, !0) && (q = "|" + q), C.cellNeedsRightBorder(e,
                            b, !0) && (q += "|"), t = "\\multicolumn{" + Math.max(1, d.colspan()) + "}{" + q + "}{" + t + "}") : 0 > d.rowspan() && (t = "");
                        d = t
                    }
                    null != d && Ha.push(d);
                    J.push(c.hasBorder(la, b, "top"));
                    ja && K.push(c.hasBorder(la, b, "bottom"))
                });
                p.push(Ha);
                var ca = x(J, f, la, P.row_count);
                U.push(ca);
                ja && (ca = x(K, f, la + 1, P.row_count), U.push(ca))
            }
            t && (p = q(p, P));
            var t = d(c, R, v),
                aa = [];
            aa.push("\\begin{table}[h]"); - 1 != m.indexOf(LaTeXExportOptions.CENTERING) && aa.push("\\centering"); - 1 != m.indexOf(LaTeXExportOptions.CAPTION_ABOVE) && (aa = aa.concat(B));
            f && (t = "@{}" +
                t + "@{}");
            n && aa.push("\\resizebox{\\textwidth}{!}{%");
            aa.push("\\begin{tabular}{" + t + "}");
            0 < U[0].length && aa.push($.trim(U[0]));
            p.forEach(function(a, b) {
                var c = a.join(" & ");
                if (b + 1 < P.row_count || 0 != $.trim(U[b + 1]).length) c += " \\\\";
                var d = v.addRowColor("", b);
                0 < d.length && aa.push(d);
                c += U[b + 1];
                aa.push(c)
            });
            aa.push("\\end{tabular}");
            n && aa.push("}"); - 1 != m.indexOf(LaTeXExportOptions.CAPTION_BELOW) && (aa = aa.concat(B));
            aa.push("\\end{table}");
            m = aa.join("\n");
            p = [];
            f && p.push("% \\usepackage{booktabs}"); - 1 != m.search("\\multirow") &&
                p.push("% \\usepackage{multirow}");
            n && p.push("% \\usepackage{graphicx}");
            v.areColorsUsed() && (p.push("% \\usepackage[table,xcdraw]{xcolor}"), p.push('% If you use beamer only pass "xcolor=table" option, i.e. \\documentclass[xcolor=table]{beamer}'));
            0 < p.length && (m = "% Please add the following required packages to your document preamble:\n" + p.join("\n") + "\n" + m);
            return m
        }
    }();
var TextExport = function() {
    function c(a, b, c) {
        for (var d = c[b], e = 1; e < a.colspan(); ++e) d += c[b + e];
        return d += a.colspan() - 1
    }

    function g(a, b, c, f) {
        for (var g = f[b] + 1, k = [], B = 0; B < g; ++B) {
            var v = d("", c.length);
            k.push(v)
        }
        a.forEachCellInRow(b, function(v, B) {
            var A = !1;
            if (v.isVisible()) A = 1 == v.rowspan(), e(v).forEach(function(a, b) {
                b >= g || (k[b][B] = a)
            });
            else if (0 < v.colspan() && 0 > v.rowspan()) {
                for (var y = a.getCell(b, B), E = e(y), N = 0, I = 0; I < -v.rowspan(); ++I) N += f[b - (I + 1)] + 1;
                for (var Z = Math.min(E.length, N + g), I = N; I < Z; ++I) k[I - N][B] = E[I];
                y.rowspan() ==
                    -v.rowspan() + 1 && (A = !0)
            }
            if (A) {
                for (I = A = 0; I < v.colspan(); ++I) A += c[B + I];
                A += v.colspan() - 1;
                I = d("-", A).join("");
                k[g - 1][B] = I
            }
        });
        return k
    }

    function e(a) {
        a = a.value().toString();
        a = a.replace(/&nbsp;/ig, " ").replace(/\n$/, "");
        var b = [];
        a.split("\n").forEach(function(a) {
            b.push(" " + a + " ")
        });
        return b
    }

    function b(a) {
        var b = 0;
        e(a).forEach(function(a) {
            b = Math.max(b, wcwidth(a))
        });
        return b
    }

    function d(a, b) {
        for (var c = [], d = 0; d < b; ++d) c.push(a);
        return c
    }

    function a(a) {
        for (var e = d(0, a.col_count), f = 0; f < a.row_count; ++f) a.forEachCellInRow(f,
            function(a, c) {
                if (1 == a.colspan()) {
                    var d = b(a);
                    e[c] = Math.max(e[c], d)
                }
            });
        for (f = 0; f < a.row_count; ++f) a.forEachCellInRow(f, function(a, d) {
            if (!(1 >= a.colspan())) {
                var f = b(a) - c(a, d, e);
                if (0 < f)
                    for (var g = Math.floor(f / a.colspan()), f = f % a.colspan(), k = 0; k < a.colspan(); ++k) e[d + k] += g, 0 < f && (e[d + k] += 1, f -= 1)
            }
        });
        return e
    }

    function f(a) {
        for (var b = [], c = 0; c < a.row_count; ++c) {
            var d = 0;
            a.forEachCellInRow(c, function(a) {
                1 < a.rowspan() || (d = Math.max(d, e(a).length))
            });
            b.push(d)
        }
        for (c = 0; c < a.row_count; ++c) a.forEachCellInRow(c, function(a) {
            if (!(1 >=
                    a.rowspan())) {
                for (var d = e(a).length, f = 0, g = 0; g < a.rowspan(); ++g) f += b[c + g];
                f += a.rowspan() - 1;
                g = d - f;
                if (0 < g)
                    for (d = Math.floor(g / a.rowspan()), f = g % a.rowspan(), g = 0; g < a.rowspan(); ++g) b[c + g] += d, 0 < f && (b[c + g] += 1, f -= 1)
            }
        });
        return b
    }

    function k(a, b, c) {
        "left" == c ? (c = wcwidth(a), c < b && (a += d(" ", b - c).join(""))) : "right" == c ? (c = wcwidth(a), c < b && (a = d(" ", b - c).join("") + a)) : "center" == c && (c = wcwidth(a), b -= c, 0 < b && (c = Math.floor(b / 2), a = d(" ", Math.floor(b / 2) + b % 2).join("") + a + d(" ", c).join("")));
        return a
    }
    return function(b) {
        var e = b.model,
            m = a(e),
            q = f(e),
            t = [],
            x = [""];
        e.forEachCellInRow(0, function(a, b) {
            if (!(1 > a.colspan())) {
                var e = c(a, b, m);
                x.push(d("-", e).join(""))
            }
        });
        x.push("");
        t.push(x.join("+"));
        for (var B = 0; B < e.row_count; ++B) {
            var v = g(e, B, m, q);
            v.forEach(function(a, d) {
                var f = [""];
                a.forEach(function(a, d) {
                    var g = e.getCell(B, d, !0);
                    if (!(1 > g.colspan())) {
                        var g = c(g, d, m),
                            q = b.getCellView(B, d).style;
                        f.push(k(a, g, q.getHorizontalAlign()))
                    }
                });
                f.push("");
                t.push(f.join(d < v.length - 1 ? "|" : "+"))
            })
        }
        return t.join("\n")
    }
}();
var MarkdownExport = function() {
    function c(a, b, c) {
        for (var d = c[b], e = 1; e < a.colspan(); ++e) d += c[b + e];
        return d += a.colspan() - 1
    }

    function g(a, b, c, f) {
        var g = f[b];
        0 == b && ++g;
        for (var k = [], B = 0; B < g; ++B) {
            var v = d("", c.length);
            k.push(v)
        }
        a.forEachCellInRow(b, function(v, B) {
            var A = 0 == b;
            if (v.isVisible()) e(v).forEach(function(a, b) {
                b >= g || (k[b][B] = a)
            });
            else if (0 < v.colspan() && 0 > v.rowspan()) {
                for (var y = a.getCell(b, B), E = e(y), N = 0, y = 0; y < -v.rowspan(); ++y) N += f[b - (y + 1)] + 1;
                for (var I = Math.min(E.length, N + g), y = N; y < I; ++y) k[y - N][B] = E[y]
            }
            if (A) {
                for (y =
                    A = 0; y < v.colspan(); ++y) A += c[B + y];
                A += v.colspan() - 1;
                A = d("-", A).join("");
                k[g - 1][B] = A
            }
        });
        return k
    }

    function e(a) {
        a = a.value().toString();
        a = a.replace(/&nbsp;/ig, " ").replace(/\n$/, "");
        a = a.replace(/\n/g, " ");
        var b = [];
        a.split("\n").forEach(function(a) {
            b.push(" " + a + " ")
        });
        return b
    }

    function b(a) {
        var b = 0;
        e(a).forEach(function(a) {
            b = Math.max(b, wcwidth(a))
        });
        return b
    }

    function d(a, b) {
        for (var c = [], d = 0; d < b; ++d) c.push(a);
        return c
    }

    function a(a) {
        for (var e = d(0, a.col_count), f = 0; f < a.row_count; ++f) a.forEachCellInRow(f, function(a,
            c) {
            if (1 == a.colspan()) {
                var d = b(a);
                e[c] = Math.max(e[c], d)
            }
        });
        for (f = 0; f < a.row_count; ++f) a.forEachCellInRow(f, function(a, d) {
            if (!(1 >= a.colspan())) {
                var f = b(a) - c(a, d, e);
                if (0 < f)
                    for (var g = Math.floor(f / a.colspan()), f = f % a.colspan(), k = 0; k < a.colspan(); ++k) e[d + k] += g, 0 < f && (e[d + k] += 1, f -= 1)
            }
        });
        for (a = 0; a < e.length; ++a) e[a] = Math.max(e[a], 3);
        return e
    }

    function f(a) {
        for (var b = [], c = 0; c < a.row_count; ++c) {
            var d = 0;
            a.forEachCellInRow(c, function(a) {
                1 < a.rowspan() || (d = Math.max(d, e(a).length))
            });
            b.push(d)
        }
        for (c = 0; c < a.row_count; ++c) a.forEachCellInRow(c,
            function(a) {
                if (!(1 >= a.rowspan())) {
                    for (var d = e(a).length, f = 0, g = 0; g < a.rowspan(); ++g) f += b[c + g];
                    f += a.rowspan() - 1;
                    g = d - f;
                    if (0 < g)
                        for (d = Math.floor(g / a.rowspan()), f = g % a.rowspan(), g = 0; g < a.rowspan(); ++g) b[c + g] += d, 0 < f && (b[c + g] += 1, f -= 1)
                }
            });
        return b
    }

    function k(a, b, c, e) {
        if ("left" == c) {
            var f = wcwidth(a);
            f < b && (a += d(" ", b - f).join(""))
        } else "right" == c ? (f = wcwidth(a), f < b && (a = d(" ", b - f).join("") + a)) : "center" == c && (f = wcwidth(a), b -= f, 0 < b && (f = Math.floor(b / 2), a = d(" ", Math.floor(b / 2) + b % 2).join("") + a + d(" ", f).join("")));
        1 == e && ("right" ==
            c ? a = a.substring(0, a.length - 1) + ":" : "center" == c && (a = ":" + a.substring(1, a.length - 1) + ":"));
        return a
    }
    return function(b, d, e) {
        for (var q = b.model, t = a(q), x = f(q), B = [], v = 0; v < q.row_count; ++v) g(q, v, t, x).forEach(function(a, f) {
            var g = [],
                x = 0 == v && 1 == f;
            a.forEach(function(a, d) {
                var f = q.getCell(v, d, !0);
                if (!(1 > f.colspan())) {
                    var p = c(f, d, t);
                    1 == e && (p = f.value().toString().length + 1);
                    f = b.getCellView(v, d).style;
                    g.push(k(a, p, f.getHorizontalAlign(), x))
                }
            });
            g.push("");
            B.push("|" + g.join(d ? "\t|" : "|"))
        });
        return B.join("\n")
    }
}();
var MediaWikiExport = function() {
    function c(b) {
        var c = [];
        b.forEach(function(a, b) {
            c.push(g(a, b))
        });
        return '{| class="wikitable"\n' + (0 < c.length ? c.join("\n|-\n") : "") + "\n|}"
    }

    function g(b, c, a) {
        var f = [],
            g = 0 == c ? "! " : "| ";
        b.forEach(function(a, b) {
            a.isVisible() && f.push(g + e(a))
        });
        return f.join(a ? " || " : "\n")
    }

    function e(b) {
        var c = b.value().toString(),
            c = c.replace(/&nbsp;/g, " "),
            c = $.trim(c),
            a = [];
        1 < b.rowspan() && a.push('rowspan="' + b.rowspan() + '"');
        1 < b.colspan() && a.push('colspan="' + b.colspan() + '"');
        b = b.view.style;
        var e = [],
            g = b.getHorizontalAlign();
        "left" != g && e.push("text-align: " + g + ";");
        b.font_style.hasOwnProperty("bold") && b.font_style.bold && e.push("font-weight: bold;");
        b.font_style.hasOwnProperty("italic") && b.font_style.italic && e.push("font-style: italic;");
        b = e.join(" ");
        "" != b && a.push('style="' + b + '"');
        b = "";
        0 < a.length && (b = a.join(" ") + " | ");
        return b + c
    }
    return function(b) {
        return c(b.model.rows)
    }
}();
var init_latex_tables_ui = function(c) {
    function g() {
        var b = c("#latex_table_style").val(),
            b = LaTeXExport(d, "booktabs" == b, c("#escape-special-tex-symbols").is(":checked"), c("#compress-tex-whitespace").is(":checked"), a);
        c("#result-code").text(b);
        Prism.highlightElement(c("#result-code")[0])
    }

    function e(d) {
        c("#escape-special-tex-symbols").change(g);
        c("#compress-tex-whitespace").change(g);
        c('<button class="btn"><i class="icon-cogs"></i> Generate</button>').appendTo(c("#edited_table_container")).click(g);
        c("#latex_table_style").selectpicker();
        c("#latex_table_style").change(function() {
            "booktabs" == c(this).val() && (d.forEachCellInRow(0, function(a) {
                a.style.setBorders("tb")
            }), d.forEachCellInRow(d.model.row_count - 1, function(a) {
                a.style.setBorders("b")
            }));
            g()
        });
        c("#show_example_btn").click(function() {
            b(d);
            g()
        });
        var e = [LaTeXExportOptions.CAPTION_ABOVE, LaTeXExportOptions.CAPTION_BELOW],
            n = !1;
        c("#extra-options").selectpicker().change(function() {
            if (n) return !1;
            var b = c(this).val() || [],
                d = b.diff(a);
            a = b;
            d = 0 < d.length ? d[0] : null; - 1 != e.indexOf(d) && (b = b.diff(e),
                b.push(d), n = !0, c(this).selectpicker("val", b), n = !1, c(this).selectpicker("refresh"), a = b);
            g()
        })
    }

    function b(a) {
        a.reset();
        var b = a.model;
        b.setRows([
            ["Item", "", ""],
            ["Animal", "Description", "Price ($)"],
            ["Gnat", "per gram", "13.65"],
            ["", "each", "0.01"],
            ["Gnu", "stuffed", "92.50"],
            ["Emu", "stuffed", "33.33"],
            ["Armadillo", "frozen", "8.99"]
        ]);
        b.mergeCells(0, 0, 0, 1);
        a.forEachCellViewInRange(function(a) {
            a.style.setHorizontalAlign("right")
        }, 0, 2, 6, 2);
        a.getCellView(0, 0).style.setHorizontalAlign("center");
        a.clearSelection();
        a.forEachCellInRow(0, function(a) {
            a.style.setBorders("t")
        });
        a.forEachCellInRange(1, 0, 1, 1, function(a) {
            a.style.setBorders("t")
        });
        a.forEachCellInRow(2, function(a) {
            a.style.setBorders("t")
        });
        a.forEachCellInRow(6, function(a) {
            a.style.setBorders("b")
        })
    }
    var d = null,
        a = [];
    return function(a, b) {
        var c = new TableModel;
        c.insertRow([""]);
        c.resize(4, 5);
        d = new TableView(c, "#edited_table_container");
        d.setLoadIgnore({
            theme: !0,
            fixed_layout: !0
        });
        e(d);
        new MainUI(d);
        a && Main.init_table_from_json(d, a);
        b && (c = jQuery.parseJSON(b),
            d.load(c));
        g()
    }
}($);
var html_tables_ui = function(c) {
    function g(b, d, a) {
        function f() {
            var a = x.is(":checked");
            return HTMLExport(p, t.is(":checked"), a, a ? "" : "\n", q)
        }

        function g() {
            var a = f();
            c("#result-code").text(a);
            16384 > a.length && Prism.highlightElement(c("#result-code")[0])
        }
        var n = new TableModel;
        n.insertRow([""]);
        var p = new TableView(n, b, {
                column_resize_enabled: !0
            }),
            m = new MainUI(p),
            q = [];
        p.on("theme_set", function(a) {
            null == a ? p.setTheme({
                ColorTheme: "Default",
                BorderTheme: "All borders"
            }) : m.theme_selector.setTheme(a)
        });
        p.theme || p.setTheme({
            ColorTheme: "Default",
            BorderTheme: "All borders"
        });
        c('<button class="btn"><i class="icon-cogs"></i> Generate</button>').appendTo(c("#edited_table_container")).click(g);
        b = c("<div/>", {
            "class": "tab-gen-opt-box"
        }).appendTo(c("#edited_table_container"));
        var t = c('<input type="checkbox">');
        c("<label/>", {
            "class": "checkbox tab-gen-option"
        }).text("Do not generate CSS").append(t).appendTo(b);
        t.change(g);
        var x = c('<input type="checkbox">');
        c("<label/>", {
            "class": "checkbox tab-gen-option"
        }).text("Compact mode").attr("title", "Useful for embedding tables into e-mails - puts styles inline & joins code into a single line").append(x).appendTo(b);
        x.change(g);
        c("#show_example_btn").click(function() {
            e(p);
            g()
        });
        d && Main.init_table_from_json(p, d);
        a && p.load(jQuery.parseJSON(a));
        c("#preview-table-btn").click(function() {
            var a = f();
            g();
            var b = window.open("", "Preview", "width=640,height=400,scrollbars=1");
            b.document.write("<!DOCTYPE html><html><body>" + a + "</body></html>");
            b.focus()
        });
        c("#extra-options").selectpicker().change(function() {
            q = c(this).val() || [];
            g()
        });
        g()
    }

    function e(b) {
        b.reset();
        b.setTheme({
            ColorTheme: "Violet",
            BorderTheme: "All borders",
            "Alternate Rows/Columns Theme": "Alternate rows"
        });
        var c = b.model;
        c.setRows(["Results     ".split(" "), "No Competition John Adam Robert Paul".split(" "), "1 Swimming 1:30 2:05 1:15 1:41".split(" "), "2 Running 15:30 14:10 15:45 16:00".split(" "), "3 Shooting 70% 55% 90% 88%".split(" ")]);
        c.mergeCells(0, 0, 0, 5);
        b.forEachCellViewInRange(function(a) {
            a.style.setHorizontalAlign("right")
        }, 2, 2, 4, 5);
        b.getCellView(0, 0).style.setHorizontalAlign("center")
    }
    return function(b, c) {
        g("#edited_table_container", b, c)
    }
}(jQuery);
(function(c, g) {
    "function" == typeof define && define.amd ? define(c) : g.rangy = c()
})(function() {
    function c(a, b) {
        var c = typeof a[b];
        return "function" == c || !("object" != c || !a[b]) || "unknown" == c
    }

    function g(a, b) {
        return !("object" != typeof a[b] || !a[b])
    }

    function e(a, b) {
        return "undefined" != typeof a[b]
    }

    function b(a) {
        return function(b, c) {
            for (var d = c.length; d--;)
                if (!a(b, c[d])) return !1;
            return !0
        }
    }

    function d(a) {
        return a && C(a, v) && A(a, B)
    }

    function a(a) {
        return g(a, "body") ? a.body : a.getElementsByTagName("body")[0]
    }

    function f(a) {
        g(window,
            "console") && c(window.console, "log") && window.console.log(a)
    }

    function k(a) {
        E.initialized = !0;
        E.supported = !1;
        a = "Rangy is not supported on this page in your browser. Reason: " + a;
        E.config.alertOnFail ? window.alert(a) : f(a)
    }

    function n() {
        if (!E.initialized) {
            var b, e = !1,
                g = !1;
            c(document, "createRange") && (b = document.createRange(), C(b, x) && A(b, t) && (e = !0));
            if ((b = a(document)) && "body" == b.nodeName.toLowerCase())
                if (b && c(b, "createTextRange") && (b = b.createTextRange(), d(b) && (g = !0)), e || g) {
                    E.initialized = !0;
                    E.features = {
                        implementsDomRange: e,
                        implementsTextRange: g
                    };
                    var m, n;
                    for (n in y)(m = y[n]) instanceof p && m.init(m, E);
                    g = 0;
                    for (m = I.length; g < m; ++g) try {
                        I[g](E)
                    } catch (q) {
                        e = "Rangy init listener threw an exception. Continuing. Detail: " + (q.message || q.description || String(q)), f(e)
                    }
                } else k("Neither Range nor TextRange are available");
            else k("No body element found")
        }
    }

    function p(a, b, c) {
        this.name = a;
        this.dependencies = b;
        this.supported = this.initialized = !1;
        this.initializer = c
    }

    function m(a, b, c, d) {
        a = new p(b, c, function(a) {
            if (!a.initialized) {
                a.initialized = !0;
                try {
                    d(E, a), a.supported = !0
                } catch (c) {
                    f("Module '" + b + "' failed to load: " + (c.message || c.description || String(c)))
                }
            }
        });
        y[b] = a
    }

    function q() {}
    var t = "startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),
        x = "setStart setStartBefore setStartAfter setEnd setEndBefore setEndAfter collapse selectNode selectNodeContents compareBoundaryPoints deleteContents extractContents cloneContents insertNode surroundContents cloneRange toString detach".split(" "),
        B = "boundingHeight boundingLeft boundingTop boundingWidth htmlText text".split(" "),
        v = "collapse compareEndPoints duplicate moveToElementText parentElement select setEndPoint getBoundingClientRect".split(" "),
        C = b(c),
        K = b(g),
        A = b(e),
        y = {},
        E = {
            version: "1.3alpha.20140801",
            initialized: !1,
            supported: !0,
            util: {
                isHostMethod: c,
                isHostObject: g,
                isHostProperty: e,
                areHostMethods: C,
                areHostObjects: K,
                areHostProperties: A,
                isTextRange: d,
                getBody: a
            },
            features: {},
            modules: y,
            config: {
                alertOnFail: !0,
                alertOnWarn: !1,
                preferTextRange: !1,
                autoInitialize: "undefined" == typeof rangyAutoInitialize ? !0 : rangyAutoInitialize
            }
        };
    E.fail =
        k;
    E.warn = function(a) {
        a = "Rangy warning: " + a;
        E.config.alertOnWarn ? window.alert(a) : f(a)
    };
    ({}).hasOwnProperty ? E.util.extend = function(a, b, c) {
        var d, e, f;
        for (f in b) b.hasOwnProperty(f) && (d = a[f], e = b[f], c && null !== d && "object" == typeof d && null !== e && "object" == typeof e && E.util.extend(d, e, !0), a[f] = e);
        b.hasOwnProperty("toString") && (a.toString = b.toString);
        return a
    } : k("hasOwnProperty not supported");
    (function() {
        var a = document.createElement("div");
        a.appendChild(document.createElement("span"));
        var b = [].slice,
            c;
        try {
            1 ==
                b.call(a.childNodes, 0)[0].nodeType && (c = function(a) {
                    return b.call(a, 0)
                })
        } catch (d) {}
        c || (c = function(a) {
            for (var b = [], c = 0, d = a.length; c < d; ++c) b[c] = a[c];
            return b
        });
        E.util.toArray = c
    })();
    var N;
    c(document, "addEventListener") ? N = function(a, b, c) {
        a.addEventListener(b, c, !1)
    } : c(document, "attachEvent") ? N = function(a, b, c) {
        a.attachEvent("on" + b, c)
    } : k("Document does not have required addEventListener or attachEvent method");
    E.util.addListener = N;
    var I = [];
    E.init = n;
    E.addInitListener = function(a) {
        E.initialized ? a(E) : I.push(a)
    };
    var Z = [];
    E.addShimListener = function(a) {
        Z.push(a)
    };
    E.shim = E.createMissingNativeApi = function(a) {
        a = a || window;
        n();
        for (var b = 0, c = Z.length; b < c; ++b) Z[b](a)
    };
    p.prototype = {
        init: function() {
            for (var a = this.dependencies || [], b = 0, c = a.length, d, e; b < c; ++b) {
                e = a[b];
                d = y[e];
                if (!(d && d instanceof p)) throw Error("required module '" + e + "' not found");
                d.init();
                if (!d.supported) throw Error("required module '" + e + "' not supported");
            }
            this.initializer(this)
        },
        fail: function(a) {
            this.initialized = !0;
            this.supported = !1;
            throw Error("Module '" +
                this.name + "' failed to load: " + a);
        },
        warn: function(a) {
            E.warn("Module " + this.name + ": " + a)
        },
        deprecationNotice: function(a, b) {
            E.warn("DEPRECATED: " + a + " in module " + this.name + "is deprecated. Please use " + b + " instead")
        },
        createError: function(a) {
            return Error("Error in Rangy " + this.name + " module: " + a)
        }
    };
    E.createModule = function(a) {
        var b, c;
        2 == arguments.length ? (b = arguments[1], c = []) : (b = arguments[2], c = arguments[1]);
        b = m(!1, a, c, b);
        E.initialized && b.init()
    };
    E.createCoreModule = function(a, b, c) {
        m(!0, a, b, c)
    };
    E.RangePrototype =
        q;
    E.rangePrototype = new q;
    E.selectionPrototype = new function() {};
    var G = !1,
        K = function(a) {
            G || (G = !0, !E.initialized && E.config.autoInitialize && n())
        };
    if ("undefined" == typeof window) k("No window found");
    else if ("undefined" == typeof document) k("No document found");
    else return c(document, "addEventListener") && document.addEventListener("DOMContentLoaded", K, !1), N(window, "load", K), E.createCoreModule("DomUtil", [], function(a, b) {
        function c(a) {
            for (var b = 0; a = a.previousSibling;) ++b;
            return b
        }

        function d(a, b) {
            var c = [],
                e;
            for (e =
                a; e; e = e.parentNode) c.push(e);
            for (e = b; e; e = e.parentNode)
                if (A(c, e)) return e;
            return null
        }

        function e(a, b, c) {
            for (b = c ? b : b.parentNode; b;) {
                if (b === a) return !0;
                b = b.parentNode
            }
            return !1
        }

        function f(a, b, c) {
            for (c = c ? a : a.parentNode; c;) {
                a = c.parentNode;
                if (a === b) return c;
                c = a
            }
            return null
        }

        function g(a) {
            a = a.nodeType;
            return 3 == a || 4 == a || 8 == a
        }

        function k(a, b) {
            var c = b.nextSibling,
                d = b.parentNode;
            c ? d.insertBefore(a, c) : d.appendChild(a);
            return a
        }

        function m(a) {
            if (9 == a.nodeType) return a;
            if ("undefined" != typeof a.ownerDocument) return a.ownerDocument;
            if ("undefined" != typeof a.document) return a.document;
            if (a.parentNode) return m(a.parentNode);
            throw b.createError("getDocument: no document found for node");
        }

        function n(a) {
            a = m(a);
            if ("undefined" != typeof a.defaultView) return a.defaultView;
            if ("undefined" != typeof a.parentWindow) return a.parentWindow;
            throw b.createError("Cannot get a window object for node");
        }

        function q(a) {
            if ("undefined" != typeof a.contentDocument) return a.contentDocument;
            if ("undefined" != typeof a.contentWindow) return a.contentWindow.document;
            throw b.createError("getIframeDocument: No Document object found for iframe element");
        }

        function p(a) {
            return a && M.isHostMethod(a, "setTimeout") && M.isHostObject(a, "document")
        }

        function t(a) {
            return a ? g(a) ? '"' + a.data + '"' : 1 == a.nodeType ? "<" + a.nodeName + (a.id ? ' id="' + a.id + '"' : "") + ">[index:" + c(a) + ",length:" + a.childNodes.length + "][" + (a.innerHTML || "[innerHTML not supported]").slice(0, 25) + "]" : a.nodeName : "[No node]"
        }

        function v(a) {
            this._next = this.root = a
        }

        function x(a, b) {
            this.node = a;
            this.offset = b
        }

        function w(a) {
            this.code =
                this[a];
            this.codeName = a;
            this.message = "DOMException: " + this.codeName
        }
        var M = a.util;
        M.areHostMethods(document, ["createDocumentFragment", "createElement", "createTextNode"]) || b.fail("document missing a Node creation method");
        M.isHostMethod(document, "getElementsByTagName") || b.fail("document missing getElementsByTagName method");
        var y = document.createElement("div");
        M.areHostMethods(y, ["insertBefore", "appendChild", "cloneNode"]) || b.fail("Incomplete Element implementation");
        M.isHostProperty(y, "innerHTML") || b.fail("Element is missing innerHTML property");
        y = document.createTextNode("test");
        M.areHostMethods(y, ["splitText", "deleteData", "insertData", "appendData", "cloneNode"]) || b.fail("Incomplete Text Node implementation");
        var A = function(a, b) {
                for (var c = a.length; c--;)
                    if (a[c] === b) return !0;
                return !1
            },
            B = !1;
        (function() {
            var b = document.createElement("b");
            b.innerHTML = "1";
            b.innerHTML = "<br>";
            B = !1;
            a.features.crashyTextNodes = B
        })();
        var C;
        "undefined" != typeof window.getComputedStyle ? C = function(a, b) {
                return n(a).getComputedStyle(a, null)[b]
            } : "undefined" != typeof document.documentElement.currentStyle ?
            C = function(a, b) {
                return a.currentStyle[b]
            } : b.fail("No means of obtaining computed style properties found");
        v.prototype = {
            _current: null,
            hasNext: function() {
                return !!this._next
            },
            next: function() {
                var a = this._current = this._next,
                    b;
                if (this._current) {
                    b = a.firstChild;
                    if (!b)
                        for (b = null; a !== this.root && !(b = a.nextSibling);) a = a.parentNode;
                    this._next = b
                }
                return this._current
            },
            detach: function() {
                this._current = this._next = this.root = null
            }
        };
        x.prototype = {
            equals: function(a) {
                return !!a && this.node === a.node && this.offset == a.offset
            },
            inspect: function() {
                return "[DomPosition(" + t(this.node) + ":" + this.offset + ")]"
            },
            toString: function() {
                return this.inspect()
            }
        };
        w.prototype = {
            INDEX_SIZE_ERR: 1,
            HIERARCHY_REQUEST_ERR: 3,
            WRONG_DOCUMENT_ERR: 4,
            NO_MODIFICATION_ALLOWED_ERR: 7,
            NOT_FOUND_ERR: 8,
            NOT_SUPPORTED_ERR: 9,
            INVALID_STATE_ERR: 11,
            INVALID_NODE_TYPE_ERR: 24
        };
        w.prototype.toString = function() {
            return this.message
        };
        a.dom = {
            arrayContains: A,
            isHtmlNamespace: function(a) {
                var b;
                return "undefined" == typeof a.namespaceURI || null === (b = a.namespaceURI) || "http://www.w3.org/1999/xhtml" ==
                    b
            },
            parentElement: function(a) {
                a = a.parentNode;
                return 1 == a.nodeType ? a : null
            },
            getNodeIndex: c,
            getNodeLength: function(a) {
                switch (a.nodeType) {
                    case 7:
                    case 10:
                        return 0;
                    case 3:
                    case 8:
                        return a.length;
                    default:
                        return a.childNodes.length
                }
            },
            getCommonAncestor: d,
            isAncestorOf: e,
            isOrIsAncestorOf: function(a, b) {
                return e(a, b, !0)
            },
            getClosestAncestorIn: f,
            isCharacterDataNode: g,
            isTextOrCommentNode: function(a) {
                if (!a) return !1;
                a = a.nodeType;
                return 3 == a || 8 == a
            },
            insertAfter: k,
            splitDataNode: function(a, b, d) {
                var e = a.cloneNode(!1);
                e.deleteData(0,
                    b);
                a.deleteData(b, a.length - b);
                k(e, a);
                if (d)
                    for (var f = 0, g; g = d[f++];) g.node == a && g.offset > b ? (g.node = e, g.offset -= b) : g.node == a.parentNode && g.offset > c(a) && ++g.offset;
                return e
            },
            getDocument: m,
            getWindow: n,
            getIframeWindow: function(a) {
                if ("undefined" != typeof a.contentWindow) return a.contentWindow;
                if ("undefined" != typeof a.contentDocument) return a.contentDocument.defaultView;
                throw b.createError("getIframeWindow: No Window object found for iframe element");
            },
            getIframeDocument: q,
            getBody: M.getBody,
            isWindow: p,
            getContentDocument: function(a,
                b, c) {
                var d;
                a ? M.isHostProperty(a, "nodeType") ? d = 1 == a.nodeType && "iframe" == a.tagName.toLowerCase() ? q(a) : m(a) : p(a) && (d = a.document) : d = document;
                if (!d) throw b.createError(c + "(): Parameter must be a Window object or DOM node");
                return d
            },
            getRootContainer: function(a) {
                for (var b; b = a.parentNode;) a = b;
                return a
            },
            comparePoints: function(a, e, g, k) {
                var m;
                if (a == g) return e === k ? 0 : e < k ? -1 : 1;
                if (m = f(g, a, !0)) return e <= c(m) ? -1 : 1;
                if (m = f(a, g, !0)) return c(m) < k ? -1 : 1;
                e = d(a, g);
                if (!e) throw Error("comparePoints error: nodes have no common ancestor");
                a = a === e ? e : f(a, e, !0);
                g = g === e ? e : f(g, e, !0);
                if (a === g) throw b.createError("comparePoints got to case 4 and childA and childB are the same!");
                for (e = e.firstChild; e;) {
                    if (e === a) return -1;
                    if (e === g) return 1;
                    e = e.nextSibling
                }
            },
            isBrokenNode: function(a) {
                return !1
            },
            inspectNode: t,
            getComputedStyleProperty: C,
            fragmentFromNodeChildren: function(a) {
                for (var b = m(a).createDocumentFragment(), c; c = a.firstChild;) b.appendChild(c);
                return b
            },
            createIterator: function(a) {
                return new v(a)
            },
            DomPosition: x
        };
        a.DOMException = w
    }), E.createCoreModule("DomRange", ["DomUtil"], function(a, b) {
        function c(a, b) {
            return 3 != a.nodeType && (V(a, b.startContainer) || V(a, b.endContainer))
        }

        function d(a) {
            return a.document || Da(a.startContainer)
        }

        function e(a) {
            return new H(a.parentNode, oa(a))
        }

        function f(a) {
            return new H(a.parentNode, oa(a) + 1)
        }

        function g(a, b, c) {
            var d = 11 == a.nodeType ? a.firstChild : a;
            L(b) ? c == b.length ? z.insertAfter(a, b) : b.parentNode.insertBefore(a, 0 == c ? b : Ia(b, c)) : c >= b.childNodes.length ? b.appendChild(a) : b.insertBefore(a, b.childNodes[c]);
            return d
        }

        function k(a, b, c) {
            Q(a);
            Q(b);
            if (d(b) != d(a)) throw new na("WRONG_DOCUMENT_ERR");
            var e = O(a.startContainer, a.startOffset, b.endContainer, b.endOffset);
            a = O(a.endContainer, a.endOffset, b.startContainer, b.startOffset);
            return c ? 0 >= e && 0 <= a : 0 > e && 0 < a
        }

        function m(a) {
            for (var b, c, e = d(a.range).createDocumentFragment(); c = a.next();) {
                b = a.isPartiallySelectedSubtree();
                c = c.cloneNode(!b);
                b && (b = a.getSubtreeIterator(), c.appendChild(m(b)), b.detach());
                if (10 == c.nodeType) throw new na("HIERARCHY_REQUEST_ERR");
                e.appendChild(c)
            }
            return e
        }

        function n(a, b, c) {
            var d,
                e;
            for (c = c || {
                    stop: !1
                }; d = a.next();)
                if (a.isPartiallySelectedSubtree())
                    if (!1 === b(d)) {
                        c.stop = !0;
                        break
                    } else {
                        if (d = a.getSubtreeIterator(), n(d, b, c), d.detach(), c.stop) break
                    } else
                for (d = z.createIterator(d); e = d.next();)
                    if (!1 === b(e)) {
                        c.stop = !0;
                        return
                    }
        }

        function q(a) {
            for (var b; a.next();) a.isPartiallySelectedSubtree() ? (b = a.getSubtreeIterator(), q(b), b.detach()) : a.remove()
        }

        function p(a) {
            for (var b, c = d(a.range).createDocumentFragment(), e; b = a.next();) {
                a.isPartiallySelectedSubtree() ? (b = b.cloneNode(!1), e = a.getSubtreeIterator(),
                    b.appendChild(p(e)), e.detach()) : a.remove();
                if (10 == b.nodeType) throw new na("HIERARCHY_REQUEST_ERR");
                c.appendChild(b)
            }
            return c
        }

        function t(a, b, c) {
            var d = !(!b || !b.length),
                e, f = !!c;
            d && (e = new RegExp("^(" + b.join("|") + ")$"));
            var g = [];
            n(new x(a, !1), function(b) {
                if (!d || e.test(b.nodeType))
                    if (!f || c(b)) {
                        var h = a.startContainer;
                        b == h && L(h) && a.startOffset == h.length || (h = a.endContainer, b == h && L(h) && 0 == a.endOffset || g.push(b))
                    }
            });
            return g
        }

        function v(a) {
            return "[" + ("undefined" == typeof a.getName ? "Range" : a.getName()) + "(" + z.inspectNode(a.startContainer) +
                ":" + a.startOffset + ", " + z.inspectNode(a.endContainer) + ":" + a.endOffset + ")]"
        }

        function x(a, b) {
            this.range = a;
            this.clonePartiallySelectedTextNodes = b;
            if (!a.collapsed) {
                this.sc = a.startContainer;
                this.so = a.startOffset;
                this.ec = a.endContainer;
                this.eo = a.endOffset;
                var c = a.commonAncestorContainer;
                this.sc === this.ec && L(this.sc) ? (this.isSingleCharacterDataNode = !0, this._first = this._last = this._next = this.sc) : (this._first = this._next = this.sc !== c || L(this.sc) ? Aa(this.sc, c, !0) : this.sc.childNodes[this.so], this._last = this.ec !==
                    c || L(this.ec) ? Aa(this.ec, c, !0) : this.ec.childNodes[this.eo - 1])
            }
        }

        function w(a) {
            return function(b, c) {
                for (var d, e = c ? b : b.parentNode; e;) {
                    d = e.nodeType;
                    if (wa(a, d)) return e;
                    e = e.parentNode
                }
                return null
            }
        }

        function M(a, b) {
            if (Oa(a, b)) throw new na("INVALID_NODE_TYPE_ERR");
        }

        function y(a, b) {
            if (!wa(b, a.nodeType)) throw new na("INVALID_NODE_TYPE_ERR");
        }

        function A(a, b) {
            if (0 > b || b > (L(a) ? a.length : a.childNodes.length)) throw new na("INDEX_SIZE_ERR");
        }

        function B(a, b) {
            if (u(a, !0) !== u(b, !0)) throw new na("WRONG_DOCUMENT_ERR");
        }

        function C(a) {
            if (ea(a, !0)) throw new na("NO_MODIFICATION_ALLOWED_ERR");
        }

        function E(a, b) {
            if (!a) throw new na(b);
        }

        function I(a) {
            return Ea && z.isBrokenNode(a) || !wa(ua, a.nodeType) && !u(a, !0)
        }

        function G(a, b) {
            return b <= (L(a) ? a.length : a.childNodes.length)
        }

        function xa(a) {
            return !!a.startContainer && !!a.endContainer && !I(a.startContainer) && !I(a.endContainer) && G(a.startContainer, a.startOffset) && G(a.endContainer, a.endOffset)
        }

        function Q(a) {
            if (!xa(a)) throw Error("Range error: Range is no longer valid after DOM mutation (" +
                a.inspect() + ")");
        }

        function F(a, b) {
            Q(a);
            var c = a.startContainer,
                d = a.startOffset,
                e = a.endContainer,
                f = a.endOffset,
                g = c === e;
            L(e) && 0 < f && f < e.length && Ia(e, f, b);
            L(c) && 0 < d && d < c.length && (c = Ia(c, d, b), g ? (f -= d, e = c) : e == c.parentNode && f >= oa(c) && f++, d = 0);
            a.setStartAndEnd(c, d, e, f)
        }

        function h(a) {
            Q(a);
            var b = a.commonAncestorContainer.parentNode.cloneNode(!1);
            b.appendChild(a.cloneContents());
            return b.innerHTML
        }

        function K(a) {
            a.START_TO_START = 0;
            a.START_TO_END = 1;
            a.END_TO_END = 2;
            a.END_TO_START = 3;
            a.NODE_BEFORE = 0;
            a.NODE_AFTER = 1;
            a.NODE_BEFORE_AND_AFTER = 2;
            a.NODE_INSIDE = 3
        }

        function N(a) {
            K(a);
            K(a.prototype)
        }

        function Z(a, b) {
            return function() {
                Q(this);
                var c = this.startContainer,
                    d = this.startOffset,
                    e = this.commonAncestorContainer,
                    g = new x(this, !0);
                c !== e && (c = Aa(c, e, !0), d = f(c), c = d.node, d = d.offset);
                n(g, C);
                g.reset();
                e = a(g);
                g.detach();
                b(this, c, d, c, d);
                return e
            }
        }

        function ha(b, d) {
            function g(a, b) {
                return function(c) {
                    y(c, pa);
                    y(ga(c), ua);
                    c = (a ? e : f)(c);
                    (b ? h : k)(this, c.node, c.offset)
                }
            }

            function h(a, b, c) {
                var e = a.endContainer,
                    f = a.endOffset;
                if (b !== a.startContainer ||
                    c !== a.startOffset) {
                    if (ga(b) != ga(e) || 1 == O(b, c, e, f)) e = b, f = c;
                    d(a, b, c, e, f)
                }
            }

            function k(a, b, c) {
                var e = a.startContainer,
                    f = a.startOffset;
                if (b !== a.endContainer || c !== a.endOffset) {
                    if (ga(b) != ga(e) || -1 == O(b, c, e, f)) e = b, f = c;
                    d(a, e, f, b, c)
                }
            }
            var r = function() {};
            r.prototype = a.rangePrototype;
            b.prototype = new r;
            ma.extend(b.prototype, {
                setStart: function(a, b) {
                    M(a, !0);
                    A(a, b);
                    h(this, a, b)
                },
                setEnd: function(a, b) {
                    M(a, !0);
                    A(a, b);
                    k(this, a, b)
                },
                setStartAndEnd: function() {
                    var a = arguments,
                        b = a[0],
                        c = a[1],
                        e = b,
                        f = c;
                    switch (a.length) {
                        case 3:
                            f =
                                a[2];
                            break;
                        case 4:
                            e = a[2], f = a[3]
                    }
                    d(this, b, c, e, f)
                },
                setBoundary: function(a, b, c) {
                    this["set" + (c ? "Start" : "End")](a, b)
                },
                setStartBefore: g(!0, !0),
                setStartAfter: g(!1, !0),
                setEndBefore: g(!0, !1),
                setEndAfter: g(!1, !1),
                collapse: function(a) {
                    Q(this);
                    a ? d(this, this.startContainer, this.startOffset, this.startContainer, this.startOffset) : d(this, this.endContainer, this.endOffset, this.endContainer, this.endOffset)
                },
                selectNodeContents: function(a) {
                    M(a, !0);
                    d(this, a, 0, a, ta(a))
                },
                selectNode: function(a) {
                    M(a, !1);
                    y(a, pa);
                    var b = e(a);
                    a = f(a);
                    d(this, b.node, b.offset, a.node, a.offset)
                },
                extractContents: Z(p, d),
                deleteContents: Z(q, d),
                canSurroundContents: function() {
                    Q(this);
                    C(this.startContainer);
                    C(this.endContainer);
                    var a = new x(this, !0),
                        b = a._first && c(a._first, this) || a._last && c(a._last, this);
                    a.detach();
                    return !b
                },
                splitBoundaries: function() {
                    F(this)
                },
                splitBoundariesPreservingPositions: function(a) {
                    F(this, a)
                },
                normalizeBoundaries: function() {
                    Q(this);
                    var a = this.startContainer,
                        b = this.startOffset,
                        c = this.endContainer,
                        e = this.endOffset,
                        f = function(a) {
                            var b =
                                a.nextSibling;
                            b && b.nodeType == a.nodeType && (c = a, e = a.length, a.appendData(b.data), b.parentNode.removeChild(b))
                        },
                        g = function(d) {
                            var f = d.previousSibling;
                            if (f && f.nodeType == d.nodeType) {
                                a = d;
                                var g = d.length;
                                b = f.length;
                                d.insertData(0, f.data);
                                f.parentNode.removeChild(f);
                                a == c ? (e += b, c = a) : c == d.parentNode && (f = oa(d), e == f ? (c = d, e = g) : e > f && e--)
                            }
                        },
                        h = !0;
                    L(c) ? c.length == e && f(c) : (0 < e && (h = c.childNodes[e - 1]) && L(h) && f(h), h = !this.collapsed);
                    h ? L(a) ? 0 == b && g(a) : b < a.childNodes.length && (f = a.childNodes[b]) && L(f) && g(f) : (a = c, b = e);
                    d(this,
                        a, b, c, e)
                },
                collapseToPoint: function(a, b) {
                    M(a, !0);
                    A(a, b);
                    this.setStartAndEnd(a, b)
                }
            });
            N(b)
        }

        function da(a) {
            a.collapsed = a.startContainer === a.endContainer && a.startOffset === a.endOffset;
            a.commonAncestorContainer = a.collapsed ? a.startContainer : z.getCommonAncestor(a.startContainer, a.endContainer)
        }

        function ia(a, b, c, d, e) {
            a.startContainer = b;
            a.startOffset = c;
            a.endContainer = d;
            a.endOffset = e;
            a.document = z.getDocument(b);
            da(a)
        }

        function qa(a) {
            this.startContainer = a;
            this.startOffset = 0;
            this.endContainer = a;
            this.endOffset = 0;
            this.document = a;
            da(this)
        }
        var z = a.dom,
            ma = a.util,
            H = z.DomPosition,
            na = a.DOMException,
            L = z.isCharacterDataNode,
            oa = z.getNodeIndex,
            V = z.isOrIsAncestorOf,
            Da = z.getDocument,
            O = z.comparePoints,
            Ia = z.splitDataNode,
            Aa = z.getClosestAncestorIn,
            ta = z.getNodeLength,
            wa = z.arrayContains,
            ga = z.getRootContainer,
            Ea = a.features.crashyTextNodes;
        x.prototype = {
            _current: null,
            _next: null,
            _first: null,
            _last: null,
            isSingleCharacterDataNode: !1,
            reset: function() {
                this._current = null;
                this._next = this._first
            },
            hasNext: function() {
                return !!this._next
            },
            next: function() {
                var a = this._current = this._next;
                a && (this._next = a !== this._last ? a.nextSibling : null, L(a) && this.clonePartiallySelectedTextNodes && (a === this.ec && (a = a.cloneNode(!0)).deleteData(this.eo, a.length - this.eo), this._current === this.sc && (a = a.cloneNode(!0)).deleteData(0, this.so)));
                return a
            },
            remove: function() {
                var a = this._current,
                    b, c;
                !L(a) || a !== this.sc && a !== this.ec ? a.parentNode && a.parentNode.removeChild(a) : (b = a === this.sc ? this.so : 0, c = a === this.ec ? this.eo : a.length, b != c && a.deleteData(b, c - b))
            },
            isPartiallySelectedSubtree: function() {
                return c(this._current,
                    this.range)
            },
            getSubtreeIterator: function() {
                var a;
                if (this.isSingleCharacterDataNode) a = this.range.cloneRange(), a.collapse(!1);
                else {
                    a = new qa(d(this.range));
                    var b = this._current,
                        c = b,
                        e = 0,
                        f = b,
                        g = ta(b);
                    V(b, this.sc) && (c = this.sc, e = this.so);
                    V(b, this.ec) && (f = this.ec, g = this.eo);
                    ia(a, c, e, f, g)
                }
                return new x(a, this.clonePartiallySelectedTextNodes)
            },
            detach: function() {
                this.range = this._current = this._next = this._first = this._last = this.sc = this.so = this.ec = this.eo = null
            }
        };
        var pa = [1, 3, 4, 5, 7, 8, 10],
            ua = [2, 9, 11],
            D = [1, 3, 4, 5, 7, 8, 10,
                11
            ],
            r = [1, 3, 4, 5, 7, 8],
            u = w([9, 11]),
            ea = w([5, 6, 10, 12]),
            Oa = w([6, 10, 12]),
            Pa = document.createElement("style"),
            Qa = !1;
        try {
            Pa.innerHTML = "<b>x</b>", Qa = 3 == Pa.firstChild.nodeType
        } catch (Fa) {}
        a.features.htmlParsingConforms = Qa;
        var Na = "startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" ");
        ma.extend(a.rangePrototype, {
            compareBoundaryPoints: function(a, b) {
                Q(this);
                B(this.startContainer, b.startContainer);
                var c = 3 == a || 0 == a ? "start" : "end",
                    d = 1 == a || 0 == a ? "start" : "end";
                return O(this[c + "Container"],
                    this[c + "Offset"], b[d + "Container"], b[d + "Offset"])
            },
            insertNode: function(a) {
                Q(this);
                y(a, D);
                C(this.startContainer);
                if (V(a, this.startContainer)) throw new na("HIERARCHY_REQUEST_ERR");
                a = g(a, this.startContainer, this.startOffset);
                this.setStartBefore(a)
            },
            cloneContents: function() {
                Q(this);
                var a, b;
                if (this.collapsed) return d(this).createDocumentFragment();
                if (this.startContainer === this.endContainer && L(this.startContainer)) return a = this.startContainer.cloneNode(!0), a.data = a.data.slice(this.startOffset, this.endOffset),
                    b = d(this).createDocumentFragment(), b.appendChild(a), b;
                b = new x(this, !0);
                a = m(b);
                b.detach();
                return a
            },
            canSurroundContents: function() {
                Q(this);
                C(this.startContainer);
                C(this.endContainer);
                var a = new x(this, !0),
                    b = a._first && c(a._first, this) || a._last && c(a._last, this);
                a.detach();
                return !b
            },
            surroundContents: function(a) {
                y(a, r);
                if (!this.canSurroundContents()) throw new na("INVALID_STATE_ERR");
                var b = this.extractContents();
                if (a.hasChildNodes())
                    for (; a.lastChild;) a.removeChild(a.lastChild);
                g(a, this.startContainer, this.startOffset);
                a.appendChild(b);
                this.selectNode(a)
            },
            cloneRange: function() {
                Q(this);
                for (var a = new qa(d(this)), b = Na.length, c; b--;) c = Na[b], a[c] = this[c];
                return a
            },
            toString: function() {
                Q(this);
                var a = this.startContainer;
                if (a === this.endContainer && L(a)) return 3 == a.nodeType || 4 == a.nodeType ? a.data.slice(this.startOffset, this.endOffset) : "";
                var b = [],
                    a = new x(this, !0);
                n(a, function(a) {
                    3 != a.nodeType && 4 != a.nodeType || b.push(a.data)
                });
                a.detach();
                return b.join("")
            },
            compareNode: function(a) {
                Q(this);
                var b = a.parentNode,
                    c = oa(a);
                if (!b) throw new na("NOT_FOUND_ERR");
                a = this.comparePoint(b, c);
                b = this.comparePoint(b, c + 1);
                return 0 > a ? 0 < b ? 2 : 0 : 0 < b ? 1 : 3
            },
            comparePoint: function(a, b) {
                Q(this);
                E(a, "HIERARCHY_REQUEST_ERR");
                B(a, this.startContainer);
                return 0 > O(a, b, this.startContainer, this.startOffset) ? -1 : 0 < O(a, b, this.endContainer, this.endOffset) ? 1 : 0
            },
            createContextualFragment: Qa ? function(a) {
                var b = this.startContainer,
                    c = Da(b);
                if (!b) throw new na("INVALID_STATE_ERR");
                var d = null;
                1 == b.nodeType ? d = b : L(b) && (d = z.parentElement(b));
                d = null === d || "HTML" == d.nodeName && z.isHtmlNamespace(Da(d).documentElement) &&
                    z.isHtmlNamespace(d) ? c.createElement("body") : d.cloneNode(!1);
                d.innerHTML = a;
                return z.fragmentFromNodeChildren(d)
            } : function(a) {
                var b = d(this).createElement("body");
                b.innerHTML = a;
                return z.fragmentFromNodeChildren(b)
            },
            toHtml: function() {
                return h(this)
            },
            intersectsNode: function(a, b) {
                Q(this);
                E(a, "NOT_FOUND_ERR");
                if (Da(a) !== d(this)) return !1;
                var c = a.parentNode,
                    e = oa(a);
                E(c, "NOT_FOUND_ERR");
                var f = O(c, e, this.endContainer, this.endOffset),
                    c = O(c, e + 1, this.startContainer, this.startOffset);
                return b ? 0 >= f && 0 <= c : 0 > f && 0 <
                    c
            },
            isPointInRange: function(a, b) {
                Q(this);
                E(a, "HIERARCHY_REQUEST_ERR");
                B(a, this.startContainer);
                return 0 <= O(a, b, this.startContainer, this.startOffset) && 0 >= O(a, b, this.endContainer, this.endOffset)
            },
            intersectsRange: function(a) {
                return k(this, a, !1)
            },
            intersectsOrTouchesRange: function(a) {
                return k(this, a, !0)
            },
            intersection: function(a) {
                if (this.intersectsRange(a)) {
                    var b = O(this.startContainer, this.startOffset, a.startContainer, a.startOffset),
                        c = O(this.endContainer, this.endOffset, a.endContainer, a.endOffset),
                        d = this.cloneRange(); - 1 == b && d.setStart(a.startContainer, a.startOffset);
                    1 == c && d.setEnd(a.endContainer, a.endOffset);
                    return d
                }
                return null
            },
            union: function(a) {
                if (this.intersectsOrTouchesRange(a)) {
                    var b = this.cloneRange(); - 1 == O(a.startContainer, a.startOffset, this.startContainer, this.startOffset) && b.setStart(a.startContainer, a.startOffset);
                    1 == O(a.endContainer, a.endOffset, this.endContainer, this.endOffset) && b.setEnd(a.endContainer, a.endOffset);
                    return b
                }
                throw new na("Ranges do not intersect");
            },
            containsNode: function(a, b) {
                return b ?
                    this.intersectsNode(a, !1) : 3 == this.compareNode(a)
            },
            containsNodeContents: function(a) {
                return 0 <= this.comparePoint(a, 0) && 0 >= this.comparePoint(a, ta(a))
            },
            containsRange: function(a) {
                var b = this.intersection(a);
                return null !== b && a.equals(b)
            },
            containsNodeText: function(a) {
                var b = this.cloneRange();
                b.selectNode(a);
                var c = b.getNodes([3]);
                return 0 < c.length ? (b.setStart(c[0], 0), a = c.pop(), b.setEnd(a, a.length), this.containsRange(b)) : this.containsNodeContents(a)
            },
            getNodes: function(a, b) {
                Q(this);
                return t(this, a, b)
            },
            getDocument: function() {
                return d(this)
            },
            collapseBefore: function(a) {
                this.setEndBefore(a);
                this.collapse(!1)
            },
            collapseAfter: function(a) {
                this.setStartAfter(a);
                this.collapse(!0)
            },
            getBookmark: function(b) {
                var c = d(this),
                    e = a.createRange(c);
                b = b || z.getBody(c);
                e.selectNodeContents(b);
                var c = this.intersection(e),
                    f = 0,
                    g = 0;
                c && (e.setEnd(c.startContainer, c.startOffset), f = e.toString().length, g = f + c.toString().length);
                return {
                    start: f,
                    end: g,
                    containerNode: b
                }
            },
            moveToBookmark: function(a) {
                var b = a.containerNode,
                    c = 0;
                this.setStart(b, 0);
                this.collapse(!0);
                for (var b = [b],
                        d, e = !1, f = !1, g, h; !f && (d = b.pop());)
                    if (3 == d.nodeType) g = c + d.length, !e && a.start >= c && a.start <= g && (this.setStart(d, a.start - c), e = !0), e && a.end >= c && a.end <= g && (this.setEnd(d, a.end - c), f = !0), c = g;
                    else
                        for (h = d.childNodes, g = h.length; g--;) b.push(h[g])
            },
            getName: function() {
                return "DomRange"
            },
            equals: function(a) {
                return qa.rangesEqual(this, a)
            },
            isValid: function() {
                return xa(this)
            },
            inspect: function() {
                return v(this)
            },
            detach: function() {}
        });
        ha(qa, ia);
        ma.extend(qa, {
            rangeProperties: Na,
            RangeIterator: x,
            copyComparisonConstants: N,
            createPrototypeRange: ha,
            inspect: v,
            toHtml: h,
            getRangeDocument: d,
            rangesEqual: function(a, b) {
                return a.startContainer === b.startContainer && a.startOffset === b.startOffset && a.endContainer === b.endContainer && a.endOffset === b.endOffset
            }
        });
        a.DomRange = qa
    }), E.createCoreModule("WrappedRange", ["DomRange"], function(a, b) {
        var c, d, e = a.dom,
            f = a.util,
            g = e.DomPosition,
            k = a.DomRange,
            m = e.getBody,
            n = e.getContentDocument,
            q = e.isCharacterDataNode;
        a.features.implementsDomRange && function() {
            function d(a) {
                for (var b = q.length, c; b--;) c = q[b],
                    a[c] = a.nativeRange[c];
                a.collapsed = a.startContainer === a.endContainer && a.startOffset === a.endOffset
            }
            var g, q = k.rangeProperties,
                p;
            c = function(a) {
                if (!a) throw b.createError("WrappedRange: Range must be specified");
                this.nativeRange = a;
                d(this)
            };
            k.createPrototypeRange(c, function(a, b, c, d, e) {
                var f = a.startContainer !== b || a.startOffset != c,
                    g = a.endContainer !== d || a.endOffset != e,
                    k = !a.equals(a.nativeRange);
                if (f || g || k) a.setEnd(d, e), a.setStart(b, c)
            });
            g = c.prototype;
            g.selectNode = function(a) {
                this.nativeRange.selectNode(a);
                d(this)
            };
            g.cloneContents = function() {
                return this.nativeRange.cloneContents()
            };
            g.surroundContents = function(a) {
                this.nativeRange.surroundContents(a);
                d(this)
            };
            g.collapse = function(a) {
                this.nativeRange.collapse(a);
                d(this)
            };
            g.cloneRange = function() {
                return new c(this.nativeRange.cloneRange())
            };
            g.refresh = function() {
                d(this)
            };
            g.toString = function() {
                return this.nativeRange.toString()
            };
            var s = document.createTextNode("test");
            m(document).appendChild(s);
            var t = document.createRange();
            t.setStart(s, 0);
            t.setEnd(s, 0);
            try {
                t.setStart(s,
                    1), g.setStart = function(a, b) {
                    this.nativeRange.setStart(a, b);
                    d(this)
                }, g.setEnd = function(a, b) {
                    this.nativeRange.setEnd(a, b);
                    d(this)
                }, p = function(a) {
                    return function(b) {
                        this.nativeRange[a](b);
                        d(this)
                    }
                }
            } catch (x) {
                g.setStart = function(a, b) {
                    try {
                        this.nativeRange.setStart(a, b)
                    } catch (c) {
                        this.nativeRange.setEnd(a, b), this.nativeRange.setStart(a, b)
                    }
                    d(this)
                }, g.setEnd = function(a, b) {
                    try {
                        this.nativeRange.setEnd(a, b)
                    } catch (c) {
                        this.nativeRange.setStart(a, b), this.nativeRange.setEnd(a, b)
                    }
                    d(this)
                }, p = function(a, b) {
                    return function(c) {
                        try {
                            this.nativeRange[a](c)
                        } catch (e) {
                            this.nativeRange[b](c),
                                this.nativeRange[a](c)
                        }
                        d(this)
                    }
                }
            }
            g.setStartBefore = p("setStartBefore", "setEndBefore");
            g.setStartAfter = p("setStartAfter", "setEndAfter");
            g.setEndBefore = p("setEndBefore", "setStartBefore");
            g.setEndAfter = p("setEndAfter", "setStartAfter");
            g.selectNodeContents = function(a) {
                this.setStartAndEnd(a, 0, e.getNodeLength(a))
            };
            t.selectNodeContents(s);
            t.setEnd(s, 3);
            p = document.createRange();
            p.selectNodeContents(s);
            p.setEnd(s, 4);
            p.setStart(s, 2); - 1 == t.compareBoundaryPoints(t.START_TO_END, p) && 1 == t.compareBoundaryPoints(t.END_TO_START,
                p) ? g.compareBoundaryPoints = function(a, b) {
                b = b.nativeRange || b;
                a == b.START_TO_END ? a = b.END_TO_START : a == b.END_TO_START && (a = b.START_TO_END);
                return this.nativeRange.compareBoundaryPoints(a, b)
            } : g.compareBoundaryPoints = function(a, b) {
                return this.nativeRange.compareBoundaryPoints(a, b.nativeRange || b)
            };
            p = document.createElement("div");
            p.innerHTML = "123";
            var v = p.firstChild,
                y = m(document);
            y.appendChild(p);
            t.setStart(v, 1);
            t.setEnd(v, 2);
            t.deleteContents();
            "13" == v.data && (g.deleteContents = function() {
                this.nativeRange.deleteContents();
                d(this)
            }, g.extractContents = function() {
                var a = this.nativeRange.extractContents();
                d(this);
                return a
            });
            y.removeChild(p);
            y = null;
            f.isHostMethod(t, "createContextualFragment") && (g.createContextualFragment = function(a) {
                return this.nativeRange.createContextualFragment(a)
            });
            m(document).removeChild(s);
            g.getName = function() {
                return "WrappedRange"
            };
            a.WrappedRange = c;
            a.createNativeRange = function(a) {
                a = n(a, b, "createNativeRange");
                return a.createRange()
            }
        }();
        if (a.features.implementsTextRange) {
            var p = function(a, b, c, d, f) {
                    var k =
                        a.duplicate();
                    k.collapse(c);
                    var m = k.parentElement();
                    e.isOrIsAncestorOf(b, m) || (m = b);
                    if (!m.canHaveHTML) return m = new g(m.parentNode, e.getNodeIndex(m)), {
                        boundaryPosition: m,
                        nodeInfo: {
                            nodeIndex: m.offset,
                            containerElement: m.node
                        }
                    };
                    b = e.getDocument(m).createElement("span");
                    b.parentNode && b.parentNode.removeChild(b);
                    var n, p = c ? "StartToStart" : "StartToEnd",
                        t = f && f.containerElement == m ? f.nodeIndex : 0,
                        x = m.childNodes.length,
                        v = x;
                    for (f = v;;) {
                        f == x ? m.appendChild(b) : m.insertBefore(b, m.childNodes[f]);
                        k.moveToElementText(b);
                        n = k.compareEndPoints(p, a);
                        if (0 == n || t == v) break;
                        else if (-1 == n)
                            if (v == t + 1) break;
                            else t = f;
                        else v = v == t + 1 ? t : f;
                        f = Math.floor((t + v) / 2);
                        m.removeChild(b)
                    }
                    p = b.nextSibling;
                    if (-1 == n && p && q(p)) {
                        k.setEndPoint(c ? "EndToStart" : "EndToEnd", a);
                        if (/[\r\n]/.test(p.data))
                            for (c = k.duplicate(), d = c.text.replace(/\r\n/g, "\r").length, d = c.moveStart("character", d); - 1 == c.compareEndPoints("StartToEnd", c);) d++, c.moveStart("character", 1);
                        else d = k.text.length;
                        c = new g(p, d)
                    } else a = (d || !c) && b.previousSibling, c = (c = (d || c) && b.nextSibling) && q(c) ?
                        new g(c, 0) : a && q(a) ? new g(a, a.data.length) : new g(m, e.getNodeIndex(b));
                    b.parentNode.removeChild(b);
                    return {
                        boundaryPosition: c,
                        nodeInfo: {
                            nodeIndex: f,
                            containerElement: m
                        }
                    }
                },
                t = function(a, b) {
                    var c, d, f = a.offset,
                        g = e.getDocument(a.node),
                        k = m(g).createTextRange(),
                        n = q(a.node);
                    n ? (c = a.node, d = c.parentNode) : (c = a.node.childNodes, c = f < c.length ? c[f] : null, d = a.node);
                    g = g.createElement("span");
                    g.innerHTML = "&#feff;";
                    c ? d.insertBefore(g, c) : d.appendChild(g);
                    k.moveToElementText(g);
                    k.collapse(!b);
                    d.removeChild(g);
                    if (n) k[b ? "moveStart" :
                        "moveEnd"]("character", f);
                    return k
                };
            d = function(a) {
                this.textRange = a;
                this.refresh()
            };
            d.prototype = new k(document);
            d.prototype.refresh = function() {
                var a, b, c;
                c = this.textRange;
                a = c.parentElement();
                var d = c.duplicate();
                d.collapse(!0);
                b = d.parentElement();
                d = c.duplicate();
                d.collapse(!1);
                c = d.parentElement();
                b = b == c ? b : e.getCommonAncestor(b, c);
                b = b == a ? b : e.getCommonAncestor(a, b);
                a = this.textRange;
                0 == a.compareEndPoints("StartToEnd", a) ? b = a = p(this.textRange, b, !0, !0).boundaryPosition : (c = p(this.textRange, b, !0, !1), a = c.boundaryPosition,
                    b = p(this.textRange, b, !1, !1, c.nodeInfo).boundaryPosition);
                this.setStart(a.node, a.offset);
                this.setEnd(b.node, b.offset)
            };
            d.prototype.getName = function() {
                return "WrappedTextRange"
            };
            k.copyComparisonConstants(d);
            var x = function(a) {
                if (a.collapsed) return t(new g(a.startContainer, a.startOffset), !0);
                var b = t(new g(a.startContainer, a.startOffset), !0),
                    c = t(new g(a.endContainer, a.endOffset), !1);
                a = m(k.getRangeDocument(a)).createTextRange();
                a.setEndPoint("StartToStart", b);
                a.setEndPoint("EndToEnd", c);
                return a
            };
            d.rangeToTextRange =
                x;
            d.prototype.toTextRange = function() {
                return x(this)
            };
            a.WrappedTextRange = d;
            if (!a.features.implementsDomRange || a.config.preferTextRange) {
                var v = function() {
                    return this
                }();
                "undefined" == typeof v.Range && (v.Range = d);
                a.createNativeRange = function(a) {
                    a = n(a, b, "createNativeRange");
                    return m(a).createTextRange()
                };
                a.WrappedRange = d
            }
        }
        a.createRange = function(c) {
            c = n(c, b, "createRange");
            return new a.WrappedRange(a.createNativeRange(c))
        };
        a.createRangyRange = function(a) {
            a = n(a, b, "createRangyRange");
            return new k(a)
        };
        a.createIframeRange =
            function(c) {
                b.deprecationNotice("createIframeRange()", "createRange(iframeEl)");
                return a.createRange(c)
            };
        a.createIframeRangyRange = function(c) {
            b.deprecationNotice("createIframeRangyRange()", "createRangyRange(iframeEl)");
            return a.createRangyRange(c)
        };
        a.addShimListener(function(b) {
            var c = b.document;
            "undefined" == typeof c.createRange && (c.createRange = function() {
                return a.createRange(c)
            });
            c = b = null
        })
    }), E.createCoreModule("WrappedSelection", ["DomRange", "WrappedRange"], function(a, b) {
        function c(a) {
            return "string" ==
                typeof a ? /^backward(s)?$/i.test(a) : !!a
        }

        function d(a, c) {
            if (a) {
                if (G.isWindow(a)) return a;
                if (a instanceof w) return a.win;
                var e = G.getContentDocument(a, b, c);
                return G.getWindow(e)
            }
            return window
        }

        function e(a) {
            return d(a, "getWinSelection").getSelection()
        }

        function f(a) {
            return d(a, "getDocSelection").document.selection
        }

        function g(a) {
            var b = !1;
            a.anchorNode && (b = 1 == G.comparePoints(a.anchorNode, a.anchorOffset, a.focusNode, a.focusOffset));
            return b
        }

        function k(a, b, c) {
            var d = c ? "end" : "start";
            c = c ? "start" : "end";
            a.anchorNode =
                b[d + "Container"];
            a.anchorOffset = b[d + "Offset"];
            a.focusNode = b[c + "Container"];
            a.focusOffset = b[c + "Offset"]
        }

        function m(a) {
            a.anchorNode = a.focusNode = null;
            a.anchorOffset = a.focusOffset = 0;
            a.rangeCount = 0;
            a.isCollapsed = !0;
            a._ranges.length = 0
        }

        function n(b) {
            var c;
            b instanceof Q ? (c = a.createNativeRange(b.getDocument()), c.setEnd(b.endContainer, b.endOffset), c.setStart(b.startContainer, b.startOffset)) : b instanceof F ? c = b.nativeRange : ha.implementsDomRange && b instanceof G.getWindow(b.startContainer).Range && (c = b);
            return c
        }

        function p(a) {
            var c = a.getNodes(),
                d;
            a: if (c.length && 1 == c[0].nodeType) {
                d = 1;
                for (var e = c.length; d < e; ++d)
                    if (!G.isAncestorOf(c[0], c[d])) {
                        d = !1;
                        break a
                    }
                d = !0
            } else d = !1;
            if (!d) throw b.createError("getSingleElementFromRange: range " + a.inspect() + " did not consist of a single element");
            return c[0]
        }

        function q(a) {
            return !!a && "undefined" != typeof a.text
        }

        function t(a, b) {
            var c = new F(b);
            a._ranges = [c];
            k(a, c, !1);
            a.rangeCount = 1;
            a.isCollapsed = c.collapsed
        }

        function v(b) {
            b._ranges.length = 0;
            if ("None" == b.docSelection.type) m(b);
            else {
                var c = b.docSelection.createRange();
                if (q(c)) t(b, c);
                else {
                    b.rangeCount = c.length;
                    for (var d, e = da(c.item(0)), f = 0; f < b.rangeCount; ++f) d = a.createRange(e), d.selectNode(c.item(f)), b._ranges.push(d);
                    b.isCollapsed = 1 == b.rangeCount && b._ranges[0].collapsed;
                    k(b, b._ranges[b.rangeCount - 1], !1)
                }
            }
        }

        function x(a, c) {
            for (var d = a.docSelection.createRange(), e = p(c), f = da(d.item(0)), f = ia(f).createControlRange(), g = 0, h = d.length; g < h; ++g) f.add(d.item(g));
            try {
                f.add(e)
            } catch (k) {
                throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");
            }
            f.select();
            v(a)
        }

        function w(a, b, c) {
            this.nativeSelection = a;
            this.docSelection = b;
            this._ranges = [];
            this.win = c;
            this.refresh()
        }

        function y(a) {
            a.win = a.anchorNode = a.focusNode = a._ranges = null;
            a.rangeCount = a.anchorOffset = a.focusOffset = 0;
            a.detached = !0
        }

        function A(a, b) {
            for (var c = ga.length, d, e; c--;)
                if (d = ga[c], e = d.selection, "deleteAll" == b) y(e);
                else if (d.win == a) return "delete" == b ? (ga.splice(c, 1), !0) : e;
            "deleteAll" == b && (ga.length = 0);
            return null
        }

        function B(a, c) {
            for (var d = da(c[0].startContainer), d = ia(d).createControlRange(),
                    e = 0, f, g = c.length; e < g; ++e) {
                f = p(c[e]);
                try {
                    d.add(f)
                } catch (h) {
                    throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)");
                }
            }
            d.select();
            v(a)
        }

        function C(a, b) {
            if (a.win.document != da(b)) throw new h("WRONG_DOCUMENT_ERR");
        }

        function E(b) {
            return function(c, d) {
                var e;
                this.rangeCount ? (e = this.getRangeAt(0), e["set" + (b ? "Start" : "End")](c, d)) : (e = a.createRange(this.win.document), e.setStartAndEnd(c, d));
                this.setSingleRange(e, this.isBackward())
            }
        }

        function I(a) {
            var b = [],
                c = new Z(a.anchorNode, a.anchorOffset),
                d = new Z(a.focusNode, a.focusOffset),
                e = "function" == typeof a.getName ? a.getName() : "Selection";
            if ("undefined" != typeof a.rangeCount)
                for (var f = 0, g = a.rangeCount; f < g; ++f) b[f] = Q.inspect(a.getRangeAt(f));
            return "[" + e + "(Ranges: " + b.join(", ") + ")(anchor: " + c.inspect() + ", focus: " + d.inspect() + "]"
        }
        a.config.checkSelectionRanges = !0;
        var G = a.dom,
            K = a.util,
            N = K.isHostMethod,
            Q = a.DomRange,
            F = a.WrappedRange,
            h = a.DOMException,
            Z = G.DomPosition,
            La, Ma, ha = a.features,
            da = G.getDocument,
            ia = G.getBody,
            qa = Q.rangesEqual,
            z = N(window, "getSelection"),
            ma = K.isHostObject(document, "selection");
        ha.implementsWinGetSelection = z;
        var H = (ha.implementsDocSelection = ma) && (!z || a.config.preferTextRange);
        H ? (La = f, a.isSelectionValid = function(a) {
            a = d(a, "isSelectionValid").document;
            var b = a.selection;
            return "None" != b.type || da(b.createRange().parentElement()) == a
        }) : z ? (La = e, a.isSelectionValid = function() {
            return !0
        }) : b.fail("Neither document.selection or window.getSelection() detected.");
        a.getNativeSelection = La;
        var z =
            La(),
            na = a.createNativeRange(document),
            L = ia(document),
            oa = K.areHostProperties(z, ["anchorNode", "focusNode", "anchorOffset", "focusOffset"]);
        ha.selectionHasAnchorAndFocus = oa;
        var V = N(z, "extend");
        ha.selectionHasExtend = V;
        var Da = "number" == typeof z.rangeCount;
        ha.selectionHasRangeCount = Da;
        var O = !1,
            Ia = !0,
            Aa = V ? function(b, c) {
                var d = Q.getRangeDocument(c),
                    d = a.createRange(d);
                d.collapseToPoint(c.endContainer, c.endOffset);
                b.addRange(n(d));
                b.extend(c.startContainer, c.startOffset)
            } : null;
        K.areHostMethods(z, ["addRange", "getRangeAt",
            "removeAllRanges"
        ]) && "number" == typeof z.rangeCount && ha.implementsDomRange && function() {
            var b = window.getSelection();
            if (b) {
                for (var c = b.rangeCount, d = 1 < c, e = [], f = g(b), h = 0; h < c; ++h) e[h] = b.getRangeAt(h);
                var h = ia(document),
                    k = h.appendChild(document.createElement("div"));
                k.contentEditable = "false";
                var m = k.appendChild(document.createTextNode("\u00a0\u00a0\u00a0")),
                    n = document.createRange();
                n.setStart(m, 1);
                n.collapse(!0);
                b.addRange(n);
                Ia = 1 == b.rangeCount;
                b.removeAllRanges();
                d || ((d = window.navigator.appVersion.match(/Chrome\/(.*?) /)) &&
                    36 <= parseInt(d[1]) ? O = !1 : (d = n.cloneRange(), n.setStart(m, 0), d.setEnd(m, 3), d.setStart(m, 2), b.addRange(n), b.addRange(d), O = 2 == b.rangeCount));
                h.removeChild(k);
                b.removeAllRanges();
                for (h = 0; h < c; ++h) 0 == h && f ? Aa ? Aa(b, e[h]) : (a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"), b.addRange(e[h])) : b.addRange(e[h])
            }
        }();
        ha.selectionSupportsMultipleRanges = O;
        ha.collapsedNonEditableSelectionsSupported = Ia;
        var ta = !1;
        L && N(L, "createControlRange") && (L = L.createControlRange(), K.areHostProperties(L, ["item", "add"]) && (ta = !0));
        ha.implementsControlRange = ta;
        Ma = oa ? function(a) {
            return a.anchorNode === a.focusNode && a.anchorOffset === a.focusOffset
        } : function(a) {
            return a.rangeCount ? a.getRangeAt(a.rangeCount - 1).collapsed : !1
        };
        var wa;
        N(z, "getRangeAt") ? wa = function(a, b) {
            try {
                return a.getRangeAt(b)
            } catch (c) {
                return null
            }
        } : oa && (wa = function(b) {
            var c = da(b.anchorNode),
                c = a.createRange(c);
            c.setStartAndEnd(b.anchorNode, b.anchorOffset, b.focusNode,
                b.focusOffset);
            c.collapsed !== this.isCollapsed && c.setStartAndEnd(b.focusNode, b.focusOffset, b.anchorNode, b.anchorOffset);
            return c
        });
        w.prototype = a.selectionPrototype;
        var ga = [],
            Ea = function(a) {
                if (a && a instanceof w) return a.refresh(), a;
                a = d(a, "getNativeSelection");
                var b = A(a),
                    c = La(a),
                    e = ma ? f(a) : null;
                b ? (b.nativeSelection = c, b.docSelection = e, b.refresh()) : (b = new w(c, e, a), ga.push({
                    win: a,
                    selection: b
                }));
                return b
            };
        a.getSelection = Ea;
        a.getIframeSelection = function(c) {
            b.deprecationNotice("getIframeSelection()", "getSelection(iframeEl)");
            return a.getSelection(G.getIframeWindow(c))
        };
        L = w.prototype;
        if (!H && oa && K.areHostMethods(z, ["removeAllRanges", "addRange"])) L.removeAllRanges = function() {
            this.nativeSelection.removeAllRanges();
            m(this)
        }, L.addRange = Da ? function(b, d) {
            if (ta && ma && "Control" == this.docSelection.type) x(this, b);
            else if (c(d) && V) Aa(this.nativeSelection, b), this.refresh();
            else {
                var e;
                O ? e = this.rangeCount : (this.removeAllRanges(), e = 0);
                this.nativeSelection.addRange(n(b).cloneRange());
                this.rangeCount = this.nativeSelection.rangeCount;
                this.rangeCount ==
                    e + 1 ? (a.config.checkSelectionRanges && (e = wa(this.nativeSelection, this.rangeCount - 1)) && !qa(e, b) && (b = new F(e)), this._ranges[this.rangeCount - 1] = b, k(this, b, D(this.nativeSelection)), this.isCollapsed = Ma(this)) : this.refresh()
            }
        } : function(a, b) {
            c(b) && V ? Aa(this.nativeSelection, a) : this.nativeSelection.addRange(n(a));
            this.refresh()
        }, L.setRanges = function(a) {
            if (ta && ma && 1 < a.length) B(this, a);
            else {
                this.removeAllRanges();
                for (var b = 0, c = a.length; b < c; ++b) this.addRange(a[b])
            }
        };
        else if (N(z, "empty") && N(na, "select") && ta && H) L.removeAllRanges =
            function() {
                try {
                    if (this.docSelection.empty(), "None" != this.docSelection.type) {
                        var a;
                        if (this.anchorNode) a = da(this.anchorNode);
                        else if ("Control" == this.docSelection.type) {
                            var b = this.docSelection.createRange();
                            b.length && (a = da(b.item(0)))
                        }
                        a && (ia(a).createTextRange().select(), this.docSelection.empty())
                    }
                } catch (c) {}
                m(this)
            }, L.addRange = function(b) {
                "Control" == this.docSelection.type ? x(this, b) : (a.WrappedTextRange.rangeToTextRange(b).select(), this._ranges[0] = b, this.rangeCount = 1, this.isCollapsed = this._ranges[0].collapsed,
                    k(this, b, !1))
            }, L.setRanges = function(a) {
                this.removeAllRanges();
                var b = a.length;
                1 < b ? B(this, a) : b && this.addRange(a[0])
            };
        else return b.fail("No means of selecting a Range or TextRange was found"), !1;
        L.getRangeAt = function(a) {
            if (0 > a || a >= this.rangeCount) throw new h("INDEX_SIZE_ERR");
            return this._ranges[a].cloneRange()
        };
        var pa;
        if (H) pa = function(b) {
            var c;
            a.isSelectionValid(b.win) ? c = b.docSelection.createRange() : (c = ia(b.win.document).createTextRange(), c.collapse(!0));
            "Control" == b.docSelection.type ? v(b) : q(c) ? t(b,
                c) : m(b)
        };
        else if (N(z, "getRangeAt") && "number" == typeof z.rangeCount) pa = function(b) {
            if (ta && ma && "Control" == b.docSelection.type) v(b);
            else if (b._ranges.length = b.rangeCount = b.nativeSelection.rangeCount, b.rangeCount) {
                for (var c = 0, d = b.rangeCount; c < d; ++c) b._ranges[c] = new a.WrappedRange(b.nativeSelection.getRangeAt(c));
                k(b, b._ranges[b.rangeCount - 1], D(b.nativeSelection));
                b.isCollapsed = Ma(b)
            } else m(b)
        };
        else if (oa && "boolean" == typeof z.isCollapsed && "boolean" == typeof na.collapsed && ha.implementsDomRange) pa = function(a) {
            var b;
            b = a.nativeSelection;
            b.anchorNode ? (b = wa(b, 0), a._ranges = [b], a.rangeCount = 1, b = a.nativeSelection, a.anchorNode = b.anchorNode, a.anchorOffset = b.anchorOffset, a.focusNode = b.focusNode, a.focusOffset = b.focusOffset, a.isCollapsed = Ma(a)) : m(a)
        };
        else return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"), !1;
        L.refresh = function(a) {
            var b = a ? this._ranges.slice(0) : null,
                c = this.anchorNode,
                d = this.anchorOffset;
            pa(this);
            if (a) {
                a = b.length;
                if (a != this._ranges.length || this.anchorNode != c || this.anchorOffset !=
                    d) return !0;
                for (; a--;)
                    if (!qa(b[a], this._ranges[a])) return !0;
                return !1
            }
        };
        var ua = function(a, b) {
            var c = a.getAllRanges();
            a.removeAllRanges();
            for (var d = 0, e = c.length; d < e; ++d) qa(b, c[d]) || a.addRange(c[d]);
            a.rangeCount || m(a)
        };
        L.removeRange = ta && ma ? function(a) {
            if ("Control" == this.docSelection.type) {
                var b = this.docSelection.createRange();
                a = p(a);
                for (var c = da(b.item(0)), c = ia(c).createControlRange(), d, e = !1, f = 0, g = b.length; f < g; ++f) d = b.item(f), d !== a || e ? c.add(b.item(f)) : e = !0;
                c.select();
                v(this)
            } else ua(this, a)
        } : function(a) {
            ua(this,
                a)
        };
        var D;
        !H && oa && ha.implementsDomRange ? (D = g, L.isBackward = function() {
            return D(this)
        }) : D = L.isBackward = function() {
            return !1
        };
        L.isBackwards = L.isBackward;
        L.toString = function() {
            for (var a = [], b = 0, c = this.rangeCount; b < c; ++b) a[b] = "" + this._ranges[b];
            return a.join("")
        };
        L.collapse = function(b, c) {
            C(this, b);
            var d = a.createRange(b);
            d.collapseToPoint(b, c);
            this.setSingleRange(d);
            this.isCollapsed = !0
        };
        L.collapseToStart = function() {
            if (this.rangeCount) {
                var a = this._ranges[0];
                this.collapse(a.startContainer, a.startOffset)
            } else throw new h("INVALID_STATE_ERR");
        };
        L.collapseToEnd = function() {
            if (this.rangeCount) {
                var a = this._ranges[this.rangeCount - 1];
                this.collapse(a.endContainer, a.endOffset)
            } else throw new h("INVALID_STATE_ERR");
        };
        L.selectAllChildren = function(b) {
            C(this, b);
            var c = a.createRange(b);
            c.selectNodeContents(b);
            this.setSingleRange(c)
        };
        L.deleteFromDocument = function() {
            if (ta && ma && "Control" == this.docSelection.type) {
                for (var a = this.docSelection.createRange(), b; a.length;) b = a.item(0), a.remove(b), b.parentNode.removeChild(b);
                this.refresh()
            } else if (this.rangeCount &&
                (a = this.getAllRanges(), a.length)) {
                this.removeAllRanges();
                b = 0;
                for (var c = a.length; b < c; ++b) a[b].deleteContents();
                this.addRange(a[c - 1])
            }
        };
        L.eachRange = function(a, b) {
            for (var c = 0, d = this._ranges.length; c < d; ++c)
                if (a(this.getRangeAt(c))) return b
        };
        L.getAllRanges = function() {
            var a = [];
            this.eachRange(function(b) {
                a.push(b)
            });
            return a
        };
        L.setSingleRange = function(a, b) {
            this.removeAllRanges();
            this.addRange(a, b)
        };
        L.callMethodOnEachRange = function(a, b) {
            var c = [];
            this.eachRange(function(d) {
                c.push(d[a].apply(d, b))
            });
            return c
        };
        L.setStart = E(!0);
        L.setEnd = E(!1);
        a.rangePrototype.select = function(a) {
            Ea(this.getDocument()).setSingleRange(this, a)
        };
        L.changeEachRange = function(a) {
            var b = [],
                c = this.isBackward();
            this.eachRange(function(c) {
                a(c);
                b.push(c)
            });
            this.removeAllRanges();
            c && 1 == b.length ? this.addRange(b[0], "backward") : this.setRanges(b)
        };
        L.containsNode = function(a, b) {
            return this.eachRange(function(c) {
                return c.containsNode(a, b)
            }, !0) || !1
        };
        L.getBookmark = function(a) {
            return {
                backward: this.isBackward(),
                rangeBookmarks: this.callMethodOnEachRange("getBookmark", [a])
            }
        };
        L.moveToBookmark = function(b) {
            for (var c = [], d = 0, e, f; e = b.rangeBookmarks[d++];) f = a.createRange(this.win), f.moveToBookmark(e), c.push(f);
            b.backward ? this.setSingleRange(c[0], "backward") : this.setRanges(c)
        };
        L.toHtml = function() {
            var a = [];
            this.eachRange(function(b) {
                a.push(Q.toHtml(b))
            });
            return a.join("")
        };
        ha.implementsTextRange && (L.getNativeTextRange = function() {
            var c;
            if (c = this.docSelection) {
                c = c.createRange();
                if (q(c)) return c;
                throw b.createError("getNativeTextRange: selection is a control selection");
            }
            if (0 <
                this.rangeCount) return a.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));
            throw b.createError("getNativeTextRange: selection contains no range");
        });
        L.getName = function() {
            return "WrappedSelection"
        };
        L.inspect = function() {
            return I(this)
        };
        L.detach = function() {
            A(this.win, "delete");
            y(this)
        };
        w.detachAll = function() {
            A(null, "deleteAll")
        };
        w.inspect = I;
        w.isDirectionBackward = c;
        a.Selection = w;
        a.selectionPrototype = L;
        a.addShimListener(function(a) {
            "undefined" == typeof a.getSelection && (a.getSelection = function() {
                return Ea(a)
            });
            a = null
        })
    }), E
}, this);
			
39 - sendForm - poster un formulaire via ajax (sans lib)
	function sendForm(form){  
    	data='';
		url=form.getAttribute('action');
		Array.prototype.forEach.call(form.elements,function(obj){
			type=obj.getAttribute('type');
			if (
				type!='checkbox'&&type!='radio'&&type!='submit'
				||obj.checked==1
			){
				data+=obj.getAttribute('name')+'='+obj.value+'&';
			}
		});
    	
    	request = new XMLHttpRequest;
		request.open('post', url, true);
		request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		request.send(data);

		// Gestion de la réponse du serveur
		request.onreadystatechange=function(){
			if (request.readyState!=4 && request.status!=200){
				console.log(request.responseText);
			}
		}
	    return false;        
	}
			
40 - JavaScript Floating Box Following Scroll
//Le HTML
//<div id="heart53100">♥</div>

//La CSS

//#heart53100 {
//position:absolute;
//top:300px;
//left:20px;
//z-index:2;
//}

// -*- coding: utf-8 -*-
// 2010-03-10, 2014-04-10
// change the position of a “div#heart53100” element.

(function () {

    var offsetFromTop = window.innerHeight/2; // number of pixels of the widget should be from top of the window
    var updateFrequency= 50; //milisecond. The smaller the value, smooth the animation.
    var chaseFactor = .05; // the closing-in factor. Smaller makes it smoother.

    var yMoveTo=0;
    var yDiff=0;

    var movingWidget = document.getElementById("heart53100");
    movingWidget.style.position="absolute";
    movingWidget.style.zIndex="2";
    movingWidget.style.top= offsetFromTop.toString() + "px";
    movingWidget.style.left="1ex";

    function ff(){
        // compute the distance user has scrolled the window
        yDiff = (navigator.appName === "Microsoft Internet Explorer") ? (yMoveTo - document.documentElement.scrollTop) : (yMoveTo - window.pageYOffset) ;

        if ( Math.abs(yDiff) > 9) {

            // turn off now, prevent the event repeatedly fired when user scroll repeatedly
            window.removeEventListener("scroll", ff);

            yMoveTo -= yDiff*chaseFactor;
            movingWidget.style.top  = (yMoveTo+offsetFromTop).toString() + "px" ;
            setTimeout(ff, updateFrequency); // calls itself again
        } else {
            window.addEventListener("scroll", ff , false); // turn back on
        }
    }

    window.addEventListener("scroll", ff , false);

})();

			
41 - Strip_cars
function strip_tags(input, allowed) {
				//http://phpjs.org/functions/strip_tags/
				allowed = (((allowed || '') + '')
				.toLowerCase()
				.match(/<[a-z][a-z0-9]*>/g) || [])
				.join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
				var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
				commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
				return input.replace(commentsAndPhpTags, '')
				.replace(tags, function($0, $1) {
				  return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
				});
			}
			
42 - Raccourci clavier textarea pour valider [Résolu]
<script type="text/javascript">
window.onload = function() {

    /* <textarea id="comment_textarea" ...></textarea> */
    var textarea = document.getElementById('comment_textarea');
    
    textarea.onkeydown = function(e) {
        e = e || event; // cross-browser (quand IE en fait � sa t�te)
        
        /* Envoyer le formulaire avec Ctrl+Entrer */
        if(e.keyCode == 13 && e.ctrlKey) {
            this.form.submit();
        }
        
        /* Envoyer le formulaire avec Entrer mais autoriser
         * les retours � la ligne avec Ctrl+Entrer */
        if(e.keyCode == 13 && !e.ctrlKey) {
            this.form.submit();
            return false;
        } else if (e.keyCode == 13) {
            this.value += "\n";
        }
    };
};
</script>


			
43 - poster des données en asynchrone sans jquery
		function post(){
			obj=document.getElementById('message');
			data=obj.value;
			request = new XMLHttpRequest;
			request.open('POST', 'index.php', true);
			
			request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			request.send("message="+data+"&pseudo=roger");// ici on met name=valeur
			obj.value='';
		}
			
45 - ScrollToTop sans jQuery - Ecyseo
/*
# ------------------ BEGIN LICENSE BLOCK ------------------
#
#
# Copyright (c) 2009 - 2014 Cyril MAGUIRE
# Licensed under the CeCILL v2.1 license.
# See http://www.cecill.info/licences.fr.html
#
# ------------------- END LICENSE BLOCK -------------------
*/
;(function(window,undefined) {

    'use_strict';

    var timeOut;
    var isIE = isIE();

    function isIE() {
        var nav = navigator.userAgent.toLowerCase();
        return (nav.indexOf('msie') != -1) ? parseInt(nav.split('msie')[1]) : false;
    }

    function backToTop() {
        if (document.body.scrollTop!=0 || document.documentElement.scrollTop!=0){
            window.scrollBy(0,-50);
            timeOut=setTimeout('backToTop()',40);
        }
        else {
            clearTimeout(timeOut);
        }
    }

    function getScrollPosition() {
        return Array((document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft,(document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop);
    }

    function Remove(idOfParent,idToRemove) {
        if (isIE) {
            document.getElementById(idToRemove).removeNode(true);
        } else {
            var Node1 = document.getElementById(idOfParent); 
            var len = Node1.childNodes.length;
            
            for(var i = 0; i < len; i++){           
                if (Node1.childNodes[i] != undefined && Node1.childNodes[i].id != undefined && Node1.childNodes[i].id == idToRemove){
                    Node1.removeChild(Node1.childNodes[i]);
                }
            }
        }   
    }

    function addElement(idOfParent,idToAdd,htmlToInsert) {
        var DomParent = document.getElementById(idOfParent);//id of body
        var newdiv = document.createElement('div');

        newdiv.setAttribute('id',idToAdd);
        newdiv.innerHTML = htmlToInsert;

        DomParent.appendChild(newdiv);
    }

    function displayBackButton() {
        var pos = [];
        var fleche = '\u21E7';

        if (isIE) {
            fleche = '\u25B2';
        }
        pos = getScrollPosition();
        var topLink = document.getElementById('toplink');
        if (pos[1] > 150) {
            if (topLink == null) {
                addElement('top','toplink',''+fleche+'');
            }
        } else {
            if (topLink != null) {
                Remove('top','toplink');
            }
        }
    }

    //add to global namespace
    window.onscroll = displayBackButton;
    window.displayBackButton = displayBackButton;
    window.backToTop = backToTop;


})(window);  
    

// CSS
#toplink {
    position: fixed;
    bottom: 20px;
    width: 100px;
    text-align: center;
    right:10px;
}
#toplink a { 
	font-size: 40px;
	opacity: 0.8;
}


			
46 - scrollToTop
/*
# ------------------ BEGIN LICENSE BLOCK ------------------
#
# This file is part of SIGesTH
#
# Copyright (c) 2009 - 2014 Cyril MAGUIRE
# Licensed under the CeCILL v2.1 license.
# See http://www.cecill.info/licences.fr.html
#
# ------------------- END LICENSE BLOCK -------------------
*/
;(function(window,undefined) {

    'use_strict';

    var timeOut;
    var isIE = isIE();

    function isIE() {
        var nav = navigator.userAgent.toLowerCase();
        return (nav.indexOf('msie') != -1) ? parseInt(nav.split('msie')[1]) : false;
    }

    function backToTop() {
        if (document.body.scrollTop!=0 || document.documentElement.scrollTop!=0){
            window.scrollBy(0,-50);
            timeOut=setTimeout('backToTop()',40);
        }
        else {
            clearTimeout(timeOut);
        }
    }

    function getScrollPosition() {
        return Array((document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft,(document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop);
    }

    function Remove(idOfParent,idToRemove) {
        if (isIE) {
            document.getElementById(idToRemove).removeNode(true);
        } else {
            var Node1 = document.getElementById(idOfParent); 
            var len = Node1.childNodes.length;
            
            for(var i = 0; i < len; i++){           
                if (Node1.childNodes[i] != undefined && Node1.childNodes[i].id != undefined && Node1.childNodes[i].id == idToRemove){
                    Node1.removeChild(Node1.childNodes[i]);
                }
            }
        }   
    }

    function addElement(idOfParent,idToAdd,htmlToInsert) {
        var DomParent = document.getElementById(idOfParent);//id of body
        var newdiv = document.createElement('div');

        newdiv.setAttribute('id',idToAdd);
        newdiv.innerHTML = htmlToInsert;

        DomParent.appendChild(newdiv);
    }

    function displayBackButton() {
        var pos = [];
        var fleche = '\u21E7';

        if (isIE) {
            fleche = '\u25B2';
        }
        pos = getScrollPosition();
        var topLink = document.getElementById('toplink');
        if (pos[1] > 150) {
            if (topLink == null) {
                addElement('top','toplink','<a href="#" onclick="backToTop();return false;">'+fleche+'</a>');
            }
        } else {
            if (topLink != null) {
                Remove('top','toplink');
            }
        }
    }

    //add to global namespace
    window.onscroll = displayBackButton;
    window.displayBackButton = displayBackButton;
    window.backToTop = backToTop;


})(window);  
    
			
47 - Connaitre la position du scroll dans la page

function getScrollPosition()
{
	return Array((document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft,(document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop);
}
			
48 - Injecter javascript en asynchrone externe (non bloquant)
<!-- BAD: blocking external script -->
<script src="http://somehost.com/awesome-widget.js"></script>

<!-- GOOD: remote script is loaded asynchronously -->
<script>
    var script = document.createElement('script');
    script.src = "http://somehost.com/awesome-widget.js";
    document.getElementsByTagName('head')[0].appendChild(script);
</script>

<!-- GOOD: modern, simpler, faster, and better all around  -->
<script src="http://somehost.com/awesome-widget.js" async></script>
			
49 - Demander confirmation de la fermeture d'un onglet
var confirmOnLeave = function(msg) {
 
    window.onbeforeunload = function (e) {
        e = e || window.event;
        msg = msg || '';
 
        // For IE and Firefox
        if (e) {e.returnValue = msg;}
 
        // For Chrome and Safari
        return msg;
    };
 
};
 
// message de confirmation générique du navigateur
confirmOnLeave();
 
// message de confirmation personnalisé
confirmOnLeave('Vous allez perdre votre travail, êtes vous sûr(e) de vouloir quitter la page ?');
			
53 - Tabulation dans textarea
document.querySelector("textarea").addEventListener('keydown',function(e) {
        if(e.keyCode === 9) { // tab was pressed
            // get caret position/selection
            var start = this.selectionStart;
            var end = this.selectionEnd;

            var target = e.target;
            var value = target.value;

            // set textarea value to: text before caret + tab + text after caret
            target.value = value.substring(0, start)
                        + "\t"
                        + value.substring(end);

            // put caret at right position again (add one for the tab)
            this.selectionStart = this.selectionEnd = start + 1;

            // prevent the focus lose
            e.preventDefault();
        }
    },false);
			
55 - Se passer de Jquery
Évènements

// jQuery
$(document).ready(function() {
  // code
})

// Vanilla
document.addEventListener('DOMContentLoaded', function() {
  // code
})
// jQuery
$('a').click(function() {
  // code…
})

// Vanilla
[].forEach.call(document.querySelectorAll('a'), function(el) {
  el.addEventListener('click', function() {
    // code…
  })
})
Sélecteurs

// jQuery
var divs = $('div')

// Vanilla
var divs = document.querySelectorAll('div')
// jQuery
var newDiv = $('<div/>')

// Vanilla
var newDiv = document.createElement('div')
Attributs

// jQuery
$('img').filter(':first').attr('alt', 'My image')

// Vanilla
document.querySelector('img').setAttribute('alt', 'My image')
Classes

// jQuery
newDiv.addClass('foo')

// Vanilla
newDiv.classList.add('foo')
// jQuery
newDiv.toggleClass('foo')

// Vanilla
newDiv.classList.toggle('foo')
Manipulation

// jQuery
$('body').append($('<p/>'))

// Vanilla
document.body.appendChild(document.createElement('p'))
// jQuery
var clonedElement = $('#about').clone()

// Vanilla
var clonedElement = document.getElementById('about').cloneNode(true)
// jQuery
$('#wrap').empty()

// Vanilla
var wrap = document.getElementById('wrap')
while(wrap.firstChild) wrap.removeChild(wrap.firstChild)
Navigation

// jQuery
var parent = $('#about').parent()

// Vanilla
var parent = document.getElementById('about').parentNode
// jQuery
if($('#wrap').is(':empty'))

// Vanilla
if(!document.getElementById('wrap').hasChildNodes())
// jQuery
var nextElement = $('#wrap').next()

// Vanilla
var nextElement = document.getElementById('wrap').nextSibling
AJAX

GET

// jQuery
$.get('//example.com', function (data) {
  // code
})

// Vanilla
var httpRequest = new XMLHttpRequest()
httpRequest.onreadystatechange = function (data) {
  // code
}
httpRequest.open('GET', url)
httpRequest.send()
POST

// jQuery
$.post('//example.com', { username: username }, function (data) {
  // code
})

// Vanilla
var httpRequest = new XMLHttpRequest()
httpRequest.onreadystatechange = function (data) {
  // code
}
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
httpRequest.open('POST', url)
httpRequest.send('username=' + encodeURIComponent(username))
JSONP

// jQuery
$.getJSON('//openexchangerates.org/latest.json?callback=?', function (data) {
  // code
})

// Vanilla
function success(data) {
  // code
}
var scr = document.createElement('script')
scr.src = '//openexchangerates.org/latest.json?callback=formatCurrency'
document.body.appendChild(scr)
			
56 - Use PHP inside JavaScript | CSS-Tricks
<FilesMatch "^.*?api.*?$">
SetHandler php5-script
</FilesMatch>

<?php
	// Sets the proper content type for javascript
	header("Content-type: application/javascript");
?>

<FilesMatch "^.*?MyWhackyExpression.*?$">
    SetHandler php5-script
</FilesMatch>


<?php
    // MyWhackyExpression
    // Sets the proper content type for javascript
    header("Content-type: application/javascript");
?>



			
57 - Parsing Markdown in Under 100 Lines of Javascript
if (typeof markdown === 'undefined') var markdown = {
parse: function (s) {
    var r = s, ii, pre1 = [], pre2 = [];

    // detect newline format
    var newline = r.indexOf('\r\n') != -1 ? '\r\n' : r.indexOf('\n') != -1 ? '\n' : ''
    
    // store CONSTANT "{ unformatted blocks": not defined !} and <pre> pre-formatted blocks </pre>
    r = r.replace(/CONSTANT "{": not defined !}/g, function (x) { pre1.push(x.substring(3, x.length - 3)); return 'CONSTANT "{": not defined !}'; });
    r = r.replace(new RegExp('<pre>([\\s\\S]*?)</pre>', 'gi'), function (x) { pre2.push(x.substring(5, x.length - 6)); return '<pre></pre>'; });
    
    // h1 - h4 and hr
    r = r.replace(/^==== (.*)=*/gm, '<h4>$1</h4>');
    r = r.replace(/^=== (.*)=*/gm, '<h3>$1</h3>');
    r = r.replace(/^== (.*)=*/gm, '<h2>$1</h2>');
    r = r.replace(/^= (.*)=*/gm, '<h1>$1</h1>');
    r = r.replace(/^[-*][-*][-*]+/gm, '<hr>');
    
    // bold, italics, and code formatting
    r = r.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
    r = r.replace(new RegExp('//(((?!https?://).)*?)//', 'g'), '<em>$1</em>');
    r = r.replace(/``(.*?)``/g, '<code>$1</code>');
    
    // unordered lists
    r = r.replace(/^\*\*\*\* (.*)/gm, '<ul><ul><ul><ul><li>$1</li></ul></ul></ul></ul>');
    r = r.replace(/^\*\*\* (.*)/gm, '<ul><ul><ul><li>$1</li></ul></ul></ul>');
    r = r.replace(/^\*\* (.*)/gm, '<ul><ul><li>$1</li></ul></ul>');
    r = r.replace(/^\* (.*)/gm, '<ul><li>$1</li></ul>');
    for (ii = 0; ii < 3; ii++) r = r.replace(new RegExp('</ul>' + newline + '<ul>', 'g'), newline);
    
    // ordered lists
    r = r.replace(/^#### (.*)/gm, '<ol><ol><ol><ol><li>$1</li></ol></ol></ol></ol>');
    r = r.replace(/^### (.*)/gm, '<ol><ol><ol><li>$1</li></ol></ol></ol>');
    r = r.replace(/^## (.*)/gm, '<ol><ol><li>$1</li></ol></ol>');
    r = r.replace(/^# (.*)/gm, '<ol><li>$1</li></ol>');
    for (ii = 0; ii < 3; ii++) r = r.replace(new RegExp('</ol>' + newline + '<ol>', 'g'), newline);
    
    // links
    r = r.replace(/\[\[(http:[^\]|]*?)\]\]/g, '<a target="_blank" href="$1">$1</a>');
    r = r.replace(/\[\[(http:[^|]*?)\|(.*?)\]\]/g, '<a target="_blank" href="$1">$2</a>');
    r = r.replace(/\[\[([^\]|]*?)\]\]/g, '<a href="$1">$1</a>');
    r = r.replace(/\[\[([^|]*?)\|(.*?)\]\]/g, '<a href="$1">$2</a>');
    
    // images
    r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">');
    r = r.replace(/{{([^|]*?)\|(.*?)}}/g, '<img src="$1" alt="$2">');
    
    // video
    r = r.replace(/<<(.*?)>>/g, '<embed class="video" src="$1" allowfullscreen="true" allowscriptaccess="never" type="application/x-shockwave/flash"></embed>');
    
    // hard linebreak if there are 2 or more spaces at the end of a line
    r = r.replace(new RegExp(' + ' + newline, 'g'), '<br>' + newline);
    
    // split on double-newlines, then add paragraph tags when the first tag isn't a block level element
    if (newline != '') for (var p = r.split(newline + newline), i = 0; i < p.length; i++) {
        var blockLevel = false;
        if (p[i].length >= 1 && p[i].charAt(0) == '<') {
            // check if the first tag is a block-level element
            var firstSpace = p[i].indexOf(' '), firstCloseTag = p[i].indexOf('>');
            var endIndex = firstSpace > -1 && firstCloseTag > -1 ? Math.min(firstSpace, firstCloseTag) : firstSpace > -1 ? firstSpace : firstCloseTag;
            var tag = p[i].substring(1, endIndex).toLowerCase();
            for (var j = 0; j < blockLevelElements.length; j++) if (blockLevelElements[j] == tag) blockLevel = true;
        } else if (p[i].length >= 1 && p[i].charAt(0) == '|') {
            // format the paragraph as a table
            blockLevel = true;
            p[i] = p[i].replace(/ \|= /g, '</th><th>').replace(/\|= /g, '<tr><th>').replace(/ \|=/g, '</th></tr>');
            p[i] = p[i].replace(/ \| /g, '</td><td>').replace(/\| /g, '<tr><td>').replace(/ \|/g, '</td></tr>');
            p[i] = '<table>' + p[i] + '</table>';
        } else if (p[i].length >= 2 && p[i].charAt(0) == '>' && p[i].charAt(1) == ' ') {
            // format the paragraph as a blockquote
            blockLevel = true;
            p[i] = '<blockquote>' + p[i].replace(/^> /gm, '') + '</blockquote>';
        }
        if (!blockLevel) p[i] = '<p>' + p[i] + '</p>';
    }
    
    // reassemble the paragraphs
    if (newline != '') r = p.join(newline + newline);
    
    // restore the preformatted and unformatted blocks
    r = r.replace(new RegExp('<pre></pre>', 'g'), function (match) { return '<pre>' + pre2.shift() + '</pre>'; });
    r = r.replace(/CONSTANT "{": not defined !}/g, function (match) { return pre1.shift(); });
    return r;
}
};

// markdown.parse(myText)

/*
= Heading 1
== Heading 2
=== Heading 3
==== Heading 4

**bold**
//italic//

* Bullet list
* Second item
** Sub item

# Numbered list
# Second item
## Sub item

[[link]]
CONSTANT "image": not defined !
<<video>>

|= table |= hdr |=
| table | row |
| table | row |

> blockquote

CONSTANT "{ unformatted text": not defined !}
--- horizontal rule

*/
			
58 - Get viewport/window size (width and height) with javascript | Andy Langton
<script type="text/javascript">
<!--

 var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
document.write('<p>Your viewport width is '+viewportwidth+'x'+viewportheight+'</p>');
//-->
</script>


<script type="text/javascript">
<!--
function viewport()
{
var e = window
, a = 'inner';
if ( !( 'innerWidth' in window ) )
{
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] }
}
//-->
</script>


<script type="text/javascript">
<!--
var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight;
//-->
</script>



			
59 - Parsing Markdown in Under 100 Lines of Javascript
if (typeof markdown === 'undefined') var markdown = {
parse: function (s) {
    var r = s, ii, pre1 = [], pre2 = [];

    // detect newline format
    var newline = r.indexOf('\r\n') != -1 ? '\r\n' : r.indexOf('\n') != -1 ? '\n' : ''
    
    // store CONSTANT "{ unformatted blocks": not defined !} and <pre> pre-formatted blocks </pre>
    r = r.replace(/CONSTANT "{": not defined !}/g, function (x) { pre1.push(x.substring(3, x.length - 3)); return 'CONSTANT "{": not defined !}'; });
    r = r.replace(new RegExp('<pre>([\\s\\S]*?)</pre>', 'gi'), function (x) { pre2.push(x.substring(5, x.length - 6)); return '<pre></pre>'; });
    
    // h1 - h4 and hr
    r = r.replace(/^==== (.*)=*/gm, '<h4>$1</h4>');
    r = r.replace(/^=== (.*)=*/gm, '<h3>$1</h3>');
    r = r.replace(/^== (.*)=*/gm, '<h2>$1</h2>');
    r = r.replace(/^= (.*)=*/gm, '<h1>$1</h1>');
    r = r.replace(/^[-*][-*][-*]+/gm, '<hr>');
    
    // bold, italics, and code formatting
    r = r.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
    r = r.replace(new RegExp('//(((?!https?://).)*?)//', 'g'), '<em>$1</em>');
    r = r.replace(/``(.*?)``/g, '<code>$1</code>');
    
    // unordered lists
    r = r.replace(/^\*\*\*\* (.*)/gm, '<ul><ul><ul><ul><li>$1</li></ul></ul></ul></ul>');
    r = r.replace(/^\*\*\* (.*)/gm, '<ul><ul><ul><li>$1</li></ul></ul></ul>');
    r = r.replace(/^\*\* (.*)/gm, '<ul><ul><li>$1</li></ul></ul>');
    r = r.replace(/^\* (.*)/gm, '<ul><li>$1</li></ul>');
    for (ii = 0; ii < 3; ii++) r = r.replace(new RegExp('</ul>' + newline + '<ul>', 'g'), newline);
    
    // ordered lists
    r = r.replace(/^#### (.*)/gm, '<ol><ol><ol><ol><li>$1</li></ol></ol></ol></ol>');
    r = r.replace(/^### (.*)/gm, '<ol><ol><ol><li>$1</li></ol></ol></ol>');
    r = r.replace(/^## (.*)/gm, '<ol><ol><li>$1</li></ol></ol>');
    r = r.replace(/^# (.*)/gm, '<ol><li>$1</li></ol>');
    for (ii = 0; ii < 3; ii++) r = r.replace(new RegExp('</ol>' + newline + '<ol>', 'g'), newline);
    
    // links
    r = r.replace(/\[\[(http:[^\]|]*?)\]\]/g, '<a target="_blank" href="$1">$1</a>');
    r = r.replace(/\[\[(http:[^|]*?)\|(.*?)\]\]/g, '<a target="_blank" href="$1">$2</a>');
    r = r.replace(/\[\[([^\]|]*?)\]\]/g, '<a href="$1">$1</a>');
    r = r.replace(/\[\[([^|]*?)\|(.*?)\]\]/g, '<a href="$1">$2</a>');
    
    // images
    r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">');
    r = r.replace(/{{([^|]*?)\|(.*?)}}/g, '<img src="$1" alt="$2">');
    
    // video
    r = r.replace(/<<(.*?)>>/g, '<embed class="video" src="$1" allowfullscreen="true" allowscriptaccess="never" type="application/x-shockwave/flash"></embed>');
    
    // hard linebreak if there are 2 or more spaces at the end of a line
    r = r.replace(new RegExp(' + ' + newline, 'g'), '<br>' + newline);
    
    // split on double-newlines, then add paragraph tags when the first tag isn't a block level element
    if (newline != '') for (var p = r.split(newline + newline), i = 0; i < p.length; i++) {
        var blockLevel = false;
        if (p[i].length >= 1 && p[i].charAt(0) == '<') {
            // check if the first tag is a block-level element
            var firstSpace = p[i].indexOf(' '), firstCloseTag = p[i].indexOf('>');
            var endIndex = firstSpace > -1 && firstCloseTag > -1 ? Math.min(firstSpace, firstCloseTag) : firstSpace > -1 ? firstSpace : firstCloseTag;
            var tag = p[i].substring(1, endIndex).toLowerCase();
            for (var j = 0; j < blockLevelElements.length; j++) if (blockLevelElements[j] == tag) blockLevel = true;
        } else if (p[i].length >= 1 && p[i].charAt(0) == '|') {
            // format the paragraph as a table
            blockLevel = true;
            p[i] = p[i].replace(/ \|= /g, '</th><th>').replace(/\|= /g, '<tr><th>').replace(/ \|=/g, '</th></tr>');
            p[i] = p[i].replace(/ \| /g, '</td><td>').replace(/\| /g, '<tr><td>').replace(/ \|/g, '</td></tr>');
            p[i] = '<table>' + p[i] + '</table>';
        } else if (p[i].length >= 2 && p[i].charAt(0) == '>' && p[i].charAt(1) == ' ') {
            // format the paragraph as a blockquote
            blockLevel = true;
            p[i] = '<blockquote>' + p[i].replace(/^> /gm, '') + '</blockquote>';
        }
        if (!blockLevel) p[i] = '<p>' + p[i] + '</p>';
    }
    
    // reassemble the paragraphs
    if (newline != '') r = p.join(newline + newline);
    
    // restore the preformatted and unformatted blocks
    r = r.replace(new RegExp('<pre></pre>', 'g'), function (match) { return '<pre>' + pre2.shift() + '</pre>'; });
    r = r.replace(/CONSTANT "{": not defined !}/g, function (match) { return pre1.shift(); });
    return r;
}
};

// markdown.parse(myText)

/*
= Heading 1
== Heading 2
=== Heading 3
==== Heading 4

**bold**
//italic//

* Bullet list
* Second item
** Sub item

# Numbered list
# Second item
## Sub item

[[link]]
CONSTANT "image": not defined !
<<video>>

|= table |= hdr |=
| table | row |
| table | row |

> blockquote

CONSTANT "{ unformatted text": not defined !}
--- horizontal rule

*/
			
61 - Slideshow minimaliste
/* CSS */
<style>
.fadein .carrousel .links{clear:both;width:100%;txtr}
.fadein { position:relative; width:100%; height:300px; } 
.fadein .carrousel { position:absolute; left:0; top:0; }

</style>
/* HTML */
<div class="fadein">
	<div class="carrousel car1">
		
		<div class="content">
			<h1>Titre du premier</h1>
			Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
			tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
			quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
			consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
			cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupihref="" datat non
			proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

		</div>
		<div class="links">
			<em>1</em>
			<a href="" data="car2">2</a>
			<a href="" data="car3">3</a>
		</div>
	</div>
	<div class="carrousel car2">
		<div class="content">
			Ut enim ad minim veniam,
			quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
			consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
			cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupit non
			proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
		</div>
		<div class="links">
			
			<a href="" data="car1">1</a>
			<em>2</em>
			<a href="" data="car3">3</a>
		</div>
	</div>

	<div class="carrousel car3">
		<div class="content">
		</div>		
		<div class="links">			
			<a href="" data="car1">2</a>			
			<a href="" data="car2">3</a>
			<em>3</em>
		</div>
	</div>

</div>

/* JS/JQuery */
<script>
	$('.fadein .carrousel:gt(0)').hide();compteur=0;
	function slideshow(){
		z=setInterval(
			function(){
				compteur++;
				if (compteur==4){montre=1;cache=3;compteur=1;}
				else if (compteur>1){montre=compteur;cache=compteur-1;}
				else if (compteur==1){montre=1;cache=3;}
				
			  	$('.fadein > .car'+cache).fadeOut(500)
				.parent().find('.car'+montre).fadeIn(500)
				.end();
			}
		,5000);
		return z;
	}
	slide=slideshow();

        // si on survole, pause
	$('.fadein').hover(function(ev){
    	clearInterval(slide);
	}, function(ev){
		  slide = slideshow();
		}
	);
 
        // clic sur un lien pour changer de diapo
        $('.links a').click(function(){
        	car=$(this).attr('data');
        	$('.fadein > .carrousel').fadeOut(500)
		.parent().find('.car'+car).fadeIn(500)
		.end();
		compteur=car;
    	        return false;
        });

</script>
			
62 - variables dynamiques (dont le nom est une variable)
(via HollandaisVolant)

Faire des variables dynamiques en JS.
 Un trop dont je ne me sert jamais, mais là ouais.
 
 // En gros, si t’as ça :
 var variable = 'machin';
 var machin = document.getElementById('id');
 
 // on peut faire :
 eval(variable).style.display = 'block';
 
 // variable contient « machin ».
 // en faisant le eval(), c’est comme si le contenu de "variable" devenait une variable. Ici, donc, le #id aura comme display un « block ».
 // Pratique si on n’a pas envie de faire un « getElementById » pour 50 blocs à la fois, mais qu’on peut écrire dans un boucle avec ça.
 
 Ça existe aussi en PHP :
 $var = nombre;
 $nombre = 137;
 $$var = 42;

			
63 - Fonctions récupérées de regexpal (à creuser)
/*
	Helper functions for RegexPal
	(c) 2007 Steven Levithan <http://stevenlevithan.com>
	MIT license
*/

function $ (el) {
	if (el.nodeName) return el;
	if (typeof el === "string") return document.getElementById(el);
	return false;
};

var trim = function () {
	// See <http://blog.stevenlevithan.com/archives/faster-trim-javascript>
	var	lSpace = /^ss*/,
		rSpace = /ss*$/;
	return function (str) {
		return str.replace(lSpace, "").replace(rSpace, "");
	};
}();

// This is much faster than simple use of innerHTML in some browsers
// See <http://blog.stevenlevithan.com/archives/faster-than-innerhtml>
function replaceHtml (el, html) {
	var oldEl = $(el);
	/*@cc_on // Pure innerHTML is slightly faster in IE
		oldEl.innerHTML = html;
		return oldEl;
	@*/
	var newEl = oldEl.cloneNode(false);
	newEl.innerHTML = html;
	oldEl.parentNode.replaceChild(newEl, oldEl);
	/* Since we just removed the old element from the DOM, return a reference
	to the new element, which can be used to restore variable references. */
	return newEl;
};

/* outerHTML is used to work around the fact that IE applies text normalization when using innerHTML,
which can cause problems with whitespace, etc. Note that even this approach doesn't work with some
elements such as <div>. However, it mostly works with <pre> elements, at least. */
function replaceOuterHtml (el, html) {
	el = replaceHtml(el, "");
	if (el.outerHTML) { // If IE
		var	id = el.id,
			className = el.className,
			nodeName = el.nodeName;
		el.outerHTML = "<" + nodeName + " id="" + id + "" class="" + className + "">" + html + "</" + nodeName + ">";
		el = $(id); // Reassign, since we just overwrote the element in the DOM
	} else {
		el.innerHTML = html;
	}
	return el;
};

// Return an array of all elements with a specified class name, optionally filtered by tag name and parent
function getElementsByClassName (className, tagName, parentNode) {
	var	els = ($(parentNode) || document).getElementsByTagName(tagName || "*"),
		results = [];
	for (var i = 0; i < els.length; i++) {
		if (hasClass(className, els[i])) results.push(els[i]);
	}
	return results;
};

function hasClass (className, el) {
	/* It might not make sense to cache all regexes in a more widely used hasClass function,
	but RegexPal uses it with a small number of classes so there is little memory overhead. */
	return XRegExp.cache("(?:^|s)" + className + "(?:s|$)").test($(el).className);
};

function addClass (className, el) {
	el = $(el);
	if (!hasClass(className, el)) {
		el.className = trim(el.className + " " + className);
	}
};

function removeClass (className, el) {
	el = $(el);
	el.className = trim(el.className.replace(XRegExp.cache("(?:^|s)" + className + "(?:s|$)", "g"), " "));
};

function toggleClass (className, el) {
	if (hasClass(className, el)) {
		removeClass(className, el);
	} else {
		addClass(className, el);
	}
};

function swapClass (oldClass, newClass, el) {
	removeClass(oldClass, el);
	addClass(newClass, el);
};

function replaceSelection (textbox, str) {
	if (textbox.setSelectionRange) {
		var	start = textbox.selectionStart,
			end = textbox.selectionEnd,
			offset = (start + str.length);
		textbox.value = (textbox.value.substring(0, start) + str + textbox.value.substring(end));
		textbox.setSelectionRange(offset, offset);
	} else if (document.selection) { // If IE (Opera has setSelectionRange and Selection objects)
		var range = document.selection.createRange();
		range.text = str;
		range.select();
	}
};

function extend (to, from) {
	for (var property in from) to[property] = from[property];
	return to;
};

// purge by Douglas Crockford <http://javascript.crockford.com/memory/leak.html>
function purge (d) {
	var a = d.attributes, i, l, n;
	if (a) {
		l = a.length;
		for (i = 0; i < l; i += 1) {
			n = a[i].name;
			if (typeof d[n] === 'function') {
				d[n] = null;
			}
		}
	}
	a = d.childNodes;
	if (a) {
		l = a.length;
		for (i = 0; i < l; i += 1) {
			purge(d.childNodes[i]);
		}
	}
};

// Sniff
var	isWebKit = navigator.userAgent.indexOf("WebKit") > -1,
	isIE /*@cc_on = true @*/,
	isIE6 = isIE && !window.XMLHttpRequest; // Despite the variable name, this means if IE lower than v7

// RegexPal also needs an Array.prototype.indexOf method, but it's provided by XRegExp

			
64 - Function htmlentities
function HTMLentities(texte) {

texte = texte.replace(/"/g,'&quot;'); // 34 22
texte = texte.replace(/&/g,'&amp;'); // 38 26
texte = texte.replace(/'/g,'&#39;'); // 39 27
texte = texte.replace(/</g,'&lt;'); // 60 3C
texte = texte.replace(/>/g,'&gt;'); // 62 3E
texte = texte.replace(/^/g,'&circ;'); // 94 5E
texte = texte.replace(/‘/g,'&lsquo;'); // 145 91
texte = texte.replace(/’/g,'&rsquo;'); // 146 92
texte = texte.replace(/“/g,'&ldquo;'); // 147 93
texte = texte.replace(/”/g,'&rdquo;'); // 148 94
texte = texte.replace(/•/g,'&bull;'); // 149 95
texte = texte.replace(/–/g,'&ndash;'); // 150 96
texte = texte.replace(/—/g,'&mdash;'); // 151 97
texte = texte.replace(/˜/g,'&tilde;'); // 152 98
texte = texte.replace(/™/g,'&trade;'); // 153 99
texte = texte.replace(/š/g,'&scaron;'); // 154 9A
texte = texte.replace(/›/g,'&rsaquo;'); // 155 9B
texte = texte.replace(/œ/g,'&oelig;'); // 156 9C
texte = texte.replace(//g,'&#357;'); // 157 9D
texte = texte.replace(/ž/g,'&#382;'); // 158 9E
texte = texte.replace(/Ÿ/g,'&Yuml;'); // 159 9F
// texte = texte.replace(/ /g,'&nbsp;'); // 160 A0
texte = texte.replace(/¡/g,'&iexcl;'); // 161 A1
texte = texte.replace(/¢/g,'&cent;'); // 162 A2
texte = texte.replace(/£/g,'&pound;'); // 163 A3
//texte = texte.replace(/ /g,'&curren;'); // 164 A4
texte = texte.replace(/¥/g,'&yen;'); // 165 A5
texte = texte.replace(/¦/g,'&brvbar;'); // 166 A6
texte = texte.replace(/§/g,'&sect;'); // 167 A7
texte = texte.replace(/¨/g,'&uml;'); // 168 A8
texte = texte.replace(/©/g,'&copy;'); // 169 A9
texte = texte.replace(/ª/g,'&ordf;'); // 170 AA
texte = texte.replace(/«/g,'&laquo;'); // 171 AB
texte = texte.replace(/¬/g,'&not;'); // 172 AC
texte = texte.replace(/­/g,'&shy;'); // 173 AD
texte = texte.replace(/®/g,'&reg;'); // 174 AE
texte = texte.replace(/¯/g,'&macr;'); // 175 AF
texte = texte.replace(/°/g,'&deg;'); // 176 B0
texte = texte.replace(/±/g,'&plusmn;'); // 177 B1
texte = texte.replace(/²/g,'&sup2;'); // 178 B2
texte = texte.replace(/³/g,'&sup3;'); // 179 B3
texte = texte.replace(/´/g,'&acute;'); // 180 B4
texte = texte.replace(/µ/g,'&micro;'); // 181 B5
texte = texte.replace(/¶/g,'&para'); // 182 B6
texte = texte.replace(/·/g,'&middot;'); // 183 B7
texte = texte.replace(/¸/g,'&cedil;'); // 184 B8
texte = texte.replace(/¹/g,'&sup1;'); // 185 B9
texte = texte.replace(/º/g,'&ordm;'); // 186 BA
texte = texte.replace(/»/g,'&raquo;'); // 187 BB
texte = texte.replace(/¼/g,'&frac14;'); // 188 BC
texte = texte.replace(/½/g,'&frac12;'); // 189 BD
texte = texte.replace(/¾/g,'&frac34;'); // 190 BE
texte = texte.replace(/¿/g,'&iquest;'); // 191 BF
texte = texte.replace(/À/g,'&Agrave;'); // 192 C0
texte = texte.replace(/Á/g,'&Aacute;'); // 193 C1
texte = texte.replace(/Â/g,'&Acirc;'); // 194 C2
texte = texte.replace(/Ã/g,'&Atilde;'); // 195 C3
texte = texte.replace(/Ä/g,'&Auml;'); // 196 C4
texte = texte.replace(/Å/g,'&Aring;'); // 197 C5
texte = texte.replace(/Æ/g,'&AElig;'); // 198 C6
texte = texte.replace(/Ç/g,'&Ccedil;'); // 199 C7
texte = texte.replace(/È/g,'&Egrave;'); // 200 C8
texte = texte.replace(/É/g,'&Eacute;'); // 201 C9
texte = texte.replace(/Ê/g,'&Ecirc;'); // 202 CA
texte = texte.replace(/Ë/g,'&Euml;'); // 203 CB
texte = texte.replace(/Ì/g,'&Igrave;'); // 204 CC
texte = texte.replace(/Í/g,'&Iacute;'); // 205 CD
texte = texte.replace(/Î/g,'&Icirc;'); // 206 CE
texte = texte.replace(/Ï/g,'&Iuml;'); // 207 CF
texte = texte.replace(/Ð/g,'&ETH;'); // 208 D0
texte = texte.replace(/Ñ/g,'&Ntilde;'); // 209 D1
texte = texte.replace(/Ò/g,'&Ograve;'); // 210 D2
texte = texte.replace(/Ó/g,'&Oacute;'); // 211 D3
texte = texte.replace(/Ô/g,'&Ocirc;'); // 212 D4
texte = texte.replace(/Õ/g,'&Otilde;'); // 213 D5
texte = texte.replace(/Ö/g,'&Ouml;'); // 214 D6
texte = texte.replace(/×/g,'&times;'); // 215 D7
texte = texte.replace(/Ø/g,'&Oslash;'); // 216 D8
texte = texte.replace(/Ù/g,'&Ugrave;'); // 217 D9
texte = texte.replace(/Ú/g,'&Uacute;'); // 218 DA
texte = texte.replace(/Û/g,'&Ucirc;'); // 219 DB
texte = texte.replace(/Ü/g,'&Uuml;'); // 220 DC
texte = texte.replace(/Ý/g,'&Yacute;'); // 221 DD
texte = texte.replace(/Þ/g,'&THORN;'); // 222 DE
texte = texte.replace(/ß/g,'&szlig;'); // 223 DF
texte = texte.replace(/à/g,'&aacute;'); // 224 E0
texte = texte.replace(/á/g,'&aacute;'); // 225 E1
texte = texte.replace(/â/g,'&acirc;'); // 226 E2
texte = texte.replace(/ã/g,'&atilde;'); // 227 E3
texte = texte.replace(/ä/g,'&auml;'); // 228 E4
texte = texte.replace(/å/g,'&aring;'); // 229 E5
texte = texte.replace(/æ/g,'&aelig;'); // 230 E6
texte = texte.replace(/ç/g,'&ccedil;'); // 231 E7
texte = texte.replace(/è/g,'&egrave;'); // 232 E8
texte = texte.replace(/é/g,'&eacute;'); // 233 E9
texte = texte.replace(/ê/g,'&ecirc;'); // 234 EA
texte = texte.replace(/ë/g,'&euml;'); // 235 EB
texte = texte.replace(/ì/g,'&igrave;'); // 236 EC
texte = texte.replace(/í/g,'&iacute;'); // 237 ED
texte = texte.replace(/î/g,'&icirc;'); // 238 EE
texte = texte.replace(/ï/g,'&iuml;'); // 239 EF
texte = texte.replace(/ð/g,'&eth;'); // 240 F0
texte = texte.replace(/ñ/g,'&ntilde;'); // 241 F1
texte = texte.replace(/ò/g,'&ograve;'); // 242 F2
texte = texte.replace(/ó/g,'&oacute;'); // 243 F3
texte = texte.replace(/ô/g,'&ocirc;'); // 244 F4
texte = texte.replace(/õ/g,'&otilde;'); // 245 F5
texte = texte.replace(/ö/g,'&ouml;'); // 246 F6
texte = texte.replace(/÷/g,'&divide;'); // 247 F7
texte = texte.replace(/ø/g,'&oslash;'); // 248 F8
texte = texte.replace(/ù/g,'&ugrave;'); // 249 F9
texte = texte.replace(/ú/g,'&uacute;'); // 250 FA
texte = texte.replace(/û/g,'&ucirc;'); // 251 FB
texte = texte.replace(/ü/g,'&uuml;'); // 252 FC
texte = texte.replace(/ý/g,'&yacute;'); // 253 FD
texte = texte.replace(/þ/g,'&thorn;'); // 254 FE
texte = texte.replace(/ÿ/g,'&yuml;'); // 255 FF
return texte;
}
			
66 - Attacher une fonction à un événement
/*
addEvent — cette fonction écrite par John Resig , à l’origine de jQuery , a gagné le concours addEvent() recoding contest . Elle permet tout simplement d’attacher une fonction à un événement (onload, onclick, onmouseover, etc) :*/

function addEvent( obj, type, fn ) {
    if ( obj.attachEvent ) {
        obj['e'+type+fn] = fn;
        obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
        obj.attachEvent( 'on'+type, obj[type+fn] );
    } else
        obj.addEventListener( type, fn, false );
}

//En prime, voici la fonction inverse, au cas où :

function removeEvent( obj, type, fn ) {
    if ( obj.detachEvent ) {
        obj.detachEvent( 'on'+type, obj[type+fn] );
        obj[type+fn] = null;
    } else
        obj.removeEventListener( type, fn, false );
}

/*Quelques exemples d’utilisation :

addEvent( document.getElementById('foo'), 'click', doSomething );
addEvent( obj, 'mouseover', function(){ alert('hello!'); } );
addEvent( window, 'load', maFonction );

Le dernier exemple est idéal pour lancer une fonction au chargement de la page sans intrusion dans le code HTML !*/
			
67 - Forcer les balises HTML5 sous IE
<!--[if IE]><script> document.createElement("article");document.createElement("aside");document.createElement("section");document.createElement("footer");</script> <![endif]-->

			
68 - Fonction addevent()
/*
addEvent — cette fonction écrite par John Resig , à l’origine de jQuery , a gagné le concours addEvent() recoding contest . Elle permet tout simplement d’attacher une fonction à un événement (onload, onclick, onmouseover, etc) :*/

function addEvent( obj, type, fn ) {
    if ( obj.attachEvent ) {
        obj['e'+type+fn] = fn;
        obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
        obj.attachEvent( 'on'+type, obj[type+fn] );
    } else
        obj.addEventListener( type, fn, false );
}

//En prime, voici la fonction inverse, au cas où :

function removeEvent( obj, type, fn ) {
    if ( obj.detachEvent ) {
        obj.detachEvent( 'on'+type, obj[type+fn] );
        obj[type+fn] = null;
    } else
        obj.removeEventListener( type, fn, false );
}

/*Quelques exemples d’utilisation :

addEvent( document.getElementById('foo'), 'click', doSomething );
addEvent( obj, 'mouseover', function(){ alert('hello!'); } );
addEvent( window, 'load', maFonction );

Le dernier exemple est idéal pour lancer une fonction au chargement de la page sans intrusion dans le code HTML !*/
			
69 - Mettre le focus sur un élément au chargement de la page
body onload="document.getElementById('nom').focus()">
  <label for="nom">Nom : </label>
  <input type="text" name="nom" id="nom" />
</body>
			
70 - Lightbox CSS
CSS DE LA LIGHTBOX
.black_overlay{
  display: none;
  position: absolute;
  top: 0%;
  left: 0%;
  width: 100%;
  height: 100%;
  background-color: black;
  z-index:1001;
  -moz-opacity: 0.8;
  opacity:.80;
  filter: alpha(opacity=80);
}
 
.white_content {
  display: none;
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  padding: 16px;
  border: 16px solid orange;
  background-color: white;
  z-index:1002;
  overflow: auto;
}



CONTENU DE LA LIGHTBOX
<div id="light" class="white_content">Hi, I am an happy lightbox</div><div id="fade" class="black_overlay"></div>

APPEL DE LA LIGHTBOX
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">Click me</a>

LIEN POUR FERMER LA LIGHTBOX
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Hide me</a>