+
\ No newline at end of file
diff --git a/resources/library/interactivities/ord-words.wgt/locales/fr/index.html b/resources/library/interactivities/ord-words.wgt/locales/fr/index.html
new file mode 100644
index 00000000..41c44bda
--- /dev/null
+++ b/resources/library/interactivities/ord-words.wgt/locales/fr/index.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Template
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/library/interactivities/ord-words.wgt/locales/fr/scripts/template2.js b/resources/library/interactivities/ord-words.wgt/locales/fr/scripts/template2.js
new file mode 100644
index 00000000..320953b2
--- /dev/null
+++ b/resources/library/interactivities/ord-words.wgt/locales/fr/scripts/template2.js
@@ -0,0 +1,274 @@
+
+/*
+ Sankore API
+*/
+
+function startEditing()
+{
+ modeEdit();
+}
+
+function stopEditing()
+{
+ modeView();
+}
+
+function initialize()
+{
+
+}
+
+function checkResponse()
+{
+ checkWord();
+}
+/*
+ / END sankore api
+*/
+
+var sankoreLang = {
+ view: "D'affichage",
+ edit: "Modifier",
+ example: "une*longue*,*il*ya*bien*longtemps*..."
+};
+
+var word = "";
+var curWord = "";
+
+if(window.sankore){
+ word = (sankore.preference("rightOrdWords", ""))?sankore.preference("rightOrdWords", ""):sankoreLang.example;
+ curWord = (sankore.preference("currentOrdWords", ""))?sankore.preference("currentOrdWords", ""):"";
+} else {
+ word = sankoreLang.example;
+}
+
+var doCheckWord = true;
+
+// array of dom elements
+var letters = [];
+
+var editMode = false; // just a flag
+
+// if use the "edit" button or rely on the api instead
+var isSankore = false;
+// whether to do window.resize or not (window = widget area)
+var isBrowser = ( typeof( widget ) == "undefined" );
+
+// hardcoded parameters, not very good
+var input_width = 606;
+var widget_padding = 65;
+var min_view_width = 400;
+
+/*
+=================
+createWordLetters
+=================
+returns array of dom elements
+*/
+function createWordLetters( word )
+{
+ var ch, el;
+ var letters = [];
+
+ if( word.indexOf( '*' ) != -1 )
+ {
+ var tmp = word.split( '*' );
+ for( i in tmp )
+ {
+ ch = tmp[i];
+ el = document.createElement( "div" );
+ $(el).addClass( "letter" ).text( ch );
+ letters.push( el );
+ }
+ }
+ else
+ {
+ for( var i = 0; i < word.length; i++ )
+ {
+ ch = word.charAt( i );
+ el = document.createElement( "div" );
+ $(el).addClass( "letter" ).text( ch );
+ letters.push( el );
+ }
+ }
+ return letters;
+}
+
+
+/*
+=====================
+checkWord
+=====================
+scans the letters and checks
+if they are in the right order
+*/
+function checkWord()
+{
+ if( !doCheckWord )
+ return;
+
+ var str = "";
+ $( "#mp_word .letter" ).each( function(){
+ str += $(this).text();
+ });
+ var w = word;
+ while( w.indexOf( '*' ) != -1 )
+ {
+ w = w.replace( '*', '' );
+ }
+ if( str == w ){
+ $( "#mp_word .letter" ).addClass( "right" );
+ //message( "Right!" );
+ }
+}
+
+/*
+==============
+shuffle
+==============
+shuffles an array
+*/
+function shuffle( arr )
+{
+ var pos, tmp;
+
+ for( var i = 0; i < arr.length; i++ )
+ {
+ pos = Math.round( Math.random() * ( arr.length - 1 ) );
+ tmp = arr[pos];
+ arr[pos] = arr[i];
+ arr[i] = tmp;
+ }
+ return arr;
+}
+
+
+
+/*
+==================
+modeView()
+==================
+turns the widget into the view mode
+*/
+function modeView()
+{
+ if( editMode ){
+ word = $( "#mp_word input:text" ).attr( "value" );
+ }
+
+ // if no sankore api, insert edit button
+ if( !isSankore ){
+ $( "#mp_setup" ).empty().append( '' );
+ $( "#mp_setup input:button" ).click( function(){
+ modeEdit();
+ });
+ }
+
+ // clean the previous word
+ $( "#mp_word" ).empty();
+
+ // create new set of letters
+ var letters;
+ if(window.sankore && curWord && !editMode)
+ letters = createWordLetters( curWord );
+ else
+ letters = shuffle( createWordLetters( word ) );
+
+ for( i in letters ){
+ $("#mp_word").append( letters[i] );
+ }
+
+ // in sankore api there would be a function to check
+ // the answer, so no update parameter would be needed
+ if( !isSankore ){
+ $( "#mp_word" ).sortable( {
+ update: checkWord
+ } );
+ } else $( "#mp_word" ).sortable();
+
+ // adjustWidth
+ var totalLettersWidth = 0;
+ for( i in letters ){
+ var currentWidth = $( letters[i] ).outerWidth( true );
+ totalLettersWidth += currentWidth;
+ }
+ totalLettersWidth += 1;
+
+ var width = Math.max(
+ totalLettersWidth,
+ min_view_width
+ );
+
+ // shift the words to the right to center them
+ if( width > totalLettersWidth ){
+ $( "#mp_word" ).css( "margin-left", Math.round( (width - totalLettersWidth)/2 ) );
+ }
+ else{
+ $( "#mp_word" ).css( "margin-left", 0 );
+ }
+
+ // apply new width
+ adjustWidth( width );
+
+}
+
+/*
+============
+adjustWidth
+============
+*/
+function adjustWidth( width )
+{
+ $( "#ub-widget" ).animate( {
+ width: width
+ } );
+ // if viewed as a widget, resize the window
+ if( !isBrowser ){
+ window.resizeTo( width + widget_padding, widget.height );
+ }
+}
+
+/*
+================
+modeEdit
+================
+*/
+function modeEdit()
+{
+ editMode = true;
+ // if no sankore api, insert ok button
+ if( !isSankore )
+ {
+ $( "#mp_setup" ).empty().append( '' );
+ $( "#mp_setup input:button" ).click( function(){
+ modeView();
+ });
+ }
+ $( "#mp_word").css( "margin-left", 0 ).empty().append('');
+ adjustWidth( input_width );
+}
+
+if (window.widget) {
+ window.widget.onleave = function(){
+ if($( "#mp_word input:text" ).attr( "value" ))
+ {
+ modeView();
+ var str = "";
+ $( "#mp_word .letter" ).each( function(){
+ str += $(this).text() + "*";
+ });
+ str = str.substr(0, str.length - 1);
+ sankore.setPreference("currentOrdWords", str);
+ modeEdit();
+ }
+ else{
+ str = "";
+ $( "#mp_word .letter" ).each( function(){
+ str += $(this).text() + "*";
+ });
+ str = str.substr(0, str.length - 1);
+ sankore.setPreference("currentOrdWords", str);
+ }
+ sankore.setPreference("rightOrdWords", word);
+ }
+}
\ No newline at end of file
diff --git a/resources/library/interactivities/ord-words.wgt/locales/ru/index.html b/resources/library/interactivities/ord-words.wgt/locales/ru/index.html
new file mode 100644
index 00000000..41c44bda
--- /dev/null
+++ b/resources/library/interactivities/ord-words.wgt/locales/ru/index.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Template
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/library/interactivities/ord-words.wgt/locales/ru/scripts/template2.js b/resources/library/interactivities/ord-words.wgt/locales/ru/scripts/template2.js
new file mode 100644
index 00000000..902bc569
--- /dev/null
+++ b/resources/library/interactivities/ord-words.wgt/locales/ru/scripts/template2.js
@@ -0,0 +1,274 @@
+
+/*
+ Sankore API
+*/
+
+function startEditing()
+{
+ modeEdit();
+}
+
+function stopEditing()
+{
+ modeView();
+}
+
+function initialize()
+{
+
+}
+
+function checkResponse()
+{
+ checkWord();
+}
+/*
+ / END sankore api
+*/
+
+var sankoreLang = {
+ view: "Показать",
+ edit: "Изменить",
+ example: "много*,*много*лет*назад*..."
+};
+
+var word = "";
+var curWord = "";
+
+if(window.sankore){
+ word = (sankore.preference("rightOrdWords", ""))?sankore.preference("rightOrdWords", ""):sankoreLang.example;
+ curWord = (sankore.preference("currentOrdWords", ""))?sankore.preference("currentOrdWords", ""):"";
+} else {
+ word = sankoreLang.example;
+}
+
+var doCheckWord = true;
+
+// array of dom elements
+var letters = [];
+
+var editMode = false; // just a flag
+
+// if use the "edit" button or rely on the api instead
+var isSankore = false;
+// whether to do window.resize or not (window = widget area)
+var isBrowser = ( typeof( widget ) == "undefined" );
+
+// hardcoded parameters, not very good
+var input_width = 606;
+var widget_padding = 65;
+var min_view_width = 400;
+
+/*
+=================
+createWordLetters
+=================
+returns array of dom elements
+*/
+function createWordLetters( word )
+{
+ var ch, el;
+ var letters = [];
+
+ if( word.indexOf( '*' ) != -1 )
+ {
+ var tmp = word.split( '*' );
+ for( i in tmp )
+ {
+ ch = tmp[i];
+ el = document.createElement( "div" );
+ $(el).addClass( "letter" ).text( ch );
+ letters.push( el );
+ }
+ }
+ else
+ {
+ for( var i = 0; i < word.length; i++ )
+ {
+ ch = word.charAt( i );
+ el = document.createElement( "div" );
+ $(el).addClass( "letter" ).text( ch );
+ letters.push( el );
+ }
+ }
+ return letters;
+}
+
+
+/*
+=====================
+checkWord
+=====================
+scans the letters and checks
+if they are in the right order
+*/
+function checkWord()
+{
+ if( !doCheckWord )
+ return;
+
+ var str = "";
+ $( "#mp_word .letter" ).each( function(){
+ str += $(this).text();
+ });
+ var w = word;
+ while( w.indexOf( '*' ) != -1 )
+ {
+ w = w.replace( '*', '' );
+ }
+ if( str == w ){
+ $( "#mp_word .letter" ).addClass( "right" );
+ //message( "Right!" );
+ }
+}
+
+/*
+==============
+shuffle
+==============
+shuffles an array
+*/
+function shuffle( arr )
+{
+ var pos, tmp;
+
+ for( var i = 0; i < arr.length; i++ )
+ {
+ pos = Math.round( Math.random() * ( arr.length - 1 ) );
+ tmp = arr[pos];
+ arr[pos] = arr[i];
+ arr[i] = tmp;
+ }
+ return arr;
+}
+
+
+
+/*
+==================
+modeView()
+==================
+turns the widget into the view mode
+*/
+function modeView()
+{
+ if( editMode ){
+ word = $( "#mp_word input:text" ).attr( "value" );
+ }
+
+ // if no sankore api, insert edit button
+ if( !isSankore ){
+ $( "#mp_setup" ).empty().append( '' );
+ $( "#mp_setup input:button" ).click( function(){
+ modeEdit();
+ });
+ }
+
+ // clean the previous word
+ $( "#mp_word" ).empty();
+
+ // create new set of letters
+ var letters;
+ if(window.sankore && curWord && !editMode)
+ letters = createWordLetters( curWord );
+ else
+ letters = shuffle( createWordLetters( word ) );
+
+ for( i in letters ){
+ $("#mp_word").append( letters[i] );
+ }
+
+ // in sankore api there would be a function to check
+ // the answer, so no update parameter would be needed
+ if( !isSankore ){
+ $( "#mp_word" ).sortable( {
+ update: checkWord
+ } );
+ } else $( "#mp_word" ).sortable();
+
+ // adjustWidth
+ var totalLettersWidth = 0;
+ for( i in letters ){
+ var currentWidth = $( letters[i] ).outerWidth( true );
+ totalLettersWidth += currentWidth;
+ }
+ totalLettersWidth += 1;
+
+ var width = Math.max(
+ totalLettersWidth,
+ min_view_width
+ );
+
+ // shift the words to the right to center them
+ if( width > totalLettersWidth ){
+ $( "#mp_word" ).css( "margin-left", Math.round( (width - totalLettersWidth)/2 ) );
+ }
+ else{
+ $( "#mp_word" ).css( "margin-left", 0 );
+ }
+
+ // apply new width
+ adjustWidth( width );
+
+}
+
+/*
+============
+adjustWidth
+============
+*/
+function adjustWidth( width )
+{
+ $( "#ub-widget" ).animate( {
+ width: width
+ } );
+ // if viewed as a widget, resize the window
+ if( !isBrowser ){
+ window.resizeTo( width + widget_padding, widget.height );
+ }
+}
+
+/*
+================
+modeEdit
+================
+*/
+function modeEdit()
+{
+ editMode = true;
+ // if no sankore api, insert ok button
+ if( !isSankore )
+ {
+ $( "#mp_setup" ).empty().append( '' );
+ $( "#mp_setup input:button" ).click( function(){
+ modeView();
+ });
+ }
+ $( "#mp_word").css( "margin-left", 0 ).empty().append('');
+ adjustWidth( input_width );
+}
+
+if (window.widget) {
+ window.widget.onleave = function(){
+ if($( "#mp_word input:text" ).attr( "value" ))
+ {
+ modeView();
+ var str = "";
+ $( "#mp_word .letter" ).each( function(){
+ str += $(this).text() + "*";
+ });
+ str = str.substr(0, str.length - 1);
+ sankore.setPreference("currentOrdWords", str);
+ modeEdit();
+ }
+ else{
+ str = "";
+ $( "#mp_word .letter" ).each( function(){
+ str += $(this).text() + "*";
+ });
+ str = str.substr(0, str.length - 1);
+ sankore.setPreference("currentOrdWords", str);
+ }
+ sankore.setPreference("rightOrdWords", word);
+ }
+}
\ No newline at end of file
diff --git a/resources/library/interactivities/ord-words.wgt/scripts/jquery-1.6.2.min.js b/resources/library/interactivities/ord-words.wgt/scripts/jquery-1.6.2.min.js
new file mode 100644
index 00000000..48590ecb
--- /dev/null
+++ b/resources/library/interactivities/ord-words.wgt/scripts/jquery-1.6.2.min.js
@@ -0,0 +1,18 @@
+/*!
+ * jQuery JavaScript Library v1.6.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Jun 30 14:16:56 2011 -0400
+ */
+(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"":"")+""),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="