

/*!
 * Globalize
 *
 * http://github.com/jquery/globalize
 *
 * Copyright Software Freedom Conservancy, Inc.
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 */

(function( window, undefined ) {

var Globalize,
	// private variables
	regexHex,
	regexInfinity,
	regexParseFloat,
	regexTrim,
	// private JavaScript utility functions
	arrayIndexOf,
	endsWith,
	extend,
	isArray,
	isFunction,
	isObject,
	startsWith,
	trim,
	truncate,
	zeroPad,
	// private Globalization utility functions
	appendPreOrPostMatch,
	expandFormat,
	formatDate,
	formatNumber,
	getTokenRegExp,
	getEra,
	getEraYear,
	parseExact,
	parseNegativePattern;

// Global variable (Globalize) or CommonJS module (globalize)
Globalize = function( cultureSelector ) {
	return new Globalize.prototype.init( cultureSelector );
};

if ( typeof require !== "undefined" &&
	typeof exports !== "undefined" &&
	typeof module !== "undefined" ) {
	// Assume CommonJS
	module.exports = Globalize;
} else {
	// Export as global variable
	window.Globalize = Globalize;
}

Globalize.cultures = {};

Globalize.prototype = {
	constructor: Globalize,
	init: function( cultureSelector ) {
		this.cultures = Globalize.cultures;
		this.cultureSelector = cultureSelector;

		return this;
	}
};
Globalize.prototype.init.prototype = Globalize.prototype;

// 1. When defining a culture, all fields are required except the ones stated as optional.
// 2. Each culture should have a ".calendars" object with at least one calendar named "standard"
//    which serves as the default calendar in use by that culture.
// 3. Each culture should have a ".calendar" object which is the current calendar being used,
//    it may be dynamically changed at any time to one of the calendars in ".calendars".
Globalize.cultures[ "default" ] = {
	// A unique name for the culture in the form <language code>-<country/region code>
	name: "en",
	// the name of the culture in the english language
	englishName: "English",
	// the name of the culture in its own language
	nativeName: "English",
	// whether the culture uses right-to-left text
	isRTL: false,
	// "language" is used for so-called "specific" cultures.
	// For example, the culture "es-CL" means "Spanish, in Chili".
	// It represents the Spanish-speaking culture as it is in Chili,
	// which might have different formatting rules or even translations
	// than Spanish in Spain. A "neutral" culture is one that is not
	// specific to a region. For example, the culture "es" is the generic
	// Spanish culture, which may be a more generalized version of the language
	// that may or may not be what a specific culture expects.
	// For a specific culture like "es-CL", the "language" field refers to the
	// neutral, generic culture information for the language it is using.
	// This is not always a simple matter of the string before the dash.
	// For example, the "zh-Hans" culture is netural (Simplified Chinese).
	// And the "zh-SG" culture is Simplified Chinese in Singapore, whose lanugage
	// field is "zh-CHS", not "zh".
	// This field should be used to navigate from a specific culture to it's
	// more general, neutral culture. If a culture is already as general as it
	// can get, the language may refer to itself.
	language: "en",
	// numberFormat defines general number formatting rules, like the digits in
	// each grouping, the group separator, and how negative numbers are displayed.
	numberFormat: {
		// [negativePattern]
		// Note, numberFormat.pattern has no "positivePattern" unlike percent and currency,
		// but is still defined as an array for consistency with them.
		//   negativePattern: one of "(n)|-n|- n|n-|n -"
		pattern: [ "-n" ],
		// number of decimal places normally shown
		decimals: 2,
		// string that separates number groups, as in 1,000,000
		",": ",",
		// string that separates a number from the fractional portion, as in 1.99
		".": ".",
		// array of numbers indicating the size of each number group.
		// TODO: more detailed description and example
		groupSizes: [ 3 ],
		// symbol used for positive numbers
		"+": "+",
		// symbol used for negative numbers
		"-": "-",
		// symbol used for NaN (Not-A-Number)
		"NaN": "NaN",
		// symbol used for Negative Infinity
		negativeInfinity: "-Infinity",
		// symbol used for Positive Infinity
		positiveInfinity: "Infinity",
		percent: {
			// [negativePattern, positivePattern]
			//   negativePattern: one of "-n %|-n%|-%n|%-n|%n-|n-%|n%-|-% n|n %-|% n-|% -n|n- %"
			//   positivePattern: one of "n %|n%|%n|% n"
			pattern: [ "-n %", "n %" ],
			// number of decimal places normally shown
			decimals: 2,
			// array of numbers indicating the size of each number group.
			// TODO: more detailed description and example
			groupSizes: [ 3 ],
			// string that separates number groups, as in 1,000,000
			",": ",",
			// string that separates a number from the fractional portion, as in 1.99
			".": ".",
			// symbol used to represent a percentage
			symbol: "%"
		},
		currency: {
			// [negativePattern, positivePattern]
			//   negativePattern: one of "($n)|-$n|$-n|$n-|(n$)|-n$|n-$|n$-|-n $|-$ n|n $-|$ n-|$ -n|n- $|($ n)|(n $)"
			//   positivePattern: one of "$n|n$|$ n|n $"
			pattern: [ "($n)", "$n" ],
			// number of decimal places normally shown
			decimals: 2,
			// array of numbers indicating the size of each number group.
			// TODO: more detailed description and example
			groupSizes: [ 3 ],
			// string that separates number groups, as in 1,000,000
			",": ",",
			// string that separates a number from the fractional portion, as in 1.99
			".": ".",
			// symbol used to represent currency
			symbol: "$"
		}
	},
	// calendars defines all the possible calendars used by this culture.
	// There should be at least one defined with name "standard", and is the default
	// calendar used by the culture.
	// A calendar contains information about how dates are formatted, information about
	// the calendar's eras, a standard set of the date formats,
	// translations for day and month names, and if the calendar is not based on the Gregorian
	// calendar, conversion functions to and from the Gregorian calendar.
	calendars: {
		standard: {
			// name that identifies the type of calendar this is
			name: "Gregorian_USEnglish",
			// separator of parts of a date (e.g. "/" in 11/05/1955)
			"/": "/",
			// separator of parts of a time (e.g. ":" in 05:44 PM)
			":": ":",
			// the first day of the week (0 = Sunday, 1 = Monday, etc)
			firstDay: 0,
			days: {
				// full day names
				names: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
				// abbreviated day names
				namesAbbr: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ],
				// shortest day names
				namesShort: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ]
			},
			months: {
				// full month names (13 months for lunar calendards -- 13th month should be "" if not lunar)
				names: [ "Januari", "Februari", "Maret", "April", "May", "June", "July", "August", "September", "October", "November", "December", "" ],
				// abbreviated month names
				namesAbbr: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "" ]
			},
			// AM and PM designators in one of these forms:
			// The usual view, and the upper and lower case versions
			//   [ standard, lowercase, uppercase ]
			// The culture does not use AM or PM (likely all standard date formats use 24 hour time)
			//   null
			AM: [ "AM", "am", "AM" ],
			PM: [ "PM", "pm", "PM" ],
			eras: [
				// eras in reverse chronological order.
				// name: the name of the era in this culture (e.g. A.D., C.E.)
				// start: when the era starts in ticks (gregorian, gmt), null if it is the earliest supported era.
				// offset: offset in years from gregorian calendar
				{
					"name": "A.D.",
					"start": null,
					"offset": 0
				}
			],
			// when a two digit year is given, it will never be parsed as a four digit
			// year greater than this year (in the appropriate era for the culture)
			// Set it as a full year (e.g. 2029) or use an offset format starting from
			// the current year: "+19" would correspond to 2029 if the current year 2010.
			twoDigitYearMax: 2029,
			// set of predefined date and time patterns used by the culture
			// these represent the format someone in this culture would expect
			// to see given the portions of the date that are shown.
			patterns: {
				// short date pattern
				d: "M/d/yyyy",
				// long date pattern
				D: "dddd, MMMM dd, yyyy",
				// short time pattern
				t: "h:mm tt",
				// long time pattern
				T: "h:mm:ss tt",
				// long date, short time pattern
				f: "dddd, MMMM dd, yyyy h:mm tt",
				// long date, long time pattern
				F: "dddd, MMMM dd, yyyy h:mm:ss tt",
				// month/day pattern
				M: "MMMM dd",
				// month/year pattern
				Y: "yyyy MMMM",
				// S is a sortable format that does not vary by culture
				S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss"
			}
			// optional fields for each calendar:
			/*
			monthsGenitive:
				Same as months but used when the day preceeds the month.
				Omit if the culture has no genitive distinction in month names.
				For an explaination of genitive months, see http://blogs.msdn.com/michkap/archive/2004/12/25/332259.aspx
			convert:
				Allows for the support of non-gregorian based calendars. This convert object is used to
				to convert a date to and from a gregorian calendar date to handle parsing and formatting.
				The two functions:
					fromGregorian( date )
						Given the date as a parameter, return an array with parts [ year, month, day ]
						corresponding to the non-gregorian based year, month, and day for the calendar.
					toGregorian( year, month, day )
						Given the non-gregorian year, month, and day, return a new Date() object
						set to the corresponding date in the gregorian calendar.
			*/
		}
	},
	// For localized strings
	messages: {}
};

Globalize.cultures[ "default" ].calendar = Globalize.cultures[ "default" ].calendars.standard;

Globalize.cultures.en = Globalize.cultures[ "default" ];

Globalize.cultureSelector = "en";

//
// private variables
//

regexHex = /^0x[a-f0-9]+$/i;
regexInfinity = /^[+\-]?infinity$/i;
regexParseFloat = /^[+\-]?\d*\.?\d*(e[+\-]?\d+)?$/;
regexTrim = /^\s+|\s+$/g;

//
// private JavaScript utility functions
//

arrayIndexOf = function( array, item ) {
	if ( array.indexOf ) {
		return array.indexOf( item );
	}
	for ( var i = 0, length = array.length; i < length; i++ ) {
		if ( array[i] === item ) {
			return i;
		}
	}
	return -1;
};

endsWith = function( value, pattern ) {
	return value.substr( value.length - pattern.length ) === pattern;
};

extend = function() {
	var options, name, src, copy, copyIsArray, clone,
		target = arguments[0] || {},
		i = 1,
		length = arguments.length,
		deep = false;

	// Handle a deep copy situation
	if ( typeof target === "boolean" ) {
		deep = target;
		target = arguments[1] || {};
		// skip the boolean and the target
		i = 2;
	}

	// Handle case when target is a string or something (possible in deep copy)
	if ( typeof target !== "object" && !isFunction(target) ) {
		target = {};
	}

	for ( ; i < length; i++ ) {
		// Only deal with non-null/undefined values
		if ( (options = arguments[ i ]) != null ) {
			// Extend the base object
			for ( name in options ) {
				src = target[ name ];
				copy = options[ name ];

				// Prevent never-ending loop
				if ( target === copy ) {
					continue;
				}

				// Recurse if we're merging plain objects or arrays
				if ( deep && copy && ( isObject(copy) || (copyIsArray = isArray(copy)) ) ) {
					if ( copyIsArray ) {
						copyIsArray = false;
						clone = src && isArray(src) ? src : [];

					} else {
						clone = src && isObject(src) ? src : {};
					}

					// Never move original objects, clone them
					target[ name ] = extend( deep, clone, copy );

				// Don't bring in undefined values
				} else if ( copy !== undefined ) {
					target[ name ] = copy;
				}
			}
		}
	}

	// Return the modified object
	return target;
};

isArray = Array.isArray || function( obj ) {
	return Object.prototype.toString.call( obj ) === "[object Array]";
};

isFunction = function( obj ) {
	return Object.prototype.toString.call( obj ) === "[object Function]";
};

isObject = function( obj ) {
	return Object.prototype.toString.call( obj ) === "[object Object]";
};

startsWith = function( value, pattern ) {
	return value.indexOf( pattern ) === 0;
};

trim = function( value ) {
	return ( value + "" ).replace( regexTrim, "" );
};

truncate = function( value ) {
	if ( isNaN( value ) ) {
		return NaN;
	}
	return Math[ value < 0 ? "ceil" : "floor" ]( value );
};

zeroPad = function( str, count, left ) {
	var l;
	for ( l = str.length; l < count; l += 1 ) {
		str = ( left ? ("0" + str) : (str + "0") );
	}
	return str;
};

//
// private Globalization utility functions
//

appendPreOrPostMatch = function( preMatch, strings ) {
	// appends pre- and post- token match strings while removing escaped characters.
	// Returns a single quote count which is used to determine if the token occurs
	// in a string literal.
	var quoteCount = 0,
		escaped = false;
	for ( var i = 0, il = preMatch.length; i < il; i++ ) {
		var c = preMatch.charAt( i );
		switch ( c ) {
			case "\'":
				if ( escaped ) {
					strings.push( "\'" );
				}
				else {
					quoteCount++;
				}
				escaped = false;
				break;
			case "\\":
				if ( escaped ) {
					strings.push( "\\" );
				}
				escaped = !escaped;
				break;
			default:
				strings.push( c );
				escaped = false;
				break;
		}
	}
	return quoteCount;
};

expandFormat = function( cal, format ) {
	// expands unspecified or single character date formats into the full pattern.
	format = format || "F";
	var pattern,
		patterns = cal.patterns,
		len = format.length;
	if ( len === 1 ) {
		pattern = patterns[ format ];
		if ( !pattern ) {
			throw "Invalid date format string \'" + format + "\'.";
		}
		format = pattern;
	}
	else if ( len === 2 && format.charAt(0) === "%" ) {
		// %X escape format -- intended as a custom format string that is only one character, not a built-in format.
		format = format.charAt( 1 );
	}
	return format;
};

formatDate = function( value, format, culture ) {
	var cal = culture.calendar,
		convert = cal.convert,
		ret;

	if ( !format || !format.length || format === "i" ) {
		if ( culture && culture.name.length ) {
			if ( convert ) {
				// non-gregorian calendar, so we cannot use built-in toLocaleString()
				ret = formatDate( value, cal.patterns.F, culture );
			}
			else {
				var eraDate = new Date( value.getTime() ),
					era = getEra( value, cal.eras );
				eraDate.setFullYear( getEraYear(value, cal, era) );
				ret = eraDate.toLocaleString();
			}
		}
		else {
			ret = value.toString();
		}
		return ret;
	}

	var eras = cal.eras,
		sortable = format === "s";
	format = expandFormat( cal, format );

	// Start with an empty string
	ret = [];
	var hour,
		zeros = [ "0", "00", "000" ],
		foundDay,
		checkedDay,
		dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g,
		quoteCount = 0,
		tokenRegExp = getTokenRegExp(),
		converted;

	function padZeros( num, c ) {
		var r, s = num + "";
		if ( c > 1 && s.length < c ) {
			r = ( zeros[c - 2] + s);
			return r.substr( r.length - c, c );
		}
		else {
			r = s;
		}
		return r;
	}

	function hasDay() {
		if ( foundDay || checkedDay ) {
			return foundDay;
		}
		foundDay = dayPartRegExp.test( format );
		checkedDay = true;
		return foundDay;
	}

	function getPart( date, part ) {
		if ( converted ) {
			return converted[ part ];
		}
		switch ( part ) {
			case 0:
				return date.getFullYear();
			case 1:
				return date.getMonth();
			case 2:
				return date.getDate();
			default:
				throw "Invalid part value " + part;
		}
	}

	if ( !sortable && convert ) {
		converted = convert.fromGregorian( value );
	}

	for ( ; ; ) {
		// Save the current index
		var index = tokenRegExp.lastIndex,
			// Look for the next pattern
			ar = tokenRegExp.exec( format );

		// Append the text before the pattern (or the end of the string if not found)
		var preMatch = format.slice( index, ar ? ar.index : format.length );
		quoteCount += appendPreOrPostMatch( preMatch, ret );

		if ( !ar ) {
			break;
		}

		// do not replace any matches that occur inside a string literal.
		if ( quoteCount % 2 ) {
			ret.push( ar[0] );
			continue;
		}

		var current = ar[ 0 ],
			clength = current.length;

		switch ( current ) {
			case "ddd":
				//Day of the week, as a three-letter abbreviation
			case "dddd":
				// Day of the week, using the full name
				var names = ( clength === 3 ) ? cal.days.namesAbbr : cal.days.names;
				ret.push( names[value.getDay()] );
				break;
			case "d":
				// Day of month, without leading zero for single-digit days
			case "dd":
				// Day of month, with leading zero for single-digit days
				foundDay = true;
				ret.push(
					padZeros( getPart(value, 2), clength )
				);
				break;
			case "MMM":
				// Month, as a three-letter abbreviation
			case "MMMM":
				// Month, using the full name
				var part = getPart( value, 1 );
				ret.push(
					( cal.monthsGenitive && hasDay() ) ?
					( cal.monthsGenitive[ clength === 3 ? "namesAbbr" : "names" ][ part ] ) :
					( cal.months[ clength === 3 ? "namesAbbr" : "names" ][ part ] )
				);
				break;
			case "M":
				// Month, as digits, with no leading zero for single-digit months
			case "MM":
				// Month, as digits, with leading zero for single-digit months
				ret.push(
					padZeros( getPart(value, 1) + 1, clength )
				);
				break;
			case "y":
				// Year, as two digits, but with no leading zero for years less than 10
			case "yy":
				// Year, as two digits, with leading zero for years less than 10
			case "yyyy":
				// Year represented by four full digits
				part = converted ? converted[ 0 ] : getEraYear( value, cal, getEra(value, eras), sortable );
				if ( clength < 4 ) {
					part = part % 100;
				}
				ret.push(
					padZeros( part, clength )
				);
				break;
			case "h":
				// Hours with no leading zero for single-digit hours, using 12-hour clock
			case "hh":
				// Hours with leading zero for single-digit hours, using 12-hour clock
				hour = value.getHours() % 12;
				if ( hour === 0 ) hour = 12;
				ret.push(
					padZeros( hour, clength )
				);
				break;
			case "H":
				// Hours with no leading zero for single-digit hours, using 24-hour clock
			case "HH":
				// Hours with leading zero for single-digit hours, using 24-hour clock
				ret.push(
					padZeros( value.getHours(), clength )
				);
				break;
			case "m":
				// Minutes with no leading zero for single-digit minutes
			case "mm":
				// Minutes with leading zero for single-digit minutes
				ret.push(
					padZeros( value.getMinutes(), clength )
				);
				break;
			case "s":
				// Seconds with no leading zero for single-digit seconds
			case "ss":
				// Seconds with leading zero for single-digit seconds
				ret.push(
					padZeros( value.getSeconds(), clength )
				);
				break;
			case "t":
				// One character am/pm indicator ("a" or "p")
			case "tt":
				// Multicharacter am/pm indicator
				part = value.getHours() < 12 ? ( cal.AM ? cal.AM[0] : " " ) : ( cal.PM ? cal.PM[0] : " " );
				ret.push( clength === 1 ? part.charAt(0) : part );
				break;
			case "f":
				// Deciseconds
			case "ff":
				// Centiseconds
			case "fff":
				// Milliseconds
				ret.push(
					padZeros( value.getMilliseconds(), 3 ).substr( 0, clength )
				);
				break;
			case "z":
				// Time zone offset, no leading zero
			case "zz":
				// Time zone offset with leading zero
				hour = value.getTimezoneOffset() / 60;
				ret.push(
					( hour <= 0 ? "+" : "-" ) + padZeros( Math.floor(Math.abs(hour)), clength )
				);
				break;
			case "zzz":
				// Time zone offset with leading zero
				hour = value.getTimezoneOffset() / 60;
				ret.push(
					( hour <= 0 ? "+" : "-" ) + padZeros( Math.floor(Math.abs(hour)), 2 ) +
					// Hard coded ":" separator, rather than using cal.TimeSeparator
					// Repeated here for consistency, plus ":" was already assumed in date parsing.
					":" + padZeros( Math.abs(value.getTimezoneOffset() % 60), 2 )
				);
				break;
			case "g":
			case "gg":
				if ( cal.eras ) {
					ret.push(
						cal.eras[ getEra(value, eras) ].name
					);
				}
				break;
		case "/":
			ret.push( cal["/"] );
			break;
		default:
			throw "Invalid date format pattern \'" + current + "\'.";
		}
	}
	return ret.join( "" );
};

// formatNumber
(function() {
	var expandNumber;

	expandNumber = function( number, precision, formatInfo ) {
		var groupSizes = formatInfo.groupSizes,
			curSize = groupSizes[ 0 ],
			curGroupIndex = 1,
			factor = Math.pow( 10, precision ),
			rounded = Math.round( number * factor ) / factor;

		if ( !isFinite(rounded) ) {
			rounded = number;
		}
		number = rounded;

		var numberString = number+"",
			right = "",
			split = numberString.split( /e/i ),
			exponent = split.length > 1 ? parseInt( split[1], 10 ) : 0;
		numberString = split[ 0 ];
		split = numberString.split( "." );
		numberString = split[ 0 ];
		right = split.length > 1 ? split[ 1 ] : "";

		var l;
		if ( exponent > 0 ) {
			right = zeroPad( right, exponent, false );
			numberString += right.slice( 0, exponent );
			right = right.substr( exponent );
		}
		else if ( exponent < 0 ) {
			exponent = -exponent;
			numberString = zeroPad( numberString, exponent + 1, true );
			right = numberString.slice( -exponent, numberString.length ) + right;
			numberString = numberString.slice( 0, -exponent );
		}

		if ( precision > 0 ) {
			right = formatInfo[ "." ] +
				( (right.length > precision) ? right.slice(0, precision) : zeroPad(right, precision) );
		}
		else {
			right = "";
		}

		var stringIndex = numberString.length - 1,
			sep = formatInfo[ "," ],
			ret = "";

		while ( stringIndex >= 0 ) {
			if ( curSize === 0 || curSize > stringIndex ) {
				return numberString.slice( 0, stringIndex + 1 ) + ( ret.length ? (sep + ret + right) : right );
			}
			ret = numberString.slice( stringIndex - curSize + 1, stringIndex + 1 ) + ( ret.length ? (sep + ret) : "" );

			stringIndex -= curSize;

			if ( curGroupIndex < groupSizes.length ) {
				curSize = groupSizes[ curGroupIndex ];
				curGroupIndex++;
			}
		}

		return numberString.slice( 0, stringIndex + 1 ) + sep + ret + right;
	};

	formatNumber = function( value, format, culture ) {
		if ( !isFinite(value) ) {
			if ( value === Infinity ) {
				return culture.numberFormat.positiveInfinity;
			}
			if ( value === -Infinity ) {
				return culture.numberFormat.negativeInfinity;
			}
			return culture.numberFormat.NaN;
		}
		if ( !format || format === "i" ) {
			return culture.name.length ? value.toLocaleString() : value.toString();
		}
		format = format || "D";

		var nf = culture.numberFormat,
			number = Math.abs( value ),
			precision = -1,
			pattern;
		if ( format.length > 1 ) precision = parseInt( format.slice(1), 10 );

		var current = format.charAt( 0 ).toUpperCase(),
			formatInfo;

		switch ( current ) {
			case "D":
				pattern = "n";
				number = truncate( number );
				if ( precision !== -1 ) {
					number = zeroPad( "" + number, precision, true );
				}
				if ( value < 0 ) number = "-" + number;
				break;
			case "N":
				formatInfo = nf;
				/* falls through */
			case "C":
				formatInfo = formatInfo || nf.currency;
				/* falls through */
			case "P":
				formatInfo = formatInfo || nf.percent;
				pattern = value < 0 ? formatInfo.pattern[ 0 ] : ( formatInfo.pattern[1] || "n" );
				if ( precision === -1 ) precision = formatInfo.decimals;
				number = expandNumber( number * (current === "P" ? 100 : 1), precision, formatInfo );
				break;
			default:
				throw "Bad number format specifier: " + current;
		}

		var patternParts = /n|\$|-|%/g,
			ret = "";
		for ( ; ; ) {
			var index = patternParts.lastIndex,
				ar = patternParts.exec( pattern );

			ret += pattern.slice( index, ar ? ar.index : pattern.length );

			if ( !ar ) {
				break;
			}

			switch ( ar[0] ) {
				case "n":
					ret += number;
					break;
				case "$":
					ret += nf.currency.symbol;
					break;
				case "-":
					// don't make 0 negative
					if ( /[1-9]/.test(number) ) {
						ret += nf[ "-" ];
					}
					break;
				case "%":
					ret += nf.percent.symbol;
					break;
			}
		}

		return ret;
	};

}());

getTokenRegExp = function() {
	// regular expression for matching date and time tokens in format strings.
	return (/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g);
};

getEra = function( date, eras ) {
	if ( !eras ) return 0;
	var start, ticks = date.getTime();
	for ( var i = 0, l = eras.length; i < l; i++ ) {
		start = eras[ i ].start;
		if ( start === null || ticks >= start ) {
			return i;
		}
	}
	return 0;
};

getEraYear = function( date, cal, era, sortable ) {
	var year = date.getFullYear();
	if ( !sortable && cal.eras ) {
		// convert normal gregorian year to era-shifted gregorian
		// year by subtracting the era offset
		year -= cal.eras[ era ].offset;
	}
	return year;
};

// parseExact
(function() {
	var expandYear,
		getDayIndex,
		getMonthIndex,
		getParseRegExp,
		outOfRange,
		toUpper,
		toUpperArray;

	expandYear = function( cal, year ) {
		// expands 2-digit year into 4 digits.
		if ( year < 100 ) {
			var now = new Date(),
				era = getEra( now ),
				curr = getEraYear( now, cal, era ),
				twoDigitYearMax = cal.twoDigitYearMax;
			twoDigitYearMax = typeof twoDigitYearMax === "string" ? new Date().getFullYear() % 100 + parseInt( twoDigitYearMax, 10 ) : twoDigitYearMax;
			year += curr - ( curr % 100 );
			if ( year > twoDigitYearMax ) {
				year -= 100;
			}
		}
		return year;
	};

	getDayIndex = function	( cal, value, abbr ) {
		var ret,
			days = cal.days,
			upperDays = cal._upperDays;
		if ( !upperDays ) {
			cal._upperDays = upperDays = [
				toUpperArray( days.names ),
				toUpperArray( days.namesAbbr ),
				toUpperArray( days.namesShort )
			];
		}
		value = toUpper( value );
		if ( abbr ) {
			ret = arrayIndexOf( upperDays[1], value );
			if ( ret === -1 ) {
				ret = arrayIndexOf( upperDays[2], value );
			}
		}
		else {
			ret = arrayIndexOf( upperDays[0], value );
		}
		return ret;
	};

	getMonthIndex = function( cal, value, abbr ) {
		var months = cal.months,
			monthsGen = cal.monthsGenitive || cal.months,
			upperMonths = cal._upperMonths,
			upperMonthsGen = cal._upperMonthsGen;
		if ( !upperMonths ) {
			cal._upperMonths = upperMonths = [
				toUpperArray( months.names ),
				toUpperArray( months.namesAbbr )
			];
			cal._upperMonthsGen = upperMonthsGen = [
				toUpperArray( monthsGen.names ),
				toUpperArray( monthsGen.namesAbbr )
			];
		}
		value = toUpper( value );
		var i = arrayIndexOf( abbr ? upperMonths[1] : upperMonths[0], value );
		if ( i < 0 ) {
			i = arrayIndexOf( abbr ? upperMonthsGen[1] : upperMonthsGen[0], value );
		}
		return i;
	};

	getParseRegExp = function( cal, format ) {
		// converts a format string into a regular expression with groups that
		// can be used to extract date fields from a date string.
		// check for a cached parse regex.
		var re = cal._parseRegExp;
		if ( !re ) {
			cal._parseRegExp = re = {};
		}
		else {
			var reFormat = re[ format ];
			if ( reFormat ) {
				return reFormat;
			}
		}

		// expand single digit formats, then escape regular expression characters.
		var expFormat = expandFormat( cal, format ).replace( /([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1" ),
			regexp = [ "^" ],
			groups = [],
			index = 0,
			quoteCount = 0,
			tokenRegExp = getTokenRegExp(),
			match;

		// iterate through each date token found.
		while ( (match = tokenRegExp.exec(expFormat)) !== null ) {
			var preMatch = expFormat.slice( index, match.index );
			index = tokenRegExp.lastIndex;

			// don't replace any matches that occur inside a string literal.
			quoteCount += appendPreOrPostMatch( preMatch, regexp );
			if ( quoteCount % 2 ) {
				regexp.push( match[0] );
				continue;
			}

			// add a regex group for the token.
			var m = match[ 0 ],
				len = m.length,
				add;
			switch ( m ) {
				case "dddd": case "ddd":
				case "MMMM": case "MMM":
				case "gg": case "g":
					add = "(\\D+)";
					break;
				case "tt": case "t":
					add = "(\\D*)";
					break;
				case "yyyy":
				case "fff":
				case "ff":
				case "f":
					add = "(\\d{" + len + "})";
					break;
				case "dd": case "d":
				case "MM": case "M":
				case "yy": case "y":
				case "HH": case "H":
				case "hh": case "h":
				case "mm": case "m":
				case "ss": case "s":
					add = "(\\d\\d?)";
					break;
				case "zzz":
					add = "([+-]?\\d\\d?:\\d{2})";
					break;
				case "zz": case "z":
					add = "([+-]?\\d\\d?)";
					break;
				case "/":
					add = "(\\/)";
					break;
				default:
					throw "Invalid date format pattern \'" + m + "\'.";
			}
			if ( add ) {
				regexp.push( add );
			}
			groups.push( match[0] );
		}
		appendPreOrPostMatch( expFormat.slice(index), regexp );
		regexp.push( "$" );

		// allow whitespace to differ when matching formats.
		var regexpStr = regexp.join( "" ).replace( /\s+/g, "\\s+" ),
			parseRegExp = { "regExp": regexpStr, "groups": groups };

		// cache the regex for this format.
		return re[ format ] = parseRegExp;
	};

	outOfRange = function( value, low, high ) {
		return value < low || value > high;
	};

	toUpper = function( value ) {
		// "he-IL" has non-breaking space in weekday names.
		return value.split( "\u00A0" ).join( " " ).toUpperCase();
	};

	toUpperArray = function( arr ) {
		var results = [];
		for ( var i = 0, l = arr.length; i < l; i++ ) {
			results[ i ] = toUpper( arr[i] );
		}
		return results;
	};

	parseExact = function( value, format, culture ) {
		// try to parse the date string by matching against the format string
		// while using the specified culture for date field names.
		value = trim( value );
		var cal = culture.calendar,
			// convert date formats into regular expressions with groupings.
			// use the regexp to determine the input format and extract the date fields.
			parseInfo = getParseRegExp( cal, format ),
			match = new RegExp( parseInfo.regExp ).exec( value );
		if ( match === null ) {
			return null;
		}
		// found a date format that matches the input.
		var groups = parseInfo.groups,
			era = null, year = null, month = null, date = null, weekDay = null,
			hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null,
			pmHour = false;
		// iterate the format groups to extract and set the date fields.
		for ( var j = 0, jl = groups.length; j < jl; j++ ) {
			var matchGroup = match[ j + 1 ];
			if ( matchGroup ) {
				var current = groups[ j ],
					clength = current.length,
					matchInt = parseInt( matchGroup, 10 );
				switch ( current ) {
					case "dd": case "d":
						// Day of month.
						date = matchInt;
						// check that date is generally in valid range, also checking overflow below.
						if ( outOfRange(date, 1, 31) ) return null;
						break;
					case "MMM": case "MMMM":
						month = getMonthIndex( cal, matchGroup, clength === 3 );
						if ( outOfRange(month, 0, 11) ) return null;
						break;
					case "M": case "MM":
						// Month.
						month = matchInt - 1;
						if ( outOfRange(month, 0, 11) ) return null;
						break;
					case "y": case "yy":
					case "yyyy":
						year = clength < 4 ? expandYear( cal, matchInt ) : matchInt;
						if ( outOfRange(year, 0, 9999) ) return null;
						break;
					case "h": case "hh":
						// Hours (12-hour clock).
						hour = matchInt;
						if ( hour === 12 ) hour = 0;
						if ( outOfRange(hour, 0, 11) ) return null;
						break;
					case "H": case "HH":
						// Hours (24-hour clock).
						hour = matchInt;
						if ( outOfRange(hour, 0, 23) ) return null;
						break;
					case "m": case "mm":
						// Minutes.
						min = matchInt;
						if ( outOfRange(min, 0, 59) ) return null;
						break;
					case "s": case "ss":
						// Seconds.
						sec = matchInt;
						if ( outOfRange(sec, 0, 59) ) return null;
						break;
					case "tt": case "t":
						// AM/PM designator.
						// see if it is standard, upper, or lower case PM. If not, ensure it is at least one of
						// the AM tokens. If not, fail the parse for this format.
						pmHour = cal.PM && ( matchGroup === cal.PM[0] || matchGroup === cal.PM[1] || matchGroup === cal.PM[2] );
						if (
							!pmHour && (
								!cal.AM || ( matchGroup !== cal.AM[0] && matchGroup !== cal.AM[1] && matchGroup !== cal.AM[2] )
							)
						) return null;
						break;
					case "f":
						// Deciseconds.
					case "ff":
						// Centiseconds.
					case "fff":
						// Milliseconds.
						msec = matchInt * Math.pow( 10, 3 - clength );
						if ( outOfRange(msec, 0, 999) ) return null;
						break;
					case "ddd":
						// Day of week.
					case "dddd":
						// Day of week.
						weekDay = getDayIndex( cal, matchGroup, clength === 3 );
						if ( outOfRange(weekDay, 0, 6) ) return null;
						break;
					case "zzz":
						// Time zone offset in +/- hours:min.
						var offsets = matchGroup.split( /:/ );
						if ( offsets.length !== 2 ) return null;
						hourOffset = parseInt( offsets[0], 10 );
						if ( outOfRange(hourOffset, -12, 13) ) return null;
						var minOffset = parseInt( offsets[1], 10 );
						if ( outOfRange(minOffset, 0, 59) ) return null;
						tzMinOffset = ( hourOffset * 60 ) + ( startsWith(matchGroup, "-") ? -minOffset : minOffset );
						break;
					case "z": case "zz":
						// Time zone offset in +/- hours.
						hourOffset = matchInt;
						if ( outOfRange(hourOffset, -12, 13) ) return null;
						tzMinOffset = hourOffset * 60;
						break;
					case "g": case "gg":
						var eraName = matchGroup;
						if ( !eraName || !cal.eras ) return null;
						eraName = trim( eraName.toLowerCase() );
						for ( var i = 0, l = cal.eras.length; i < l; i++ ) {
							if ( eraName === cal.eras[i].name.toLowerCase() ) {
								era = i;
								break;
							}
						}
						// could not find an era with that name
						if ( era === null ) return null;
						break;
				}
			}
		}
		var result = new Date(), defaultYear, convert = cal.convert;
		defaultYear = convert ? convert.fromGregorian( result )[ 0 ] : result.getFullYear();
		if ( year === null ) {
			year = defaultYear;
		}
		else if ( cal.eras ) {
			// year must be shifted to normal gregorian year
			// but not if year was not specified, its already normal gregorian
			// per the main if clause above.
			year += cal.eras[( era || 0 )].offset;
		}
		// set default day and month to 1 and January, so if unspecified, these are the defaults
		// instead of the current day/month.
		if ( month === null ) {
			month = 0;
		}
		if ( date === null ) {
			date = 1;
		}
		// now have year, month, and date, but in the culture's calendar.
		// convert to gregorian if necessary
		if ( convert ) {
			result = convert.toGregorian( year, month, date );
			// conversion failed, must be an invalid match
			if ( result === null ) return null;
		}
		else {
			// have to set year, month and date together to avoid overflow based on current date.
			result.setFullYear( year, month, date );
			// check to see if date overflowed for specified month (only checked 1-31 above).
			if ( result.getDate() !== date ) return null;
			// invalid day of week.
			if ( weekDay !== null && result.getDay() !== weekDay ) {
				return null;
			}
		}
		// if pm designator token was found make sure the hours fit the 24-hour clock.
		if ( pmHour && hour < 12 ) {
			hour += 12;
		}
		result.setHours( hour, min, sec, msec );
		if ( tzMinOffset !== null ) {
			// adjust timezone to utc before applying local offset.
			var adjustedMin = result.getMinutes() - ( tzMinOffset + result.getTimezoneOffset() );
			// Safari limits hours and minutes to the range of -127 to 127.  We need to use setHours
			// to ensure both these fields will not exceed this range.	adjustedMin will range
			// somewhere between -1440 and 1500, so we only need to split this into hours.
			result.setHours( result.getHours() + parseInt(adjustedMin / 60, 10), adjustedMin % 60 );
		}
		return result;
	};
}());

parseNegativePattern = function( value, nf, negativePattern ) {
	var neg = nf[ "-" ],
		pos = nf[ "+" ],
		ret;
	switch ( negativePattern ) {
		case "n -":
			neg = " " + neg;
			pos = " " + pos;
			/* falls through */
		case "n-":
			if ( endsWith(value, neg) ) {
				ret = [ "-", value.substr(0, value.length - neg.length) ];
			}
			else if ( endsWith(value, pos) ) {
				ret = [ "+", value.substr(0, value.length - pos.length) ];
			}
			break;
		case "- n":
			neg += " ";
			pos += " ";
			/* falls through */
		case "-n":
			if ( startsWith(value, neg) ) {
				ret = [ "-", value.substr(neg.length) ];
			}
			else if ( startsWith(value, pos) ) {
				ret = [ "+", value.substr(pos.length) ];
			}
			break;
		case "(n)":
			if ( startsWith(value, "(") && endsWith(value, ")") ) {
				ret = [ "-", value.substr(1, value.length - 2) ];
			}
			break;
	}
	return ret || [ "", value ];
};

//
// public instance functions
//

Globalize.prototype.findClosestCulture = function( cultureSelector ) {
	return Globalize.findClosestCulture.call( this, cultureSelector );
};

Globalize.prototype.format = function( value, format, cultureSelector ) {
	return Globalize.format.call( this, value, format, cultureSelector );
};

Globalize.prototype.localize = function( key, cultureSelector ) {
	return Globalize.localize.call( this, key, cultureSelector );
};

Globalize.prototype.parseInt = function( value, radix, cultureSelector ) {
	return Globalize.parseInt.call( this, value, radix, cultureSelector );
};

Globalize.prototype.parseFloat = function( value, radix, cultureSelector ) {
	return Globalize.parseFloat.call( this, value, radix, cultureSelector );
};

Globalize.prototype.culture = function( cultureSelector ) {
	return Globalize.culture.call( this, cultureSelector );
};

//
// public singleton functions
//

Globalize.addCultureInfo = function( cultureName, baseCultureName, info ) {

	var base = {},
		isNew = false;

	if ( typeof cultureName !== "string" ) {
		// cultureName argument is optional string. If not specified, assume info is first
		// and only argument. Specified info deep-extends current culture.
		info = cultureName;
		cultureName = this.culture().name;
		base = this.cultures[ cultureName ];
	} else if ( typeof baseCultureName !== "string" ) {
		// baseCultureName argument is optional string. If not specified, assume info is second
		// argument. Specified info deep-extends specified culture.
		// If specified culture does not exist, create by deep-extending default
		info = baseCultureName;
		isNew = ( this.cultures[ cultureName ] == null );
		base = this.cultures[ cultureName ] || this.cultures[ "default" ];
	} else {
		// cultureName and baseCultureName specified. Assume a new culture is being created
		// by deep-extending an specified base culture
		isNew = true;
		base = this.cultures[ baseCultureName ];
	}

	this.cultures[ cultureName ] = extend(true, {},
		base,
		info
	);
	// Make the standard calendar the current culture if it's a new culture
	if ( isNew ) {
		this.cultures[ cultureName ].calendar = this.cultures[ cultureName ].calendars.standard;
	}
};

Globalize.findClosestCulture = function( name ) {
	var match;
	if ( !name ) {
		return this.findClosestCulture( this.cultureSelector ) || this.cultures[ "default" ];
	}
	if ( typeof name === "string" ) {
		name = name.split( "," );
	}
	if ( isArray(name) ) {
		var lang,
			cultures = this.cultures,
			list = name,
			i, l = list.length,
			prioritized = [];
		for ( i = 0; i < l; i++ ) {
			name = trim( list[i] );
			var pri, parts = name.split( ";" );
			lang = trim( parts[0] );
			if ( parts.length === 1 ) {
				pri = 1;
			}
			else {
				name = trim( parts[1] );
				if ( name.indexOf("q=") === 0 ) {
					name = name.substr( 2 );
					pri = parseFloat( name );
					pri = isNaN( pri ) ? 0 : pri;
				}
				else {
					pri = 1;
				}
			}
			prioritized.push({ lang: lang, pri: pri });
		}
		prioritized.sort(function( a, b ) {
			if ( a.pri < b.pri ) {
				return 1;
			} else if ( a.pri > b.pri ) {
				return -1;
			}
			return 0;
		});
		// exact match
		for ( i = 0; i < l; i++ ) {
			lang = prioritized[ i ].lang;
			match = cultures[ lang ];
			if ( match ) {
				return match;
			}
		}

		// neutral language match
		for ( i = 0; i < l; i++ ) {
			lang = prioritized[ i ].lang;
			do {
				var index = lang.lastIndexOf( "-" );
				if ( index === -1 ) {
					break;
				}
				// strip off the last part. e.g. en-US => en
				lang = lang.substr( 0, index );
				match = cultures[ lang ];
				if ( match ) {
					return match;
				}
			}
			while ( 1 );
		}

		// last resort: match first culture using that language
		for ( i = 0; i < l; i++ ) {
			lang = prioritized[ i ].lang;
			for ( var cultureKey in cultures ) {
				var culture = cultures[ cultureKey ];
				if ( culture.language == lang ) {
					return culture;
				}
			}
		}
	}
	else if ( typeof name === "object" ) {
		return name;
	}
	return match || null;
};

Globalize.format = function( value, format, cultureSelector ) {
	var culture = this.findClosestCulture( cultureSelector );
	if ( value instanceof Date ) {
		value = formatDate( value, format, culture );
	}
	else if ( typeof value === "number" ) {
		value = formatNumber( value, format, culture );
	}
	return value;
};

Globalize.localize = function( key, cultureSelector ) {
	return this.findClosestCulture( cultureSelector ).messages[ key ] ||
		this.cultures[ "default" ].messages[ key ];
};

Globalize.parseDate = function( value, formats, culture ) {
	culture = this.findClosestCulture( culture );

	var date, prop, patterns;
	if ( formats ) {
		if ( typeof formats === "string" ) {
			formats = [ formats ];
		}
		if ( formats.length ) {
			for ( var i = 0, l = formats.length; i < l; i++ ) {
				var format = formats[ i ];
				if ( format ) {
					date = parseExact( value, format, culture );
					if ( date ) {
						break;
					}
				}
			}
		}
	} else {
		patterns = culture.calendar.patterns;
		for ( prop in patterns ) {
			date = parseExact( value, patterns[prop], culture );
			if ( date ) {
				break;
			}
		}
	}

	return date || null;
};

Globalize.parseInt = function( value, radix, cultureSelector ) {
	return truncate( Globalize.parseFloat(value, radix, cultureSelector) );
};

Globalize.parseFloat = function( value, radix, cultureSelector ) {
	// radix argument is optional
	if ( typeof radix !== "number" ) {
		cultureSelector = radix;
		radix = 10;
	}

	var culture = this.findClosestCulture( cultureSelector );
	var ret = NaN,
		nf = culture.numberFormat;

	if ( value.indexOf(culture.numberFormat.currency.symbol) > -1 ) {
		// remove currency symbol
		value = value.replace( culture.numberFormat.currency.symbol, "" );
		// replace decimal seperator
		value = value.replace( culture.numberFormat.currency["."], culture.numberFormat["."] );
	}

	//Remove percentage character from number string before parsing
	if ( value.indexOf(culture.numberFormat.percent.symbol) > -1){
		value = value.replace( culture.numberFormat.percent.symbol, "" );
	}

	// remove spaces: leading, trailing and between - and number. Used for negative currency pt-BR
	value = value.replace( / /g, "" );

	// allow infinity or hexidecimal
	if ( regexInfinity.test(value) ) {
		ret = parseFloat( value );
	}
	else if ( !radix && regexHex.test(value) ) {
		ret = parseInt( value, 16 );
	}
	else {

		// determine sign and number
		var signInfo = parseNegativePattern( value, nf, nf.pattern[0] ),
			sign = signInfo[ 0 ],
			num = signInfo[ 1 ];

		// #44 - try parsing as "(n)"
		if ( sign === "" && nf.pattern[0] !== "(n)" ) {
			signInfo = parseNegativePattern( value, nf, "(n)" );
			sign = signInfo[ 0 ];
			num = signInfo[ 1 ];
		}

		// try parsing as "-n"
		if ( sign === "" && nf.pattern[0] !== "-n" ) {
			signInfo = parseNegativePattern( value, nf, "-n" );
			sign = signInfo[ 0 ];
			num = signInfo[ 1 ];
		}

		sign = sign || "+";

		// determine exponent and number
		var exponent,
			intAndFraction,
			exponentPos = num.indexOf( "e" );
		if ( exponentPos < 0 ) exponentPos = num.indexOf( "E" );
		if ( exponentPos < 0 ) {
			intAndFraction = num;
			exponent = null;
		}
		else {
			intAndFraction = num.substr( 0, exponentPos );
			exponent = num.substr( exponentPos + 1 );
		}
		// determine decimal position
		var integer,
			fraction,
			decSep = nf[ "." ],
			decimalPos = intAndFraction.indexOf( decSep );
		if ( decimalPos < 0 ) {
			integer = intAndFraction;
			fraction = null;
		}
		else {
			integer = intAndFraction.substr( 0, decimalPos );
			fraction = intAndFraction.substr( decimalPos + decSep.length );
		}
		// handle groups (e.g. 1,000,000)
		var groupSep = nf[ "," ];
		integer = integer.split( groupSep ).join( "" );
		var altGroupSep = groupSep.replace( /\u00A0/g, " " );
		if ( groupSep !== altGroupSep ) {
			integer = integer.split( altGroupSep ).join( "" );
		}
		// build a natively parsable number string
		var p = sign + integer;
		if ( fraction !== null ) {
			p += "." + fraction;
		}
		if ( exponent !== null ) {
			// exponent itself may have a number patternd
			var expSignInfo = parseNegativePattern( exponent, nf, "-n" );
			p += "e" + ( expSignInfo[0] || "+" ) + expSignInfo[ 1 ];
		}
		if ( regexParseFloat.test(p) ) {
			ret = parseFloat( p );
		}
	}
	return ret;
};

Globalize.culture = function( cultureSelector ) {
	// setter
	if ( typeof cultureSelector !== "undefined" ) {
		this.cultureSelector = cultureSelector;
	}
	// getter
	return this.findClosestCulture( cultureSelector ) || this.cultures[ "default" ];
};

}( this ));


/*!
 * Globalize
 *
 * http://github.com/jquery/globalize
 *
 * Copyright Software Freedom Conservancy, Inc.
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 */

(function( window, undefined ) {

var Globalize,
	// private variables
	regexHex,
	regexInfinity,
	regexParseFloat,
	regexTrim,
	// private JavaScript utility functions
	arrayIndexOf,
	endsWith,
	extend,
	isArray,
	isFunction,
	isObject,
	startsWith,
	trim,
	truncate,
	zeroPad,
	// private Globalization utility functions
	appendPreOrPostMatch,
	expandFormat,
	formatDate,
	formatNumber,
	getTokenRegExp,
	getEra,
	getEraYear,
	parseExact,
	parseNegativePattern;

// Global variable (Globalize) or CommonJS module (globalize)
Globalize = function( cultureSelector ) {
	return new Globalize.prototype.init( cultureSelector );
};

if ( typeof require !== "undefined" &&
	typeof exports !== "undefined" &&
	typeof module !== "undefined" ) {
	// Assume CommonJS
	module.exports = Globalize;
} else {
	// Export as global variable
	window.Globalize = Globalize;
}

Globalize.cultures = {};

Globalize.prototype = {
	constructor: Globalize,
	init: function( cultureSelector ) {
		this.cultures = Globalize.cultures;
		this.cultureSelector = cultureSelector;

		return this;
	}
};
Globalize.prototype.init.prototype = Globalize.prototype;

// 1. When defining a culture, all fields are required except the ones stated as optional.
// 2. Each culture should have a ".calendars" object with at least one calendar named "standard"
//    which serves as the default calendar in use by that culture.
// 3. Each culture should have a ".calendar" object which is the current calendar being used,
//    it may be dynamically changed at any time to one of the calendars in ".calendars".
Globalize.cultures[ "default" ] = {
	// A unique name for the culture in the form <language code>-<country/region code>
	name: "en",
	// the name of the culture in the english language
	englishName: "English",
	// the name of the culture in its own language
	nativeName: "English",
	// whether the culture uses right-to-left text
	isRTL: false,
	// "language" is used for so-called "specific" cultures.
	// For example, the culture "es-CL" means "Spanish, in Chili".
	// It represents the Spanish-speaking culture as it is in Chili,
	// which might have different formatting rules or even translations
	// than Spanish in Spain. A "neutral" culture is one that is not
	// specific to a region. For example, the culture "es" is the generic
	// Spanish culture, which may be a more generalized version of the language
	// that may or may not be what a specific culture expects.
	// For a specific culture like "es-CL", the "language" field refers to the
	// neutral, generic culture information for the language it is using.
	// This is not always a simple matter of the string before the dash.
	// For example, the "zh-Hans" culture is netural (Simplified Chinese).
	// And the "zh-SG" culture is Simplified Chinese in Singapore, whose lanugage
	// field is "zh-CHS", not "zh".
	// This field should be used to navigate from a specific culture to it's
	// more general, neutral culture. If a culture is already as general as it
	// can get, the language may refer to itself.
	language: "en",
	// numberFormat defines general number formatting rules, like the digits in
	// each grouping, the group separator, and how negative numbers are displayed.
	numberFormat: {
		// [negativePattern]
		// Note, numberFormat.pattern has no "positivePattern" unlike percent and currency,
		// but is still defined as an array for consistency with them.
		//   negativePattern: one of "(n)|-n|- n|n-|n -"
		pattern: [ "-n" ],
		// number of decimal places normally shown
		decimals: 2,
		// string that separates number groups, as in 1,000,000
		",": ",",
		// string that separates a number from the fractional portion, as in 1.99
		".": ".",
		// array of numbers indicating the size of each number group.
		// TODO: more detailed description and example
		groupSizes: [ 3 ],
		// symbol used for positive numbers
		"+": "+",
		// symbol used for negative numbers
		"-": "-",
		// symbol used for NaN (Not-A-Number)
		"NaN": "NaN",
		// symbol used for Negative Infinity
		negativeInfinity: "-Infinity",
		// symbol used for Positive Infinity
		positiveInfinity: "Infinity",
		percent: {
			// [negativePattern, positivePattern]
			//   negativePattern: one of "-n %|-n%|-%n|%-n|%n-|n-%|n%-|-% n|n %-|% n-|% -n|n- %"
			//   positivePattern: one of "n %|n%|%n|% n"
			pattern: [ "-n %", "n %" ],
			// number of decimal places normally shown
			decimals: 2,
			// array of numbers indicating the size of each number group.
			// TODO: more detailed description and example
			groupSizes: [ 3 ],
			// string that separates number groups, as in 1,000,000
			",": ",",
			// string that separates a number from the fractional portion, as in 1.99
			".": ".",
			// symbol used to represent a percentage
			symbol: "%"
		},
		currency: {
			// [negativePattern, positivePattern]
			//   negativePattern: one of "($n)|-$n|$-n|$n-|(n$)|-n$|n-$|n$-|-n $|-$ n|n $-|$ n-|$ -n|n- $|($ n)|(n $)"
			//   positivePattern: one of "$n|n$|$ n|n $"
			pattern: [ "($n)", "$n" ],
			// number of decimal places normally shown
			decimals: 2,
			// array of numbers indicating the size of each number group.
			// TODO: more detailed description and example
			groupSizes: [ 3 ],
			// string that separates number groups, as in 1,000,000
			",": ",",
			// string that separates a number from the fractional portion, as in 1.99
			".": ".",
			// symbol used to represent currency
			symbol: "Rp."
		}
	},
	// calendars defines all the possible calendars used by this culture.
	// There should be at least one defined with name "standard", and is the default
	// calendar used by the culture.
	// A calendar contains information about how dates are formatted, information about
	// the calendar's eras, a standard set of the date formats,
	// translations for day and month names, and if the calendar is not based on the Gregorian
	// calendar, conversion functions to and from the Gregorian calendar.
	calendars: {
		standard: {
			// name that identifies the type of calendar this is
			name: "Gregorian_USEnglish",
			// separator of parts of a date (e.g. "/" in 11/05/1955)
			"/": "/",
			// separator of parts of a time (e.g. ":" in 05:44 PM)
			":": ":",
			// the first day of the week (0 = Sunday, 1 = Monday, etc)
			firstDay: 0,
			days: {
				// full day names
				names: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
				// abbreviated day names
				namesAbbr: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ],
				// shortest day names
				namesShort: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ]
			},
			months: {
				// full month names (13 months for lunar calendards -- 13th month should be "" if not lunar)
				names: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "" ],
				// abbreviated month names
				namesAbbr: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "" ]
			},
			// AM and PM designators in one of these forms:
			// The usual view, and the upper and lower case versions
			//   [ standard, lowercase, uppercase ]
			// The culture does not use AM or PM (likely all standard date formats use 24 hour time)
			//   null
			AM: [ "AM", "am", "AM" ],
			PM: [ "PM", "pm", "PM" ],
			eras: [
				// eras in reverse chronological order.
				// name: the name of the era in this culture (e.g. A.D., C.E.)
				// start: when the era starts in ticks (gregorian, gmt), null if it is the earliest supported era.
				// offset: offset in years from gregorian calendar
				{
					"name": "A.D.",
					"start": null,
					"offset": 0
				}
			],
			// when a two digit year is given, it will never be parsed as a four digit
			// year greater than this year (in the appropriate era for the culture)
			// Set it as a full year (e.g. 2029) or use an offset format starting from
			// the current year: "+19" would correspond to 2029 if the current year 2010.
			twoDigitYearMax: 2029,
			// set of predefined date and time patterns used by the culture
			// these represent the format someone in this culture would expect
			// to see given the portions of the date that are shown.
			patterns: {
				// short date pattern
				d: "dd/MM/yyyy",
				// long date pattern
				D: "dddd, MMMM dd, yyyy",
				// short time pattern
				t: "h:mm tt",
				// long time pattern
				T: "h:mm:ss tt",
				// long date, short time pattern
				f: "dddd, MMMM dd, yyyy h:mm tt",
				// long date, long time pattern
				F: "dddd, MMMM dd, yyyy h:mm:ss tt",
				// month/day pattern
				M: "MMMM dd",
				// month/year pattern
				Y: "yyyy MMMM",
				// S is a sortable format that does not vary by culture
				S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss"
			}
			// optional fields for each calendar:
			/*
			monthsGenitive:
				Same as months but used when the day preceeds the month.
				Omit if the culture has no genitive distinction in month names.
				For an explaination of genitive months, see http://blogs.msdn.com/michkap/archive/2004/12/25/332259.aspx
			convert:
				Allows for the support of non-gregorian based calendars. This convert object is used to
				to convert a date to and from a gregorian calendar date to handle parsing and formatting.
				The two functions:
					fromGregorian( date )
						Given the date as a parameter, return an array with parts [ year, month, day ]
						corresponding to the non-gregorian based year, month, and day for the calendar.
					toGregorian( year, month, day )
						Given the non-gregorian year, month, and day, return a new Date() object
						set to the corresponding date in the gregorian calendar.
			*/
		}
	},
	// For localized strings
	messages: {}
};

Globalize.cultures[ "default" ].calendar = Globalize.cultures[ "default" ].calendars.standard;

Globalize.cultures.en = Globalize.cultures[ "default" ];

Globalize.cultureSelector = "en";

//
// private variables
//

regexHex = /^0x[a-f0-9]+$/i;
regexInfinity = /^[+\-]?infinity$/i;
regexParseFloat = /^[+\-]?\d*\.?\d*(e[+\-]?\d+)?$/;
regexTrim = /^\s+|\s+$/g;

//
// private JavaScript utility functions
//

arrayIndexOf = function( array, item ) {
	if ( array.indexOf ) {
		return array.indexOf( item );
	}
	for ( var i = 0, length = array.length; i < length; i++ ) {
		if ( array[i] === item ) {
			return i;
		}
	}
	return -1;
};

endsWith = function( value, pattern ) {
	return value.substr( value.length - pattern.length ) === pattern;
};

extend = function() {
	var options, name, src, copy, copyIsArray, clone,
		target = arguments[0] || {},
		i = 1,
		length = arguments.length,
		deep = false;

	// Handle a deep copy situation
	if ( typeof target === "boolean" ) {
		deep = target;
		target = arguments[1] || {};
		// skip the boolean and the target
		i = 2;
	}

	// Handle case when target is a string or something (possible in deep copy)
	if ( typeof target !== "object" && !isFunction(target) ) {
		target = {};
	}

	for ( ; i < length; i++ ) {
		// Only deal with non-null/undefined values
		if ( (options = arguments[ i ]) != null ) {
			// Extend the base object
			for ( name in options ) {
				src = target[ name ];
				copy = options[ name ];

				// Prevent never-ending loop
				if ( target === copy ) {
					continue;
				}

				// Recurse if we're merging plain objects or arrays
				if ( deep && copy && ( isObject(copy) || (copyIsArray = isArray(copy)) ) ) {
					if ( copyIsArray ) {
						copyIsArray = false;
						clone = src && isArray(src) ? src : [];

					} else {
						clone = src && isObject(src) ? src : {};
					}

					// Never move original objects, clone them
					target[ name ] = extend( deep, clone, copy );

				// Don't bring in undefined values
				} else if ( copy !== undefined ) {
					target[ name ] = copy;
				}
			}
		}
	}

	// Return the modified object
	return target;
};

isArray = Array.isArray || function( obj ) {
	return Object.prototype.toString.call( obj ) === "[object Array]";
};

isFunction = function( obj ) {
	return Object.prototype.toString.call( obj ) === "[object Function]";
};

isObject = function( obj ) {
	return Object.prototype.toString.call( obj ) === "[object Object]";
};

startsWith = function( value, pattern ) {
	return value.indexOf( pattern ) === 0;
};

trim = function( value ) {
	return ( value + "" ).replace( regexTrim, "" );
};

truncate = function( value ) {
	if ( isNaN( value ) ) {
		return NaN;
	}
	return Math[ value < 0 ? "ceil" : "floor" ]( value );
};

zeroPad = function( str, count, left ) {
	var l;
	for ( l = str.length; l < count; l += 1 ) {
		str = ( left ? ("0" + str) : (str + "0") );
	}
	return str;
};

//
// private Globalization utility functions
//

appendPreOrPostMatch = function( preMatch, strings ) {
	// appends pre- and post- token match strings while removing escaped characters.
	// Returns a single quote count which is used to determine if the token occurs
	// in a string literal.
	var quoteCount = 0,
		escaped = false;
	for ( var i = 0, il = preMatch.length; i < il; i++ ) {
		var c = preMatch.charAt( i );
		switch ( c ) {
			case "\'":
				if ( escaped ) {
					strings.push( "\'" );
				}
				else {
					quoteCount++;
				}
				escaped = false;
				break;
			case "\\":
				if ( escaped ) {
					strings.push( "\\" );
				}
				escaped = !escaped;
				break;
			default:
				strings.push( c );
				escaped = false;
				break;
		}
	}
	return quoteCount;
};

expandFormat = function( cal, format ) {
	// expands unspecified or single character date formats into the full pattern.
	format = format || "F";
	var pattern,
		patterns = cal.patterns,
		len = format.length;
	if ( len === 1 ) {
		pattern = patterns[ format ];
		if ( !pattern ) {
			throw "Invalid date format string \'" + format + "\'.";
		}
		format = pattern;
	}
	else if ( len === 2 && format.charAt(0) === "%" ) {
		// %X escape format -- intended as a custom format string that is only one character, not a built-in format.
		format = format.charAt( 1 );
	}
	return format;
};

formatDate = function( value, format, culture ) {
	var cal = culture.calendar,
		convert = cal.convert,
		ret;

	if ( !format || !format.length || format === "i" ) {
		if ( culture && culture.name.length ) {
			if ( convert ) {
				// non-gregorian calendar, so we cannot use built-in toLocaleString()
				ret = formatDate( value, cal.patterns.F, culture );
			}
			else {
				var eraDate = new Date( value.getTime() ),
					era = getEra( value, cal.eras );
				eraDate.setFullYear( getEraYear(value, cal, era) );
				ret = eraDate.toLocaleString();
			}
		}
		else {
			ret = value.toString();
		}
		return ret;
	}

	var eras = cal.eras,
		sortable = format === "s";
	format = expandFormat( cal, format );

	// Start with an empty string
	ret = [];
	var hour,
		zeros = [ "0", "00", "000" ],
		foundDay,
		checkedDay,
		dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g,
		quoteCount = 0,
		tokenRegExp = getTokenRegExp(),
		converted;

	function padZeros( num, c ) {
		var r, s = num + "";
		if ( c > 1 && s.length < c ) {
			r = ( zeros[c - 2] + s);
			return r.substr( r.length - c, c );
		}
		else {
			r = s;
		}
		return r;
	}

	function hasDay() {
		if ( foundDay || checkedDay ) {
			return foundDay;
		}
		foundDay = dayPartRegExp.test( format );
		checkedDay = true;
		return foundDay;
	}

	function getPart( date, part ) {
		if ( converted ) {
			return converted[ part ];
		}
		switch ( part ) {
			case 0:
				return date.getFullYear();
			case 1:
				return date.getMonth();
			case 2:
				return date.getDate();
			default:
				throw "Invalid part value " + part;
		}
	}

	if ( !sortable && convert ) {
		converted = convert.fromGregorian( value );
	}

	for ( ; ; ) {
		// Save the current index
		var index = tokenRegExp.lastIndex,
			// Look for the next pattern
			ar = tokenRegExp.exec( format );

		// Append the text before the pattern (or the end of the string if not found)
		var preMatch = format.slice( index, ar ? ar.index : format.length );
		quoteCount += appendPreOrPostMatch( preMatch, ret );

		if ( !ar ) {
			break;
		}

		// do not replace any matches that occur inside a string literal.
		if ( quoteCount % 2 ) {
			ret.push( ar[0] );
			continue;
		}

		var current = ar[ 0 ],
			clength = current.length;

		switch ( current ) {
			case "ddd":
				//Day of the week, as a three-letter abbreviation
			case "dddd":
				// Day of the week, using the full name
				var names = ( clength === 3 ) ? cal.days.namesAbbr : cal.days.names;
				ret.push( names[value.getDay()] );
				break;
			case "d":
				// Day of month, without leading zero for single-digit days
			case "dd":
				// Day of month, with leading zero for single-digit days
				foundDay = true;
				ret.push(
					padZeros( getPart(value, 2), clength )
				);
				break;
			case "MMM":
				// Month, as a three-letter abbreviation
			case "MMMM":
				// Month, using the full name
				var part = getPart( value, 1 );
				ret.push(
					( cal.monthsGenitive && hasDay() ) ?
					( cal.monthsGenitive[ clength === 3 ? "namesAbbr" : "names" ][ part ] ) :
					( cal.months[ clength === 3 ? "namesAbbr" : "names" ][ part ] )
				);
				break;
			case "M":
				// Month, as digits, with no leading zero for single-digit months
			case "MM":
				// Month, as digits, with leading zero for single-digit months
				ret.push(
					padZeros( getPart(value, 1) + 1, clength )
				);
				break;
			case "y":
				// Year, as two digits, but with no leading zero for years less than 10
			case "yy":
				// Year, as two digits, with leading zero for years less than 10
			case "yyyy":
				// Year represented by four full digits
				part = converted ? converted[ 0 ] : getEraYear( value, cal, getEra(value, eras), sortable );
				if ( clength < 4 ) {
					part = part % 100;
				}
				ret.push(
					padZeros( part, clength )
				);
				break;
			case "h":
				// Hours with no leading zero for single-digit hours, using 12-hour clock
			case "hh":
				// Hours with leading zero for single-digit hours, using 12-hour clock
				hour = value.getHours() % 12;
				if ( hour === 0 ) hour = 12;
				ret.push(
					padZeros( hour, clength )
				);
				break;
			case "H":
				// Hours with no leading zero for single-digit hours, using 24-hour clock
			case "HH":
				// Hours with leading zero for single-digit hours, using 24-hour clock
				ret.push(
					padZeros( value.getHours(), clength )
				);
				break;
			case "m":
				// Minutes with no leading zero for single-digit minutes
			case "mm":
				// Minutes with leading zero for single-digit minutes
				ret.push(
					padZeros( value.getMinutes(), clength )
				);
				break;
			case "s":
				// Seconds with no leading zero for single-digit seconds
			case "ss":
				// Seconds with leading zero for single-digit seconds
				ret.push(
					padZeros( value.getSeconds(), clength )
				);
				break;
			case "t":
				// One character am/pm indicator ("a" or "p")
			case "tt":
				// Multicharacter am/pm indicator
				part = value.getHours() < 12 ? ( cal.AM ? cal.AM[0] : " " ) : ( cal.PM ? cal.PM[0] : " " );
				ret.push( clength === 1 ? part.charAt(0) : part );
				break;
			case "f":
				// Deciseconds
			case "ff":
				// Centiseconds
			case "fff":
				// Milliseconds
				ret.push(
					padZeros( value.getMilliseconds(), 3 ).substr( 0, clength )
				);
				break;
			case "z":
				// Time zone offset, no leading zero
			case "zz":
				// Time zone offset with leading zero
				hour = value.getTimezoneOffset() / 60;
				ret.push(
					( hour <= 0 ? "+" : "-" ) + padZeros( Math.floor(Math.abs(hour)), clength )
				);
				break;
			case "zzz":
				// Time zone offset with leading zero
				hour = value.getTimezoneOffset() / 60;
				ret.push(
					( hour <= 0 ? "+" : "-" ) + padZeros( Math.floor(Math.abs(hour)), 2 ) +
					// Hard coded ":" separator, rather than using cal.TimeSeparator
					// Repeated here for consistency, plus ":" was already assumed in date parsing.
					":" + padZeros( Math.abs(value.getTimezoneOffset() % 60), 2 )
				);
				break;
			case "g":
			case "gg":
				if ( cal.eras ) {
					ret.push(
						cal.eras[ getEra(value, eras) ].name
					);
				}
				break;
		case "/":
			ret.push( cal["/"] );
			break;
		default:
			throw "Invalid date format pattern \'" + current + "\'.";
		}
	}
	return ret.join( "" );
};

// formatNumber
(function() {
	var expandNumber;

	expandNumber = function( number, precision, formatInfo ) {
		var groupSizes = formatInfo.groupSizes,
			curSize = groupSizes[ 0 ],
			curGroupIndex = 1,
			factor = Math.pow( 10, precision ),
			rounded = Math.round( number * factor ) / factor;

		if ( !isFinite(rounded) ) {
			rounded = number;
		}
		number = rounded;

		var numberString = number+"",
			right = "",
			split = numberString.split( /e/i ),
			exponent = split.length > 1 ? parseInt( split[1], 10 ) : 0;
		numberString = split[ 0 ];
		split = numberString.split( "." );
		numberString = split[ 0 ];
		right = split.length > 1 ? split[ 1 ] : "";

		var l;
		if ( exponent > 0 ) {
			right = zeroPad( right, exponent, false );
			numberString += right.slice( 0, exponent );
			right = right.substr( exponent );
		}
		else if ( exponent < 0 ) {
			exponent = -exponent;
			numberString = zeroPad( numberString, exponent + 1, true );
			right = numberString.slice( -exponent, numberString.length ) + right;
			numberString = numberString.slice( 0, -exponent );
		}

		if ( precision > 0 ) {
			right = formatInfo[ "." ] +
				( (right.length > precision) ? right.slice(0, precision) : zeroPad(right, precision) );
		}
		else {
			right = "";
		}

		var stringIndex = numberString.length - 1,
			sep = formatInfo[ "," ],
			ret = "";

		while ( stringIndex >= 0 ) {
			if ( curSize === 0 || curSize > stringIndex ) {
				return numberString.slice( 0, stringIndex + 1 ) + ( ret.length ? (sep + ret + right) : right );
			}
			ret = numberString.slice( stringIndex - curSize + 1, stringIndex + 1 ) + ( ret.length ? (sep + ret) : "" );

			stringIndex -= curSize;

			if ( curGroupIndex < groupSizes.length ) {
				curSize = groupSizes[ curGroupIndex ];
				curGroupIndex++;
			}
		}

		return numberString.slice( 0, stringIndex + 1 ) + sep + ret + right;
	};

	formatNumber = function( value, format, culture ) {
		if ( !isFinite(value) ) {
			if ( value === Infinity ) {
				return culture.numberFormat.positiveInfinity;
			}
			if ( value === -Infinity ) {
				return culture.numberFormat.negativeInfinity;
			}
			return culture.numberFormat.NaN;
		}
		if ( !format || format === "i" ) {
			return culture.name.length ? value.toLocaleString() : value.toString();
		}
		format = format || "D";

		var nf = culture.numberFormat,
			number = Math.abs( value ),
			precision = -1,
			pattern;
		if ( format.length > 1 ) precision = parseInt( format.slice(1), 10 );

		var current = format.charAt( 0 ).toUpperCase(),
			formatInfo;

		switch ( current ) {
			case "D":
				pattern = "n";
				number = truncate( number );
				if ( precision !== -1 ) {
					number = zeroPad( "" + number, precision, true );
				}
				if ( value < 0 ) number = "-" + number;
				break;
			case "N":
				formatInfo = nf;
				/* falls through */
			case "C":
				formatInfo = formatInfo || nf.currency;
				/* falls through */
			case "P":
				formatInfo = formatInfo || nf.percent;
				pattern = value < 0 ? formatInfo.pattern[ 0 ] : ( formatInfo.pattern[1] || "n" );
				if ( precision === -1 ) precision = formatInfo.decimals;
				number = expandNumber( number * (current === "P" ? 100 : 1), precision, formatInfo );
				break;
			default:
				throw "Bad number format specifier: " + current;
		}

		var patternParts = /n|\$|-|%/g,
			ret = "";
		for ( ; ; ) {
			var index = patternParts.lastIndex,
				ar = patternParts.exec( pattern );

			ret += pattern.slice( index, ar ? ar.index : pattern.length );

			if ( !ar ) {
				break;
			}

			switch ( ar[0] ) {
				case "n":
					ret += number;
					break;
				case "$":
					ret += nf.currency.symbol;
					break;
				case "-":
					// don't make 0 negative
					if ( /[1-9]/.test(number) ) {
						ret += nf[ "-" ];
					}
					break;
				case "%":
					ret += nf.percent.symbol;
					break;
			}
		}

		return ret;
	};

}());

getTokenRegExp = function() {
	// regular expression for matching date and time tokens in format strings.
	return (/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g);
};

getEra = function( date, eras ) {
	if ( !eras ) return 0;
	var start, ticks = date.getTime();
	for ( var i = 0, l = eras.length; i < l; i++ ) {
		start = eras[ i ].start;
		if ( start === null || ticks >= start ) {
			return i;
		}
	}
	return 0;
};

getEraYear = function( date, cal, era, sortable ) {
	var year = date.getFullYear();
	if ( !sortable && cal.eras ) {
		// convert normal gregorian year to era-shifted gregorian
		// year by subtracting the era offset
		year -= cal.eras[ era ].offset;
	}
	return year;
};

// parseExact
(function() {
	var expandYear,
		getDayIndex,
		getMonthIndex,
		getParseRegExp,
		outOfRange,
		toUpper,
		toUpperArray;

	expandYear = function( cal, year ) {
		// expands 2-digit year into 4 digits.
		if ( year < 100 ) {
			var now = new Date(),
				era = getEra( now ),
				curr = getEraYear( now, cal, era ),
				twoDigitYearMax = cal.twoDigitYearMax;
			twoDigitYearMax = typeof twoDigitYearMax === "string" ? new Date().getFullYear() % 100 + parseInt( twoDigitYearMax, 10 ) : twoDigitYearMax;
			year += curr - ( curr % 100 );
			if ( year > twoDigitYearMax ) {
				year -= 100;
			}
		}
		return year;
	};

	getDayIndex = function	( cal, value, abbr ) {
		var ret,
			days = cal.days,
			upperDays = cal._upperDays;
		if ( !upperDays ) {
			cal._upperDays = upperDays = [
				toUpperArray( days.names ),
				toUpperArray( days.namesAbbr ),
				toUpperArray( days.namesShort )
			];
		}
		value = toUpper( value );
		if ( abbr ) {
			ret = arrayIndexOf( upperDays[1], value );
			if ( ret === -1 ) {
				ret = arrayIndexOf( upperDays[2], value );
			}
		}
		else {
			ret = arrayIndexOf( upperDays[0], value );
		}
		return ret;
	};

	getMonthIndex = function( cal, value, abbr ) {
		var months = cal.months,
			monthsGen = cal.monthsGenitive || cal.months,
			upperMonths = cal._upperMonths,
			upperMonthsGen = cal._upperMonthsGen;
		if ( !upperMonths ) {
			cal._upperMonths = upperMonths = [
				toUpperArray( months.names ),
				toUpperArray( months.namesAbbr )
			];
			cal._upperMonthsGen = upperMonthsGen = [
				toUpperArray( monthsGen.names ),
				toUpperArray( monthsGen.namesAbbr )
			];
		}
		value = toUpper( value );
		var i = arrayIndexOf( abbr ? upperMonths[1] : upperMonths[0], value );
		if ( i < 0 ) {
			i = arrayIndexOf( abbr ? upperMonthsGen[1] : upperMonthsGen[0], value );
		}
		return i;
	};

	getParseRegExp = function( cal, format ) {
		// converts a format string into a regular expression with groups that
		// can be used to extract date fields from a date string.
		// check for a cached parse regex.
		var re = cal._parseRegExp;
		if ( !re ) {
			cal._parseRegExp = re = {};
		}
		else {
			var reFormat = re[ format ];
			if ( reFormat ) {
				return reFormat;
			}
		}

		// expand single digit formats, then escape regular expression characters.
		var expFormat = expandFormat( cal, format ).replace( /([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1" ),
			regexp = [ "^" ],
			groups = [],
			index = 0,
			quoteCount = 0,
			tokenRegExp = getTokenRegExp(),
			match;

		// iterate through each date token found.
		while ( (match = tokenRegExp.exec(expFormat)) !== null ) {
			var preMatch = expFormat.slice( index, match.index );
			index = tokenRegExp.lastIndex;

			// don't replace any matches that occur inside a string literal.
			quoteCount += appendPreOrPostMatch( preMatch, regexp );
			if ( quoteCount % 2 ) {
				regexp.push( match[0] );
				continue;
			}

			// add a regex group for the token.
			var m = match[ 0 ],
				len = m.length,
				add;
			switch ( m ) {
				case "dddd": case "ddd":
				case "MMMM": case "MMM":
				case "gg": case "g":
					add = "(\\D+)";
					break;
				case "tt": case "t":
					add = "(\\D*)";
					break;
				case "yyyy":
				case "fff":
				case "ff":
				case "f":
					add = "(\\d{" + len + "})";
					break;
				case "dd": case "d":
				case "MM": case "M":
				case "yy": case "y":
				case "HH": case "H":
				case "hh": case "h":
				case "mm": case "m":
				case "ss": case "s":
					add = "(\\d\\d?)";
					break;
				case "zzz":
					add = "([+-]?\\d\\d?:\\d{2})";
					break;
				case "zz": case "z":
					add = "([+-]?\\d\\d?)";
					break;
				case "/":
					add = "(\\/)";
					break;
				default:
					throw "Invalid date format pattern \'" + m + "\'.";
			}
			if ( add ) {
				regexp.push( add );
			}
			groups.push( match[0] );
		}
		appendPreOrPostMatch( expFormat.slice(index), regexp );
		regexp.push( "$" );

		// allow whitespace to differ when matching formats.
		var regexpStr = regexp.join( "" ).replace( /\s+/g, "\\s+" ),
			parseRegExp = { "regExp": regexpStr, "groups": groups };

		// cache the regex for this format.
		return re[ format ] = parseRegExp;
	};

	outOfRange = function( value, low, high ) {
		return value < low || value > high;
	};

	toUpper = function( value ) {
		// "he-IL" has non-breaking space in weekday names.
		return value.split( "\u00A0" ).join( " " ).toUpperCase();
	};

	toUpperArray = function( arr ) {
		var results = [];
		for ( var i = 0, l = arr.length; i < l; i++ ) {
			results[ i ] = toUpper( arr[i] );
		}
		return results;
	};

	parseExact = function( value, format, culture ) {
		// try to parse the date string by matching against the format string
		// while using the specified culture for date field names.
		value = trim( value );
		var cal = culture.calendar,
			// convert date formats into regular expressions with groupings.
			// use the regexp to determine the input format and extract the date fields.
			parseInfo = getParseRegExp( cal, format ),
			match = new RegExp( parseInfo.regExp ).exec( value );
		if ( match === null ) {
			return null;
		}
		// found a date format that matches the input.
		var groups = parseInfo.groups,
			era = null, year = null, month = null, date = null, weekDay = null,
			hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null,
			pmHour = false;
		// iterate the format groups to extract and set the date fields.
		for ( var j = 0, jl = groups.length; j < jl; j++ ) {
			var matchGroup = match[ j + 1 ];
			if ( matchGroup ) {
				var current = groups[ j ],
					clength = current.length,
					matchInt = parseInt( matchGroup, 10 );
				switch ( current ) {
					case "dd": case "d":
						// Day of month.
						date = matchInt;
						// check that date is generally in valid range, also checking overflow below.
						if ( outOfRange(date, 1, 31) ) return null;
						break;
					case "MMM": case "MMMM":
						month = getMonthIndex( cal, matchGroup, clength === 3 );
						if ( outOfRange(month, 0, 11) ) return null;
						break;
					case "M": case "MM":
						// Month.
						month = matchInt - 1;
						if ( outOfRange(month, 0, 11) ) return null;
						break;
					case "y": case "yy":
					case "yyyy":
						year = clength < 4 ? expandYear( cal, matchInt ) : matchInt;
						if ( outOfRange(year, 0, 9999) ) return null;
						break;
					case "h": case "hh":
						// Hours (12-hour clock).
						hour = matchInt;
						if ( hour === 12 ) hour = 0;
						if ( outOfRange(hour, 0, 11) ) return null;
						break;
					case "H": case "HH":
						// Hours (24-hour clock).
						hour = matchInt;
						if ( outOfRange(hour, 0, 23) ) return null;
						break;
					case "m": case "mm":
						// Minutes.
						min = matchInt;
						if ( outOfRange(min, 0, 59) ) return null;
						break;
					case "s": case "ss":
						// Seconds.
						sec = matchInt;
						if ( outOfRange(sec, 0, 59) ) return null;
						break;
					case "tt": case "t":
						// AM/PM designator.
						// see if it is standard, upper, or lower case PM. If not, ensure it is at least one of
						// the AM tokens. If not, fail the parse for this format.
						pmHour = cal.PM && ( matchGroup === cal.PM[0] || matchGroup === cal.PM[1] || matchGroup === cal.PM[2] );
						if (
							!pmHour && (
								!cal.AM || ( matchGroup !== cal.AM[0] && matchGroup !== cal.AM[1] && matchGroup !== cal.AM[2] )
							)
						) return null;
						break;
					case "f":
						// Deciseconds.
					case "ff":
						// Centiseconds.
					case "fff":
						// Milliseconds.
						msec = matchInt * Math.pow( 10, 3 - clength );
						if ( outOfRange(msec, 0, 999) ) return null;
						break;
					case "ddd":
						// Day of week.
					case "dddd":
						// Day of week.
						weekDay = getDayIndex( cal, matchGroup, clength === 3 );
						if ( outOfRange(weekDay, 0, 6) ) return null;
						break;
					case "zzz":
						// Time zone offset in +/- hours:min.
						var offsets = matchGroup.split( /:/ );
						if ( offsets.length !== 2 ) return null;
						hourOffset = parseInt( offsets[0], 10 );
						if ( outOfRange(hourOffset, -12, 13) ) return null;
						var minOffset = parseInt( offsets[1], 10 );
						if ( outOfRange(minOffset, 0, 59) ) return null;
						tzMinOffset = ( hourOffset * 60 ) + ( startsWith(matchGroup, "-") ? -minOffset : minOffset );
						break;
					case "z": case "zz":
						// Time zone offset in +/- hours.
						hourOffset = matchInt;
						if ( outOfRange(hourOffset, -12, 13) ) return null;
						tzMinOffset = hourOffset * 60;
						break;
					case "g": case "gg":
						var eraName = matchGroup;
						if ( !eraName || !cal.eras ) return null;
						eraName = trim( eraName.toLowerCase() );
						for ( var i = 0, l = cal.eras.length; i < l; i++ ) {
							if ( eraName === cal.eras[i].name.toLowerCase() ) {
								era = i;
								break;
							}
						}
						// could not find an era with that name
						if ( era === null ) return null;
						break;
				}
			}
		}
		var result = new Date(), defaultYear, convert = cal.convert;
		defaultYear = convert ? convert.fromGregorian( result )[ 0 ] : result.getFullYear();
		if ( year === null ) {
			year = defaultYear;
		}
		else if ( cal.eras ) {
			// year must be shifted to normal gregorian year
			// but not if year was not specified, its already normal gregorian
			// per the main if clause above.
			year += cal.eras[( era || 0 )].offset;
		}
		// set default day and month to 1 and January, so if unspecified, these are the defaults
		// instead of the current day/month.
		if ( month === null ) {
			month = 0;
		}
		if ( date === null ) {
			date = 1;
		}
		// now have year, month, and date, but in the culture's calendar.
		// convert to gregorian if necessary
		if ( convert ) {
			result = convert.toGregorian( year, month, date );
			// conversion failed, must be an invalid match
			if ( result === null ) return null;
		}
		else {
			// have to set year, month and date together to avoid overflow based on current date.
			result.setFullYear( year, month, date );
			// check to see if date overflowed for specified month (only checked 1-31 above).
			if ( result.getDate() !== date ) return null;
			// invalid day of week.
			if ( weekDay !== null && result.getDay() !== weekDay ) {
				return null;
			}
		}
		// if pm designator token was found make sure the hours fit the 24-hour clock.
		if ( pmHour && hour < 12 ) {
			hour += 12;
		}
		result.setHours( hour, min, sec, msec );
		if ( tzMinOffset !== null ) {
			// adjust timezone to utc before applying local offset.
			var adjustedMin = result.getMinutes() - ( tzMinOffset + result.getTimezoneOffset() );
			// Safari limits hours and minutes to the range of -127 to 127.  We need to use setHours
			// to ensure both these fields will not exceed this range.	adjustedMin will range
			// somewhere between -1440 and 1500, so we only need to split this into hours.
			result.setHours( result.getHours() + parseInt(adjustedMin / 60, 10), adjustedMin % 60 );
		}
		return result;
	};
}());

parseNegativePattern = function( value, nf, negativePattern ) {
	var neg = nf[ "-" ],
		pos = nf[ "+" ],
		ret;
	switch ( negativePattern ) {
		case "n -":
			neg = " " + neg;
			pos = " " + pos;
			/* falls through */
		case "n-":
			if ( endsWith(value, neg) ) {
				ret = [ "-", value.substr(0, value.length - neg.length) ];
			}
			else if ( endsWith(value, pos) ) {
				ret = [ "+", value.substr(0, value.length - pos.length) ];
			}
			break;
		case "- n":
			neg += " ";
			pos += " ";
			/* falls through */
		case "-n":
			if ( startsWith(value, neg) ) {
				ret = [ "-", value.substr(neg.length) ];
			}
			else if ( startsWith(value, pos) ) {
				ret = [ "+", value.substr(pos.length) ];
			}
			break;
		case "(n)":
			if ( startsWith(value, "(") && endsWith(value, ")") ) {
				ret = [ "-", value.substr(1, value.length - 2) ];
			}
			break;
	}
	return ret || [ "", value ];
};

//
// public instance functions
//

Globalize.prototype.findClosestCulture = function( cultureSelector ) {
	return Globalize.findClosestCulture.call( this, cultureSelector );
};

Globalize.prototype.format = function( value, format, cultureSelector ) {
	return Globalize.format.call( this, value, format, cultureSelector );
};

Globalize.prototype.localize = function( key, cultureSelector ) {
	return Globalize.localize.call( this, key, cultureSelector );
};

Globalize.prototype.parseInt = function( value, radix, cultureSelector ) {
	return Globalize.parseInt.call( this, value, radix, cultureSelector );
};

Globalize.prototype.parseFloat = function( value, radix, cultureSelector ) {
	return Globalize.parseFloat.call( this, value, radix, cultureSelector );
};

Globalize.prototype.culture = function( cultureSelector ) {
	return Globalize.culture.call( this, cultureSelector );
};

//
// public singleton functions
//

Globalize.addCultureInfo = function( cultureName, baseCultureName, info ) {

	var base = {},
		isNew = false;

	if ( typeof cultureName !== "string" ) {
		// cultureName argument is optional string. If not specified, assume info is first
		// and only argument. Specified info deep-extends current culture.
		info = cultureName;
		cultureName = this.culture().name;
		base = this.cultures[ cultureName ];
	} else if ( typeof baseCultureName !== "string" ) {
		// baseCultureName argument is optional string. If not specified, assume info is second
		// argument. Specified info deep-extends specified culture.
		// If specified culture does not exist, create by deep-extending default
		info = baseCultureName;
		isNew = ( this.cultures[ cultureName ] == null );
		base = this.cultures[ cultureName ] || this.cultures[ "default" ];
	} else {
		// cultureName and baseCultureName specified. Assume a new culture is being created
		// by deep-extending an specified base culture
		isNew = true;
		base = this.cultures[ baseCultureName ];
	}

	this.cultures[ cultureName ] = extend(true, {},
		base,
		info
	);
	// Make the standard calendar the current culture if it's a new culture
	if ( isNew ) {
		this.cultures[ cultureName ].calendar = this.cultures[ cultureName ].calendars.standard;
	}
};

Globalize.findClosestCulture = function( name ) {
	var match;
	if ( !name ) {
		return this.findClosestCulture( this.cultureSelector ) || this.cultures[ "default" ];
	}
	if ( typeof name === "string" ) {
		name = name.split( "," );
	}
	if ( isArray(name) ) {
		var lang,
			cultures = this.cultures,
			list = name,
			i, l = list.length,
			prioritized = [];
		for ( i = 0; i < l; i++ ) {
			name = trim( list[i] );
			var pri, parts = name.split( ";" );
			lang = trim( parts[0] );
			if ( parts.length === 1 ) {
				pri = 1;
			}
			else {
				name = trim( parts[1] );
				if ( name.indexOf("q=") === 0 ) {
					name = name.substr( 2 );
					pri = parseFloat( name );
					pri = isNaN( pri ) ? 0 : pri;
				}
				else {
					pri = 1;
				}
			}
			prioritized.push({ lang: lang, pri: pri });
		}
		prioritized.sort(function( a, b ) {
			if ( a.pri < b.pri ) {
				return 1;
			} else if ( a.pri > b.pri ) {
				return -1;
			}
			return 0;
		});
		// exact match
		for ( i = 0; i < l; i++ ) {
			lang = prioritized[ i ].lang;
			match = cultures[ lang ];
			if ( match ) {
				return match;
			}
		}

		// neutral language match
		for ( i = 0; i < l; i++ ) {
			lang = prioritized[ i ].lang;
			do {
				var index = lang.lastIndexOf( "-" );
				if ( index === -1 ) {
					break;
				}
				// strip off the last part. e.g. en-US => en
				lang = lang.substr( 0, index );
				match = cultures[ lang ];
				if ( match ) {
					return match;
				}
			}
			while ( 1 );
		}

		// last resort: match first culture using that language
		for ( i = 0; i < l; i++ ) {
			lang = prioritized[ i ].lang;
			for ( var cultureKey in cultures ) {
				var culture = cultures[ cultureKey ];
				if ( culture.language == lang ) {
					return culture;
				}
			}
		}
	}
	else if ( typeof name === "object" ) {
		return name;
	}
	return match || null;
};

Globalize.format = function( value, format, cultureSelector ) {
	var culture = this.findClosestCulture( cultureSelector );
	if ( value instanceof Date ) {
		value = formatDate( value, format, culture );
	}
	else if ( typeof value === "number" ) {
		value = formatNumber( value, format, culture );
	}
	return value;
};

Globalize.localize = function( key, cultureSelector ) {
	return this.findClosestCulture( cultureSelector ).messages[ key ] ||
		this.cultures[ "default" ].messages[ key ];
};

Globalize.parseDate = function( value, formats, culture ) {
	culture = this.findClosestCulture( culture );

	var date, prop, patterns;
	if ( formats ) {
		if ( typeof formats === "string" ) {
			formats = [ formats ];
		}
		if ( formats.length ) {
			for ( var i = 0, l = formats.length; i < l; i++ ) {
				var format = formats[ i ];
				if ( format ) {
					date = parseExact( value, format, culture );
					if ( date ) {
						break;
					}
				}
			}
		}
	} else {
		patterns = culture.calendar.patterns;
		for ( prop in patterns ) {
			date = parseExact( value, patterns[prop], culture );
			if ( date ) {
				break;
			}
		}
	}

	return date || null;
};

Globalize.parseInt = function( value, radix, cultureSelector ) {
	return truncate( Globalize.parseFloat(value, radix, cultureSelector) );
};

Globalize.parseFloat = function( value, radix, cultureSelector ) {
	// radix argument is optional
	if ( typeof radix !== "number" ) {
		cultureSelector = radix;
		radix = 10;
	}

	var culture = this.findClosestCulture( cultureSelector );
	var ret = NaN,
		nf = culture.numberFormat;

	if ( value.indexOf(culture.numberFormat.currency.symbol) > -1 ) {
		// remove currency symbol
		value = value.replace( culture.numberFormat.currency.symbol, "" );
		// replace decimal seperator
		value = value.replace( culture.numberFormat.currency["."], culture.numberFormat["."] );
	}

	//Remove percentage character from number string before parsing
	if ( value.indexOf(culture.numberFormat.percent.symbol) > -1){
		value = value.replace( culture.numberFormat.percent.symbol, "" );
	}

	// remove spaces: leading, trailing and between - and number. Used for negative currency pt-BR
	value = value.replace( / /g, "" );

	// allow infinity or hexidecimal
	if ( regexInfinity.test(value) ) {
		ret = parseFloat( value );
	}
	else if ( !radix && regexHex.test(value) ) {
		ret = parseInt( value, 16 );
	}
	else {

		// determine sign and number
		var signInfo = parseNegativePattern( value, nf, nf.pattern[0] ),
			sign = signInfo[ 0 ],
			num = signInfo[ 1 ];

		// #44 - try parsing as "(n)"
		if ( sign === "" && nf.pattern[0] !== "(n)" ) {
			signInfo = parseNegativePattern( value, nf, "(n)" );
			sign = signInfo[ 0 ];
			num = signInfo[ 1 ];
		}

		// try parsing as "-n"
		if ( sign === "" && nf.pattern[0] !== "-n" ) {
			signInfo = parseNegativePattern( value, nf, "-n" );
			sign = signInfo[ 0 ];
			num = signInfo[ 1 ];
		}

		sign = sign || "+";

		// determine exponent and number
		var exponent,
			intAndFraction,
			exponentPos = num.indexOf( "e" );
		if ( exponentPos < 0 ) exponentPos = num.indexOf( "E" );
		if ( exponentPos < 0 ) {
			intAndFraction = num;
			exponent = null;
		}
		else {
			intAndFraction = num.substr( 0, exponentPos );
			exponent = num.substr( exponentPos + 1 );
		}
		// determine decimal position
		var integer,
			fraction,
			decSep = nf[ "." ],
			decimalPos = intAndFraction.indexOf( decSep );
		if ( decimalPos < 0 ) {
			integer = intAndFraction;
			fraction = null;
		}
		else {
			integer = intAndFraction.substr( 0, decimalPos );
			fraction = intAndFraction.substr( decimalPos + decSep.length );
		}
		// handle groups (e.g. 1,000,000)
		var groupSep = nf[ "," ];
		integer = integer.split( groupSep ).join( "" );
		var altGroupSep = groupSep.replace( /\u00A0/g, " " );
		if ( groupSep !== altGroupSep ) {
			integer = integer.split( altGroupSep ).join( "" );
		}
		// build a natively parsable number string
		var p = sign + integer;
		if ( fraction !== null ) {
			p += "." + fraction;
		}
		if ( exponent !== null ) {
			// exponent itself may have a number patternd
			var expSignInfo = parseNegativePattern( exponent, nf, "-n" );
			p += "e" + ( expSignInfo[0] || "+" ) + expSignInfo[ 1 ];
		}
		if ( regexParseFloat.test(p) ) {
			ret = parseFloat( p );
		}
	}
	return ret;
};

Globalize.culture = function( cultureSelector ) {
	// setter
	if ( typeof cultureSelector !== "undefined" ) {
		this.cultureSelector = cultureSelector;
	}
	// getter
	return this.findClosestCulture( cultureSelector ) || this.cultures[ "default" ];
};

}( this ));


/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx=a.jqx||{};a.jqx.define=function(b,c,d){b[c]=function(){if(this.baseType){this.base=new b[this.baseType]();this.base.defineInstance()}this.defineInstance()};b[c].prototype.defineInstance=function(){};b[c].prototype.base=null;b[c].prototype.baseType=undefined;if(d&&b[d]){b[c].prototype.baseType=d}};a.jqx.invoke=function(e,d){if(d.length==0){return}var f=typeof(d)==Array||d.length>0?d[0]:d;var c=typeof(d)==Array||d.length>1?Array.prototype.slice.call(d,1):a({}).toArray();while(e[f]==undefined&&e.base!=null){e=e.base}if(e[f]!=undefined&&a.isFunction(e[f])){return e[f].apply(e,c)}if(typeof f=="string"){var b=f.toLowerCase();if(e[b]!=undefined&&a.isFunction(e[b])){return e[b].apply(e,c)}}return};a.jqx.hasProperty=function(c,b){if(typeof(b)=="object"){for(var e in b){var d=c;while(d){if(d.hasOwnProperty(e)){return true}if(d.hasOwnProperty(e.toLowerCase())){return true}d=d.base}return false}}else{while(c){if(c.hasOwnProperty(b)){return true}if(c.hasOwnProperty(b.toLowerCase())){return true}c=c.base}}return false};a.jqx.hasFunction=function(e,d){if(d.length==0){return false}if(e==undefined){return false}var f=typeof(d)==Array||d.length>0?d[0]:d;var c=typeof(d)==Array||d.length>1?Array.prototype.slice.call(d,1):{};while(e[f]==undefined&&e.base!=null){e=e.base}if(e[f]&&a.isFunction(e[f])){return true}if(typeof f=="string"){var b=f.toLowerCase();if(e[b]&&a.isFunction(e[b])){return true}}return false};a.jqx.isPropertySetter=function(c,b){if(b.length==1&&typeof(b[0])=="object"){return true}if(b.length==2&&typeof(b[0])=="string"&&!a.jqx.hasFunction(c,b)){return true}return false};a.jqx.validatePropertySetter=function(f,d,b){if(!a.jqx.propertySetterValidation){return true}if(d.length==1&&typeof(d[0])=="object"){for(var e in d[0]){var g=f;while(!g.hasOwnProperty(e)&&g.base){g=g.base}if(!g||!g.hasOwnProperty(e)){if(!b){var c=g.hasOwnProperty(e.toString().toLowerCase());if(!c){throw"Invalid property: "+e}else{return true}}return false}}return true}if(d.length!=2){if(!b){throw"Invalid property: "+d.length>=0?d[0]:""}return false}while(!f.hasOwnProperty(d[0])&&f.base){f=f.base}if(!f||!f.hasOwnProperty(d[0])){if(!b){throw"Invalid property: "+d[0]}return false}return true};a.jqx.set=function(c,b){if(b.length==1&&typeof(b[0])=="object"){a.each(b[0],function(d,e){var f=c;while(!f.hasOwnProperty(d)&&f.base!=null){f=f.base}if(f.hasOwnProperty(d)){a.jqx.setvalueraiseevent(f,d,e)}else{if(f.hasOwnProperty(d.toLowerCase())){a.jqx.setvalueraiseevent(f,d.toLowerCase(),e)}else{if(a.jqx.propertySetterValidation){throw"jqxCore: invalid property '"+d+"'"}}}})}else{if(b.length==2){while(!c.hasOwnProperty(b[0])&&c.base){c=c.base}if(c.hasOwnProperty(b[0])){a.jqx.setvalueraiseevent(c,b[0],b[1])}else{if(c.hasOwnProperty(b[0].toLowerCase())){a.jqx.setvalueraiseevent(c,b[0].toLowerCase(),b[1])}else{if(a.jqx.propertySetterValidation){throw"jqxCore: invalid property '"+b[0]+"'"}}}}}};a.jqx.setvalueraiseevent=function(c,d,e){var b=c[d];c[d]=e;if(!c.isInitialized){return}if(c.propertyChangedHandler!=undefined){c.propertyChangedHandler(c,d,b,e)}if(c.propertyChangeMap!=undefined&&c.propertyChangeMap[d]!=undefined){c.propertyChangeMap[d](c,d,b,e)}};a.jqx.get=function(e,d){if(d==undefined||d==null){return undefined}if(e.propertyMap){var c=e.propertyMap(d);if(c!=null){return c}}if(e.hasOwnProperty(d)){return e[d]}if(e.hasOwnProperty(d.toLowerCase())){return e[d.toLowerCase()]}var b=undefined;if(typeof(d)==Array){if(d.length!=1){return undefined}b=d[0]}else{if(typeof(d)=="string"){b=d}}while(!e.hasOwnProperty(b)&&e.base){e=e.base}if(e){return e[b]}return undefined};a.jqx.serialize=function(e){var b="";if(a.isArray(e)){b="[";for(var d=0;d<e.length;d++){if(d>0){b+=", "}b+=a.jqx.serialize(e[d])}b+="]"}else{if(typeof(e)=="object"){b="{";var c=0;for(var d in e){if(c++>0){b+=", "}b+=d+": "+a.jqx.serialize(e[d])}b+="}"}else{b=e.toString()}}return b};a.jqx.propertySetterValidation=true;a.jqx.jqxWidgetProxy=function(g,c,b){var d=a(c);var f=a.data(c,g);if(f==undefined){return undefined}var e=f.instance;if(a.jqx.hasFunction(e,b)){return a.jqx.invoke(e,b)}if(a.jqx.isPropertySetter(e,b)){if(a.jqx.validatePropertySetter(e,b)){a.jqx.set(e,b);return undefined}}else{if(typeof(b)=="object"&&b.length==0){return}else{if(typeof(b)=="object"&&b.length==1&&a.jqx.hasProperty(e,b[0])){return a.jqx.get(e,b[0])}else{if(typeof(b)=="string"&&a.jqx.hasProperty(e,b[0])){return a.jqx.get(e,b)}}}}throw"jqxCore: Invalid parameter '"+a.jqx.serialize(b)+"' does not exist.";return undefined};a.jqx.jqxWidget=function(b,d,j){var c=false;try{jqxArgs=Array.prototype.slice.call(j,0)}catch(h){jqxArgs=""}try{c=window.MSApp!=undefined}catch(h){}var g=b;var f="";if(d){f="_"+d}a.jqx.define(a.jqx,"_"+g,f);a.fn[g]=function(){var e=Array.prototype.slice.call(arguments,0);var k=null;if(e.length==0||(e.length==1&&typeof(e[0])=="object")){if(this.length==0){if(this.selector){throw new Error("Invalid jQuery Selector - "+this.selector+"! Please, check whether the used ID or CSS Class name is correct.")}else{throw new Error("Invalid jQuery Selector! Please, check whether the used ID or CSS Class name is correct.")}}return this.each(function(){var o=a(this);var n=this;var q=a.data(n,g);if(q==null){q={};q.element=n;q.host=o;q.instance=new a.jqx["_"+g]();if(n.id==""){n.id=a.jqx.utilities.createId()}q.instance.get=q.instance.set=q.instance.call=function(){var r=Array.prototype.slice.call(arguments,0);return a.jqx.jqxWidgetProxy(g,n,r)};a.data(n,g,q);a.data(n,"jqxWidget",q.instance);var p=new Array();var l=q.instance;while(l){l.isInitialized=false;p.push(l);l=l.base}p.reverse();p[0].theme="";a.jqx.jqxWidgetProxy(g,this,e);for(var m in p){l=p[m];if(m==0){l.host=o;l.element=n;l.WinJS=c}if(l!=undefined){if(l.createInstance!=null){if(c){MSApp.execUnsafeLocalFunction(function(){l.createInstance(e)})}else{l.createInstance(e)}}}}for(var m in p){if(p[m]!=undefined){p[m].isInitialized=true}}if(c){MSApp.execUnsafeLocalFunction(function(){q.instance.refresh(true)})}else{q.instance.refresh(true)}k=this}else{a.jqx.jqxWidgetProxy(g,this,e)}})}else{if(this.length==0){if(this.selector){throw new Error("Invalid jQuery Selector - "+this.selector+"! Please, check whether the used ID or CSS Class name is correct.")}else{throw new Error("Invalid jQuery Selector! Please, check whether the used ID or CSS Class name is correct.")}}this.each(function(){var l=a.jqx.jqxWidgetProxy(g,this,e);if(k==null){k=l}})}return k};try{a.extend(a.jqx["_"+g].prototype,Array.prototype.slice.call(j,0)[0])}catch(h){}a.extend(a.jqx["_"+g].prototype,{toThemeProperty:function(e,k){if(this.theme==""){return e}if(k!=null&&k){return e+"-"+this.theme}return e+" "+e+"-"+this.theme}});a.jqx["_"+g].prototype.refresh=function(){if(this.base){this.base.refresh()}};a.jqx["_"+g].prototype.createInstance=function(){};a.jqx["_"+g].prototype.propertyChangeMap={};a.jqx["_"+g].prototype.addHandler=function(m,k,e,l){switch(k){case"mousewheel":if(window.addEventListener){if(a.jqx.browser.mozilla){m[0].addEventListener("DOMMouseScroll",e,false)}else{m[0].addEventListener("mousewheel",e,false)}return false}break;case"mousemove":if(window.addEventListener&&!l){m[0].addEventListener("mousemove",e,false);return false}break}if(l==undefined||l==null){if(m.on){m.on(k,e)}else{m.bind(k,e)}}else{if(m.on){m.on(k,l,e)}else{m.bind(k,l,e)}}};a.jqx["_"+g].prototype.removeHandler=function(l,k,e){switch(k){case"mousewheel":if(window.removeEventListener){if(a.jqx.browser.mozilla){l[0].removeEventListener("DOMMouseScroll",e,false)}else{l[0].removeEventListener("mousewheel",e,false)}return false}break;case"mousemove":if(e){if(window.removeEventListener){l[0].removeEventListener("mousemove",e,false)}}break}if(k==undefined){if(l.off){l.off()}else{l.unbind()}return}if(e==undefined){if(l.off){l.off(k)}else{l.unbind(k)}}else{if(l.off){l.off(k,e)}else{l.unbind(k,e)}}}};a.jqx.utilities=a.jqx.utilities||{};a.extend(a.jqx.utilities,{scrollBarSize:15,touchScrollBarSize:10,createId:function(){var b=function(){return(((1+Math.random())*65536)|0).toString(16).substring(1)};return"jqxWidget"+b()+b()},setTheme:function(f,g,e){if(typeof e==="undefined"){return}var h=e[0].className.split(" "),b=[],j=[],d=e.children();for(var c=0;c<h.length;c+=1){if(h[c].indexOf(f)>=0){if(f.length>0){b.push(h[c]);j.push(h[c].replace(f,g))}else{j.push(h[c]+"-"+g)}}}this._removeOldClasses(b,e);this._addNewClasses(j,e);for(var c=0;c<d.length;c+=1){this.setTheme(f,g,a(d[c]))}},_removeOldClasses:function(d,c){for(var b=0;b<d.length;b+=1){c.removeClass(d[b])}},_addNewClasses:function(d,c){for(var b=0;b<d.length;b+=1){c.addClass(d[b])}},getOffset:function(b){var d=a.jqx.mobile.getLeftPos(b[0]);var c=a.jqx.mobile.getTopPos(b[0]);return{top:c,left:d}},resize:function(d,m,l,k){if(k===undefined){k=true}var g=-1;var f=this;var c=function(o){if(!f.hiddenWidgets){return -1}var p=-1;for(var n=0;n<f.hiddenWidgets.length;n++){if(o.id){if(f.hiddenWidgets[n].id==o.id){p=n;break}}else{if(f.hiddenWidgets[n].id==o[0].id){p=n;break}}}return p};if(this.resizeHandlers){for(var e=0;e<this.resizeHandlers.length;e++){if(d.id){if(this.resizeHandlers[e].id==d.id){g=e;break}}else{if(this.resizeHandlers[e].id==d[0].id){g=e;break}}}if(l===true){if(g!=-1){this.resizeHandlers.splice(g,1)}if(this.resizeHandlers.length==0){var j=a(window);if(j.off){j.off("resize.jqx");j.off("orientationchange.jqx");j.off("orientationchanged.jqx")}else{j.unbind("resize.jqx");j.unbind("orientationchange.jqx");j.unbind("orientationchanged.jqx")}this.resizeHandlers=null}var b=c(d);if(b!=-1&&this.hiddenWidgets){this.hiddenWidgets.splice(b,1)}return}}else{if(l===true){var b=c(d);if(b!=-1&&this.hiddenWidgets){this.hiddenWidgets.splice(b,1)}return}}var f=this;var h=function(n,o){if(!f.resizeHandlers){return}var p=function(t,r){var s=t.widget.parents().length;var q=r.widget.parents().length;try{if(s<q){return -1}if(s>q){return 1}}catch(u){var v=u}return 0};f.hiddenWidgets=new Array();f.resizeHandlers.sort(p);a.each(f.resizeHandlers,function(s,v){var u=this.widget.data();if(!u){return true}if(!u.jqxWidget){return true}var t=u.jqxWidget.width;var q=u.jqxWidget.height;var r=false;if(t!=null&&t.toString().indexOf("%")!=-1){r=true}if(q!=null&&q.toString().indexOf("%")!=-1){r=true}if(a.jqx.isHidden(this.widget)){if(c(this.widget)===-1){f.hiddenWidgets.push(this)}}else{if(n===undefined||n!==true){if(r){this.callback(o);if(f.hiddenWidgets.indexOf(this)>=0){f.hiddenWidgets.splice(f.hiddenWidgets.indexOf(this),1)}}}}});if(f.hiddenWidgets.length>0){f.hiddenWidgets.sort(p);if(f.__resizeInterval){clearInterval(f.__resizeInterval)}f.__resizeInterval=setInterval(function(){var q=false;var r=new Array();a.each(f.hiddenWidgets,function(s,t){if(a.jqx.isHidden(this.widget)){q=true;r.push(this)}else{this.callback(o)}});f.hiddenWidgets=r;if(!q){clearInterval(f.__resizeInterval)}},100)}};if(!this.resizeHandlers){this.resizeHandlers=new Array();var j=a(window);if(j.on){j.on("resize.jqx",function(n){h(null,"resize")});j.on("orientationchange.jqx",function(n){h(null,"orientationchange")});j.on("orientationchanged.jqx",function(n){h(null,"orientationchange")})}else{j.bind("resize.jqx",function(n){h(null,"orientationchange")});j.bind("orientationchange.jqx",function(n){h(null,"orientationchange")});j.bind("orientationchanged.jqx",function(n){h(null,"orientationchange")})}}if(k){if(g===-1){this.resizeHandlers.push({id:d[0].id,widget:d,callback:m})}}if(a.jqx.isHidden(d)&&k===true){h(true)}},html:function(c,d){if(!a(c).on){return a(c).html(d)}try{return jQuery.access(c,function(s){var f=c[0]||{},m=0,j=c.length;if(s===undefined){return f.nodeType===1?f.innerHTML.replace(rinlinejQuery,""):undefined}var r=/<(?:script|style|link)/i,n="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",h=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,p=/<([\w:]+)/,g=/<(?:script|object|embed|option|style)/i,k=new RegExp("<(?:"+n+")[\\s/>]","i"),q=/^\s+/,t={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};if(typeof s==="string"&&!r.test(s)&&(jQuery.support.htmlSerialize||!k.test(s))&&(jQuery.support.leadingWhitespace||!q.test(s))&&!t[(p.exec(s)||["",""])[1].toLowerCase()]){s=s.replace(h,"<$1></$2>");try{for(;m<j;m++){f=this[m]||{};if(f.nodeType===1){jQuery.cleanData(f.getElementsByTagName("*"));f.innerHTML=s}}f=0}catch(o){}}if(f){c.empty().append(s)}},null,d,arguments.length)}catch(b){return a(c).html(d)}},hasTransform:function(d){var c="";c=d.css("transform");if(c==""||c=="none"){c=d.parents().css("transform");if(c==""||c=="none"){var b=a.jqx.utilities.getBrowser();if(b.browser=="msie"){c=d.css("-ms-transform");if(c==""||c=="none"){c=d.parents().css("-ms-transform")}}else{if(b.browser=="chrome"){c=d.css("-webkit-transform");if(c==""||c=="none"){c=d.parents().css("-webkit-transform")}}else{if(b.browser=="opera"){c=d.css("-o-transform");if(c==""||c=="none"){c=d.parents().css("-o-transform")}}else{if(b.browser=="mozilla"){c=d.css("-moz-transform");if(c==""||c=="none"){c=d.parents().css("-moz-transform")}}}}}}else{return c!=""&&c!="none"}}if(c==""||c=="none"){c=a(document.body).css("transform")}return c!=""&&c!="none"&&c!=null},getBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(c)||/(webkit)[ \/]([\w.]+)/.exec(c)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(c)||/(msie) ([\w.]+)/.exec(c)||c.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(c)||[];var d={browser:b[1]||"",version:b[2]||"0"};d[b[1]]=b[1];return d}});a.jqx.browser=a.jqx.utilities.getBrowser();a.jqx.isHidden=function(d){try{var b=d[0].offsetWidth,e=d[0].offsetHeight;if(b===0||e===0){return true}else{return false}}catch(c){return false}};a.jqx.ariaEnabled=true;a.jqx.aria=function(c,e,d){if(!a.jqx.ariaEnabled){return}if(e==undefined){a.each(c.aria,function(g,h){var k=!c.base?c.host.attr(g):c.base.host.attr(g);if(k!=undefined&&!a.isFunction(k)){var j=k;switch(h.type){case"number":j=new Number(k);if(isNaN(j)){j=k}break;case"boolean":j=k=="true"?true:false;break;case"date":j=new Date(k);if(j=="Invalid Date"||isNaN(j)){j=k}break}c[h.name]=j}else{var k=c[h.name];if(a.isFunction(k)){k=c[h.name]()}if(k==undefined){k=""}try{!c.base?c.host.attr(g,k.toString()):c.base.host.attr(g,k.toString())}catch(f){}}})}else{try{if(c.host){if(!c.base){if(c.host){if(c.element.setAttribute){c.element.setAttribute(e,d.toString())}else{c.host.attr(e,d.toString())}}else{c.attr(e,d.toString())}}else{if(c.base.host){c.base.host.attr(e,d.toString())}else{c.attr(e,d.toString())}}}else{if(c.setAttribute){c.setAttribute(e,d.toString())}}}catch(b){}}};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(c){var b=this.length;var d=Number(arguments[1])||0;d=(d<0)?Math.ceil(d):Math.floor(d);if(d<0){d+=b}for(;d<b;d++){if(d in this&&this[d]===c){return d}}return -1}}a.jqx.mobile=a.jqx.mobile||{};a.jqx.position=function(b){var e=parseInt(b.pageX);var d=parseInt(b.pageY);if(a.jqx.mobile.isTouchDevice()){var c=a.jqx.mobile.getTouches(b);var f=c[0];e=parseInt(f.pageX);d=parseInt(f.pageY)}return{left:e,top:d}};a.extend(a.jqx.mobile,{_touchListener:function(h,f){var b=function(j,l){var k=document.createEvent("MouseEvents");k.initMouseEvent(j,l.bubbles,l.cancelable,l.view,l.detail,l.screenX,l.screenY,l.clientX,l.clientY,l.ctrlKey,l.altKey,l.shiftKey,l.metaKey,l.button,l.relatedTarget);k._pageX=l.pageX;k._pageY=l.pageY;return k};var g={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"};var d=b(g[h.type],h);h.target.dispatchEvent(d);var c=h.target["on"+g[h.type]];if(typeof c==="function"){c(h)}},setMobileSimulator:function(c,e){if(this.isTouchDevice()){return}this.simulatetouches=true;if(e==false){this.simulatetouches=false}var d={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"};var b=this;if(window.addEventListener){var f=function(){for(var g in d){if(c.addEventListener){c.removeEventListener(g,b._touchListener);c.addEventListener(g,b._touchListener,false)}}};if(a.jqx.browser.msie){f()}else{f()}}},isTouchDevice:function(){if(this.touchDevice!=undefined){return this.touchDevice}var b="Browser CodeName: "+navigator.appCodeName+"";b+="Browser Name: "+navigator.appName+"";b+="Browser Version: "+navigator.appVersion+"";b+="Platform: "+navigator.platform+"";b+="User-agent header: "+navigator.userAgent+"";if(b.indexOf("Android")!=-1){return true}if(b.indexOf("IEMobile")!=-1){return true}if(b.indexOf("Windows Phone")!=-1){return true}if(b.indexOf("WPDesktop")!=-1){return true}if(b.indexOf("ZuneWP7")!=-1){return true}if(b.indexOf("BlackBerry")!=-1&&b.indexOf("Mobile Safari")!=-1){return true}if(b.indexOf("ipod")!=-1){return true}if(b.indexOf("nokia")!=-1||b.indexOf("Nokia")!=-1){return true}if(b.indexOf("Chrome/17")!=-1){return false}if(b.indexOf("CrOS")!=-1){return false}if(b.indexOf("Opera")!=-1&&b.indexOf("Mobi")==-1&&b.indexOf("Mini")==-1&&b.indexOf("Platform: Win")!=-1){return false}if(b.indexOf("Opera")!=-1&&b.indexOf("Mobi")!=-1&&b.indexOf("Opera Mobi")!=-1){return true}var c={ios:"i(?:Pad|Phone|Pod)(?:.*)CPU(?: iPhone)? OS ",android:"(Android |HTC_|Silk/)",blackberry:"BlackBerry(?:.*)Version/",rimTablet:"RIM Tablet OS ",webos:"(?:webOS|hpwOS)/",bada:"Bada/"};try{if(this.touchDevice!=undefined){return this.touchDevice}this.touchDevice=false;for(i in c){if(c.hasOwnProperty(i)){prefix=c[i];match=b.match(new RegExp("(?:"+prefix+")([^\\s;]+)"));if(match){if(i.toString()=="blackberry"){this.touchDevice=false;return false}this.touchDevice=true;return true}}}if(navigator.platform.toLowerCase().indexOf("win")!=-1){this.touchDevice=false;return false}document.createEvent("TouchEvent");this.touchDevice=true;return this.touchDevice}catch(d){this.touchDevice=false;return false}},getLeftPos:function(b){var c=b.offsetLeft;while((b=b.offsetParent)!=null){if(b.tagName!="HTML"){c+=b.offsetLeft;if(document.all){c+=b.clientLeft}}}return c},getTopPos:function(c){var e=c.offsetTop;var b=a(c).coord();while((c=c.offsetParent)!=null){if(c.tagName!="HTML"){e+=(c.offsetTop-c.scrollTop);if(document.all){e+=c.clientTop}}}var d=navigator.userAgent.toLowerCase();var f=(d.indexOf("windows phone")!=-1||d.indexOf("WPDesktop")!=-1||d.indexOf("ZuneWP7")!=-1||d.indexOf("msie 9")!=-1||d.indexOf("msie 11")!=-1||d.indexOf("msie 10")!=-1)&&d.indexOf("touch")!=-1;if(f){return b.top}if(this.isSafariMobileBrowser()){if(this.isSafari4MobileBrowser()&&this.isIPadSafariMobileBrowser()){return e}if(d.indexOf("version/7")!=-1){return b.top}e=e+a(window).scrollTop()}return e},isChromeMobileBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=c.indexOf("android")!=-1;return b},isOperaMiniMobileBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=c.indexOf("opera mini")!=-1||c.indexOf("opera mobi")!=-1;return b},isOperaMiniBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=c.indexOf("opera mini")!=-1;return b},isNewSafariMobileBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=c.indexOf("ipad")!=-1||c.indexOf("iphone")!=-1||c.indexOf("ipod")!=-1;b=b&&(c.indexOf("version/5")!=-1);return b},isSafari4MobileBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=c.indexOf("ipad")!=-1||c.indexOf("iphone")!=-1||c.indexOf("ipod")!=-1;b=b&&(c.indexOf("version/4")!=-1);return b},isWindowsPhone:function(){var c=navigator.userAgent.toLowerCase();var b=(c.indexOf("windows phone")!=-1||c.indexOf("WPDesktop")!=-1||c.indexOf("ZuneWP7")!=-1||c.indexOf("msie 9")!=-1||c.indexOf("msie 11")!=-1||c.indexOf("msie 10")!=-1)&&c.indexOf("touch")!=-1;return b},isSafariMobileBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=c.indexOf("ipad")!=-1||c.indexOf("iphone")!=-1||c.indexOf("ipod")!=-1;return b},isIPadSafariMobileBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=c.indexOf("ipad")!=-1;return b},isMobileBrowser:function(){var c=navigator.userAgent.toLowerCase();var b=c.indexOf("ipad")!=-1||c.indexOf("iphone")!=-1||c.indexOf("android")!=-1;return b},getTouches:function(b){if(b.originalEvent){if(b.originalEvent.touches&&b.originalEvent.touches.length){return b.originalEvent.touches}else{if(b.originalEvent.changedTouches&&b.originalEvent.changedTouches.length){return b.originalEvent.changedTouches}}}if(!b.touches){b.touches=new Array();b.touches[0]=b.originalEvent!=undefined?b.originalEvent:b;if(b.originalEvent!=undefined&&b.pageX){b.touches[0]=b}if(b.type=="mousemove"){b.touches[0]=b}}return b.touches},getTouchEventName:function(b){if(this.isWindowsPhone()){if(b.toLowerCase().indexOf("start")!=-1){return"MSPointerDown"}if(b.toLowerCase().indexOf("move")!=-1){return"MSPointerMove"}if(b.toLowerCase().indexOf("end")!=-1){return"MSPointerUp"}}else{return b}},dispatchMouseEvent:function(b,f,d){if(this.simulatetouches){return}var c=document.createEvent("MouseEvent");c.initMouseEvent(b,true,true,f.view,1,f.screenX,f.screenY,f.clientX,f.clientY,false,false,false,false,0,null);if(d!=null){d.dispatchEvent(c)}},getRootNode:function(b){while(b.nodeType!==1){b=b.parentNode}return b},setTouchScroll:function(b,c){if(!this.enableScrolling){this.enableScrolling=[]}this.enableScrolling[c]=b},touchScroll:function(d,y,g,D,b,k){if(d==null){return}var B=this;var t=0;var j=0;var l=0;var u=0;var m=0;var n=0;if(!this.scrolling){this.scrolling=[]}this.scrolling[D]=false;var h=false;var q=a(d);var v=["select","input","textarea"];var c=0;var e=0;if(!this.enableScrolling){this.enableScrolling=[]}this.enableScrolling[D]=true;var D=D;var C=this.getTouchEventName("touchstart")+".touchScroll";var p=this.getTouchEventName("touchend")+".touchScroll";var A=this.getTouchEventName("touchmove")+".touchScroll";var c=function(E){if(!B.enableScrolling[D]){return true}if(a.inArray(E.target.tagName.toLowerCase(),v)!==-1){return}var F=B.getTouches(E);var G=F[0];if(F.length==1){B.dispatchMouseEvent("mousedown",G,B.getRootNode(G.target))}h=false;j=G.pageY;m=G.pageX;if(B.simulatetouches){j=G._pageY;m=G._pageX}B.scrolling[D]=true;t=0;u=0;return true};if(q.on){q.on(C,c)}else{q.bind(C,c)}var x=function(J){if(!B.enableScrolling[D]){return true}if(!B.scrolling[D]){return true}var L=B.getTouches(J);if(L.length>1){return true}var H=L[0].pageY;var I=L[0].pageX;if(B.simulatetouches){H=L[0]._pageY;I=L[0]._pageX}var E=H-j;var F=I-m;e=H;touchHorizontalEnd=I;l=E-t;n=F-u;h=true;t=E;u=F;g(-n*1,-l*1,F,E,J);var G=b!=null?b[0].style.display!="none":true;var K=k!=null?k[0].style.display!="none":true;if(G||K){if((n!==0&&G)||(l!==0&&K)){J.preventDefault();J.stopPropagation();if(J.preventManipulation){J.preventManipulation()}return false}}};if(q.on){q.on(A,x)}else{q.bind(A,x)}if(this.simulatetouches){var o=a(window).on!=undefined||a(window).bind;var z=function(E){B.scrolling[D]=false};a(window).on!=undefined?a(document).on("mouseup.touchScroll",z):a(document).bind("mouseup.touchScroll",z);if(window.frameElement){if(window.top!=null){var r=function(E){B.scrolling[D]=false};if(window.top.document){a(window.top.document).on?a(window.top.document).on("mouseup",r):a(window.top.document).bind("mouseup",r)}}}var s=a(document).on!=undefined||a(document).bind;var w=function(E){if(!B.scrolling[D]){return true}B.scrolling[D]=false;var G=B.getTouches(E)[0],F=B.getRootNode(G.target);B.dispatchMouseEvent("mouseup",G,F);B.dispatchMouseEvent("click",G,F)};a(document).on!=undefined?a(document).on("touchend",w):a(document).bind("touchend",w)}var f=function(E){if(!B.enableScrolling[D]){return true}var G=B.getTouches(E)[0];if(!B.scrolling[D]){return true}B.scrolling[D]=false;if(h){B.dispatchMouseEvent("mouseup",G,F)}else{var G=B.getTouches(E)[0],F=B.getRootNode(G.target);B.dispatchMouseEvent("mouseup",G,F);B.dispatchMouseEvent("click",G,F);return true}};q.on?q.on(p+" touchcancel.touchScroll",f):q.bind(p+" touchcancel.touchScroll",f)}});a.jqx.cookie=a.jqx.cookie||{};a.extend(a.jqx.cookie,{cookie:function(e,f,c){if(arguments.length>1&&String(f)!=="[object Object]"){c=jQuery.extend({},c);if(f===null||f===undefined){c.expires=-1}if(typeof c.expires==="number"){var h=c.expires,d=c.expires=new Date();d.setDate(d.getDate()+h)}f=String(f);return(document.cookie=[encodeURIComponent(e),"=",c.raw?f:encodeURIComponent(f),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join(""))}c=f||{};var b,g=c.raw?function(j){return j}:decodeURIComponent;return(b=new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)").exec(document.cookie))?g(b[1]):null}});a.jqx.string=a.jqx.string||{};a.extend(a.jqx.string,{replace:function(f,d,e){if(d===e){return this}var b=f;var c=b.indexOf(d);while(c!=-1){b=b.replace(d,e);c=b.indexOf(d)}return b},contains:function(b,c){if(b==null||c==null){return false}return b.indexOf(c)!=-1},containsIgnoreCase:function(b,c){if(b==null||c==null){return false}return b.toUpperCase().indexOf(c.toUpperCase())!=-1},equals:function(b,c){if(b==null||c==null){return false}b=this.normalize(b);if(c.length==b.length){return b.slice(0,c.length)==c}return false},equalsIgnoreCase:function(b,c){if(b==null||c==null){return false}b=this.normalize(b);if(c.length==b.length){return b.toUpperCase().slice(0,c.length)==c.toUpperCase()}return false},startsWith:function(b,c){if(b==null||c==null){return false}return b.slice(0,c.length)==c},startsWithIgnoreCase:function(b,c){if(b==null||c==null){return false}return b.toUpperCase().slice(0,c.length)==c.toUpperCase()},normalize:function(b){if(b.charCodeAt(b.length-1)==65279){b=b.substring(0,b.length-1)}return b},endsWith:function(b,c){if(b==null||c==null){return false}b=this.normalize(b);return b.slice(-c.length)==c},endsWithIgnoreCase:function(b,c){if(b==null||c==null){return false}b=this.normalize(b);return b.toUpperCase().slice(-c.length)==c.toUpperCase()}});a.extend(jQuery.easing,{easeOutBack:function(f,g,e,k,j,h){if(h==undefined){h=1.70158}return k*((g=g/j-1)*g*((h+1)*g+h)+1)+e},easeInQuad:function(f,g,e,j,h){return j*(g/=h)*g+e},easeInOutCirc:function(f,g,e,j,h){if((g/=h/2)<1){return -j/2*(Math.sqrt(1-g*g)-1)+e}return j/2*(Math.sqrt(1-(g-=2)*g)+1)+e},easeInOutSine:function(f,g,e,j,h){return -j/2*(Math.cos(Math.PI*g/h)-1)+e},easeInCubic:function(f,g,e,j,h){return j*(g/=h)*g*g+e},easeOutCubic:function(f,g,e,j,h){return j*((g=g/h-1)*g*g+1)+e},easeInOutCubic:function(f,g,e,j,h){if((g/=h/2)<1){return j/2*g*g*g+e}return j/2*((g-=2)*g*g+2)+e},easeInSine:function(f,g,e,j,h){return -j*Math.cos(g/h*(Math.PI/2))+j+e},easeOutSine:function(f,g,e,j,h){return j*Math.sin(g/h*(Math.PI/2))+e},easeInOutSine:function(f,g,e,j,h){return -j/2*(Math.cos(Math.PI*g/h)-1)+e}})})(jQuery);(function(b){b.extend(jQuery.event.special,{close:{noBubble:true},open:{noBubble:true},expand:{noBubble:true},collapse:{noBubble:true},tabclick:{noBubble:true},selected:{noBubble:true},expanded:{noBubble:true},collapsed:{noBubble:true},valuechanged:{noBubble:true},expandedItem:{noBubble:true},collapsedItem:{noBubble:true},expandingItem:{noBubble:true},collapsingItem:{noBubble:true}});b.fn.extend({ischildof:function(f){var d=b(this).parents().get();for(var c=0;c<d.length;c++){if(typeof f!="string"){var e=d[c];if(f!==undefined){if(e==f[0]){return true}}}else{if(f!==undefined){if(b(d[c]).is(f)){return true}}}}return false}});var a=this.originalVal=b.fn.val;b.fn.val=function(d){if(typeof d=="undefined"){if(b(this).hasClass("jqx-widget")){var c=b(this).data().jqxWidget;if(c&&c.val){return c.val()}}return a.call(this)}else{if(b(this).hasClass("jqx-widget")){var c=b(this).data().jqxWidget;if(c&&c.val){if(arguments.length!=2){return c.val(d)}else{return c.val(d,arguments[1])}}}return a.call(this,d)}};b.fn.coord=function(o){var e,k,j={top:0,left:0},f=this[0],m=f&&f.ownerDocument;if(!m){return}e=m.documentElement;if(!jQuery.contains(e,f)){return j}if(typeof f.getBoundingClientRect!==undefined){j=f.getBoundingClientRect()}var d=function(p){return jQuery.isWindow(p)?p:p.nodeType===9?p.defaultView||p.parentWindow:false};k=d(m);var h=0;var c=0;var g=navigator.userAgent.toLowerCase();var n=g.indexOf("ipad")!=-1||g.indexOf("iphone")!=-1;if(n){h=2}if(true==o){if(b(document.body).css("position")!="static"){var l=b(document.body).coord();h=-l.left;c=-l.top}}return{top:c+j.top+(k.pageYOffset||e.scrollTop)-(e.clientTop||0),left:h+j.left+(k.pageXOffset||e.scrollLeft)-(e.clientLeft||0)}}})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(i){i.jqx.dataAdapter=function(J,e){if(J!=undefined){if(J.dataFields!==undefined){J.datafields=J.dataFields}if(J.dataType!==undefined){J.datatype=J.dataType}if(J.localData!==undefined){J.localdata=J.localData}if(J.sortColumn!==undefined){J.sortcolumn=J.sortColumn}if(J.sortDirection!==undefined){J.sortdirection=J.sortDirection}if(J.sortOrder!==undefined){J.sortdirection=J.sortOrder}if(J.formatData!==undefined){J.formatdata=J.formatData}if(J.processData!==undefined){J.processdata=J.processData}if(J.pageSize!==undefined){J.pagesize=J.pageSize}if(J.pageNum!==undefined){J.pagenum=J.pageNum}if(J.updateRow!==undefined){J.updaterow=J.updateRow}if(J.addRow!==undefined){J.addrow=J.addRow}if(J.deleteRow!==undefined){J.deleterow=J.deleteRow}if(J.contentType!==undefined){J.contenttype=J.contentType}if(J.totalRecords!=undefined){J.totalRecords=J.totalRecords}if(J.loadError!=undefined){J.loadError=J.loadError}if(J.sortComparer!=undefined){J.sortcomparer=J.sortComparer}}this._source=J;this._options=e||{};this.records=new Array();this._downloadComplete=new Array();this._bindingUpdate=new Array();if(J!=undefined&&J.localdata!=null&&typeof J.localdata=="function"){var I=J.localdata();if(I!=null){J._localdata=J.localdata;var H=this;if(J._localdata.subscribe){H._oldlocaldata=[];J._localdata.subscribe(function(K){var L=function(M){if(jQuery.isArray(M)){return jQuery.makeArray(L(i(M)))}return jQuery.extend(true,{},M)};if(H.suspendKO==false||H.suspendKO==undefined||H._oldlocaldata.length==0){H._oldlocaldata=L(K)}},J._localdata,"beforeChange");J._localdata.subscribe(function(L){if(H.suspendKO==false||H.suspendKO==undefined){var K="";H._oldrecords=H.records;if(H._oldlocaldata.length==0){J.localdata=J._localdata()}if(H._oldlocaldata.length==0){K="change"}else{if(H._oldlocaldata.length==L.length){K="update"}if(H._oldlocaldata.length>L.length){K="remove"}if(H._oldlocaldata.length<L.length){K="add"}}H.dataBind(null,K)}},J._localdata,"change");H._knockoutdatasource=true}J.localdata=I}}if(this._options.autoBind==true){this.dataBind()}};i.jqx.dataAdapter.prototype={getrecords:function(){return this.records},beginUpdate:function(){this.isUpdating=true},endUpdate:function(e){this.isUpdating=false;if(e!=false){if(this._changedrecords&&this._changedrecords.length>0){this.callBindingUpdate("update");this._changedrecords=[]}else{this.dataBind(null,"")}}},formatDate:function(H,J,I){var e=i.jqx.dataFormat.formatdate(H,J,I);return e},formatNumber:function(H,J,I){var e=i.jqx.dataFormat.formatnumber(H,J,I);return e},dataBind:function(R,X){if(this.isUpdating==true){return}var U=this._source;if(!U){return}i.jqx.dataFormat.datescache=new Array();if(U.dataFields!=null){U.datafields=U.dataFields}if(U.recordstartindex==undefined){U.recordstartindex=0}if(U.recordendindex==undefined){U.recordendindex=0}if(U.loadallrecords==undefined){U.loadallrecords=true}if(U.sort!=undefined){this.sort=U.sort}if(U.filter!=undefined){this.filter=U.filter}else{this.filter=null}if(U.sortcolumn!=undefined){this.sortcolumn=U.sortcolumn}if(U.sortdirection!=undefined){this.sortdirection=U.sortdirection}if(U.sortcomparer!=undefined){this.sortcomparer=U.sortcomparer}this.records=new Array();var K=this._options||{};this.virtualmode=K.virtualmode!=undefined?K.virtualmode:false;this.totalrecords=K.totalrecords!=undefined?K.totalrecords:0;this.pageable=K.pageable!=undefined?K.pageable:false;this.pagesize=K.pagesize!=undefined?K.pagesize:0;this.pagenum=K.pagenum!=undefined?K.pagenum:0;this.cachedrecords=K.cachedrecords!=undefined?K.cachedrecords:new Array();this.originaldata=new Array();this.recordids=new Array();this.updaterow=K.updaterow!=undefined?K.updaterow:null;this.addrow=K.addrow!=undefined?K.addrow:null;this.deleterow=K.deleterow!=undefined?K.deleterow:null;this.cache=K.cache!=undefined?K.cache:false;this.unboundmode=false;if(U.formatdata!=undefined){K.formatData=U.formatdata}if(U.data!=undefined){if(K.data==undefined){K.data={}}i.extend(K.data,U.data)}if(U.mapchar!=undefined){this.mapChar=U.mapchar?U.mapchar:">"}else{this.mapChar=K.mapChar?K.mapChar:">"}if(K.unboundmode||U.unboundmode){this.unboundmode=K.unboundmode||U.unboundmode}if(U.cache!=undefined){this.cache=U.cache}if(this.koSubscriptions){for(var Z=0;Z<this.koSubscriptions.length;Z++){this.koSubscriptions[Z].dispose()}}this.koSubscriptions=new Array();if(this.pagenum<0){this.pagenum=0}var ae=this;var Q=U.datatype;if(U.datatype==="csv"||U.datatype==="tab"||U.datatype=="text"){Q="text"}var N=K.async!=undefined?K.async:true;if(U.async!=undefined){N=U.async}switch(Q){case"local":case"array":case"observablearray":default:if(U.localdata==undefined&&U.length){U.localdata=new Array();for(var W=0;W<U.length;W++){U.localdata[U.localdata.length]=U[W];U[W].uid=W}}var M=U.localdata.length;this.totalrecords=this.virtualmode?(U.totalrecords||M):M;if(this.unboundmode){this.totalrecords=this.unboundmode?(U.totalrecords||M):M;var aa=U.datafields?U.datafields.length:0;if(aa>0){for(var W=0;W<this.totalrecords;W++){var I={};for(var V=0;V<aa;V++){I[U.datafields[V].name]=""}I.uid=W;U.localdata[U.localdata.length]=I}}}if(this.totalrecords==undefined){this.totalrecords=0}var aa=U.datafields?U.datafields.length:0;var H=function(ak,am){var al={};for(var ai=0;ai<am;ai++){var ah=U.datafields[ai];var an="";if(undefined==ah||ah==null){continue}if(ah.map){if(i.isFunction(ah.map)){an=ah.map(ak)}else{var af=ah.map.split(ae.mapChar);if(af.length>0){var aj=ak;for(var ag=0;ag<af.length;ag++){aj=aj[af[ag]]}an=aj}else{an=ak[ah.map]}}if(an!=undefined&&an!=null){an=an.toString()}else{if(an==undefined&&an!=null){an=""}}}if(an==""){an=ak[ah.name];if(an!=undefined&&an!=null){if(U._localdata&&an.subscribe){an=an()}else{an=an.toString()}}}an=ae.getvaluebytype(an,ah);if(ah.displayname!=undefined){al[ah.displayname]=an}else{al[ah.name]=an}}return al};if(U._localdata){this._changedrecords=[];this.records=new Array();var ad=U._localdata();i.each(ad,function(ai,al){if(typeof al==="string"){ae.records.push(al)}else{var ag={};var ak=0;var aj=this;i.each(this,function(au,ax){var ao=null;var ay="string";if(aa>0){var aA=false;for(var at=0;at<aa;at++){var ar=U.datafields[at];if(ar!=undefined&&ar.name==au){aA=true;ao=ar.map;ay=ar.type;break}}if(!aA){return true}}var aq=i.isFunction(aj[au]);if(aq){var az=aj[au]();if(ay!="string"){az=ae.getvaluebytype(az,{type:ay})}ag[au]=az;if(aj[au].subscribe){var aw=ai;ae.koSubscriptions[ae.koSubscriptions.length]=aj[au].subscribe(function(aC){var aB=aw;ag[au]=aC;var aD={index:aB,oldrecord:ag,record:ag};ae._changedrecords.push(aD);if(ae.isUpdating){return}ae.callBindingUpdate("update");ae._changedrecords=[];return false})}}else{var az=aj[au];if(ao!=null){var an=ao.split(ae.mapChar);if(an.length>0){var av=aj;for(var ap=0;ap<an.length;ap++){av=av[an[ap]]}az=av}else{az=aj[ao]}}if(ay!="string"){az=ae.getvaluebytype(az,{type:ay})}ag[au]=az;if(ag[au]!=undefined){ak+=ag[au].toString().length+ag[au].toString().substr(0,1)}}});var ah=ae.getid(U.id,aj,ai);ag.uid=ah;ae.records.push(ag);ag._koindex=ak;if(ae._oldrecords){var af=ae.records.length-1;if(X=="update"){if(ae._oldrecords[af]._koindex!=ak){var am={index:af,oldrecord:ae._oldrecords[af],record:ag};ae._changedrecords.push(am)}}}}});if(X=="add"){var M=ae.records.length;for(var W=0;W<M;W++){var I=ae.records[W];var L=false;for(var T=0;T<ae._oldrecords.length;T++){if(ae._oldrecords[T]._koindex===I._koindex){L=true;break}}if(!L){ae._changedrecords.push({index:W,oldrecord:null,record:I,position:(W!=0?"last":"first")})}}}else{if(X=="remove"){var M=ae._oldrecords.length;for(var W=0;W<M;W++){var P=ae._oldrecords[W];if(!ae.records[W]){ae._changedrecords.push({index:W,oldrecord:P,record:null})}else{if(ae.records[W]._koindex!=P._koindex){ae._changedrecords.push({index:W,oldrecord:P,record:null})}}}}}}else{if(!i.isArray(U.localdata)){this.records=new Array();i.each(U.localdata,function(ah){var ag=ae.getid(U.id,this,ah);if(aa>0){var af=this;var ai=H(af,aa);ai.uid=ag;ae.records[ae.records.length]=ai}else{this.uid=ag;ae.records[ae.records.length]=this}})}else{if(aa==0){i.each(U.localdata,function(ah,ai){var af=i.extend({},this);if(typeof ai==="string"){ae.records=U.localdata;return false}else{var ag=ae.getid(U.id,af,ah);if(typeof(ag)==="object"){ag=ah}af.uid=ag;ae.records[ae.records.length]=af}})}else{i.each(U.localdata,function(ah){var af=this;var ai=H(af,aa);var ag=ae.getid(U.id,ai,ah);if(typeof(ag)==="object"){ag=ah}var af=i.extend({},ai);af.uid=ag;ae.records[ae.records.length]=af})}}}this.originaldata=U.localdata;this.cachedrecords=this.records;this.addForeignValues(U);if(K.uniqueDataFields){var S=this.getUniqueRecords(this.records,K.uniqueDataFields);this.records=S;this.cachedrecords=S}if(K.beforeLoadComplete){var ab=K.beforeLoadComplete(ae.records,this.originaldata);if(ab!=undefined){ae.records=ab;ae.cachedrecords=ab}}if(K.autoSort&&K.autoSortField){var O=Object.prototype.toString;Object.prototype.toString=(typeof field=="function")?field:function(){return this[K.autoSortField]};ae.records.sort(function(ag,af){if(ag===undefined){ag=null}if(af===undefined){af=null}if(ag===null&&af===null){return 0}if(ag===null&&af!==null){return 1}if(ag!==null&&af===null){return -1}ag=ag.toString();af=af.toString();if(i.jqx.dataFormat.isNumber(ag)&&i.jqx.dataFormat.isNumber(af)){if(ag<af){return -1}if(ag>af){return 1}return 0}else{if(i.jqx.dataFormat.isDate(ag)&&i.jqx.dataFormat.isDate(af)){if(ag<af){return -1}if(ag>af){return 1}return 0}else{if(!i.jqx.dataFormat.isNumber(ag)&&!i.jqx.dataFormat.isNumber(af)){ag=String(ag).toLowerCase();af=String(af).toLowerCase()}}}try{if(ag<af){return -1}if(ag>af){return 1}}catch(ah){var ai=ah}return 0});Object.prototype.toString=O}ae.buildHierarchy();if(i.isFunction(K.loadComplete)){K.loadComplete(U.localdata)}break;case"json":case"jsonp":case"xml":case"xhtml":case"script":case"text":if(U.localdata!=null){if(i.isFunction(U.beforeprocessing)){U.beforeprocessing(U.localdata)}if(U.datatype==="xml"){ae.loadxml(U.localdata,U.localdata,U)}else{if(Q==="text"){ae.loadtext(U.localdata,U)}else{ae.loadjson(U.localdata,U.localdata,U)}}ae.addForeignValues(U);if(K.uniqueDataFields){var S=ae.getUniqueRecords(ae.records,K.uniqueDataFields);ae.records=S;ae.cachedrecords=S}ae.buildHierarchy.call(ae);if(i.isFunction(K.loadComplete)){K.loadComplete(U.localdata)}return}var ac=K.data!=undefined?K.data:{};if(U.processdata){U.processdata(ac)}if(i.isFunction(K.processData)){K.processData(ac)}if(i.isFunction(K.formatData)){var e=K.formatData(ac);if(e!=undefined){ac=e}}var Y="application/x-www-form-urlencoded";if(K.contentType){Y=K.contentType}var J="GET";if(U.type){J=U.type}if(K.type){J=K.type}if(U.url&&U.url.length>0){if(i.isFunction(K.loadServerData)){ae._requestData(ac,U,K)}else{this.xhr=i.jqx.data.ajax({dataType:Q,cache:this.cache,type:J,url:U.url,async:N,contentType:Y,data:ac,success:function(ai,af,al){if(i.isFunction(U.beforeprocessing)){var ak=U.beforeprocessing(ai,af,al);if(ak!=undefined){ai=ak}}if(i.isFunction(K.downloadComplete)){var ak=K.downloadComplete(ai,af,al);if(ak!=undefined){ai=ak}}if(ai==null){ae.records=new Array();ae.cachedrecords=new Array();ae.originaldata=new Array();ae.callDownloadComplete();if(i.isFunction(K.loadComplete)){K.loadComplete(new Array())}return}var ag=ai;if(ai.records){ag=ai.records}if(ai.totalrecords!=undefined){U.totalrecords=ai.totalrecords}if(U.datatype==="xml"){ae.loadxml(null,ag,U)}else{if(Q==="text"){ae.loadtext(ag,U)}else{ae.loadjson(null,ag,U)}}ae.addForeignValues(U);if(K.uniqueDataFields){var ah=ae.getUniqueRecords(ae.records,K.uniqueDataFields);ae.records=ah;ae.cachedrecords=ah}if(K.beforeLoadComplete){var aj=K.beforeLoadComplete(ae.records,ai);if(aj!=undefined){ae.records=aj;ae.cachedrecords=aj}}ae.buildHierarchy.call(ae);ae.callDownloadComplete();if(i.isFunction(K.loadComplete)){K.loadComplete(ai,af,al,ae.records)}},error:function(ah,af,ag){if(i.isFunction(U.loaderror)){U.loaderror(ah,af,ag)}if(i.isFunction(K.loadError)){K.loadError(ah,af,ag)}ah=null;ae.callDownloadComplete()},beforeSend:function(ag,af){if(i.isFunction(K.beforeSend)){K.beforeSend(ag,af)}if(i.isFunction(U.beforesend)){U.beforesend(ag,af)}}})}}else{ae.callDownloadComplete();if(i.isFunction(K.loadComplete)){K.loadComplete(data)}}break}this.callBindingUpdate(X)},buildHierarchy:function(){var e=this._source;var L=new Array();if(!e.datafields){return}var M=false;var O="";for(var J=0;J<e.datafields.length;J++){var I=e.datafields[J];if(I&&I.type=="array"){O=I;M=true}}if(M){if(!e.hierarchicalDataFields||e.hierarchicalDataFields.length==0){throw new Error("jqxDataAdapter: hierarchicalDataFields Array is not initialized!")}this.hierarchy=this.records;for(var J=0;J<this.records.length;J++){var K=this.records[J];K.records=K[O.name];K.level=0;K.parent=null;K.label=K[e.hierarchicalDataFields[0].name];K.data=K;if(K.expanded===undefined){K.expanded=false}var N=function(S,Q){if(!Q){S.records=new Array();return}for(var R=0;R<Q.length;R++){var P=Q[R];P.records=P[O.name];P.level=S.level+1;P.parent=S;P.label=P[e.hierarchicalDataFields[0].name];P.data=P;if(P.expanded===undefined){P.expanded=false}N(P,P.records)}};N(K,K.records)}return}if(e.hierarchicalDataFields){var H=new Array();for(var J=0;J<e.hierarchicalDataFields.length;J++){H.push(e.hierarchicalDataFields[J].name)}var L=this.getGroupedRecords(H,"records","label",null,"data",null,"parent")}this.hierarchy=L;return L},addForeignValues:function(H){var Q=this;var V=H.datafields?H.datafields.length:0;for(var N=0;N<V;N++){var L=H.datafields[N];if(L!=undefined){if(L.values!=undefined){if(L.value==undefined){L.value=L.name}if(L.values.value==undefined){L.values.value=L.value}var T=new Array();var K,M;if(Q.pageable&&Q.virtualmode){K=Q.pagenum*Q.pagesize;M=K+Q.pagesize;if(M>Q.totalrecords){M=Q.totalrecords}}else{K=0;M=Q.records.length}for(var O=K;O<M;O++){var P=Q.records[O];var I=L.name;var U=P[L.value];if(T[U]!=undefined){P[I]=T[U]}else{for(var J=0;J<L.values.source.length;J++){var S=L.values.source[J];var e=S[L.values.value];if(e==undefined){e=S.uid}if(e==U){var R=S[L.values.name];P[I]=R;T[U]=R;break}}}}}else{if(L.value!=undefined){for(var O=0;O<Q.records.length;O++){var P=Q.records[O];P[L.name]=P[L.value]}}}}}},abort:function(){if(this.xhr&&this.xhr.readyState!=4){this.xhr.abort();me.callDownloadComplete()}},_requestData:function(H,J,e){var I=this;var K=function(L){if(L.totalrecords){J.totalrecords=L.totalrecords;I.totalrecords=L.totalrecords}if(L.records){I.records=L.records;I.cachedrecords=L.records}if(i.isFunction(e.loadComplete)){e.loadComplete(data)}I.callDownloadComplete()};e.loadServerData(H,J,K)},getUniqueRecords:function(I,L){if(I&&L){var e=I.length;var Q=L.length;var N=new Array();var O=new Array();for(var P=0;P<e;P++){var M=I[P];var J="";if(M==undefined){continue}for(var K=0;K<Q;K++){var H=L[K];J+=M[H]+"_"}if(!O[J]){N[N.length]=M}O[J]=true}}return N},getAggregatedData:function(Q,M,K){var J=K;if(!J){J=this.records}var N={};var I=J.length;if(I==0){return}if(I==undefined){return}for(var O=0;O<I;O++){var P=J[O];for(var L=0;L<Q.length;L++){var H=Q[L];var S=P[H.name];if(H.aggregates){N[H.name]=N[H.name]||{};var e=function(T){for(obj in T){var U=N[H.name][obj];if(U==null){N[H.name][obj]=0;U=0}if(i.isFunction(T[obj])){U=T[obj](U,S,H.name,P)}N[H.name][obj]=U}};var R=parseFloat(S);if(isNaN(R)){R=false}else{R=true}if(R){S=parseFloat(S)}if(typeof S==="number"&&isFinite(S)){i.each(H.aggregates,function(){var T=N[H.name][this];if(T==null){T=0;if(this=="min"){T=9999999999999}if(this=="max"){T=-9999999999999}}if(this=="sum"||this=="avg"||this=="stdev"||this=="stdevp"||this=="var"||this=="varp"){T+=parseFloat(S)}else{if(this=="product"){if(O==0){T=parseFloat(S)}else{T*=parseFloat(S)}}else{if(this=="min"){T=Math.min(T,parseFloat(S))}else{if(this=="max"){T=Math.max(T,parseFloat(S))}else{if(this=="count"){T++}else{if(typeof(this)=="object"){e(this);return}}}}}}N[H.name][this]=T})}else{i.each(H.aggregates,function(){if(this=="min"||this=="max"||this=="count"||this=="product"||this=="sum"||this=="avg"||this=="stdev"||this=="stdevp"||this=="var"||this=="varp"){var T=N[H.name][this];if(T==null){T=0}N[H.name][this]=T;return true}if(typeof(this)=="object"){e(this)}})}}}}for(var L=0;L<Q.length;L++){var H=Q[L];if(N[H.name]["avg"]!=undefined){var S=N[H.name]["avg"];N[H.name]["avg"]=S/J.length}else{if(N[H.name]["count"]!=undefined){N[H.name]["count"]=I}}if(N[H.name]["stdev"]||N[H.name]["stdevp"]||N[H.name]["var"]||N[H.name]["varp"]){i.each(H.aggregates,function(Z){if(this=="stdev"||this=="var"||this=="varp"||this=="stdevp"){var aa=N[H.name][this];var Y=I;var T=(aa/I);var V=0;for(var W=0;W<I;W++){var X=J[W];var ab=X[H.name];V+=(ab-T)*(ab-T)}var U=(this=="stdevp"||this=="varp")?Y:Y-1;if(U==0){U=1}if(this=="var"||this=="varp"){N[H.name][this]=V/U}else{if(this=="stdevp"||this=="stdev"){N[H.name][this]=Math.sqrt(V/U)}}}})}if(H.formatStrings){i.each(H.aggregates,function(U){var T=H.formatStrings[U];if(T){if(this=="min"||this=="max"||this=="count"||this=="product"||this=="sum"||this=="avg"||this=="stdev"||this=="stdevp"||this=="var"||this=="varp"){var V=N[H.name][this];N[H.name][this]=i.jqx.dataFormat.formatnumber(V,T,M)}else{if(typeof this=="object"){for(obj in this){var V=N[H.name][obj];N[H.name][obj]=i.jqx.dataFormat.formatnumber(V,T,M)}}}}})}}return N},bindDownloadComplete:function(H,e){this._downloadComplete[this._downloadComplete.length]={id:H,func:e}},unbindDownloadComplete:function(H){for(var e=0;e<this._downloadComplete.length;e++){if(this._downloadComplete[e].id==H){this._downloadComplete[e].func=null;this._downloadComplete.splice(e,1);break}}},callDownloadComplete:function(){for(var e=0;e<this._downloadComplete.length;e++){var H=this._downloadComplete[e];if(H.func!=null){H.func()}}},setSource:function(e){this._source=e},generatekey:function(){var e=function(){return(((1+Math.random())*65536)|0).toString(16).substring(1)};return(e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e())},getGroupedRecords:function(ah,ak,U,ac,ai,Z,ab){var ae=0;var Y=this;var I=new Array();for(var M=0;M<ah.length;M++){I[M]=Y.generatekey()}if(!ak){ak="items"}if(!U){U="group"}if(!ai){ai="record"}if(!ab){ab="parentItem"}if(undefined===Z){Z="value"}var Q=new Array();var K=0;var J=new Array();var P=ah.length;var aj=new Array();var al=this.records;var N=al.length;var ad=function(am){var an=am;if(ac){i.each(ac,function(){if(this.name&&this.map){an[this.map]=an[this.name]}})}return an};for(var T=0;T<N;T++){var ag=ad(al[T]);id=ag[Y.uniqueId];var H=new Array();var V=0;for(M=0;M<P;M++){var O=ah[M];var aa=ag[O];if(null==aa){continue}H[V++]={value:aa,hash:I[M]}}if(H.length!=P){break}var W=null;var R="";var e=-1;for(var X=0;X<H.length;X++){e++;var af=H[X].value;var L=H[X].hash;R=R+"_"+L+"_"+af;if(J[R]!=undefined&&J[R]!=null){W=J[R];continue}if(W==null){W={level:0};W[ab]=null;W[U]=af;W[ai]=ag;if(ag.expanded!==undefined){W.expanded=ag.expanded}else{W.expanded=false}if(Z){W[Z]=ag[Z]}W[ak]=new Array();Q[K++]=W}else{var S={level:W.level+1};S[ab]=W;S[U]=af;S[ak]=new Array();S[ai]=ag;if(ag.expanded!==undefined){S.expanded=ag.expanded}else{S.expanded=false}if(Z){S[Z]=ag[Z]}W[ak][W[ak].length]=S;W=S}J[R]=W;if(W!=null&&X===H.length-1){W.leaf=true}}}return Q},getRecordsHierarchy:function(K,I,X,S){var e=new Array();var H=this.records;if(this.records.length==0){return null}var V=X!=null?X:"items";var P=[];var Y=H;var N=Y.length;var T=function(Z){var aa=Z;if(S){i.each(S,function(){if(this.name&&this.map){aa[this.map]=aa[this.name]}})}return aa};for(var U=0;U<N;U++){var W=i.extend({},Y[U]);var R=W[I];var Q=W[K];P[Q]={parentid:R,item:W}}for(var U=0;U<N;U++){var W=i.extend({},Y[U]);var R=W[I];var Q=W[K];if(P[R]!=undefined){var W={parentid:R,item:P[Q].item};var O=P[R].item;if(!O[V]){O[V]=[]}var L=O[V].length;var J=W.item;var M=T(J);O[V][L]=M;P[R].item=O;P[Q]=W}else{var J=P[Q].item;var M=T(J);e[e.length]=M}}return e},bindBindingUpdate:function(H,e){this._bindingUpdate[this._bindingUpdate.length]={id:H,func:e}},unbindBindingUpdate:function(H){for(var e=0;e<this._bindingUpdate.length;e++){if(this._bindingUpdate[e].id==H){this._bindingUpdate[e].func=null;this._bindingUpdate.splice(e,1);break}}},callBindingUpdate:function(e){for(var I=0;I<this._bindingUpdate.length;I++){var H=this._bindingUpdate[I];if(H.func!=null){H.func(e)}}},getid:function(J,H,I){if(i(J,H).length>0){return i(J,H).text()}if(J){if(J.toString().length>0){var e=i(H).attr(J);if(e!=null&&e.toString().length>0){return e}}}return I},loadjson:function(ae,af,R){if(typeof(ae)=="string"){ae=i.parseJSON(ae)}if(R.root==undefined){R.root=""}if(R.record==undefined){R.record=""}var ae=ae||af;if(!ae){ae=[]}var ad=this;if(R.root!=""){var K=R.root.split(ad.mapChar);if(K.length>1){var aa=ae;for(var Q=0;Q<K.length;Q++){if(aa!=undefined){aa=aa[K[Q]]}}ae=aa}else{if(ae[R.root]!=undefined){ae=ae[R.root]}else{i.each(ae,function(ah){var ag=this;if(this==R.root){ae=this;return false}else{if(this[R.root]!=undefined){ae=this[R.root]}}})}if(!ae){var K=R.root.split(ad.mapChar);if(K.length>0){var aa=ae;for(var Q=0;Q<K.length;Q++){if(aa!=undefined){aa=aa[K[Q]]}}ae=aa}}}}else{if(!ae.length){for(obj in ae){if(i.isArray(ae[obj])){ae=ae[obj];break}}}}if(ae!=null&&ae.length==undefined){ae=i.makeArray(ae)}if(ae==null||ae.length==undefined){alert("JSON Parse error.");return}if(ae.length==0){this.totalrecords=0;return}var J=ae.length;this.totalrecords=this.virtualmode?(R.totalrecords||J):J;this.records=new Array();this.originaldata=new Array();var W=this.records;var T=!this.pageable?R.recordstartindex:this.pagesize*this.pagenum;this.recordids=new Array();if(R.loadallrecords){T=0;J=this.totalrecords}var P=0;if(this.virtualmode){T=!this.pageable?R.recordstartindex:this.pagesize*this.pagenum;P=T;T=0;J=this.totalrecords}var Y=R.datafields?R.datafields.length:0;if(Y==0){var e=ae[0];var ab=new Array();for(obj in e){var H=obj;ab[ab.length]={name:H}}R.datafields=ab;Y=ab.length}var M=T;for(var V=T;V<J;V++){var I=ae[V];if(I==undefined){break}if(R.record&&R.record!=""){I=I[R.record];if(I==undefined){continue}}var ac=this.getid(R.id,I,V);if(typeof(ac)==="object"){ac=V}if(!this.recordids[ac]){this.recordids[ac]=I;var L={};for(var U=0;U<Y;U++){var N=R.datafields[U];var S="";if(undefined==N||N==null){continue}if(N.map){if(i.isFunction(N.map)){S=N.map(I)}else{var K=N.map.split(ad.mapChar);if(K.length>0){var Z=I;for(var Q=0;Q<K.length;Q++){if(Z!=undefined){Z=Z[K[Q]]}}S=Z}else{S=I[N.map]}}if(S!=undefined&&S!=null){S=S.toString()}else{if(S==undefined&&S!=null){S=""}}}if(S==""&&!N.map){S=I[N.name];if(S==undefined&&S!=null){S=""}if(N.value!=undefined){if(S!=undefined){var X=S[N.value];if(X!=undefined){S=X}}}}S=this.getvaluebytype(S,N);if(N.displayname!=undefined){L[N.displayname]=S}else{L[N.name]=S}if(N.type==="array"){var O=function(aj){if(!aj){return}for(var ap=0;ap<aj.length;ap++){var am=aj[ap];for(var an=0;an<Y;an++){var ai=R.datafields[an];var ao="";if(undefined==ai||ai==null){continue}if(ai.map){if(i.isFunction(ai.map)){ao=ai.map(am)}else{var ag=ai.map.split(ad.mapChar);if(ag.length>0){var al=am;for(var ah=0;ah<ag.length;ah++){if(al!=undefined){al=al[ag[ah]]}}ao=al}else{ao=am[ai.map]}}if(ao!=undefined&&ao!=null){ao=ao.toString()}else{if(ao==undefined&&ao!=null){ao=""}}}if(ao==""&&!ai.map){ao=am[ai.name];if(ao==undefined&&ao!=null){ao=""}if(ai.value!=undefined){if(ao!=undefined){var ak=ao[ai.value];if(ak!=undefined){ao=ak}}}}ao=this.getvaluebytype(ao,ai);if(ai.displayname!=undefined){am[ai.displayname]=ao}else{am[ai.name]=ao}if(ai.type==="array"){O.call(this,ao)}}}};O.call(this,S)}}if(R.recordendindex<=0||T<R.recordendindex){W[P+M]=i.extend({},L);W[P+M].uid=ac;this.originaldata[P+M]=i.extend({},W[V]);M++}}}this.records=W;this.cachedrecords=this.records},loadxml:function(K,ad,S){if(typeof(K)=="string"){K=ad=i(i.parseXML(K));K=null}if(S.root==undefined){S.root=""}if(S.record==undefined){S.record=""}var K;if(i.jqx.browser.msie&&ad){if(ad.xml!=undefined){K=i(S.root+" "+S.record,i.parseXML(ad.xml))}else{K=K||i(S.root+" "+S.record,ad)}}else{K=K||i(S.root+" "+S.record,ad)}if(!K){K=[]}var J=K.length;if(K.length==0){return}this.totalrecords=this.virtualmode?(S.totalrecords||J):J;this.records=new Array();this.originaldata=new Array();var Y=this.records;var V=!this.pageable?S.recordstartindex:this.pagesize*this.pagenum;this.recordids=new Array();if(S.loadallrecords){V=0;J=this.totalrecords}var Q=0;if(this.virtualmode){V=!this.pageable?S.recordstartindex:this.pagesize*this.pagenum;Q=V;V=0;J=this.totalrecords}var Z=S.datafields?S.datafields.length:0;if(Z==0){var e=K[0];var ab=new Array();for(obj in e){var H=obj;ab[ab.length]={name:H}}S.datafields=ab;Z=ab.length}var R=V;for(var X=V;X<J;X++){var I=K[X];if(I==undefined){break}var ac=this.getid(S.id,I,X);if(!this.recordids[ac]){this.recordids[ac]=I;var L={};for(var W=0;W<Z;W++){var O=S.datafields[W];var U="";if(undefined==O||O==null){continue}if(O.map){if(i.isFunction(O.map)){U=O.map(I)}else{var M=O.map.indexOf("[");if(M<0){U=i(O.map,I).text()}else{var aa=O.map.substring(0,M-1);var N=O.map.indexOf("]");var P=O.map.substring(M+1,N);U=i(aa,I).attr(P);if(U==undefined){U=""}}if(U==""){U=i(I).attr(O.map);if(U==undefined){U=""}}}}if(U==""){U=i(O.name,I).text();if(U==""){U=i(I).attr(O.name);if(U==undefined){U=""}}if(U==""){if(I.nodeName&&I.nodeName==O.name&&I.firstChild){U=i(I.firstChild).text()}}}var T=U;U=this.getvaluebytype(U,O);if(O.displayname!=undefined){L[O.displayname]=U}else{L[O.name]=U}}if(S.recordendindex<=0||V<S.recordendindex){Y[Q+R]=i.extend({},L);Y[Q+R].uid=ac;this.originaldata[Q+R]=i.extend({},Y[X]);R++}}}this.records=Y;this.cachedrecords=this.records},loadtext:function(X,P){if(X==null){return}var e=P.rowDelimiter||this.rowDelimiter||"\n";var L=X.split(e);var J=L.length;this.totalrecords=this.virtualmode?(P.totalrecords||J):J;this.records=new Array();this.originaldata=new Array();var U=this.records;var R=!this.pageable?P.recordstartindex:this.pagesize*this.pagenum;this.recordids=new Array();if(P.loadallrecords){R=0;J=this.totalrecords}var N=0;if(this.virtualmode){R=!this.pageable?P.recordstartindex:this.pagesize*this.pagenum;N=R;R=0;J=this.totalrecords}var V=P.datafields.length;var O=P.columnDelimiter||this.columnDelimiter;if(!O){O=(P.datatype==="tab")?"\t":","}for(var T=R;T<J;T++){var I=L[T];var W=this.getid(P.id,I,T);if(!this.recordids[W]){this.recordids[W]=I;var K={};var H=L[T].split(O);for(var S=0;S<V;S++){if(S>=H.length){continue}var M=P.datafields[S];var Q=H[S];if(M.map&&i.isFunction(M.map)){Q=M.map(I)}if(M.type){Q=this.getvaluebytype(Q,M)}var Y=M.map||M.name||S.toString();K[Y]=Q}U[N+T]=i.extend({},K);U[N+T].uid=W;this.originaldata[N+T]=i.extend({},U[T])}}this.records=U;this.cachedrecords=this.records},getvaluebytype:function(K,H){var I=K;if(K==null){return K}if(H.type=="date"){if(K=="NaN"){K=""}else{var J=new Date(K);if(typeof K=="string"){if(H.format){var e=i.jqx.dataFormat.parsedate(K,H.format);if(e!=null){J=e}}}if(J.toString()=="NaN"||J.toString()=="Invalid Date"){if(i.jqx.dataFormat){K=i.jqx.dataFormat.tryparsedate(K)}else{K=J}}else{K=J}if(K==null){K=I}}}else{if(H.type=="float"||H.type=="number"||H.type=="decimal"){if(K=="NaN"){K=""}else{var K=parseFloat(K);if(isNaN(K)){K=I}}}else{if(H.type=="int"||H.type=="integer"){var K=parseInt(K);if(isNaN(K)){K=I}}else{if(H.type=="bool"||H.type=="boolean"){if(K!=null){if(K.toLowerCase!=undefined){if(K.toLowerCase()=="false"){K=false}else{if(K.toLowerCase()=="true"){K=true}}}}if(K==1){K=true}else{if(K==0&&K!==""){K=false}else{K=""}}}}}}return K}};i.jqx.dataFormat={};i.extend(i.jqx.dataFormat,{regexTrim:/^\s+|\s+$/g,regexInfinity:/^[+-]?infinity$/i,regexHex:/^0x[a-f0-9]+$/i,regexParseFloat:/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/,toString:Object.prototype.toString,isBoolean:function(e){return typeof e==="boolean"},isObject:function(e){return(e&&(typeof e==="object"||i.isFunction(e)))||false},isDate:function(e){return e instanceof Date},arrayIndexOf:function(J,I){if(J.indexOf){return J.indexOf(I)}for(var e=0,H=J.length;e<H;e++){if(J[e]===I){return e}}return -1},isString:function(e){return typeof e==="string"},isNumber:function(e){return typeof e==="number"&&isFinite(e)},isNull:function(e){return e===null},isUndefined:function(e){return typeof e==="undefined"},isValue:function(e){return(this.isObject(e)||this.isString(e)||this.isNumber(e)||this.isBoolean(e))},isEmpty:function(e){if(!this.isString(e)&&this.isValue(e)){return false}else{if(!this.isValue(e)){return true}}e=i.trim(e).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return e===""},startsWith:function(H,e){return H.indexOf(e)===0},endsWith:function(H,e){return H.substr(H.length-e.length)===e},trim:function(e){return(e+"").replace(this.regexTrim,"")},isArray:function(e){return this.toString.call(e)==="[object Array]"},defaultcalendar:function(){var e={"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff"},percentsymbol:"%",currencysymbol:"$",currencysymbolposition:"before",decimalseparator:".",thousandsseparator:","};return e},expandFormat:function(K,J){J=J||"F";var I,H=K.patterns,e=J.length;if(e===1){I=H[J];if(!I){throw"Invalid date format string '"+J+"'."}J=I}else{if(e===2&&J.charAt(0)==="%"){J=J.charAt(1)}}return J},getEra:function(I,H){if(!H){return 0}if(typeof I==="string"){return 0}var L,K=I.getTime();for(var J=0,e=H.length;J<e;J++){L=H[J].start;if(L===null||K>=L){return J}}return 0},toUpper:function(e){return e.split("\u00A0").join(" ").toUpperCase()},toUpperArray:function(e){var J=[];for(var I=0,H=e.length;I<H;I++){J[I]=this.toUpper(e[I])}return J},getEraYear:function(H,J,e,K){var I=H.getFullYear();if(!K&&J.eras){I-=J.eras[e].offset}return I},toUpper:function(e){if(e){return e.toUpperCase()}return""},getDayIndex:function(K,J,H){var e,L=K.days,I=K._upperDays;if(!I){K._upperDays=I=[this.toUpperArray(L.names),this.toUpperArray(L.namesAbbr),this.toUpperArray(L.namesShort)]}J=J.toUpperCase();if(H){e=this.arrayIndexOf(I[1],J);if(e===-1){e=this.arrayIndexOf(I[2],J)}}else{e=this.arrayIndexOf(I[0],J)}return e},getMonthIndex:function(N,M,I){var e=N.months,H=N.monthsGenitive||N.months,K=N._upperMonths,L=N._upperMonthsGen;if(!K){N._upperMonths=K=[this.toUpperArray(e.names),this.toUpperArray(e.namesAbbr)];N._upperMonthsGen=L=[this.toUpperArray(H.names),this.toUpperArray(H.namesAbbr)]}M=this.toUpper(M);var J=this.arrayIndexOf(I?K[1]:K[0],M);if(J<0){J=this.arrayIndexOf(I?L[1]:L[0],M)}return J},appendPreOrPostMatch:function(J,e){var I=0,L=false;for(var K=0,H=J.length;K<H;K++){var M=J.charAt(K);switch(M){case"'":if(L){e.push("'")}else{I++}L=false;break;case"\\":if(L){e.push("\\")}L=!L;break;default:e.push(M);L=false;break}}return I},getTokenRegExp:function(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g},formatlink:function(e,I){var H="";if(I&&I.target){H="target="+I.target}if(H!=""){return"<a "+H+' href="'+e+'">'+e+"</a>"}return'<a href="'+e+'">'+e+"</a>"},formatemail:function(e){return'<a href="mailto:'+e+'">'+e+"</a>"},formatnumber:function(T,S,O){if(O==undefined||O==null||O==""){O=this.defaultcalendar()}if(S===""||S===null){return T}if(!this.isNumber(T)){T*=1}var P;if(S.length>1){P=parseInt(S.slice(1),10)}var V={};var Q=S.charAt(0).toUpperCase();V.thousandsSeparator=O.thousandsseparator;V.decimalSeparator=O.decimalseparator;switch(Q){case"D":case"d":case"F":case"f":V.decimalPlaces=P;break;case"N":case"n":V.decimalPlaces=0;break;case"C":case"c":V.decimalPlaces=P;if(O.currencysymbolposition=="before"){V.prefix=O.currencysymbol}else{V.suffix=O.currencysymbol}break;case"P":case"p":V.suffix=O.percentsymbol;V.decimalPlaces=P;break;default:throw"Bad number format specifier: "+Q}if(this.isNumber(T)){var K=(T<0);var I=T+"";var R=(V.decimalSeparator)?V.decimalSeparator:".";var e;if(this.isNumber(V.decimalPlaces)){var L=V.decimalPlaces;var N=Math.pow(10,L);I=(T*N).toFixed(0)/N+"";e=I.lastIndexOf(".");if(L>0){if(e<0){I+=R;e=I.length-1}else{if(R!=="."){I=I.replace(".",R)}}while((I.length-1-e)<L){I+="0"}}}if(V.thousandsSeparator){var U=V.thousandsSeparator;e=I.lastIndexOf(R);e=(e>-1)?e:I.length;var J=I.substring(e);var H=-1;for(var M=e;M>0;M--){H++;if((H%3===0)&&(M!==e)&&(!K||(M>1))){J=U+J}J=I.charAt(M-1)+J}I=J}I=(V.prefix)?V.prefix+I:I;I=(V.suffix)?I+V.suffix:I;return I}else{return T}},tryparsedate:function(T,M){if(M==undefined||M==null){M=this.defaultcalendar()}var Q=this;if(T==""){return null}if(T!=null&&!T.substring){T=T.toString()}if(T!=null&&T.substring(0,6)=="/Date("){var R=/^\/Date\((-?\d+)(\+|-)?(\d+)?\)\/$/;var J=new Date(+T.replace(/\/Date\((\d+)\)\//,"$1"));if(J=="Invalid Date"){var K=T.match(/^\/Date\((\d+)([-+]\d\d)(\d\d)\)\/$/);var J=null;if(K){J=new Date(1*K[1]+3600000*K[2]+60000*K[3])}}if(J==null||J=="Invalid Date"||isNaN(J)){var N=R.exec(T);if(N){var U=new Date(parseInt(N[1]));if(N[2]){var e=parseInt(N[3]);if(N[2]==="-"){e=-e}var P=U.getUTCMinutes();U.setUTCMinutes(P-e)}if(!isNaN(U.valueOf())){return U}}}return J}patterns=M.patterns;for(prop in patterns){J=Q.parsedate(T,patterns[prop],M);if(J){if(prop=="ISO"){var I=Q.parsedate(T,patterns.ISO2,M);if(I){return I}}return J}}if(T!=null){var I=null;var S=[":","/","-"];var O=true;for(var H=0;H<S.length;H++){if(T.indexOf(S[H])!=-1){O=false}}if(O){var L=new Number(T);if(!isNaN(L)){return new Date(L)}}}return null},getparseregexp:function(e,R){var T=e._parseRegExp;if(!T){e._parseRegExp=T={}}else{var K=T[R];if(K){return K}}var Q=this.expandFormat(e,R).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),O=["^"],H=[],N=0,J=0,W=this.getTokenRegExp(),L;while((L=W.exec(Q))!==null){var V=Q.slice(N,L.index);N=W.lastIndex;J+=this.appendPreOrPostMatch(V,O);if(J%2){O.push(L[0]);continue}var I=L[0],M=I.length,S;switch(I){case"dddd":case"ddd":case"MMMM":case"MMM":case"gg":case"g":S="(\\D+)";break;case"tt":case"t":S="(\\D*)";break;case"yyyy":case"fff":case"ff":case"f":S="(\\d{"+M+"})";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":S="(\\d\\d?)";break;case"zzz":S="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":S="([+-]?\\d\\d?)";break;case"/":S="(\\"+e["/"]+")";break;default:throw"Invalid date format pattern '"+I+"'.";break}if(S){O.push(S)}H.push(L[0])}this.appendPreOrPostMatch(Q.slice(N),O);O.push("$");var U=O.join("").replace(/\s+/g,"\\s+"),P={regExp:U,groups:H};return T[R]=P},outOfRange:function(I,e,H){return I<e||I>H},expandYear:function(L,J){var H=new Date(),e=getEra(H);if(J<100){var I=L.twoDigitYearMax;I=typeof I==="string"?new Date().getFullYear()%100+parseInt(I,10):I;var K=this.getEraYear(H,L,e);J+=K-(K%100);if(J>I){J-=100}}return J},parsedate:function(ab,ai,W){if(W==undefined||W==null){W=this.defaultcalendar()}ab=this.trim(ab);var T=W,an=this.getparseregexp(T,ai),N=new RegExp(an.regExp).exec(ab);if(N===null){return null}var aj=an.groups,Z=null,R=null,am=null,al=null,S=null,L=0,ae,ad=0,ak=0,e=0,I=null,U=false;for(var af=0,ah=aj.length;af<ah;af++){var H=N[af+1];if(H){var aa=aj[af],K=aa.length,M=parseInt(H,10);switch(aa){case"dd":case"d":al=M;if(this.outOfRange(al,1,31)){return null}break;case"MMM":case"MMMM":am=this.getMonthIndex(T,H,K===3);if(this.outOfRange(am,0,11)){return null}break;case"M":case"MM":am=M-1;if(this.outOfRange(am,0,11)){return null}break;case"y":case"yy":case"yyyy":R=K<4?this.expandYear(T,M):M;if(this.outOfRange(R,0,9999)){return null}break;case"h":case"hh":L=M;if(L===12){L=0}if(this.outOfRange(L,0,11)){return null}break;case"H":case"HH":L=M;if(this.outOfRange(L,0,23)){return null}break;case"m":case"mm":ad=M;if(this.outOfRange(ad,0,59)){return null}break;case"s":case"ss":ak=M;if(this.outOfRange(ak,0,59)){return null}break;case"tt":case"t":U=T.PM&&(H===T.PM[0]||H===T.PM[1]||H===T.PM[2]);if(!U&&(!T.AM||(H!==T.AM[0]&&H!==T.AM[1]&&H!==T.AM[2]))){return null}break;case"f":case"ff":case"fff":e=M*Math.pow(10,3-K);if(this.outOfRange(e,0,999)){return null}break;case"ddd":case"dddd":S=this.getDayIndex(T,H,K===3);if(this.outOfRange(S,0,6)){return null}break;case"zzz":var J=H.split(/:/);if(J.length!==2){return null}ae=parseInt(J[0],10);if(this.outOfRange(ae,-12,13)){return null}var P=parseInt(J[1],10);if(this.outOfRange(P,0,59)){return null}I=(ae*60)+(startsWith(H,"-")?-P:P);break;case"z":case"zz":ae=M;if(this.outOfRange(ae,-12,13)){return null}I=ae*60;break;case"g":case"gg":var V=H;if(!V||!T.eras){return null}V=trim(V.toLowerCase());for(var ag=0,ac=T.eras.length;ag<ac;ag++){if(V===T.eras[ag].name.toLowerCase()){Z=ag;break}}if(Z===null){return null}break}}}var Q=new Date(),Y,O=T.convert;Y=Q.getFullYear();if(R===null){R=Y}else{if(T.eras){R+=T.eras[(Z||0)].offset}}if(am===null){am=0}if(al===null){al=1}if(O){Q=O.toGregorian(R,am,al);if(Q===null){return null}}else{Q.setFullYear(R,am,al);if(Q.getDate()!==al){return null}if(S!==null&&Q.getDay()!==S){return null}}if(U&&L<12){L+=12}Q.setHours(L,ad,ak,e);if(I!==null){var X=Q.getMinutes()-(I+Q.getTimezoneOffset());Q.setHours(Q.getHours()+parseInt(X/60,10),X%60)}return Q},cleardatescache:function(){this.datescache=new Array()},formatdate:function(Z,ad,U){if(U==undefined||U==null){U=this.defaultcalendar()}if(typeof Z==="string"){return Z}var J=Z.toString()+"_"+ad;if(this.datescache&&this.datescache[J]){return this.datescache[J]}if(!ad||!ad.length||ad==="i"){var af;af=this.formatDate(Z,U.patterns.F,culture);return af}var aa=U.eras,H=ad==="s";ad=this.expandFormat(U,ad);af=[];var M,ab=["0","00","000"],Q,R,e=/([^d]|^)(d|dd)([^d]|$)/g,ae=0,W=this.getTokenRegExp(),I;function O(ag,aj){var ai,ah=ag+"";if(aj>1&&ah.length<aj){ai=(ab[aj-2]+ah);return ai.substr(ai.length-aj,aj)}else{ai=ah}return ai}function ac(){if(Q||R){return Q}Q=e.test(ad);R=true;return Q}function K(ah,ag){if(I){return I[ag]}if(ah.getMonth!=undefined){switch(ag){case 0:return ah.getFullYear();case 1:return ah.getMonth();case 2:return ah.getDate()}}}for(;;){var N=W.lastIndex,V=W.exec(ad);var S=ad.slice(N,V?V.index:ad.length);ae+=this.appendPreOrPostMatch(S,af);if(!V){break}if(ae%2){af.push(V[0]);continue}var X=V[0],L=X.length;switch(X){case"ddd":case"dddd":var T=(L===3)?U.days.namesAbbr:U.days.names;af.push(T[Z.getDay()]);break;case"d":case"dd":Q=true;af.push(O(K(Z,2),L));break;case"MMM":case"MMMM":var Y=K(Z,1);af.push(U.months[L===3?"namesAbbr":"names"][Y]);break;case"M":case"MM":af.push(O(K(Z,1)+1,L));break;case"y":case"yy":case"yyyy":Y=this.getEraYear(Z,U,this.getEra(Z,aa),H);if(L<4){Y=Y%100}af.push(O(Y,L));break;case"h":case"hh":M=Z.getHours()%12;if(M===0){M=12}af.push(O(M,L));break;case"H":case"HH":af.push(O(Z.getHours(),L));break;case"m":case"mm":af.push(O(Z.getMinutes(),L));break;case"s":case"ss":af.push(O(Z.getSeconds(),L));break;case"t":case"tt":Y=Z.getHours()<12?(U.AM?U.AM[0]:" "):(U.PM?U.PM[0]:" ");af.push(L===1?Y.charAt(0):Y);break;case"f":case"ff":case"fff":af.push(O(Z.getMilliseconds(),3).substr(0,L));break;case"z":case"zz":M=Z.getTimezoneOffset()/60;af.push((M<=0?"+":"-")+O(Math.floor(Math.abs(M)),L));break;case"zzz":M=Z.getTimezoneOffset()/60;af.push((M<=0?"+":"-")+O(Math.floor(Math.abs(M)),2)+":"+O(Math.abs(Z.getTimezoneOffset()%60),2));break;case"g":case"gg":if(U.eras){af.push(U.eras[getEra(Z,aa)].name)}break;case"/":af.push(U["/"]);break;default:throw"Invalid date format pattern '"+X+"'.";break}}var P=af.join("");if(!this.datescache){this.datescache=new Array()}this.datescache[J]=P;return P}});i.jqx.data={};var l,E,p=/#.*$/,a=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,f=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,j=/^(?:GET|HEAD)$/,o=/^\/\//,k=/\?/,b=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,d=/([?&])_=[^&]*/,h=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,t=/\s+/,F=jQuery.fn.load,G={},C={},q=["*/"]+["*"];try{E=location.href}catch(A){E=document.createElement("a");E.href="";E=E.href}l=h.exec(E.toLowerCase())||[];function r(e){return function(K,M){if(typeof K!=="string"){M=K;K="*"}var H,N,O,J=K.toLowerCase().split(t),I=0,L=J.length;if(jQuery.isFunction(M)){for(;I<L;I++){H=J[I];O=/^\+/.test(H);if(O){H=H.substr(1)||"*"}N=e[H]=e[H]||[];N[O?"unshift":"push"](M)}}}}function v(H,Q,L,O,N,J){N=N||Q.dataTypes[0];J=J||{};J[N]=true;var P,M=H[N],I=0,e=M?M.length:0,K=(H===G);for(;I<e&&(K||!P);I++){P=M[I](Q,L,O);if(typeof P==="string"){if(!K||J[P]){P=undefined}else{Q.dataTypes.unshift(P);P=v(H,Q,L,O,P,J)}}}if((K||!P)&&!J["*"]){P=v(H,Q,L,O,"*",J)}return P}function u(I,J){var H,e,K=i.jqx.data.ajaxSettings.flatOptions||{};for(H in J){if(J[H]!==undefined){(K[H]?I:(e||(e={})))[H]=J[H]}}if(e){jQuery.extend(true,I,e)}}i.extend(i.jqx.data,{ajaxSetup:function(H,e){if(e){u(H,i.jqx.data.ajaxSettings)}else{e=H;H=i.jqx.data.ajaxSettings}u(H,e);return H},ajaxSettings:{url:E,isLocal:f.test(l[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":q},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":window.String,"text html":true,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:r(G),ajaxTransport:r(C),ajax:function(M,J){if(typeof M==="object"){J=M;M=undefined}J=J||{};var P,ad,K,Y,R,V,I,X,Q=i.jqx.data.ajaxSetup({},J),af=Q.context||Q,T=af!==Q&&(af.nodeType||af instanceof jQuery)?jQuery(af):jQuery.event,ae=jQuery.Deferred(),aa=jQuery.Callbacks("once memory"),N=Q.statusCode||{},U={},ab={},L=0,O="canceled",W={readyState:0,setRequestHeader:function(ag,ah){if(!L){var e=ag.toLowerCase();ag=ab[e]=ab[e]||ag;U[ag]=ah}return this},getAllResponseHeaders:function(){return L===2?ad:null},getResponseHeader:function(ag){var e;if(L===2){if(!K){K={};while((e=a.exec(ad))){K[e[1].toLowerCase()]=e[2]}}e=K[ag.toLowerCase()]}return e===undefined?null:e},overrideMimeType:function(e){if(!L){Q.mimeType=e}return this},abort:function(e){e=e||O;if(Y){Y.abort(e)}S(0,e);return this}};function S(ak,ag,al,ai){var e,ao,am,aj,an,ah=ag;if(L===2){return}L=2;if(R){clearTimeout(R)}Y=undefined;ad=ai||"";W.readyState=ak>0?4:0;if(al){aj=B(Q,W,al)}if(ak>=200&&ak<300||ak===304){if(Q.ifModified){an=W.getResponseHeader("Last-Modified");if(an){jQuery.lastModified[P]=an}an=W.getResponseHeader("Etag");if(an){jQuery.etag[P]=an}}if(ak===304){ah="notmodified";e=true}else{e=c(Q,aj);ah=e.state;ao=e.data;am=e.error;e=!am}}else{am=ah;if(!ah||ak){ah="error";if(ak<0){ak=0}}}W.status=ak;W.statusText=(ag||ah)+"";if(e){ae.resolveWith(af,[ao,ah,W])}else{ae.rejectWith(af,[W,ah,am])}W.statusCode(N);N=undefined;if(I){T.trigger("ajax"+(e?"Success":"Error"),[W,Q,e?ao:am])}aa.fireWith(af,[W,ah]);if(I){T.trigger("ajaxComplete",[W,Q]);if(!(--jQuery.active)){jQuery.event.trigger("ajaxStop")}}}ae.promise(W);W.success=W.done;W.error=W.fail;W.complete=aa.add;W.statusCode=function(ag){if(ag){var e;if(L<2){for(e in ag){N[e]=[N[e],ag[e]]}}else{e=ag[W.status];W.always(e)}}return this};Q.url=((M||Q.url)+"").replace(p,"").replace(o,l[1]+"//");Q.dataTypes=jQuery.trim(Q.dataType||"*").toLowerCase().split(t);if(Q.crossDomain==null){V=h.exec(Q.url.toLowerCase());Q.crossDomain=!!(V&&(V[1]!==l[1]||V[2]!==l[2]||(V[3]||(V[1]==="http:"?80:443))!=(l[3]||(l[1]==="http:"?80:443))))}if(Q.data&&Q.processData&&typeof Q.data!=="string"){Q.data=jQuery.param(Q.data,Q.traditional)}v(G,Q,J,W);if(L===2){return W}I=Q.global;Q.type=Q.type.toUpperCase();Q.hasContent=!j.test(Q.type);if(I&&jQuery.active++===0){jQuery.event.trigger("ajaxStart")}if(!Q.hasContent){if(Q.data){Q.url+=(k.test(Q.url)?"&":"?")+Q.data;delete Q.data}P=Q.url;if(Q.cache===false){var H=jQuery.now(),ac=Q.url.replace(d,"$1_="+H);Q.url=ac+((ac===Q.url)?(k.test(Q.url)?"&":"?")+"_="+H:"")}}if(Q.data&&Q.hasContent&&Q.contentType!==false||J.contentType){W.setRequestHeader("Content-Type",Q.contentType)}if(Q.ifModified){P=P||Q.url;if(jQuery.lastModified[P]){W.setRequestHeader("If-Modified-Since",jQuery.lastModified[P])}if(jQuery.etag[P]){W.setRequestHeader("If-None-Match",jQuery.etag[P])}}W.setRequestHeader("Accept",Q.dataTypes[0]&&Q.accepts[Q.dataTypes[0]]?Q.accepts[Q.dataTypes[0]]+(Q.dataTypes[0]!=="*"?", "+q+"; q=0.01":""):Q.accepts["*"]);for(X in Q.headers){W.setRequestHeader(X,Q.headers[X])}if(Q.beforeSend&&(Q.beforeSend.call(af,W,Q)===false||L===2)){return W.abort()}O="abort";for(X in {success:1,error:1,complete:1}){W[X](Q[X])}Y=v(C,Q,J,W);if(!Y){S(-1,"No Transport")}else{W.readyState=1;if(I){T.trigger("ajaxSend",[W,Q])}if(Q.async&&Q.timeout>0){R=setTimeout(function(){W.abort("timeout")},Q.timeout)}try{L=1;Y.send(U,S)}catch(Z){if(L<2){S(-1,Z)}else{throw Z}}}return W},active:0,lastModified:{},etag:{}});function B(P,O,L){var K,M,J,e,H=P.contents,N=P.dataTypes,I=P.responseFields;for(M in I){if(M in L){O[I[M]]=L[M]}}while(N[0]==="*"){N.shift();if(K===undefined){K=P.mimeType||O.getResponseHeader("content-type")}}if(K){for(M in H){if(H[M]&&H[M].test(K)){N.unshift(M);break}}}if(N[0] in L){J=N[0]}else{for(M in L){if(!N[0]||P.converters[M+" "+N[0]]){J=M;break}if(!e){e=M}}J=J||e}if(J){if(J!==N[0]){N.unshift(J)}return L[J]}}function c(R,J){var P,H,N,L,O=R.dataTypes.slice(),I=O[0],Q={},K=0;if(R.dataFilter){J=R.dataFilter(J,R.dataType)}if(O[1]){for(P in R.converters){Q[P.toLowerCase()]=R.converters[P]}}for(;(N=O[++K]);){if(N!=="*"){if(I!=="*"&&I!==N){P=Q[I+" "+N]||Q["* "+N];if(!P){for(H in Q){L=H.split(" ");if(L[1]===N){P=Q[I+" "+L[0]]||Q["* "+L[0]];if(P){if(P===true){P=Q[H]}else{if(Q[H]!==true){N=L[0];O.splice(K--,0,N)}}break}}}}if(P!==true){if(P&&R["throws"]){J=P(J)}else{try{J=P(J)}catch(M){return{state:"parsererror",error:P?M:"No conversion from "+I+" to "+N}}}}}I=N}}return{state:"success",data:J}}var y=[],n=/\?/,D=/(=)\?(?=&|$)|\?\?/,z=jQuery.now();i.jqx.data.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=y.pop()||(jQuery.expando+"_"+(z++));this[e]=true;return e}});i.jqx.data.ajaxPrefilter("json jsonp",function(Q,L,P){var O,e,N,J=Q.data,H=Q.url,I=Q.jsonp!==false,M=I&&D.test(H),K=I&&!M&&typeof J==="string"&&!(Q.contentType||"").indexOf("application/x-www-form-urlencoded")&&D.test(J);if(Q.dataTypes[0]==="jsonp"||M||K){O=Q.jsonpCallback=jQuery.isFunction(Q.jsonpCallback)?Q.jsonpCallback():Q.jsonpCallback;e=window[O];if(M){Q.url=H.replace(D,"$1"+O)}else{if(K){Q.data=J.replace(D,"$1"+O)}else{if(I){Q.url+=(n.test(H)?"&":"?")+Q.jsonp+"="+O}}}Q.converters["script json"]=function(){if(!N){jQuery.error(O+" was not called")}return N[0]};Q.dataTypes[0]="json";window[O]=function(){N=arguments};P.always(function(){window[O]=e;if(Q[O]){Q.jsonpCallback=L.jsonpCallback;y.push(O)}if(N&&jQuery.isFunction(e)){e(N[0])}N=e=undefined});return"script"}});i.jqx.data.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){jQuery.globalEval(e);return e}}});i.jqx.data.ajaxPrefilter("script",function(e){if(e.cache===undefined){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});i.jqx.data.ajaxTransport("script",function(I){if(I.crossDomain){var e,H=document.head||document.getElementsByTagName("head")[0]||document.documentElement;return{send:function(J,K){e=document.createElement("script");e.async="async";if(I.scriptCharset){e.charset=I.scriptCharset}e.src=I.url;e.onload=e.onreadystatechange=function(M,L){if(L||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(H&&e.parentNode){H.removeChild(e)}e=undefined;if(!L){K(200,"success")}}};H.insertBefore(e,H.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var w,x=window.ActiveXObject?function(){for(var e in w){w[e](0,1)}}:false,m=0;function g(){try{return new window.XMLHttpRequest()}catch(H){}}function s(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(H){}}i.jqx.data.ajaxSettings.xhr=window.ActiveXObject?function(){return !this.isLocal&&g()||s()}:g;(function(e){jQuery.extend(jQuery.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(i.jqx.data.ajaxSettings.xhr());if(jQuery.support.ajax){i.jqx.data.ajaxTransport(function(e){if(!e.crossDomain||jQuery.support.cors){var H;return{send:function(N,I){var L,K,M=e.xhr();if(e.username){M.open(e.type,e.url,e.async,e.username,e.password)}else{M.open(e.type,e.url,e.async)}if(e.xhrFields){for(K in e.xhrFields){M[K]=e.xhrFields[K]}}if(e.mimeType&&M.overrideMimeType){M.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!N["X-Requested-With"]){N["X-Requested-With"]="XMLHttpRequest"}try{for(K in N){M.setRequestHeader(K,N[K])}}catch(J){}M.send((e.hasContent&&e.data)||null);H=function(W,Q){var R,P,O,U,T;try{if(H&&(Q||M.readyState===4)){H=undefined;if(L){M.onreadystatechange=jQuery.noop;if(x){delete w[L]}}if(Q){if(M.readyState!==4){M.abort()}}else{R=M.status;O=M.getAllResponseHeaders();U={};T=M.responseXML;if(T&&T.documentElement){U.xml=T}try{U.text=M.responseText}catch(V){}try{P=M.statusText}catch(V){P=""}if(!R&&e.isLocal&&!e.crossDomain){R=U.text?200:404}else{if(R===1223){R=204}}}}}catch(S){if(!Q){I(-1,S)}}if(U){I(R,P,U,O)}};if(!e.async){H()}else{if(M.readyState===4){setTimeout(H,0)}else{L=++m;if(x){if(!w){w={};jQuery(window).unload(x)}w[L]=H}M.onreadystatechange=H}}},abort:function(){if(H){H(0,1)}}}}})}i.jqx.filter=function(){this.operator="and";var M=0;var J=1;var P=["EMPTY","NOT_EMPTY","CONTAINS","CONTAINS_CASE_SENSITIVE","DOES_NOT_CONTAIN","DOES_NOT_CONTAIN_CASE_SENSITIVE","STARTS_WITH","STARTS_WITH_CASE_SENSITIVE","ENDS_WITH","ENDS_WITH_CASE_SENSITIVE","EQUAL","EQUAL_CASE_SENSITIVE","NULL","NOT_NULL"];var R=["EQUAL","NOT_EQUAL","LESS_THAN","LESS_THAN_OR_EQUAL","GREATER_THAN","GREATER_THAN_OR_EQUAL","NULL","NOT_NULL"];var S=["EQUAL","NOT_EQUAL","LESS_THAN","LESS_THAN_OR_EQUAL","GREATER_THAN","GREATER_THAN_OR_EQUAL","NULL","NOT_NULL"];var L=["EQUAL","NOT_EQUAL"];var K=new Array();var Q=new Array();this.evaluate=function(X){var V=true;for(var W=0;W<K.length;W++){var U=K[W].evaluate(X);if(W==0){V=U}else{if(Q[W]==J||Q[W]=="or"){V=V||U}else{V=V&&U}}}return V};this.getfilterscount=function(){return K.length};this.setoperatorsbyfiltertype=function(U,V){switch(U){case"numericfilter":R=V;break;case"stringfilter":P=V;break;case"datefilter":S=V;break;case"booleanfilter":L=V;break}};this.getoperatorsbyfiltertype=function(U){var V=new Array();switch(U){case"numericfilter":V=R.slice(0);break;case"stringfilter":V=P.slice(0);break;case"datefilter":V=S.slice(0);break;case"booleanfilter":V=L.slice(0);break}return V};var O=function(){var U=function(){return(((1+Math.random())*65536)|0).toString(16).substring(1)};return(U()+"-"+U()+"-"+U())};this.createfilter=function(Y,V,X,W,U,Z){if(Y==null||Y==undefined){return null}switch(Y){case"numericfilter":return new N(V,X.toUpperCase());case"stringfilter":return new T(V,X.toUpperCase());case"datefilter":return new H(V,X.toUpperCase(),U,Z);case"booleanfilter":return new I(V,X.toUpperCase());case"custom":return new e(V,X.toUpperCase(),W)}throw new Error("jqxGrid: There is no such filter type. The available filter types are: 'numericfilter', 'stringfilter', 'datefilter' and 'booleanfilter'");return null};this.getfilters=function(){var U=new Array();for(var V=0;V<K.length;V++){var W={value:K[V].filtervalue,condition:K[V].comparisonoperator,operator:Q[V],type:K[V].type};U[V]=W}return U};this.addfilter=function(U,V){K[K.length]=V;V.key=O();Q[Q.length]=U};this.removefilter=function(V){for(var U=0;U<K.length;U++){if(K[U].key==V.key){K.splice(U,1);Q.splice(U,1);break}}};this.getoperatorat=function(U){if(U==undefined||U==null){return null}if(U<0||U>K.length){return null}return Q[U]};this.setoperatorat=function(V,U){if(V==undefined||V==null){return null}if(V<0||V>K.length){return null}Q[U]=U};this.getfilterat=function(U){if(U==undefined||U==null){return null}if(U<0||U>K.length){return null}return K[U]};this.setfilterat=function(U,V){if(U==undefined||U==null){return null}if(U<0||U>K.length){return null}V.key=O();K[U]=V};this.clear=function(){K=new Array();Q=new Array()};var T=function(V,U){this.filtervalue=V;this.comparisonoperator=U;this.type="stringfilter";this.evaluate=function(Z){var Y=this.filtervalue;var W=this.comparisonoperator;if(Z==null||Z==undefined||Z==""){if(W=="NULL"){return true}return false}var aa="";try{aa=Z.toString()}catch(X){return true}switch(W){case"EQUAL":return i.jqx.string.equalsIgnoreCase(aa,Y);case"EQUAL_CASE_SENSITIVE":return i.jqx.string.equals(aa,Y);case"NOT_EQUAL":return !i.jqx.string.equalsIgnoreCase(aa,Y);case"NOT_EQUAL_CASE_SENSITIVE":return !i.jqx.string.equals(aa,Y);case"CONTAINS":return i.jqx.string.containsIgnoreCase(aa,Y);case"CONTAINS_CASE_SENSITIVE":return i.jqx.string.contains(aa,Y);case"DOES_NOT_CONTAIN":return !i.jqx.string.containsIgnoreCase(aa,Y);case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return !i.jqx.string.contains(aa,Y);case"EMPTY":return aa=="";case"NOT_EMPTY":return aa!="";case"NOT_NULL":return aa!=null;case"STARTS_WITH":return i.jqx.string.startsWithIgnoreCase(aa,Y);case"ENDS_WITH":return i.jqx.string.endsWithIgnoreCase(aa,Y);case"ENDS_WITH_CASE_SENSITIVE":return i.jqx.string.endsWith(aa,Y);case"STARTS_WITH_CASE_SENSITIVE":return i.jqx.string.startsWith(aa,Y);default:return false}}};var I=function(V,U){this.filtervalue=V;this.comparisonoperator=U;this.type="booleanfilter";this.evaluate=function(Y){var X=this.filtervalue;var W=this.comparisonoperator;if(Y==null||Y==undefined){if(W=="NULL"){return true}return false}var Z=Y;switch(W){case"EQUAL":return Z==X||Z.toString()==X.toString();case"NOT_EQUAL":return Z!=X&&Z.toString()!=X.toString();default:return false}}};var N=function(V,U){this.filtervalue=V;this.comparisonoperator=U;this.type="numericfilter";this.evaluate=function(Z){var Y=this.filtervalue;var W=this.comparisonoperator;if(Z===null||Z===undefined||Z===""){if(W=="NOT_NULL"){return false}if(W=="NULL"){return true}else{return false}}else{if(W=="NULL"){return false}if(W=="NOT_NULL"){return true}}var aa=Z;try{aa=parseFloat(aa)}catch(X){if(Z.toString()!=""){return false}}switch(W){case"EQUAL":return aa==Y;case"NOT_EQUAL":return aa!=Y;case"GREATER_THAN":return aa>Y;case"GREATER_THAN_OR_EQUAL":return aa>=Y;case"LESS_THAN":return aa<Y;case"LESS_THAN_OR_EQUAL":return aa<=Y;case"STARTS_WITH":return i.jqx.string.startsWithIgnoreCase(aa.toString(),Y.toString());case"ENDS_WITH":return i.jqx.string.endsWithIgnoreCase(aa.toString(),Y.toString());case"ENDS_WITH_CASE_SENSITIVE":return i.jqx.string.endsWith(aa.toString(),Y.toString());case"STARTS_WITH_CASE_SENSITIVE":return i.jqx.string.startsWith(aa.toString(),Y.toString());case"CONTAINS":return i.jqx.string.containsIgnoreCase(aa.toString(),Y.toString());case"CONTAINS_CASE_SENSITIVE":return i.jqx.string.contains(aa.toString(),Y.toString());case"DOES_NOT_CONTAIN":return !i.jqx.string.containsIgnoreCase(aa.toString(),Y.toString());case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return !i.jqx.string.contains(aa.toString(),Y.toString());default:return true}}};var H=function(X,V,W,aa){this.filtervalue=X;this.type="datefilter";if(W!=undefined&&aa!=undefined){var Y=i.jqx.dataFormat.parsedate(X,W,aa);if(Y!=null){this.filterdate=Y}else{var U=i.jqx.dataFormat.tryparsedate(X,aa);if(U!=null){this.filterdate=U}}}else{var Z=new Date(X);if(Z.toString()=="NaN"||Z.toString()=="Invalid Date"){this.filterdate=i.jqx.dataFormat.tryparsedate(X)}else{this.filterdate=Z}}if(!this.filterdate){var Z=new Date(X);if(Z.toString()=="NaN"||Z.toString()=="Invalid Date"){this.filterdate=i.jqx.dataFormat.tryparsedate(X)}else{this.filterdate=Z}}this.comparisonoperator=V;this.evaluate=function(ai){var aj=this.filtervalue;var ag=this.comparisonoperator;if(ai==null||ai==undefined||ai==""){if(ag=="NOT_NULL"){return false}if(ag=="NULL"){return true}else{return false}}else{if(ag=="NULL"){return false}if(ag=="NOT_NULL"){return true}}var ab=new Date();ab.setFullYear(1900,0,1);ab.setHours(12,0,0,0);try{var ae=new Date(ai);if(ae.toString()=="NaN"||ae.toString()=="Invalid Date"){ai=i.jqx.dataFormat.tryparsedate(ai)}else{ai=ae}ab=ai}catch(af){if(ai.toString()!=""){return false}}if(this.filterdate!=null){aj=this.filterdate}else{if(aj.indexOf){if(aj.indexOf(":")!=-1||!isNaN(parseInt(aj))){var ah=new Date(ab);ah.setHours(12,0,0,0);var ac=aj.split(":");for(var ad=0;ad<ac.length;ad++){if(ad==0){ah.setHours(ac[ad])}if(ad==1){ah.setMinutes(ac[ad])}if(ad==2){ah.setSeconds(ac[ad])}}aj=ah}}}if(ab==null){ab=""}switch(ag){case"EQUAL":return ab.toString()==aj.toString();case"NOT_EQUAL":return ab.toString()!=aj.toString();case"GREATER_THAN":return ab>aj;case"GREATER_THAN_OR_EQUAL":return ab>=aj;case"LESS_THAN":return ab<aj;case"LESS_THAN_OR_EQUAL":return ab<=aj;case"STARTS_WITH":return i.jqx.string.startsWithIgnoreCase(ab.toString(),aj.toString());case"ENDS_WITH":return i.jqx.string.endsWithIgnoreCase(ab.toString(),aj.toString());case"ENDS_WITH_CASE_SENSITIVE":return i.jqx.string.endsWith(ab.toString(),aj.toString());case"STARTS_WITH_CASE_SENSITIVE":return i.jqx.string.startsWith(ab.toString(),aj.toString());case"CONTAINS":return i.jqx.string.containsIgnoreCase(ab.toString(),aj.toString());case"CONTAINS_CASE_SENSITIVE":return i.jqx.string.contains(ab.toString(),aj.toString());case"DOES_NOT_CONTAIN":return !i.jqx.string.containsIgnoreCase(ab.toString(),aj.toString());case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return !i.jqx.string.contains(ab.toString(),aj.toString());default:return true}}};var e=function(V,U,W){this.filtervalue=V;this.comparisonoperator=U;this.evaluate=function(Y,X){return W(this.filtervalue,Y,this.comparisonoperator)}}}})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.cssroundedcorners=function(b){var c={all:"jqx-rc-all",top:"jqx-rc-t",bottom:"jqx-rc-b",left:"jqx-rc-l",right:"jqx-rc-r","top-right":"jqx-rc-tr","top-left":"jqx-rc-tl","bottom-right":"jqx-rc-br","bottom-left":"jqx-rc-bl"};for(prop in c){if(!c.hasOwnProperty(prop)){continue}if(b==prop){return c[prop]}}};a.jqx.jqxWidget("jqxButton","",{});a.extend(a.jqx._jqxButton.prototype,{defineInstance:function(){this.cursor="arrow";this.roundedCorners="all";this.disabled=false;this.height=null;this.width=null;this.overrideTheme=false;this.enableHover=true;this.rtl=false;this._ariaDisabled=false;this.aria={"aria-disabled":{name:"disabled",type:"boolean"}}},createInstance:function(d){var b=this;this._setSize();if(!this._ariaDisabled){this.host.attr("role","button")}if(!this.overrideTheme){this.host.addClass(this.toThemeProperty(a.jqx.cssroundedcorners(this.roundedCorners)));this.host.addClass(this.toThemeProperty("jqx-button"));this.host.addClass(this.toThemeProperty("jqx-widget"))}this.isTouchDevice=a.jqx.mobile.isTouchDevice();if(!this._ariaDisabled){a.jqx.aria(this)}if(this.cursor!="arrow"){if(!this.disabled){this.host.css({cursor:this.cursor})}else{this.host.css({cursor:"arrow"})}}this.addHandler(this.host,"mouseenter mouseleave mousedown focus blur",function(g){switch(g.type){case"mouseenter":if(!this.isTouchDevice){if(!b.disabled&&b.enableHover){b.isMouseOver=true;b.refresh()}}break;case"mouseleave":if(!this.isTouchDevice){if(!b.disabled&&b.enableHover){b.isMouseOver=false;b.refresh()}}break;case"mousedown":if(!b.disabled){b.isPressed=true;b.refresh()}break;case"focus":if(!b.disabled){b.isFocused=true;b.refresh()}break;case"blur":if(!b.disabled){b.isFocused=false;b.refresh()}break}});this.mouseupfunc=function(g){if(!b.disabled){b.isPressed=false;b.refresh()}};this.addHandler(a(document),"mouseup.button"+this.element.id,this.mouseupfunc);try{if(document.referrer!=""||window.frameElement){if(window.top!=null&&window.top!=window.self){var f="";if(window.parent&&document.referrer){f=document.referrer}if(f.indexOf(document.location.host)!=-1){var e=function(g){b.isPressed=false;b.refresh()};if(window.top.document){this.addHandler(a(window.top.document),"mouseup",e)}}}}}catch(c){}this.propertyChangeMap.roundedCorners=function(g,i,h,j){g.refresh()};this.propertyChangeMap.width=function(g,i,h,j){g._setSize();g.refresh()};this.propertyChangeMap.height=function(g,i,h,j){g._setSize();g.refresh()};this.propertyChangeMap.disabled=function(g,i,h,j){if(h!=j){g.host[0].disabled=j;g.refresh();if(!j){g.host.css({cursor:g.cursor})}else{g.host.css({cursor:"arrow"})}a.jqx.aria(g,"aria-disabled",g.disabled)}};this.propertyChangeMap.rtl=function(g,i,h,j){if(h!=j){g.refresh()}};this.propertyChangeMap.theme=function(g,i,h,j){g.host.removeClass();g.host.addClass(g.toThemeProperty("jqx-button"));g.host.addClass(g.toThemeProperty("jqx-widget"));if(!g.overrideTheme){g.host.addClass(g.toThemeProperty(a.jqx.cssroundedcorners(g.roundedCorners)))}g._oldCSSCurrent=null;g.refresh()}},val:function(){var b=this.host.find("input");if(b.length>0){if(arguments.length==0||typeof(value)=="object"){return b.val()}b.val(value);this.refresh();return b.val()}if(arguments.length==0||typeof(value)=="object"){return this.element.value}this.element.value=arguments[0];this.refresh()},_setSize:function(){if(this.width!=null&&(this.width.toString().indexOf("px")!=-1||this.width.toString().indexOf("%")!=-1)){this.host.css("width",this.width)}else{if(this.width!=undefined&&!isNaN(this.width)){this.host.css("width",this.width)}}if(this.height!=null&&(this.height.toString().indexOf("px")!=-1||this.height.toString().indexOf("%")!=-1)){this.host.css("height",parseInt(this.height)+2)}else{if(this.height!=undefined&&!isNaN(this.height)){this.host.css("height",parseInt(this.height)+2)}}},_removeHandlers:function(){this.removeHandler(this.host,"selectstart");this.removeHandler(this.host,"click");this.removeHandler(this.host,"focus");this.removeHandler(this.host,"blur");this.removeHandler(this.host,"mouseenter");this.removeHandler(this.host,"mouseleave");this.removeHandler(this.host,"mousedown");this.removeHandler(a(document),"mouseup.button"+this.element.id,this.mouseupfunc);this.mouseupfunc=null;delete this.mouseupfunc},focus:function(){this.host.focus()},destroy:function(){this._removeHandlers();this.host.removeClass();this.host.removeData();this.host.remove();delete this.set;delete this.get;delete this.call},render:function(){this.refresh()},refresh:function(){if(this.overrideTheme){return}var d=this.toThemeProperty("jqx-fill-state-focus");var h=this.toThemeProperty("jqx-fill-state-disabled");var b=this.toThemeProperty("jqx-fill-state-normal");var g=this.toThemeProperty("jqx-fill-state-hover");var e=this.toThemeProperty("jqx-fill-state-pressed");var f=this.toThemeProperty("jqx-fill-state-pressed");var c="";this.host[0].disabled=this.disabled;if(this.disabled){c=h}else{if(this.isMouseOver&&!this.isTouchDevice){if(this.isPressed){c=f}else{c=g}}else{if(this.isPressed){c=e}else{c=b}}}if(this.isFocused){c+=" "+d}if(c!=this._oldCSSCurrent){if(this._oldCSSCurrent){this.host.removeClass(this._oldCSSCurrent)}this.host.addClass(c);this._oldCSSCurrent=c}if(this.rtl){this.host.addClass(this.toThemeProperty("jqx-rtl"));this.host.css("direction","rtl")}}});a.jqx.jqxWidget("jqxLinkButton","",{});a.extend(a.jqx._jqxLinkButton.prototype,{defineInstance:function(){this.disabled=false;this.height=null;this.width=null;this.rtl=false;this.href=null},createInstance:function(d){var c=this;this.host.onselectstart=function(){return false};this.host.attr("role","button");var b=this.height||this.host.height();var e=this.width||this.host.width();this.href=this.host.attr("href");this.target=this.host.attr("target");this.content=this.host.text();this.element.innerHTML="";this.host.append("<input type='button' class='jqx-wrapper'/>");var f=this.host.find("input");f.addClass(this.toThemeProperty("jqx-reset"));f.width(e);f.height(b);f.val(this.content);this.host.find("tr").addClass(this.toThemeProperty("jqx-reset"));this.host.find("td").addClass(this.toThemeProperty("jqx-reset"));this.host.find("tbody").addClass(this.toThemeProperty("jqx-reset"));this.host.css("color","inherit");this.host.addClass(this.toThemeProperty("jqx-link"));f.css({width:e});f.css({height:b});var g=d==undefined?{}:d[0]||{};f.jqxButton(g);if(this.disabled){this.host[0].disabled=true}this.propertyChangeMap.disabled=function(h,j,i,k){c.host[0].disabled=k};this.addHandler(f,"click",function(h){if(!this.disabled){c.onclick(h)}return false})},onclick:function(b){if(this.target!=null){window.open(this.href,this.target)}else{window.location=this.href}}});a.jqx.jqxWidget("jqxRepeatButton","jqxButton",{});a.extend(a.jqx._jqxRepeatButton.prototype,{defineInstance:function(){this.delay=50},createInstance:function(e){var c=this;var d=a.jqx.mobile.isTouchDevice();var b=!d?"mouseup."+this.base.element.id:"touchend."+this.base.element.id;var f=!d?"mousedown."+this.base.element.id:"touchstart."+this.base.element.id;this.addHandler(a(document),b,function(g){if(c.timeout!=null){clearTimeout(c.timeout);c.timeout=null;c.refresh()}if(c.timer!=undefined){clearInterval(c.timer);c.timer=null;c.refresh()}});this.addHandler(this.base.host,f,function(g){if(c.timer!=null){clearInterval(c.timer)}c.timeout=setTimeout(function(){clearInterval(c.timer);c.timer=setInterval(function(h){c.ontimer(h)},c.delay)},150)});this.mousemovefunc=function(g){if(!d){if(g.which==0){if(c.timer!=null){clearInterval(c.timer);c.timer=null}}}};this.addHandler(this.base.host,"mousemove",this.mousemovefunc)},destroy:function(){var c=a.jqx.mobile.isTouchDevice();var b=!c?"mouseup."+this.base.element.id:"touchend."+this.base.element.id;var d=!c?"mousedown."+this.base.element.id:"touchstart."+this.base.element.id;this.removeHandler(this.base.host,"mousemove",this.mousemovefunc);this.removeHandler(this.base.host,d);this.removeHandler(a(document),b);this.timer=null;delete this.mousemovefunc;delete this.timer;this.base.destroy();delete this},stop:function(){clearInterval(this.timer);this.timer=null},ontimer:function(b){var b=new jQuery.Event("click");if(this.base!=null&&this.base.host!=null){this.base.host.trigger(b)}}});a.jqx.jqxWidget("jqxToggleButton","jqxButton",{});a.extend(a.jqx._jqxToggleButton.prototype,{defineInstance:function(){this.toggled=false;this.aria={"aria-checked":{name:"toggled",type:"boolean"},"aria-disabled":{name:"disabled",type:"boolean"}}},createInstance:function(c){var b=this;this.base.overrideTheme=true;this.isTouchDevice=a.jqx.mobile.isTouchDevice();a.jqx.aria(this);this.propertyChangeMap.toggled=function(d,f,e,g){d.refresh()};this.propertyChangeMap.disabled=function(d,f,e,g){b.base.disabled=g;d.refresh()};this.addHandler(this.base.host,"click",function(d){if(!b.base.disabled){b.toggle()}});if(!this.isTouchDevice){this.addHandler(this.base.host,"mouseenter",function(d){if(!b.base.disabled){b.refresh()}});this.addHandler(this.base.host,"mouseleave",function(d){if(!b.base.disabled){b.refresh()}})}this.addHandler(this.base.host,"mousedown",function(d){if(!b.base.disabled){b.refresh()}});this.addHandler(a(document),"mouseup",function(d){if(!b.base.disabled){b.refresh()}})},_removeHandlers:function(){this.removeHandler(this.base.host,"click");this.removeHandler(this.base.host,"mouseenter");this.removeHandler(this.base.host,"mouseleave");this.removeHandler(this.base.host,"mousedown");this.removeHandler(a(document),"mouseup")},toggle:function(){this.toggled=!this.toggled;this.refresh();a.jqx.aria(this,"aria-checked",this.toggled)},unCheck:function(){this.toggled=false;this.refresh()},check:function(){this.toggled=true;this.refresh()},refresh:function(){var g=this.base.toThemeProperty("jqx-fill-state-disabled");var b=this.base.toThemeProperty("jqx-fill-state-normal");var f=this.base.toThemeProperty("jqx-fill-state-hover");var d=this.base.toThemeProperty("jqx-fill-state-pressed");var e=this.base.toThemeProperty("jqx-fill-state-pressed");var c="";this.base.host[0].disabled=this.base.disabled;if(this.base.disabled){c=g}else{if(this.base.isMouseOver&&!this.isTouchDevice){if(this.base.isPressed||this.toggled){c=e}else{c=f}}else{if(this.base.isPressed||this.toggled){c=d}else{c=b}}}if(this.base.host.hasClass(g)&&g!=c){this.base.host.removeClass(g)}if(this.base.host.hasClass(b)&&b!=c){this.base.host.removeClass(b)}if(this.base.host.hasClass(f)&&f!=c){this.base.host.removeClass(f)}if(this.base.host.hasClass(d)&&d!=c){this.base.host.removeClass(d)}if(this.base.host.hasClass(e)&&e!=c){this.base.host.removeClass(e)}if(!this.base.host.hasClass(c)){this.base.host.addClass(c)}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.jqxWidget("jqxScrollBar","",{});a.extend(a.jqx._jqxScrollBar.prototype,{defineInstance:function(){this.height=null;this.width=null;this.vertical=false;this.min=0;this.max=1000;this.value=this.min;this.step=10;this.largestep=50;this.thumbMinSize=10;this.thumbSize=0;this.thumbStep="auto";this.roundedCorners="all";this.showButtons=true;this.disabled=false;this.touchMode="auto";this.touchModeStyle="auto";this.thumbTouchSize=0;this._triggervaluechanged=true;this.rtl=false;this.areaDownCapture=false;this.areaUpCapture=false;this._initialLayout=false},createInstance:function(b){this.render()},render:function(){this._mouseup=new Date();var b=this;var c="<div id='jqxScrollOuterWrap' style='width:100%; height: 100%; align:left; border: 0px; valign:top; position: relative;'><div id='jqxScrollWrap' style='width:100%; height: 100%; left: 0px; top: 0px; align:left; valign:top; position: absolute;'><div id='jqxScrollBtnUp' style='align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='jqxScrollAreaUp' style='align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='jqxScrollThumb' style='align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='jqxScrollAreaDown' style='align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='jqxScrollBtnDown' style='align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div></div></div>";if(b.WinJS){MSApp.execUnsafeLocalFunction(function(){WinJS.Utilities.setInnerHTMLUnsafe(this.element,c)})}else{this.element.innerHTML=c}if(this.width!=undefined&&parseInt(this.width)>0){this.host.width(parseInt(this.width))}if(this.height!=undefined&&parseInt(this.height)>0){this.host.height(parseInt(this.height))}this.isPercentage=false;if(this.width!=null&&this.width.toString().indexOf("%")!=-1){this.host.width(this.width);this.isPercentage=true}if(this.height!=null&&this.height.toString().indexOf("%")!=-1){this.host.height(this.height);this.isPercentage=true}if(this.isPercentage){var d=this;a.jqx.utilities.resize(this.host,function(){d._arrange()},false)}this.thumbCapture=false;this.btnUp=this.host.find("#jqxScrollBtnUp");this.btnDown=this.host.find("#jqxScrollBtnDown");this.btnThumb=this.host.find("#jqxScrollThumb");this.areaUp=this.host.find("#jqxScrollAreaUp");this.arrowUp=a("<div></div>");this.arrowUp.appendTo(this.btnUp);this.arrowDown=a("<div></div>");this.arrowDown.appendTo(this.btnDown);this.areaDown=this.host.find("#jqxScrollAreaDown");this.scrollWrap=this.host.find("#jqxScrollWrap");this.scrollOuterWrap=this.host.find("#jqxScrollOuterWrap");this.btnUp[0].id="jqxScrollBtnUp"+this.element.id;this.btnDown[0].id="jqxScrollBtnDown"+this.element.id;this.btnThumb[0].id="jqxScrollThumb"+this.element.id;this.areaUp[0].id="jqxScrollAreaUp"+this.element.id;this.areaDown[0].id="jqxScrollAreaDown"+this.element.id;this.scrollWrap[0].id="jqxScrollWrap"+this.element.id;this.scrollOuterWrap[0].id="jqxScrollOuterWrap"+this.element.id;if(!this.host.jqxRepeatButton){throw new Error("jqxScrollBar: Missing reference to jqxbuttons.js.");return}this.btnUp.jqxRepeatButton({_ariaDisabled:true,overrideTheme:true,disabled:this.disabled});this.btnDown.jqxRepeatButton({_ariaDisabled:true,overrideTheme:true,disabled:this.disabled});this.btnDownInstance=a.data(this.btnDown[0],"jqxRepeatButton").instance;this.btnUpInstance=a.data(this.btnUp[0],"jqxRepeatButton").instance;this.areaUp.jqxRepeatButton({_ariaDisabled:true,overrideTheme:true});this.areaDown.jqxRepeatButton({_ariaDisabled:true,overrideTheme:true});this.btnThumb.jqxButton({_ariaDisabled:true,overrideTheme:true,disabled:this.disabled});this.propertyChangeMap.value=function(e,g,f,h){if(!(isNaN(h))){if(f!=h){e.setPosition(parseFloat(h),true)}}};this.propertyChangeMap.width=function(e,g,f,h){if(e.width!=undefined&&parseInt(e.width)>0){e.host.width(parseInt(e.width));e._arrange()}};this.propertyChangeMap.height=function(e,g,f,h){if(e.height!=undefined&&parseInt(e.height)>0){e.host.height(parseInt(e.height));e._arrange()}};this.propertyChangeMap.theme=function(e,g,f,h){e.setTheme()};this.propertyChangeMap.max=function(e,g,f,h){if(!(isNaN(h))){if(f!=h){e.max=parseInt(h);if(e.min>e.max){e.max=e.min+1}e._arrange();e.setPosition(e.value)}}};this.propertyChangeMap.min=function(e,g,f,h){if(!(isNaN(h))){if(f!=h){e.min=parseInt(h);if(e.min>e.max){e.max=e.min+1}e._arrange();e.setPosition(e.value)}}};this.propertyChangeMap.disabled=function(e,g,f,h){if(f!=h){if(h){e.host.addClass(e.toThemeProperty("jqx-fill-state-disabled"))}else{e.host.removeClass(e.toThemeProperty("jqx-fill-state-disabled"))}e.btnUp.jqxRepeatButton("disabled",e.disabled);e.btnDown.jqxRepeatButton("disabled",e.disabled);e.btnThumb.jqxButton("disabled",e.disabled)}};this.propertyChangeMap.touchMode=function(e,g,f,h){if(f!=h){e._updateTouchBehavior();if(h===true){e.showButtons=false;e.refresh()}else{if(h===false){e.showButtons=true;e.refresh()}}}};this.buttonUpCapture=false;this.buttonDownCapture=false;this._updateTouchBehavior();this.setPosition(this.value);this._addHandlers();this.setTheme()},_updateTouchBehavior:function(){this.isTouchDevice=a.jqx.mobile.isTouchDevice();if(this.touchMode==true){if(a.jqx.browser.msie&&a.jqx.browser.version<9){this.setTheme();return}this.isTouchDevice=true;a.jqx.mobile.setMobileSimulator(this.btnThumb[0]);this._removeHandlers();this._addHandlers();this.setTheme()}else{if(this.touchMode==false){this.isTouchDevice=false}}},_addHandlers:function(){var d=this;if(d.isTouchDevice){this.addHandler(this.btnThumb,a.jqx.mobile.getTouchEventName("touchend"),function(h){var i=d.vertical?d.toThemeProperty("jqx-scrollbar-thumb-state-pressed"):d.toThemeProperty("jqx-scrollbar-thumb-state-pressed-horizontal");var j=d.toThemeProperty("jqx-fill-state-pressed");d.btnThumb.removeClass(i);d.btnThumb.removeClass(j);if(!d.disabled){d.handlemouseup(d,h)}});this.addHandler(this.btnThumb,a.jqx.mobile.getTouchEventName("touchstart"),function(h){if(!d.disabled){if(d.touchMode==true){h.clientX=h.originalEvent.clientX;h.clientY=h.originalEvent.clientY}else{var i=h;if(i.originalEvent.touches&&i.originalEvent.touches.length){h.clientX=i.originalEvent.touches[0].clientX;h.clientY=i.originalEvent.touches[0].clientY}else{h.clientX=h.originalEvent.clientX;h.clientY=h.originalEvent.clientY}}d.handlemousedown(h)}});a.jqx.mobile.touchScroll(this.element,d.max,function(n,m,i,h,j){if(d.host.css("visibility")=="visible"){if(d.touchMode==true){j.clientX=j.originalEvent.clientX;j.clientY=j.originalEvent.clientY}else{var l=j;if(l.originalEvent.touches&&l.originalEvent.touches.length){j.clientX=l.originalEvent.touches[0].clientX;j.clientY=l.originalEvent.touches[0].clientY}else{j.clientX=j.originalEvent.clientX;j.clientY=j.originalEvent.clientY}}var k=d.vertical?d.toThemeProperty("jqx-scrollbar-thumb-state-pressed"):d.toThemeProperty("jqx-scrollbar-thumb-state-pressed-horizontal");d.btnThumb.addClass(k);d.btnThumb.addClass(d.toThemeProperty("jqx-fill-state-pressed"));d.handlemousemove(j)}},d.element.id)}this.addHandler(this.btnUp,"click",function(i){var h=d.step;if(d.rtl&&!d.vertical){h=-d.step}if(d.buttonUpCapture&&!d.isTouchDevice){if(!d.disabled){d.setPosition(d.value-h)}}else{if(!d.disabled&&d.isTouchDevice){d.setPosition(d.value-h)}}});this.addHandler(this.btnDown,"click",function(i){var h=d.step;if(d.rtl&&!d.vertical){h=-d.step}if(d.buttonDownCapture&&!d.isTouchDevice){if(!d.disabled){d.setPosition(d.value+h)}}else{if(!d.disabled&&d.isTouchDevice){d.setPosition(d.value+h)}}});if(!this.isTouchDevice){try{if(document.referrer!=""||window.frameElement){if(window.top!=null&&window.top!=window.self){var g=null;if(window.parent&&document.referrer){g=document.referrer}if(g&&g.indexOf(document.location.host)!=-1){var f=function(h){if(!d.disabled){d.handlemouseup(d,h)}};if(window.top.document.addEventListener){window.top.document.addEventListener("mouseup",f,false)}else{if(window.top.document.attachEvent){window.top.document.attachEvent("onmouseup",f)}}}}}}catch(e){}this.addHandler(this.btnDown,"mouseup",function(i){if(!d.btnDownInstance.base.disabled&&d.buttonDownCapture){d.buttonDownCapture=false;d.btnDown.removeClass(d.toThemeProperty("jqx-scrollbar-button-state-pressed"));d.btnDown.removeClass(d.toThemeProperty("jqx-fill-state-pressed"));d._removeArrowClasses("pressed","down");d.handlemouseup(d,i);var h=d.step;if(d.rtl&&!d.vertical){h=-d.step}d.setPosition(d.value+h);return false}});this.addHandler(this.btnUp,"mouseup",function(i){if(!d.btnUpInstance.base.disabled&&d.buttonUpCapture){d.buttonUpCapture=false;d.btnUp.removeClass(d.toThemeProperty("jqx-scrollbar-button-state-pressed"));d.btnUp.removeClass(d.toThemeProperty("jqx-fill-state-pressed"));d._removeArrowClasses("pressed","up");d.handlemouseup(d,i);var h=d.step;if(d.rtl&&!d.vertical){h=-d.step}d.setPosition(d.value-h);return false}});this.addHandler(this.btnDown,"mousedown",function(h){if(!d.btnDownInstance.base.disabled){d.buttonDownCapture=true;d.btnDown.addClass(d.toThemeProperty("jqx-fill-state-pressed"));d.btnDown.addClass(d.toThemeProperty("jqx-scrollbar-button-state-pressed"));d._addArrowClasses("pressed","down");return false}});this.addHandler(this.btnUp,"mousedown",function(h){if(!d.btnUpInstance.base.disabled){d.buttonUpCapture=true;d.btnUp.addClass(d.toThemeProperty("jqx-fill-state-pressed"));d.btnUp.addClass(d.toThemeProperty("jqx-scrollbar-button-state-pressed"));d._addArrowClasses("pressed","up");return false}})}var c="click";if(this.isTouchDevice){c=a.jqx.mobile.getTouchEventName("touchend")}this.addHandler(this.areaUp,c,function(i){if(!d.disabled){var h=d.largestep;if(d.rtl&&!d.vertical){h=-d.largestep}d.setPosition(d.value-h);return false}});this.addHandler(this.areaDown,c,function(i){if(!d.disabled){var h=d.largestep;if(d.rtl&&!d.vertical){h=-d.largestep}d.setPosition(d.value+h);return false}});this.addHandler(this.areaUp,"mousedown",function(h){if(!d.disabled){d.areaUpCapture=true;return false}});this.addHandler(this.areaDown,"mousedown",function(h){if(!d.disabled){d.areaDownCapture=true;return false}});this.addHandler(this.btnThumb,"mousedown",function(h){if(!d.disabled){d.handlemousedown(h)}return false});this.addHandler(this.btnThumb,"dragstart",function(h){return false});this.addHandler(a(document),"mouseup."+this.element.id,function(h){if(!d.disabled){d.handlemouseup(d,h)}});if(!this.isTouchDevice){this.mousemoveFunc=function(h){if(!d.disabled){d.handlemousemove(h)}};this.addHandler(a(document),"mousemove."+this.element.id,this.mousemoveFunc);this.addHandler(a(document),"mouseleave."+this.element.id,function(h){if(!d.disabled){d.handlemouseleave(h)}});this.addHandler(a(document),"mouseenter."+this.element.id,function(h){if(!d.disabled){d.handlemouseenter(h)}});if(!d.disabled){this.addHandler(this.btnUp,"mouseenter",function(){if(!d.disabled&&!d.btnUpInstance.base.disabled&&d.touchMode!=true){d.btnUp.addClass(d.toThemeProperty("jqx-scrollbar-button-state-hover"));d.btnUp.addClass(d.toThemeProperty("jqx-fill-state-hover"));d._addArrowClasses("hover","up")}});this.addHandler(this.btnUp,"mouseleave",function(){if(!d.disabled&&!d.btnUpInstance.base.disabled&&d.touchMode!=true){d.btnUp.removeClass(d.toThemeProperty("jqx-scrollbar-button-state-hover"));d.btnUp.removeClass(d.toThemeProperty("jqx-fill-state-hover"));d._removeArrowClasses("hover","up")}});var b=d.toThemeProperty("jqx-scrollbar-thumb-state-hover");if(!d.vertical){b=d.toThemeProperty("jqx-scrollbar-thumb-state-hover-horizontal")}this.addHandler(this.btnThumb,"mouseenter",function(){if(!d.disabled&&d.touchMode!=true){d.btnThumb.addClass(b);d.btnThumb.addClass(d.toThemeProperty("jqx-fill-state-hover"))}});this.addHandler(this.btnThumb,"mouseleave",function(){if(!d.disabled&&d.touchMode!=true){d.btnThumb.removeClass(b);d.btnThumb.removeClass(d.toThemeProperty("jqx-fill-state-hover"))}});this.addHandler(this.btnDown,"mouseenter",function(){if(!d.disabled&&!d.btnDownInstance.base.disabled&&d.touchMode!=true){d.btnDown.addClass(d.toThemeProperty("jqx-scrollbar-button-state-hover"));d.btnDown.addClass(d.toThemeProperty("jqx-fill-state-hover"));d._addArrowClasses("hover","down")}});this.addHandler(this.btnDown,"mouseleave",function(){if(!d.disabled&&!d.btnDownInstance.base.disabled&&d.touchMode!=true){d.btnDown.removeClass(d.toThemeProperty("jqx-scrollbar-button-state-hover"));d.btnDown.removeClass(d.toThemeProperty("jqx-fill-state-hover"));d._removeArrowClasses("hover","down")}})}}},destroy:function(){var b=this.btnUp;var f=this.btnDown;var d=this.btnThumb;var c=this.scrollWrap;var g=this.areaUp;var e=this.areaDown;e.removeClass();g.removeClass();f.removeClass();b.removeClass();d.removeClass();b.jqxRepeatButton("destroy");f.jqxRepeatButton("destroy");g.jqxRepeatButton("destroy");e.jqxRepeatButton("destroy");d.jqxButton("destroy");this._removeHandlers();this.host.removeClass();this.host.removeData();this.host.remove();this.host=null;this.btnUp=null;this.btnDown=null;this.scrollWrap=null;this.areaUp=null;this.areaDown=null;this.scrollOuterWrap=null;delete this.scrollOuterWrap;delete this.scrollWrap;delete this.btnDown;delete this.areaDown;delete this.areaUp;delete this.btnDown;delete this.btnUp},_removeHandlers:function(){this.removeHandler(this.btnUp,"mouseenter");this.removeHandler(this.btnDown,"mouseenter");this.removeHandler(this.btnThumb,"mouseenter");this.removeHandler(this.btnUp,"mouseleave");this.removeHandler(this.btnDown,"mouseleave");this.removeHandler(this.btnThumb,"mouseleave");this.removeHandler(this.btnUp,"click");this.removeHandler(this.btnDown,"click");this.removeHandler(this.btnDown,"mouseup");this.removeHandler(this.btnUp,"mouseup");this.removeHandler(this.btnDown,"mousedown");this.removeHandler(this.btnUp,"mousedown");this.removeHandler(this.areaUp,"mousedown");this.removeHandler(this.areaDown,"mousedown");this.removeHandler(this.areaUp,"click");this.removeHandler(this.areaDown,"click");this.removeHandler(this.btnThumb,"mousedown");this.removeHandler(this.btnThumb,"dragstart");this.removeHandler(a(document),"mouseup."+this.element.id);if(!this.mousemoveFunc){this.removeHandler(a(document),"mousemove."+this.element.id)}else{this.removeHandler(a(document),"mousemove."+this.element.id,this.mousemoveFunc)}this.removeHandler(a(document),"mouseleave."+this.element.id);this.removeHandler(a(document),"mouseenter."+this.element.id);var b=this},_addArrowClasses:function(c,b){if(c=="pressed"){c="selected"}if(c!=""){c="-"+c}if(this.vertical){if(b=="up"||b==undefined){this.arrowUp.addClass(this.toThemeProperty("jqx-icon-arrow-up"+c))}if(b=="down"||b==undefined){this.arrowDown.addClass(this.toThemeProperty("jqx-icon-arrow-down"+c))}}else{if(b=="up"||b==undefined){this.arrowUp.addClass(this.toThemeProperty("jqx-icon-arrow-left"+c))}if(b=="down"||b==undefined){this.arrowDown.addClass(this.toThemeProperty("jqx-icon-arrow-right"+c))}}},_removeArrowClasses:function(c,b){if(c=="pressed"){c="selected"}if(c!=""){c="-"+c}if(this.vertical){if(b=="up"||b==undefined){this.arrowUp.removeClass(this.toThemeProperty("jqx-icon-arrow-up"+c))}if(b=="down"||b==undefined){this.arrowDown.removeClass(this.toThemeProperty("jqx-icon-arrow-down"+c))}}else{if(b=="up"||b==undefined){this.arrowUp.removeClass(this.toThemeProperty("jqx-icon-arrow-left"+c))}if(b=="down"||b==undefined){this.arrowDown.removeClass(this.toThemeProperty("jqx-icon-arrow-right"+c))}}},setTheme:function(){var o=this.btnUp;var m=this.btnDown;var p=this.btnThumb;var e=this.scrollWrap;var g=this.areaUp;var h=this.areaDown;var f=this.arrowUp;var i=this.arrowDown;this.scrollWrap[0].className=this.toThemeProperty("jqx-reset");this.scrollOuterWrap[0].className=this.toThemeProperty("jqx-reset");var k=this.toThemeProperty("jqx-reset");this.areaDown[0].className=k;this.areaUp[0].className=k;var d=this.toThemeProperty("jqx-scrollbar")+" "+this.toThemeProperty("jqx-widget")+" "+this.toThemeProperty("jqx-widget-content");this.element.className=d;m[0].className=this.toThemeProperty("jqx-scrollbar-button-state-normal");o[0].className=this.toThemeProperty("jqx-scrollbar-button-state-normal");var q="";if(this.vertical){f[0].className=k+" "+this.toThemeProperty("jqx-icon-arrow-up");i[0].className=k+" "+this.toThemeProperty("jqx-icon-arrow-down");q=this.toThemeProperty("jqx-scrollbar-thumb-state-normal")}else{f[0].className=k+" "+this.toThemeProperty("jqx-icon-arrow-left");i[0].className=k+" "+this.toThemeProperty("jqx-icon-arrow-right");q=this.toThemeProperty("jqx-scrollbar-thumb-state-normal-horizontal")}q+=" "+this.toThemeProperty("jqx-fill-state-normal");p[0].className=q;if(this.disabled){e.addClass(this.toThemeProperty("jqx-fill-state-disabled"));e.removeClass(this.toThemeProperty("jqx-scrollbar-state-normal"))}else{e.addClass(this.toThemeProperty("jqx-scrollbar-state-normal"));e.removeClass(this.toThemeProperty("jqx-fill-state-disabled"))}if(this.roundedCorners=="all"){this.host.addClass(this.toThemeProperty("jqx-rc-all"));if(this.vertical){var j=a.jqx.cssroundedcorners("top");j=this.toThemeProperty(j);o.addClass(j);var c=a.jqx.cssroundedcorners("bottom");c=this.toThemeProperty(c);m.addClass(c)}else{var n=a.jqx.cssroundedcorners("left");n=this.toThemeProperty(n);o.addClass(n);var l=a.jqx.cssroundedcorners("right");l=this.toThemeProperty(l);m.addClass(l)}}else{var b=a.jqx.cssroundedcorners(this.roundedCorners);b=this.toThemeProperty(b);elBtnUp.addClass(b);elBtnDown.addClass(b)}var b=a.jqx.cssroundedcorners(this.roundedCorners);b=this.toThemeProperty(b);if(!p.hasClass(b)){p.addClass(b)}if(this.isTouchDevice&&this.touchModeStyle!=false){this.showButtons=false;p.addClass(this.toThemeProperty("jqx-scrollbar-thumb-state-normal-touch"))}},isScrolling:function(){if(this.thumbCapture==undefined||this.buttonDownCapture==undefined||this.buttonUpCapture==undefined||this.areaDownCapture==undefined||this.areaUpCapture==undefined){return false}return this.thumbCapture||this.buttonDownCapture||this.buttonUpCapture||this.areaDownCapture||this.areaUpCapture},handlemousedown:function(c){if(this.thumbCapture==undefined||this.thumbCapture==false){this.thumbCapture=true;var b=this.btnThumb;if(b!=null){b.addClass(this.toThemeProperty("jqx-fill-state-pressed"));if(this.vertical){b.addClass(this.toThemeProperty("jqx-scrollbar-thumb-state-pressed"))}else{b.addClass(this.toThemeProperty("jqx-scrollbar-thumb-state-pressed-horizontal"))}}}this.dragStartX=c.clientX;this.dragStartY=c.clientY;this.dragStartValue=this.value},toggleHover:function(c,b){},refresh:function(){this._arrange()},_setElementPosition:function(c,b,d){if(!isNaN(b)){if(parseInt(c[0].style.left)!=parseInt(b)){c[0].style.left=b+"px"}}if(!isNaN(d)){if(parseInt(c[0].style.top)!=parseInt(d)){c[0].style.top=d+"px"}}},_setElementTopPosition:function(b,c){if(!isNaN(c)){b[0].style.top=c+"px"}},_setElementLeftPosition:function(c,b){if(!isNaN(b)){c[0].style.left=b+"px"}},handlemouseleave:function(e){var b=this.btnUp;var d=this.btnDown;if(this.buttonDownCapture||this.buttonUpCapture){b.removeClass(this.toThemeProperty("jqx-scrollbar-button-state-pressed"));d.removeClass(this.toThemeProperty("jqx-scrollbar-button-state-pressed"));this._removeArrowClasses("pressed")}if(this.thumbCapture!=true){return}var c=this.btnThumb;var f=this.vertical?this.toThemeProperty("jqx-scrollbar-thumb-state-pressed"):this.toThemeProperty("jqx-scrollbar-thumb-state-pressed-horizontal");c.removeClass(f);c.removeClass(this.toThemeProperty("jqx-fill-state-pressed"))},handlemouseenter:function(e){var b=this.btnUp;var d=this.btnDown;if(this.buttonUpCapture){b.addClass(this.toThemeProperty("jqx-scrollbar-button-state-pressed"));b.addClass(this.toThemeProperty("jqx-fill-state-pressed"));this._addArrowClasses("pressed","up")}if(this.buttonDownCapture){d.addClass(this.toThemeProperty("jqx-scrollbar-button-state-pressed"));d.addClass(this.toThemeProperty("jqx-fill-state-pressed"));this._addArrowClasses("pressed","down")}if(this.thumbCapture!=true){return}var c=this.btnThumb;if(this.vertical){c.addClass(this.toThemeProperty("jqx-scrollbar-thumb-state-pressed"))}else{c.addClass(this.toThemeProperty("jqx-scrollbar-thumb-state-pressed-horizontal"))}c.addClass(this.toThemeProperty("jqx-fill-state-pressed"))},handlemousemove:function(b){var i=this.btnUp;var e=this.btnDown;var d=0;if(e==null||i==null){return}if(i!=null&&e!=null&&this.buttonDownCapture!=undefined&&this.buttonUpCapture!=undefined){if(this.buttonDownCapture&&b.which==d){e.removeClass(this.toThemeProperty("jqx-scrollbar-button-state-pressed"));e.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));this._removeArrowClasses("pressed","down");this.buttonDownCapture=false}else{if(this.buttonUpCapture&&b.which==d){i.removeClass(this.toThemeProperty("jqx-scrollbar-button-state-pressed"));i.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));this._removeArrowClasses("pressed","up");this.buttonUpCapture=false}}}if(this.thumbCapture!=true){return false}var k=this.btnThumb;if(b.which==d&&!this.isTouchDevice){this.thumbCapture=false;this._arrange();var j=this.vertical?this.toThemeProperty("jqx-scrollbar-thumb-state-pressed"):this.toThemeProperty("jqx-scrollbar-thumb-state-pressed-horizontal");k.removeClass(j);k.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));return true}if(b.preventDefault!=undefined){b.preventDefault()}if(b.originalEvent!=null){b.originalEvent.mouseHandled=true}if(b.stopPropagation!=undefined){b.stopPropagation()}var l=0;try{if(!this.vertical){l=b.clientX-this.dragStartX}else{l=b.clientY-this.dragStartY}var f=this._btnAndThumbSize;if(!this._btnAndThumbSize){f=(this.vertical)?i.height()+e.height()+k.height():i.width()+e.width()+k.width()}var g=(this.max-this.min)/(this.scrollBarSize-f);if(this.thumbStep=="auto"){l*=g}else{l*=g;if(Math.abs(this.dragStartValue+l-this.value)>=parseInt(this.thumbStep)){var c=Math.round(parseInt(l)/this.thumbStep)*this.thumbStep;if(this.rtl&&!this.vertical){this.setPosition(this.dragStartValue-c)}else{this.setPosition(this.dragStartValue+c)}return false}else{return false}}var c=l;if(this.rtl&&!this.vertical){c=-l}this.setPosition(this.dragStartValue+c)}catch(h){alert(h)}return false},handlemouseup:function(d,g){var c=false;if(this.thumbCapture){this.thumbCapture=false;var e=this.btnThumb;var h=this.vertical?this.toThemeProperty("jqx-scrollbar-thumb-state-pressed"):this.toThemeProperty("jqx-scrollbar-thumb-state-pressed-horizontal");e.removeClass(h);e.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));c=true;this._mouseup=new Date()}this.areaDownCapture=this.areaUpCapture=false;if(this.buttonUpCapture||this.buttonDownCapture){var b=this.btnUp;var f=this.btnDown;this.buttonUpCapture=false;this.buttonDownCapture=false;b.removeClass(this.toThemeProperty("jqx-scrollbar-button-state-pressed"));f.removeClass(this.toThemeProperty("jqx-scrollbar-button-state-pressed"));b.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));f.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));this._removeArrowClasses("pressed");c=true;this._mouseup=new Date()}if(c){if(g.preventDefault!=undefined){g.preventDefault()}if(g.originalEvent!=null){g.originalEvent.mouseHandled=true}if(g.stopPropagation!=undefined){g.stopPropagation()}}},setPosition:function(b,g){var d=this.element;if(b==undefined||b==NaN){b=this.min}if(b>=this.max){b=this.max}if(b<this.min){b=this.min}if(this.value!==b||g==true){if(b==this.max){var c=new jQuery.Event("complete");this.host.trigger(c)}var f=this.value;if(this._triggervaluechanged){var e=new jQuery.Event("valuechanged");e.previousValue=this.value;e.currentValue=b}this.value=b;this._positionelements();if(this._triggervaluechanged){this.host.trigger(e)}if(this.valuechanged){this.valuechanged({currentValue:this.value,previousvalue:f})}}return b},_getThumbSize:function(b){var d=this.max-this.min;var c=0;if(d>1){c=(b/(d+b)*b)}else{if(d==1){c=b}}if(this.thumbSize>0){c=this.thumbSize}if(c<this.thumbMinSize){c=this.thumbMinSize}return Math.min(c,b)},_positionelements:function(){var g=this.element;var n=this.areaUp;var e=this.areaDown;var h=this.btnUp;var f=this.btnDown;var o=this.btnThumb;var b=this.scrollWrap;var p=this._height?this._height:this.host.height();var c=this._width?this._width:this.host.width();var l=(!this.vertical)?p:c;if(!this.showButtons){l=0}var m=(!this.vertical)?c:p;this.scrollBarSize=m;var d=this._getThumbSize(m-2*l);d=Math.round(d);if(d<this.thumbMinSize){d=this.thumbMinSize}if(p==NaN||p<10){p=10}if(c==NaN||c<10){c=10}l+=2;this.btnSize=l;var i=this._btnAndThumbSize;if(!this._btnAndThumbSize){var i=(this.vertical)?2*this.btnSize+o.outerHeight():2*this.btnSize+o.outerWidth();i=Math.round(i)}var k=(m-i)/(this.max-this.min)*(this.value-this.min);if(this.rtl&&!this.vertical){k=(m-i)/(this.max-this.min)*(this.max-this.value-this.min)}k=Math.round(k);if(k<0){k=0}if(this.vertical){var j=m-k-i;if(j<0){j=0}e[0].style.height=j+"px";n[0].style.height=k+"px";this._setElementTopPosition(n,l);this._setElementTopPosition(o,l+k);this._setElementTopPosition(e,l+k+d)}else{n[0].style.width=k+"px";e[0].style.width=m-k-i+"px";this._setElementLeftPosition(n,l);this._setElementLeftPosition(o,l+k);this._setElementLeftPosition(e,2+l+k+d)}},_arrange:function(){if(this._initialLayout){this._initialLayout=false;return}var d=this.element;var g=this.areaUp;var r=this.areaDown;var c=this.btnUp;var k=this.btnDown;var s=this.btnThumb;var n=this.scrollWrap;var l=parseInt(this.element.style.height);var o=parseInt(this.element.style.width);if(this.isPercentage){var l=this.host.height();var o=this.host.width()}if(isNaN(l)){l=0}if(isNaN(o)){o=0}this._width=o;this._height=l;var b=(!this.vertical)?l:o;if(!this.showButtons){b=0}c[0].style.width=b+"px";c[0].style.height=b+"px";k[0].style.width=b+"px";k[0].style.height=b+"px";if(this.vertical){n[0].style.width=o+2+"px"}else{n[0].style.height=l+2+"px"}this._setElementPosition(c,0,0);var q=b+2;if(this.vertical){this._setElementPosition(k,0,l-q)}else{this._setElementPosition(k,o-q,0)}var e=(!this.vertical)?o:l;this.scrollBarSize=e;var h=this._getThumbSize(e-2*b);h=Math.round(h);if(h<this.thumbMinSize){h=this.thumbMinSize}var m=false;if(this.isTouchDevice&&this.touchModeStyle!=false){m=true}if(!this.vertical){s[0].style.width=h+"px";s[0].style.height=l+"px";if(m&&this.thumbTouchSize!==0){s.css({height:this.thumbTouchSize+"px"});s.css("margin-top",(this.host.height()-this.thumbTouchSize)/2)}}else{s[0].style.width=o+"px";s[0].style.height=h+"px";if(m&&this.thumbTouchSize!==0){s.css({width:this.thumbTouchSize+"px"});s.css("margin-left",(this.host.width()-this.thumbTouchSize)/2)}}if(l==NaN||l<10){l=10}if(o==NaN||o<10){o=10}b+=2;this.btnSize=b;var f=(this.vertical)?2*this.btnSize+(2+parseInt(s[0].style.height)):2*this.btnSize+(2+parseInt(s[0].style.width));f=Math.round(f);this._btnAndThumbSize=f;var u=(e-f)/(this.max-this.min)*(this.value-this.min);if(this.rtl&&!this.vertical){u=(e-f)/(this.max-this.min)*(this.max-this.value-this.min)}u=Math.round(u);if(u===-Infinity||u==Infinity){u=0}if(isNaN(u)){u=0}if(u<0){u=0}if(this.vertical){var t=(e-u-f);if(t<0){t=0}r[0].style.height=t+"px";r[0].style.width=o+"px";g[0].style.height=u+"px";g[0].style.width=o+"px";var i=parseInt(this.element.style.height);if(this.isPercentage){i=this.host.height()}s[0].style.visibility="inherit";if(i-3*parseInt(b)<0){s[0].style.visibility="hidden"}else{if(i<f){s[0].style.visibility="hidden"}else{if(this.element.style.visibility=="visible"){s[0].style.visibility="inherit"}}}this._setElementPosition(g,0,b);this._setElementPosition(s,0,b+u);this._setElementPosition(r,0,b+u+h)}else{if(u>0){g[0].style.width=u+"px"}if(l>0){g[0].style.height=l+"px"}var j=(e-u-f);if(j<0){j=0}r[0].style.width=j+"px";r[0].style.height=l+"px";var p=parseInt(this.element.style.width);if(this.isPercentage){p=this.host.width()}s[0].style.visibility="inherit";if(p-3*parseInt(b)<0){s[0].style.visibility="hidden"}else{if(p<f){s[0].style.visibility="hidden"}else{if(this.element.style.visibility=="visible"){s[0].style.visibility="inherit"}}}this._setElementPosition(g,b,0);this._setElementPosition(s,b+u,0);this._setElementPosition(r,2+b+u+h,0)}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.jqxWidget("jqxMenu","",{});a.extend(a.jqx._jqxMenu.prototype,{defineInstance:function(){this.items=new Array();this.mode="horizontal";this.width=null;this.height=null;this.easing="easeInOutSine";this.animationShowDuration=200;this.animationHideDuration=200;this.autoCloseInterval=0;this.animationHideDelay=100;this.animationShowDelay=100;this.menuElements=new Array();this.autoSizeMainItems=false;this.autoCloseOnClick=true;this.autoCloseOnMouseLeave=true;this.enableRoundedCorners=true;this.disabled=false;this.autoOpenPopup=true;this.enableHover=true;this.autoOpen=true;this.autoGenerate=true;this.clickToOpen=false;this.showTopLevelArrows=false;this.touchMode="auto";this.source=null;this.popupZIndex=20000;this.rtl=false;this.events=["shown","closed","itemclick","initialized"]},createInstance:function(d){var c=this;this.host.css("display","block");this.host.attr("role","menubar");this.propertyChangeMap.disabled=function(h,k,j,l){if(c.disabled){c.host.addClass(c.toThemeProperty("jqx-fill-state-disabled"));c.host.addClass(c.toThemeProperty("jqx-menu-disabled"))}else{c.host.removeClass(c.toThemeProperty("jqx-fill-state-disabled"));c.host.removeClass(c.toThemeProperty("jqx-menu-disabled"))}};var b=false;var f=this;if(f.width!=null&&f.width.toString().indexOf("%")!=-1){b=true}if(f.height!=null&&f.height.toString().indexOf("%")!=-1){b=true}a.jqx.utilities.resize(this.host,function(){f.refresh()});if(this.disabled){this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"));this.host.addClass(this.toThemeProperty("jqx-menu-disabled"))}this.host.css("outline","none");if(this.source){if(this.source!=null){var e=this.loadItems(this.source);this.element.innerHTML=e}}if(this.element.innerHTML.indexOf("UL")){var g=this.host.find("ul:first");if(g.length>0){this._createMenu(g[0])}}this.host.data("autoclose",{});this._render();this.setSize();var f=this;if(a.jqx.browser.msie&&a.jqx.browser.version<8){this.host.attr("hideFocus",true)}},focus:function(){try{this.host.focus()}catch(b){}},loadItems:function(c,e){if(c==null){return}if(c.length==0){return""}var b=this;this.items=new Array();var d="<ul>";if(e){d='<ul style="width:'+e+';">'}a.map(c,function(f){if(f==undefined){return null}d+=b._parseItem(f)});d+="</ul>";return d},_parseItem:function(f){var c="";if(f==undefined){return null}var b=f.label;if(!f.label&&f.html){b=f.html}if(!b){b="Item"}if(typeof f==="string"){b=f}var e=false;if(f.selected!=undefined&&f.selected){e=true}var d=false;if(f.disabled!=undefined&&f.disabled){d=true}c+="<li";if(d){c+=' item-disabled="true" '}if(f.label&&!f.html){c+=' item-label="'+b+'" '}if(f.value!=null){c+=' item-value="'+f.value+'" '}if(f.id!=undefined){c+=' id="'+f.id+'" '}c+=">"+b;if(f.items){if(f.subMenuWidth){c+=this.loadItems(f.items,f.subMenuWidth)}else{c+=this.loadItems(f.items)}}c+="</li>";return c},setSize:function(){if(this.width!=null&&this.width.toString().indexOf("%")!=-1){this.host.width(this.width)}else{if(this.width!=null&&this.width.toString().indexOf("px")!=-1){this.host.width(this.width)}else{if(this.width!=undefined&&!isNaN(this.width)){this.host.width(this.width)}}}if(this.height!=null&&this.height.toString().indexOf("%")!=-1){this.host.height(this.height)}else{if(this.height!=null&&this.height.toString().indexOf("px")!=-1){this.host.height(this.height)}else{if(this.height!=undefined&&!isNaN(this.height)){this.host.height(this.height)}}}if(this.height===null){this.host.height("auto")}},isTouchDevice:function(){if(this._isTouchDevice!=undefined){return this._isTouchDevice}var b=a.jqx.mobile.isTouchDevice();if(this.touchMode==true){b=true}else{if(this.touchMode==false){b=false}}if(b){this.host.addClass(this.toThemeProperty("jqx-touch"));a(".jqx-menu-item").addClass(this.toThemeProperty("jqx-touch"))}this._isTouchDevice=b;return b},refresh:function(b){if(!b){this.setSize()}},_closeAll:function(f){var d=f!=null?f.data:this;var b=d.items;a.each(b,function(){var e=this;if(e.hasItems==true){if(e.isOpen){d._closeItem(d,e)}}});if(d.mode=="popup"){if(f!=null){var c=d._isRightClick(f);if(!c){d.close()}}}},closeItem:function(e){if(e==null){return false}var b=e;var c=document.getElementById(b);var d=this;a.each(d.items,function(){var f=this;if(f.isOpen==true&&f.element==c){d._closeItem(d,f);if(f.parentId){d.closeItem(f.parentId)}}});return true},openItem:function(e){if(e==null){return false}var b=e;var c=document.getElementById(b);var d=this;a.each(d.items,function(){var f=this;if(f.isOpen==false&&f.element==c){d._openItem(d,f);if(f.parentId){d.openItem(f.parentId)}}});return true},_getClosedSubMenuOffset:function(c){var b=a(c.subMenuElement);var f=-b.outerHeight();var e=-b.outerWidth();var d=c.level==0&&this.mode=="horizontal";if(d){e=0}else{f=0}switch(c.openVerticalDirection){case"up":case"center":f=b.outerHeight();break}switch(c.openHorizontalDirection){case this._getDir("left"):if(d){e=0}else{e=b.outerWidth()}break;case"center":if(d){e=0}else{e=b.outerWidth()}break}return{left:e,top:f}},_closeItem:function(l,o,g,c){if(l==null||o==null){return false}var j=a(o.subMenuElement);var b=o.level==0&&this.mode=="horizontal";var f=this._getClosedSubMenuOffset(o);var m=f.top;var e=f.left;$menuElement=a(o.element);var k=j.closest("div.jqx-menu-popup");if(k!=null){var h=l.animationHideDelay;if(c==true){h=0}if(j.data("timer").show!=null){clearTimeout(j.data("timer").show);j.data("timer").show=null}var n=function(){o.isOpen=false;if(!a.jqx.browser.msie&&this.animationtype=="fade"){}if(b){if(!a.jqx.browser.msie){}j.stop().animate({top:m},l.animationHideDuration,function(){a(o.element).removeClass(l.toThemeProperty("jqx-fill-state-pressed"));a(o.element).removeClass(l.toThemeProperty("jqx-menu-item-top-selected"));var p=a(o.arrow);if(p.length>0&&l.showTopLevelArrows){p.removeClass();if(o.openVerticalDirection=="down"){p.addClass(l.toThemeProperty("jqx-menu-item-arrow-down"))}else{p.addClass(l.toThemeProperty("jqx-menu-item-arrow-up"))}}a.jqx.aria(a(o.element),"aria-expanded",false);k.css({display:"none"});if(l.animationHideDuration==0){j.css({top:m})}l._raiseEvent("1",o)})}else{if(!a.jqx.browser.msie){}j.stop().animate({left:e},l.animationHideDuration,function(){if(l.animationHideDuration==0){j.css({left:e})}if(o.level>0){a(o.element).removeClass(l.toThemeProperty("jqx-fill-state-pressed"));a(o.element).removeClass(l.toThemeProperty("jqx-menu-item-selected"));var p=a(o.arrow);if(p.length>0){p.removeClass();if(o.openHorizontalDirection!="left"){p.addClass(l.toThemeProperty("jqx-menu-item-arrow-"+l._getDir("right")))}else{p.addClass(l.toThemeProperty("jqx-menu-item-arrow-"+l._getDir("left")))}}}else{a(o.element).removeClass(l.toThemeProperty("jqx-fill-state-pressed"));a(o.element).removeClass(l.toThemeProperty("jqx-menu-item-top-selected"));var p=a(o.arrow);if(p.length>0){p.removeClass();if(o.openHorizontalDirection!="left"){p.addClass(l.toThemeProperty("jqx-menu-item-arrow-top-"+l._getDir("right")))}else{p.addClass(l.toThemeProperty("jqx-menu-item-arrow-top-"+l._getDir("left")))}}}a.jqx.aria(a(o.element),"aria-expanded",false);k.css({display:"none"});l._raiseEvent("1",o)})}};if(h>0){j.data("timer").hide=setTimeout(function(){n()},h)}else{n()}if(g!=undefined&&g){var d=j.children();a.each(d,function(){if(l.menuElements[this.id]&&l.menuElements[this.id].isOpen){var p=a(l.menuElements[this.id].subMenuElement);l._closeItem(l,l.menuElements[this.id],true,true)}})}}},getSubItems:function(j,h){if(j==null){return false}var g=this;var c=new Array();if(h!=null){a.extend(c,h)}var d=j;var f=this.menuElements[d];var b=a(f.subMenuElement);var e=b.find(".jqx-menu-item");a.each(e,function(){c[this.id]=g.menuElements[this.id];var k=g.getSubItems(this.id,c);a.extend(c,k)});return c},disable:function(g,d){if(g==null){return}var c=g;var f=this;if(this.menuElements[c]){var e=this.menuElements[c];e.disabled=d;var b=a(e.element);e.element.disabled=d;a.each(b.children(),function(){this.disabled=d});if(d){b.addClass(f.toThemeProperty("jqx-menu-item-disabled"));b.addClass(f.toThemeProperty("jqx-fill-state-disabled"))}else{b.removeClass(f.toThemeProperty("jqx-menu-item-disabled"));b.removeClass(f.toThemeProperty("jqx-fill-state-disabled"))}}},_setItemProperty:function(g,c,f){if(g==null){return}var b=g;var e=this;if(this.menuElements[b]){var d=this.menuElements[b];if(d[c]){d[c]=f}}},setItemOpenDirection:function(d,c,e){if(d==null){return}var k=d;var g=this;var f=a.jqx.browser.msie&&a.jqx.browser.version<8;if(this.menuElements[k]){var j=this.menuElements[k];if(c!=null){j.openHorizontalDirection=c;if(j.hasItems&&j.level>0){var h=a(j.element);if(h!=undefined){var b=a(j.arrow);if(j.arrow==null){b=a('<span id="arrow'+h[0].id+'"></span>');if(!f){b.prependTo(h)}else{b.appendTo(h)}j.arrow=b[0]}b.removeClass();if(j.openHorizontalDirection=="left"){b.addClass(g.toThemeProperty("jqx-menu-item-arrow-"+g._getDir("left")))}else{b.addClass(g.toThemeProperty("jqx-menu-item-arrow-"+g._getDir("right")))}b.css("visibility","visible");if(!f){b.css("display","block");b.css("float","right")}else{b.css("display","inline-block");b.css("float","none")}}}}if(e!=null){j.openVerticalDirection=e;var b=a(j.arrow);var h=a(j.element);if(!g.showTopLevelArrows){return}if(h!=undefined){if(j.arrow==null){b=a('<span id="arrow'+h[0].id+'"></span>');if(!f){b.prependTo(h)}else{b.appendTo(h)}j.arrow=b[0]}b.removeClass();if(j.openVerticalDirection=="down"){b.addClass(g.toThemeProperty("jqx-menu-item-arrow-down"))}else{b.addClass(g.toThemeProperty("jqx-menu-item-arrow-up"))}b.css("visibility","visible");if(!f){b.css("display","block");b.css("float","right")}else{b.css("display","inline-block");b.css("float","none")}}}}},_getSiblings:function(c){var d=new Array();var b=0;for(i=0;i<this.items.length;i++){if(this.items[i]==c){continue}if(this.items[i].parentId==c.parentId&&this.items[i].hasItems){d[b++]=this.items[i]}}return d},_openItem:function(t,s,r){if(t==null||s==null){return false}if(s.isOpen){return false}if(s.disabled){return false}if(t.disabled){return false}var m=t.popupZIndex;if(r!=undefined){m=r}var e=t.animationHideDuration;t.animationHideDuration=0;t._closeItem(t,s,true,true);t.animationHideDuration=e;this.host.focus();var f=[5,5];var u=a(s.subMenuElement);if(u!=null){u.stop()}if(u.data("timer").hide!=null){clearTimeout(u.data("timer").hide)}var p=u.closest("div.jqx-menu-popup");var h=a(s.element);var j=s.level==0?this._getOffset(s.element):h.position();if(s.level>0&&this.hasTransform){var q=parseInt(h.coord().top)-parseInt(this._getOffset(s.element).top);j.top+=q}if(s.level==0&&this.mode=="popup"){j=h.coord()}var k=s.level==0&&this.mode=="horizontal";var b=k?j.left:this.menuElements[s.parentId]!=null&&this.menuElements[s.parentId].subMenuElement!=null?parseInt(a(a(this.menuElements[s.parentId].subMenuElement).closest("div.jqx-menu-popup")).outerWidth())-f[0]:parseInt(u.outerWidth());p.css({visibility:"visible",display:"block",left:b,top:k?j.top+h.outerHeight():j.top,zIndex:m});u.css("display","block");if(this.mode!="horizontal"&&s.level==0){var d=this._getOffset(this.element);p.css("left",-1+d.left+this.host.outerWidth());u.css("left",-u.outerWidth())}else{var c=this._getClosedSubMenuOffset(s);u.css("left",c.left);u.css("top",c.top)}p.css({height:parseInt(u.outerHeight())+parseInt(f[1])+"px"});var o=0;var g=0;switch(s.openVerticalDirection){case"up":if(k){u.css("top",u.outerHeight());o=f[1];var l=parseInt(u.parent().css("padding-bottom"));if(isNaN(l)){l=0}if(l>0){p.addClass(this.toThemeProperty("jqx-menu-popup-clear"))}u.css("top",u.outerHeight()-l);p.css({display:"block",top:j.top-p.outerHeight(),zIndex:m})}else{o=f[1];u.css("top",u.outerHeight());p.css({display:"block",top:j.top-p.outerHeight()+f[1]+h.outerHeight(),zIndex:m})}break;case"center":if(k){u.css("top",0);p.css({display:"block",top:j.top-p.outerHeight()/2+f[1],zIndex:m})}else{u.css("top",0);p.css({display:"block",top:j.top+h.outerHeight()/2-p.outerHeight()/2+f[1],zIndex:m})}break}switch(s.openHorizontalDirection){case this._getDir("left"):if(k){p.css({left:j.left-(p.outerWidth()-h.outerWidth()-f[0])})}else{g=0;u.css("left",p.outerWidth());p.css({left:j.left-(p.outerWidth())+2*s.level})}break;case"center":if(k){p.css({left:j.left-(p.outerWidth()/2-h.outerWidth()/2-f[0]/2)})}else{p.css({left:j.left-(p.outerWidth()/2-h.outerWidth()/2-f[0]/2)});u.css("left",p.outerWidth())}break}if(k){if(parseInt(u.css("top"))==o){s.isOpen=true;return}}else{if(parseInt(u.css("left"))==g){s.isOpen==true;return}}a.each(t._getSiblings(s),function(){t._closeItem(t,this,true,true)});var n=a.data(t.element,"animationHideDelay");t.animationHideDelay=n;if(this.autoCloseInterval>0){if(this.host.data("autoclose")!=null&&this.host.data("autoclose").close!=null){clearTimeout(this.host.data("autoclose").close)}if(this.host.data("autoclose")!=null){this.host.data("autoclose").close=setTimeout(function(){t._closeAll()},this.autoCloseInterval)}}u.data("timer").show=setTimeout(function(){if(p!=null){if(k){u.stop();u.css("left",g);if(!a.jqx.browser.msie){}h.addClass(t.toThemeProperty("jqx-fill-state-pressed"));h.addClass(t.toThemeProperty("jqx-menu-item-top-selected"));var v=a(s.arrow);if(v.length>0&&t.showTopLevelArrows){v.removeClass();if(s.openVerticalDirection=="down"){v.addClass(t.toThemeProperty("jqx-menu-item-arrow-down-selected"))}else{v.addClass(t.toThemeProperty("jqx-menu-item-arrow-up-selected"))}}if(t.animationShowDuration==0){u.css({top:o});s.isOpen=true;t._raiseEvent("0",s);a.jqx.aria(a(s.element),"aria-expanded",true)}else{u.animate({top:o},t.animationShowDuration,t.easing,function(){s.isOpen=true;a.jqx.aria(a(s.element),"aria-expanded",true);t._raiseEvent("0",s)})}}else{u.stop();u.css("top",o);if(!a.jqx.browser.msie){}if(s.level>0){h.addClass(t.toThemeProperty("jqx-fill-state-pressed"));h.addClass(t.toThemeProperty("jqx-menu-item-selected"));var v=a(s.arrow);if(v.length>0){v.removeClass();if(s.openHorizontalDirection!="left"){v.addClass(t.toThemeProperty("jqx-menu-item-arrow-"+t._getDir("right")+"-selected"))}else{v.addClass(t.toThemeProperty("jqx-menu-item-arrow-"+t._getDir("left")+"-selected"))}}}else{h.addClass(t.toThemeProperty("jqx-fill-state-pressed"));h.addClass(t.toThemeProperty("jqx-menu-item-top-selected"));var v=a(s.arrow);if(v.length>0){v.removeClass();if(s.openHorizontalDirection!="left"){v.addClass(t.toThemeProperty("jqx-menu-item-arrow-"+t._getDir("right")+"-selected"))}else{v.addClass(t.toThemeProperty("jqx-menu-item-arrow-"+t._getDir("left")+"-selected"))}}}if(!a.jqx.browser.msie){}if(t.animationShowDuration==0){u.css({left:g});t._raiseEvent("0",s);s.isOpen=true;a.jqx.aria(a(s.element),"aria-expanded",true)}else{u.animate({left:g},t.animationShowDuration,t.easing,function(){t._raiseEvent("0",s);s.isOpen=true;a.jqx.aria(a(s.element),"aria-expanded",true)})}}}},this.animationShowDelay)},_getDir:function(b){switch(b){case"left":return !this.rtl?"left":"right";case"right":return this.rtl?"left":"right"}return"left"},_applyOrientation:function(j,d){var g=this;var f=0;this.host.removeClass(g.toThemeProperty("jqx-menu-horizontal"));this.host.removeClass(g.toThemeProperty("jqx-menu-vertical"));this.host.removeClass(g.toThemeProperty("jqx-menu"));this.host.removeClass(g.toThemeProperty("jqx-widget"));this.host.addClass(g.toThemeProperty("jqx-widget"));this.host.addClass(g.toThemeProperty("jqx-menu"));if(j!=undefined&&d!=undefined&&d=="popup"){if(this.host.parent().length>0&&this.host.parent().parent().length>0&&this.host.parent().parent()[0]==document.body){var h=a.data(document.body,"jqxMenuOldHost"+this.element.id);if(h!=null){var e=this.host.closest("div.jqx-menu-wrapper");e.remove();e.appendTo(h);this.host.css("display","block");this.host.css("visibility","visible");e.css("display","block");e.css("visibility","visible")}}}else{if(j==undefined&&d==undefined){a.data(document.body,"jqxMenuOldHost"+this.element.id,this.host.parent()[0])}}if(this.autoOpenPopup){if(this.mode=="popup"){this.addHandler(a(document),"contextmenu."+this.element.id,function(k){return false});this.addHandler(a(document),"mousedown.menu"+this.element.id,function(k){g._openContextMenu(k)})}else{this.removeHandler(a(document),"contextmenu."+this.element.id);this.removeHandler(a(document),"mousedown.menu"+this.element.id)}}else{this.removeHandler(a(document),"contextmenu."+this.element.id);this.removeHandler(a(document),"mousedown.menu"+this.element.id)}if(this.rtl){this.host.addClass(this.toThemeProperty("jqx-rtl"))}switch(this.mode){case"horizontal":this.host.addClass(g.toThemeProperty("jqx-widget-header"));this.host.addClass(g.toThemeProperty("jqx-menu-horizontal"));a.each(this.items,function(){var m=this;$element=a(m.element);var l=a(m.arrow);l.removeClass();if(m.hasItems&&m.level>0){var l=a('<span style="border: none; background-color: transparent;" id="arrow'+$element[0].id+'"></span>');l.prependTo($element);l.css("float",g._getDir("right"));l.addClass(g.toThemeProperty("jqx-menu-item-arrow-"+g._getDir("right")));m.arrow=l[0]}if(m.level==0){a(m.element).css("float",g._getDir("left"));if(!m.ignoretheme&&m.hasItems&&g.showTopLevelArrows){var l=a('<span style="border: none; background-color: transparent;" id="arrow'+$element[0].id+'"></span>');var k=a.jqx.browser.msie&&a.jqx.browser.version<8;if(m.arrow==null){if(!k){l.prependTo($element)}else{l.appendTo($element)}}else{l=a(m.arrow)}if(m.openVerticalDirection=="down"){l.addClass(g.toThemeProperty("jqx-menu-item-arrow-down"))}else{l.addClass(g.toThemeProperty("jqx-menu-item-arrow-up"))}l.css("visibility","visible");if(!k){l.css("display","block");l.css("float","right")}else{l.css("display","inline-block")}m.arrow=l[0]}else{if(!m.ignoretheme&&m.hasItems&&!g.showTopLevelArrows){if(m.arrow!=null){var l=a(m.arrow);l.remove();m.arrow=null}}}f=Math.max(f,$element.height())}});break;case"vertical":case"popup":this.host.addClass(g.toThemeProperty("jqx-menu-vertical"));a.each(this.items,function(){var l=this;$element=a(l.element);if(l.hasItems&&!l.ignoretheme){if(l.arrow){a(l.arrow).remove()}var k=a('<span style="border: none; background-color: transparent;" id="arrow'+$element[0].id+'"></span>');k.prependTo($element);k.css("float","right");if(l.level==0){k.addClass(g.toThemeProperty("jqx-menu-item-arrow-top-"+g._getDir("right")))}else{k.addClass(g.toThemeProperty("jqx-menu-item-arrow-"+g._getDir("right")))}l.arrow=k[0]}$element.css("float","none")});if(this.mode=="popup"){this.host.addClass(g.toThemeProperty("jqx-widget-content"));this.host.wrap('<div class="jqx-menu-wrapper" style="z-index:'+this.popupZIndex+'; border: none; background-color: transparent; padding: 0px; margin: 0px; position: absolute; top: 0; left: 0; display: block; visibility: visible;"></div>');var e=this.host.closest("div.jqx-menu-wrapper");this.host.addClass(g.toThemeProperty("jqx-popup"));e[0].id="menuWrapper"+this.element.id;e.appendTo(a(document.body))}else{this.host.addClass(g.toThemeProperty("jqx-widget-header"))}if(this.mode=="popup"){var b=this.host.height();this.host.css("position","absolute");this.host.css("top","0");this.host.css("left","0");this.host.height(b);this.host.css("display","none")}break}var c=this.isTouchDevice();if(this.autoCloseOnClick){this.removeHandler(a(document),"mousedown.menu"+this.element.id,g._closeAfterClick);this.addHandler(a(document),"mousedown.menu"+this.element.id,g._closeAfterClick,g);if(c){this.removeHandler(a(document),a.jqx.mobile.getTouchEventName("touchstart")+".menu"+this.element.id,g._closeAfterClick,g);this.addHandler(a(document),a.jqx.mobile.getTouchEventName("touchstart")+".menu"+this.element.id,g._closeAfterClick,g)}}},_getBodyOffset:function(){var c=0;var b=0;if(a("body").css("border-top-width")!="0px"){c=parseInt(a("body").css("border-top-width"));if(isNaN(c)){c=0}}if(a("body").css("border-left-width")!="0px"){b=parseInt(a("body").css("border-left-width"));if(isNaN(b)){b=0}}return{left:b,top:c}},_getOffset:function(c){var e=a.jqx.mobile.isSafariMobileBrowser();var h=a(c).coord(true);var g=h.top;var f=h.left;if(a("body").css("border-top-width")!="0px"){g=parseInt(g)+this._getBodyOffset().top}if(a("body").css("border-left-width")!="0px"){f=parseInt(f)+this._getBodyOffset().left}var d=a.jqx.mobile.isWindowsPhone();if(this.hasTransform||(e!=null&&e)||d){var b={left:a.jqx.mobile.getLeftPos(c),top:a.jqx.mobile.getTopPos(c)};return b}else{return{left:f,top:g}}},_isRightClick:function(c){var b;if(!c){var c=window.event}if(c.which){b=(c.which==3)}else{if(c.button){b=(c.button==2)}}return b},_openContextMenu:function(d){var c=this;var b=c._isRightClick(d);if(b){c.open(parseInt(d.clientX)+5,parseInt(d.clientY)+5)}},close:function(){var c=this;var d=a.data(this.element,"contextMenuOpened"+this.element.id);if(d){var b=this.host;a.each(c.items,function(){var e=this;if(e.hasItems){c._closeItem(c,e)}});a.each(c.items,function(){var e=this;if(e.isOpen==true){$submenu=a(e.subMenuElement);var f=$submenu.closest("div.jqx-menu-popup");f.hide(this.animationHideDuration)}});this.host.hide(this.animationHideDuration);a.data(c.element,"contextMenuOpened"+this.element.id,false);c._raiseEvent("1",c)}},open:function(e,d){if(this.mode=="popup"){var c=0;if(this.host.css("display")=="block"){this.close();c=this.animationHideDuration}var b=this;if(e==undefined||e==null){e=0}if(d==undefined||d==null){d=0}setTimeout(function(){b.host.show(b.animationShowDuration);b.host.css("visibility","visible");a.data(b.element,"contextMenuOpened"+b.element.id,true);b._raiseEvent("0",b);b.host.css("z-index",9999);if(e!=undefined&&d!=undefined){b.host.css({left:e,top:d})}},c)}},_renderHover:function(c,e,b){var d=this;if(!e.ignoretheme){this.addHandler(c,"mouseenter",function(){if(!e.disabled&&!e.separator&&d.enableHover&&!d.disabled){if(e.level>0){c.addClass(d.toThemeProperty("jqx-fill-state-hover"));c.addClass(d.toThemeProperty("jqx-menu-item-hover"))}else{c.addClass(d.toThemeProperty("jqx-fill-state-hover"));c.addClass(d.toThemeProperty("jqx-menu-item-top-hover"))}}});this.addHandler(c,"mouseleave",function(){if(!e.disabled&&!e.separator&&d.enableHover&&!d.disabled){if(e.level>0){c.removeClass(d.toThemeProperty("jqx-fill-state-hover"));c.removeClass(d.toThemeProperty("jqx-menu-item-hover"))}else{c.removeClass(d.toThemeProperty("jqx-fill-state-hover"));c.removeClass(d.toThemeProperty("jqx-menu-item-top-hover"))}}})}},_closeAfterClick:function(c){var b=c!=null?c.data:this;var d=false;if(b.autoCloseOnClick){a.each(a(c.target).parents(),function(){if(this.className.indexOf){if(this.className.indexOf("jqx-menu")!=-1){d=true;return false}}});if(!d){c.data=b;b._closeAll(c)}}},_autoSizeHorizontalMenuItems:function(){var c=this;if(c.autoSizeMainItems&&this.mode=="horizontal"){var b=this.maxHeight;if(parseInt(b)>parseInt(this.host.height())){b=parseInt(this.host.height())}b=parseInt(this.host.height());a.each(this.items,function(){var m=this;$element=a(m.element);if(m.level==0&&b>0){var d=$element.children().length>0?parseInt($element.children().height()):$element.height();var g=c.host.find("ul:first");var h=parseInt(g.css("padding-top"));var n=parseInt(g.css("margin-top"));var k=b-2*(n+h);var j=parseInt(k)/2-d/2;var e=parseInt(j);var l=parseInt(j);$element.css("padding-top",e);$element.css("padding-bottom",l);if(parseInt($element.outerHeight())>k){var f=1;$element.css("padding-top",e-f);e=e-f}}})}a.each(this.items,function(){var f=this;$element=a(f.element);if(f.hasItems&&f.level>0){if(f.arrow){var e=a(f.arrow);var d=a(f.element).height();if(d>15){e.css("margin-top",(d-15)/2)}}}})},_render:function(g,b){var h=this.popupZIndex;var c=[5,5];var f=this;a.data(f.element,"animationHideDelay",f.animationHideDelay);var d=this.isTouchDevice();var e=d&&a.jqx.mobile.isWindowsPhone();a.data(document.body,"menuel",this);this.hasTransform=a.jqx.utilities.hasTransform(this.host);this._applyOrientation(g,b);if(f.enableRoundedCorners){this.host.addClass(f.toThemeProperty("jqx-rc-all"))}a.each(this.items,function(){var q=this;var m=a(q.element);m.attr("role","menuitem");if(f.enableRoundedCorners){m.addClass(f.toThemeProperty("jqx-rc-all"))}f.removeHandler(m,"click");f.addHandler(m,"click",function(v){if(q.disabled){return}f._raiseEvent("2",{item:q.element,event:v});if(!f.autoOpen){if(q.level>0){if(f.autoCloseOnClick&&!d&&!f.clickToOpen){v.data=f;f._closeAll(v)}}}else{if(f.autoCloseOnClick&&!d&&!f.clickToOpen){if(q.closeOnClick){v.data=f;f._closeAll(v)}}}if(d&&f.autoCloseOnClick){v.data=f;if(!q.hasItems){f._closeAll(v)}}if(v.target.tagName!="A"&&v.target.tagName!="a"){var t=q.anchor!=null?a(q.anchor):null;if(t!=null&&t.length>0){var s=t.attr("href");var u=t.attr("target");if(s!=null){if(u!=null){window.open(s,u)}else{window.location=s}}}}});f.removeHandler(m,"mouseenter");f.removeHandler(m,"mouseleave");if(!e){f._renderHover(m,q,d)}if(q.subMenuElement!=null){var n=a(q.subMenuElement);n.wrap('<div class="jqx-menu-popup '+f.toThemeProperty("jqx-menu-popup")+'" style="border: none; background-color: transparent; z-index:'+h+'; padding: 0px; margin: 0px; position: absolute; top: 0; left: 0; display: block; visibility: hidden;"><div style="background-color: transparent; border: none; position:absolute; overflow:hidden; left: 0; top: 0; right: 0; width: 100%; height: 100%;"></div></div>');n.css({overflow:"hidden",position:"absolute",left:0,display:"inherit",top:-n.outerHeight()});n.data("timer",{});if(q.level>0){n.css("left",-n.outerWidth())}else{if(f.mode=="horizontal"){n.css("left",0)}}h++;var p=a(q.subMenuElement).closest("div.jqx-menu-popup").css({width:parseInt(a(q.subMenuElement).outerWidth())+parseInt(c[0])+"px",height:parseInt(a(q.subMenuElement).outerHeight())+parseInt(c[1])+"px"});var r=m.closest("div.jqx-menu-popup");if(r.length>0){var j=n.css("margin-left");var l=n.css("margin-right");var k=n.css("padding-left");var o=n.css("padding-right");p.appendTo(r);n.css("margin-left",j);n.css("margin-right",l);n.css("padding-left",k);n.css("padding-right",o)}else{var j=n.css("margin-left");var l=n.css("margin-right");var k=n.css("padding-left");var o=n.css("padding-right");p.appendTo(a(document.body));n.css("margin-left",j);n.css("margin-right",l);n.css("padding-left",k);n.css("padding-right",o)}if(!f.clickToOpen){if(d){f.removeHandler(m,a.jqx.mobile.getTouchEventName("touchstart"));f.addHandler(m,a.jqx.mobile.getTouchEventName("touchstart"),function(s){clearTimeout(n.data("timer").hide);if(n!=null){n.stop()}if(q.level==0&&!q.isOpen){s.data=f;f._closeAll(s)}if(!q.isOpen){f._openItem(f,q)}else{f._closeItem(f,q,true)}return false})}if(!e){f.addHandler(m,"mouseenter",function(){if(f.autoOpen||(q.level>0&&!f.autoOpen)){clearTimeout(n.data("timer").hide)}if(q.parentId&&q.parentId!=0){if(f.menuElements[q.parentId]){var s=f.menuElements[q.parentId].isOpen;if(!s){return}}}if(f.autoOpen||(q.level>0&&!f.autoOpen)){f._openItem(f,q)}return false});f.addHandler(m,"mousedown",function(){if(!f.autoOpen&&q.level==0){clearTimeout(n.data("timer").hide);if(n!=null){n.stop()}if(!q.isOpen){f._openItem(f,q)}else{f._closeItem(f,q,true)}}});f.addHandler(m,"mouseleave",function(t){if(f.autoCloseOnMouseLeave){clearTimeout(n.data("timer").hide);var w=a(q.subMenuElement);var s={left:parseInt(t.pageX),top:parseInt(t.pageY)};var v={left:parseInt(w.coord().left),top:parseInt(w.coord().top),width:parseInt(w.outerWidth()),height:parseInt(w.outerHeight())};var u=true;if(v.left-5<=s.left&&s.left<=v.left+v.width+5){if(v.top<=s.top&&s.top<=v.top+v.height){u=false}}if(u){f._closeItem(f,q,true)}}});f.removeHandler(p,"mouseenter");f.addHandler(p,"mouseenter",function(){clearTimeout(n.data("timer").hide)});f.removeHandler(p,"mouseleave");f.addHandler(p,"mouseleave",function(s){if(f.autoCloseOnMouseLeave){clearTimeout(n.data("timer").hide);clearTimeout(n.data("timer").show);if(n!=null){n.stop()}f._closeItem(f,q,true)}})}}else{f.removeHandler(m,"mousedown");f.addHandler(m,"mousedown",function(s){clearTimeout(n.data("timer").hide);if(n!=null){n.stop()}if(q.level==0&&!q.isOpen){s.data=f;f._closeAll(s)}if(!q.isOpen){f._openItem(f,q)}else{f._closeItem(f,q,true)}})}}});this._autoSizeHorizontalMenuItems();this._raiseEvent("3",this)},createID:function(){var b=Math.random()+"";b=b.replace(".","");b="99"+b;b=b/1;while(this.items[b]){b=Math.random()+"";b=b.replace(".","");b=b/1}return"menuItem"+b},_createMenu:function(c,f){if(c==null){return}if(f==undefined){f=true}if(f==null){f=true}var o=this;var t=a(c).find("li");var q=0;for(var j=0;j<t.length;j++){var m=t[j];var r=a(m);if(m.className.indexOf("jqx-menu")==-1&&this.autoGenerate==false){continue}var p=m.id;if(!p){p=this.createID()}if(f){m.id=p;this.items[q]=new a.jqx._jqxMenu.jqxMenuItem();this.menuElements[p]=this.items[q]}q+=1;var s=0;var v=this;var h=r.children();h.each(function(){if(!f){this.className="";if(v.autoGenerate){a(v.items[q-1].subMenuElement)[0].className="";a(v.items[q-1].subMenuElement).addClass(v.toThemeProperty("jqx-widget-content"));a(v.items[q-1].subMenuElement).addClass(v.toThemeProperty("jqx-menu-dropdown"));a(v.items[q-1].subMenuElement).addClass(v.toThemeProperty("jqx-popup"))}}if(this.className.indexOf("jqx-menu-dropdown")!=-1){if(f){v.items[q-1].subMenuElement=this}return false}else{if(v.autoGenerate&&(this.tagName=="ul"||this.tagName=="UL")){if(f){v.items[q-1].subMenuElement=this}this.className="";a(this).addClass(v.toThemeProperty("jqx-widget-content"));a(this).addClass(v.toThemeProperty("jqx-menu-dropdown"));a(this).addClass(v.toThemeProperty("jqx-popup"));a(this).attr("role","menu");if(v.rtl){a(this).addClass(v.toThemeProperty("jqx-rc-l"))}else{a(this).addClass(v.toThemeProperty("jqx-rc-r"))}a(this).addClass(v.toThemeProperty("jqx-rc-b"));return false}}});var u=r.parents();u.each(function(){if(this.className.indexOf("jqx-menu-item")!=-1){s=this.id;return false}else{if(v.autoGenerate&&(this.tagName=="li"||this.tagName=="LI")){s=this.id;return false}}});var e=false;var d=m.getAttribute("type");var b=m.getAttribute("ignoretheme");if(b){if(b=="true"||b==true){b=true}}else{b=false}if(!d){d=m.type}else{if(d=="separator"){var e=true}}if(!e){if(s){d="sub"}else{d="top"}}var g=this.items[q-1];if(f){g.id=p;g.parentId=s;g.type=d;g.separator=e;g.element=t[j];var l=r.children("a");g.level=r.parents("li").length;g.anchor=l.length>0?l:null}g.ignoretheme=b;var n=this.menuElements[s];if(n!=null){if(n.ignoretheme){g.ignoretheme=n.ignoretheme;b=n.ignoretheme}}if(this.autoGenerate){if(d=="separator"){r.removeClass();r.addClass(this.toThemeProperty("jqx-menu-item-separator"));r.attr("role","separator")}else{if(!b){r[0].className="";if(this.rtl){r.addClass(this.toThemeProperty("jqx-rtl"))}if(g.level>0){r.addClass(this.toThemeProperty("jqx-item"));r.addClass(this.toThemeProperty("jqx-menu-item"))}else{r.addClass(this.toThemeProperty("jqx-item"));r.addClass(this.toThemeProperty("jqx-menu-item-top"))}}}}if(f&&!b){g.hasItems=r.find("li").length>0;if(g.hasItems){if(g.element){a.jqx.aria(a(g.element),"aria-haspopup",true);if(!g.subMenuElement.id){g.subMenuElement.id=a.jqx.utilities.createId()}a.jqx.aria(a(g.element),"aria-owns",g.subMenuElement.id)}}}}},destroy:function(){a.jqx.utilities.resize(this.host,null,true);var d=this.host.closest("div.jqx-menu-wrapper");d.remove();var b=this;this.removeHandler(a(document),"mousedown.menu"+this.element.id,b._closeAfterClick);this.removeHandler(a(document),"mouseup.menu"+this.element.id,b._closeAfterClick);a.data(document.body,"jqxMenuOldHost"+this.element.id,null);if(a(window).off){a(window).off("resize.menu"+b.element.id)}a.each(this.items,function(){var g=this;var f=a(g.element);b.removeHandler(f,"click");b.removeHandler(f,"selectstart");b.removeHandler(f,"mouseenter");b.removeHandler(f,"mouseleave");b.removeHandler(f,"mousedown");b.removeHandler(f,"mouseleave");var e=a(g.subMenuElement);var h=e.closest("div.jqx-menu-popup");h.remove();delete this.subMenuElement;delete this.element});a.data(document.body,"menuel",null);delete this.menuElements;this.items=new Array();delete this.items;var c=a.data(this.element,"jqxMenu");if(c){delete c.instance}this.host.removeClass();this.host.remove();delete this.host;delete this.element},_raiseEvent:function(f,c){if(c==undefined){c={owner:null}}var d=this.events[f];args=c;args.owner=this;var e=new jQuery.Event(d);if(f=="2"){args=c.item;args.owner=this;a.extend(e,c.event);e.type="itemclick"}e.owner=this;e.args=args;var b=this.host.trigger(e);return b},propertyChangedHandler:function(b,d,g,f){if(this.isInitialized==undefined||this.isInitialized==false){return}if(f==g){return}if(d=="touchMode"){this._isTouchDevice=null;b._render(f,g)}if(d=="source"){if(b.source!=null){var c=b.loadItems(b.source);b.element.innerHTML=c;var e=b.host.find("ul:first");if(e.length>0){b.refresh();b._createMenu(e[0]);b._render()}}}if(d=="autoCloseOnClick"){if(f==false){b.removeHandler(a(document),"mousedown.menu"+this.element.id,b._closeAll)}else{b.addHandler(a(document),"mousedown.menu"+this.element.id,b,b._closeAll)}}else{if(d=="mode"||d=="width"||d=="height"||d=="showTopLevelArrows"){b.refresh();if(d=="mode"){b._render(f,g)}else{b._applyOrientation()}}else{if(d=="theme"){a.jqx.utilities.setTheme(g,f,b.host)}}}}})})(jQuery);(function(a){a.jqx._jqxMenu.jqxMenuItem=function(e,d,c){var b={id:e,parentId:d,parentItem:null,anchor:null,type:c,disabled:false,level:0,isOpen:false,hasItems:false,element:null,subMenuElement:null,arrow:null,openHorizontalDirection:"right",openVerticalDirection:"down",closeOnClick:true};return b}})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.jqxWidget("jqxCheckBox","",{});a.extend(a.jqx._jqxCheckBox.prototype,{defineInstance:function(){this.animationShowDelay=300,this.animationHideDelay=300,this.width=null;this.height=null;this.boxSize="13px";this.checked=false;this.hasThreeStates=false;this.disabled=false;this.enableContainerClick=true;this.locked=false;this.groupName="";this.keyboardCheck=true;this.enableHover=true;this.hasInput=true;this.rtl=false;this.updated=null;this.disabledContainer=false;this._canFocus=true;this.aria={"aria-checked":{name:"checked",type:"boolean"},"aria-disabled":{name:"disabled",type:"boolean"}};this.events=["checked","unchecked","indeterminate","change"]},createInstance:function(b){this.render()},_addInput:function(){if(this.hasInput){var b=this.host.attr("name");if(!b){b=this.element.id}this.input=a("<input type='hidden'/>");this.host.append(this.input);this.input.attr("name",b);this.input.val(this.checked);this.host.attr("role","checkbox");a.jqx.aria(this)}},render:function(){this.init=true;var c=this;this.setSize();this.propertyChangeMap.width=function(e,g,f,h){c.setSize()};this.propertyChangeMap.height=function(e,g,f,h){c.setSize()};if(this.checkbox){this.checkbox.remove()}if(this.boxSize==null){this.boxSize=13}var d=parseInt(this.boxSize)+"px";this.checkbox=a('<div><div style="width: '+d+"; height: "+d+';"><span style="width: '+d+"; height: "+d+';"></span></div></div>');this.host.prepend(this.checkbox);if(!this.disabledContainer){if(!this.host.attr("tabIndex")){this.host.attr("tabIndex",0)}this.host.append(a('<div style="clear: both;"></div>'))}this.checkMark=a(this.checkbox[0].firstChild.firstChild);this.box=this.checkbox;this.box.addClass(this.toThemeProperty("jqx-checkbox-default")+" "+this.toThemeProperty("jqx-fill-state-normal")+" "+this.toThemeProperty("jqx-rc-all"));if(this.disabled){this.disable()}if(!this.disabledContainer){this.host.addClass(this.toThemeProperty("jqx-widget"));this.host.addClass(this.toThemeProperty("jqx-checkbox"))}if(this.locked&&!this.disabledContainer){this.host.css("cursor","auto")}var b=this.element.getAttribute("checked");if(b=="checked"||b=="true"||b==true){this.checked=true}this._addInput();this._render();this._addHandlers();this.init=false},refresh:function(b){if(!b){this.setSize();this._render()}},setSize:function(){if(this.width!=null&&this.width.toString().indexOf("px")!=-1){this.host.width(this.width)}else{if(this.width!=undefined&&!isNaN(this.width)){this.host.width(this.width)}}if(this.height!=null&&this.height.toString().indexOf("px")!=-1){this.host.height(this.height)}else{if(this.height!=undefined&&!isNaN(this.height)){this.host.height(this.height)}}},_addHandlers:function(){var d=this;var c=a.jqx.mobile.isTouchDevice();var b="click";if(c){b=a.jqx.mobile.getTouchEventName("touchend")}this.addHandler(this.box,b,function(e){if(!d.disabled&&!d.enableContainerClick&&!d.locked){d.toggle();if(d.updated){e.owner=d;d.updated(e,d.checked,d.oldChecked)}if(e.preventDefault){e.preventDefault()}return false}});if(!this.disabledContainer){this.addHandler(this.host,"keydown",function(e){if(!d.disabled&&!d.locked&&d.keyboardCheck){if(e.keyCode==32){if(!d._canFocus){return true}d.toggle();if(d.updated){e.owner=d;d.updated(e,d.checked,d.oldChecked)}if(e.preventDefault){e.preventDefault()}return false}}});this.addHandler(this.host,b,function(e){if(!d.disabled&&d.enableContainerClick&&!d.locked){d.toggle();if(e.preventDefault){e.preventDefault()}return false}});this.addHandler(this.host,"selectstart",function(e){if(!d.disabled&&d.enableContainerClick){if(e.preventDefault){e.preventDefault()}return false}});this.addHandler(this.host,"mouseup",function(e){if(!d.disabled&&d.enableContainerClick){if(e.preventDefault){e.preventDefault()}}});this.addHandler(this.host,"focus",function(e){if(!d.disabled&&!d.locked){if(!d._canFocus){return true}if(d.enableHover){d.box.addClass(d.toThemeProperty("jqx-checkbox-hover"))}d.box.addClass(d.toThemeProperty("jqx-fill-state-focus"));if(e.preventDefault){e.preventDefault()}d.hovered=true;return false}});this.addHandler(this.host,"blur",function(e){if(!d.disabled&&!d.locked){if(!d._canFocus){return true}if(d.enableHover){d.box.removeClass(d.toThemeProperty("jqx-checkbox-hover"))}d.box.removeClass(d.toThemeProperty("jqx-fill-state-focus"));if(e.preventDefault){e.preventDefault()}d.hovered=false;return false}});this.addHandler(this.host,"mouseenter",function(e){if(d.locked){d.host.css("cursor","arrow")}if(d.enableHover){if(!d.disabled&&d.enableContainerClick&&!d.locked){d.box.addClass(d.toThemeProperty("jqx-checkbox-hover"));d.box.addClass(d.toThemeProperty("jqx-fill-state-hover"));if(e.preventDefault){e.preventDefault()}d.hovered=true;return false}}});this.addHandler(this.host,"mouseleave",function(e){if(d.enableHover){if(!d.disabled&&d.enableContainerClick&&!d.locked){d.box.removeClass(d.toThemeProperty("jqx-checkbox-hover"));d.box.removeClass(d.toThemeProperty("jqx-fill-state-hover"));if(e.preventDefault){e.preventDefault()}d.hovered=false;return false}}});this.addHandler(this.box,"mouseenter",function(){if(d.locked){return}if(!d.disabled&&!d.enableContainerClick){d.box.addClass(d.toThemeProperty("jqx-checkbox-hover"));d.box.addClass(d.toThemeProperty("jqx-fill-state-hover"))}});this.addHandler(this.box,"mouseleave",function(){if(!d.disabled&&!d.enableContainerClick){d.box.removeClass(d.toThemeProperty("jqx-checkbox-hover"));d.box.removeClass(d.toThemeProperty("jqx-fill-state-hover"))}})}},focus:function(){try{this.host.focus()}catch(b){}},_removeHandlers:function(){var c=a.jqx.mobile.isTouchDevice();var b="click";if(c){b="touchend"}this.removeHandler(this.box,b);this.removeHandler(this.box,"mouseenter");this.removeHandler(this.box,"mouseleave");this.removeHandler(this.host,b);this.removeHandler(this.host,"mouseup");this.removeHandler(this.host,"selectstart");this.removeHandler(this.host,"mouseenter");this.removeHandler(this.host,"mouseleave");this.removeHandler(this.host,"keydown");this.removeHandler(this.host,"blur");this.removeHandler(this.host,"focus")},_render:function(){if(!this.disabled){if(this.enableContainerClick){this.host.css("cursor","pointer")}else{if(!this.init){this.host.css("cursor","auto")}}}else{this.disable()}if(this.rtl){this.box.addClass(this.toThemeProperty("jqx-checkbox-rtl"));this.host.addClass(this.toThemeProperty("jqx-rtl"))}this.updateStates()},_setState:function(b){if(this.checked!=b){this.checked=b;if(this.checked){this.checkMark[0].className=this.toThemeProperty("jqx-checkbox-check-checked")}else{if(this.checked==null){this.checkMark[0].className=this.toThemeProperty("jqx-checkbox-check-indeterminate")}else{this.checkMark[0].className=""}}}},val:function(b){if(arguments.length==0||(b!=null&&typeof(b)=="object")){return this.checked}if(typeof b=="string"){if(b=="true"){this.check()}if(b=="false"){this.uncheck()}if(b==""){this.indeterminate()}}else{if(b==true){this.check()}if(b==false){this.uncheck()}if(b==null){this.indeterminate()}}return this.checked},check:function(){this.checked=true;var b=this;this.checkMark.removeClass();if(a.jqx.browser.msie||this.animationShowDelay==0){this.checkMark.addClass(this.toThemeProperty("jqx-checkbox-check-checked"))}else{this.checkMark.addClass(this.toThemeProperty("jqx-checkbox-check-checked"));this.checkMark.css("opacity",0);this.checkMark.stop().animate({opacity:1},this.animationShowDelay,function(){})}if(this.groupName!=null&&this.groupName.length>0){var c=a.find(this.toThemeProperty(".jqx-checkbox",true));a.each(c,function(){var d=a(this).jqxCheckBox("groupName");if(d==b.groupName&&this!=b.element){a(this).jqxCheckBox("uncheck")}})}this._raiseEvent("0",true);this._raiseEvent("3",{checked:true});if(this.input!=undefined){this.input.val(this.checked);a.jqx.aria(this,"aria-checked",this.checked)}},uncheck:function(){this.checked=false;var b=this;if(a.jqx.browser.msie||this.animationHideDelay==0){if(b.checkMark[0].className!=""){b.checkMark[0].className=""}}else{this.checkMark.css("opacity",1);this.checkMark.stop().animate({opacity:0},this.animationHideDelay,function(){if(b.checkMark[0].className!=""){b.checkMark[0].className=""}})}this._raiseEvent("1");this._raiseEvent("3",{checked:false});if(this.input!=undefined){this.input.val(this.checked);a.jqx.aria(this,"aria-checked",this.checked)}},indeterminate:function(){this.checked=null;this.checkMark.removeClass();if(a.jqx.browser.msie||this.animationShowDelay==0){this.checkMark.addClass(this.toThemeProperty("jqx-checkbox-check-indeterminate"))}else{this.checkMark.addClass(this.toThemeProperty("jqx-checkbox-check-indeterminate"));this.checkMark.css("opacity",0);this.checkMark.stop().animate({opacity:1},this.animationShowDelay,function(){})}this._raiseEvent("2");this._raiseEvent("3",{checked:null});if(this.input!=undefined){this.input.val(this.checked);a.jqx.aria(this,"aria-checked","undefined")}},toggle:function(){if(this.disabled){return}if(this.locked){return}if(this.groupName!=null&&this.groupName.length>0){if(this.checked!=true){this.checked=true;this.updateStates()}return}this.oldChecked=this.checked;if(this.checked==true){this.checked=this.hasThreeStates?null:false}else{this.checked=this.checked!=null}this.updateStates();if(this.input!=undefined){this.input.val(this.checked)}},updateStates:function(){if(this.checked){this.check()}else{if(this.checked==false){this.uncheck()}else{if(this.checked==null){this.indeterminate()}}}},disable:function(){this.disabled=true;if(this.checked==true){this.checkMark.addClass(this.toThemeProperty("jqx-checkbox-check-disabled"))}else{if(this.checked==null){this.checkMark.addClass(this.toThemeProperty("jqx-checkbox-check-indeterminate-disabled"))}}this.box.addClass(this.toThemeProperty("jqx-checkbox-disabled-box"));this.host.addClass(this.toThemeProperty("jqx-checkbox-disabled"));this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"));this.box.addClass(this.toThemeProperty("jqx-checkbox-disabled"));a.jqx.aria(this,"aria-disabled",this.disabled)},enable:function(){if(this.checked==true){this.checkMark.removeClass(this.toThemeProperty("jqx-checkbox-check-disabled"))}else{if(this.checked==null){this.checkMark.removeClass(this.toThemeProperty("jqx-checkbox-check-indeterminate-disabled"))}}this.box.removeClass(this.toThemeProperty("jqx-checkbox-disabled-box"));this.host.removeClass(this.toThemeProperty("jqx-checkbox-disabled"));this.host.removeClass(this.toThemeProperty("jqx-fill-state-disabled"));this.box.removeClass(this.toThemeProperty("jqx-checkbox-disabled"));this.disabled=false;a.jqx.aria(this,"aria-disabled",this.disabled)},destroy:function(){this.host.remove()},_raiseEvent:function(g,e){if(this.init){return}var c=this.events[g];var f=new jQuery.Event(c);f.owner=this;f.args=e;try{var b=this.host.trigger(f)}catch(d){}return b},propertyChangedHandler:function(b,c,e,d){if(this.isInitialized==undefined||this.isInitialized==false){return}if(c==b.enableContainerClick&&!b.disabled&&!b.locked){if(d){b.host.css("cursor","pointer")}else{b.host.css("cursor","auto")}}if(c=="rtl"){if(d){b.box.addClass(b.toThemeProperty("jqx-checkbox-rtl"));b.host.addClass(b.toThemeProperty("jqx-rtl"))}else{b.box.removeClass(b.toThemeProperty("jqx-checkbox-rtl"));b.host.removeClass(b.toThemeProperty("jqx-rtl"))}}if(c=="theme"){a.jqx.utilities.setTheme(e,d,b.host)}if(c=="checked"){if(d!=e){switch(d){case true:b.check();break;case false:b.uncheck();break;case null:b.indeterminate();break}}}if(c=="disabled"){if(d!=e){if(d){b.disable()}else{b.enable()}}}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.jqxWidget("jqxListBox","",{});a.extend(a.jqx._jqxListBox.prototype,{defineInstance:function(){this.disabled=false;this.width=null;this.height=null;this.items=new Array();this.multiple=false;this.selectedIndex=-1;this.selectedIndexes=new Array();this.source=null;this.scrollBarSize=a.jqx.utilities.scrollBarSize;this.enableHover=true;this.enableSelection=true;this.visualItems=new Array();this.groups=new Array();this.equalItemsWidth=true;this.itemHeight=-1;this.visibleItems=new Array();this.emptyGroupText="Group";this.checkboxes=false;this.hasThreeStates=false;this.autoHeight=false;this.autoItemsHeight=false;this.roundedcorners=true;this.touchMode="auto";this.displayMember="";this.valueMember="";this.searchMode="startswithignorecase";this.incrementalSearch=true;this.incrementalSearchDelay=1000;this.incrementalSearchKeyDownDelay=300;this.allowDrag=false;this.allowDrop=true;this.dropAction="default";this.touchModeStyle="auto";this.keyboardNavigation=true;this.enableMouseWheel=true;this.multipleextended=false;this.emptyString="null";this.rtl=false;this.rendered=null;this.renderer=null;this.dragStart=null;this.dragEnd=null;this.ready=null;this._checkForHiddenParent=true;this.aria={"aria-disabled":{name:"disabled",type:"boolean"}};this.events=["select","unselect","change","checkChange","dragStart","dragEnd","bindingComplete"]},createInstance:function(b){if(this.width==null){this.width=200}if(this.height==null){this.height=200}this.render();var c=this;a.jqx.utilities.resize(this.host,function(){c._updateSize()},false,this._checkForHiddenParent)},render:function(){this.element.innerHTML="";var b=this;var d=this.element.className;d+=" "+this.toThemeProperty("jqx-listbox");d+=" "+this.toThemeProperty("jqx-reset");d+=" "+this.toThemeProperty("jqx-rc-all");d+=" "+this.toThemeProperty("jqx-widget");d+=" "+this.toThemeProperty("jqx-widget-content");this.element.className=d;var h=false;if(this.width!=null&&this.width.toString().indexOf("%")!=-1){this.host.width(this.width);h=true}if(this.height!=null&&this.height.toString().indexOf("%")!=-1){this.host.height(this.height);if(this.host.height()==0){this.host.height(200)}h=true}if(this.width!=null&&this.width.toString().indexOf("px")!=-1){this.host.width(this.width)}else{if(this.width!=undefined&&!isNaN(this.width)){this.element.style.width=parseInt(this.width)+"px"}}if(this.height!=null&&this.height.toString().indexOf("px")!=-1){this.host.height(this.height)}else{if(this.height!=undefined&&!isNaN(this.height)){this.element.style.height=parseInt(this.height)+"px"}}if(this.multiple||this.multipleextended||this.checkboxes){a.jqx.aria(this,"aria-multiselectable",true)}else{a.jqx.aria(this,"aria-multiselectable",false)}var c=a("<div style='-webkit-appearance: none; background: transparent; outline: none; width:100%; height: 100%; align:left; border: 0px; padding: 0px; margin: 0px; left: 0px; top: 0px; valign:top; position: relative;'><div style='-webkit-appearance: none; border: none; background: transparent; outline: none; width:100%; height: 100%; padding: 0px; margin: 0px; align:left; left: 0px; top: 0px; valign:top; position: relative;'><div id='listBoxContent' style='-webkit-appearance: none; border: none; background: transparent; outline: none; border: none; padding: 0px; overflow: hidden; margin: 0px; align:left; valign:top; left: 0px; top: 0px; position: absolute;'/><div id='verticalScrollBar"+this.element.id+"' style='visibility: inherit; align:left; valign:top; left: 0px; top: 0px; position: absolute;'/><div id='horizontalScrollBar"+this.element.id+"' style='visibility: inherit; align:left; valign:top; left: 0px; top: 0px; position: absolute;'/><div id='bottomRight' style='align:left; valign:top; left: 0px; top: 0px; border: none; position: absolute;'/></div></div>");if(this._checkForHiddenParent){this._addInput();if(!this.host.attr("tabIndex")){this.host.attr("tabIndex",1)}}this.host.attr("role","listbox");if(this.checkboxes&&!this.host.jqxCheckBox){throw new Error("jqxListBox: Missing reference to jqxcheckbox.js.")}this.host.append(c);var f=this.host.find("#verticalScrollBar"+this.element.id);if(!this.host.jqxButton){throw new Error("jqxListBox: Missing reference to jqxbuttons.js.");return}if(!f.jqxScrollBar){throw new Error("jqxListBox: Missing reference to jqxscrollbar.js.");return}var g=parseInt(this.host.height())/2;if(g==0){g=10}this.vScrollBar=f.jqxScrollBar({_initialLayout:true,vertical:true,rtl:this.rtl,theme:this.theme,touchMode:this.touchMode,largestep:g});var e=this.host.find("#horizontalScrollBar"+this.element.id);this.hScrollBar=e.jqxScrollBar({_initialLayout:true,vertical:false,rtl:this.rtl,touchMode:this.touchMode,theme:this.theme});this.content=this.host.find("#listBoxContent");this.content[0].id="listBoxContent"+this.element.id;this.bottomRight=this.host.find("#bottomRight").addClass(this.toThemeProperty("jqx-listbox-bottomright"));this.bottomRight[0].id="bottomRight"+this.element.id;this.vScrollInstance=a.data(this.vScrollBar[0],"jqxScrollBar").instance;this.hScrollInstance=a.data(this.hScrollBar[0],"jqxScrollBar").instance;if(this.isTouchDevice()){if(!(a.jqx.browser.msie&&a.jqx.browser.version<9)){var i=a("<div class='overlay' style='z-index: 99; -webkit-appearance: none; border: none; background: black; opacity: 0.01; outline: none; border: none; padding: 0px; overflow: hidden; margin: 0px; align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div>");this.content.parent().append(i);this.overlayContent=this.host.find(".overlay")}}this._updateTouchScrolling();this.host.addClass("jqx-disableselect");if(this.host.jqxDragDrop){jqxListBoxDragDrop()}},_highlight:function(b,c){var d=c.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return b.replace(new RegExp("("+d+")","ig"),function(e,f){return"<b>"+f+"</b>"})},_addInput:function(){var b=this.host.attr("name");if(!b){b=this.element.id}else{this.host.attr("name","")}this.input=a("<input type='hidden'/>");this.host.append(this.input);this.input.attr("name",b)},_updateTouchScrolling:function(){var b=this;if(this.isTouchDevice()){b.enableHover=false;var c=this.overlayContent?this.overlayContent:this.content;this.removeHandler(a(c),a.jqx.mobile.getTouchEventName("touchstart")+".touchScroll");this.removeHandler(a(c),a.jqx.mobile.getTouchEventName("touchmove")+".touchScroll");this.removeHandler(a(c),a.jqx.mobile.getTouchEventName("touchend")+".touchScroll");this.removeHandler(a(c),"touchcancel.touchScroll");a.jqx.mobile.touchScroll(c,b.vScrollInstance.max,function(f,e){if(b.vScrollBar.css("visibility")!="hidden"){var d=b.vScrollInstance.value;b.vScrollInstance.setPosition(d+e);b._lastScroll=new Date()}if(b.hScrollBar.css("visibility")!="hidden"){var d=b.hScrollInstance.value;b.hScrollInstance.setPosition(d+f);b._lastScroll=new Date()}},this.element.id,this.hScrollBar,this.vScrollBar);if(b.vScrollBar.css("visibility")!="visible"&&b.hScrollBar.css("visibility")!="visible"){a.jqx.mobile.setTouchScroll(false,this.element.id)}else{a.jqx.mobile.setTouchScroll(true,this.element.id)}this._arrange()}},isTouchDevice:function(){var b=a.jqx.mobile.isTouchDevice();if(this.touchMode==true){if(this.touchDevice){return true}if(a.jqx.browser.msie&&a.jqx.browser.version<9){return false}this.touchDevice=true;b=true;a.jqx.mobile.setMobileSimulator(this.element)}else{if(this.touchMode==false){b=false}}if(b&&this.touchModeStyle!=false){this.scrollBarSize=a.jqx.utilities.touchScrollBarSize}if(b){this.host.addClass(this.toThemeProperty("jqx-touch"))}return b},beginUpdate:function(){this.updatingListBox=true},endUpdate:function(){this.updatingListBox=false;this._addItems();this._renderItems()},beginUpdateLayout:function(){this.updating=true},resumeUpdateLayout:function(){this.updating=false;this.vScrollInstance.value=0;this._render(false)},propertyChangedHandler:function(b,c,e,d){if(this.isInitialized==undefined||this.isInitialized==false){return}if(c=="itemHeight"){b.refresh()}if(c=="source"||c=="checkboxes"){if(d==null&&e&&e.unbindBindingUpdate){e.unbindBindingUpdate(b.element.id);e.unbindDownloadComplete(b.element.id)}b.clearSelection();b.refresh()}if(c=="scrollBarSize"||c=="equalItemsWidth"){if(d!=e){b._updatescrollbars()}}if(c=="disabled"){b._renderItems();b.vScrollBar.jqxScrollBar({disabled:d});b.hScrollBar.jqxScrollBar({disabled:d})}if(c=="touchMode"||c=="rtl"){b._removeHandlers();b.vScrollBar.jqxScrollBar({touchMode:d});b.hScrollBar.jqxScrollBar({touchMode:d});if(c=="touchMode"){if(!(a.jqx.browser.msie&&a.jqx.browser.version<9)){var g=a("<div class='overlay' style='z-index: 99; -webkit-appearance: none; border: none; background: black; opacity: 0.01; outline: none; border: none; padding: 0px; overflow: hidden; margin: 0px; align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div>");b.content.parent().append(g);b.overlayContent=b.host.find(".overlay")}}b._updateTouchScrolling();b._addHandlers();b._render(false)}if(!this.updating){if(c=="width"||c=="height"){b._updateSize()}}if(c=="theme"){if(e!=d){b.hScrollBar.jqxScrollBar({theme:b.theme});b.vScrollBar.jqxScrollBar({theme:b.theme});b.host.removeClass();b.host.addClass(b.toThemeProperty("jqx-listbox"));b.host.addClass(b.toThemeProperty("jqx-widget"));b.host.addClass(b.toThemeProperty("jqx-widget-content"));b.host.addClass(b.toThemeProperty("jqx-reset"));b.host.addClass(b.toThemeProperty("jqx-rc-all"));b.refresh()}}if(c=="selectedIndex"){b.clearSelection();b.selectIndex(d,true)}if(c=="displayMember"||c=="valueMember"){if(e!=d){var f=b.selectedIndex;b.refresh();b.selectedIndex=f;b.selectedIndexes[f]=f}b._renderItems()}if(c=="autoHeight"){if(e!=d){b._render(false)}else{b._updatescrollbars();b._renderItems()}}},loadFromSelect:function(i){if(i==null){return}var c="#"+i;var f=a(c);if(f.length>0){var e=f.find("option");var b=f.find("optgroup");var d=0;var h=-1;var g=new Array();a.each(e,function(){var k=b.find(this).length>0;var m=null;if(this.text!=this.value&&(this.label==null||this.label=="")){this.label=this.text}var l={disabled:this.disabled,value:this.value,label:this.label,title:this.title,originalItem:this};var j=a.jqx.browser.msie&&a.jqx.browser.version<8;if(j){if(l.value==""&&this.text!=null&&this.text.length>0){l.value=this.text}}if(k){m=b.find(this).parent()[0].label;l.group=m}if(this.selected){h=d}g[d]=l;d++});this.source=g;this.fromSelect=true;this.clearSelection();this.selectedIndex=h;this.selectedIndexes[this.selectedIndex]=this.selectedIndex;this.refresh()}},invalidate:function(){this._cachedItemHtml=[];this._renderItems();this.virtualSize=null;this._updateSize()},refresh:function(c){var b=this;if(this.vScrollBar==undefined){return}this._cachedItemHtml=[];this.visibleItems=new Array();var d=function(e){if(e==true){if(b.selectedIndex!=-1){var f=b.selectedIndex;b.selectedIndex=-1;b._stopEvents=true;b.selectIndex(f,false,true);if(b.selectedIndex==-1){b.selectedIndex=f}b._stopEvents=false}}};if(this.itemswrapper!=null){this.itemswrapper.remove();this.itemswrapper=null}if(a.jqx.dataAdapter&&this.source!=null&&this.source._source){this.databind(this.source);d(c);return}this.items=this.loadItems(this.source);this._raiseEvent("6");this._render(false,c==true);d(c)},_render:function(c,b){this._addItems();this._renderItems();this.vScrollInstance.setPosition(0);this._cachedItemHtml=new Array();if(c==undefined||c){if(this.items!=undefined&&this.items!=null){if(this.selectedIndex>=0&&this.selectedIndex<this.items.length){this.selectIndex(this.selectedIndex,true,true,true)}}}if(this.allowDrag&&this._enableDragDrop){this._enableDragDrop();if(this.isTouchDevice()){this._removeHandlers();if(this.overlayContent){this.overlayContent.remove();this.overlayContent=null}this._updateTouchScrolling();this._addHandlers();return}}this._updateTouchScrolling();if(this.rendered){this.rendered()}if(this.ready){this.ready()}},_hitTest:function(c,f){var e=parseInt(this.vScrollInstance.value);var b=this._searchFirstVisibleIndex(f+e,this.renderedVisibleItems);if(this.renderedVisibleItems[b]!=undefined&&this.renderedVisibleItems[b].isGroup){return null}if(this.renderedVisibleItems.length>0){var d=this.renderedVisibleItems[this.renderedVisibleItems.length-1];if(d.height+d.top<f+e){return null}}b=this._searchFirstVisibleIndex(f+e);return this.visibleItems[b];return null},_searchFirstVisibleIndex:function(e,f){if(e==undefined){e=parseInt(this.vScrollInstance.value)}var c=0;if(f==undefined||f==null){f=this.visibleItems}var b=f.length;while(c<=b){mid=parseInt((c+b)/2);var d=f[mid];if(d==undefined){break}if(d.initialTop>e&&d.initialTop+d.height>e){b=mid-1}else{if(d.initialTop<e&&d.initialTop+d.height<=e){c=mid+1}else{return mid;break}}}return 0},_renderItems:function(){if(this.items==undefined||this.items.length==0){this.visibleItems=new Array();return}if(this.updatingListBox==true){return}var N=this.isTouchDevice();var G=this.vScrollInstance;var h=this.hScrollInstance;var g=parseInt(G.value);var f=parseInt(h.value);if(this.rtl){if(this.hScrollBar[0].style.visibility!="hidden"){f=h.max-f}}var A=this.items.length;var M=this.host.width();var K=parseInt(this.content[0].style.width);var b=K+parseInt(h.max);var p=parseInt(this.vScrollBar[0].style.width)+2;if(this.vScrollBar[0].style.visibility=="hidden"){p=0}if(this.hScrollBar[0].style.visibility!="visible"){b=K}var k=this._getVirtualItemsCount();var L=new Array();var E=0;var D=parseInt(this.element.style.height)+2;if(this.element.style.height.indexOf("%")!=-1){D=this.host.outerHeight()}if(isNaN(D)){D=0}var s=0;var r=0;var Q=0;if(G.value==0||this.visibleItems.length==0){for(var q=0;q<this.items.length;q++){var w=this.items[q];if(w.visible){w.top=-g;w.initialTop=-g;if(!w.isGroup&&w.visible){this.visibleItems[r++]=w;w.visibleIndex=r-1}this.renderedVisibleItems[Q++]=w;w.left=-f;var c=w.top+w.height;if(c>=0&&w.top-w.height<=D){L[E++]={index:q,item:w}}g-=w.height}}}var l=g>0?this._searchFirstVisibleIndex(this.vScrollInstance.value,this.renderedVisibleItems):0;var O=0;E=0;var x=this.vScrollInstance.value;var J=0;while(O<100+D){var w=this.renderedVisibleItems[l];if(w==undefined){break}if(w.visible){w.left=-f;var c=w.top+w.height-x;if(c>=0&&w.initialTop-x-w.height<=2*D){L[E++]={index:l,item:w}}}l++;if(w.visible){O+=w.initialTop-x+w.height-O}J++;if(J>this.items.length-1){break}}var n=this.toThemeProperty("jqx-listitem-state-normal")+" "+this.toThemeProperty("jqx-item");var i=this.toThemeProperty("jqx-listitem-state-group");var P=this.toThemeProperty("jqx-listitem-state-disabled")+" "+this.toThemeProperty("jqx-fill-state-disabled");var B=0;var m=this;for(var q=0;q<this.visualItems.length;q++){var C=this.visualItems[q];var I=function(){var y=C[0].firstChild;if(m.checkboxes){y=C[0].lastChild}if(y!=null){y.style.visibility="hidden";y.className=""}if(m.checkboxes&&m.host.jqxCheckBox){var R=C.find(".chkbox");R.css({visibility:"hidden"})}};if(q<L.length){var w=L[q].item;if(w.initialTop-x>=D){I();continue}var z=a(C[0].firstChild);if(this.checkboxes){z=a(C[0].lastChild)}if(z.length==0){continue}if(z[0]==null){continue}z[0].className="";z[0].style.display="block";z[0].style.visibility="inherit";var o="";if(!w.isGroup&&!this.selectedIndexes[w.index]>=0){o=n}else{o=i}if(w.disabled||this.disabled){o+=" "+P}if(this.roundedcorners){o+=" "+this.toThemeProperty("jqx-rc-all")}if(N){o+=" "+this.toThemeProperty("jqx-listitem-state-normal-touch")}z[0].className=o;if(this.renderer){if(!w.key){w.key=this.generatekey()}if(!this._cachedItemHtml){this._cachedItemHtml=new Array()}if(this._cachedItemHtml[w.key]){if(z[0].innerHTML!=this._cachedItemHtml[w.key]){z[0].innerHTML=this._cachedItemHtml[w.key]}}else{var v=this.renderer(w.index,w.label,w.value);z[0].innerHTML=v;this._cachedItemHtml[w.key]=z[0].innerHTML}}else{if(this.itemHeight!==-1){var j=2+2*parseInt(z.css("padding-top"));z[0].style.lineHeight=(w.height-j)+"px";z.css("vertical-align","middle")}if(w.html!=null&&w.html.toString().length>0){z[0].innerHTML=w.html}else{if(w.label!=null||w.value!=null){if(w.label!=null){if(z[0].innerHTML!==w.label){z[0].innerHTML=w.label}if(w.label==""){z[0].innerHTML=this.emptyString;if(this.emptyString==""){z[0].style.height=(w.height-8)+"px"}}if(!this.incrementalSearch&&!w.disabled){if(this.searchString!=undefined&&this.searchString!=""){z[0].innerHTML=this._highlight(w.label,this.searchString)}}}else{if(z[0].innerHTML!==w.value){z[0].innerHTML=w.value}else{if(w.label==""){z[0].innerHTML=" "}}}}else{if(w.label==""||w.label==null){z[0].innerHTML="";z[0].style.height=(w.height-8)+"px"}}}}C[0].style.left=w.left+"px";C[0].style.top=w.initialTop-x+"px";w.element=z[0];if(w.title){z[0].title=w.title}if(this.equalItemsWidth&&!w.isGroup){if(s==0){var d=parseInt(b);var u=parseInt(z.outerWidth())-parseInt(z.width());d-=u;var H=1;if(H!=null){H=parseInt(H)}else{H=0}d-=2*H;s=d;if(this.checkboxes&&this.host.jqxCheckBox&&this.hScrollBar[0].style.visibility=="hidden"){s-=18}}if(K>this.virtualSize.width){z[0].style.width=s+"px";w.width=s}else{z[0].style.width=-4+this.virtualSize.width+"px";w.width=this.virtualSize.width-4}}else{if(z.width()<this.host.width()){z.width(this.host.width()-2)}}if(this.rtl){z[0].style.textAlign="right"}if(this.autoItemsHeight){z[0].style.whiteSpace="normal";z.width(s);w.width=s}B=0;if(this.checkboxes&&this.host.jqxCheckBox&&!w.isGroup){if(B==0){B=(w.height-16)/2;B++}var e=a(C.children()[0]);e[0].item=w;if(!this.rtl){if(z[0].style.left!="18px"){z[0].style.left="18px"}}else{if(z[0].style.left!="0px"){z[0].style.left="0px"}}if(this.rtl){e.css("left",8+w.width+"px")}e.css("top",B+"px");e.css({display:"block",visibility:"inherit"});var t=false;if(e.data().jqxCheckBox){var F=e.data().jqxCheckBox.instance;var t=F.checked}if(a.jqx.ariaEnabled){if(t){C[0].setAttribute("aria-selected",true)}else{C[0].removeAttribute("aria-selected")}}if(F){if(t!=w.checked){F._setState(w.checked);if(w.disabled!=F.disabled){e.jqxCheckBox({disabled:w.disabled})}}else{if(w.disabled!=F.disabled){e.jqxCheckBox({disabled:w.disabled})}}if((this.disabled||w.disabled)!=F.disabled){e.jqxCheckBox({disabled:this.disabled||w.disabled})}}}else{if(this.checkboxes&&this.host.jqxCheckBox){var e=a(C.children()[0]);e.css({display:"none",visibility:"inherit"})}}if(this.selectedIndexes[w.visibleIndex]>=0&&!w.disabled){z.addClass(this.toThemeProperty("jqx-listitem-state-selected"));z.addClass(this.toThemeProperty("jqx-fill-state-pressed"));if(a.jqx.ariaEnabled){C[0].setAttribute("aria-selected",true);this._activeElement=C[0]}}else{if(!this.checkboxes){if(a.jqx.ariaEnabled){C[0].removeAttribute("aria-selected")}}}}else{I()}}},generatekey:function(){var b=function(){return(((1+Math.random())*65536)|0).toString(16).substring(1)};return(b()+b()+"-"+b()+"-"+b()+"-"+b()+"-"+b()+b()+b())},_calculateVirtualSize:function(){var o=0;var m=2;var g=0;var n=a("<span></span>");if(this.equalItemsWidth){n.css("float","left")}var h=0;var i=this.host.outerHeight();a(document.body).append(n);var e=this.items.length;var j=this.host.width();if(this.autoItemsHeight){j-=10;if(this.vScrollBar.css("visibility")!="hidden"){j-=20}}if(this.autoItemsHeight||this.renderer||this.groups.length>1||(e>0&&this.items[0].html!=null&&this.items[0].html!="")){for(var g=0;g<e;g++){var r=this.items[g];if(r.isGroup&&(r.label==""&&r.html=="")){continue}if(!r.visible){continue}var d="";if(!r.isGroup){d+=this.toThemeProperty("jqx-listitem-state-normal jqx-rc-all")}else{d+=this.toThemeProperty("jqx-listitem-state-group jqx-rc-all")}d+=" "+this.toThemeProperty("jqx-fill-state-normal");if(this.isTouchDevice()){d+=" "+this.toThemeProperty("jqx-touch")}n[0].className=d;if(this.autoItemsHeight){n[0].style.whiteSpace="normal";var b=this.checkboxes?-20:0;n[0].style.width=(b+j)+"px"}if(this.renderer){var k=this.renderer(r.index,r.label,r.value);n[0].innerHTML=k}else{if(r.html!=null&&r.html.toString().length>0){n[0].innerHTML=r.html}else{if(r.label!=null||r.value!=null){if(r.label!=null){n[0].innerHTML=r.label;if(r.label==""){n[0].innerHTML="Empty"}}else{n[0].innerHTML=r.value}}}}var q=n.outerHeight();var s=n.outerWidth();if(this.itemHeight>-1){q=this.itemHeight}r.height=q;r.width=s;m+=q;o=Math.max(o,s);if(m<=i){h++}}}else{var m=0;var l=0;var c="";var t=0;var f=0;var p=-1;for(var g=0;g<e;g++){var r=this.items[g];if(r.isGroup&&(r.label==""&&r.html=="")){continue}if(!r.visible){continue}p++;var d="";if(p==0){d+=this.toThemeProperty("jqx-listitem-state-normal jqx-rc-all");d+=" "+this.toThemeProperty("jqx-fill-state-normal");d+=" "+this.toThemeProperty("jqx-widget");d+=" "+this.toThemeProperty("jqx-listbox");d+=" "+this.toThemeProperty("jqx-widget-content");if(this.isTouchDevice()){d+=" "+this.toThemeProperty("jqx-touch");d+=" "+this.toThemeProperty("jqx-listitem-state-normal-touch")}n[0].className=d;if(this.autoItemsHeight){n[0].style.whiteSpace="normal";var b=this.checkboxes?-20:0;n[0].style.width=(b+j)+"px"}if(r.html==null||(r.label==""||r.label==null)){n[0].innerHTML="Item"}else{if(r.html!=null&&r.html.toString().length>0){n[0].innerHTML=r.html}else{if(r.label!=null||r.value!=null){if(r.label!=null){n[0].innerHTML=r.label}else{n[0].innerHTML=r.value}}}}var q=n.outerHeight();if(this.itemHeight>-1){q=this.itemHeight}l=q}if(t!=undefined){f=t}if(r.html!=null&&r.html.toString().length>0){t=Math.max(t,r.html.toString().length);if(f!=t){c=r.html}}else{if(r.label!=null){t=Math.max(t,r.label.length);if(f!=t){c=r.label}}else{if(r.value!=null){t=Math.max(t,r.value.length);if(f!=t){c=r.value}}}}r.height=l;m+=l;if(m<=i){h++}}n[0].innerHTML=c;o=n.outerWidth()}m+=2;if(h<10){h=10}n.remove();return{width:o,height:m,itemsPerPage:h}},_getVirtualItemsCount:function(){if(this.virtualItemsCount==0){var b=parseInt(this.host.height())/5;if(b>this.items.length){b=this.items.length}return b}else{return this.virtualItemsCount}},_addItems:function(l){if(this.updatingListBox==true){return}if(this.items==undefined||this.items.length==0){this.virtualSize={width:0,height:0,itemsPerPage:0};this._updatescrollbars();this.renderedVisibleItems=new Array();if(this.itemswrapper){this.itemswrapper.children().remove()}return}if(l==false){var o=this._calculateVirtualSize();var p=o.itemsPerPage*2;if(this.autoHeight){p=this.items.length}this.virtualItemsCount=Math.min(p,this.items.length);var j=this;var i=o.width;this.virtualSize=o;this._updatescrollbars();return}var r=this;var k=0;this.visibleItems=new Array();this.renderedVisibleItems=new Array();this._removeHandlers();if(this.allowDrag&&this._enableDragDrop){this.itemswrapper=null}if(this.itemswrapper==null){this.content[0].innerHTML="";this.itemswrapper=a('<div style="outline: 0 none; overflow:hidden; width:100%; position: relative;"></div>');this.itemswrapper.height(2*this.host.height());this.content.append(this.itemswrapper)}var o=this._calculateVirtualSize();var p=o.itemsPerPage*2;if(this.autoHeight){p=this.items.length}this.virtualItemsCount=Math.min(p,this.items.length);var j=this;var i=o.width;this.virtualSize=o;this.itemswrapper.width(Math.max(this.host.width(),17+o.width));var m=0;var g="";for(var n=m;n<this.virtualItemsCount;n++){var q=this.items[n];var b="listitem"+n+this.element.id;g+="<div role='option' id='"+b+"' class='jqx-listitem-element'>";if(this.checkboxes&&this.host.jqxCheckBox){g+='<div style="background-color: transparent; padding: 0; margin: 0; position: absolute; float: left; width: 16px; height: 16px;" class="chkbox"></div>'}g+="<span style='-ms-touch-action: none;'></span></div>"}if(r.WinJS){MSApp.execUnsafeLocalFunction(function(){WinJS.Utilities.setInnerHTMLUnsafe(this.itemswrapper[0],g)})}else{this.itemswrapper[0].innerHTML=g}var d=this.itemswrapper.children();for(var n=m;n<this.virtualItemsCount;n++){var q=this.items[n];var c=a(d[n]);if(this.allowDrag&&this._enableDragDrop){c.addClass("draggable")}if(this.checkboxes&&this.host.jqxCheckBox){var h=a(c.children()[0]);c.css("float","left");var e=a(c[0].firstChild);e.css("float","left");h.jqxCheckBox({locked:true,disabledContainer:true,hasInput:false,checked:q.checked,animationShowDelay:0,animationHideDelay:0,disabled:q.disabled,enableContainerClick:false,keyboardCheck:false,hasThreeStates:this.hasThreeStates,theme:this.theme});q.checkBoxElement=h[0];q.checkBoxInstance=h.data().jqxCheckBox.instance;var f=function(v,u){var s=v.owner.element.item;if(s!=null){var t=v.args;if(u){j.checkIndex(s.index,true)}else{if(s.checked==false){j.uncheckIndex(s.index,true)}else{if(s.hasThreeStates&&j.hasThreeStates){if(u==false){j.uncheckIndex(s.index,true)}else{j.indeterminateIndex(s.index,true)}}else{j.uncheckIndex(s.index,true)}}}}j.focused=true};q.checkBoxInstance.updated=f}c[0].style.height=q.height+"px";c[0].style.top=k+"px";k+=q.height;this.visualItems[n]=c}this._addHandlers();this._updatescrollbars();if(this.autoItemsHeight){var o=this._calculateVirtualSize();var p=o.itemsPerPage*2;if(this.autoHeight){p=this.items.length}this.virtualItemsCount=Math.min(p,this.items.length);var j=this;var i=o.width;this.virtualSize=o;this._updatescrollbars()}if(a.jqx.browser.msie&&a.jqx.browser.version<8){this.host.attr("hideFocus",true);this.host.find("div").attr("hideFocus",true)}},_updatescrollbars:function(){if(!this.virtualSize){return}var l=this.virtualSize.height;var j=this.virtualSize.width;var f=this.vScrollInstance;var e=this.hScrollInstance;this._arrange(false);var k=false;var m=this.host.outerWidth();if(l>this.host.outerHeight()){var b=0;if(j>m){b=this.hScrollBar.outerHeight()+2}var d=f.max;f.max=2+parseInt(l)+b-parseInt(this.host.height());if(this.vScrollBar[0].style.visibility!="inherit"){this.vScrollBar[0].style.visibility="inherit";k=true}if(d!=f.max){f._arrange()}}else{if(this.vScrollBar[0].style.visibility!="hidden"){this.vScrollBar[0].style.visibility="hidden";k=true;f.setPosition(0)}}var h=0;if(this.vScrollBar[0].style.visibility!="hidden"){h=this.scrollBarSize+6}var g=this.checkboxes?20:0;if(this.autoItemsHeight){this.hScrollBar[0].style.visibility="hidden"}else{if(j>=m-h-g){var i=e.max;if(this.vScrollBar[0].style.visibility=="inherit"){e.max=g+h+parseInt(j)-this.host.width()+4}else{e.max=g+parseInt(j)-this.host.width()+6}if(this.hScrollBar[0].style.visibility!="inherit"){this.hScrollBar[0].style.visibility="inherit";k=true}if(i!=e.max){e._arrange()}if(this.vScrollBar[0].style.visibility=="inherit"){f.max=2+parseInt(l)+this.hScrollBar.outerHeight()+2-parseInt(this.host.height())}}else{if(this.hScrollBar[0].style.visibility!="hidden"){this.hScrollBar[0].style.visibility="hidden";k=true}}}e.setPosition(0);if(k){this._arrange()}if(this.itemswrapper){this.itemswrapper.width(Math.max(this.host.width(),17+j));this.itemswrapper.height(2*this.host.height())}var c=this.isTouchDevice();if(c){if(this.vScrollBar.css("visibility")!="visible"&&this.hScrollBar.css("visibility")!="visible"){a.jqx.mobile.setTouchScroll(false,this.element.id)}else{a.jqx.mobile.setTouchScroll(true,this.element.id)}}},clear:function(){this.source=null;this.clearSelection();this.refresh()},clearSelection:function(b){for(var c=0;c<this.selectedIndexes.length;c++){if(this.selectedIndexes[c]&&this.selectedIndexes[c]!=-1){this._raiseEvent("1",{index:c,type:"api",item:this.getVisibleItem(c),originalEvent:null})}this.selectedIndexes[c]=-1}this.selectedIndex=-1;if(b!=false){this._renderItems()}},unselectIndex:function(b,c){if(isNaN(b)){return}this.selectedIndexes[b]=-1;var e=false;for(var d=0;d<this.selectedIndexes.length;d++){var b=this.selectedIndexes[d];if(b!=-1&&b!=undefined){e=true}}if(!e){this.selectedValue=null;this.selectedIndex=-1}if(c==undefined||c==true){this._renderItems();this._raiseEvent("1",{index:b,type:"api",item:this.getVisibleItem(b),originalEvent:null})}this._updateInputSelection();this._raiseEvent("2",{index:b,type:"api",item:this.getItem(b)})},getItem:function(c){if(c==-1||isNaN(c)||typeof(c)==="string"){if(c===-1){return null}return this.getItemByValue(c)}var b=null;var d=a.each(this.items,function(){if(this.index==c){b=this;return false}});return b},getVisibleItem:function(b){if(b==-1||isNaN(b)||typeof(b)==="string"){if(b===-1){return null}return this.getItemByValue(b)}return this.visibleItems[b]},getVisibleItems:function(){return this.visibleItems},checkIndex:function(b,c,e){if(!this.checkboxes||!this.host.jqxCheckBox){return}if(isNaN(b)){return}if(b<0||b>=this.visibleItems.length){return}if(this.visibleItems[b]!=null&&this.visibleItems[b].disabled){return}if(this.disabled){return}var d=this.getItem(b);if(this.groups.length>0){var d=this.getVisibleItem(b)}if(d!=null){var f=a(d.checkBoxElement);d.checked=true;if(c==undefined||c==true){this._updateCheckedItems()}}if(e==undefined||e==true){this._raiseEvent(3,{label:d.label,value:d.value,checked:true,item:d})}},getCheckedItems:function(){if(!this.checkboxes||!this.host.jqxCheckBox){return null}var b=new Array();if(this.items==undefined){return}a.each(this.items,function(){if(this.checked){b[b.length]=this}});return b},checkAll:function(b){if(!this.checkboxes||!this.host.jqxCheckBox){return}if(this.disabled){return}var c=this;a.each(this.items,function(){var d=this;if(b!==false&&d.checked!==true){c._raiseEvent(3,{label:d.label,value:d.value,checked:true,item:d})}this.checked=true});this._updateCheckedItems()},uncheckAll:function(b){if(!this.checkboxes||!this.host.jqxCheckBox){return}if(this.disabled){return}var c=this;a.each(this.items,function(){var d=this;if(b!==false&&d.checked!==false){this.checked=false;c._raiseEvent(3,{label:d.label,value:d.value,checked:false,item:d})}this.checked=false});this._updateCheckedItems()},uncheckIndex:function(b,c,e){if(!this.checkboxes||!this.host.jqxCheckBox){return}if(isNaN(b)){return}if(b<0||b>=this.visibleItems.length){return}if(this.visibleItems[b]!=null&&this.visibleItems[b].disabled){return}if(this.disabled){return}var d=this.getItem(b);if(this.groups.length>0){var d=this.getVisibleItem(b)}if(d!=null){var f=a(d.checkBoxElement);d.checked=false;if(c==undefined||c==true){this._updateCheckedItems()}}if(e==undefined||e==true){this._raiseEvent(3,{label:d.label,value:d.value,checked:false,item:d})}},indeterminateIndex:function(b,c,e){if(!this.checkboxes||!this.host.jqxCheckBox){return}if(isNaN(b)){return}if(b<0||b>=this.visibleItems.length){return}if(this.visibleItems[b]!=null&&this.visibleItems[b].disabled){return}if(this.disabled){return}var d=this.getItem(b);if(this.groups.length>0){var d=this.getVisibleItem(b)}if(d!=null){var f=a(d.checkBoxElement);d.checked=null;if(c==undefined||c==true){this._updateCheckedItems()}}if(e==undefined||e==true){this._raiseEvent(3,{checked:null})}},getSelectedIndex:function(){return this.selectedIndex},getSelectedItems:function(){var b=this.getVisibleItems();var e=this.selectedIndexes;var d=[];for(var c in e){if(e[c]!=-1){d[d.length]=b[c]}}return d},getSelectedItem:function(){return this.getItem(this.selectedIndex)},_updateCheckedItems:function(){var b=this.selectedIndex;this.clearSelection(false);var c=this.getCheckedItems();this.selectedIndex=b;this._renderItems();var d=a.data(this.element,"hoveredItem");if(d!=null){a(d).addClass(this.toThemeProperty("jqx-listitem-state-hover"));a(d).addClass(this.toThemeProperty("jqx-fill-state-hover"))}this._updateInputSelection()},getItemByValue:function(d){if(this.visibleItems==null){return}if(this.itemsByValue){return this.itemsByValue[a.trim(d).split(" ").join("")]}var b=this.visibleItems;for(var c=0;c<b.length;c++){if(b[c].value==d){return b[c];break}}},checkItem:function(c){if(c!=null){var b=this._getItemByParam(c);return this.checkIndex(b.index,true)}return false},uncheckItem:function(c){if(c!=null){var b=this._getItemByParam(c);return this.uncheckIndex(b.index,true)}return false},indeterminateItem:function(c){if(c!=null){var b=this._getItemByParam(c);return this.indeterminateIndex(b.index,true)}return false},val:function(c){if(this.input&&arguments.length==0){return this.input.val()}var b=this.getItemByValue(c);if(b!=null){this.selectItem(b)}if(this.input){return this.input.val()}},selectItem:function(c){if(c!=null){if(c.index==undefined){var b=this.getItemByValue(c);if(b){c=b}}return this.selectIndex(c.visibleIndex,true)}return false},unselectItem:function(c){if(c!=null){if(c.index==undefined){var b=this.getItemByValue(c);if(b){c=b}}return this.unselectIndex(c.visibleIndex,true)}return false},selectIndex:function(j,q,c,d,m,b){if(isNaN(j)){return}if(j<-1||j>=this.visibleItems.length){return}if(this.visibleItems[j]!=null&&this.visibleItems[j].disabled){return}if(this.disabled){return}if(!this.multiple&&!this.multipleextended&&this.selectedIndex==j&&!d){return}if(this.checkboxes){this._updateCheckedItems();return}this.focused=true;var p=false;if(this.selectedIndex!=j){p=true}var o=this.selectedIndex;if(this.selectedIndex==j&&!this.multiple){o=-1}if(m==undefined){m="none"}var h=this.getItem(j);var r=this.getItem(o);if(this.visibleItems&&this.items&&this.visibleItems.length!=this.items.length){h=this.getVisibleItem(j);r=this.getVisibleItem(o)}if(d!=undefined&&d){this._raiseEvent("1",{index:o,type:m,item:r,originalEvent:b});this.selectedIndex=j;this.selectedIndexes[o]=-1;this.selectedIndexes[j]=j;if(h){this.selectedValue=h.value}this._raiseEvent("0",{index:j,type:m,item:h,originalEvent:b})}else{var l=this;var e=function(s,w,u,v,t,i){l._raiseEvent("1",{index:w,type:u,item:v,originalEvent:i});l.selectedIndex=s;l.selectedIndexes[w]=-1;w=s;l.selectedIndexes[s]=s;l._raiseEvent("0",{index:s,type:u,item:t,originalEvent:i})};var k=function(s,w,u,v,t,i){if(l.selectedIndexes[s]==undefined||l.selectedIndexes[s]==-1){l.selectedIndexes[s]=s;l.selectedIndex=s;l._raiseEvent("0",{index:s,type:u,item:t,originalEvent:i})}else{w=l.selectedIndexes[s];v=l.getVisibleItem(w);l.selectedIndexes[s]=-1;l.selectedIndex=-1;l._raiseEvent("1",{index:w,type:u,item:v,originalEvent:i})}};if(this.multipleextended){if(!this._shiftKey&&!this._ctrlKey){if(m!="keyboard"&&m!="mouse"){k(j,o,m,r,h,b);l._clickedIndex=j}else{this.clearSelection(false);l._clickedIndex=j;e(j,o,m,r,h,b)}}else{if(this._ctrlKey){if(m=="keyboard"){this.clearSelection(false);l._clickedIndex=j}k(j,o,m,r,h,b)}else{if(this._shiftKey){if(l._clickedIndex==undefined){l._clickedIndex=o}var f=Math.min(l._clickedIndex,j);var n=Math.max(l._clickedIndex,j);this.clearSelection(false);for(var g=f;g<=n;g++){l.selectedIndexes[g]=g;l._raiseEvent("0",{index:g,type:m,item:this.getVisibleItem(g),originalEvent:b})}if(m!="keyboard"){l.selectedIndex=l._clickedIndex}else{l.selectedIndex=j}}}}}else{if(this.multiple){k(j,o,m,r,h,b)}else{if(h){this.selectedValue=h.value}e(j,o,m,r,h,b)}}}if(c==undefined||c==true){this._renderItems()}if(q!=undefined&&q!=null&&q==true){this.ensureVisible(j)}this._raiseEvent("2",{index:j,item:h,oldItem:r,type:m});this._updateInputSelection();return p},_updateInputSelection:function(){if(this.input){if(this.selectedIndex==-1){this.input.val("")}else{if(this.items){if(this.items[this.selectedIndex]!=undefined){this.input.val(this.items[this.selectedIndex].value)}}}if(this.multiple||this.multipleextended||this.checkboxes){var b=!this.checkboxes?this.getSelectedItems():this.getCheckedItems();var d="";if(b){for(var c=0;c<b.length;c++){if(undefined!=b[c]){if(c==b.length-1){d+=b[c].value}else{d+=b[c].value+","}}}this.input.val(d)}}}},isIndexInView:function(c){if(isNaN(c)){return false}if(!this.items){return false}if(c<0||c>=this.items.length){return false}var d=this.vScrollInstance.value;var e=this.visibleItems[c];if(e==undefined){return true}var b=e.initialTop;var f=e.height;if(b-d<0||b-d+f>=this.host.outerHeight()){return false}return true},_itemsInPage:function(){var b=0;var c=this;a.each(this.items,function(){if((this.initialTop+this.height)>=c.content.height()){return false}b++});return b},_firstItemIndex:function(){if(this.visibleItems!=null){if(this.visibleItems[0].isGroup){return this._nextItemIndex(0)}else{return 0}}return -1},_lastItemIndex:function(){if(this.visibleItems!=null){if(this.visibleItems[this.visibleItems.length-1].isGroup){return this._prevItemIndex(this.visibleItems.length-1)}else{return this.visibleItems.length-1}}return -1},_nextItemIndex:function(b){for(indx=b+1;indx<this.visibleItems.length;indx++){if(this.visibleItems[indx]){if(!this.visibleItems[indx].disabled&&!this.visibleItems[indx].isGroup){return indx}}}return -1},_prevItemIndex:function(b){for(indx=b-1;indx>=0;indx--){if(this.visibleItems[indx]){if(!this.visibleItems[indx].disabled&&!this.visibleItems[indx].isGroup){return indx}}}return -1},_getMatches:function(g,d){if(g==undefined||g.length==0){return -1}if(d==undefined){d=0}var b=this.getItems();var f=this;var c=-1;var e=0;a.each(b,function(h){var k="";if(!this.isGroup){if(this.label){k=this.label.toString()}else{if(this.value){k=this.value.toString()}else{if(this.title){k=this.title.toString()}else{k="jqxItem"}}}var j=false;switch(f.searchMode){case"containsignorecase":j=a.jqx.string.containsIgnoreCase(k,g);break;case"contains":j=a.jqx.string.contains(k,g);break;case"equals":j=a.jqx.string.equals(k,g);break;case"equalsignorecase":j=a.jqx.string.equalsIgnoreCase(k,g);break;case"startswith":j=a.jqx.string.startsWith(k,g);break;case"startswithignorecase":j=a.jqx.string.startsWithIgnoreCase(k,g);break;case"endswith":j=a.jqx.string.endsWith(k,g);break;case"endswithignorecase":j=a.jqx.string.endsWithIgnoreCase(k,g);break}if(j&&this.visibleIndex>=d){c=this.visibleIndex;return false}}});return c},findItems:function(e){var b=this.getItems();var d=this;var c=0;var f=new Array();a.each(b,function(g){var j="";if(!this.isGroup){if(this.label){j=this.label}else{if(this.value){j=this.value}else{if(this.title){j=this.title}else{j="jqxItem"}}}var h=false;switch(d.searchMode){case"containsignorecase":h=a.jqx.string.containsIgnoreCase(j,e);break;case"contains":h=a.jqx.string.contains(j,e);break;case"equals":h=a.jqx.string.equals(j,e);break;case"equalsignorecase":h=a.jqx.string.equalsIgnoreCase(j,e);break;case"startswith":h=a.jqx.string.startsWith(j,e);break;case"startswithignorecase":h=a.jqx.string.startsWithIgnoreCase(j,e);break;case"endswith":h=a.jqx.string.endsWith(j,e);break;case"endswithignorecase":h=a.jqx.string.endsWithIgnoreCase(j,e);break}if(h){f[c++]=this}}});return f},_handleKeyDown:function(n){var s=n.keyCode;var k=this;var g=k.selectedIndex;var d=k.selectedIndex;var l=false;if(!this.keyboardNavigation||!this.enableSelection){return}var j=function(){if(k.multiple){k.clearSelection(false)}};if(n.altKey){s=-1}if(k.incrementalSearch){var o=-1;if(!k._searchString){k._searchString=""}if((s==8||s==46)&&k._searchString.length>=1){k._searchString=k._searchString.substr(0,k._searchString.length-1)}var r=String.fromCharCode(s);var m=(!isNaN(parseInt(r)));var i=false;if((s>=65&&s<=97)||m||s==8||s==32||s==46){if(!n.shiftKey){r=r.toLocaleLowerCase()}var e=1+k.selectedIndex;if(s!=8&&s!=32&&s!=46){if(k._searchString.length>0&&k._searchString.substr(0,1)==r){e=1+k.selectedIndex}else{k._searchString+=r}}if(s==32){k._searchString+=" "}var b=this._getMatches(k._searchString,e);o=b;if(o==k._lastMatchIndex||o==-1){var b=this._getMatches(k._searchString,0);o=b}k._lastMatchIndex=o;if(o>=0){var h=function(){j();k.selectIndex(o,false,false,false,"keyboard",n);var t=k.isIndexInView(o);if(!t){k.ensureVisible(o)}else{k._renderItems()}};if(k._toSelectTimer){clearTimeout(k._toSelectTimer)}k._toSelectTimer=setTimeout(function(){h()},k.incrementalSearchKeyDownDelay)}i=true}if(k._searchTimer!=undefined){clearTimeout(k._searchTimer)}if(s==27||s==13){k._searchString=""}k._searchTimer=setTimeout(function(){k._searchString="";k._renderItems()},k.incrementalSearchDelay);if(o>=0){return}if(i){return false}}if(this.checkboxes){return true}if(s==33){var p=k._itemsInPage();if(k.selectedIndex-p>=0){j();k.selectIndex(d-p,false,false,false,"keyboard",n)}else{j();k.selectIndex(k._firstItemIndex(),false,false,false,"keyboard",n)}k._searchString=""}if(s==32&&this.checkboxes){var f=this.getItem(g);if(f!=null){k._updateItemCheck(f,g);n.preventDefault()}k._searchString=""}if(s==36){j();k.selectIndex(k._firstItemIndex(),false,false,false,"keyboard",n);k._searchString=""}if(s==35){j();k.selectIndex(k._lastItemIndex(),false,false,false,"keyboard",n);k._searchString=""}if(s==34){var p=k._itemsInPage();if(k.selectedIndex+p<k.visibleItems.length){j();k.selectIndex(d+p,false,false,false,"keyboard",n)}else{j();k.selectIndex(k._lastItemIndex(),false,false,false,"keyboard",n)}k._searchString=""}if(s==38){k._searchString="";if(k.selectedIndex>0){var c=k._prevItemIndex(k.selectedIndex);if(c!=k.selectedIndex&&c!=-1){j();k.selectIndex(c,false,false,false,"keyboard",n)}else{return true}}else{return false}}else{if(s==40){k._searchString="";if(k.selectedIndex+1<k.visibleItems.length){var c=k._nextItemIndex(k.selectedIndex);if(c!=k.selectedIndex&&c!=-1){j();k.selectIndex(c,false,false,false,"keyboard",n)}else{return true}}else{return false}}}if(s==35||s==36||s==38||s==40||s==34||s==33){var q=k.isIndexInView(k.selectedIndex);if(!q){k.ensureVisible(k.selectedIndex)}else{k._renderItems()}return false}return true},_updateItemCheck:function(b,c){if(b.checked==true){b.checked=(b.hasThreeStates&&this.hasThreeStates)?null:false}else{b.checked=b.checked!=null}switch(b.checked){case true:this.checkIndex(c);break;case false:this.uncheckIndex(c);break;default:this.indeterminateIndex(c);break}},wheel:function(d,c){if(c.autoHeight||!c.enableMouseWheel){d.returnValue=true;return true}if(c.disabled){return true}var e=0;if(!d){d=window.event}if(d.originalEvent&&d.originalEvent.wheelDelta){d.wheelDelta=d.originalEvent.wheelDelta}if(d.wheelDelta){e=d.wheelDelta/120}else{if(d.detail){e=-d.detail/3}}if(e){var b=c._handleDelta(e);if(b){if(d.preventDefault){d.preventDefault()}if(d.originalEvent!=null){d.originalEvent.mouseHandled=true}if(d.stopPropagation!=undefined){d.stopPropagation()}}if(b){b=false;d.returnValue=b;return b}else{return false}}if(d.preventDefault){d.preventDefault()}d.returnValue=false},_handleDelta:function(d){var c=this.vScrollInstance.value;if(d<0){this.scrollDown()}else{this.scrollUp()}var b=this.vScrollInstance.value;if(c!=b){return true}return false},focus:function(){try{this.focused=true;this.host.focus();var c=this;setTimeout(function(){c.host.focus()},10)}catch(b){}},_removeHandlers:function(){var b=this;this.removeHandler(a(document),"keydown.listbox"+this.element.id);this.removeHandler(a(document),"keyup.listbox"+this.element.id);this.removeHandler(this.vScrollBar,"valuechanged");this.removeHandler(this.hScrollBar,"valuechanged");if(this._mousewheelfunc){this.removeHandler(this.host,"mousewheel",this._mousewheelfunc)}else{this.removeHandler(this.host,"mousewheel")}this.removeHandler(this.host,"keydown");this.removeHandler(this.content,"mouseleave");this.removeHandler(this.content,"focus");this.removeHandler(this.content,"blur");this.removeHandler(this.host,"focus");this.removeHandler(this.host,"blur");this.removeHandler(this.content,"mouseenter");this.removeHandler(this.content,"mouseup");this.removeHandler(this.content,"mousedown");this.removeHandler(this.content,"touchend");if(this._mousemovefunc){this.removeHandler(this.content,"mousemove",this._mousemovefunc)}else{this.removeHandler(this.content,"mousemove")}this.removeHandler(this.content,"selectstart");if(this.overlayContent){this.removeHandler(this.overlayContent,a.jqx.mobile.getTouchEventName("touchend"))}},_updateSize:function(){if(!this.virtualSize){this._oldheight=null;this.virtualSize=this._calculateVirtualSize()}var b=this;b._arrange();if(b.host.height()!=b._oldheight||b.host.width()!=b._oldwidth){var c=b.host.width()!=b._oldwidth;if(b.autoItemsHeight){b._render(false)}else{if(b.items){if(b.items.length>0&&b.virtualItemsCount*b.items[0].height<b._oldheight){b._render(false)}else{var d=b.vScrollInstance.value;b._updatescrollbars();b._renderItems();if(d<b.vScrollInstance.max){b.vScrollInstance.setPosition(d)}else{b.vScrollInstance.setPosition(b.vScrollInstance.max)}}}}b._oldwidth=b.host.width();b._oldheight=b.host.height()}},_addHandlers:function(){var j=this;this.focused=false;var k=false;var i=0;var f=null;var i=0;var b=0;var g=new Date();var d=this.isTouchDevice();this.addHandler(this.vScrollBar,"valuechanged",function(l){if(a.jqx.browser.msie&&a.jqx.browser.version>9){setTimeout(function(){j._renderItems()},1)}else{j._renderItems()}});this.addHandler(this.hScrollBar,"valuechanged",function(){j._renderItems()});if(this._mousewheelfunc){this.removeHandler(this.host,"mousewheel",this._mousewheelfunc)}this._mousewheelfunc=function(l){j.wheel(l,j)};this.addHandler(this.host,"mousewheel",this._mousewheelfunc);this.addHandler(a(document),"keydown.listbox"+this.element.id,function(l){j._ctrlKey=l.ctrlKey;j._shiftKey=l.shiftKey});this.addHandler(a(document),"keyup.listbox"+this.element.id,function(l){j._ctrlKey=l.ctrlKey;j._shiftKey=l.shiftKey});this.addHandler(this.host,"keydown",function(l){return j._handleKeyDown(l)});this.addHandler(this.content,"mouseleave",function(l){j.focused=false;var m=a.data(j.element,"hoveredItem");if(m!=null){a(m).removeClass(j.toThemeProperty("jqx-listitem-state-hover"));a(m).removeClass(j.toThemeProperty("jqx-fill-state-hover"));a.data(j.element,"hoveredItem",null)}});this.addHandler(this.content,"focus",function(l){if(!j.disabled){j.host.addClass(j.toThemeProperty("jqx-fill-state-focus"));j.focused=true}});this.addHandler(this.content,"blur",function(l){j.focused=false;j.host.removeClass(j.toThemeProperty("jqx-fill-state-focus"))});this.addHandler(this.host,"focus",function(l){if(!j.disabled){j.host.addClass(j.toThemeProperty("jqx-fill-state-focus"));j.focused=true}});this.addHandler(this.host,"blur",function(l){if(a.jqx.browser.msie&&a.jqx.browser.version<9&&j.focused){return}j.host.removeClass(j.toThemeProperty("jqx-fill-state-focus"));j.focused=false});this.addHandler(this.content,"mouseenter",function(l){j.focused=true});var c=a.jqx.utilities.hasTransform(this.host);if(this.enableSelection){var e=j.isTouchDevice()&&this.touchMode!==true;var h=!e?"mousedown":"touchend";if(this.overlayContent){this.addHandler(this.overlayContent,a.jqx.mobile.getTouchEventName("touchend"),function(n){if(!j.enableSelection){return true}if(e){j._newScroll=new Date();if(j._newScroll-j._lastScroll<500){return true}}var q=a.jqx.mobile.getTouches(n);var r=q[0];if(r!=undefined){var l=j.host.offset();var p=parseInt(r.pageX);var o=parseInt(r.pageY);if(j.touchmode==true){p=parseInt(r._pageX);o=parseInt(r._pageY)}p=p-l.left;o=o-l.top;var m=j._hitTest(p,o);if(m!=null&&!m.isGroup){j._newScroll=new Date();if(j._newScroll-j._lastScroll<500){return false}if(j.checkboxes){j._updateItemCheck(m,m.visibleIndex);return}if(m.html.indexOf("href")!=-1){setTimeout(function(){j.selectIndex(m.visibleIndex,false,true,false,"mouse",n);j.content.trigger("click")},100)}else{j.selectIndex(m.visibleIndex,false,true,false,"mouse",n);j.content.trigger("click")}}}})}else{this.addHandler(this.content,h,function(l){if(!j.enableSelection){return true}if(e){j._newScroll=new Date();if(j._newScroll-j._lastScroll<500){return false}}j.focused=true;if(!j.isTouchDevice()){j.host.focus()}if(l.target.id!=("listBoxContent"+j.element.id)&&j.itemswrapper[0]!=l.target){var p=l.target;var v=a(p).offset();var o=j.host.offset();if(c){var m=a.jqx.mobile.getLeftPos(p);var r=a.jqx.mobile.getTopPos(p);v.left=m;v.top=r;m=a.jqx.mobile.getLeftPos(j.element);r=a.jqx.mobile.getTopPos(j.element);o.left=m;o.top=r}var q=parseInt(v.top)-parseInt(o.top);var t=parseInt(v.left)-parseInt(o.left);var u=j._hitTest(t,q);if(u!=null&&!u.isGroup){var n=function(x,w){if(!j._shiftKey){j._clickedIndex=x.visibleIndex}if(!j.checkboxes){j.selectIndex(x.visibleIndex,false,true,false,"mouse",w)}else{j.selectedIndex=x.visibleIndex;t=20+w.pageX-v.left;if(j.rtl){var y=j.hScrollBar.css("visibility")!="hidden"?j.hScrollInstance.max:j.host.width();if(t<=j.host.width()-20){j._updateItemCheck(x,x.visibleIndex)}}else{if(t+j.hScrollInstance.value>=20){j._updateItemCheck(x,x.visibleIndex)}}}};if(!u.disabled){if(u.html.indexOf("href")!=-1){setTimeout(function(){n(u,l)},100)}else{n(u,l)}}}if(h=="mousedown"){var s=false;if(l.which){s=(l.which==3)}else{if(l.button){s=(l.button==2)}}if(s){return true}return false}}return true})}this.addHandler(this.content,"mouseup",function(l){j.vScrollInstance.handlemouseup(j,l)});if(a.jqx.browser.msie){this.addHandler(this.content,"selectstart",function(l){return false})}}var d=this.isTouchDevice();if(this.enableHover&&!d){this._mousemovefunc=function(l){if(d){return true}if(!j.enableHover){return true}var n=a.jqx.browser.msie==true&&a.jqx.browser.version<9?0:1;if(l.target==null){return true}if(j.disabled){return true}j.focused=true;var p=j.vScrollInstance.isScrolling();if(!p&&l.target.id!=("listBoxContent"+j.element.id)){if(j.itemswrapper[0]!=l.target){var r=l.target;var z=a(r).offset();var q=j.host.offset();if(c){var m=a.jqx.mobile.getLeftPos(r);var t=a.jqx.mobile.getTopPos(r);z.left=m;z.top=t;m=a.jqx.mobile.getLeftPos(j.element);t=a.jqx.mobile.getTopPos(j.element);q.left=m;q.top=t}var s=parseInt(z.top)-parseInt(q.top);var u=parseInt(z.left)-parseInt(q.left);var w=j._hitTest(u,s);if(w!=null&&!w.isGroup&&!w.disabled){var o=a.data(j.element,"hoveredItem");if(o!=null){a(o).removeClass(j.toThemeProperty("jqx-listitem-state-hover"));a(o).removeClass(j.toThemeProperty("jqx-fill-state-hover"))}a.data(j.element,"hoveredItem",w.element);var v=a(w.element);v.addClass(j.toThemeProperty("jqx-listitem-state-hover"));v.addClass(j.toThemeProperty("jqx-fill-state-hover"))}}}};this.addHandler(this.content,"mousemove",this._mousemovefunc)}},_arrange:function(n){if(n==undefined){n=true}var c=null;var p=null;var k=this;var i=function(h){h=k.host.height();if(h==0){h=200;k.host.height(h)}return h};if(this.width!=null&&this.width.toString().indexOf("px")!=-1){c=this.width}else{if(this.width!=undefined&&!isNaN(this.width)){c=this.width}}if(this.height!=null&&this.height.toString().indexOf("px")!=-1){p=this.height}else{if(this.height!=undefined&&!isNaN(this.height)){p=this.height}}if(this.width!=null&&this.width.toString().indexOf("%")!=-1){this.host.css("width",this.width);c=this.host.width()}if(this.height!=null&&this.height.toString().indexOf("%")!=-1){this.host.css("height",this.height);p=i(p)}if(c!=null){c=parseInt(c);if(parseInt(this.element.style.width)!=parseInt(this.width)){this.host.width(this.width)}}if(!this.autoHeight){if(p!=null){p=parseInt(p);if(parseInt(this.element.style.height)!=parseInt(this.height)){this.host.height(this.height);i(p)}}}else{if(this.virtualSize){if(this.hScrollBar.css("visibility")!="hidden"){this.host.height(this.virtualSize.height+parseInt(this.scrollBarSize)+3);this.height=this.virtualSize.height+parseInt(this.scrollBarSize)+3;p=this.height}else{this.host.height(this.virtualSize.height);this.height=this.virtualSize.height;p=this.virtualSize.height}}}var b=this.scrollBarSize;if(isNaN(b)){b=parseInt(b);if(isNaN(b)){b="17px"}else{b=b+"px"}}b=parseInt(b);var j=4;var s=2;var l=0;if(this.vScrollBar){if(this.vScrollBar[0].style.visibility!="hidden"){l=b+j}else{this.vScrollInstance.setPosition(0)}}else{return}if(this.hScrollBar){if(this.hScrollBar[0].style.visibility!="hidden"){s=b+j}else{this.hScrollInstance.setPosition(0)}}else{return}if(this.autoItemsHeight){this.hScrollBar[0].style.visibility="hidden";s=0}if(p==null){p=0}var r=parseInt(p)-j-b;if(r<0){r=0}if(parseInt(this.hScrollBar[0].style.height)!=b){if(parseInt(b)<0){b=0}this.hScrollBar[0].style.height=parseInt(b)+"px"}if(this.hScrollBar[0].style.top!=r+"px"){this.hScrollBar[0].style.top=r+"px";this.hScrollBar[0].style.left="0px"}var q=c-b-j;if(q<0){q=0}var o=q+"px";if(this.hScrollBar[0].style.width!=o){this.hScrollBar[0].style.width=o}if(l==0){this.hScrollBar.width(c-2)}if(b!=parseInt(this.vScrollBar[0].style.width)){this.vScrollBar.width(b)}if((parseInt(p)-s)!=parseInt(this.vScrollBar[0].style.height)){this.vScrollBar.height(parseInt(p)-s+"px")}if(c==null){c=0}var d=parseInt(c)-parseInt(b)-j+"px";if(d!=this.vScrollBar[0].style.left){if(parseInt(d)>=0){this.vScrollBar[0].style.left=d}this.vScrollBar[0].style.top="0px"}var f=this.vScrollInstance;f.disabled=this.disabled;if(n){f._arrange()}var e=this.hScrollInstance;e.disabled=this.disabled;if(n){e._arrange()}if((this.vScrollBar[0].style.visibility!="hidden")&&(this.hScrollBar[0].style.visibility!="hidden")){this.bottomRight[0].style.visibility="inherit";this.bottomRight.css({left:1+parseInt(this.vScrollBar[0].style.left),top:1+parseInt(this.hScrollBar[0].style.top)});if(this.rtl){this.bottomRight.css({left:0})}this.bottomRight.width(parseInt(b)+3);this.bottomRight.height(parseInt(b)+3)}else{this.bottomRight[0].style.visibility="hidden"}if(parseInt(this.content[0].style.width)!=(parseInt(c)-l)){var m=parseInt(c)-l;this.content[0].style.width=m+"px"}if(this.rtl){this.vScrollBar.css({left:0+"px",top:"0px"});this.hScrollBar.css({left:this.vScrollBar.width()+2+"px"});if(this.vScrollBar[0].style.visibility!="hidden"){this.content.css("margin-left",4+this.vScrollBar.width())}else{this.content.css("margin-left",0);this.hScrollBar.css({left:"0px"})}}if(parseInt(this.content[0].style.height)!=(parseInt(p)-s)){var g=parseInt(p)-s;if(g<0){g=0}this.content[0].style.height=g+"px"}if(this.overlayContent){this.overlayContent.width(parseInt(c)-l);this.overlayContent.height(parseInt(p)-s)}},ensureVisible:function(e){if(isNaN(e)){var f=this.getItemByValue(e);if(f){e=f.index}}var c=this.isIndexInView(e);if(!c){if(e<0){return}if(this.autoHeight){var b=a.data(this.vScrollBar[0],"jqxScrollBar").instance;b.setPosition(0)}else{for(indx=0;indx<this.visibleItems.length;indx++){var f=this.visibleItems[indx];if(f.visibleIndex==e&&!f.isGroup){var b=a.data(this.vScrollBar[0],"jqxScrollBar").instance;var g=b.value;var d=this.hScrollBar.css("visibility")==="hidden";var h=d?0:this.scrollBarSize+4;if(f.initialTop<g){b.setPosition(f.initialTop)}else{if(f.initialTop+f.height>g+this.host.height()){b.setPosition(f.initialTop+f.height+2-this.host.height()+h)}}break}}}}this._renderItems()},scrollTo:function(c,b){if(this.vScrollBar.css("visibility")!="hidden"){this.vScrollInstance.setPosition(b)}if(this.hScrollBar.css("visibility")!="hidden"){this.hScrollInstance.setPosition(c)}},scrollDown:function(){if(this.vScrollBar.css("visibility")=="hidden"){return false}var b=this.vScrollInstance;if(b.value+b.largestep<=b.max){b.setPosition(b.value+b.largestep);return true}else{b.setPosition(b.max);return true}return false},scrollUp:function(){if(this.vScrollBar.css("visibility")=="hidden"){return false}var b=this.vScrollInstance;if(b.value-b.largestep>=b.min){b.setPosition(b.value-b.largestep);return true}else{if(b.value!=b.min){b.setPosition(b.min);return true}}return false},databind:function(h){this.records=new Array();var d=h._source?true:false;var i=new a.jqx.dataAdapter(h,{autoBind:false});if(d){i=h;h=h._source}var g=function(j){if(h.type!=undefined){i._options.type=h.type}if(h.formatdata!=undefined){i._options.formatData=h.formatdata}if(h.contenttype!=undefined){i._options.contentType=h.contenttype}if(h.async!=undefined){i._options.async=h.async}};var c=function(o,p){var r=function(s){if(typeof s==="string"){var u=s;var v=s}else{var v=s[o.valueMember];var u=s[o.displayMember]}var t=new a.jqx._jqxListBox.item();t.label=u;t.value=v;t.html="";t.visible=true;t.originalItem=s;t.group="";t.groupHtml="";t.disabled=false;t.hasThreeStates=true;return t};if(p!=undefined){var j=i._changedrecords[0];if(j){a.each(i._changedrecords,function(){var s=this.index;var t=this.record;if(p!="remove"){var u=r(t)}switch(p){case"update":o.updateAt(u,s);break;case"add":o.insertAt(u,s);break;case"remove":o.removeAt(s);break}});return}}o.records=i.records;var l=o.records.length;o.items=new Array();o.itemsByValue=new Array();for(var k=0;k<l;k++){var m=o.records[k];var n=r(m);n.index=k;o.items[k]=n;var q=n.value;if(n.value==""||n.value==null){q=k}o.itemsByValue[a.trim(q).split(" ").join("")]=n}o._render();o._raiseEvent("6")};g(this);var f=this;switch(h.datatype){case"local":case"array":default:if(h.localdata!=null){i.unbindBindingUpdate(this.element.id);i.dataBind();c(this);i.bindBindingUpdate(this.element.id,function(j){c(f,j)})}break;case"json":case"jsonp":case"xml":case"xhtml":case"script":case"text":case"csv":case"tab":if(h.localdata!=null){i.unbindBindingUpdate(this.element.id);i.dataBind();c(this);i.bindBindingUpdate(this.element.id,function(){c(f)});return}var e={};if(i._options.data){a.extend(i._options.data,e)}else{if(h.data){a.extend(e,h.data)}i._options.data=e}var b=function(){c(f)};i.unbindDownloadComplete(f.element.id);i.bindDownloadComplete(f.element.id,b);i.dataBind()}},loadItems:function(m){if(m==null){this.groups=new Array();this.items=new Array();this.visualItems=new Array();return}var s=this;var k=0;var d=0;var b=0;this.groups=new Array();this.items=new Array();this.visualItems=new Array();var e=new Array();this.itemsByValue=new Array();a.map(m,function(v){if(v==undefined){return null}var j=new a.jqx._jqxListBox.item();var w=v.group;var i=v.groupHtml;var x=v.title;if(x==null||x==undefined){x=""}if(w==null||w==undefined){w=""}if(i==null||i==undefined){i=""}if(!s.groups[w]){s.groups[w]={items:new Array(),index:-1,caption:w,captionHtml:i};k++;var t=k+"jqxGroup";s.groups[t]=s.groups[w];d++;s.groups.length=d}var u=s.groups[w];u.index++;u.items[u.index]=j;if(typeof v==="string"){j.label=v;j.value=v}else{if(v.label==null&&v.value==null&&v.html==null&&v.group==null&&v.groupHtml==null){j.label=v.toString();j.value=v.toString()}else{j.label=v.label||v.value;j.value=v.value||v.label}}if(typeof v!="string"){if(s.displayMember!=""){if(v[s.displayMember]){j.label=v[s.displayMember]}}if(s.valueMember!=""){j.value=v[s.valueMember]}}j.hasThreeStates=v.hasThreeStates!=undefined?v.hasThreeStates:true;j.originalItem=v;j.title=x;j.html=v.html||"";if(v.html&&v.html!=""){if(x&&x!=""){}}j.group=w;j.checked=v.checked||false;j.groupHtml=v.groupHtml||"";j.disabled=v.disabled||false;j.visible=v.visible!=undefined?v.visible:true;j.index=b;e[b]=j;b++;return j});var c=new Array();var o=0;if(this.fromSelect==undefined||this.fromSelect==false){for(var h=0;h<d;h++){var k=h+1;var n=k+"jqxGroup";var q=this.groups[n];if(q==undefined||q==null){break}if(h==0&&q.caption==""&&q.captionHtml==""&&d<=1){for(var g=0;g<q.items.length;g++){var p=q.items[g].value;if(q.items[g].value==""||q.items[g].value==null){p=g}this.itemsByValue[a.trim(p).split(" ").join("")]=q.items[g]}return q.items}else{var l=new a.jqx._jqxListBox.item();l.isGroup=true;l.label=q.caption;if(q.caption==""&&q.captionHtml==""){q.caption=this.emptyGroupText;l.label=q.caption}l.html=q.captionHtml;c[o]=l;o++}for(var f=0;f<q.items.length;f++){c[o]=q.items[f];var p=q.items[f].value;if(q.items[f].value==""||q.items[f].value==null){p=o}s.itemsByValue[a.trim(p).split(" ").join("")]=q.items[f];o++}}}else{var o=0;var r=new Array();a.each(e,function(){if(!r[this.group]){if(this.group!=""){var i=new a.jqx._jqxListBox.item();i.isGroup=true;i.label=this.group;c[o]=i;o++;r[this.group]=true}}c[o]=this;var j=this.value;if(this.value==""||this.value==null){j=o-1}s.itemsByValue[a.trim(j).split(" ").join("")]=this;o++})}return c},_mapItem:function(c){var b=new a.jqx._jqxListBox.item();if(this.displayMember){if(c.label==undefined){c.label=c[this.displayMember]}if(c.value==undefined){c.value=c[this.valueMember]}}if(typeof c==="string"){b.label=c;b.value=c}else{if(typeof c==="number"){b.label=c.toString();b.value=c.toString()}else{b.label=c.label||c.value;b.value=c.value||c.label}}if(b.label==undefined&&b.value==undefined&&b.html==undefined){b.label=b.value=c}b.html=c.html||"";b.group=c.group||"";b.title=c.title||"";b.groupHtml=c.groupHtml||"";b.disabled=c.disabled||false;b.visible=c.visible||true;return b},addItem:function(c){var b=this._getItemByParam(c);return this.insertAt(b,this.items?this.items.length:0)},_getItemByParam:function(c){if(c!=null){if(c.index==undefined){var b=this.getItemByValue(c);if(b){c=b}}}return c},insertItem:function(d,b){var c=this._getItemByParam(d);return this.insertAt(c,b)},updateItem:function(c,d){var b=this._getItemByParam(d);if(b&&b.index!=undefined){return this.updateAt(c,b.index)}return false},updateAt:function(d,c){if(d!=null){var b=this._mapItem(d);this.itemsByValue[a.trim(b.value).split(" ").join("")]=this.items[c];this.items[c].value=b.value;this.items[c].label=b.label;this.items[c].html=b.html;this.items[c].disabled=b.disabled}this._cachedItemHtml=[];this._renderItems();if(this.rendered){this.rendered()}},insertAt:function(l,f){if(l==null){return false}this._cachedItemHtml=[];if(this.items==undefined||this.items.length==0){this.source=new Array();this.refresh();var g=this._mapItem(l);g.index=0;this.items[this.items.length]=g;this._addItems(true);this._renderItems();if(this.rendered){this.rendered()}if(this.allowDrag&&this._enableDragDrop){this._enableDragDrop()}var k=g.value;if(g.value==""||g.value==null){k=f}this.itemsByValue[a.trim(k).split(" ").join("")]=g;return false}var g=this._mapItem(l);if(f==-1||f==undefined||f==null||f>=this.items.length){g.index=this.items.length;this.items[this.items.length]=g}else{var c=new Array();var j=0;var e=false;var h=0;for(var b=0;b<this.items.length;b++){if(this.items[b].isGroup==false){if(h>=f&&!e){c[j++]=g;g.index=f;h++;e=true}}c[j]=this.items[b];if(!this.items[b].isGroup){c[j].index=h;h++}j++}this.items=c}var k=g.value;if(g.value==""||g.value==null){k=f}this.itemsByValue[a.trim(k).split(" ").join("")]=g;this.visibleItems=new Array();this.renderedVisibleItems=new Array();var d=a.data(this.vScrollBar[0],"jqxScrollBar").instance;var i=d.value;d.setPosition(0);if((this.allowDrag&&this._enableDragDrop)||(this.virtualSize&&this.virtualSize.height<10+this.host.height())){this._addItems(true)}else{this._addItems(false)}this._renderItems();if(this.allowDrag&&this._enableDragDrop){this._enableDragDrop()}d.setPosition(i);if(this.rendered){this.rendered()}return true},removeAt:function(g){if(g<0||g>this.items.length-1){return false}var d=this.items[g].height;var k=this.items[g].value;if(k==""||k==null){k=g}this.itemsByValue[a.trim(k).split(" ").join("")]=null;this.items.splice(g,1);var c=new Array();var j=0;var f=false;var h=0;for(var b=0;b<this.items.length;b++){c[j]=this.items[b];if(!this.items[b].isGroup){c[j].index=h;h++}j++}this.items=c;var e=a.data(this.vScrollBar[0],"jqxScrollBar").instance;var e=a.data(this.vScrollBar[0],"jqxScrollBar").instance;var i=e.value;e.setPosition(0);this.visibleItems=new Array();this.renderedVisibleItems=new Array();if(this.items.length>0){if(this.virtualSize){this.virtualSize.height-=d;var l=this.virtualSize.itemsPerPage*2;if(this.autoHeight){l=this.items.length}this.virtualItemsCount=Math.min(l,this.items.length)}this._updatescrollbars()}else{this._addItems()}this._renderItems();if(this.allowDrag&&this._enableDragDrop){this._enableDragDrop()}if(this.vScrollBar.css("visibility")!="hidden"){e.setPosition(i)}else{e.setPosition(0)}if(this.rendered){this.rendered()}return true},removeItem:function(c){var b=this._getItemByParam(c);this.removeAt(b.index)},getItems:function(){return this.items},disableItem:function(c){var b=this._getItemByParam(c);this.disableAt(b.index)},enableItem:function(c){var b=this._getItemByParam(c);this.enableAt(b.index)},disableAt:function(b){if(!this.items){return false}if(b<0||b>this.items.length-1){return false}this.items[b].disabled=true;this._renderItems();return true},enableAt:function(b){if(!this.items){return false}if(b<0||b>this.items.length-1){return false}this.items[b].disabled=false;this._renderItems();return true},destroy:function(){if(this.source&&this.source.unbindBindingUpdate){this.source.unbindBindingUpdate(this.element.id)}this._removeHandlers();this.vScrollBar.jqxScrollBar("destroy");this.hScrollBar.jqxScrollBar("destroy");this.vScrollBar.remove();this.hScrollBar.remove();this.content.remove();a.jqx.utilities.resize(this.host,null,true);var b=a.data(this.element,"jqxListBox");delete this.hScrollInstance;delete this.vScrollInstance;delete this.vScrollBar;delete this.hScrollBar;delete this.content;delete this.bottomRight;delete this.itemswrapper;delete this.visualItems;delete this.visibleItems;delete this.items;delete this.groups;delete this.renderedVisibleItems;delete this._mousewheelfunc;delete this._mousemovefunc;delete this._cachedItemHtml;delete this.itemsByValue;delete this.source;delete this.events;if(this.input){this.input.remove();delete this.input}if(b){delete b.instance}this.host.removeData();this.host.removeClass();this.host.remove();this.element=null;delete this.element;this.host=null;delete this.set;delete this.get;delete this.call;delete this.host},_raiseEvent:function(f,c){if(this._stopEvents==true){return true}if(c==undefined){c={owner:null}}var d=this.events[f];args=c;args.owner=this;this._updateInputSelection();var e=new jQuery.Event(d);e.owner=this;e.args=args;if(this.host!=null){var b=this.host.trigger(e)}return b}})})(jQuery);(function(a){a.jqx._jqxListBox.item=function(){var b={group:"",groupHtml:"",selected:false,isGroup:false,highlighted:false,value:null,label:"",html:null,visible:true,disabled:false,element:null,width:null,height:null,initialTop:null,top:null,left:null,title:"",index:-1,checkBoxElement:null,originalItem:null,checked:false,visibleIndex:-1};return b}})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.jqxWidget("jqxDropDownList","",{});a.extend(a.jqx._jqxDropDownList.prototype,{defineInstance:function(){this.disabled=false;this.width=null;this.height=null;this.items=new Array();this.selectedIndex=-1;this.source=null;this.scrollBarSize=15;this.arrowSize=19;this.enableHover=true;this.enableSelection=true;this.visualItems=new Array();this.groups=new Array();this.equalItemsWidth=true;this.itemHeight=-1;this.visibleItems=new Array();this.emptyGroupText="Group";this.checkboxes=false;if(this.openDelay==undefined){this.openDelay=250}if(this.closeDelay==undefined){this.closeDelay=300}this.animationType="default";this.autoOpen=false;this.dropDownWidth="auto";this.dropDownHeight="200px";this.autoDropDownHeight=false;this.keyboardSelection=true;this.enableBrowserBoundsDetection=false;this.dropDownHorizontalAlignment="left";this.displayMember="";this.valueMember="";this.searchMode="startswithignorecase";this.incrementalSearch=true;this.incrementalSearchDelay=700;this.renderer=null;this.placeHolder="Please Choose:";this.promptText="Please Choose:";this.emptyString="";this.rtl=false;this.selectionRenderer=null;this.listBox=null;this.popupZIndex=9999999999999;this.renderMode="default";this.touchMode="auto";this.aria={"aria-disabled":{name:"disabled",type:"boolean"}};this.events=["open","close","select","unselect","change","checkChange","bindingComplete"]},createInstance:function(b){this.render()},render:function(){if(!this.width){this.width=200}if(!this.height){this.height=25}this.element.innerHTML="";this.isanimating=false;this.id=this.element.id||a.jqx.utilities.createId();this.host.attr("role","combobox");a.jqx.aria(this,"aria-autocomplete","both");a.jqx.aria(this,"aria-readonly",false);var d=a("<div tabIndex=0 style='background-color: transparent; -webkit-appearance: none; outline: none; width:100%; height: 100%; padding: 0px; margin: 0px; border: 0px; position: relative;'><div id='dropdownlistWrapper' style='outline: none; background-color: transparent; border: none; float: left; width:100%; height: 100%; position: relative;'><div id='dropdownlistContent' style='outline: none; background-color: transparent; border: none; float: left; position: relative;'/><div id='dropdownlistArrow' style='background-color: transparent; border: none; float: right; position: relative;'><div></div></div></div></div>");this._addInput();if(a.jqx._jqxListBox==null||a.jqx._jqxListBox==undefined){throw new Error("jqxDropDownList: Missing reference to jqxlistbox.js.")}var h=this;this.touch=a.jqx.mobile.isTouchDevice();this.comboStructure=d;this.host.append(d);this.dropdownlistWrapper=this.host.find("#dropdownlistWrapper");this.dropdownlistArrow=this.host.find("#dropdownlistArrow");this.arrow=a(this.dropdownlistArrow.children()[0]);this.dropdownlistContent=this.host.find("#dropdownlistContent");this.dropdownlistContent.addClass(this.toThemeProperty("jqx-dropdownlist-content"));this.dropdownlistWrapper.addClass(this.toThemeProperty("jqx-disableselect"));if(this.rtl){this.dropdownlistContent.addClass(this.toThemeProperty("jqx-rtl"));this.dropdownlistContent.addClass(this.toThemeProperty("jqx-dropdownlist-content-rtl"))}this.addHandler(this.dropdownlistWrapper,"selectstart",function(){return false});this.dropdownlistWrapper[0].id="dropdownlistWrapper"+this.element.id;this.dropdownlistArrow[0].id="dropdownlistArrow"+this.element.id;this.dropdownlistContent[0].id="dropdownlistContent"+this.element.id;if(this.promptText!="Please Choose:"){this.placeHolder=this.promptText}var j=this.toThemeProperty("jqx-widget")+" "+this.toThemeProperty("jqx-dropdownlist-state-normal")+" "+this.toThemeProperty("jqx-rc-all")+" "+this.toThemeProperty("jqx-fill-state-normal");this.element.className+=" "+j;this._firstDiv=this.host.find("div:first");try{var k="listBox"+this.id;var f=a(a.find("#"+k));if(f.length>0){f.remove()}a.jqx.aria(this,"aria-owns",k);a.jqx.aria(this,"aria-haspopup",true);var b=a("<div style='overflow: hidden; background-color: transparent; border: none; position: absolute;' id='listBox"+this.id+"'><div id='innerListBox"+this.id+"'></div></div>");b.hide();b.appendTo(document.body);this.container=b;this.listBoxContainer=a(a.find("#innerListBox"+this.id));var c=this.width;if(this.dropDownWidth!="auto"){c=this.dropDownWidth}if(c==null){c=this.host.width();if(c==0){c=this.dropDownWidth}}if(this.dropDownHeight==null){this.dropDownHeight=200}var h=this;this.container.width(parseInt(c)+25);this.container.height(parseInt(this.dropDownHeight)+25);this.addHandler(this.listBoxContainer,"bindingComplete",function(e){h._raiseEvent("6")});this.listBoxContainer.jqxListBox({_checkForHiddenParent:false,touchMode:this.touchMode,checkboxes:this.checkboxes,rtl:this.rtl,emptyString:this.emptyString,itemHeight:this.itemHeight,width:c,searchMode:this.searchMode,incrementalSearch:this.incrementalSearch,incrementalSearchDelay:this.incrementalSearchDelay,displayMember:this.displayMember,valueMember:this.valueMember,height:this.dropDownHeight,autoHeight:this.autoDropDownHeight,scrollBarSize:this.scrollBarSize,selectedIndex:this.selectedIndex,source:this.source,theme:this.theme,rendered:function(){if(h.selectedIndex!=h.listBoxContainer.jqxListBox("selectedIndex")){h.listBox=a.data(h.listBoxContainer[0],"jqxListBox").instance;h.listBoxContainer.jqxListBox({selectedIndex:h.selectedIndex});h.renderSelection("mouse")}else{h.renderSelection("mouse")}},renderer:this.renderer});this.listBoxContainer.css({position:"absolute",zIndex:this.popupZIndex,top:0,left:0});this.listBox=a.data(this.listBoxContainer[0],"jqxListBox").instance;this.listBox.enableSelection=this.enableSelection;this.listBox.enableHover=this.enableHover;this.listBox.equalItemsWidth=this.equalItemsWidth;this.listBox.selectIndex(this.selectedIndex);this.listBox._arrange();this.listBoxContainer.addClass(this.toThemeProperty("jqx-popup"));if(a.jqx.browser.msie){this.listBoxContainer.addClass(this.toThemeProperty("jqx-noshadow"))}this.addHandler(this.listBoxContainer,"unselect",function(e){h._raiseEvent("3",{index:e.args.index,type:e.args.type,item:e.args.item})});this.addHandler(this.listBoxContainer,"change",function(e){h._raiseEvent("4",{index:e.args.index,type:e.args.type,item:e.args.item})});if(this.animationType=="none"){this.container.css("display","none")}else{this.container.hide()}}catch(g){}var l=this;this.propertyChangeMap.disabled=function(e,n,m,o){if(o){e.host.addClass(l.toThemeProperty("jqx-dropdownlist-state-disabled"));e.host.addClass(l.toThemeProperty("jqx-fill-state-disabled"));e.dropdownlistContent.addClass(l.toThemeProperty("jqx-dropdownlist-content-disabled"))}else{e.host.removeClass(l.toThemeProperty("jqx-dropdownlist-state-disabled"));e.host.removeClass(l.toThemeProperty("jqx-fill-state-disabled"));e.dropdownlistContent.removeClass(l.toThemeProperty("jqx-dropdownlist-content-disabled"))}a.jqx.aria(e,"aria-disabled",e.disabled)};if(this.disabled){this.host.addClass(this.toThemeProperty("jqx-dropdownlist-state-disabled"));this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"));this.dropdownlistContent.addClass(this.toThemeProperty("jqx-dropdownlist-content-disabled"))}this.arrow.addClass(this.toThemeProperty("jqx-icon-arrow-down"));this.arrow.addClass(this.toThemeProperty("jqx-icon"));if(this.renderMode==="simple"){this.arrow.remove();this.host.removeClass(this.toThemeProperty("jqx-fill-state-normal"));this.host.removeClass(this.toThemeProperty("jqx-rc-all"))}this._updateHandlers();this._setSize();this._arrange();if(this.listBox){this.renderSelection()}if(a.jqx.browser.msie&&a.jqx.browser.version<8){if(this.host.parents(".jqx-window").length>0){var i=this.host.parents(".jqx-window").css("z-index");b.css("z-index",i+10);this.listBoxContainer.css("z-index",i+10)}}},val:function(c){if(!this.dropdownlistContent){return""}if(this.input&&arguments.length==0){return this.input.val()}var b=this.getItemByValue(c);if(b!=null){this.selectItem(b)}if(this.input){return this.input.val()}},focus:function(){try{var d=this;var c=function(){d.host.focus();if(d._firstDiv){d._firstDiv.focus()}};c();setTimeout(function(){c()},10)}catch(b){}},_addInput:function(){var b=this.host.attr("name");if(!b){b=this.element.id}this.input=a("<input type='hidden'/>");this.host.append(this.input);this.input.attr("name",b)},getItems:function(){if(!this.listBox){return new Array()}return this.listBox.items},getVisibleItems:function(){return this.listBox.getVisibleItems()},_setSize:function(){if(this.width!=null&&this.width.toString().indexOf("px")!=-1){this.host.width(this.width)}else{if(this.width!=undefined&&!isNaN(this.width)){this.host.width(this.width)}}if(this.height!=null&&this.height.toString().indexOf("px")!=-1){this.host.height(this.height)}else{if(this.height!=undefined&&!isNaN(this.height)){this.host.height(this.height)}}var e=false;if(this.width!=null&&this.width.toString().indexOf("%")!=-1){e=true;this.host.width(this.width)}if(this.height!=null&&this.height.toString().indexOf("%")!=-1){e=true;this.host.height(this.height)}var c=this;var d=function(){c._arrange();if(c.dropDownWidth=="auto"){var f=c.host.width();c.listBoxContainer.jqxListBox({width:f});c.container.width(parseInt(f)+25)}};if(e){var b=this.host.width();if(this.dropDownWidth!="auto"){b=this.dropDownWidth}this.listBoxContainer.jqxListBox({width:b});this.container.width(parseInt(b)+25)}a.jqx.utilities.resize(this.host,function(){d()})},isOpened:function(){var c=this;var b=a.data(document.body,"openedJQXListBox"+this.id);if(b!=null&&b==c.listBoxContainer){return true}return false},_updateHandlers:function(){var c=this;var d=false;this.removeHandlers();if(!this.touch){this.addHandler(this.host,"mouseenter",function(){if(!c.disabled&&c.enableHover&&c.renderMode!=="simple"){d=true;c.host.addClass(c.toThemeProperty("jqx-dropdownlist-state-hover"));c.arrow.addClass(c.toThemeProperty("jqx-icon-arrow-down-hover"));c.host.addClass(c.toThemeProperty("jqx-fill-state-hover"))}});this.addHandler(this.host,"mouseleave",function(){if(!c.disabled&&c.enableHover&&c.renderMode!=="simple"){c.host.removeClass(c.toThemeProperty("jqx-dropdownlist-state-hover"));c.host.removeClass(c.toThemeProperty("jqx-fill-state-hover"));c.arrow.removeClass(c.toThemeProperty("jqx-icon-arrow-down-hover"));d=false}})}if(this.host.parents()){this.addHandler(this.host.parents(),"scroll.dropdownlist"+this.element.id,function(e){var f=c.isOpened();if(f){c.close()}})}var b="mousedown";if(this.touch){b=a.jqx.mobile.getTouchEventName("touchstart")}this.addHandler(this.dropdownlistWrapper,b,function(f){if(!c.disabled){var e=c.container.css("display")=="block";if(!c.isanimating){if(e){c.hideListBox();return false}else{c.showListBox()}}}});if(c.autoOpen){this.addHandler(this.host,"mouseenter",function(){var e=c.isOpened();if(!e&&c.autoOpen){c.open();c.host.focus()}});a(document).on("mousemove."+c.id,function(h){var g=c.isOpened();if(g&&c.autoOpen){var l=c.host.coord();var k=l.top;var j=l.left;var i=c.container.coord();var e=i.left;var f=i.top;canClose=true;if(h.pageY>=k&&h.pageY<=k+c.host.height()){if(h.pageX>=j&&h.pageX<j+c.host.width()){canClose=false}}if(h.pageY>=f&&h.pageY<=f+c.container.height()){if(h.pageX>=e&&h.pageX<e+c.container.width()){canClose=false}}if(canClose){c.close()}}})}if(this.touch){this.addHandler(a(document),a.jqx.mobile.getTouchEventName("touchstart")+"."+this.id,c.closeOpenedListBox,{me:this,listbox:this.listBox,id:this.id})}else{this.addHandler(a(document),"mousedown."+this.id,c.closeOpenedListBox,{me:this,listbox:this.listBox,id:this.id})}this.addHandler(this.host,"keydown",function(f){var e=c.container.css("display")=="block";if(c.host.css("display")=="none"){return true}if(f.keyCode=="13"||f.keyCode=="9"){if(!c.isanimating){if(e){c.renderSelection();if(f.keyCode=="13"){c._firstDiv.focus()}c.hideListBox();if(!c.keyboardSelection){c._raiseEvent("2",{index:c.selectedIndex,type:"keyboard",item:c.getItem(c.selectedIndex)})}}if(e&&f.keyCode!="9"){return false}return true}}if(f.keyCode==115){if(!c.isanimating){if(!c.isOpened()){c.showListBox()}else{if(c.isOpened()){c.hideListBox()}}}return false}if(f.altKey){if(c.host.css("display")=="block"){if(f.keyCode==38){if(c.isOpened()){c.hideListBox();return true}}else{if(f.keyCode==40){if(!c.isOpened()){c.showListBox();return true}}}}}if(f.keyCode=="27"){if(!c.ishiding){c.hideListBox();if(c.tempSelectedIndex!=undefined){c.selectIndex(c.tempSelectedIndex)}return false}}if(!c.disabled){return c.listBox._handleKeyDown(f)}});this.addHandler(this.listBoxContainer,"checkChange",function(e){c.renderSelection();c._updateInputSelection();c._raiseEvent(5,{label:e.args.label,value:e.args.value,checked:e.args.checked,item:e.args.item})});this.addHandler(this.listBoxContainer,"select",function(e){if(!c.disabled){if(e.args.type=="keyboard"&&!c.isOpened()){c.renderSelection()}if(e.args.type!="keyboard"||c.keyboardSelection){c.renderSelection();c._raiseEvent("2",{index:e.args.index,type:e.args.type,item:e.args.item,originalEvent:e.args.originalEvent});if(e.args.type=="mouse"){if(!c.checkboxes){c.hideListBox();if(c._firstDiv){c._firstDiv.focus()}}}}}});if(this.listBox){if(this.listBox.content){this.addHandler(this.listBox.content,"click",function(e){if(!c.disabled){if(c.listBox.itemswrapper&&e.target===c.listBox.itemswrapper[0]){return true}c.renderSelection("mouse");if(!c.touch){if(!c.ishiding){if(!c.checkboxes){c.hideListBox();if(c._firstDiv){c._firstDiv.focus()}}}}if(!c.keyboardSelection){if(c._oldSelectedInd==undefined){c._oldSelectedIndx=c.selectedIndex}if(c.selectedIndex!=c._oldSelectedIndx){c._raiseEvent("2",{index:c.selectedIndex,type:"keyboard",item:c.getItem(c.selectedIndex)});c._oldSelectedIndx=c.selectedIndex}}}})}}this.addHandler(this.host,"focus",function(e){if(c.renderMode!=="simple"){c.host.addClass(c.toThemeProperty("jqx-dropdownlist-state-focus"));c.host.addClass(c.toThemeProperty("jqx-fill-state-focus"))}});this.addHandler(this.host,"blur",function(){if(c.renderMode!=="simple"){c.host.removeClass(c.toThemeProperty("jqx-dropdownlist-state-focus"));c.host.removeClass(c.toThemeProperty("jqx-fill-state-focus"))}});this.addHandler(this._firstDiv,"focus",function(e){if(c.renderMode!=="simple"){c.host.addClass(c.toThemeProperty("jqx-dropdownlist-state-focus"));c.host.addClass(c.toThemeProperty("jqx-fill-state-focus"))}});this.addHandler(this._firstDiv,"blur",function(){if(c.renderMode!=="simple"){c.host.removeClass(c.toThemeProperty("jqx-dropdownlist-state-focus"));c.host.removeClass(c.toThemeProperty("jqx-fill-state-focus"))}})},removeHandlers:function(){var c=this;var b="mousedown";if(this.touch){b=a.jqx.mobile.getTouchEventName("touchstart")}this.removeHandler(this.dropdownlistWrapper,b);if(this.listBox){if(this.listBox.content){this.removeHandler(this.listBox.content,"click")}}this.removeHandler(this.host,"loadContent");this.removeHandler(this.listBoxContainer,"checkChange");this.removeHandler(this.host,"keydown");this.removeHandler(this.host,"focus");this.removeHandler(this.host,"blur");this.removeHandler(this._firstDiv,"focus");this.removeHandler(this._firstDiv,"blur");this.removeHandler(this.host,"mouseenter");this.removeHandler(this.host,"mouseleave");this.removeHandler(a(document),"mousemove."+c.id)},getItem:function(b){var c=this.listBox.getItem(b);return c},getItemByValue:function(c){var b=this.listBox.getItemByValue(c);return b},selectItem:function(b){if(this.listBox!=undefined){this.listBox.selectItem(b);this.selectedIndex=this.listBox.selectedIndex;this.renderSelection("mouse")}},unselectItem:function(b){if(this.listBox!=undefined){this.listBox.unselectItem(b);this.renderSelection("mouse")}},checkItem:function(b){if(this.listBox!=undefined){this.listBox.checkItem(b)}},uncheckItem:function(b){if(this.listBox!=undefined){this.listBox.uncheckItem(b)}},indeteterminateItem:function(b){if(this.listBox!=undefined){this.listBox.indeteterminateItem(b)}},renderSelection:function(){if(this.listBox==null){return}var q=this.listBox.visibleItems[this.listBox.selectedIndex];var n=this;if(this.checkboxes){var h=this.getCheckedItems();if(h!=null&&h.length>0){q=h[0]}else{q=null}}if(q==null){var d=a('<span style="color: inherit; border: none; background-color: transparent;"></span>');d.appendTo(a(document.body));d.addClass(this.toThemeProperty("jqx-widget"));d.addClass(this.toThemeProperty("jqx-listitem-state-normal"));d.addClass(this.toThemeProperty("jqx-item"));a.jqx.utilities.html(d,this.placeHolder);var c=this.dropdownlistContent.css("padding-top");var r=this.dropdownlistContent.css("padding-bottom");d.css("padding-top",c);d.css("padding-bottom",r);var b=d.outerHeight();d.remove();d.removeClass();a.jqx.utilities.html(this.dropdownlistContent,d);var p=this.host.height();if(this.height!=null&&this.height!=undefined){p=parseInt(this.height)}var o=parseInt((parseInt(p)-parseInt(b))/2);if(o>0){this.dropdownlistContent.css("margin-top",o+"px");this.dropdownlistContent.css("margin-bottom",o+"px")}if(this.selectionRenderer){a.jqx.utilities.html(this.dropdownlistContent,this.selectionRenderer());this._updateInputSelection()}this.selectedIndex=this.listBox.selectedIndex;if(this.width==="auto"){this._arrange()}return}this.selectedIndex=this.listBox.selectedIndex;var d=a('<span style="color: inherit; border: none; background-color: transparent;"></span>');d.appendTo(a(document.body));d.addClass(this.toThemeProperty("jqx-widget"));d.addClass(this.toThemeProperty("jqx-listitem-state-normal"));d.addClass(this.toThemeProperty("jqx-item"));var e=false;try{if(q.html!=undefined&&q.html!=null&&q.html.toString().length>0){a.jqx.utilities.html(d,q.html)}else{if(q.label!=undefined&&q.label!=null&&q.label.toString().length>0){a.jqx.utilities.html(d,q.label)}else{if(q.value!=undefined&&q.value!=null&&q.value.toString().length>0){a.jqx.utilities.html(d,q.value)}else{if(q.title!=undefined&&q.title!=null&&q.title.toString().length>0){a.jqx.utilities.html(d,q.title)}else{if(q.label==""||q.label==null){e=true;a.jqx.utilities.html(d,"Item")}}}}}}catch(m){var j=m}var c=this.dropdownlistContent.css("padding-top");var r=this.dropdownlistContent.css("padding-bottom");d.css("padding-top",c);d.css("padding-bottom",r);var b=d.outerHeight();if(b===0){b=16}if((q.label==""||q.label==null)&&e){a.jqx.utilities.html(d,"")}var g=this.width&&this.width.toString().indexOf("%")<=0;d.remove();d.removeClass();if(this.selectionRenderer){a.jqx.utilities.html(this.dropdownlistContent,this.selectionRenderer(d,q.index,q.label,q.value))}else{if(this.checkboxes){var k=this.getCheckedItems();var l="";for(var f=0;f<k.length;f++){if(f==k.length-1){l+=k[f].label}else{l+=k[f].label+","}}d.text(l);if(g){d.css("max-width",this.host.width()-30)}d.css("overflow","hidden");d.css("display","block");if(!this.rtl){if(g){d.css("width",this.host.width()-30)}}d.css("text-overflow","ellipsis");this.dropdownlistContent.html(d)}else{if(this.width&&this.width!=="auto"){if(g){if(!this.rtl){d.css("max-width",this.host.width()-10)}}d.css("overflow","hidden");d.css("display","block");if(!this.rtl){if(g){d.css("width",this.host.width()-10)}}d.css("text-overflow","ellipsis")}this.dropdownlistContent.html(d)}}var p=this.host.height();if(this.height!=null&&this.height!=undefined){p=parseInt(this.height)}var o=parseInt((parseInt(p)-parseInt(b))/2);if(o>0){this.dropdownlistContent.css("margin-top",o+"px");this.dropdownlistContent.css("margin-bottom",o+"px")}if(this.dropdownlistContent&&this.input){this._updateInputSelection()}if(this.listBox&&this.listBox._activeElement){a.jqx.aria(this,"aria-activedescendant",this.listBox._activeElement.id)}if(this.width==="auto"){this._arrange()}},_updateInputSelection:function(){if(this.input){if(this.selectedIndex==-1){this.input.val("")}else{var e=this.getSelectedItem();if(e!=null){this.input.val(e.value)}else{this.input.val(this.dropdownlistContent.text())}}if(this.checkboxes){var b=this.getCheckedItems();var f="";if(b!=null){for(var c=0;c<b.length;c++){var d=b[c].value;if(d==undefined){continue}if(c==b.length-1){f+=d}else{f+=d+","}}}this.input.val(f)}}},setContent:function(b){a.jqx.utilities.html(this.dropdownlistContent,b);this._updateInputSelection()},dataBind:function(){this.listBoxContainer.jqxListBox({source:this.source});this.renderSelection("mouse");if(this.source==null){this.clearSelection()}},clear:function(){this.listBoxContainer.jqxListBox({source:null});this.clearSelection()},clearSelection:function(b){this.selectedIndex=-1;this._updateInputSelection();this.listBox.clearSelection();this.renderSelection();a.jqx.utilities.html(this.dropdownlistContent,this.placeHolder)},unselectIndex:function(b,c){if(isNaN(b)){return}this.listBox.unselectIndex(b,c);this.renderSelection()},selectIndex:function(b,d,e,c){this.listBox.selectIndex(b,d,e,c,"api")},getSelectedIndex:function(){return this.selectedIndex},getSelectedItem:function(){return this.getItem(this.selectedIndex)},getCheckedItems:function(){return this.listBox.getCheckedItems()},checkIndex:function(b){this.listBox.checkIndex(b)},uncheckIndex:function(b){this.listBox.uncheckIndex(b)},indeterminateIndex:function(b){this.listBox.indeterminateIndex(b)},checkAll:function(){this.listBox.checkAll()},uncheckAll:function(){this.listBox.uncheckAll()},addItem:function(b){return this.listBox.addItem(b)},insertAt:function(c,b){if(c==null){return false}return this.listBox.insertAt(c,b)},removeAt:function(c){var b=this.listBox.removeAt(c);this.renderSelection("mouse");return b},removeItem:function(c){var b=this.listBox.removeItem(c);this.renderSelection("mouse");return b},updateItem:function(c,d){var b=this.listBox.updateItem(c,d);this.renderSelection("mouse");return b},updateAt:function(d,c){var b=this.listBox.updateAt(d,c);this.renderSelection("mouse");return b},ensureVisible:function(b){return this.listBox.ensureVisible(b)},disableAt:function(b){return this.listBox.disableAt(b)},enableAt:function(b){return this.listBox.enableAt(b)},disableItem:function(b){return this.listBox.disableItem(b)},enableItem:function(b){return this.listBox.enableItem(b)},_findPos:function(c){while(c&&(c.type=="hidden"||c.nodeType!=1||a.expr.filters.hidden(c))){c=c.nextSibling}var b=a(c).coord(true);return[b.left,b.top]},testOffset:function(h,f,c){var g=h.outerWidth();var j=h.outerHeight();var i=a(window).width()+a(window).scrollLeft();var e=a(window).height()+a(window).scrollTop();if(f.left+g>i){if(g>this.host.width()){var d=this.host.coord().left;var b=g-this.host.width();f.left=d-b+2}}if(f.left<0){f.left=parseInt(this.host.coord().left)+"px"}f.top-=Math.min(f.top,(f.top+j>e&&e>j)?Math.abs(j+c+22):0);return f},open:function(){this.showListBox()},close:function(){this.hideListBox()},_getBodyOffset:function(){var c=0;var b=0;if(a("body").css("border-top-width")!="0px"){c=parseInt(a("body").css("border-top-width"));if(isNaN(c)){c=0}}if(a("body").css("border-left-width")!="0px"){b=parseInt(a("body").css("border-left-width"));if(isNaN(b)){b=0}}return{left:b,top:c}},showListBox:function(){a.jqx.aria(this,"aria-expanded",true);if(this.dropDownWidth=="auto"&&this.width!=null&&this.width.indexOf&&this.width.indexOf("%")!=-1){if(this.listBox.host.width()!=this.host.width()){var c=this.host.width();this.listBoxContainer.jqxListBox({width:c});this.container.width(parseInt(c)+25)}}var q=this;var e=this.listBoxContainer;var k=this.listBox;var n=a(window).scrollTop();var i=a(window).scrollLeft();var l=parseInt(this._findPos(this.host[0])[1])+parseInt(this.host.outerHeight())-1+"px";var g,h=parseInt(Math.round(this.host.coord(true).left));g=h+"px";var p=a.jqx.mobile.isSafariMobileBrowser()||a.jqx.mobile.isWindowsPhone();if(this.listBox==null){return}var d=a.jqx.utilities.hasTransform(this.host);this.ishiding=false;if(!this.keyboardSelection){this.listBox.selectIndex(this.selectedIndex);this.listBox.ensureVisible(this.selectedIndex)}this.tempSelectedIndex=this.selectedIndex;if(this.autoDropDownHeight){this.container.height(this.listBoxContainer.height()+25)}if(d||(p!=null&&p)){g=a.jqx.mobile.getLeftPos(this.element);l=a.jqx.mobile.getTopPos(this.element)+parseInt(this.host.outerHeight());if(a("body").css("border-top-width")!="0px"){l=parseInt(l)-this._getBodyOffset().top+"px"}if(a("body").css("border-left-width")!="0px"){g=parseInt(g)-this._getBodyOffset().left+"px"}}e.stop();if(this.renderMode!=="simple"){this.host.addClass(this.toThemeProperty("jqx-dropdownlist-state-selected"));this.host.addClass(this.toThemeProperty("jqx-fill-state-pressed"));this.arrow.addClass(this.toThemeProperty("jqx-icon-arrow-down-selected"))}this.container.css("left",g);this.container.css("top",l);k._arrange();var f=true;var r=false;if(this.dropDownHorizontalAlignment=="right"||this.rtl){var m=this.container.outerWidth();var b=Math.abs(m-this.host.width());if(m>this.host.width()){this.container.css("left",25+parseInt(Math.round(h))-b+"px")}else{this.container.css("left",25+parseInt(Math.round(h))+b+"px")}}if(this.enableBrowserBoundsDetection){var j=this.testOffset(e,{left:parseInt(this.container.css("left")),top:parseInt(l)},parseInt(this.host.outerHeight()));if(parseInt(this.container.css("top"))!=j.top){r=true;e.css("top",23)}else{e.css("top",0)}this.container.css("top",j.top);if(parseInt(this.container.css("left"))!=j.left){this.container.css("left",j.left)}}if(this.animationType=="none"){this.container.css("display","block");a.data(document.body,"openedJQXListBoxParent",q);a.data(document.body,"openedJQXListBox"+this.id,e);e.css("margin-top",0);e.css("opacity",1)}else{this.container.css("display","block");q.isanimating=true;if(this.animationType=="fade"){e.css("margin-top",0);e.css("opacity",0);e.animate({opacity:1},this.openDelay,function(){a.data(document.body,"openedJQXListBoxParent",q);a.data(document.body,"openedJQXListBox"+q.id,e);q.ishiding=false;q.isanimating=false})}else{e.css("opacity",1);var o=e.outerHeight();if(r){e.css("margin-top",o)}else{e.css("margin-top",-o)}e.animate({"margin-top":0},this.openDelay,function(){a.data(document.body,"openedJQXListBoxParent",q);a.data(document.body,"openedJQXListBox"+q.id,e);q.ishiding=false;q.isanimating=false})}}if(!r){this.host.addClass(this.toThemeProperty("jqx-rc-b-expanded"));e.addClass(this.toThemeProperty("jqx-rc-t-expanded"))}else{this.host.addClass(this.toThemeProperty("jqx-rc-t-expanded"));e.addClass(this.toThemeProperty("jqx-rc-b-expanded"))}if(this.renderMode!=="simple"){e.addClass(this.toThemeProperty("jqx-fill-state-focus"));this.host.addClass(this.toThemeProperty("jqx-dropdownlist-state-focus"));this.host.addClass(this.toThemeProperty("jqx-fill-state-focus"))}this.host.focus();setTimeout(function(){q.host.focus()});k._renderItems();this._raiseEvent("0",k)},hideListBox:function(){a.jqx.aria(this,"aria-expanded",false);var f=this.listBoxContainer;var g=this.listBox;var c=this.container;var d=this;a.data(document.body,"openedJQXListBox"+this.id,null);if(this.animationType=="none"){this.container.css("display","none")}else{if(!d.ishiding){f.stop();var b=f.outerHeight();f.css("margin-top",0);d.isanimating=true;var e=-b;if(parseInt(this.container.coord().top)<parseInt(this.host.coord().top)){e=b}if(this.animationType=="fade"){f.css({opacity:1});f.animate({opacity:0},this.closeDelay,function(){c.css("display","none");d.isanimating=false;d.ishiding=false})}else{f.animate({"margin-top":e},this.closeDelay,function(){c.css("display","none");d.isanimating=false;d.ishiding=false})}}}this.ishiding=true;this.host.removeClass(this.toThemeProperty("jqx-dropdownlist-state-selected"));this.host.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));this.arrow.removeClass(this.toThemeProperty("jqx-icon-arrow-down-selected"));this.host.removeClass(this.toThemeProperty("jqx-rc-b-expanded"));f.removeClass(this.toThemeProperty("jqx-rc-t-expanded"));this.host.removeClass(this.toThemeProperty("jqx-rc-t-expanded"));f.removeClass(this.toThemeProperty("jqx-rc-b-expanded"));f.removeClass(this.toThemeProperty("jqx-fill-state-focus"));this._raiseEvent("1",g)},closeOpenedListBox:function(e){var d=e.data.me;var b=a(e.target);var c=e.data.listbox;if(c==null){return true}if(a(e.target).ischildof(e.data.me.host)){return true}if(!d.isOpened()){return true}var f=d;var g=false;a.each(b.parents(),function(){if(this.className!="undefined"){if(this.className.indexOf){if(this.className.indexOf("jqx-listbox")!=-1){g=true;return false}if(this.className.indexOf("jqx-dropdownlist")!=-1){if(d.element.id==this.id){g=true}return false}}}});if(c!=null&&!g&&d.isOpened()){d.hideListBox()}return true},loadFromSelect:function(b){this.listBox.loadFromSelect(b)},refresh:function(b){if(b!==true){this._setSize();this._arrange();if(this.listBox){this.renderSelection()}}},_arrange:function(){var f=parseInt(this.host.width());var b=parseInt(this.host.height());var e=this.arrowSize;var d=this.arrowSize;var g=3;var c=f-d-2*g;if(c>0&&this.width!=="auto"){this.dropdownlistContent.width(c+"px")}if(this.width==="auto"){f=this.dropdownlistContent.width()+d+2*g;this.host.width(f)}this.dropdownlistContent.height(b);this.dropdownlistContent.css("left",0);this.dropdownlistContent.css("top",0);this.dropdownlistArrow.width(d);this.dropdownlistArrow.height(b);if(this.rtl){this.dropdownlistArrow.css("float","left");this.dropdownlistContent.css("float","right")}},destroy:function(){a.jqx.utilities.resize(this.host,null,true);this.removeHandler(this.listBoxContainer,"select");this.removeHandler(this.listBoxContainer,"unselect");this.removeHandler(this.listBoxContainer,"change");this.removeHandler(this.dropdownlistWrapper,"selectstart");this.removeHandler(this.dropdownlistWrapper,"mousedown");this.removeHandler(this.host,"keydown");this.removeHandler(this.listBoxContainer,"select");this.removeHandler(this.listBox.content,"click");this.removeHandler(this.listBoxContainer,"bindingComplete");if(this.host.parents()){this.removeHandler(this.host.parents(),"scroll.dropdownlist"+this.element.id)}this.removeHandlers();this.listBoxContainer.jqxListBox("destroy");this.listBoxContainer.remove();this.host.removeClass();this.removeHandler(a(document),"mousedown."+this.id,this.closeOpenedListBox);if(this.touch){this.removeHandler(a(document),a.jqx.mobile.getTouchEventName("touchstart")+"."+this.id)}this.dropdownlistArrow.remove();delete this.dropdownlistArrow;delete this.dropdownlistWrapper;delete this.listBoxContainer;delete this.input;delete this.arrow;delete this.dropdownlistContent;delete this.listBox;delete this._firstDiv;this.container.remove();delete this.container;var b=a.data(this.element,"jqxDropDownList");if(b){delete b.instance}this.host.removeData();this.host.remove();delete this.comboStructure;delete this.host;delete this.set;delete this.get;delete this.call;delete this.element},_raiseEvent:function(f,c){if(c==undefined){c={owner:null}}var d=this.events[f];args=c;args.owner=this;var e=new jQuery.Event(d);e.owner=this;if(f==2||f==3||f==4||f==5){e.args=c}var b=this.host.trigger(e);return b},propertyChangedHandler:function(b,c,f,e){if(b.isInitialized==undefined||b.isInitialized==false){return}if(c=="autoOpen"){b._updateHandlers()}if(c=="emptyString"){b.listBox.emptyString=b.emptyString}if(c=="renderer"){b.listBox.renderer=b.renderer}if(c=="itemHeight"){b.listBox.itemHeight=e}if(c=="rtl"){if(e){b.dropdownlistArrow.css("float","left");b.dropdownlistContent.css("float","right")}else{b.dropdownlistArrow.css("float","right");b.dropdownlistContent.css("float","left")}b.listBoxContainer.jqxListBox({rtl:b.rtl})}if(c=="source"){b.listBoxContainer.jqxListBox({source:b.source});b.listBox.selectedIndex=-1;b.listBox.selectIndex(this.selectedIndex);b.renderSelection();if(e==null){b.clear()}}if(c=="displayMember"||c=="valueMember"){b.listBoxContainer.jqxListBox({displayMember:b.displayMember,valueMember:b.valueMember});b.renderSelection()}if(c=="placeHolder"){b.renderSelection()}if(c=="theme"&&e!=null){b.listBoxContainer.jqxListBox({theme:e});b.listBoxContainer.addClass(b.toThemeProperty("jqx-popup"));if(a.jqx.browser.msie){b.listBoxContainer.addClass(b.toThemeProperty("jqx-noshadow"))}b.dropdownlistContent.removeClass();b.dropdownlistContent.addClass(b.toThemeProperty("jqx-dropdownlist-content"));b.dropdownlistWrapper.removeClass();b.dropdownlistWrapper.addClass(b.toThemeProperty("jqx-disableselect"));b.host.removeClass();b.host.addClass(b.toThemeProperty("jqx-fill-state-normal"));b.host.addClass(b.toThemeProperty("jqx-dropdownlist-state-normal"));b.host.addClass(b.toThemeProperty("jqx-rc-all"));b.host.addClass(b.toThemeProperty("jqx-widget"));b.arrow.removeClass();b.arrow.addClass(b.toThemeProperty("jqx-icon-arrow-down"));b.arrow.addClass(b.toThemeProperty("jqx-icon"))}if(c=="autoDropDownHeight"){b.listBoxContainer.jqxListBox({autoHeight:b.autoDropDownHeight});if(b.autoDropDownHeight){b.container.height(b.listBoxContainer.height()+25)}else{b.listBoxContainer.jqxListBox({height:b.dropDownHeight});b.container.height(parseInt(b.dropDownHeight)+25)}}if(c=="searchMode"){b.listBoxContainer.jqxListBox({searchMode:b.searchMode})}if(c=="incrementalSearch"){b.listBoxContainer.jqxListBox({incrementalSearch:b.incrementalSearch})}if(c=="incrementalSearchDelay"){b.listBoxContainer.jqxListBox({incrementalSearchDelay:b.incrementalSearchDelay})}if(c=="dropDownHeight"){if(!b.autoDropDownHeight){b.listBoxContainer.jqxListBox({height:b.dropDownHeight});b.container.height(parseInt(b.dropDownHeight)+25)}}if(c=="dropDownWidth"||c=="scrollBarSize"){var d=b.width;if(b.dropDownWidth!="auto"){d=b.dropDownWidth}b.listBoxContainer.jqxListBox({width:d,scrollBarSize:b.scrollBarSize});b.container.width(parseInt(d)+25)}if(c=="width"||c=="height"){if(e!=f){this.refresh();if(c=="width"){if(b.dropDownWidth=="auto"){var d=b.host.width();b.listBoxContainer.jqxListBox({width:d});b.container.width(parseInt(d)+25)}}}}if(c=="checkboxes"){b.listBoxContainer.jqxListBox({checkboxes:b.checkboxes})}if(c=="selectedIndex"){if(b.listBox!=null){b.listBox.selectIndex(parseInt(e));b.renderSelection()}}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(b){b.jqx.jqxWidget("jqxGrid","",{});b.extend(b.jqx._jqxGrid.prototype,{defineInstance:function(){this.disabled=false;this.width=600;this.height=400;this.pagerheight=28;this.groupsheaderheight=34;this.pagesize=10;this.pagesizeoptions=["5","10","20"];this.rowsheight=25;this.columnsheight=25;this.filterrowheight=30;this.groupindentwidth=30;this.rowdetails=false;this.enablerowdetailsindent=true;this.enablemousewheel=true;this.initrowdetails=null;this.layoutrowdetails=null;this.editable=false;this.editmode="selectedcell";this.pageable=false;this.pagermode="default";this.pagerbuttonscount=5;this.groupable=false;this.sortable=false;this.filterable=false;this.filtermode="default";this.autoshowfiltericon=true;this.showfiltercolumnbackground=true;this.showpinnedcolumnbackground=true;this.showsortcolumnbackground=true;this.altrows=false;this.altstart=1;this.altstep=1;this.showrowdetailscolumn=true;this.showtoolbar=false;this.toolbarheight=34;this.showstatusbar=false;this.statusbarheight=34;this.enableellipsis=true;this.groups=[];this.groupsrenderer=null;this.groupcolumnrenderer=null;this.groupsexpandedbydefault=false;this.pagerrenderer=null;this.touchmode="auto";this.columns=[];this.selectedrowindex=-1;this.selectedrowindexes=new Array();this.selectedcells=new Array();this.selectedcell=null;this.tableZIndex=799;this.headerZIndex=499;this.updatefilterconditions=null;this.showaggregates=false;this.showfilterrow=false;this.autorowheight=false;this.autokoupdates=true;this.handlekeyboardnavigation=null;this.showsortmenuitems=true;this.showfiltermenuitems=true;this.showgroupmenuitems=true;this.enablebrowserselection=false;this.enablekeyboarddelete=true;this.clipboard=true;this.ready=null;this.updatefilterpanel=null;this.autogeneratecolumns=false;this.rowdetailstemplate=null;this.scrollfeedback=null;this.rendertoolbar=null;this.renderstatusbar=null;this.rendered=null;this.multipleselectionbegins=null;this.columngroups=null;this.source={beforeprocessing:null,beforesend:null,loaderror:null,localdata:null,data:null,datatype:"array",datafields:[],url:"",root:"",record:"",id:"",totalrecords:0,recordstartindex:0,recordendindex:0,loadallrecords:true,sortcolumn:null,sortdirection:null,sort:null,filter:null,sortcomparer:null};this.dataview=null;this.updatedelay=0;this.autoheight=false;this.autowidth=false;this.showheader=true;this.showgroupsheader=true;this.closeablegroups=true;this.scrollbarsize=b.jqx.utilities.scrollBarSize;this.touchscrollbarsize=b.jqx.utilities.touchScrollBarSize;this.virtualmode=false;this.sort=null;this.columnsmenu=true;this.columnsresize=false;this.columnsreorder=false;this.columnsmenuwidth=15;this.autoshowcolumnsmenubutton=true;this.popupwidth="auto";this.sorttogglestates=2;this.rendergridrows=null;this.enableanimations=true;this.enabletooltips=false;this.selectionmode="singlerow";this.enablehover=true;this.loadingerrormessage="The data is still loading. When the data binding is completed, the Grid raises the 'bindingcomplete' event. Call this function in the 'bindingcomplete' event handler.";this.verticalscrollbarstep=25;this.verticalscrollbarlargestep=400;this.horizontalscrollbarstep=10;this.horizontalscrollbarlargestep=50;this.keyboardnavigation=true;this.touchModeStyle="auto";this.autoshowloadelement=true;this.showdefaultloadelement=true;this.showemptyrow=true;this.autosavestate=false;this.autoloadstate=false;this._updating=false;this._pagescache=new Array();this._pageviews=new Array();this._cellscache=new Array();this._rowdetailscache=new Array();this._rowdetailselementscache=new Array();this._requiresupdate=false;this._hasOpenedMenu=false;this.scrollmode="physical";this.deferreddatafields=null;this.localization=null;this.rtl=false;this.menuitemsarray=[];this.events=["initialized","rowClick","rowSelect","rowUnselect","groupExpand","groupCollapse","sort","columnClick","cellClick","pageChanged","pageSizeChanged","bindingComplete","groupsChanged","filter","columnResized","cellSelect","cellUnselect","cellBeginEdit","cellEndEdit","cellValueChanged","rowExpand","rowCollapse","rowDoubleClick","cellDoubleClick","columnReordered","pageChanging"]},createInstance:function(h){this.that=this;var g="<div style='overflow: hidden; -webkit-appearance: none; outline: none; width:100%; height: 100%; align:left; border: 0px; padding: 0px; margin: 0px; left: 0px; top: 0px; valign:top; position: relative;'><div id='wrapper"+this.element.id+"' style='overflow: hidden; -webkit-appearance: none; border: none; background: transparent; outline: none; width:100%; height: 100%; padding: 0px; margin: 0px; align:left; left: 0px; top: 0px; valign:top; position: relative;'><div id='toolbar' style='visibility: hidden; align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='groupsheader' style='visibility: hidden; align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='content"+this.element.id+"' style='overflow: hidden; -webkit-appearance: none; border: none; background: transparent; outline: none; border: none; padding: 0px; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='verticalScrollBar"+this.element.id+"' style='align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='horizontalScrollBar"+this.element.id+"' style='align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='bottomRight' style='align:left; valign:top; left: 0px; top: 0px; border: none; position: absolute;'></div><div id='statusbar' style='align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div><div id='pager' style='z-index: 20; align:left; valign:top; left: 0px; top: 0px; position: absolute;'></div></div></div>";this.element.innerText="";this.element.innerHTML="";if(!this.source.dataBind){this.source=new b.jqx.dataAdapter(this.source)}var d=this.source._source.datafields;if(d&&d.length>0){this._camelCase=this.source._source.dataFields!==undefined;this.editmode=this.editmode.toLowerCase();this.selectionmode=this.selectionmode.toLowerCase()}this.host.attr("role","grid");this.host.attr("align","left");this.element.innerHTML=g;this.host.addClass(this.toTP("jqx-grid"));this.host.addClass(this.toTP("jqx-reset"));this.host.addClass(this.toTP("jqx-rc-all"));this.host.addClass(this.toTP("jqx-widget"));this.host.addClass(this.toTP("jqx-widget-content"));this.wrapper=this.host.find("#wrapper"+this.element.id);this.content=this.host.find("#content"+this.element.id);this.content.addClass(this.toTP("jqx-reset"));var j=this.host.find("#verticalScrollBar"+this.element.id);var n=this.host.find("#horizontalScrollBar"+this.element.id);this.bottomRight=this.host.find("#bottomRight").addClass(this.toTP("jqx-grid-bottomright"));if(!j.jqxScrollBar){throw new Error("jqxGrid: Missing reference to jqxscrollbar.js");return}this.editors=new Array();this.vScrollBar=j.jqxScrollBar({vertical:true,rtl:this.rtl,touchMode:this.touchmode,step:this.verticalscrollbarstep,largestep:this.verticalscrollbarlargestep,theme:this.theme,_triggervaluechanged:false});this.hScrollBar=n.jqxScrollBar({vertical:false,rtl:this.rtl,touchMode:this.touchmode,step:this.horizontalscrollbarstep,largestep:this.horizontalscrollbarlargestep,theme:this.theme,_triggervaluechanged:false});this.pager=this.host.find("#pager");this.pager[0].id="pager"+this.element.id;this.toolbar=this.host.find("#toolbar");this.toolbar[0].id="toolbar"+this.element.id;this.toolbar.addClass(this.toTP("jqx-grid-toolbar"));this.toolbar.addClass(this.toTP("jqx-widget-header"));this.statusbar=this.host.find("#statusbar");this.statusbar[0].id="statusbar"+this.element.id;this.statusbar.addClass(this.toTP("jqx-grid-statusbar"));this.statusbar.addClass(this.toTP("jqx-widget-header"));this.pager.addClass(this.toTP("jqx-grid-pager"));this.pager.addClass(this.toTP("jqx-widget-header"));this.groupsheader=this.host.find("#groupsheader");this.groupsheader.addClass(this.toTP("jqx-grid-groups-header"));this.groupsheader.addClass(this.toTP("jqx-widget-header"));this.vScrollBar.css("visibility","hidden");this.hScrollBar.css("visibility","hidden");this.vScrollInstance=b.data(this.vScrollBar[0],"jqxScrollBar").instance;this.hScrollInstance=b.data(this.hScrollBar[0],"jqxScrollBar").instance;this.gridtable=null;this.isNestedGrid=this.host.parent()?this.host.parent().css("z-index")==2000:false;this.touchdevice=this.isTouchDevice();if(this.localizestrings){this.localizestrings();if(this.localization!=null){this.localizestrings(this.localization,false)}}if(this.rowdetailstemplate){if(undefined==this.rowdetailstemplate.rowdetails){this.rowdetailstemplate.rowdetails="<div></div>"}if(undefined==this.rowdetailstemplate.rowdetailsheight){this.rowdetailstemplate.rowdetailsheight=200}if(undefined==this.rowdetailstemplate.rowdetailshidden){this.rowdetailstemplate.rowdetailshidden=true}}if(this.showfilterrow&&!this.filterable){throw new Error('jqxGrid: "showfilterrow" requires setting the "filterable" property to true!');this.host.remove();return}if(this.autorowheight&&!this.autoheight&&!this.pageable){throw new Error('jqxGrid: "autorowheight" requires setting the "autoheight" or "pageable" property to true!');this.host.remove();return}if(this.virtualmode&&this.rendergridrows==null){throw new Error('jqxGrid: "virtualmode" requires setting the "rendergridrows"!');this.host.remove();return}if(this.virtualmode&&!this.pageable&&this.groupable){throw new Error('jqxGrid: "grouping" in "virtualmode" without paging is not supported!');this.host.remove();return}if(this._testmodules()){return}this._builddataloadelement();this._cachedcolumns=this.columns;if(this.rowsheight!=25){this._measureElement("cell")}if(this.columnsheight!=25||this.columngroups){this._measureElement("column")}var d=this.source.datafields;if(d==null&&this.source._source){d=this.source._source.datafields}if(d){for(var e=0;e<this.columns.length;e++){var f=this.columns[e];if(f&&f.cellsformat&&f.cellsformat.length>2){for(var l=0;l<d.length;l++){if(d[l].name==f.datafield&&!d[l].format){d[l].format=f.cellsformat;break}}}}}this.databind(this.source);if(this.showtoolbar){this.toolbar.css("visibility","visible")}if(this.showstatusbar){this.statusbar.css("visibility","visible")}this._arrange();if(this.pageable&&this._initpager){this._initpager()}this.tableheight=null;var i=this.that;var k=function(){if(i.content){i.content[0].scrollTop=0;i.content[0].scrollLeft=0}if(i.gridcontent){i.gridcontent[0].scrollLeft=0;i.gridcontent[0].scrollTop=0}};this.addHandler(this.content,"mousedown",function(){k()});this.addHandler(this.content,"scroll",function(m){k();return false});if(!this.showfilterrow){if(!this.showstatusbar&&!this.showtoolbar){this.host.addClass("jqx-disableselect")}this.content.addClass("jqx-disableselect")}if(this.enablebrowserselection){this.content.removeClass("jqx-disableselect");this.host.removeClass("jqx-disableselect")}this._resizeWindow();if(this.renderstatusbar){this.renderstatusbar(this.statusbar)}if(this.rendertoolbar){this.rendertoolbar(this.toolbar)}if(this.disabled){this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"))}this.hasTransform=b.jqx.utilities.hasTransform(this.host);if(this.scrollmode=="logical"){this.vScrollInstance.thumbStep=this.rowsheight;this.vScrollInstance.step=this.rowsheight}if(this.filterable||this.groupable||this.sortable){this._initmenu()}},_resizeWindow:function(){var d=this.that;if((this.width!=null&&this.width.toString().indexOf("%")!=-1)||(this.height!=null&&this.height.toString().indexOf("%")!=-1)){this._updatesizeonwindowresize=true;b.jqx.utilities.resize(this.host,function(h){var g=b(window).width();var e=b(window).height();var f=d.host.width();var i=d.host.height();if(d.autoheight){d._lastHostWidth=e}if(d._lastHostWidth!=f||d._lastHostHeight!=i){if(d.touchdevice&&d.editcell&&h!=="orientationchange"){return}d._updatesize(d._lastHostWidth!=f,d._lastHostHeight!=i)}d._lastWidth=g;d._lastHeight=e;d._lastHostWidth=f;d._lastHostHeight=i})}},_builddataloadelement:function(){if(this.dataloadelement){this.dataloadelement.remove()}this.dataloadelement=b('<div style="overflow: hidden; position: absolute;"></div>');if(this.showdefaultloadelement){var d=b('<table cellspacing="0" cellpadding="0" style="z-index: 99999; margin-left: -66px; left: 50%; top: 50%; margin-top: -24px; position: relative; width: 112px; height: 50px; font-family: verdana; font-size: 12px; color: #767676; border-color: #898989; border-width: 1px; border-style: solid; background: #f6f6f6; border-collapse: collapse;"><tbody><tr><td><div style="overflow: hidden; width: 32px; height: 32px;" class="jqx-grid-load"/></td><td><span style="margin-left: 5px;" >'+this.gridlocalization.loadtext+"</span></td></tr></tbody></table>");d.addClass(this.toTP("jqx-rc-all"));this.dataloadelement.addClass(this.toTP("jqx-rc-all"));this.dataloadelement.append(d)}else{this.dataloadelement.addClass(this.toTP("jqx-grid-load"))}this.dataloadelement.width(this.width);this.dataloadelement.height(this.height);this.host.prepend(this.dataloadelement)},_measureElement:function(e){var d=b("<span style='visibility: hidden; white-space: nowrap;'>measure Text</span>");d.addClass(this.toTP("jqx-widget"));b(document.body).append(d);if(e=="cell"){this._cellheight=d.height()}else{this._columnheight=d.height()}d.remove()},_measureMenuElement:function(){var e=b("<span style='visibility: hidden; white-space: nowrap;'>measure Text</span>");e.addClass(this.toTP("jqx-widget"));e.addClass(this.toTP("jqx-menu"));e.addClass(this.toTP("jqx-menu-item-top"));e.addClass(this.toTP("jqx-fill-state-normal"));b(document.body).append(e);var d=e.outerHeight();e.remove();return d},_measureElementWidth:function(f){var e=b("<span style='visibility: hidden; white-space: nowrap;'>"+f+"</span>");e.addClass(this.toTP("jqx-widget"));e.addClass(this.toTP("jqx-grid"));e.addClass(this.toTP("jqx-grid-column-header"));e.addClass(this.toTP("jqx-widget-header"));b(document.body).append(e);var d=e.outerWidth()+20;e.remove();return d},_getBodyOffset:function(){var e=0;var d=0;if(b("body").css("border-top-width")!="0px"){e=parseInt(b("body").css("border-top-width"));if(isNaN(e)){e=0}}if(b("body").css("border-left-width")!="0px"){d=parseInt(b("body").css("border-left-width"));if(isNaN(d)){d=0}}return{left:d,top:e}},_testmodules:function(){var k="";var h=this.that;var d=function(){if(k.length!=""){k+=","}};if(this.columnsmenu&&!this.host.jqxMenu&&(this.sortable||this.groupable||this.filterable)){d();k+=" jqxmenu.js"}if(!this.host.jqxScrollBar){d();k+=" jqxscrollbar.js"}if(!this.host.jqxButton){d();k+=" jqxbuttons.js"}if(!b.jqx.dataAdapter){d();k+=" jqxdata.js"}if(this.pageable&&!this.gotopage){d();k+="jqxgrid.pager.js"}if(this.filterable&&!this.applyfilters){d();k+=" jqxgrid.filter.js"}if(this.groupable&&!this._initgroupsheader){d();k+=" jqxgrid.grouping.js"}if(this.columnsresize&&!this.autoresizecolumns){d();k+=" jqxgrid.columnsresize.js"}if(this.columnsreorder&&!this.setcolumnindex){d();k+=" jqxgrid.columnsreorder.js"}if(this.sortable&&!this.sortby){d();k+=" jqxgrid.sort.js"}if(this.editable&&!this.begincelledit){d();k+=" jqxgrid.edit.js"}if(this.showaggregates&&!this.getcolumnaggregateddata){d();k+=" jqxgrid.aggregates.js"}if(this.keyboardnavigation&&!this.selectrow){d();k+=" jqxgrid.selection.js"}if(k!=""||this.editable||this.filterable||this.pageable){var f=[];var j=function(i){switch(i){case"checkbox":if(!h.host.jqxCheckBox&&!f.checkbox){f.checkbox=true;d();k+=" jqxcheckbox.js"}break;case"numberinput":if(!h.host.jqxNumberInput&&!f.numberinput){f.numberinput=true;d();k+=" jqxnumberinput.js"}break;case"datetimeinput":if(!h.host.jqxDateTimeInput&&!f.datetimeinput){d();f.datetimeinput=true;k+=" jqxdatetimeinput.js(requires: jqxcalendar.js)"}else{if(!h.host.jqxCalendar&&!f.calendar){d();k+=" jqxcalendar.js"}}break;case"combobox":if(!h.host.jqxComboBox&&!f.combobox){d();f.combobox=true;k+=" jqxcombobox.js(requires: jqxlistbox.js)"}else{if(!h.host.jqxListBox&&!f.listbox){d();f.listbox=true;k+=" jqxlistbox.js"}}break;case"dropdownlist":if(!h.host.jqxDropDownList&&!f.dropdownlist){d();f.dropdownlist=true;k+=" jqxdropdownlist.js(requires: jqxlistbox.js)"}else{if(!h.host.jqxListBox&&!f.listbox){d();f.listbox=true;k+=" jqxlistbox.js"}}break}};if(this.filterable||this.pageable){j("dropdownlist")}for(var e=0;e<this.columns.length;e++){if(this.columns[e]==undefined){continue}var g=this.columns[e].columntype;j(g);if(this.filterable&&this.showfilterrow){var g=this.columns[e].filtertype;if(g=="checkedlist"||g=="bool"){j("checkbox")}if(g=="date"){j("datetimeinput")}}}if(k!=""){throw new Error("jqxGrid: Missing references to the following module(s): "+k);this.host.remove();return true}}return false},focus:function(){try{this.wrapper.focus();var e=this.that;setTimeout(function(){e.wrapper.focus()},10);this.focused=true}catch(d){}},hiddenParent:function(){return b.jqx.isHidden(this.host)},_updatesize:function(i,h){if(this._loading){return}var f=this.that;var g=f.host.width();var e=f.host.height();if(!f._oldWidth){f._oldWidth=g}if(!f._oldHeight){f._oldHeight=e}if(f._resizeTimer){clearTimeout(f._resizeTimer)}var d=5;f._resizeTimer=setTimeout(function(){f.resizingGrid=true;if(b.jqx.isHidden(f.host)){return}if(j!=f._oldHeight||h==true){var k=f.groupable&&f.groups.length>0;var p=f.vScrollBar.css("visibility");if(!f.autoheight){if(f.virtualmode){f._pageviews=new Array()}if(!k&&!f.rowdetails&&!f.pageable){f._arrange();f.virtualsizeinfo=f._calculatevirtualheight();var j=Math.round(f.host.height())+2*f.rowsheight;if(parseInt(j)>=parseInt(f._oldHeight)){f.prerenderrequired=true}f._renderrows(f.virtualsizeinfo)}else{f._arrange();f.prerenderrequired=true;var j=Math.round(f.host.height())+2*f.rowsheight;realheight=f._gettableheight();var r=Math.round(j/f.rowsheight);var m=Math.max(f.dataview.totalrows,f.dataview.totalrecords);if(f.pageable){m=f.pagesize;if(f.pagesize>Math.max(f.dataview.totalrows,f.dataview.totalrecords)&&f.autoheight){m=Math.max(f.dataview.totalrows,f.dataview.totalrecords)}else{if(!f.autoheight){if(f.dataview.totalrows<f.pagesize){m=Math.max(f.dataview.totalrows,f.dataview.totalrecords)}}}}var o=m*f.rowsheight;var l=f._getpagesize();if(!f.pageable&&f.autoheight){r=m}if(f.virtualsizeinfo){f.virtualsizeinfo.visiblerecords=r}f.rendergridcontent(true,false);f._renderrows(f.virtualsizeinfo)}if(p!=f.vScrollBar.css("visibility")){f.vScrollInstance.setPosition(0);f._arrange();f._updatecolumnwidths();if(f.table){f.table.width(f.columnsheader.width())}f._updatecellwidths()}}}if(g!=f._oldWidth||i==true){var q=false;if(f.editcell&&f.editcell.editor){switch(f.editcell.columntype){case"dropdownlist":q=f.editcell.editor.jqxDropDownList("isOpened")||(f.editcell.editor.jqxDropDownList("isanimating")&&!f.editcell.editor.jqxDropDownList("ishiding"));if(q){f.editcell.editor.jqxDropDownList({openDelay:0});f.editcell.editor.jqxDropDownList("open");f.editcell.editor.jqxDropDownList({openDelay:250});return}break;case"combobox":q=f.editcell.editor.jqxComboBox("isOpened")||(f.editcell.editor.jqxComboBox("isanimating")&&!f.editcell.editor.jqxComboBox("ishiding"));if(q){f.editcell.editor.jqxComboBox({openDelay:0});f.editcell.editor.jqxComboBox("open");f.editcell.editor.jqxComboBox({openDelay:250});return}break;case"datetimeinput":if(q){q=f.editcell.editor.jqxDateTimeInput("isOpened")||(f.editcell.editor.jqxDateTimeInput("isanimating")&&!f.editcell.editor.jqxDateTimeInput("ishiding"));f.editcell.editor.jqxDateTimeInput({openDelay:0});f.editcell.editor.jqxDateTimeInput("open");f.editcell.editor.jqxDateTimeInput({openDelay:250});return}break}}var n=f.hScrollBar.css("visibility");f._arrange();f._updatecolumnwidths();if(f.table){f.table.width(f.columnsheader.width())}f._updatecellwidths();if(!(i==false&&f._oldWidth>g)){if(!h){f._renderrows(f.virtualsizeinfo)}}if(n!=f.hScrollBar.css("visibility")){f.hScrollInstance.setPosition(0)}}f._oldWidth=g;f._oldHeight=j;f.resizingGrid=false},d)},getTouches:function(d){return b.jqx.mobile.getTouches(d)},_updateTouchScrolling:function(){var e=this.that;if(e.isTouchDevice()){if(e.autoheight){return}e.scrollmode="logical";e.vScrollInstance.thumbStep=e.rowsheight;var g=b.jqx.mobile.getTouchEventName("touchstart");var f=b.jqx.mobile.getTouchEventName("touchend");var d=b.jqx.mobile.getTouchEventName("touchmove");e.enablehover=false;if(e.gridcontent){e.removeHandler(e.gridcontent,g+".touchScroll");e.removeHandler(e.gridcontent,d+".touchScroll");e.removeHandler(e.gridcontent,f+".touchScroll");e.removeHandler(e.gridcontent,"touchcancel.touchScroll");b.jqx.mobile.touchScroll(e.gridcontent[0],e.vScrollInstance.max,function(j,i){if(e.vScrollBar.css("visibility")=="visible"){var h=e.vScrollInstance.value;e.vScrollInstance.setPosition(h+i)}if(e.hScrollBar.css("visibility")=="visible"){var h=e.hScrollInstance.value;e.hScrollInstance.setPosition(h+j)}e.vScrollInstance.thumbCapture=true;e._lastScroll=new Date()},this.element.id,this.hScrollBar,this.vScrollBar);if(e._overlayElement){e.removeHandler(e._overlayElement,g+".touchScroll");e.removeHandler(e._overlayElement,d+".touchScroll");e.removeHandler(e._overlayElement,f+".touchScroll");e.removeHandler(e._overlayElement,"touchcancel.touchScroll");b.jqx.mobile.touchScroll(e._overlayElement[0],e.vScrollInstance.max,function(j,i){if(e.vScrollBar.css("visibility")=="visible"){var h=e.vScrollInstance.value;e.vScrollInstance.setPosition(h+i)}if(e.hScrollBar.css("visibility")=="visible"){var h=e.hScrollInstance.value;e.hScrollInstance.setPosition(h+j)}e.vScrollInstance.thumbCapture=true;e._lastScroll=new Date()},this.element.id,this.hScrollBar,this.vScrollBar);this.addHandler(this.host,g,function(){if(!e.editcell){e._overlayElement.css("visibility","visible")}else{e._overlayElement.css("visibility","hidden")}});this.addHandler(this.host,f,function(){if(!e.editcell){e._overlayElement.css("visibility","visible")}else{e._overlayElement.css("visibility","hidden")}})}}}},isTouchDevice:function(){if(this.touchDevice!=undefined){return this.touchDevice}var d=b.jqx.mobile.isTouchDevice();this.touchDevice=d;if(this.touchmode==true){if(b.jqx.browser.msie&&b.jqx.browser.version<9){this.enablehover=false;return false}d=true;b.jqx.mobile.setMobileSimulator(this.element);this.touchDevice=d}else{if(this.touchmode==false){d=false}}if(d&&this.touchModeStyle!=false){this.touchDevice=true;this.host.addClass(this.toThemeProperty("jqx-touch"));this.host.find("jqx-widget-content").addClass(this.toThemeProperty("jqx-touch"));this.host.find("jqx-widget-header").addClass(this.toThemeProperty("jqx-touch"));this.scrollbarsize=this.touchscrollbarsize}return d},toTP:function(d){return this.toThemeProperty(d)},localizestrings:function(d,e){this._cellscache=new Array();if(b.jqx.dataFormat){b.jqx.dataFormat.cleardatescache()}if(this._loading){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}if(d!=null){for(var f in d){if(f.toLowerCase()!==f){d[f.toLowerCase()]=d[f]}}if(d.pagergotopagestring){this.gridlocalization.pagergotopagestring=d.pagergotopagestring}if(d.pagershowrowsstring){this.gridlocalization.pagershowrowsstring=d.pagershowrowsstring}if(d.pagerrangestring){this.gridlocalization.pagerrangestring=d.pagerrangestring}if(d.pagernextbuttonstring){this.gridlocalization.pagernextbuttonstring=d.pagernextbuttonstring}if(d.pagerpreviousbuttonstring){this.gridlocalization.pagerpreviousbuttonstring=d.pagerpreviousbuttonstring}if(d.pagerfirstbuttonstring){this.gridlocalization.pagerfirstbuttonstring=d.pagerfirstbuttonstring}if(d.pagerlastbuttonstring){this.gridlocalization.pagerlastbuttonstring=d.pagerlastbuttonstring}if(d.groupsheaderstring){this.gridlocalization.groupsheaderstring=d.groupsheaderstring}if(d.sortascendingstring){this.gridlocalization.sortascendingstring=d.sortascendingstring}if(d.sortdescendingstring){this.gridlocalization.sortdescendingstring=d.sortdescendingstring}if(d.sortremovestring){this.gridlocalization.sortremovestring=d.sortremovestring}if(d.groupbystring){this.gridlocalization.groupbystring=d.groupbystring}if(d.groupremovestring){this.gridlocalization.groupremovestring=d.groupremovestring}if(d.firstDay){this.gridlocalization.firstDay=d.firstDay}if(d.days){this.gridlocalization.days=d.days}if(d.months){this.gridlocalization.months=d.months}if(d.AM){this.gridlocalization.AM=d.AM}if(d.PM){this.gridlocalization.PM=d.PM}if(d.patterns){this.gridlocalization.patterns=d.patterns}if(d.percentsymbol){this.gridlocalization.percentsymbol=d.percentsymbol}if(d.currencysymbol){this.gridlocalization.currencysymbol=d.currencysymbol}if(d.currencysymbolposition){this.gridlocalization.currencysymbolposition=d.currencysymbolposition}if(d.decimalseparator){this.gridlocalization.decimalseparator=d.decimalseparator}if(d.thousandsseparator){this.gridlocalization.thousandsseparator=d.thousandsseparator}if(d.filterclearstring){this.gridlocalization.filterclearstring=d.filterclearstring}if(d.filterstring){this.gridlocalization.filterstring=d.filterstring}if(d.filtershowrowstring){this.gridlocalization.filtershowrowstring=d.filtershowrowstring}if(d.filterselectallstring){this.gridlocalization.filterselectallstring=d.filterselectallstring}if(d.filterchoosestring){this.gridlocalization.filterchoosestring=d.filterchoosestring}if(d.filterorconditionstring){this.gridlocalization.filterorconditionstring=d.filterorconditionstring}if(d.filterandconditionstring){this.gridlocalization.filterandconditionstring=d.filterandconditionstring}if(d.filterstringcomparisonoperators){this.gridlocalization.filterstringcomparisonoperators=d.filterstringcomparisonoperators}if(d.filternumericcomparisonoperators){this.gridlocalization.filternumericcomparisonoperators=d.filternumericcomparisonoperators}if(d.filterdatecomparisonoperators){this.gridlocalization.filterdatecomparisonoperators=d.filterdatecomparisonoperators}if(d.filterbooleancomparisonoperators){this.gridlocalization.filterbooleancomparisonoperators=d.filterbooleancomparisonoperators}if(d.emptydatastring){this.gridlocalization.emptydatastring=d.emptydatastring}if(d.filterselectstring){this.gridlocalization.filterselectstring=d.filterselectstring}if(d.todaystring){this.gridlocalization.todaystring=d.todaystring}if(d.clearstring){this.gridlocalization.clearstring=d.clearstring}if(d.validationstring){this.gridlocalization.validationstring=d.validationstring}if(d.loadtext){this.gridlocalization.loadtext=d.loadtext}if(e!==false){if(this._initpager){this._initpager()}if(this._initgroupsheader){this._initgroupsheader()}if(this._initmenu){this._initmenu()}this._builddataloadelement();b(this.dataloadelement).css("visibility","hidden");b(this.dataloadelement).css("display","none");if(this.filterable&&this.showfilterrow){if(this._updatefilterrow){for(var f in this._filterrowcache){b(this._filterrowcache[f]).remove()}this._filterrowcache=[];this._updatefilterrow()}}if(this.showaggregates&&this.refresheaggregates){this.refresheaggregates()}this._renderrows(this.virtualsizeinfo)}}else{this.gridlocalization={"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",d3:"dd-MMMM-yyyy",d4:"dd-MM-yy",d5:"H:mm",d6:"HH:mm",d7:"HH:mm tt",d8:"dd/MMMM/yyyy",d9:"MMMM-dd",d10:"MM-dd",d11:"MM-dd-yyyy"},percentsymbol:"%",currencysymbol:"$",currencysymbolposition:"before",decimalseparator:".",thousandsseparator:",",pagergotopagestring:"Go to page:",pagershowrowsstring:"Show rows:",pagerrangestring:" of ",pagerpreviousbuttonstring:"previous",pagernextbuttonstring:"next",pagerfirstbuttonstring:"first",pagerlastbuttonstring:"last",groupsheaderstring:"Drag a column and drop it here to group by that column",sortascendingstring:"Sort Ascending",sortdescendingstring:"Sort Descending",sortremovestring:"Remove Sort",groupbystring:"Group By this column",groupremovestring:"Remove from groups",filterclearstring:"Clear",filterstring:"Filter",filtershowrowstring:"Show rows where:",filterorconditionstring:"Or",filterandconditionstring:"And",filterselectallstring:"(Select All)",filterchoosestring:"Please Choose:",filterstringcomparisonoperators:["empty","not empty","contains","contains(match case)","does not contain","does not contain(match case)","starts with","starts with(match case)","ends with","ends with(match case)","equal","equal(match case)","null","not null"],filternumericcomparisonoperators:["equal","not equal","less than","less than or equal","greater than","greater than or equal","null","not null"],filterdatecomparisonoperators:["equal","not equal","less than","less than or equal","greater than","greater than or equal","null","not null"],filterbooleancomparisonoperators:["equal","not equal"],validationstring:"Entered value is not valid",emptydatastring:"No data to display",filterselectstring:"Select Filter",loadtext:"Loading...",clearstring:"Clear",todaystring:"Today"}}},_initmenu:function(){var r=this.that;if(this.host.jqxMenu){if(this.gridmenu){if(this.filterable){if(this._destroyfilterpanel){this._destroyfilterpanel()}}this.removeHandler(this.gridmenu,"keydown");this.removeHandler(this.gridmenu,"closed");this.removeHandler(this.gridmenu,"itemclick");this.gridmenu.removeData();this.gridmenu.jqxMenu("destroy");this.gridmenu.remove()}this.menuitemsarray=new Array();this.gridmenu=b('<div id="gridmenu'+this.element.id+'" style="z-index: 9999999999999;"></div>');this.host.append(this.gridmenu);var w=b("<ul></ul>");var i='<div class="jqx-grid-sortasc-icon"></div>';var t=b("<li>"+i+this.gridlocalization.sortascendingstring+"</li>");var A='<div class="jqx-grid-sortdesc-icon"></div>';var x=b("<li>"+A+this.gridlocalization.sortdescendingstring+"</li>");var n='<div class="jqx-grid-sortremove-icon"></div>';var k=b("<li>"+n+this.gridlocalization.sortremovestring+"</li>");var j='<div class="jqx-grid-groupby-icon"></div>';var q=b("<li>"+j+this.gridlocalization.groupbystring+"</li>");var f=b("<li>"+j+this.gridlocalization.groupremovestring+"</li>");var d=b('<li type="separator"></li>');var v=b('<li class="filter" style="height: 170px;" ignoretheme="true"><div class="filter"></div></li>');var m=this.gridlocalization.sortascendingstring.length;var s=this.gridlocalization.sortascendingstring;if(this.gridlocalization.sortdescendingstring.length>m){m=this.gridlocalization.sortdescendingstring.length;s=this.gridlocalization.sortdescendingstring}if(this.gridlocalization.sortremovestring.length>m){m=this.gridlocalization.sortremovestring.length;s=this.gridlocalization.sortremovestring}if(this.groupable&&this._initgroupsheader&&this.showgroupmenuitems){if(this.gridlocalization.groupbystring.length>m){m=this.gridlocalization.groupbystring.length;s=this.gridlocalization.groupbystring}if(this.gridlocalization.groupremovestring.length>m){m=this.gridlocalization.groupremovestring.length;s=this.gridlocalization.groupremovestring}}var y=200;s=b.trim(s).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");var g=b("<span>"+s+"</span>");g.addClass(this.toThemeProperty("jqx-menu-item"));this.host.append(g);y=g.outerWidth()+60;g.remove();var e=0;if(this.sortable&&this._togglesort&&this.showsortmenuitems){w.append(t);this.menuitemsarray[0]=t[0];w.append(x);this.menuitemsarray[1]=x[0];w.append(k);this.menuitemsarray[2]=k[0];e=3}if(this.groupable&&this._initgroupsheader&&this.showgroupmenuitems){w.append(q);this.menuitemsarray[3]=q[0];w.append(f);this.menuitemsarray[4]=f[0];e+=2}var u=this._measureMenuElement();var l=e*u+9;var p=true;if(this.filterable&&!this.showfilterrow&&this.showfiltermenuitems){if(this._initfilterpanel){this.menuitemsarray[5]=v[0];this.menuitemsarray[6]=v[0];w.append(d);w.append(v);l+=176;if(b.jqx.browser.msie&&b.jqx.browser.version<8){l+=20}var o=b(v).find("div:first");y+=20;this._initfilterpanel(this,o,"",y);p=false;this.removeHandler(b(document),"click.menu"+r.element.id,r._closemenuafterclick,r);this.addHandler(b(document),"click.menu"+r.element.id,r._closemenuafterclick,r)}else{throw new Error("jqxGrid: Missing reference to jqxgrid.filter.js.")}}this.gridmenu.append(w);if(b.jqx.browser.msie&&b.jqx.browser.version<8&&this.filterable){b("#listBoxfilter1"+this.element.id).css("z-index",4990);b("#listBoxfilter2"+this.element.id).css("z-index",4990);b("#listBoxfilter3"+this.element.id).css("z-index",4990);b("#gridmenu"+this.element.id).css("z-index",5000);this.addHandler(b("#gridmenu"+this.element.id),"initialized",function(){b("#menuWrappergridmenu"+r.element.id).css("z-index",4980)})}if(this.menuitemsarray[0]==undefined){l=65}this.removeHandler(this.gridmenu,"keydown");this.addHandler(this.gridmenu,"keydown",function(F){if(F.keyCode==27){r.gridmenu.jqxMenu("close")}else{if(F.keyCode==13&&r.filterable){if(r._buildfilter){var E=b(b.find("#filter1"+r.element.id)).jqxDropDownList("container").css("display")=="block";var D=b(b.find("#filter2"+r.element.id)).jqxDropDownList("container").css("display")=="block";var B=b(b.find("#filter3"+r.element.id)).jqxDropDownList("container").css("display")=="block";var G=b(b.find("#filterclearbutton"+r.element.id)).hasClass("jqx-fill-state-focus");if(G){var C=b.data(document.body,"contextmenu"+r.element.id).column;r._clearfilter(r,r.element,C);r.gridmenu.jqxMenu("close")}else{if(!E&&!D&&!B){var C=b.data(document.body,"contextmenu"+r.element.id).column;r.gridmenu.jqxMenu("close");r._buildfilter(r,v,C)}}}}}});if(this.popupwidth!="auto"){y=this.popupwidth}this.gridmenu.jqxMenu({width:y,height:l,autoCloseOnClick:p,autoOpenPopup:false,mode:"popup",theme:this.theme,animationShowDuration:0,animationHideDuration:0,animationShowDelay:0});if(this.filterable){this.gridmenu.jqxMenu("_setItemProperty",v[0].id,"closeOnClick",false)}if(this.rtl){var z=this.that;b.each(w.find("li"),function(){b(this).addClass(z.toTP("jqx-rtl"))});var h=function(B){var C=B.find("div");C.css("float","right");C.css("margin-left","4px");C.css("margin-right","-4px")};h(k);h(x);h(t);h(q);h(f)}this._handlemenueevents()}else{this.columnsmenu=false}},_arrangemenu:function(){if(!this.gridmenu){this._initmenu()}var i=this.gridlocalization.sortascendingstring.length;var d=this.gridlocalization.sortascendingstring;if(this.gridlocalization.sortdescendingstring.length>i){i=this.gridlocalization.sortdescendingstring.length;d=this.gridlocalization.sortdescendingstring}if(this.gridlocalization.sortremovestring.length>i){i=this.gridlocalization.sortremovestring.length;d=this.gridlocalization.sortremovestring}if(this.groupable&&this._initgroupsheader){if(this.gridlocalization.groupbystring.length>i){i=this.gridlocalization.groupbystring.length;d=this.gridlocalization.groupbystring}if(this.gridlocalization.groupremovestring.length>i){i=this.gridlocalization.groupremovestring.length;d=this.gridlocalization.groupremovestring}}var e=200;d=b.trim(d).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");var f=b("<span>"+d+"</span>");f.addClass(this.toThemeProperty("jqx-menu-item"));this.host.append(f);e=f.outerWidth()+60;f.remove();var g=0;if(this.sortable&&this._togglesort&&this.showsortmenuitems){g=3}if(this.groupable&&this._initgroupsheader&&this.showgroupmenuitems){g+=2}var h=g*27+3;if(this.filterable&&this.showfiltermenuitems){if(this._initfilterpanel){h+=176;e+=20;if(b.jqx.browser.msie&&b.jqx.browser.version<8){h+=20}}}if(this.menuitemsarray[0]==undefined){h=65}if(this.popupwidth!="auto"){e=this.popupwidth}this.gridmenu.jqxMenu({width:e,height:h})},_closemenuafterclick:function(e){var i=e!=null?e.data:this;var g=false;if(e.target==undefined||(e.target!=undefined&&e.target.className.indexOf==undefined)){i.gridmenu.jqxMenu("close");return}if(e.target.className.indexOf("filter")!=-1){return}if(e.target.className.indexOf("jqx-grid-cell")!=-1){i.gridmenu.jqxMenu("close");return}if(i._hasOpenedMenu){if(b(e.target).ischildof(i.gridmenu)){return}}var d=i.host.coord();var f=i.gridmenu.coord();var k=e.pageX;var j=e.pageY;b.each(b(e.target).parents(),function(){if(this.id!=null&&this.id.indexOf("filter")!=-1){g=true;return false}if(this.className.indexOf("filter")!=-1){g=true;return false}if(this.className.indexOf("jqx-grid-cell")!=-1){i.gridmenu.jqxMenu("close");return false}if(this.className.indexOf("jqx-grid-column")!=-1){i.gridmenu.jqxMenu("close");return false}});if(g){return}try{if(this.filtermode==="default"){var n=b(b.find("#filter1"+i.element.id)).jqxDropDownList("listBox").vScrollInstance._mouseup;var l=new Date();if(l-n<100){return}var m=b(b.find("#filter3"+i.element.id)).jqxDropDownList("listBox").vScrollInstance._mouseup;if(l-m<100){return}if((b(b.find("#filter3"+i.element.id)).jqxDropDownList("container")).css("display")=="block"){return}if((b(b.find("#filter1"+i.element.id)).jqxDropDownList("container")).css("display")=="block"){return}if((b(b.find("#filter2"+i.element.id)).jqxDropDownList("container")).css("display")=="block"){return}}else{var n=b(b.find("#filter1"+i.element.id)).data().jqxListBox.instance.vScrollInstance._mouseup;var l=new Date();if(l-n<100){return}var m=b(b.find("#filter1"+i.element.id)).data().jqxListBox.instance.hScrollInstance._mouseup;if(l-m<100){return}}}catch(h){}if(k>=f.left&&k<=f.left+i.gridmenu.width()){if(j>=f.top&&j<=f.top+i.gridmenu.height()){return}}i.gridmenu.jqxMenu("close")},_handlemenueevents:function(){var d=this.that;this.removeHandler(this.gridmenu,"closed");this.addHandler(this.gridmenu,"closed",function(e){d._closemenu()});this.removeHandler(this.gridmenu,"itemclick");this.addHandler(this.gridmenu,"itemclick",function(h){var g=h.args;for(var e=0;e<d.menuitemsarray.length;e++){var j=d.menuitemsarray[e];if(g==j){if(b(g).attr("ignoretheme")!=undefined){return}var k=b.data(document.body,"contextmenu"+d.element.id);var f=k.column;if(d.filterable){d.gridmenu.jqxMenu("close")}var m=f.displayfield;if(m==null){m=f.datafield}if(k!=null){switch(e){case 0:d.sortby(m,"ascending",null);break;case 1:d.sortby(m,"descending",null);break;case 2:d.sortby(m,null,null);break;case 3:d.addgroup(f.datafield);break;case 4:d.removegroup(f.datafield);break;case 5:var l=b(d.menuitemsarray[6]);b(l).css("display","block");break;case 7:break}}break}}})},getdatainformation:function(){var d=this.dataview.totalrecords;if(this.summaryrows){d+=this.summaryrows.length}return{rowscount:d,sortinformation:this.getsortinformation(),paginginformation:this.getpaginginformation()}},getsortinformation:function(){return{sortcolumn:this.sortcolumn,sortdirection:this.sortdirection}},getpaginginformation:function(){return{pagenum:this.dataview.pagenum,pagesize:this.pagesize,pagescount:Math.ceil(this.dataview.totalrecords/this.pagesize)}},_updaterowsproperties:function(){this._updatehiddenrows();this._updaterowheights();this._updaterowdetails()},_updatehiddenrows:function(){var e=this.that;this.hiddens=new Array();var d=this.hiddenboundrows;b.each(d,function(g){if(this.index!=undefined){var f=this.index;var h=e.getrowvisibleindex(g);e.hiddens[h]=this.hidden}})},_updaterowheights:function(){var e=this.that;this.heights=new Array();var d=this.heightboundrows;b.each(d,function(g){if(this.index!=undefined){var f=this.index;var h=e.getrowvisibleindex(g);e.heights[h]=this.height}})},_updaterowdetails:function(){var d=this.that;this.details=new Array();var e=this.detailboundrows;b.each(e,function(g){if(this.index!=undefined){var f=this.index;var h=d.getrowvisibleindex(g);d.details[h]=this.details}})},_getmenuitembyindex:function(d){if(d==undefined){return null}return this.menuitemsarray[d]},_closemenu:function(){if(this._hasOpenedMenu){if(this.gridmenu!=null){this.gridmenu.jqxMenu("close")}var h=b.data(document.body,"contextmenu"+this.element.id);var e=16;if(h!=null&&this.autoshowcolumnsmenubutton){if(this.enableanimations){b(h.columnsmenu).animate({"margin-left":0},"fast",function(){b(h.columnsmenu).css("display","none")});var g=!this.rtl?-32:0;h.column.iconscontainer.animate({"margin-left":g},"fast")}else{b(h.columnsmenu).css("display","none");var g=!this.rtl?-32:0;h.column.iconscontainer.css("margin-left",g)}b.data(document.body,"contextmenu"+this.element.id,null)}this._hasOpenedMenu=false;var j=this._getmenuitembyindex(5);if(j){var i=b(j).find("#filter1"+this.element.id);var d=b(j).find("#filter2"+this.element.id);var f=b(j).find("#filter3"+this.element.id);if(i.length>0&&this.filtermode==="default"){i.jqxDropDownList("hideListBox");d.jqxDropDownList("hideListBox");f.jqxDropDownList("hideListBox")}}}},scrolloffset:function(e,d){if(e==null||d==null||e==undefined||d==undefined){return}this.vScrollBar.jqxScrollBar("setPosition",e);this.hScrollBar.jqxScrollBar("setPosition",d)},scrollleft:function(d){if(d==null||d==undefined){return}if(this.hScrollBar.css("visibility")!="hidden"){this.hScrollBar.jqxScrollBar("setPosition",d)}},scrolltop:function(d){if(d==null||d==undefined){return}if(this.vScrollBar.css("visibility")!="hidden"){this.vScrollBar.jqxScrollBar("setPosition",d)}},beginupdate:function(){this._updating=true;this._datachanged=false},endupdate:function(){this.resumeupdate()},resumeupdate:function(){this._updating=false;if(this._datachanged==true){var d=this.vScrollInstance.value;this.render(true,true,false);this._datachanged=false;if(d!=0&&d<this.vScrollInstance.max){this.scrolltop(d)}}else{this.rendergridcontent(true);this._renderrows(this.virtualsizeinfo)}},updating:function(){return this._updating},showloadelement:function(){if(this.renderloadelement){this.dataloadelement.html(this.renderloadelement())}b(this.dataloadelement).css("visibility","visible");b(this.dataloadelement).css("display","block")},hideloadelement:function(){b(this.dataloadelement).css("visibility","hidden");b(this.dataloadelement).css("display","none")},_updatefocusedfilter:function(){var d=this.that;if(d.focusedfilter){d.focusedfilter.focus();setTimeout(function(){d.focusedfilter.focus();if(d.focusedfilter[0].nodeName.toLowerCase()=="input"){var g=d.focusedfilter.val().length;try{if("selectionStart" in d.focusedfilter[0]){d.focusedfilter[0].setSelectionRange(g,g)}else{var e=d.focusedfilter[0].createTextRange();e.collapse(true);e.moveEnd("character",g);e.moveStart("character",g);e.select()}}catch(f){}}},10)}},databind:function(g,i){if(this.loadingstate===true){return}if(this.host.css("display")=="block"){if(this.autoshowloadelement){b(this.dataloadelement).css("visibility","visible");b(this.dataloadelement).css("display","block");this.dataloadelement.width(this.host.width());this.dataloadelement.height(this.host.height());this._hideemptyrow()}else{b(this.dataloadelement).css("visibility","hidden");b(this.dataloadelement).css("display","none")}}if(!this._initgroupsheader&&this.groups.length>0){this.groups=new Array()}var f=this.that;if(g==null){g={}}if(!g.recordstartindex){g.recordstartindex=0}if(!g.recordendindex){g.recordendindex=0}if(g.loadallrecords==undefined||g.loadallrecords==null){g.loadallrecords=true}if(g.sortcomparer==undefined||g.sortcomparer==null){g.sortcomparer=null}if(g.filter==undefined||g.filter==null){g.filter=null}if(g.sort==undefined||g.sort==null){g.sort=null}if(g.data==undefined||g.data==null){g.data=null}var d=null;if(g!=null){d=g._source!=undefined?g._source.url:g.url}this.dataview=this.dataview||new b.jqx.dataview();if(b.jqx.dataview.sort){b.extend(this.dataview,new b.jqx.dataview.sort())}if(b.jqx.dataview.grouping){b.extend(this.dataview,new b.jqx.dataview.grouping())}this.dataview.suspendupdate();this.dataview.pageable=this.pageable;this.dataview.groupable=this.groupable;this.dataview.groups=this.groups;this.dataview.virtualmode=this.virtualmode;this.dataview.grid=this;this.dataview._clearcaches();if(!this.pageable&&this.virtualmode){this.loadondemand=true}if(!f.initializedcall){if(g._source){if(this.sortable){if(g._source.sortcolumn!=undefined){this.sortcolumn=g._source.sortcolumn;this.source.sortcolumn=this.sortcolumn;this.dataview.sortfield=g._source.sortcolumn;g._source.sortcolumn=null}if(g._source.sortdirection!=undefined){this.dataview.sortfielddirection=g._source.sortdirection;var h=g._source.sortdirection;if(h=="a"||h=="asc"||h=="ascending"||h==true){var e=true}else{var e=false}if(h!=null){this.sortdirection={ascending:e,descending:!e}}else{this.sortdirection={ascending:false,descending:false}}}}}if(this.pageable){if(g._source){if(g._source.pagenum!=undefined){this.dataview.pagenum=g._source.pagenum}if(g._source.pagesize!=undefined){this.pagesize=g._source.pagesize;this.dataview.pagesize=g._source.pagesize}else{this.dataview.pagesize=g._source.pagesize;if(this.dataview.pagesize==undefined){this.dataview.pagesize=this.pagesize}}}}if(this.sortable){if(g.sortcolumn){this.dataview.sortfield=g.sortcolumn}if(g.sortdirection){this.dataview.sortfielddirection=g.sortdirection}}if(this.autoloadstate){if(this.loadstate){this.loadstate(null,true)}}}this._loading=true;this.dataview.update=function(l){if(!f.pageable&&f.virtualmode){f.loadondemand=true}f._loading=false;if(f.dataview.isupdating()){f.dataview.resumeupdate(false)}if(f.pageable&&f.pagerrenderer){if(f._initpager){f._initpager()}else{throw new Error("jqxGrid: Missing reference to jqxgrid.pager.js.")}}if((f.source.sortcolumn)&&f.sortby&&!f.virtualmode){f.render();if(!f.source._source.sort){f.sortby(f.source.sortcolumn,f.source.sortdirection,f.source.sortcomparer)}f.source.sortcolumn=null}else{var k=f.vScrollInstance.value;var n=f.hScrollInstance.value;var o=f.source.datatype;if(o!="local"||o!="array"){var p=f.virtualsizeinfo==null||(f.virtualsizeinfo!=null&&f.virtualsizeinfo.virtualheight==0);if(i=="cells"){var m=false;if(f.filterable&&f._initfilterpanel&&f.dataview.filters.length){m=true}if(false==l){if(!f.vScrollInstance.isScrolling()&&!f.hScrollInstance.isScrolling()){f._cellscache=new Array();f._pagescache=new Array();f._renderrows(f.virtualsizeinfo);if(f.showfilterrow&&f.filterable&&f.filterrow){f._updatelistfilters(true)}if(f.showaggregates&&f._updateaggregates){f._updateaggregates()}}if(f.autoshowloadelement){b(f.dataloadelement).css("visibility","hidden");b(f.dataloadelement).css("display","none")}return}else{if(m){i="filter"}else{if(f.sortcolumn!=undefined){i="sort"}}}}if(!f.virtualmode||p||(f.virtualmode&&f.pageable)){if(f.initializedcall==true&&i=="pagechanged"){k=0;if(f.groupable&&f.groups.length>0){f._render(true,true,false,false,false);f._updatecolumnwidths();f._updatecellwidths();f._renderrows(f.virtualsizeinfo)}else{f.rendergridcontent(true);if(f.pageable&&f.updatepagerdetails){f.updatepagerdetails();if(f.autoheight){f._updatepageviews();if(f.autorowheight){f._renderrows(this.virtualsizeinfo)}}else{if(f.autorowheight){f._updatepageviews();f._renderrows(this.virtualsizeinfo)}}}}if(f.showaggregates&&f._updateaggregates){f._updateaggregates()}}else{if(i=="filter"){f._render(true,true,false,false,false);f._updatefocusedfilter();f._updatecolumnwidths();f._updatecellwidths();f._renderrows(f.virtualsizeinfo)}else{if(i=="sort"){f.rendergridcontent(true);if(f.showaggregates&&f._updateaggregates){f._updateaggregates()}}else{if(i=="data"){f._render(true,true,false,false,false)}else{if(i=="state"){f._render(true,true,false,f.menuitemsarray&&f.menuitemsarray.length>0&&!f.virtualmode)}else{f._render(true,true,true,f.menuitemsarray&&f.menuitemsarray.length>0&&!f.virtualmode)}}}}}}else{if(f.virtualmode&&l==true&&!f.pageable){f._render(true,true,false,false,false);f._updatefocusedfilter();f._updatecolumnwidths();f._updatecellwidths();f._renderrows(f.virtualsizeinfo)}else{if(f.virtualmode&&!f.pageable&&l==false&&i!=undefined){f.rendergridcontent(true);if(f.showaggregates&&f._updateaggregates){f._updateaggregates()}}else{if(f.virtualmode&&f.dataview.totalrecords==0&&f.dataview.filters.length>0){f._render(true,true,true,f.menuitemsarray&&!f.virtualmode)}else{f._pagescache=new Array();f._renderrows(f.virtualsizeinfo)}}}}if(f.vScrollInstance.value!=k&&k<=f.vScrollInstance.max){f.vScrollInstance.setPosition(k)}if(f.hScrollInstance.value!=n&&n<=f.hScrollInstance.max){f.hScrollInstance.setPosition(n)}}}if(f.autoshowloadelement){b(f.dataloadelement).css("visibility","hidden");b(f.dataloadelement).css("display","none")}if(f.pageable){if(f.pagerrightbutton){f.pagerrightbutton.jqxButton({disabled:false});f.pagerleftbutton.jqxButton({disabled:false});f.pagershowrowscombo.jqxDropDownList({disabled:false})}}f._raiseEvent(11);if(!f.initializedcall){f._raiseEvent(0);f.initializedcall=true;if(f.ready){f.ready()}if(f.autoloadstate){if(f.loadstate){f._loadselectionandcolumnwidths()}}if((f.width!=null&&f.width.toString().indexOf("%")!=-1)||(f.height!=null&&f.height.toString().indexOf("%")!=-1)){}if(f.host.css("visibility")=="hidden"){var j=b.jqx.browser.msie&&b.jqx.browser.version<8;if(f.vScrollBar.css("visibility")=="visible"){f.vScrollBar.css("visibility","inherit")}if(!f.autowidth){if(f.hScrollBar.css("visibility")=="visible"){f.hScrollBar.css("visibility","inherit")}}f._intervalTimer=setInterval(function(){if(f.host.css("visibility")=="visible"){f._updatesize(true);clearInterval(f._intervalTimer)}},100)}}else{f._updateTouchScrolling()}};this.dataview.databind(g);if(this.dataview.isupdating()){if(d!=undefined){this.dataview.suspend=false}else{this.dataview.resumeupdate(false)}}this._initializeRows()},scrollto:function(e,d){if(undefined!=e){this.hScrollInstance.setPosition(e)}if(undefined!=d){this.vScrollInstance.setPosition(d)}},scrollposition:function(){return{top:this.vScrollInstance.value,left:this.hScrollInstance.value}},ensurerowvisible:function(h){if(this.autoheight&&!this.pageable){return true}var e=this._getpagesize();var g=Math.floor(h/e);if(!this._pageviews[g]&&!this.pageable){this._updatepageviews()}if(this.groupable&&this.groups.length>0){return true}var n=false;if(this.pageable&&this.gotopage&&!this.virtualmode){var g=Math.floor(h/e);if(this.dataview.pagenum!=g){if(this.groupable&&this.groups.length>0){return true}this.gotopage(g);n=true}}var l=this.vScrollInstance.value;var m=this._gettableheight()-this.rowsheight;var d=e*(h/e-g);d=Math.round(d);if(this._pageviews[g]){var k=this._pageviews[g].top;var j=k+d*this.rowsheight;if(this.rowdetails){for(var f=e*g;f<h;f++){if(this.details[f]){if(this.details[f].rowdetailshidden==false){j+=this.details[f].rowdetailsheight}}}}if(this.scrollmode=="deferred"){if(this.vScrollInstance.max<=j+this.rowsheight){j=this.vScrollInstance.max}}if(j<l){this.scrolltop(j);n=true}else{if(j>l+m+2){this.scrolltop(j-m);n=true}}}else{if(this.pageable){var j=d*this.rowsheight;if(this.rowdetails){for(var f=e*g;f<e*g+d;f++){if(this.details[f]&&this.details[f].rowdetailshidden==false){j+=this.details[f].rowdetailsheight}}}if(j<l||j>l+m){this.scrollto(0,j);n=true}}}return n},ensurecellvisible:function(h,d){var n=this.that;var i=this.hScrollBar.jqxScrollBar("value");var j=n.hScrollInstance.max;if(n.rtl){if(this.hScrollBar.css("visibility")!="visible"){j=0}}var o=this.ensurerowvisible(h);var e=0;if(this.columns.records){var m=i;if(this.hScrollBar.css("visibility")=="hidden"){return}var l=this.host.width();var k=0;var f=this.vScrollBar.css("visibility")=="visible"?20:0;var g=false;b.each(this.columns.records,function(){if(this.datafield==d){var q=0;var p=!n.rtl?m:j-i;if(e+this.width>p+l-f){q=e+this.width-l+f;if(n.rtl){q=j-q}n.scrollleft(q);g=true}else{if(e<=p){q=e-this.width;if(n.rtl){q=j-q}n.scrollleft(q);g=true}}if(k==0){if(n.rtl){n.scrollleft(j)}else{n.scrollleft(0)}g=true}else{if(k==n.columns.records.length-1){if(n.hScrollBar.css("visibility")=="visible"){if(!n.rtl){n.scrollleft(n.hScrollBar.jqxScrollBar("max"))}else{n.scrollleft(n.hScrollBar.jqxScrollBar("min"))}g=true}}}return false}k++;e+=this.width});if(!g){n.scrollleft(m)}}return o},setrowheight:function(e,d){if(this._loading){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}if(e==null||d==null){return false}this.heightboundrows[e]={index:e,height:d};e=this.getrowvisibleindex(e);if(e<0){return false}if(this.rows.records[e]){this.rows.records[e].height=d}else{row=new a(this,null);row.height=d;this.rows.replace(e,row)}this.heights[e]=d;this.rendergridcontent(true);return true},getrowheight:function(d){if(d==null){return null}d=this.getrowvisibleindex(d);if(d<0){return false}if(this.rows.records[d]){return this.rows.records[d].height}},setrowdetails:function(f,h,d,j){if(f==undefined||f==null||f<0){return}var e=f+"_";if(this._rowdetailscache[e]){var g=this._rowdetailscache[e].element;b(g).remove();this._rowdetailscache[e]=null}var i=this.dataview.generatekey();this.detailboundrows[f]={index:f,details:{rowdetails:h,rowdetailsheight:d,rowdetailshidden:j,key:i}};f=this.getrowvisibleindex(f);if(f<0){return false}return this._setrowdetails(f,h,d,j,i)},getcolumn:function(d){var e=null;if(this.columns.records){b.each(this.columns.records,function(){if(this.datafield==d||this.displayfield==d){e=this;return false}})}return e},_getcolumnindex:function(e){var d=-1;if(this.columns.records){b.each(this.columns.records,function(){d++;if(this.datafield==e){return false}})}return d},_getcolumnat:function(d){var e=this.columns.records[d];return e},_getprevvisiblecolumn:function(e){var d=this.that;while(e>0){e--;var f=d.getcolumnat(e);if(!f){return null}if(!f.hidden){return f}}return null},_getnextvisiblecolumn:function(e){var d=this.that;while(e<this.columns.records.length){e++;var f=d.getcolumnat(e);if(!f){return null}if(!f.hidden){return f}}return null},getcolumnat:function(d){if(!isNaN(d)){var e=this.columns.records[d];return e}return null},_getcolumn:function(d){var e=null;b.each(this._columns,function(){if(this.datafield==d||this.displayfield==d){e=this;return false}});return e},_setcolumnproperty:function(e,g,h){if(e==null||g==null||h==null){return null}g=g.toLowerCase();var f=this.getcolumn(e);if(f==null){return}var i=f[g];f[g]=h;var d=this._getcolumn(e);if(d!=null){d[g]=h}this._cellscache=new Array();switch(g){case"filteritems":if(this.filterable&&this.showfilterrow){this._updatelistfilters(true,true)}break;case"text":this.prerenderrequired=true;this._rendercolumnheaders();this._updatecellwidths();if(this._groupsheader()){if(this._initgroupsheader){this._initgroupsheader()}}this._renderrows(this.virtualsizeinfo);break;case"editable":case"resizable":case"draggable":if(g=="editable"){if(h!=i){if(this.editcell!=null&&this.endcelledit){this.endcelledit(this.editcell.row,this.editcell.column,true,true)}if(f.columntype=="checkbox"){this.prerenderrequired=true;this.rendergridcontent(true,false);if(this.updating()){return false}}if(this.updating()){return false}this._renderrows(this.virtualsizeinfo)}}break;case"hidden":case"hideable":case"renderer":case"cellsrenderer":case"align":case"aggregates":case"cellsalign":case"cellsformat":case"pinned":case"contenttype":case"filterable":case"groupable":case"cellclass":case"cellclassname":case"class":this.prerenderrequired=true;this.rendergridcontent(true);if(this.updating()){return false}this._renderrows(this.virtualsizeinfo);if(this.showaggregates&&this._updateaggregates){this._updateaggregates()}break;case"width":case"minwidth":case"maxwidth":if(this.updating()){return false}f._width=null;this._updatecolumnwidths();this._updatecellwidths();this._renderrows(this.virtualsizeinfo);break}},_getcolumnproperty:function(d,f){if(d==null||f==null){return null}f=f.toLowerCase();var e=this.getcolumn(d);return e[f]},setcolumnproperty:function(d,e,f){this._setcolumnproperty(d,e,f)},getcolumnproperty:function(d,e){return this._getcolumnproperty(d,e)},hidecolumn:function(d){this._setcolumnproperty(d,"hidden",true)},showcolumn:function(d){this._setcolumnproperty(d,"hidden",false)},iscolumnvisible:function(d){return !this._getcolumnproperty(d,"hidden")},pincolumn:function(d){this._setcolumnproperty(d,"pinned",true)},unpincolumn:function(d){this._setcolumnproperty(d,"pinned",false)},iscolumnpinned:function(d){return this._getcolumnproperty(d,"pinned")},_setrowdetails:function(j,d,n,h,e){if(n==0){n=100}if(j==null||n==null){return false}if(e!=null){this.details[j]={rowdetails:d,rowdetailsheight:n,rowdetailshidden:h,detailskey:e}}else{var m=this.details[j]!=null?this.details[j].detailskey:null;var l={rowdetails:d,rowdetailsheight:n,rowdetailshidden:h,detailskey:m};var k=this.that;for(var g=0;g<this.detailboundrows.length;g++){if(this.detailboundrows[g]!=undefined){var f=this.detailboundrows[g];if(f.details.detailskey==m){f.details.rowdetailsheight=l.rowdetailsheight;f.details.rowdetailshidden=l.rowdetailshidden;f.details.rowdetails=l.rowdetails;break}}}this.details[j]=l}this.rendergridcontent(true);this._updatecolumnwidths();this._updatecellwidths();this._renderrows(this.virtualsizeinfo);return true},getrowdetails:function(d){if(d==null){return false}d=this.getrowvisibleindex(d);return this._getrowdetails(d)},_getrowdetails:function(d){if(d==null){return false}if(d<0){return false}if(this.details[d]){return this.details[d]}if(this.rowdetailstemplate){return this.rowdetailstemplate}},getrecordscount:function(){return this.dataview.totalrecords},showrowdetails:function(d){if(this._loading){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}if(d==null){return false}d=this.getrowvisibleindex(d);if(d<0){return false}var e=this._getrowdetails(d);return this._setrowdetailsvisibility(d,e,false)},hiderowdetails:function(d){if(this._loading){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}d=this.getrowvisibleindex(d);if(d<0){return false}var e=this._getrowdetails(d);return this._setrowdetailsvisibility(d,e,true)},_togglerowdetails:function(i){var f=i.visibleindex;var g=this._getrowdetails(f);if(g!=null){var e=this.vScrollInstance.value;var h=!g.rowdetailshidden;var d=this._setrowdetailsvisibility(f,g,h);if(e!==0&&this.vScrollBar.css("visibility")!=="hidden"){if(e<=this.vScrollInstance.max){this.vScrollInstance.setPosition(e)}else{this.vScrollInstance.setPosition(this.vScrollInstance.max)}}return d}return false},_setrowdetailsvisibility:function(e,f,h){if(this.rowdetailstemplate){if(!this.details){this.details=new Array()}if(!this.details[e]){this.details[e]={rowdetailshidden:this.rowdetailstemplate.rowdetailshidden,rowdetailsheight:this.rowdetailstemplate.rowdetailsheight,rowdetails:this.rowdetailstemplate.rowdetails};var g=this.dataview.generatekey();this.details[e].detailskey=g;this.detailboundrows[e]={index:e,details:this.details[e]}}}if(f!=null){this.details[e].rowdetailshidden=h}else{return false}var d=this.details[e];if(h){this._raiseEvent(21,{rowindex:e,details:d.rowdetails,height:d.rowdetailsheight})}else{this._raiseEvent(20,{rowindex:e,details:d.rowdetails,height:d.rowdetailsheight})}return this._setrowdetails(e,d.rowdetails,d.rowdetailsheight,d.rowdetailshidden)},getrowvisibleindex:function(d){if(d==undefined||d==null||d<0){return false}if(this.virtualmode){var e=this.dataview.loadedrecords[d];if(e==undefined){return -1}return e.visibleindex}return this.getrowdisplayindex(d)},hiderow:function(d){if(this._loading){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}if(d==undefined||d==null||d<0){return false}if(d==null){return false}this.hiddenboundrows[d]={index:d,hidden:true};d=this.getrowvisibleindex(d);return this._setrowvisibility(d,true)},showrow:function(d){if(this._loading){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}if(d==undefined||d==null||d<0){return false}if(d==null){return false}this.hiddenboundrows[d]={index:d,hidden:false};d=this.getrowvisibleindex(d);return this._setrowvisibility(d,false)},isrowhiddenat:function(d){if(d==null){return null}d=this.getrowvisibleindex(d);if(this.rows.records[d]){return this.rows.records[d].hidden}},_setrowvisibility:function(d,f,e){if(d==null){return false}this.hiddens[d]=f;if(e==undefined||e){this.rendergridcontent(true);return true}return false},_loadrows:function(){if(!this._pageviews[this.dataview.pagenum]&&!this.pageable){return}var p=!this.pageable?this._pageviews[this.dataview.pagenum].top:0;if(!this.pageable&&this._pagescache[this.dataview.pagenum]!=undefined){return null}if(!this.virtualsizeinfo){return}var t=this.that;var l=new Array();var q=new Array();var e=t.groupable&&t.groups.length>0;var j=this.dataview.totalrecords;var o=this.virtualsizeinfo.virtualheight;var s=0;this.rows.beginupdate();var f=this.dataview.pagesize;if(this.pageable&&e){f=this.dataview.rows.length}for(var g=0;g<f;g++){if(g>=this.dataview.rows.length){break}var k=this.dataview.rows[g];var u=null;if(!t.rows.records[k.visibleindex]){u=new a(t,k)}else{u=t.rows.records[k.visibleindex];u.setdata(k)}u.hidden=this.hiddens[u.visibleindex];if(this.rowdetailstemplate){u.rowdetails=this.rowdetailstemplate.rowdetails;u.rowdetailsheight=this.rowdetailstemplate.rowdetailsheight;u.rowdetailshidden=this.rowdetailstemplate.rowdetailshidden}var d=this.details[u.visibleindex];if(d){u.rowdetails=d.rowdetails;u.rowdetailsheight=d.rowdetailsheight;u.rowdetailshidden=d.rowdetailshidden}else{if(!this.rowdetailstemplate){u.rowdetails=null}}if(e&&this.pageable&&u.parentbounddata!=null){var r=l[u.parentbounddata.uniqueid];if(r!=null){var n=this._findgroupstate(r.uniqueid);if(this._setsubgroupsvisibility){this._setsubgroupsvisibility(this,u.parentbounddata,!n,false)}u.hidden=this.hiddens[u.visibleindex]}if(r!=null&&r!=undefined){u.parentrow=r;r.subrows[r.subrows.length++]=u}}if(u.hidden){continue}var h=k.visibleindex;if(!this.heights[h]){this.heights[h]=this.rowsheight}u.height=this.heights[h];if(this.rowdetails){if(u.rowdetails&&!u.rowdetailshidden){u.height+=u.rowdetailsheight}}l[u.uniqueid]=u;q[s++]=u;u.top=p;p+=u.height;var m=h;t.rows.replace(m,u)}if((this.autoheight||this.pageable)&&this.autorowheight){if(this._pageviews&&this._pageviews.length>0){this._pageviews[0].height=p}}this.rows.resumeupdate();if(q.length>0){this._pagescache[this.dataview.pagenum]=q}},_gettableheight:function(){if(this.tableheight!=undefined){return this.tableheight}var e=this.host.height();if(this.columnsheader){var d=this.columnsheader.outerHeight();if(!this.showheader){d=0}}e-=d;if(this.hScrollBar[0].style.visibility=="visible"){e-=this.hScrollBar.outerHeight()}if(this.pageable){e-=this.pager.outerHeight()}if(this._groupsheader()){e-=this.groupsheader.outerHeight()}if(this.showtoolbar){e-=this.toolbarheight}if(this.showstatusbar){e-=this.statusbarheight}if(e>0){this.tableheight=e;return e}return this.host.height()},_getpagesize:function(){if(this.pageable){return this.pagesize}if(this.virtualmode){var e=Math.round(this.host.height())+2*this.rowsheight;var d=Math.round(e/this.rowsheight);return d}if(this.autoheight||this.autorowheight){if(this.dataview.totalrows==0){return 1}return this.dataview.totalrows}if(this.dataview.totalrows<100&&this.dataview.totalrecords<100&&this.dataview.totalrows>0){return this.dataview.totalrows}return 100},_calculatevirtualheight:function(){var n=this.that;var e=Math.round(this.host.height())+2*this.rowsheight;realheight=this._gettableheight();var p=Math.round(e/this.rowsheight);this.heights=new Array();this.hiddens=new Array();this.details=new Array();this.expandedgroups=new Array();this.hiddenboundrows=new Array();this.heightboundrows=new Array();this.detailboundrows=new Array();var h=Math.max(this.dataview.totalrows,this.dataview.totalrecords);if(this.pageable){h=this.pagesize;if(this.pagesize>Math.max(this.dataview.totalrows,this.dataview.totalrecords)&&this.autoheight){h=Math.max(this.dataview.totalrows,this.dataview.totalrecords)}else{if(!this.autoheight){if(this.dataview.totalrows<this.pagesize){h=Math.max(this.dataview.totalrows,this.dataview.totalrecords)}}}}var l=h*this.rowsheight;var m=0;var j=0;var k=0;var f=this._getpagesize();var d=f*this.rowsheight;var g=0;if(!this.pageable&&this.autoheight){p=h}if(h+f>0){while(g<=h+f){m+=d;if(g-f<h&&g>=h){var o=g-h;if(o>0){k-=d;this._pageviews[j-1]={top:k,height:d-o*this.rowsheight}}break}else{this._pageviews[j++]={top:k,height:d}}k=m;g+=f}}if(this.resizingGrid!=true){this.vScrollBar.jqxScrollBar({value:0})}if(l>realheight&&!this.autoheight){this.vScrollBar.css("visibility","visible");if(this.scrollmode=="deferred"){this.vScrollBar.jqxScrollBar({max:l})}else{this.vScrollBar.jqxScrollBar({max:l-realheight})}}else{this.vScrollBar.css("visibility","hidden")}this.dataview.pagesize=f;this.dataview.updateview();return{visiblerecords:p,virtualheight:l}},_updatepageviews:function(){if(this.updating()){return}this._pagescache=new Array();this._pageviews=new Array();this.tableheight=null;var u=this.that;var d=Math.round(this.host.height())+2*this.rowsheight;var v=Math.round(d/this.rowsheight);var n=Math.max(this.dataview.totalrows,this.dataview.totalrecords);var q=n*this.rowsheight;var t=0;var f=0;var o=0;var p=0;var j=0;var h=this._getpagesize();if(!this.pageable){for(var m=0;m<n;m++){var s={index:m,height:this.heights[m],hidden:this.hiddens[m],details:this.details[m]};if(this.heights[m]==undefined){this.heights[m]=this.rowsheight;s.height=this.rowsheight}if(this.hiddens[m]==undefined){this.hiddens[m]=false;s.hidden=false}if(this.details[m]==undefined){this.details[m]=null}if(s.height!=u.rowsheight){q-=u.rowsheight;q+=s.height}if(s.hidden){q-=s.height}else{f+=s.height;var l=0;if(this.rowdetails){if(this.rowdetailstemplate){if(!s.details){s.details=this.rowdetailstemplate}}if(s.details&&s.details.rowdetails&&!s.details.rowdetailshidden){l=s.details.rowdetailsheight;f+=l;q+=l}}t+=s.height+l}j++;if(j>=h||m==n-1){this._pageviews[o++]={top:p,height:f};f=0;p=t;j=0}}}else{if(this._updatepagedview){q=this._updatepagedview(n,q,0)}if(this.autoheight){this._arrange()}}var e=this._gettableheight();if(q>e){if(this.pageable&&this.gotopage){q=this._pageviews[0].height;if(q<0){q=this._pageviews[0].height}}if(this.vScrollBar.css("visibility")!="visible"){this.vScrollBar.css("visibility","visible")}if(q<=e||this.autoheight){this.vScrollBar.css("visibility","hidden")}if(q-e>0){if(this.scrollmode!="deferred"){var r=q-e;var g=this.vScrollInstance.max;this.vScrollBar.jqxScrollBar({max:r});if(r!=g){this.vScrollBar.jqxScrollBar({value:0})}}}else{this.vScrollBar.jqxScrollBar({value:0,max:q})}}else{if(!this._loading){this.vScrollBar.css("visibility","hidden")}this.vScrollBar.jqxScrollBar({value:0})}this._arrange();if(this.autoheight){v=Math.round(this.host.height()/this.rowsheight)}this.virtualsizeinfo={visiblerecords:v,virtualheight:q}},updatebounddata:function(d){this.databind(this.source,d)},refreshdata:function(){this._refreshdataview();this.render()},_updatevscrollbarmax:function(){if(this._pageviews&&this._pageviews.length>0){var f=this._pageviews[0].height;if(this.virtualmode){f=this.virtualsizeinfo.virtualheight}var e=this._gettableheight();if(f>e){if(this.pageable&&this.gotopage){f=this._pageviews[0].height;if(f<0){f=this._pageviews[0].height}}if(this.vScrollBar.css("visibility")!="visible"){this.vScrollBar.css("visibility","visible")}if(f<=e||this.autoheight){this.vScrollBar.css("visibility","hidden")}if(f-e>0){var d=f-e;this.vScrollBar.jqxScrollBar({max:d})}else{this.vScrollBar.jqxScrollBar({value:0,max:f})}}else{this.vScrollBar.css("visibility","hidden");this.vScrollBar.jqxScrollBar({value:0})}}},_refreshdataview:function(){this.dataview.refresh()},refresh:function(d){if(d!=true){if(b.jqx.isHidden(this.host)){return}if(this.virtualsizeinfo!=null){this._cellscache=new Array();this._renderrows(this.virtualsizeinfo);this._updatesize()}}},render:function(){this._render(true,true,true,true)},invalidate:function(){if(this.virtualsizeinfo){this._updatecolumnwidths();this._updatecellwidths();this._renderrows(this.virtualsizeinfo)}},clear:function(){this.databind(null);this.render()},_preparecolumngroups:function(){var o=this.columnsheight;if(this.columngroups){this.columnshierarchy=new Array();if(this.columngroups.length){var n=this;for(var h=0;h<this.columngroups.length;h++){this.columngroups[h].parent=null;this.columngroups[h].groups=null}for(var h=0;h<this.columns.records.length;h++){this.columns.records[h].parent=null;this.columns.records[h].groups=null}var p=function(j){for(var u=0;u<n.columngroups.length;u++){var v=n.columngroups[u];if(v.name===j){return v}}return null};for(var h=0;h<this.columngroups.length;h++){var q=this.columngroups[h];if(!q.groups){q.groups=null}if(q.parentgroup){var s=p(q.parentgroup);if(s){q.parent=s;if(!s.groups){s.groups=new Array()}if(s.groups.indexOf(q)===-1){s.groups.push(q)}}}}for(var h=0;h<this.columns.records.length;h++){var q=this.columns.records[h];if(q.columngroup){var s=p(q.columngroup);if(s){if(!s.groups){s.groups=new Array()}q.parent=s;if(s.groups.indexOf(q)===-1){s.groups.push(q)}}}}var r=0;for(var h=0;h<this.columns.records.length;h++){var q=this.columns.records[h];var e=q;q.level=0;while(e.parent){e=e.parent;q.level++}var e=q;var d=q.level;r=Math.max(r,q.level);while(e.parent){e=e.parent;if(e){e.level=--d}}}var m=function(y){var x=new Array();if(y.columngroup){x.push(y)}for(var w=0;w<y.groups.length;w++){if(y.groups[w].columngroup){x.push(y.groups[w])}else{if(y.groups[w].groups){var v=m(y.groups[w]);for(var u=0;u<v.length;u++){x.push(v[u])}}}}return x};for(var h=0;h<this.columngroups.length;h++){var q=this.columngroups[h];var f=m(q);q.columns=f;var k=new Array();var t=0;for(var g=0;g<f.length;g++){k.push(this.columns.records.indexOf(f[g]));if(f[g].pinned){t++}}if(t!=0){throw new Error("jqxGrid: Column Groups initialization Error. Please, check the initialization of the jqxGrid's columns array. The columns in a column group cannot be pinned.")}k.sort(function(j,i){j=parseInt(j);i=parseInt(i);if(j<i){return -1}if(j>i){return 1}return 0});for(var l=1;l<k.length;l++){if(k[l]!=k[l-1]+1){throw new Error("jqxGrid: Column Groups initialization Error. Please, check the initialization of the jqxGrid's columns array. The columns in a column group are expected to be siblings in the columns array.");this.host.remove()}}}}this.columngroupslevel=1+r;o=this.columngroupslevel*this.columnsheight}return o},_render:function(h,j,g,d,f){if(this.dataview==null){return}if(this._loading){return}if(b.jqx.isHidden(this.host)){var i=this;if(i.___hiddenTimer){clearInterval(i.___hiddenTimer);i.___hiddenTimer=null}this.___hiddenTimer=setInterval(function(){if(!b.jqx.isHidden(i.host)){clearInterval(i.___hiddenTimer);i._render(h,j,g,d,f)}},300);return}if(this.editcell!=null&&this.endcelledit){this.endcelledit(this.editcell.row,this.editcell.column,true,false)}this.validationpopup=null;this._removeHandlers();this._addHandlers();this._initializeRows();this._requiresupdate=j!=undefined?j:true;this._newmax=null;if(g){if(!this._requiresupdate){if(d!=false){this._initmenu()}}if(this.columns==null){this.columns=new b.jqx.collection(this.element)}else{this._initializeColumns()}}this.tableheight=null;this._pagescache=new Array();this._pageviews=new Array();this.visiblerows=new Array();this.hittestinfo=new Array();if(this._requiresupdate){this._clearcaches();if(d==true){this._initmenu()}}this.virtualsizeinfo=null;this.prerenderrequired=true;if((this.groupable&&this.groups.length>0&&this.rowdetails)||(this.rowdetails)){if(this.gridcontent){this._rowdetailscache=new Array();this._rowdetailselementscache=new Array();this.detailboundrows=new Array();this.details=new Array();b.jqx.utilities.html(this.gridcontent,"");this.gridcontent=null}}if(this.gridcontent){if(this.editable&&this._destroyeditors){this._destroyeditors()}}if(g){if(this.filterrow){this.filterrow.detach()}b.jqx.utilities.html(this.content,"");this.columnsheader=this.columnsheader||b('<div style="overflow: hidden;"></div>');this.columnsheader.remove();this.columnsheader.addClass(this.toTP("jqx-widget-header"));this.columnsheader.addClass(this.toTP("jqx-grid-header"))}else{if(this.gridcontent){b.jqx.utilities.html(this.gridcontent,"")}}if(!this.showheader){this.columnsheader.css("display","none")}else{if(this.columnsheader){this.columnsheader.css("display","block")}}this.gridcontent=this.gridcontent||b('<div style="width: 100%; overflow: hidden; position: absolute;"></div>');this.gridcontent.remove();var e=this.columnsheight;e=this._preparecolumngroups();if(this.showfilterrow&&this.filterable){this.columnsheader.height(e+this.filterrowheight)}else{this.columnsheader.height(e)}this.content.append(this.columnsheader);this.content.append(this.gridcontent);this._arrange();if(this._initgroupsheader){this._initgroupsheader()}this.selectionarea=this.selectionarea||b("<div style='z-index: 99999; visibility: hidden; position: absolute;'></div>");this.selectionarea.addClass(this.toThemeProperty("jqx-grid-selectionarea"));this.selectionarea.addClass(this.toThemeProperty("jqx-fill-state-pressed"));this.content.append(this.selectionarea);this.tableheight=null;this.rendergridcontent(false,g);if(this.groups.length>0&&this.groupable){this.suspendgroupevents=true;if(this.collapseallgroups){if(!this.groupsexpandedbydefault){this.collapseallgroups(false);this._updatescrollbarsafterrowsprerender()}else{this.expandallgroups(false)}}this.suspendgroupevents=false}if(this.pageable&&this.updatepagerdetails){this.updatepagerdetails();if(this.autoheight){this._updatepageviews()}if(this.autorowheight){if(!this.autoheight){this._updatepageviews()}this._renderrows(this.virtualsizeinfo)}}if(this.showaggregates&&this._updateaggregates){this._updateaggregates()}this._addoverlayelement();if(this.scrollmode=="deferred"){this._addscrollelement()}if(this.showfilterrow&&this.filterable&&this.filterrow&&(f==undefined||f==true)){this._updatelistfilters(!g)}if(this.rendered){this.rendered("full")}},_addoverlayelement:function(){if(this.autoheight){if(this._overlayElement){this._overlayElement.remove()}return}var d=b.jqx.utilities.getBrowser();if((d.browser=="msie"&&parseInt(d.version)<9)||this.isTouchDevice()){if(this._overlayElement){this._overlayElement.remove()}this._overlayElement=b("<div style='visibility: hidden; position: absolute; width: 100%; height: 100%;'></div>");this._overlayElement.css("background","white");this._overlayElement.css("z-index",18000);this._overlayElement.css("opacity",0.001);if(this.isTouchDevice()){if(this.vScrollBar.css("visibility")!=="hidden"||this.hScrollBar.css("visibility")!=="hidden"){var e=0;if(this.selectionmode=="checkbox"){e+=30}if(this.groupable||this.rowdetails){this._overlayElement.css("left",30*(this.groups.length+(this.rowdetails?1:0)))}var f=this._overlayElement.css("left");this._overlayElement.css("left",f+e)}else{if(this._overlayElement){this._overlayElement.remove()}}}else{this.content.prepend(this._overlayElement)}}this._updateTouchScrolling()},_addscrollelement:function(){if(this._scrollelement){this._scrollelement.remove()}if(this._scrollelementoverlay){this._scrollelementoverlay.remove()}this._scrollelementoverlay=b("<div style='visibility: hidden; position: absolute; width: 100%; height: 100%;'></div>");this._scrollelementoverlay.css("background","black");this._scrollelementoverlay.css("z-index",18000);this._scrollelementoverlay.css("opacity",0.1);this._scrollelement=b("<span style='visibility: hidden; top: 50%; right: 10px; position: absolute;'></span>");this._scrollelement.css("z-index",18005);this._scrollelement.addClass(this.toThemeProperty("jqx-button"));this._scrollelement.addClass(this.toThemeProperty("jqx-fill-state-normal"));this._scrollelement.addClass(this.toThemeProperty("jqx-rc-all"));this._scrollelement.addClass(this.toThemeProperty("jqx-shadow"));this.content.prepend(this._scrollelement);this.content.prepend(this._scrollelementoverlay)},rendergridcontent:function(d,f){if(this.updating()){return false}if(d==undefined||d==null){d=false}this._requiresupdate=d;var h=this.prerenderrequired;if(this.prerenderrequired){this._arrange()}var g=this.that;var f=f;if(f==null||f==undefined){f=true}this.tableheight=null;g.virtualsizeinfo=g.virtualsizeinfo||g._calculatevirtualheight();if(g.pageable&&!g.autoheight){if(g.dataview.totalrows<g.pagesize){g._requiresupdate=true}}if(f){g._rendercolumnheaders()}else{if(this._rendersortcolumn){this._rendersortcolumn()}if(this._renderfiltercolumn){this._renderfiltercolumn()}}g._renderrows(g.virtualsizeinfo);if(this.gridcontent){if(this.gridcontent[0].scrollTop!=0){this.gridcontent[0].scrollTop=0}if(this.gridcontent[0].scrollLeft!=0){this.gridcontent[0].scrollLeft=0}}if(h){var e=this.tableheight;this._arrange();if(e!=this.tableheight&&this.autoheight){g._renderrows(g.virtualsizeinfo)}}if(this.rtl){this._renderhorizontalscroll()}if(this.autosavestate){if(this.initializedcall!=null){if(this.savestate){this.savestate()}}}return true},_updatecolumnwidths:function(){var l=this.host.width();var e=l;var k="";if(this.columns==undefined||this.columns.records==undefined){return}var n=this.that;b.each(this.columns.records,function(o,p){if(!(this.hidden&&this.hideable)){if(this.width.toString().indexOf("%")!=-1||this._percentagewidth!=undefined){var p=0;var q=n.vScrollBar[0].style.visibility=="hidden"?0:n.scrollbarsize+5;p=parseInt(this.width)*e/100;if(this._percentagewidth!=undefined){p=parseInt(this._percentagewidth)*(e-q)/100}if(p<this.minwidth&&this.minwidth!="auto"){p=this.minwidth}if(p>this.maxwidth&&this.maxwidth!="auto"){p=this.maxwidth}l-=Math.round(p)}else{if(this.width!="auto"&&!this._width){l-=this.width}else{k+=this.text}}}});var f=this._gettableheight();if(!this.autoheight){if(this.virtualsizeinfo&&this.virtualsizeinfo.virtualheight>f){if(this.groupable&&this.groups.length>0){if(this.dataview&&this.dataview.loadedrootgroups&&!this.groupsexpandedbydefault){var m=this.dataview.loadedrootgroups.length*this.rowsheight;if(this.pageable){for(var d=0;d<this.dataview.rows.length;d++){if(this.dataview.rows[d].group&&this.dataview.rows[d].level===0){m+=this.rowsheight}}}if(m>f){l-=this.scrollbarsize+5;e-=this.scrollbarsize+5}else{if(this.vScrollBar.css("visibility")=="visible"){l-=this.scrollbarsize+5;e-=this.scrollbarsize+5}}}else{l-=this.scrollbarsize+5;e-=this.scrollbarsize+5}}else{l-=this.scrollbarsize+5;e-=this.scrollbarsize+5}}}var g=this.rowdetails&&this.showrowdetailscolumn?(1+this.groups.length)*this.groupindentwidth:(this.groups.length)*this.groupindentwidth;e-=g;var i=this.columnsheader.find("#columntable"+this.element.id);if(i.length==0){return}var j=i.find(".jqx-grid-column-header");var h=0;b.each(this.columns.records,function(p,t){var r=b(j[p]);var o=false;var s=this.width;if(this.width.toString().indexOf("%")!=-1||this._percentagewidth!=undefined){if(this._percentagewidth!=undefined){s=parseInt(this._percentagewidth)*e/100}else{s=parseInt(this.width)*e/100}o=true}if(this.width!="auto"&&!this._width&&!o){if(parseInt(r[0].style.width)!=this.width){r.width(this.width)}}else{if(o){if(s<this.minwidth&&this.minwidth!="auto"){s=this.minwidth;this.width=s}if(s>this.maxwidth&&this.maxwidth!="auto"){s=this.maxwidth;this.width=s}if(parseInt(r[0].style.width)!=s){r.width(s);this.width=s}}else{var q=Math.floor(l*(this.text.length/k.length));if(isNaN(q)){q=this.minwidth}if(q<0){$element=b("<span>"+this.text+"</span>");b(document.body).append($element);q=10+$element.width();$element.remove()}if(q<this.minwidth){q=this.minwidth}if(q>this.maxwidth){q=this.maxwidth}l-=q;k=k.substring(this.text.length);this._width="auto";this.width=q;r.width(this.width)}}if(parseInt(r[0].style.left)!=h){r.css("left",h)}if(!(this.hidden&&this.hideable)){h+=this.width}this._requirewidthupdate=true});this.columnsheader.width(2+h);i.width(this.columnsheader.width());this._resizecolumngroups();if(this.showfilterrow&&this.filterrow){this.filterrow.width(this.columnsheader.width());this._updatefilterrowui()}if(this.autowidth){this._arrange()}},_rendercolumnheaders:function(){var u=this.that;if(!this.prerenderrequired){if(this._rendersortcolumn){this._rendersortcolumn()}if(this._renderfiltercolumn){this._renderfiltercolumn()}if(this.showfilterrow&&this.filterrow){this.filterrow.width(this.columnsheader.width());this._updatefilterrowui()}return}this._columnsbydatafield=new Array();this.columnsheader.find("#columntable"+this.element.id).remove();var l=b('<div id="columntable'+this.element.id+'" style="height: 100%; position: relative;"></div>');l[0].cells=new Array();var x=0;var f=0;var r="";var C=this.host.width();var n=C;var e=new Array();var w=new Array();b.each(this.columns.records,function(j,k){if(!(this.hidden&&this.hideable)){if(this.width!="auto"&&!this._width){if(this.width<this.minwidth&&this.minwidth!="auto"){C-=this.minwidth}else{if(this.width>this.maxwidth&&this.maxwidth!="auto"){C-=this.maxwidth}else{if(this.width.toString().indexOf("%")!=-1){var k=0;var p=u.vScrollBar[0].style.visibility=="hidden"?0:u.scrollbarsize+5;k=parseInt(this.width)*(n-p)/100;if(k<this.minwidth&&this.minwidth!="auto"){k=this.minwidth}if(k>this.maxwidth&&this.maxwidth!="auto"){k=this.maxwidth}C-=k}else{if(typeof this.width=="string"){this.width=parseInt(this.width)}C-=this.width}}}}else{r+=this.text}}if(this.pinned||this.grouped||this.checkboxcolumn){if(u._haspinned){this.pinned=true}e[e.length]=this}else{w[w.length]=this}});if(!this.rtl){for(var z=0;z<e.length;z++){this.columns.replace(z,e[z])}for(var y=0;y<w.length;y++){this.columns.replace(e.length+y,w[y])}}else{var v=0;e.reverse();for(var z=this.columns.records.length-1;z>=this.columns.records.length-e.length;z--){this.columns.replace(z,e[v++])}for(var y=0;y<w.length;y++){this.columns.replace(y,w[y])}}var h=this.headerZIndex;var m=u.groupable?u.groups.length:0;if(this.rowdetails&&this.showrowdetailscolumn){m++}var g=u.columnsheader.height();if(this.showfilterrow){if(!this.columngroups){g=this.columnsheight}else{g-=this.filterrowheight}}var s=this._gettableheight();if(this.virtualsizeinfo&&this.virtualsizeinfo.virtualheight>s){if(this.groupable&&this.groups.length>0){if(this.dataview&&this.dataview.loadedrootgroups&&!this.groupsexpandedbydefault){var A=0;if(!this.pageable){var A=this.dataview.loadedrootgroups.length*this.rowsheight}else{if(this.pageable){for(var t=0;t<this.dataview.rows.length;t++){if(this.dataview.rows[t].group&&this.dataview.rows[t].level===0){A+=this.rowsheight}}}}if(A>s){C-=this.scrollbarsize+5;n-=this.scrollbarsize+5}}else{C-=this.scrollbarsize+5;n-=this.scrollbarsize+5}}else{if(!this.autoheight){C-=this.scrollbarsize+5;n-=this.scrollbarsize+5}}}var o=this.rowdetails&&this.showrowdetailscolumn?(1+this.groups.length)*this.groupindentwidth:(this.groups.length)*this.groupindentwidth;n-=o;var d=function(j,k){var i=u.columngroupslevel*u.columnsheight;i=i-(k.level*u.columnsheight);return i};b.each(this.columns.records,function(S,Q){this.height=u.columnsheight;if(u.columngroups){if(u.columngroups.length){this.height=d(this.datafield,this);g=this.height}}var W=u.toTP("jqx-grid-column-header")+" "+u.toTP("jqx-widget-header");if(u.rtl){W+=" "+u.toTP("jqx-grid-column-header-rtl")}var U=!u.rtl?50+h-1:50+h+1;var O=!u.rtl?h--:h++;var D=b('<div role="columnheader" style="z-index: '+O+';position: absolute; height: 100%;" class="'+W+'"><div style="height: 100%; width: 100%;"></div></div>');if(u.columngroups){D[0].style.height=g+"px";D[0].style.bottom="0px";if(this.pinned){D[0].style.zIndex=U}}this.uielement=D;if(this.classname!=""&&this.classname){D.addClass(this.classname)}var L=this.width;var M=false;if(this.width.toString().indexOf("%")!=-1||this._percentagewidth!=undefined){if(this._percentagewidth!=undefined){L=parseInt(this._percentagewidth)*n/100}else{L=parseInt(this.width)*n/100}M=true}if(this.width!="auto"&&!this._width&&!M){if(L<this.minwidth&&this.minwidth!="auto"){L=this.minwidth}if(L>this.maxwidth&&this.maxwidth!="auto"){L=this.maxwidth}D[0].style.width=parseInt(L)+"px"}else{if(M){if(L<this.minwidth&&this.minwidth!="auto"){L=this.minwidth}if(L>this.maxwidth&&this.maxwidth!="auto"){L=this.maxwidth}if(this._percentagewidth==undefined||this.width.toString().indexOf("%")!=-1){this._percentagewidth=this.width}D.width(L);this.width=L}else{var P=Math.round(C*(this.text.length/r.length));if(isNaN(P)){P=this.minwidth}if(P<0){$element=b("<span>"+this.text+"</span>");b(document.body).append($element);P=10+$element.width();$element.remove()}if(P<this.minwidth){P=this.minwidth}if(P>this.maxwidth){P=this.maxwidth}this._width="auto";this.width=P;C-=P;r=r.substring(this.text.length);L=this.width;D.width(this.width)}}if(this.hidden&&this.hideable){D.css("display","none")}var p=b(D.children()[0]);var T=u.rtl?u.toTP("jqx-grid-column-menubutton")+" "+u.toTP("jqx-grid-column-menubutton-rtl"):u.toTP("jqx-grid-column-menubutton");var G=b('<div style="height: '+g+'px; display: none; left: 100%; top: 0%; position: absolute;"><div class="'+T+'" style="width: 100%; height:100%;"></div></div>');if(!u.enableanimations){G.css("margin-left",-16)}if(u.rtl){G.css("left","0px")}this.columnsmenu=G[0];l[0].cells[S]=D[0];G[0].style.width=parseInt(u.columnsmenuwidth)+"px";var F=u.columnsmenu;var q=false;var R=false;var N=(u.groupable&&m>0&&x<m)||(u.rowdetails&&x<m);if(u.rtl){N=(u.groupable&&m>0&&x<m)||(u.rowdetails&&x<m);N&=S>u.columns.records.length-1-m}if(N){x++;F&=false;this.sortable=false;this.editable=false;R=true}else{var I=this.renderer!=null?this.renderer(this.text,this.align,g):u._rendercolumnheader(this.text,this.align,g,u);if(I==null){I=u._rendercolumnheader(this.text,this.align,g,u)}if(this.renderer!=null){I=b(I)}F&=true;q=true}if(u.WinJS){MSApp.execUnsafeLocalFunction(function(){p.append(b(I))})}else{if(this.renderer){p.append(b(I))}else{if(I){p[0].innerHTML=I}}}if(I!=null){var K=b('<div class="iconscontainer" style="height: '+g+'px; margin-left: -32px; display: block; position: absolute; left: 100%; top: 0%; width: 32px;"><div class="filtericon '+u.toTP("jqx-widget-header")+'" style="height: '+g+'px; float: right; display: none; width: 16px;"><div class="'+u.toTP("jqx-grid-column-filterbutton")+'" style="width: 100%; height:100%;"></div></div><div class="sortasc '+u.toTP("jqx-widget-header")+'" style="height: '+g+'px; float: right; display: none; width: 16px;"><div class="'+u.toTP("jqx-grid-column-sortascbutton")+'" style="width: 100%; height:100%;"></div></div><div class="sortdesc '+u.toTP("jqx-widget-header")+'" style="height: '+g+'px; float: right; display: none; width: 16px;"><div class="'+u.toTP("jqx-grid-column-sortdescbutton")+'" style="width: 100%; height:100%;"></div></div></div>');G.addClass(u.toTP("jqx-widget-header"));p.append(K);var X=K.children();this.sortasc=X[1];this.sortdesc=X[2];this.filtericon=X[0];this.iconscontainer=K;if(u.rtl){K.css("margin-left","0px");K.css("left","0px");b(this.sortasc).css("float","left");b(this.filtericon).css("float","left");b(this.sortdesc).css("float","left")}if(!u.autoshowfiltericon&&this.filterable){b(this.filtericon).css("display","block")}}if(F){u._handlecolumnsmenu(u,p,D,G,this);if(!this.menu){G.hide()}}l.append(D);if(u.groupable&&q){D[0].id=u.dataview.generatekey();if(u._handlecolumnstogroupsdragdrop){u._handlecolumnstogroupsdragdrop(this,D)}else{throw new Error("jqxGrid: Missing reference to jqxgrid.grouping.js.")}}if(u.columnsreorder&&this.draggable&&u._handlecolumnsdragreorder){u._handlecolumnsdragreorder(this,D)}var V=this;u.addHandler(D,"click",function(i){if(V.checkboxcolumn){return true}if(u.sorttogglestates>0&&u._togglesort){if(!u._loading){u._togglesort(V)}}i.preventDefault();u._raiseEvent(7,{column:V.getcolumnproperties(),datafield:V.datafield,originalEvent:i})});if(V.resizable&&u.columnsresize&&!R){var E=false;var j="mousemove";if(u.isTouchDevice()&&u.touchmode!==true){E=true;j=b.jqx.mobile.getTouchEventName("touchstart")}u.addHandler(D,j,function(Y){var i=parseInt(Y.pageX);var aa=5;var ad=parseInt(D.coord().left);if(u.hasTransform){ad=b.jqx.utilities.getOffset(D).left}if(u._handlecolumnsresize){if(E){var Z=u.getTouches(Y);var ac=Z[0];i=ac.pageX;aa=40;if(i>=ad+V.width-aa){u.resizablecolumn={columnelement:D,column:V};D.css("cursor","col-resize")}else{D.css("cursor","");u.resizablecolumn=null}return true}var ab=V.width;if(u.rtl){ab=0}if(i>=ad+ab-aa){if(i<=ad+ab+aa){u.resizablecolumn={columnelement:D,column:V};D.css("cursor","col-resize");return false}else{D.css("cursor","");u.resizablecolumn=null}}else{D.css("cursor","");if(i<ad+ab-aa){if(!V._animating&&!V._menuvisible){D.mouseenter()}}u.resizablecolumn=null}}})}D.css("left",f);if(!(this.hidden&&this.hideable)){f+=L}if(V.rendered){var J=V.rendered(b(p[0].firstChild),V.align,g);if(J&&K!=null){K.hide()}}if(V.checkboxcolumn){K.hide();if(!u.host.jqxCheckBox){throw new Error("jqxGrid: Missing reference to jqxcheckbox.js")}p.html('<div style="cursor: pointer; margin-left: 5px; top: 50%; margin-top: -8px; position: relative;"></div>');var k=p.find("div:first");k.jqxCheckBox({_canFocus:false,disabledContainer:true,theme:u.theme,enableContainerClick:false,width:16,height:16,animationShowDelay:0,animationHideDelay:0});V.checkboxelement=k;var H=k.data().jqxCheckBox.instance;u._checkboxcolumn=V;H.updated=function(Y,i,Z){u._checkboxcolumnupdating=true;if(i){u.selectallrows()}else{u.clearselection(true,false)}u._checkboxcolumnupdating=false}}});if(f>0){this.columnsheader.width(2+f)}else{this.columnsheader.width(f)}this.columnsrow=l;u.columnsheader.append(l);if(this.showfilterrow&&this._updatefilterrow){if(!this.columngroups){l.height(this.columnsheight)}else{l.height(this.columngroupslevel*this.columnsheight)}if(!this.filterrow){var B=b("<div></div>");B[0].id="filterrow."+this.element.id;B.height(this.filterrowheight);this.filterrow=B}this.filterrow.width(f);this.columnsheader.append(this.filterrow);this._updatefilterrow()}l.width(f);if(this._handlecolumnsdragdrop){this._handlecolumnsdragdrop()}if(this._handlecolumnsreorder){this._handlecolumnsreorder()}if(this._rendersortcolumn){this._rendersortcolumn()}if(this._renderfiltercolumn){this._renderfiltercolumn()}if(this._handlecolumnsresize){this._handlecolumnsresize()}if(this.columngroups){this._rendercolumngroups()}if(this._updatecheckboxselection){this._updatecheckboxselection()}},_rendercolumngroups:function(){if(!this.columngroups){return}var p=0;for(var m=0;m<this.columns.records.length;m++){if(this.columns.records[m].pinned){p++}}var u=this.headerZIndex-p+this.columns.records.length;var v=this.that;var h=v.toTP("jqx-grid-column-header")+" "+v.toTP("jqx-grid-columngroup-header")+" "+v.toTP("jqx-widget-header");if(v.rtl){h+=" "+v.toTP("jqx-grid-columngroup-header-rtl")}var f=this.columnsheader.find("#columntable"+this.element.id);f.find("jqx-grid-columngroup-header").remove();for(var k=0;k<this.columngroupslevel-1;k++){for(var m=0;m<this.columngroups.length;m++){var r=this.columngroups[m];var d=r.level;if(d!==k){continue}var q=d*this.columnsheight;var e=99999;if(r.groups){var t=function(y){var x=0;for(var w=0;w<y.groups.length;w++){var i=y.groups[w];if(!i.groups){if(!i.hidden){x+=i.width;e=Math.min(parseInt(i.element.style.left),e)}}else{x+=t(i)}}return x};r.width=t(r);r.left=e;var s=this.columnsheight;var n=u--;var g=b('<div role="columnheader" style="z-index: '+n+';position: absolute;" class="'+h+'"></div>');var l=b(this._rendercolumnheader(r.text,r.align,this.columnsheight,this));if(r.renderer){var l=b("<div style='height: 100%; width: 100%;'></div>");var o=r.renderer(r.text,r.align,s);l.html(o)}g.append(l);g[0].style.left=e+"px";if(e===0){g[0].style.borderLeftColor="transparent"}g[0].style.top=q+"px";g[0].style.height=s+"px";g[0].style.width=-1+r.width+"px";f.append(g);r.element=g;if(r.rendered){r.rendered(l,r.align,s)}}}}},_resizecolumngroups:function(){if(!this.columngroups){return}for(var e=0;e<this.columngroups.length;e++){var k=this.columngroups[e];var l=k.level;var j=l*this.columnsheight;var h=99999;if(k.groups){var g=function(o){var n=0;for(var m=0;m<o.groups.length;m++){var i=o.groups[m];if(!i.groups){n+=i.width;h=Math.min(parseInt(i.element.style.left),h)}else{n+=g(i)}}return n};k.width=g(k);k.left=h;var d=this.columnsheight;var f=k.element;f[0].style.left=h+"px";f[0].style.top=j+"px";f[0].style.height=d+"px";f[0].style.width=-1+k.width+"px"}}},_handlecolumnsmenu:function(o,f,g,j,l){o.dragmousedown=null;j[0].id=o.dataview.generatekey();f.append(j);g[0].columnsmenu=j[0];l.element=g[0];var k=this.columnsmenuwidth+1;var n=function(){if(!l.menu){return false}if(!o.resizing){if(l._menuvisible&&o._hasOpenedMenu){return false}l._animating=true;if(o.menuitemsarray&&o.menuitemsarray.length>0){if(!o.enableanimations){j.css("display","block");var p=!o.rtl?-48:16;l.iconscontainer.css("margin-left",p+"px");l._animating=false;l._menuvisible=true}else{j.css("display","block");j.stop();l.iconscontainer.stop();if(!o.rtl){j.css("margin-left","0px");j.animate({"margin-left":-k},"fast",function(){j.css("display","block");l._animating=false;l._menuvisible=true})}else{j.css("margin-left",-k);j.animate({"margin-left":"0px"},"fast",function(){j.css("display","block");l._animating=false;l._menuvisible=true})}var p=!o.rtl?-(32+k):k;l.iconscontainer.animate({"margin-left":p},"fast")}}}};o.addHandler(g,"mouseenter",function(q){var p=parseInt(q.pageX);var s=o.columnsresize&&l.resizable?3:0;var u=parseInt(g.coord().left);if(o.hasTransform){u=b.jqx.utilities.getOffset(g).left}var t=l.width;if(o.rtl){t=0}if(s!=0){if(p>=u+t-s){if(p<=u+t+s){return false}}}var r=o.vScrollInstance.isScrolling();if(l.menu&&o.autoshowcolumnsmenubutton&&!r){n()}});if(!o.autoshowcolumnsmenubutton){j.css("display","block");var e=!o.rtl?-48:16;l.iconscontainer.css("margin-left",e+"px");if(!o.rtl){j.css({"margin-left":-k})}else{j.css({"margin-left":"0px"})}}o.addHandler(g,"mouseleave",function(p){if(o.menuitemsarray&&o.menuitemsarray.length>0&&l.menu){var r=b.data(document.body,"contextmenu"+o.element.id);if(r!=undefined&&j[0].id==r.columnsmenu.id){return}if(o.autoshowcolumnsmenubutton){if(!o.enableanimations){j.css("display","none");var q=!o.rtl?-32:0;l.iconscontainer.css("margin-left",q+"px");l._menuvisible=false}else{if(!o.rtl){j.css("margin-left",-k)}else{j.css("margin-left","0px")}j.stop();l.iconscontainer.stop();if(!o.rtl){j.animate({"margin-left":0},"fast",function(){j.css("display","none");l._menuvisible=false})}else{j.animate({"margin-left":-k},"fast",function(){j.css("display","none");l._menuvisible=false})}var q=!o.rtl?-32:0;l.iconscontainer.animate({"margin-left":q},"fast")}}}});var i=true;var d="";var h=b(l.filtericon);o.addHandler(j,"mousedown",function(p){if(!o.gridmenu){o._initmenu()}i=!b.data(o.gridmenu[0],"contextMenuOpened"+o.gridmenu[0].id);d=b.data(document.body,"contextmenu"+o.element.id);if(d!=null){d=d.column.datafield}});o.addHandler(h,"mousedown",function(p){if(!o.gridmenu){o._initmenu()}i=!b.data(o.gridmenu[0],"contextMenuOpened"+o.gridmenu[0].id);d=b.data(document.body,"contextmenu"+o.element.id);if(d!=null){d=d.column.datafield}});var m=function(){if(!l.menu){return false}if(!o.gridmenu){o._initmenu()}var s=j.coord(true);var y=j.height();if(!i){i=true;if(d==l.datafield){o._closemenu();return false}}var v=o.host.coord(true);if(o.hasTransform){v=b.jqx.utilities.getOffset(o.host);s=b.jqx.utilities.getOffset(j)}if(v.left+o.host.width()>parseInt(s.left)+o.gridmenu.width()){o.gridmenu.jqxMenu("open",s.left,s.top+y)}else{o.gridmenu.jqxMenu("open",j.width()+s.left-o.gridmenu.width(),s.top+y)}if(o.gridmenu.width()<100){o._arrangemenu()}o._hasOpenedMenu=true;var w=o._getmenuitembyindex(0);var p=o._getmenuitembyindex(1);var A=o._getmenuitembyindex(2);var x=o._getmenuitembyindex(3);var q=o._getmenuitembyindex(4);var B=o._getmenuitembyindex(5);if(w!=null&&p!=null&&A!=null){var t=l.sortable&&o.sortable;o.gridmenu.jqxMenu("disable",w.id,!t);o.gridmenu.jqxMenu("disable",p.id,!t);o.gridmenu.jqxMenu("disable",A.id,!t);if(l.datafield){if(o.sortcolumn==l.datafield){var u=o.getsortinformation();if(t){if(u.sortdirection.ascending){o.gridmenu.jqxMenu("disable",w.id,true)}else{o.gridmenu.jqxMenu("disable",p.id,true)}}}else{o.gridmenu.jqxMenu("disable",A.id,true)}}}if(x!=null&&q!=null){if(!o.groupable||!l.groupable){o.gridmenu.jqxMenu("disable",q.id,true);o.gridmenu.jqxMenu("disable",x.id,true)}else{if(o.groups&&o.groups.indexOf(l.datafield)!=-1){o.gridmenu.jqxMenu("disable",x.id,true);o.gridmenu.jqxMenu("disable",q.id,false)}else{o.gridmenu.jqxMenu("disable",x.id,false);o.gridmenu.jqxMenu("disable",q.id,true)}}}if(B!=null){o._updatefilterpanel(o,B,l);var r=0;if(o.sortable&&o._togglesort&&o.showsortmenuitems){r+=3}if(o.groupable&&o.addgroup&&o.showgroupmenuitems){r+=2}var z=r*27+3;if(b.jqx.browser.msie&&b.jqx.browser.version<8){z+=20;b(B).height(190)}if(o.filterable&&o.showfiltermenuitems){if(!l.filterable){o.gridmenu.height(z);b(B).css("display","none")}else{o.gridmenu.height(z+176);b(B).css("display","block")}}}b.data(document.body,"contextmenu"+o.element.id,{column:l,columnsmenu:j[0]})};o.addHandler(h,"click",function(p){if(!l.menu){return false}if(!o.showfilterrow){n();m()}return false});o.addHandler(j,"click",function(p){if(!l.menu){return false}m();return false})},_removecolumnhandlers:function(h){var e=this.that;var f=b(h.element);if(f.length>0){e.removeHandler(f,"mouseenter");e.removeHandler(f,"mouseleave");var g=b(h.filtericon);e.removeHandler(g,"mousedown");e.removeHandler(g,"click");e.removeHandler(f,"click");e.removeHandler(f,"mousemove");if(f[0].columnsmenu){var d=b(f[0].columnsmenu);e.removeHandler(d,"click");e.removeHandler(d,"mousedown")}}},_rendercolumnheader:function(h,i,e,d){var g="4px";if(d.columngroups){g=(e/2-this._columnheight/2);if(g<0){g=4}g+="px"}else{if(this.columnsheight!=25){g=(this.columnsheight/2-this._columnheight/2);if(g<0){g=4}g+="px"}}if(this.enableellipsis){return'<div style="padding-bottom: 2px; overflow: hidden; text-overflow: ellipsis; text-align: '+i+"; margin-left: 4px; margin-right: 2px; margin-bottom: "+g+"; margin-top: "+g+';"><span style="text-overflow: ellipsis; cursor: default;">'+h+"</span></div>"}if(i=="center"||i=="middle"){return'<div style="padding-bottom: 2px; text-align: center; margin-top: '+g+';"><a href="#">'+h+"</a></div>"}var f='<a style="margin-top: '+g+"; float: "+i+';" href="#">'+h+"</a>";return f},_renderrows:function(f,h,l){var r=this.that;if((this.pageable||this.groupable)&&(this.autoheight||this.autorowheight)){if(this.table!=null&&this.table[0].rows!=null&&this.table[0].rows.length<this.dataview.rows.length){r.prerenderrequired=true}}if(!this.pageable&&(this.autoheight||this.autorowheight)&&(this.virtualmode||this.unboundmode)){var p=this.source.totalrecords;if(!isNaN(p)){if(this.table!=null&&this.table[0].rows!=null&&this.table[0].rows.length!=p){r.prerenderrequired=true}}}if((this.autoheight||this.autorowheight)&&!r.prerenderrequired){if(this.table&&this.table[0].rows){if(this.table[0].rows.length<this.dataview.records.length){if(this.pageable&&this.table[0].rows.length<this.dataview.pagesize){r.prerenderrequired=true}else{if(!this.pageable){r.prerenderrequired=true}}}if(this.table[0].rows.length<this.dataview.cachedrecords.length){if(this.pageable&&this.table[0].rows.length<this.dataview.pagesize){r.prerenderrequired=true}else{if(!this.pageable){r.prerenderrequired=true}}}}}r._prerenderrows(f);if(r._requiresupdate){r._requiresupdate=false;r._updatepageviews()}var q=function(){if(r._loading){return}if(r.WinJS){MSApp.execUnsafeLocalFunction(function(){r._rendervisualrows()})}else{r._rendervisualrows()}if(r.virtualmode&&r.showaggregates&&r._updateaggregates){r.refreshaggregates()}};var t=b.jqx.browser.msie&&b.jqx.browser.version<10;if(this.virtualmode){var i=function(){if(r.rendergridrows){var w=r._startboundindex;if(w==undefined){w=0}var u=w+1+r.dataview.pagesize;if(w!=null&&u!=null){var v=r.source._source?true:false;var x=!v?r.source.recordstartindex:r.source._source.recordstartindex;if(x!=w||h==true){if(!v){r.source.recordstartindex=w;r.source.recordendindex=u}else{if(u>=r.source._source.totalrecords){u=r.source._source.totalrecords;w=u-r.dataview.pagesize-1;if(w<0){w=0}if(r.source._source.recordendindex==u&&r.source._source.recordstartindex==w){return}}r.source._source.recordstartindex=w;r.source._source.recordendindex=u}r.updatebounddata()}}}};if(this.loadondemand){q();i();this.loadondemand=false}var j=this._browser==undefined?this._isIE10():this._browser;if(this.editable&&this.editcell&&!this.vScrollInstance.isScrolling()&&!this.hScrollInstance.isScrolling()){q()}else{if(this.autoheight){q()}else{if(j||t||b.jqx.browser.mozilla||(navigator&&navigator.userAgent.indexOf("Safari")!=-1)){if(this._scrolltimer!=null){clearTimeout(this._scrolltimer)}this._scrolltimer=setTimeout(function(){q()},5)}else{q()}}}}else{if(this.scrollmode=="deferred"&&(this.hScrollInstance.isScrolling()||this.vScrollInstance.isScrolling())){if(this._scrolltimer!=null){clearInterval(this._scrolltimer)}var s=this._getfirstvisualrow();if(s!=null){var m=function(z){if(s==null){return""}var y="<table>";var w=r.deferreddatafields;if(w==null){if(r.columns.records.length>0){w=new Array();w.push(r.columns.records[0].displayfield)}}for(var v=0;v<w.length;v++){var A=w[v];var x=r._getcolumnbydatafield(A);if(x){var u=r._getcellvalue(x,s);if(x.cellsformat!=""){if(b.jqx.dataFormat){if(b.jqx.dataFormat.isDate(u)){u=b.jqx.dataFormat.formatdate(u,x.cellsformat,r.gridlocalization)}else{if(b.jqx.dataFormat.isNumber(u)){u=b.jqx.dataFormat.formatnumber(u,x.cellsformat,r.gridlocalization)}}}}y+="<tr><td>"+u+"</td></tr>"}}y+="</table>";return y};var k=this.scrollfeedback?this.scrollfeedback(s.bounddata):m(s.bounddata);if(k!=this._scrollelementcontent){this._scrollelement[0].innerHTML=k;this._scrollelementcontent=k}}this._scrollelement.css("visibility","visible");this._scrollelementoverlay.css("visibility","visible");this._scrollelement.css("margin-top",-this._scrollelement.height()/2);this._scrolltimer=setInterval(function(){if(!r.hScrollInstance.isScrolling()&&!r.vScrollInstance.isScrolling()){q();r._scrollelement.css("visibility","hidden");r._scrollelementoverlay.css("visibility","hidden");clearInterval(r._scrolltimer);if(s){r.ensurerowvisible(s.visibleindex)}}},100);return}if(navigator&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")!=-1){this.updatedelay=1}if(this.touchDevice!=undefined&&this.touchDevice==true){this.updatedelay=5}var j=this._browser==undefined?this._isIE10():this._browser;if(j||t){this.updatedelay=5}if((j||b.jqx.browser.mozilla)&&this.hScrollInstance.isScrolling()){q();return}if(b.jqx.browser.mozilla&&this.updatedelay==0&&(this.vScrollInstance.isScrolling()||this.hScrollInstance.isScrolling())){this.updatedelay=1}if(this.updatedelay==0){q()}else{var d=this._jqxgridrendertimer;if(d!=null){clearTimeout(d)}if(this.vScrollInstance.isScrolling()||this.hScrollInstance.isScrolling()){d=setTimeout(function(){q()},this.updatedelay);this._jqxgridrendertimer=d}else{this._jqxgridrendertimer=d;q()}}}if(r.autorowheight&&!r.autoheight){if(this._pageviews.length>0){var e=this._gettableheight();var n=this._pageviews[0].height;if(n>e){if(this.pageable&&this.gotopage){n=this._pageviews[0].height;if(n<0){n=this._pageviews[0].height}}if(this.vScrollBar.css("visibility")!="visible"){this.vScrollBar.css("visibility","visible")}if(n<=e||this.autoheight){this.vScrollBar.css("visibility","hidden")}if(n-e>0){if(this.scrollmode!="deferred"){var o=n-e;var g=this.vScrollInstance.max;this.vScrollBar.jqxScrollBar({max:o});if(Math.round(o)!=Math.round(g)){this.vScrollBar.jqxScrollBar({value:0})}}}else{this.vScrollBar.jqxScrollBar({value:0,max:n})}}else{if(!this._loading){this.vScrollBar.css("visibility","hidden")}this.vScrollBar.jqxScrollBar({value:0})}this._arrange();if(this.virtualsizeinfo){this.virtualsizeinfo.virtualheight=n}}}},scrolling:function(){var e=this.vScrollInstance.isScrolling();var d=this.hScrollInstance.isScrolling();return{vertical:e,horizontal:d}},_renderhorizontalscroll:function(){var s=this.hScrollInstance;var t=s.value;if(this.hScrollBar.css("visibility")==="hidden"){s.value=0;t=0}var k=parseInt(t);if(this.table==null){return}var p=this.table[0].rows.length;var o=this.columnsrow;var q=this.groupable&&this.groups.length>0?this.groups.length:0;var l=this.columns.records.length-q;var f=this.columns.records;var n=this.dataview.rows.length==0;if(this.rtl){if(this.hScrollBar.css("visibility")!="hidden"){k=s.max-k}}if(n&&!this._haspinned){for(var v=0;v<p;v++){var r=this.table[0].rows[v];for(var u=0;u<q+l;u++){var d=r.cells[u];if(d!=undefined){var g=f[u];if(g.pinned){d.style.marginLeft=k+"px";if(v==0){var e=o[0].cells[u];e.style.marginLeft=k+"px"}}}}}this.table[0].style.marginLeft=-k+"px";o[0].style.marginLeft=-k+"px"}else{if(this._haspinned||this._haspinned==undefined){for(var v=0;v<p;v++){var r=this.table[0].rows[v];for(var u=0;u<q+l;u++){var d=r.cells[u];if(d!=undefined){var g=f[u];if(g.pinned){if(k==0&&d.style.marginLeft==""){continue}var h=null;var w=null;if(this.showfilterrow&&this.filterrow){if(this.filterrow[0].cells){w=this.filterrow[0].cells[u]}}if(this.showaggregates){if(this.statusbar[0].cells){h=this.statusbar[0].cells[u]}}if(!this.rtl){d.style.marginLeft=k+"px";if(v==0){var e=o[0].cells[u];e.style.marginLeft=k+"px";if(h){h.style.marginLeft=k+"px"}if(w){w.style.marginLeft=k+"px"}}}else{d.style.marginLeft=-parseInt(t)+"px";if(v==0){var e=o[0].cells[u];e.style.marginLeft=-parseInt(t)+"px";if(h){h.style.marginLeft=-parseInt(t)+"px"}if(w){w.style.marginLeft=-parseInt(t)+"px"}}}}}}}this.table[0].style.marginLeft=-k+"px";o[0].style.marginLeft=-k+"px"}else{if(this._haspinned==false){this.table[0].style.marginLeft=-k+"px";o[0].style.marginLeft=-k+"px"}}}if(this.showaggregates){if(this.statusbar[0].cells){var m=0;if(this.rtl){if(this.vScrollBar.css("visibility")!="hidden"){if(this.hScrollBar.css("visibility")!="hidden"){m=2+parseInt(this.hScrollBar.css("left"))}}}this.statusbar[0].style.marginLeft=-k+m+"px"}}if(this.showfilterrow&&this.filterrow){if(this.filterrow[0].cells){this.filterrow[0].style.marginLeft=-k+"px"}}},_updaterowdetailsvisibility:function(){if(this.rowdetails){for(var d=0;d<this._rowdetailselementscache.length;d++){b(this._rowdetailselementscache[d]).css("display","none")}}},_getvisualcolumnsindexes:function(e,m,i,l,d){if(this.rowdetails||this.rtl||this.editcell||(this.width&&this.width.toString().indexOf("%")>=0)||this.exporting){return{start:0,end:i+l}}var f=0;var k=-1;var g=i+l;var n=false;if(this.autorowheight){return{start:0,end:i+l}}if(!d){for(var h=0;h<i+l;h++){var o=h;if(!n){if(this.columns.records[h].pinned){n=true}}if(!this.columns.records[h].hidden){f+=this.columns.records[h].width}if(f>=e&&k==-1){k=h}if(f>m+e){g=h;break}}}g++;if(g>i+l){g=i+l}if(k==-1||n){k=0}return{start:k,end:g}},_getfirstvisualrow:function(){var e=this.vScrollInstance;var g=e.value;var f=parseInt(g);if(this._pagescache.length==0){this.dataview.updateview();this._loadrows()}if(this.vScrollBar[0].style.visibility!="visible"){f=0}if(!this.pageable){var d=this._findvisiblerow(f,this._pageviews);if(d==-1){return null}if(d!=this.dataview.pagenum){this.dataview.pagenum=d;this.dataview.updateview();this._loadrows()}else{if(!this._pagescache[this.dataview.pagenum]){this._loadrows()}}}var h=this._findvisiblerow(f,this._pagescache[this.dataview.pagenum]);var i=this._pagescache[this.dataview.pagenum];if(i&&i[0]){return i[h]}},_rendervisualrows:function(){if(!this.virtualsizeinfo){return}var R=this.vScrollInstance;var o=this.hScrollInstance;var h=R.value;var z=o.value;var n=parseInt(h);var k=parseInt(z);var v=this._gettableheight();var E=this._hostwidth!=undefined?this._hostwidth:this.host.width();if(this.hScrollBar[0].style.visibility=="visible"){v+=29}if(this.scrollmode=="deferred"&&this._newmax!=0){if(n>this._newmax&&this._newmax!=null){n=this._newmax}}var ab=R.isScrolling()||o.isScrolling()||this._keydown;var A=this.groupable&&this.groups.length>0;this.visiblerows=new Array();this.hittestinfo=new Array();if(this.editcell&&this.editrow==undefined){this._hidecelleditor(false)}if(this.editrow!=undefined){this._hideeditors()}if(this.virtualmode&&!this.pageable){this._pagescache=new Array()}if(this._pagescache.length==0){this.dataview.updateview();this._loadrows()}if(this.vScrollBar[0].style.visibility=="hidden"){n=0}if(!this.pageable){var G=this._findvisiblerow(n,this._pageviews);if(G==-1){this._clearvisualrows();this._renderemptyrow();this._updaterowdetailsvisibility();return}if(G!=this.dataview.pagenum){this.dataview.pagenum=G;this.dataview.updateview();this._loadrows()}else{if(!this._pagescache[this.dataview.pagenum]){this._loadrows()}}}var ad=this.groupable&&this.groups.length>0?this.groups.length:0;if(!this.columns.records){return}var q=this.columns.records.length-ad;var V=this._findvisiblerow(n,this._pagescache[this.dataview.pagenum]);var H=this._pagescache[this.dataview.pagenum];var M=V;if(M<0){M=0}var X=0;var U=0;var L=0;var e=0;var N=this.virtualsizeinfo.visiblerecords;var K=this.groupable?this.groups.length:0;var x=this.toTP("jqx-grid-cell");if(this.rtl){x+=" "+this.toTP("jqx-grid-cell-rtl")}if((this.autoheight||this.autorowheight)&&this.pageable){if(!this.groupable){N=this.dataview.pagesize}}if(A){x=" "+this.toTP("jqx-grid-group-cell")}if(this.isTouchDevice()){x+=" "+this.toTP("jqx-touch")}if(this.autorowheight){x+=" jqx-grid-cell-wrap"}var J=this.rowsheight;var D=M;var ac=this._rendercell;var r=true;var p=this._getvisualcolumnsindexes(k,E,ad,q,A);var d=p.start;var T=p.end;if((this.autoheight||this.pageable)&&this.autorowheight){if(this._pageviews[0]){this._oldpageviewheight=this._pageviews[0].height}}if(this.autorowheight){M=0}if(M>=0){this._updaterowdetailsvisibility();this._startboundindex=H!=null?H[M].bounddata.boundindex:0;this._startvisibleindex=H!=null?H[M].bounddata.visibleindex:0;for(var m=0;m<N&&U<N;m++){var W=H!=undefined?H[M+m]:null;if(W==null){M=-m;if(this._pagescache[this.dataview.pagenum+1]){H=this._pagescache[this.dataview.pagenum+1];this.dataview.pagenum++}else{var s=this._pageviews.length;do{if(this.dataview.pagenum<this._pageviews.length-1){this.dataview.pagenum++;H=undefined;if(this._pageviews[this.dataview.pagenum].height>0){this.dataview.updateview();this._loadrows();H=this._pagescache[this.dataview.pagenum]}}else{H=undefined;break}}while(H==undefined&&this.dataview.pagenum<s)}if(H!=undefined){W=H[M+m]}}if(W!=null){if(W.hidden){continue}this._endboundindex=this._startboundindex+m;this._endvisibleindex=this._startvisibleindex+m;if(m==0){var l=Math.abs(n-W.top);this.table[0].style.top=-l+"px";e=-l}var j=this.table[0].rows[U];if(!j){continue}if(parseInt(j.style.height)!=W.height){j.style.height=parseInt(W.height)+"px"}L+=W.height;var Q=this.rowdetails&&W.rowdetails;var u=!W.rowdetailshidden;if(Q&&u){j.style.height=parseInt(W.height-W.rowdetailsheight)+"px";N++}var F=this._isrowselected(r,W);for(var O=d;O<T;O++){var Z=O;this._rendervisualcell(ac,x,F,Q,u,A,K,j,W,Z,U,ab)}if(W.group!=undefined&&this._rendergroup){this._rendergroup(K,j,W,ad,q,U,E)}if(this.autorowheight&&(this.autoheight||this.pageable)){var J=this.rowsheight;for(var O=d;O<T;O++){if(this.editable&&this.editcell&&this.editcell.column==this.columns.records[O].datafield&&this.editcell.row==this.getboundindex(W)){continue}if(j.cells[O].firstChild){J=Math.max(J,8+parseInt(j.cells[O].firstChild.offsetHeight))}}j.style.height=parseInt(J)+"px";this.heights[this._startboundindex+m]=J;if(Q&&u){J+=W.rowdetailsheight}W.height=J}this.visiblerows[this.visiblerows.length]=W;this.hittestinfo[this.hittestinfo.length]={row:W,visualrow:j,details:false};if(Q&&u){U++;var j=this.table[0].rows[U];this._renderrowdetails(x,j,W,ad,q,U);this.visiblerows[this.visiblerows.length]=W;this.hittestinfo[this.hittestinfo.length]={row:W,visualrow:j,details:true}}if(!this.autorowheight){if(L+e>=v){break}}}else{cansetheight=true;this._clearvisualrow(k,A,U,ad,q);if(L+X+e<=v){X+=J}}U++}this._horizontalvalue=k;if(X>0){if(this.vScrollBar[0].style.visibility=="visible"){var aa=parseInt(this.table.css("top"));var C=this._pageviews[this._pageviews.length-1];var t=R.max;var B=C.top+C.height-v;if(this.hScrollBar.css("visibility")=="visible"){B+=this.scrollbarsize+20}if(t!=B&&!this.autorowheight){if(B>=0){if(this.scrollmode!="deferred"){R.max=B;R.setPosition(R.max)}else{if(this._newmax!=B){this._newmax=B;this._rendervisualrows()}}}}}}}if((this.autoheight||this.pageable)&&this.autorowheight){this._pagescache=new Array();var P=0;var g=0;for(var Y=0;Y<this.visiblerows.length;Y++){var w=this.visiblerows[Y];w.top=P;P+=w.height;g+=w.height;var Q=this.rowdetails&&w.rowdetails;var u=!w.rowdetailshidden;var j=this.table[0].rows[Y];if(Q&&u){Y++}for(var O=d;O<T;O++){var S=this.columns.records[O];if(!S.hidden){if(!S.cellsrenderer){var I=j.cells[O];var f=0;if(I.firstChild){var f=(w.height-parseInt(I.firstChild.offsetHeight)-8)/2;if(Q&&u){var f=(w.height-w.rowdetailsheight-b(I.firstChild).height()-8)/2}}else{var f=(w.height-parseInt(b(I).height())-8)/2}if(f>=0){f=parseInt(f)+4;if(I.firstChild){if(I.firstChild.className.indexOf("jqx-grid-groups-row")==-1){if(S.columntype!="checkbox"&&S.columntype!="button"){if(this.editable&&this.editcell&&this.editcell.column==S.datafield&&this.editcell.row==this.getboundindex(w)){continue}I.firstChild.style.marginTop=f+"px"}}}}}}}}if(this._pageviews[0]){this._pageviews[0].height=g}this._arrange()}this._renderemptyrow()},_hideemptyrow:function(){if(!this.showemptyrow){return}if(!this.table){return}if(!this.table[0].rows){return}var f=this.table[0].rows[0];if(!f){return}var g=false;for(var e=0;e<f.cells.length;e++){var d=b(f.cells[e]);if(d.css("display")!="none"&&!g){if(d.width()==this.host.width()||d.text()==this.gridlocalization.emptydatastring){d[0].checkbox=null;d[0].button=null;g=true;d[0].innerHTML=""}}}},_renderemptyrow:function(){if(this._loading){return}if(this.dataview.records.length==0&&this.showemptyrow){var l=false;var e=this.toTP("jqx-grid-cell");if(this.table&&this.table.length>0&&this.table[0].rows&&this.table[0].rows.length>0){var k=this.table[0].rows[0];this.table[0].style.top="0px";for(var f=0;f<k.cells.length;f++){var d=b(k.cells[f]);if(d.css("display")!="none"&&!l){d[0].checkbox=null;d[0].button=null;d[0].className=e;l=true;d[0].innerHTML="";var g=b("<span style='white-space: nowrap; float: left; margin-left: 50%; position: relative;'></span>");g.text(this.gridlocalization.emptydatastring);d.append(g);var j=0;if(!this.oldhscroll){j=parseInt(this.table[0].style.marginLeft);if(this.rtl){d.css("z-index",999);d.css("overflow","visible")}}g.css("left",-j-(g.width()/2));g.css("top",this._gettableheight()/2-g.height()/2);if(b.jqx.browser.msie&&b.jqx.browser.version<8){g.css("margin-left","0px");g.css("left",this.host.width()/2-g.width()/2)}var h=Math.abs(parseInt(this.table[0].style.top));if(isNaN(h)){h=0}b(k).height(this._gettableheight()+h);d.css("margin-left","0px");d.width(this.host.width());if(this.table.width()<this.host.width()){this.table.width(this.host.width())}}d.addClass(this.toThemeProperty("jqx-grid-empty-cell"))}}}},_clearvisualrows:function(){var e=this.virtualsizeinfo.visiblerecords;var f=this.hScrollInstance;var d=f.value;var g=parseInt(d);var i=this.groupable&&this.groups.length>0;if(!this.columns.records){return}for(var h=0;h<e;h++){this._clearvisualrow(g,i,h,0,this.columns.records.length)}},_isrowselected:function(g,f){var e=false;var d=0;if(this.virtualmode&&this.pageable&&this.groupable){if(this.groups.length>0){d=this.dataview.pagesize*this.dataview.pagenum}}if(g&&f.bounddata!=null){if(this.selectionmode!="singlerow"){if(this.dataview.filters.length>0){if(this.selectedrowindexes.indexOf(d+f.bounddata.dataindex)!=-1){e=true}}else{if(this.selectedrowindexes.indexOf(d+f.bounddata.boundindex)!=-1){e=true}}}else{if(this.dataview.filters.length>0){if(this.selectedrowindexes.indexOf(d+f.bounddata.dataindex)!=-1){e=true}}else{if(d+f.bounddata.boundindex==this.selectedrowindex){e=true}}}}return e},_rendervisualcell:function(y,i,p,k,s,w,j,q,d,h,r,n){var f=null;var g=this.columns.records[h];if(g.hidden){var e=q.cells[h];e.innerHTML="";return}cellvalue=this._getcellvalue(g,d);var e=q.cells[h];var v=i;if(this.selectionmode.indexOf("cell")!=-1){if(this.dataview.filters.length>0){if(this.selectedcells[d.bounddata.dataindex+"_"+g.datafield]){p=true}else{p=false}}else{if(this.selectedcells[d.boundindex+"_"+g.datafield]){p=true}else{p=false}}if(this.editcell){if(this.editcell.row===d.boundindex&&this.editcell.column===g.datafield){if(g.columntype!=="checkbox"){p=false}}}}if(g.cellclassname!=""&&g.cellclassname){if(typeof g.cellclassname=="string"){v+=" "+g.cellclassname}else{var m=g.cellclassname(this.getboundindex(d),g.datafield,cellvalue,d.bounddata);if(m){v+=" "+m}}}var o=this.showsortcolumnbackground&&this.sortcolumn&&g.displayfield==this.sortcolumn;if(o){v+=" "+this.toTP("jqx-grid-cell-sort")}if(g.filter&&this.showfiltercolumnbackground){v+=" "+this.toTP("jqx-grid-cell-filter")}if((g.pinned&&this.showpinnedcolumnbackground)||g.grouped){if(w){v+=" "+this.toTP("jqx-grid-cell-pinned")}else{v+=" "+this.toTP("jqx-grid-cell-pinned")}}if(this.altrows&&d.group==undefined){var x=d.visibleindex;if(x>=this.altstart){if((this.altstart+x)%(1+this.altstep)==0){if(!o){v+=" "+this.toTP("jqx-grid-cell-alt")}else{v+=" "+this.toTP("jqx-grid-cell-sort-alt")}if(g.filter&&this.showfiltercolumnbackground){v+=" "+this.toTP("jqx-grid-cell-filter-alt")}if(g.pinned&&this.showpinnedcolumnbackground){v+=" "+this.toTP("jqx-grid-cell-pinned-alt")}}}}if(h<=j){if(w||this.rowdetails){var t=b(e);var l=this.columns.records[h].width;if(e.style.width!=parseInt(l)+"px"){t.width(l)}}}else{if(w||this.rowdetails){if(this._hiddencolumns){var t=b(e);var l=this.columns.records[h].width;if(parseInt(e.style.width)!=l){t.width(l)}}}}var u=true;if(this.rowdetails&&k){if(s&&!w){v+=" "+this.toTP("jqx-grid-details-cell")}else{if(w){v+=" "+this.toTP("jqx-grid-group-details-cell")}}if(this.showrowdetailscolumn){if(!this.rtl){if(d.group==undefined&&h==j){if(s){v+=" "+this.toTP("jqx-grid-group-expand")}else{v+=" "+this.toTP("jqx-grid-group-collapse")}u=false;e.title="";e.innerHTML="";if(e.className!=v){e.className=v}return}}else{if(d.group==undefined&&h==q.cells.length-j-1){if(s){v+=" "+this.toTP("jqx-grid-group-expand-rtl")}else{v+=" "+this.toTP("jqx-grid-group-collapse-rtl")}u=false;e.title="";e.innerHTML="";if(e.className!=v){e.className=v}return}}}}if(p&&u&&h>=j){v+=" "+this.toTP("jqx-grid-cell-selected");v+=" "+this.toTP("jqx-fill-state-pressed")}if(e.className!=v){e.className=v}if(d.group!=undefined){cellvalue="";e.title="";e.innerHTML="";return}y(this,g,d,cellvalue,e,n)},_rendercell:function(u,f,j,s,d,q){var g=s+"_"+f.visibleindex;if(f.columntype=="number"||f.cellsrenderer!=null){var g=j.uniqueid+"_"+f.visibleindex}if(u.editcell&&u.editrow==undefined){if(u.editmode=="selectedrow"&&f.editable&&u.editable){if(u.editcell.row==u.getboundindex(j)){if(u._showcelleditor){if(!u.hScrollInstance.isScrolling()&&!u.vScrollInstance.isScrolling()){u._showcelleditor(u.editcell.row,f,d,u.editcell.init)}else{u._showcelleditor(u.editcell.row,f,d,u.editcell.init,false)}return}}}else{if(u.editcell.row==u.getboundindex(j)&&u.editcell.column==f.datafield){u.editcell.element=d;if(u.editcell.editing){if(u._showcelleditor){if(!u.hScrollInstance.isScrolling()&&!u.vScrollInstance.isScrolling()){u._showcelleditor(u.editcell.row,f,u.editcell.element,u.editcell.init)}else{u._showcelleditor(u.editcell.row,f,u.editcell.element,u.editcell.init,false)}return}}}}}var r=u._defaultcellsrenderer(s,f);var n=u._cellscache[g];if(n){if(f.columntype=="inline"){u._renderinlinecell(u,d,f,j,s);if(f.cellsrenderer!=null){var h=f.cellsrenderer(u.getboundindex(j),f.datafield,s,r,f.getcolumnproperties(),j.bounddata);if(h!=undefined){d.innerHTML=h}}return}else{if(f.columntype=="checkbox"){if(u.host.jqxCheckBox){if(s===""){s=null}var m=d.innerHTML.toString().length==0;if(d.checkbox&&!u.groupable&&!m){d.checkboxrow=u.getboundindex(j);if(s==""){s=false}if(s=="1"){s=true}if(s=="0"){s=false}if(s==1){s=true}if(s==0){s=false}if(s=="true"){s=true}if(s=="false"){s=false}if(s==null&&!f.threestatecheckbox){s=false}if(f.checkboxcolumn){s=false;if(u.dataview.filters.length>0){if(u.selectedrowindexes.indexOf(j.bounddata.dataindex)!=-1){s=true}}else{if(u.selectedrowindexes.indexOf(j.bounddata.boundindex)!=-1){s=true}}}if(d.checkboxinstance){d.checkboxinstance._setState(s)}else{d.checkbox.jqxCheckBox("_setState",s)}}else{u._rendercheckboxcell(u,d,f,j,s)}if(f.cellsrenderer!=null){var h=f.cellsrenderer(u.getboundindex(j),f.datafield,s,r,f.getcolumnproperties(),j.bounddata);if(h!=undefined){d.innerHTML=h}}return}}else{if(f.columntype=="button"){if(u.host.jqxButton){if(s==""){s=false}if(f.cellsrenderer!=null){s=f.cellsrenderer(u.getboundindex(j),f.datafield,s,r,f.getcolumnproperties(),j.bounddata)}if(d.innerHTML==""){d.buttonrow=u.getboundindex(j);d.button=null;u._renderbuttoncell(u,d,f,j,s)}if(d.button&&!u.groupable){d.buttonrow=u.getboundindex(j);d.button.val(s)}else{u._renderbuttoncell(u,d,f,j,s)}return}}}}var t=n.element;if(f.cellsrenderer!=null||(d.childNodes&&d.childNodes.length==0)||u.groupable||u.rowdetails){if(d.innerHTML!=t){d.innerHTML=t}}else{if(d.innerHTML.indexOf("editor")>=0){d.innerHTML=t}else{if(q){var o=t.indexOf(">");var l=t.indexOf("</");var p=t.substring(o+1,l);var i=d.childNodes[0];if(i.childNodes[0]){if(p!=i.childNodes[0].nodeValue){if(p.indexOf("&")>=0){d.innerHTML=t}else{i.childNodes[0].nodeValue=p}}}else{var e=document.createTextNode(p);i.appendChild(e)}}else{if(d.innerHTML!=t){d.innerHTML=t}}}}if(u.enabletooltips&&f.enabletooltips){d.title=n.title}return}if(f.columntype=="checkbox"){u._rendercheckboxcell(u,d,f,j,s);u._cellscache[g]={element:"",title:s};if(u.enabletooltips&&f.enabletooltips){d.title=s}return}else{if(f.columntype=="button"){if(f.cellsrenderer!=null){s=f.cellsrenderer(u.getboundindex(j),f.datafield,s,r,f.getcolumnproperties(),j.bounddata)}u._renderbuttoncell(u,d,f,j,s);u._cellscache[g]={element:"",title:s};if(u.enabletooltips&&f.enabletooltips){d.title=s}return}else{if(f.columntype=="number"){s=j.visibleindex}else{if(f.columntype=="inline"){u._renderinlinecell(u,d,f,j,s);u._cellscache[g]={element:"",title:s};if(u.enabletooltips&&f.enabletooltips){d.title=s}return}}}}var t=null;if(f.cellsrenderer!=null){t=f.cellsrenderer(u.getboundindex(j),f.datafield,s,r,f.getcolumnproperties(),j.bounddata)}else{t=r}if(t==null){t=r}var k=s;if(u.enabletooltips&&f.enabletooltips){if(f.cellsformat!=""){if(b.jqx.dataFormat){if(b.jqx.dataFormat.isDate(s)){k=b.jqx.dataFormat.formatdate(k,f.cellsformat,this.gridlocalization)}else{if(b.jqx.dataFormat.isNumber(s)){k=b.jqx.dataFormat.formatnumber(k,f.cellsformat,this.gridlocalization)}}}}d.title=k}if(u.WinJS){WinJS.Utilities.setInnerHTMLUnsafe(d,t)}else{d.innerHTML=t}u._cellscache[g]={element:d.innerHTML,title:k};return true},_isIE10:function(){if(this._browser==undefined){var e=b.jqx.utilities.getBrowser();if(e.browser=="msie"&&parseInt(e.version)>9){this._browser=true}else{this._browser=false;if(e.browser=="msie"){var d="Browser CodeName: "+navigator.appCodeName+"";d+="Browser Name: "+navigator.appName+"";d+="Browser Version: "+navigator.appVersion+"";d+="Platform: "+navigator.platform+"";d+="User-agent header: "+navigator.userAgent+"";if(d.indexOf("Zune 4.7")!=-1){this._browser=true}}}}return this._browser},_renderinlinecell:function(f,d,e,i,g){var h=b(d);d.innerHTML='<div style="position: absolute;"></div>'},_rendercheckboxcell:function(g,e,f,k,h){if(g.host.jqxCheckBox){var j=b(e);if(h===""){if(f.threestatecheckbox){h=null}else{h=false}}if(h=="1"){h=true}if(h=="0"){h=false}if(h==1){h=true}if(h==0){h=false}if(h=="true"){h=true}if(h=="false"){h=false}if(f.checkboxcolumn){h=false;if(this.dataview.filters.length>0){if(this.selectedrowindexes.indexOf(k.bounddata.dataindex)!=-1){h=true}}else{if(this.selectedrowindexes.indexOf(k.bounddata.boundindex)!=-1){h=true}}}if(j.find(".jqx-checkbox").length==0){e.innerHTML='<div style="position: absolute; top: 50%; left: 50%; margin-top: -7px; margin-left: -10px;"></div>';b(e.firstChild).jqxCheckBox({_canFocus:false,hasInput:false,hasThreeStates:f.threestatecheckbox,enableContainerClick:false,animationShowDelay:0,animationHideDelay:0,locked:true,theme:g.theme,checked:h});if(this.editable&&f.editable){b(e.firstChild).jqxCheckBox({locked:false})}if(f.checkboxcolumn){b(e.firstChild).jqxCheckBox({locked:false})}e.checkbox=b(e.firstChild);e.checkboxinstance=e.checkbox.data().jqxCheckBox.instance;e.checkboxrow=k.boundindex;if(this.dataview.filters.length>0){var d=k.bounddata.dataindex;e.checkboxrow=d}var i=b.data(e.firstChild,"jqxCheckBox").instance;i.updated=function(o,n,q){if(f.editable){var p=g.table[0].rows.length;var s=g._getcolumnindex(f.datafield);if(g.editrow==undefined){if(f.cellbeginedit){var r=f.cellbeginedit(e.checkboxrow,f.datafield,f.columntype,!n);if(r==false){g.setcellvalue(e.checkboxrow,f.datafield,!n,true);return}}if(g.editmode!=="selectedrow"){for(var m=0;m<p;m++){var l=g.table[0].rows[m].cells[s].firstChild;if(l){b(l).jqxCheckBox("destroy")}}}if(g.editcell&&g.editcell.validated==false){g.setcellvalue(e.checkboxrow,f.datafield,!n,true)}else{g._raiseEvent(17,{rowindex:e.checkboxrow,datafield:f.datafield,value:q,columntype:f.columntype});g.setcellvalue(e.checkboxrow,f.datafield,n,true);g._raiseEvent(18,{rowindex:e.checkboxrow,datafield:f.datafield,oldvalue:q,value:n,columntype:f.columntype})}}}else{if(f.checkboxcolumn){if(g.editcell){g.endcelledit(g.editcell.row,g.editcell.column,false,true)}if(n){g.selectrow(e.checkboxrow)}else{g.unselectrow(e.checkboxrow)}}}}}else{e.checkboxrow=k.boundindex;if(this.dataview.filters.length>0){d=k.bounddata.dataindex;e.checkboxrow=d}b(e.firstChild).jqxCheckBox("_setState",h)}}},_renderbuttoncell:function(h,e,g,k,i){if(h.host.jqxButton){var j=b(e);if(i==""){i=false}if(j.find(".jqx-button").length==0){e.innerHTML='<input type="button" style="opacity: 0.99; position: absolute; top: 0%; left: 0%; padding: 0px; margin-top: 2px; margin-left: 2px;"/>';b(e.firstChild).val(i);b(e.firstChild).attr("hideFocus","true");b(e.firstChild).jqxButton({theme:h.theme,height:h.rowsheight-4,width:g.width-4});e.button=b(e.firstChild);e.buttonrow=h.getboundindex(k);var d=this.isTouchDevice();if(d){var f=b.jqx.mobile.getTouchEventName("touchend");h.addHandler(b(e.firstChild),f,function(l){if(g.buttonclick){g.buttonclick(e.buttonrow,l)}})}else{h.addHandler(b(e.firstChild),"click",function(l){if(g.buttonclick){g.buttonclick(e.buttonrow,l)}})}}else{e.buttonrow=h.getboundindex(k);b(e.firstChild).val(i)}}},_clearvisualrow:function(g,f,o,i,n){var m=this.toTP("jqx-grid-cell");if(f){m=" "+this.toTP("jqx-grid-group-cell")}m+=" "+this.toTP("jqx-grid-cleared-cell");var p=this.table[0].rows;for(var k=0;k<i+n;k++){if(p[o]){var e=p[o].cells[k];if(e.className!=m){e.className=m}var d=this.columns.records[k];if(this._horizontalvalue!=g&&!d.pinned){if(this.oldhscroll==true){var h=-g;e.style.marginLeft=-g+"px"}}var l=d.width;if(l<d.minwidth){l=d.minwidth}if(l>d.maxwidth){l=d.maxwidth}if(parseInt(e.style.width)!=l){b(e).width(l)}if(e.title!=""){e.title=""}if(e.innerHTML!=""){e.innerHTML=""}}}if(p[o]){if(parseInt(p[o].style.height)!=this.rowsheight){p[o].style.height=parseInt(this.rowsheight)+"px"}}},_findgroupstate:function(e){var d=this._findgroup(e);if(d==null){return false}return d.expanded},_findgroup:function(e){var d=null;if(this.expandedgroups[e]){return this.expandedgroups[e]}return d},_clearcaches:function(){this._columnsbydatafield=new Array();this._pagescache=new Array();this._pageviews=new Array();this._cellscache=new Array();this.heights=new Array();this.hiddens=new Array();this.hiddenboundrows=new Array();this.heightboundrows=new Array();this.detailboundrows=new Array();this.details=new Array();this.expandedgroups=new Array();this._rowdetailscache=new Array();this._rowdetailselementscache=new Array();if(b.jqx.dataFormat){b.jqx.dataFormat.cleardatescache()}this.tableheight=null},_getColumnText:function(d){if(this._columnsbydatafield==undefined){this._columnsbydatafield=new Array()}if(this._columnsbydatafield[d]){return this._columnsbydatafield[d]}var f=d;var e=null;b.each(this.columns.records,function(){if(this.datafield==d){f=this.text;e=this;return false}});this._columnsbydatafield[d]={label:f,column:e};return this._columnsbydatafield[d]},_getcolumnbydatafield:function(d){if(this.__columnsbydatafield==undefined){this.__columnsbydatafield=new Array()}if(this.__columnsbydatafield[d]){return this.__columnsbydatafield[d]}var f=d;var e=null;b.each(this.columns.records,function(){if(this.datafield==d||this.displayfield==d){f=this.text;e=this;return false}});this.__columnsbydatafield[d]=e;return this.__columnsbydatafield[d]},isscrollingvertically:function(){var d=(this.vScrollBar.jqxScrollBar("isScrolling"));return d},_renderrowdetails:function(q,y,d,x,n,A){if(y==undefined){return}var D=b(y);var g=0;var t=this.rowdetails&&this.showrowdetailscolumn?(1+this.groups.length)*this.groupindentwidth:(this.groups.length)*this.groupindentwidth;if(this.groupable&&this.groups.length>0){for(var r=0;r<=n;r++){var e=b(y.cells[r]);e[0].innerHTML="";e[0].className="jqx-grid-details-cell"}}var e=b(y.cells[g]);if(e[0].style.display=="none"){var o=y.cells[g];var B=2;var l=g;while(o!=undefined&&o.style.display=="none"&&B<10){o=y.cells[l+B-1];B++}e=b(o)}if(this.rtl){for(var v=x;v<n;v++){y.cells[v].innerHTML="";y.cells[v].className="jqx-grid-details-cell"}}e.css("width","100%");D.height(d.rowdetailsheight);e[0].className=q;var p=this.getboundindex(d);var j=p+"_";if(this._rowdetailscache[j]){var u=this._rowdetailscache[j];var C=u.html;if(this.initrowdetails){if(this._rowdetailscache[j].element){var f=this._rowdetailscache[j].element;var i=e.coord();var z=this.gridcontent.coord();var w=parseInt(i.top)-parseInt(z.top);var k=parseInt(i.left)-parseInt(z.left);if(this.rtl){k=0}b(f).css("top",w);b(f).css("left",k);b(f).css("display","block");b(f).width(this.host.width()-t);if(this.layoutrowdetails){this.layoutrowdetails(p,f,this.element,this.getrowdata(p))}}}else{e[0].innerHTML=C}return}e[0].innerHTML="";if(!this.enablerowdetailsindent){t=0}var h='<div role="rowgroup" style="border: none; overflow: hidden; width: 100%; height: 100%; margin-left: '+t+'px;">'+d.rowdetails+"</div>";if(this.rtl){var h='<div role="rowgroup" style="border: none; overflow: hidden; width: 100%; height: 100%; margin-left: '+0+"px; margin-right: "+t+'px;">'+d.rowdetails+"</div>"}this._rowdetailscache[j]={id:y.id,html:h};if(this.initrowdetails){var f=b(h)[0];b(this.gridcontent).prepend(b(f));b(f).css("position","absolute");b(f).width(this.host.width()-t);b(f).height(e.height());var i=e.coord();b(f).css("z-index",2000);if(this.isTouchDevice()){b(f).css("z-index",99999)}b(f).addClass(this.toThemeProperty("jqx-widget-content"));var i=e.coord();var z=this.gridcontent.coord();var w=parseInt(i.top)-parseInt(z.top);var k=parseInt(i.left)-parseInt(z.left);b(f).css("top",w);b(f).css("left",k);this.content[0].scrollTop=0;this.content[0].scrollLeft=0;this.initrowdetails(p,f,this.element,this.getrowdata(p));this._rowdetailscache[j].element=f;this._rowdetailselementscache[p]=f}else{e[0].innerHTML=h}},_defaultcellsrenderer:function(f,d){if(d.cellsformat!=""){if(b.jqx.dataFormat){if(b.jqx.dataFormat.isDate(f)){f=b.jqx.dataFormat.formatdate(f,d.cellsformat,this.gridlocalization)}else{if(b.jqx.dataFormat.isNumber(f)){f=b.jqx.dataFormat.formatnumber(f,d.cellsformat,this.gridlocalization)}}}}var e="4px";if(this.rowsheight!=25){e=(this.rowsheight/2-this._cellheight/2);if(e<0){e=4}e+="px"}if(this.enableellipsis){if(d.cellsalign=="center"||d.cellsalign=="middle"){e="5px";return'<div style="text-overflow: ellipsis; overflow: hidden; padding-bottom: 2px; text-align: center; margin-top: '+e+';">'+f+"</div>"}if(d.cellsalign=="left"){return'<div style="overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: '+e+';">'+f+"</div>"}if(d.cellsalign=="right"){return'<div style="overflow: hidden;  text-overflow: ellipsis; padding-bottom: 2px; text-align: right; margin-right: 2px; margin-left: 4px; margin-top: '+e+';">'+f+"</div>"}}if(d.cellsalign=="center"||d.cellsalign=="middle"){e="5px";return'<div style="text-align: center; margin-top: '+e+';">'+f+"</div>"}return'<span style="margin-left: 4px; margin-right: 2px; margin-top: '+e+"; float: "+d.cellsalign+';">'+f+"</span>"},getcelltext:function(g,e){if(g==null||e==null){return null}var d=this.getcellvalue(g,e);var f=this.getcolumn(e);if(f&&f.cellsformat!=""){if(b.jqx.dataFormat){if(b.jqx.dataFormat.isDate(d)){d=b.jqx.dataFormat.formatdate(d,f.cellsformat,this.gridlocalization)}else{if(b.jqx.dataFormat.isNumber(d)){d=b.jqx.dataFormat.formatnumber(d,f.cellsformat,this.gridlocalization)}}}}return d},getcelltextbyid:function(g,e){if(g==null||e==null){return null}var d=this.getcellvaluebyid(g,e);var f=this.getcolumn(e);if(f&&f.cellsformat!=""){if(b.jqx.dataFormat){if(b.jqx.dataFormat.isDate(d)){d=b.jqx.dataFormat.formatdate(d,f.cellsformat,this.gridlocalization)}else{if(b.jqx.dataFormat.isNumber(d)){d=b.jqx.dataFormat.formatnumber(d,f.cellsformat,this.gridlocalization)}}}}return d},_getcellvalue:function(d,f){var e=null;e=f.bounddata[d.datafield];if(d.displayfield!=null){e=f.bounddata[d.displayfield]}if(e==null){e=""}return e},getcell:function(h,d){if(h==null||d==null){return null}var e=parseInt(h);var g=h;var f="";if(!isNaN(e)){g=this.getrowdata(e)}if(g!=null){f=g[d]}return this._getcellresult(f,h,d)},getrenderedcell:function(h,d){if(h==null||d==null){return null}var e=parseInt(h);var g=h;var f="";if(!isNaN(e)){g=this.getrenderedrowdata(e)}if(g!=null){f=g[d]}return this._getcellresult(f,h,d)},_getcellresult:function(k,n,e){var f=this.getcolumn(e);if(f==null||f==undefined){return null}var i=f.getcolumnproperties();var g=i.hidden;var d=i.width;var m=i.pinned;var h=i.cellsalign;var j=i.cellsformat;var l=this.getrowheight(n);if(l==false){return null}return{value:k,row:n,column:e,datafield:e,width:d,height:l,hidden:g,pinned:m,align:h,format:j}},setcellvaluebyid:function(i,d,h,f,g){var e=this.getrowboundindexbyid(i);return this.setcellvalue(e,d,h,f,g)},getcellvaluebyid:function(f,d){var e=this.getrowboundindexbyid(f);return this.getcellvalue(e,d)},setcellvalue:function(s,y,D,l,w){if(s==null||y==null){return false}var i=parseInt(s);var o=i;var m=s;if(!isNaN(i)){m=this.getrowdata(i)}var z=false;if(this.filterable&&this._initfilterpanel&&this.dataview.filters.length){z=true}if(this.virtualmode){this._pagescache=new Array()}var u="";if(m!=null&&m[y]!==D){var h=this._getcolumnbydatafield(y);var j="string";var I=this.source.datafields||((this.source._source)?this.source._source.datafields:null);if(I){var A="";b.each(I,function(){if(this.name==h.displayfield){if(this.type){A=this.type}return false}});if(A){j=A}}u=m[y];if(!h.nullable||(D!=null&&D!==""&&h.nullable&&D.label===undefined)){if(b.jqx.dataFormat.isNumber(u)||j=="number"||j=="float"||j=="int"||j=="decimal"&&j!="date"){D=new Number(D);D=parseFloat(D);if(isNaN(D)){D=0}}else{if(b.jqx.dataFormat.isDate(u)||j=="date"){if(D!=""){var H=D;H=new Date(H);if(H!="Invalid Date"&&H!=null){D=H}else{if(H=="Invalid Date"){H=new Date();D=H}}}}}}m[y]=D;var L=this.getrenderedrowdata(i,true);L[y]=D;if(D!=null&&D.label!=null){var h=this._getcolumnbydatafield(y);m[h.displayfield]=D.label;L[h.displayfield]=D.label;m[y]=D.value;L[y]=D.value}if(z){if(m.dataindex!=undefined){o=m.dataindex;this.dataview.cachedrecords[m.dataindex][y]=D;if(D!=null&&D.label!=undefined){this.dataview.cachedrecords[m.dataindex][y]=D.value;this.dataview.cachedrecords[m.dataindex][h.displayfield]=D.label}}}}else{if(!this._updating&&l!=false){this._renderrows(this.virtualsizeinfo)}return false}if(this.source&&this.source._knockoutdatasource&&!this._updateFromAdapter&&this.autokoupdates){if(this.source._source._localdata){var G=i;if(z){if(m.dataindex!=undefined){G=m.dataindex}}var C=this.source._source._localdata()[G];this.source.suspendKO=true;var r=C;if(r[y]&&r[y].subscribe){if(D!=null&&D.label!=null){r[h.displayfield](D.label);r[y](D.value)}else{r[y](D)}}else{var I=this.source._source.datafields;var g=null;var J=null;if(I){b.each(I,function(){if(this.name==y){J=this.map;return false}})}if(J==null){if(D!=null&&D.label!=null){r[y]=D.value;r[h.displayfield]=D.label}else{r[y]=D}}else{var k=J.split(this.source.mapChar);if(k.length>0){var e=r;for(var B=0;B<k.length-1;B++){e=e[k[B]]}e[k[k.length-1]]=D}}this.source._source._localdata.replace(C,b.extend({},r))}this.source.suspendKO=false}}if(this.sortcolumn&&this.dataview.sortby&&!this._updating){var v=this.getsortinformation();if(this.sortcolumn==y){this.dataview.clearsortdata();this.dataview.sortby(v.sortcolumn,v.sortdirection.ascending)}}else{if(!this._updating){if(this.dataview.sortby){if(this.dataview.sortcache[y]){this.dataview.sortcache[y]=null}}}}this._cellscache=new Array();if(this.source.updaterow&&(w==undefined||w==true)){var t=false;var K=this.that;var x=function(p){if(false==p){K.setcellvalue(s,y,u,true,false)}};try{var q=this.getrowid(i);t=this.source.updaterow(q,m,x);if(t==undefined){t=true}}catch(E){t=false;K.setcellvalue(s,y,u,true,false);return}}var n=this.vScrollInstance.value;if(this._updating&&l!=true){l=false}if(l==true||l==undefined){var K=this.that;var f=function(){if(K.pageable&&K.updatepagerdetails){K.updatepagerdetails();if(K.autoheight||K.autorowheight){K._updatepageviews()}}};var F=this.groupable&&this.groups.length>0;if(z&&!F){if(this.autoheight||this.autorowheight){this.prerenderrequired=true}this.dataview.refresh();this.rendergridcontent(true,false);f();this._renderrows(this.virtualsizeinfo)}else{if(this.sortcolumn&&!F){if(this.autoheight||this.autorowheight){this.prerenderrequired=true}this.dataview.reloaddata();this.rendergridcontent(true,false);f();this._renderrows(this.virtualsizeinfo)}else{if(this.groupable&&this.groups.length>0){if(this.autoheight||this.autorowheight){this.prerenderrequired=true}if(this.pageable){if(this.groups.indexOf(y)!=-1){this._pagescache=new Array();this._cellscache=new Array();this.dataview.refresh();this._render(true,true,false,false)}else{this._pagescache=new Array();this._cellscache=new Array();this.dataview.updateview();this._renderrows(this.virtualsizeinfo)}}else{this._pagescache=new Array();this._cellscache=new Array();this.dataview.updateview();this._renderrows(this.virtualsizeinfo)}}else{this.dataview.updateview();this._renderrows(this.virtualsizeinfo)}}}}this.vScrollInstance.setPosition(n);if(this.showaggregates&&this._updatecolumnsaggregates){this._updatecolumnsaggregates()}if(this.showfilterrow&&this.filterable&&this.filterrow){var d=this.getcolumn(y).filtertype;if(d=="list"||d=="checkedlist"){this._updatelistfilters(true)}}this._raiseEvent(19,{rowindex:s,datafield:y,newvalue:D,value:D,oldvalue:u});return true},getcellvalue:function(h,d){if(h==null||d==null){return null}var e=parseInt(h);var g=h;if(!isNaN(e)){g=this.getrowdata(e)}if(g!=null){var f=g[d];return f}return null},getrows:function(){var h=this.dataview.records.length;if(this.virtualmode){var j=new Array();for(var e=0;e<this.dataview.records.length;e++){var d=this.dataview.records[e];if(d){j.push(d)}}if(this.dataview.records.length===undefined){b.each(this.dataview.records,function(){var i=this;if(i){j.push(i)}})}var g=0;if(this.pageable){g=this.dataview.pagenum*this.dataview.pagesize}if(j.length>this.source._source.totalrecords-g){return j.slice(0,this.source._source.totalrecords-g)}return j}if(this.dataview.sortdata){var j=new Array();for(var e=0;e<h;e++){var f={};f=b.extend({},this.dataview.sortdata[e].value);j[e]=f}return j}else{return this.dataview.records}},getrowboundindexbyid:function(g){var f=this.dataview.recordsbyid["id"+g];if(f){if(f.boundindex){return this.getboundindex(f)}}var e=this.getboundrows();for(var d=0;d<e.length;d++){if(e[d]){if(e[d].uid==g){return d}}}return -1},getrowdatabyid:function(f){var e=this.dataview.recordsbyid["id"+f];if(e){return e}else{var d=this.getrowboundindexbyid(f);return this.getboundrows()[d]}return null},getrowdata:function(d){if(d==undefined){d=0}if(this.virtualmode){var e=this.dataview.records[d];return e}else{var e=this.getboundrows()[d];return e}return null},getrenderedrowdata:function(d,f){if(d==undefined){d=0}if(this.virtualmode){var g=this.getrowvisibleindex(d);var e=this.dataview.loadedrecords[g];return e}var g=this.getrowvisibleindex(d);if(g>=0){if(this.groupable&&this.groups.length>0){var e=this.dataview.loadedrecords[g]}else{var e=this.dataview.loadedrecords[g];if(this.pageable&&(f==undefined||f==false)){var e=this.dataview.loadedrecords[this.dataview.pagesize*this.dataview.pagenum+d]}}return e}return null},getboundrows:function(){return this.dataview.cachedrecords},getrowdisplayindex:function(d){var f=this.getdisplayrows();for(var e=0;e<f.length;e++){if(f[e].dataindex!==undefined){if(f[e].dataindex===d){return f[e].visibleindex}}else{if(f[e].boundindex===d){return f[e].visibleindex}}}return -1},getboundindex:function(e){var d=e.boundindex;if(this.dataview.filters.length>0){if(e.bounddata){if(e.bounddata.dataindex!==undefined){d=e.bounddata.dataindex}}else{if(e.dataindex!==undefined){d=e.dataindex}}}return d},getrowboundindex:function(d){var e=this.getdisplayrows()[d];if(e){if(e.dataindex!==undefined){return e.dataindex}return e.boundindex}return -1},getdisplayrows:function(){return this.dataview.loadedrecords},getloadedrows:function(){return this.getdisplayrows()},getvisiblerowdata:function(e){var d=this.getvisiblerows();if(d){return d[e]}return null},getloadedrowdata:function(e){var d=this.getloadedrows();if(d){return d[e]}return null},getvisiblerows:function(){if(this.virtualmode){return this.dataview.loadedrecords}if(this.pageable){var f=[];for(var e=0;e<this.dataview.pagesize;e++){var d=this.dataview.loadedrecords[e+(this.dataview.pagesize*this.dataview.pagenum)];if(d==undefined){break}f.push(d)}return f}else{if(this._startboundindex!=undefined&&this._endboundindex!=undefined){var f=[];for(var e=this._startvisibleindex;e<=this._endvisibleindex;e++){var d=this.dataview.loadedrecords[e];if(d==undefined){break}f.push(d)}return f}}return this.dataview.loadedrecords},getrowid:function(d){if(d==undefined){d=0}if(this.virtualmode){var g=this.getrowvisibleindex(d);var f=this.dataview.loadedrecords[g];if(f){return f.uid}}else{var f=null;var e=this.dataview.filters.length>0;if(d>=0&&d<this.dataview.bounditems.length&&!e){if(this.groupable&&this.groups.length>0){var g=this.getrowvisibleindex(d);var f=this.dataview.loadedrecords[g]}else{var g=this.getrowvisibleindex(d);var f=this.dataview.loadedrecords[g]}if(f){return f.uid}}if(this.dataview.filters.length>0){var f=this.getboundrows()[d];if(f){if(f.uid!=null){return f.uid}}return null}}return null},_updateGridData:function(e){var d=false;if(this.filterable&&this._initfilterpanel&&this.dataview.filters.length){d=true}if(d){this.dataview.refresh();if(e=="updaterow"){this._render(true,true,false,false,false);this.invalidate()}else{this.render()}}else{if(this.sortcolumn||(this.groupable&&this.groups.length>0)){this.dataview.reloaddata();this.render()}else{this._cellscache=new Array();this._pagescache=new Array();this._renderrows(this.virtualsizeinfo)}}if(this.showfilterrow&&this.filterable&&this.filterrow){this._updatelistfilters(true)}},updaterow:function(i,k,g){if(i!=undefined&&k!=undefined){var h=this.that;var j=false;h._datachanged=true;var e=function(o,n,s){if(o._loading){throw new Error("jqxGrid: "+o.loadingerrormessage);return false}var q=false;if(!b.isArray(n)){q=o.dataview.updaterow(n,s)}else{b.each(n,function(t,u){q=o.dataview.updaterow(this,s[t],false)});o.dataview.refresh()}var r=o.vScrollInstance.value;if(g==undefined||g==true){if(o._updating==undefined||o._updating==false){o._updateGridData("updaterow")}}if(o.showaggregates&&o._updatecolumnsaggregates){o._updatecolumnsaggregates()}if(o.source&&o.source._knockoutdatasource&&!o._updateFromAdapter&&o.autokoupdates){if(o.source._source._localdata){var m=o.dataview.recordsbyid["id"+n];var p=o.dataview.records.indexOf(m);var l=o.source._source._localdata()[p];o.source.suspendKO=true;o.source._source._localdata.replace(l,b.extend({},m));o.source.suspendKO=false}}o.vScrollInstance.setPosition(r);return q};if(this.source.updaterow){var d=function(l){if(l==true||l==undefined){e(h,i,k)}};try{j=this.source.updaterow(i,k,d);if(j==undefined){j=true}}catch(f){j=false}}else{j=e(h,i,k)}return j}return false},deleterow:function(h){if(h!=undefined){this._datachanged=true;var i=false;var g=this.that;var e=function(k,j){if(k._loading){throw new Error("jqxGrid: "+k.loadingerrormessage);return false}var l=false;var m=k.vScrollInstance.value;if(!b.isArray(j)){var l=k.dataview.deleterow(j)}else{b.each(j,function(){l=k.dataview.deleterow(this,false)});k.dataview.refresh()}if(k._updating==undefined||k._updating==false){k._render(true,true,false,false);if(k.vScrollBar.css("visibility")!="visible"){k._arrange();k._updatecolumnwidths();k._updatecellwidths();k._renderrows(k.virtualsizeinfo)}}if(k.source&&k.source._knockoutdatasource&&!k._updateFromAdapter&&k.autokoupdates){if(k.source._source._localdata){k.source.suspendKO=true;k.source._source._localdata.pop(rowdata);k.source.suspendKO=false}}k.vScrollInstance.setPosition(m);return l};if(this.source.deleterow){var d=function(j){if(j==true||j==undefined){e(g,h)}};try{this.source.deleterow(h,d);if(i==undefined){i=true}}catch(f){i=false}}else{i=e(g,h)}return i}return false},addrow:function(f,o,j){if(o!=undefined){this._datachanged=true;if(j==undefined){j="last"}var n=false;var m=this.that;if(f==null){var g=this.dataview.filters&&this.dataview.filters.length>0;var l=!g?this.dataview.totalrecords:this.dataview.cachedrecords.length;if(!b.isArray(o)){f=this.dataview.getid(this.dataview.source.id,o,l)}else{var d=new Array();b.each(o,function(e,p){var q=m.dataview.getid(m.dataview.source.id,o[e],l+e);d.push(q)});f=d}}var h=function(q,p,t,e){if(q._loading){throw new Error("jqxGrid: "+q.loadingerrormessage);return false}var s=q.vScrollInstance.value;var r=false;if(!b.isArray(t)){if(t!=undefined&&t.dataindex!=undefined){delete t.dataindex}r=q.dataview.addrow(p,t,e)}else{b.each(t,function(u,v){if(this.dataindex!=undefined){delete this.dataindex}var w=null;if(p!=null&&p[u]!=null){w=p[u]}r=q.dataview.addrow(w,this,e,false)});q.dataview.refresh()}if(q._updating==undefined||q._updating==false){q._render(true,true,false,false);q.invalidate()}if(q.source&&q.source._knockoutdatasource&&!q._updateFromAdapter&&q.autokoupdates){if(q.source._source._localdata){q.source.suspendKO=true;q.source._source._localdata.push(t);q.source.suspendKO=false}}if(q.scrollmode!="deferred"){q.vScrollInstance.setPosition(s)}else{q.vScrollInstance.setPosition(0)}return r};if(this.source.addrow){var i=function(e,p){if(e==true||e==undefined){if(p!=undefined){f=p}h(m,f,o,j)}};try{n=this.source.addrow(f,o,j,i);if(n==undefined){n=true}}catch(k){n=false}if(n==false){return false}}else{h(this,f,o,j)}return n}return false},_findvisiblerow:function(g,h){if(g==undefined){g=parseInt(this.vScrollInstance.value)}var e=0;if(h==undefined||h==null){h=this.rows.records}var d=h.length;while(e<=d){mid=parseInt((e+d)/2);var f=h[mid];if(f==undefined){break}if(f.top>g&&f.top+f.height>g){d=mid-1}else{if(f.top<g&&f.top+f.height<g){e=mid+1}else{return mid;break}}}return -1},_updatecellwidths:function(){var f=this.virtualsizeinfo;if(!f){return}var p=this.that;if(this.gridcontent==undefined){return}if(this.table==undefined){this.table=this.gridcontent.find("#contenttable"+this.element.id)}var k=this.groupable&&this.groups.length>0;var q=0;var l=f.visiblerecords;if(this.pageable&&(this.autoheight||this.autorowheight)){l=this.dataview.pagesize;if(this.groupable){this.dataview.updateview();l=this.dataview.rows.length}}if(!this.groupable&&!this.pageable&&(this.autoheight||this.autorowheight)){l=this.dataview.totalrecords}if(this.rowdetails){l+=this.dataview.pagesize}var r=this.columns.records.length;var t=this.table[0].rows;for(var n=0;n<l;n++){var d=t[n];if(!d){break}var s=d.cells;var h=0;for(var m=0;m<r;m++){var g=this.columns.records[m];var e=g.width;var o=s[m];if(parseInt(o.style.left)!=h){o.style.left=h+"px"}if(parseInt(o.style.width)!=e){o.style.width=e+"px"}if(!(g.hidden&&g.hideable)){h+=e}else{o.style.display="none"}}if(q==0){this.table.width(parseInt(h)+2);q=h}}if(this.showaggregates&&this._updateaggregates){this._updateaggregates()}if(this.showfilterrow&&this.filterable&&this._updatefilterrowui){this._updatefilterrowui()}this._updatescrollbarsafterrowsprerender();if(k){this._renderrows()}},_updatescrollbarsafterrowsprerender:function(){var f=this.hScrollBar[0].style.visibility;var h=0;var d=this.vScrollBar[0].style.visibility;if(d=="visible"){h=this.scrollbarsize+3}var e=this.element.style.width;if(e.toString().indexOf("%")>=0){e=this.host.width()}else{e=parseInt(e)}if(parseInt(this.table[0].style.width)-2>e-h){if(f!="visible"){if(!this.autowidth){this.hScrollBar.css("visibility","visible")}this._arrange()}if(d=="visible"){if(this.scrollmode!="deferred"&&!this.virtualmode){if(this.virtualsizeinfo){var g=this.virtualsizeinfo.virtualheight-this._gettableheight();if(!isNaN(g)&&g>0){if(f!="hidden"){this.vScrollBar.jqxScrollBar("max",g+this.scrollbarsize+4)}else{this.vScrollBar.jqxScrollBar("max",g)}}}}else{this._updatevscrollbarmax()}}else{h=-2}this.hScrollBar.jqxScrollBar("max",h+this.table.width()-this.host.width())}else{if(f!="hidden"){this.hScrollBar.css("visibility","hidden");this._arrange()}}this._renderhorizontalscroll()},_prerenderrows:function(o){var B=this.that;if(this.prerenderrequired==true){this.prerenderrequired=false;if(this.editable&&this._destroyeditors){this._destroyeditors()}if(this.gridcontent==undefined){return}this.gridcontent.find("#contenttable"+this.element.id).remove();if(this.table!=null){this.table.remove();this.table=null}this.table=b('<div id="contenttable'+this.element.id+'" style="overflow: hidden; position: relative;" height="100%"></div>');this.gridcontent.addClass(this.toTP("jqx-grid-content"));this.gridcontent.addClass(this.toTP("jqx-widget-content"));this.gridcontent.append(this.table);var A=this.groupable&&this.groups.length>0;var p=0;this.table[0].rows=new Array();var l=this.toTP("jqx-grid-cell");if(A){l=" "+this.toTP("jqx-grid-group-cell")}var u=o.visiblerecords;if(this.pageable&&(this.autoheight||this.autorowheight)){u=this.dataview.pagesize;if(this.groupable){this.dataview.updateview();u=this.dataview.rows.length;if(u<this.dataview.pagesize){u=this.dataview.pagesize}}}if(!this.pageable&&(this.autoheight||this.autorowheight)){u=this.dataview.totalrecords}if(this.groupable&&(this.autoheight||this.autorowheight)&&!this.pageable){u=this.dataview.rows.length}if(this.rowdetails){if(this.autoheight||this.autorowheight){u+=this.dataview.pagesize}else{u+=u}}var z=this.columns.records.length;if(b.jqx.browser.msie&&b.jqx.browser.version>8){this.table.css("opacity","0.99")}if(b.jqx.browser.mozilla){this.table.css("opacity","0.99")}if(navigator.userAgent.indexOf("Safari")!=-1){this.table.css("opacity","0.99")}var r=b.jqx.browser.msie&&b.jqx.browser.version<8;if(r){this.host.attr("hideFocus","true")}var k=this.tableZIndex;if(u*z>k){k=u*z}var g=this.dataview.records.length==0;var n=this.isTouchDevice();var v="";this._hiddencolumns=false;for(var y=0;y<u;y++){var s='<div role="row" style="position: relative; height='+this.rowsheight+'px;" id="row'+y+this.element.id+'">';if(r){var s='<div role="row" style="position: relative; z-index: '+k+"; height:"+this.rowsheight+'px;" id="row'+y+this.element.id+'">';k--}var f=0;for(var w=0;w<z;w++){var x=this.columns.records[w];var t=x.width;if(t<x.minwidth){t=x.minwidth}if(t>x.maxwidth){t=x.maxwidth}if(this.rtl){var q=k-z+2*w;var d='<div role="gridcell" style="left: '+f+"px; z-index: "+q+"; width:"+t+"px;";k--}else{var d='<div role="gridcell" style="left: '+f+"px; z-index: "+k--+"; width:"+t+"px;"}if(!(x.hidden&&x.hideable)){f+=t}else{d+="display: none;";this._hiddencolumns=true;k++}d+='" class="'+l+'"></div>';s+=d}if(p==0){this.table.width(parseInt(f)+2);p=f}s+="</div>";v+=s}if(B.WinJS){MSApp.execUnsafeLocalFunction(function(){B.table.html(v)})}else{B.table[0].innerHTML=v}this.table[0].rows=new Array();var m=this.table.children();for(var y=0;y<u;y++){var h=m[y];this.table[0].rows.push(h);h.cells=new Array();var e=b(h).children();for(var w=0;w<z;w++){h.cells.push(e[w])}}if(u==0){var f=0;if(this.showemptyrow){var s=b('<div style="position: relative;" id="row0'+this.element.id+'"></div>');this.table.append(s);s.height(this.rowsheight);this.table[0].rows[0]=s[0];this.table[0].rows[0].cells=new Array()}for(var w=0;w<z;w++){var x=this.columns.records[w];var t=x.width;if(this.showemptyrow){var d=b('<div style="position: absolute; height: 100%; left: '+f+"px; z-index: "+k--+"; width:"+t+'px;" class="'+l+'"></div>');d.height(this.rowsheight);s.append(d);this.table[0].rows[0].cells[w]=d[0]}if(t<x.minwidth){t=x.minwidth}if(t>x.maxwidth){t=x.maxwidth}if(!(x.hidden&&x.hideable)){f+=t}}this.table.width(parseInt(f)+2);p=f}this._updatescrollbarsafterrowsprerender();if(this.rendered){this.rendered("rows")}this._addoverlayelement()}},_groupsheader:function(){return this.groupable&&this.showgroupsheader},_arrange:function(){var A=null;var x=null;this.tableheight=null;var F=this.that;var n=false;var m=false;if(this.width!=null&&this.width.toString().indexOf("px")!=-1){A=this.width}else{if(this.width!=undefined&&!isNaN(this.width)){A=this.width}}if(this.width!=null&&this.width.toString().indexOf("%")!=-1){A=this.width;n=true}if(this.autowidth){var p=0;for(var B=0;B<this.columns.records.length;B++){var e=this.columns.records[B].width;if(e=="auto"){e=this._measureElementWidth(this.columns.records[B].text);p+=e}else{p+=e}}if(this.vScrollBar.css("visibility")!="hidden"){p+=this.scrollbarsize+4}A=p;this.width=A}if(this.height!=null&&this.height.toString().indexOf("px")!=-1){x=this.height}else{if(this.height!=undefined&&!isNaN(this.height)){x=this.height}}if(this.height!=null&&this.height.toString().indexOf("%")!=-1){x=this.height;m=true}var k=function(){var i=0;var w=F.showheader?F.columnsheader!=null?F.columnsheader.height()+2:0:0;i+=w;if(F.pageable){i+=F.pagerheight}if(F._groupsheader()){i+=F.groupsheaderheight}if(F.showtoolbar){i+=F.toolbarheight}if(F.showstatusbar){i+=F.statusbarheight}if(F.hScrollBar[0].style.visibility=="visible"){i+=20}return i};if(this.autoheight&&this.virtualsizeinfo){if(this.pageable&&this.gotopage){var C=0;x=C+(this._pageviews[0]?this._pageviews[0].height:0);x+=k();if(this.showemptyrow&&this.dataview.totalrecords==0){x+=this.rowsheight}}else{var C=this.host.height()-this._gettableheight();if(this._pageviews.length>0){x=C+this._pageviews[this._pageviews.length-1].height+this._pageviews[this._pageviews.length-1].top;this.vScrollBar[0].style.visibility="hidden"}else{x=k();if(this.showemptyrow){x+=this.rowsheight}}}}else{if(this.autoheight){x=this.dataview.totalrecords*this.rowsheight;if(this._loading){x=250;this.dataloadelement.height(x)}x+=k();if(x>10000){x=10000}}}if(A!=null){A=parseInt(A);if(!n){if(this.element.style.width!=parseInt(this.width)+"px"){this.element.style.width=parseInt(this.width)+"px"}}else{this.element.style.width=this.width}if(n){A=this.host.width();if(A<=2){A=600;this.host.width(A)}if(!this._oldWidth){this._oldWidth=A}}}else{this.host.width(250)}if(x!=null){if(!m){x=parseInt(x)}if(!m){if(this.element.style.height!=parseInt(x)+"px"){this.element.style.height=parseInt(x)+"px"}}else{this.element.style.height=this.height}if(m&&!this.autoheight){x=this.host.height();if(x==0){x=400;this.host.height(x)}if(!this._oldHeight){this._oldHeight=x}}}else{this.host.height(250)}if(this.autoheight){this.tableheight=null;this._gettableheight()}var v=0;if(this.showtoolbar){this.toolbar.width(A);this.toolbar.height(this.toolbarheight-1);this.toolbar.css("top",0);v+=this.toolbarheight;x-=parseInt(this.toolbarheight)}else{this.toolbar[0].style.height="0px"}if(this.showstatusbar){if(this.showaggregates){this.statusbar.width(!this.table?A:Math.max(A,this.table.width()))}else{this.statusbar.width(A)}this.statusbar.height(this.statusbarheight-1)}else{this.statusbar[0].style.height="0px"}if(this._groupsheader()){this.groupsheader.width(A);this.groupsheader.height(this.groupsheaderheight);this.groupsheader.css("top",v);var y=this.groupsheader.height()+1;v+=y;if(x>y){x-=parseInt(y)}}else{if(this.groupsheader[0].style.width!=A+"px"){this.groupsheader[0].style.width=parseInt(A)+"px"}if(this.groupsheader[0].style.height!=this.groupsheaderheight+"px"){this.groupsheader[0].style.height=parseInt(this.groupsheaderheight)+"px"}if(this.groupsheader[0].style.top!=v+"px"){this.groupsheader.css("top",v)}var y=this.showgroupsheader&&this.groupable?this.groupsheaderheight:0;var f=v+y+"px";if(this.content[0].style.top!=f){this.content.css("top",v+this.groupsheaderheight)}}var d=this.scrollbarsize;if(isNaN(d)){d=parseInt(d);if(isNaN(d)){d="17px"}else{d=d+"px"}}d=parseInt(d);var s=4;var h=2;var j=0;if(this.vScrollBar[0].style.visibility=="visible"){j=d+s}if(this.hScrollBar[0].style.visibility=="visible"){h=d+s+2}var r=0;if(this.pageable){r=this.pagerheight;h+=this.pagerheight}if(this.showstatusbar){h+=this.statusbarheight;r+=this.statusbarheight}if(this.hScrollBar[0].style.height!=d+"px"){this.hScrollBar[0].style.height=parseInt(d)+"px"}if(this.hScrollBar[0].style.top!=v+x-s-d-r+"px"||this.hScrollBar[0].style.left!="0px"){this.hScrollBar.css({top:v+x-s-d-r+"px",left:"0px"})}var q=this.hScrollBar[0].style.width;var l=false;var D=false;if(j==0){if(q!=(A-2)+"px"){this.hScrollBar.width(A-2);l=true}}else{if(q!=(A-d-s)+"px"){this.hScrollBar.width(A-d-s+"px");l=true}}if(!this.autoheight){if(this.vScrollBar[0].style.width!=d+"px"){this.vScrollBar.width(d);D=true}if(this.vScrollBar[0].style.height!=parseInt(x)-h+"px"){this.vScrollBar.height(parseInt(x)-h+"px");D=true}if(this.vScrollBar[0].style.left!=parseInt(A)-parseInt(d)-s+"px"||this.vScrollBar[0].style.top!=v+"px"){this.vScrollBar.css({left:parseInt(A)-parseInt(d)-s+"px",top:v})}}if(this.rtl){this.vScrollBar.css({left:"0px",top:v});if(this.vScrollBar.css("visibility")!="hidden"){this.hScrollBar.css({left:d+2})}}var o=this.vScrollInstance;o.disabled=this.disabled;if(!this.autoheight){if(D){o.refresh()}}var z=this.hScrollInstance;z.disabled=this.disabled;if(l){z.refresh()}if(this.autowidth){this.hScrollBar[0].style.visibility="hidden"}var t=function(i){if((i.vScrollBar[0].style.visibility=="visible")&&(i.hScrollBar[0].style.visibility=="visible")){i.bottomRight[0].style.visibility="visible";i.bottomRight.css({left:1+parseInt(i.vScrollBar.css("left")),top:parseInt(i.hScrollBar.css("top"))});if(i.rtl){i.bottomRight.css("left","0px")}i.bottomRight.width(parseInt(d)+3);i.bottomRight.height(parseInt(d)+4);if(i.showaggregates){i.bottomRight.css("z-index",99);i.bottomRight.height(parseInt(d)+4+i.statusbarheight);i.bottomRight.css({top:parseInt(i.hScrollBar.css("top"))-i.statusbarheight})}}else{i.bottomRight[0].style.visibility="hidden"}};t(this);if(this.content[0].style.width!=A-j+"px"){this.content.width(A-j)}if(this.content[0].style.height!=x-h+3+"px"){this.content.height(x-h+3)}if(this.content[0].style.top!=v+"px"){this.content.css("top",v)}if(this.rtl){this.content.css("left",j);if(this.table){var u=this.table.width();if(u<A-j){this.content.css("left",A-u)}}}if(this.showstatusbar){this.statusbar.css("top",v+x-this.statusbarheight-(this.pageable?this.pagerheight:0));if(this.showaggregates){if(this.hScrollBar.css("visibility")=="visible"){this.hScrollBar.css({top:v+x-s-d-r+this.statusbarheight+"px"});this.statusbar.css("top",1+v+x-d-5-this.statusbarheight-(this.pageable?this.pagerheight:0))}t(this)}if(this.rtl){if(this.hScrollBar.css("visibility")!="visible"){this.statusbar.css("left",this.content.css("left"))}else{this.statusbar.css("left","0px")}}}if(this.pageable){this.pager.width(A);this.pager.height(this.pagerheight);this.pager.css("top",v+x-this.pagerheight-1)}else{this.pager[0].style.height="0px"}if(this.table!=null){var g=-2;if(this.vScrollBar[0].style.visibility=="visible"){g=this.scrollbarsize+3}if(this.hScrollBar[0].style.visibility=="visible"){var E=g+this.table.width()-this.host.width();if(E>=0){this.hScrollBar.jqxScrollBar("max",E)}if(this.hScrollBar[0].style.visibility=="visible"&&E==0){this.hScrollBar[0].style.visibility="hidden";this._arrange()}}}if(A!=parseInt(this.dataloadelement[0].style.width)){this.dataloadelement[0].style.width=this.element.style.width}if(x!=parseInt(this.dataloadelement[0].style.height)){this.dataloadelement[0].style.height=this.element.style.height}this._hostwidth=A},destroy:function(){delete b.jqx.dataFormat.datescache;delete this.gridlocalization;b.jqx.utilities.resize(this.host,null,true);if(this.table&&this.table[0]){var m=this.table[0].rows.length;for(var k=0;k<m;k++){var o=this.table[0].rows[k];var n=o.cells;var f=n.length;for(var h=0;h<f;h++){b(o.cells[h]).remove();o.cells[h]=null;delete o.cells[h]}o.cells=null;delete o.cells;b(this.table[0].rows[k]).remove();this.table[0].rows[k]=null}delete this.table[0].rows;this.table.remove();delete this.table}if(this.columns&&this.columns.records){for(var k=0;k<this.columns.records.length;k++){var e=this.columns.records[k];this._removecolumnhandlers(this.columns.records[k]);if(e.element){b(e.element).remove();b(e.sortasc).remove();b(e.sortdesc).remove();b(e.filtericon).remove();b(e.menu).remove();e.element=null;e.uielement=null;e.sortasc=null;e.sortdesc=null;e.filtericon=null;e.menu=null;delete e.element;delete e.uielement;delete e.sortasc;delete e.sortdesc;delete e.filtericon;delete e.menu;delete this.columnsrow[0].cells[k]}}delete this.columnsrow[0].cells;delete this.columnsrow}jQuery.removeData(document.body,"contextmenu"+this.element.id);if(this.host.jqxDropDownList){if(this._destroyfilterpanel){this._destroyfilterpanel()}}if(this.editable&&this._destroyeditors){this._destroyeditors()}if(this.filterable&&this._destroyedfilters&&this.showfilterrow){this._destroyedfilters()}if(this.host.jqxMenu){if(this.gridmenu){this.removeHandler(b(document),"click.menu"+this.element.id);this.removeHandler(this.gridmenu,"keydown");this.removeHandler(this.gridmenu,"closed");this.removeHandler(this.gridmenu,"itemclick");this.gridmenu.jqxMenu("destroy");this.gridmenu=null}}if(this.pagershowrowscombo){this.pagershowrowscombo.jqxDropDownList("destroy");this.pagershowrowscombo=null}if(this.pagerrightbutton){this.removeHandler(this.pagerrightbutton,"mousedown");this.removeHandler(this.pagerrightbutton,"mouseup");this.removeHandler(this.pagerrightbutton,"click");this.pagerrightbutton.jqxButton("destroy");this.pagerrightbutton=null}if(this.pagerleftbutton){this.removeHandler(this.pagerleftbutton,"mousedown");this.removeHandler(this.pagerleftbutton,"mouseup");this.removeHandler(this.pagerleftbutton,"click");this.pagerleftbutton.jqxButton("destroy");this.removeHandler(b(document),"mouseup.pagerbuttons"+this.element.id);this.pagerleftbutton=null}this.removeHandler(b(document),"mousedown.resize"+this.element.id);this.removeHandler(b(document),"mouseup.resize"+this.element.id);this.removeHandler(b(document),"mousemove.resize"+this.element.id);this.removeHandler(b(document),"mousedown.reorder"+this.element.id);this.removeHandler(b(document),"mouseup.reorder"+this.element.id);this.removeHandler(b(document),"mousemove.reorder"+this.element.id);this.removeHandler(b(window),"resize."+this.element.id);if(this.groupable){var l="mousemove.grouping"+this.element.id;var d="mousedown.grouping"+this.element.id;var g="mouseup.grouping"+this.element.id;this.removeHandler(b(document),l);this.removeHandler(b(document),d);this.removeHandler(b(document),g)}if(this.content){this.removeHandler(this.content,"mousedown");this.removeHandler(this.content,"scroll")}this._removeHandlers();this.hScrollInstance.destroy();this.vScrollInstance.destroy();this.hScrollBar.remove();this.vScrollBar.remove();this._clearcaches();delete this.hScrollInstance;delete this.vScrollInstance;delete this.visiblerows;delete this.hittestinfo;delete this.rows;delete this.columns;delete this.columnsbydatafield;delete this.pagescache;delete this.pageviews;delete this.cellscache;delete this.heights;delete this.hiddens;delete this.hiddenboundrows;delete this.heightboundrows;delete this.detailboundrows;delete this.details;delete this.expandedgroups;delete this._rowdetailscache;delete this._rowdetailselementscache;delete this.columnsmenu;this.columnsheader.remove();delete this.columnsheader;this.selectionarea.remove();delete this.selectionarea;this.dataview._clearcaches();this.content.removeClass();this.content.remove();this.content=null;delete this.content;this.vScrollBar=null;this.hScrollBar=null;delete this.hScrollBar;delete this.hScrollBar;this.gridcontent.remove();delete this.gridcontent;if(this.gridmenu){this.gridmenu=null;delete this.gridmenu}delete this._mousemovefunc;delete this._mousewheelfunc;this.dataview.destroy();delete this.dataview;this.bottomRight.remove();delete this.bottomRight;this.wrapper.remove();delete this.wrapper;if(this.pagerdiv){this.pagerdiv.remove();delete this.pagerdiv}if(this.pagerpageinput){this.pagerpageinput.remove();delete this.pagerpageinput}if(this.pagergoto){this.pagergoto.remove();delete this.pagergoto}if(this.pagershowrows){this.pagershowrows.remove();delete this.pagershowrows}if(this.pagerfirstbutton){this.pagerfirstbutton.remove();delete this.pagerfirstbutton}if(this.pagerlastbutton){this.pagerlastbutton.remove();delete this.pagerlastbutton}if(this.pagerbuttons){this.pagerbuttons.remove();delete this.pagerbuttons}if(this.pagerdetails){this.pagerdetails.remove();delete this.pagerdetails}if(this.pagergotoinput){this.pagergotoinput.remove();delete this.pagergotoinput}this.pager.remove();delete this.pager;this.groupsheader.remove();delete this.groupsheader;this.dataloadelement.remove();delete this.dataloadelement;this.toolbar.remove();delete this.toolbar;this.statusbar.remove();delete this.statusbar;this.host.removeData();this.host.removeClass();this.host.remove();this.host=null;delete this.host;delete this.element;delete this.set;delete this.get;delete this.that;delete this.call},_initializeColumns:function(){var f=this.source.datafields;if(f==null&&this.source._source){f=this.source._source.datafields}var j=f?f.length>0:false;if(this.autogeneratecolumns){var l=new Array();if(f){b.each(f,function(){var i={datafield:this.name,text:this.text||this.name,cellsformat:this.format||""};l.push(i)})}else{if(this.source.records.length>0){var n=this.source.records[0];for(obj in n){if(obj!="uid"){var g={width:100,datafield:obj,text:obj};l.push(g)}}}}this.columns=l}if(this.columns&&this.columns.records){for(var h=0;h<this.columns.records.length;h++){this._removecolumnhandlers(this.columns.records[h])}}var k=this.that;var e=new b.jqx.collection(this.element);var d=0;this._haspinned=false;if(!this._columns){this._columns=this.columns}else{this.columns=this._columns}if(this.groupable){b.each(this.groups,function(i){var o=new c(k,this);o.visibleindex=d++;o.width=k.groupindentwidth;e.add(o);o.grouped=true;o.filterable=false;o.sortable=false;o.editable=false;o.resizable=false;o.draggable=false})}if(this.rowdetails&&this.showrowdetailscolumn){var g=new c(k,this);g.visibleindex=d++;g.width=k.groupindentwidth;g.pinned=true;g.editable=false;g.filterable=false;g.draggable=false;g.groupable=false;g.resizable=false;e.add(g);k._haspinned=true}if(this.selectionmode=="checkbox"){var g=new c(k,this);g.visibleindex=d++;g.width=k.groupindentwidth;g.checkboxcolumn=true;g.editable=false;g.columntype="checkbox";g.groupable=false;g.draggable=false;g.filterable=false;g.resizable=false;g.datafield="_checkboxcolumn";e.add(g)}var m=new Array();b.each(this.columns,function(i){if(k.columns[i]!=undefined){var o=new c(k,this);o.visibleindex=d++;if(this.dataField!=undefined){this.datafield=this.dataField}if(this.pinned){k._haspinned=true}if(this.datafield==null){if(k.source&&k.source._source&&(k.source._source.datatype=="array")){if(!j){if(!k.source._source.datafields){k.source._source.datafields=new Array();k.source._source.datafields.push({name:i.toString()})}else{k.source._source.datafields.push({name:i.toString()})}}this.datafield=i.toString();this.displayfield=i.toString();o.datafield=this.datafield;o.displayfield=this.displayfield}}else{if(m[this.datafield]){throw new Error("jqxGrid: Invalid column 'datafield' setting. jqxGrid's columns should be initialized with unique data fields.");k.host.remove();return false}else{m[this.datafield]=true}}e.add(o)}});if(this.rtl){e.records.reverse()}this.columns=e},_initializeRows:function(){var d=new b.jqx.collection(this.element);if(this.rows){this.rows.clear()}this.rows=d},_raiseEvent:function(h,e){if(e==undefined){e={owner:null}}if(this._trigger===false){return}var f=this.events[h];if(!this._camelCase){f=f.toLowerCase()}args=e;args.owner=this;var g=new jQuery.Event(f);g.owner=this;g.args=args;var d=this.host.trigger(g);e=g.args;return d},wheel:function(f,e){if(e.autoheight&&e.hScrollBar.css("visibility")!="visible"){f.returnValue=true;return true}var g=0;if(!f){f=window.event}if(f.originalEvent&&f.originalEvent.wheelDelta){f.wheelDelta=f.originalEvent.wheelDelta}if(f.wheelDelta){g=f.wheelDelta/120}else{if(f.detail){g=-f.detail/3}}if(g){var d=e._handleDelta(g);if(d){if(f.preventDefault){f.preventDefault()}if(f.originalEvent!=null){f.originalEvent.mouseHandled=true}if(f.stopPropagation!=undefined){f.stopPropagation()}}if(d){d=false;f.returnValue=d;return d}else{return false}}if(f.preventDefault){f.preventDefault()}f.returnValue=false},_handleDelta:function(f){if(this.vScrollBar.css("visibility")!="hidden"){var e=this.vScrollInstance.value;if(f<0){this.scrollDown()}else{this.scrollUp()}var d=this.vScrollInstance.value;if(e!=d){return true}}else{if(this.hScrollBar.css("visibility")!="hidden"){var e=this.hScrollInstance.value;if(f>0){if(this.hScrollInstance.value>2*this.horizontalscrollbarstep){this.hScrollInstance.setPosition(this.hScrollInstance.value-2*this.horizontalscrollbarstep)}else{this.hScrollInstance.setPosition(0)}}else{if(this.hScrollInstance.value<this.hScrollInstance.max){this.hScrollInstance.setPosition(this.hScrollInstance.value+2*this.horizontalscrollbarstep)}else{this.hScrollInstance.setPosition(this.hScrollInstance.max)}}var d=this.hScrollInstance.value;if(e!=d){return true}}}return false},scrollDown:function(){if(this.vScrollBar.css("visibility")=="hidden"){return}var d=this.vScrollInstance;if(d.value+this.rowsheight<=d.max){d.setPosition(parseInt(d.value)+this.rowsheight)}else{d.setPosition(d.max)}},scrollUp:function(){if(this.vScrollBar.css("visibility")=="hidden"){return}var d=this.vScrollInstance;if(d.value-this.rowsheight>=d.min){d.setPosition(parseInt(d.value)-this.rowsheight)}else{d.setPosition(d.min)}},_removeHandlers:function(){var d=this.that;this.removeHandler(this.vScrollBar,"valuechanged");this.removeHandler(this.hScrollBar,"valuechanged");this.vScrollInstance.valuechanged=null;this.hScrollInstance.valuechanged=null;var e="mousedown.jqxgrid";if(this.isTouchDevice()){e=b.jqx.mobile.getTouchEventName("touchend")}this.removeHandler(this.host,"dblclick.jqxgrid");this.removeHandler(this.host,e);this.removeHandler(this.content,"mousemove",this._mousemovefunc);this.removeHandler(this.host,"mouseleave.jqxgrid");this.removeHandler(this.content,"mouseenter");this.removeHandler(this.content,"mouseleave");this.removeHandler(this.content,"mousedown");this.removeHandler(this.content,"scroll");this.removeHandler(this.content,"selectstart."+this.element.id);this.removeHandler(this.host,"dragstart."+this.element.id);this.removeHandler(this.host,"keydown.edit"+this.element.id);this.removeHandler(b(document),"keydown.edit"+this.element.id);this.removeHandler(b(document),"keyup.edit"+this.element.id);if(this._mousemovedocumentfunc){this.removeHandler(b(document),"mousemove.selection"+this.element.id,this._mousemovedocumentfunc)}this.removeHandler(b(document),"mouseup.selection"+this.element.id);if(this._mousewheelfunc){this.removeHandler(this.host,"mousewheel",this._mousewheelfunc)}if(this.editable){this.removeHandler(b(document),"mousedown.gridedit"+this.element.id)}if(this.host.off){this.content.off("mousemove");this.host.off("mousewheel")}},_addHandlers:function(){var e=this.that;var d=e.isTouchDevice();if(!d){this.addHandler(this.host,"dragstart."+this.element.id,function(j){return false})}if(this.editable){this.addHandler(b(document),"mousedown.gridedit"+this.element.id,function(m){if(e.editable&&e.begincelledit){if(e.editcell){if(!e.vScrollInstance.isScrolling()&&!e.vScrollInstance.isScrolling()){var r=e.host.coord();var q=e.host.width();var n=e.host.height();var v=false;var k=false;var t=false;if(m.pageY<r.top||m.pageY>r.top+n){v=true;k=true}if(m.pageX<r.left||m.pageX>r.left+q){v=true;t=true}if(v){var u=false;if(e.editcell&&e.editcell.editor){switch(e.editcell.columntype){case"datetimeinput":if(e.editcell.editor.jqxDateTimeInput&&e.editcell.editor.jqxDateTimeInput("container")[0].style.display=="block"){var s=e.editcell.editor.jqxDateTimeInput("container").coord().top;var j=e.editcell.editor.jqxDateTimeInput("container").coord().top+e.editcell.editor.jqxDateTimeInput("container").height();if(k&&(m.pageY<s||m.pageY>j)){v=true;e.editcell.editor.jqxDateTimeInput("close")}else{return}}break;case"combobox":if(e.editcell.editor.jqxComboBox&&e.editcell.editor.jqxComboBox("container")[0].style.display=="block"){var s=e.editcell.editor.jqxComboBox("container").coord().top;var j=e.editcell.editor.jqxComboBox("container").coord().top+e.editcell.editor.jqxComboBox("container").height();if(k&&(m.pageY<s||m.pageY>j)){v=true;e.editcell.editor.jqxComboBox("close")}else{return}}break;case"dropdownlist":if(e.editcell.editor.jqxDropDownList&&e.editcell.editor.jqxDropDownList("container")[0].style.display=="block"){var s=e.editcell.editor.jqxDropDownList("container").coord().top;var j=e.editcell.editor.jqxDropDownList("container").coord().top+e.editcell.editor.jqxDropDownList("container").height();if(k&&(m.pageY<s||m.pageY>j)){v=true;e.editcell.editor.jqxDropDownList("close")}else{return}}break;case"template":case"custom":var l=["jqxDropDownList","jqxComboBox","jqxDropDownButton","jqxDateTimeInput"];var p=function(A){var z=e.editcell.editor.data();if(z[A]&&z[A].instance.container&&z[A].instance.container[0].style.display=="block"){var x=z[A].instance;var B=x.container.coord().top;var y=x.container.coord().top+x.container.height();if(k&&(m.pageY<B||m.pageY>y)){v=true;x.close();return true}else{return false}}};for(var o=0;o<l.length;o++){var w=p(l[o]);if(w==false){return}}break}}e.endcelledit(e.editcell.row,e.editcell.column,false,true)}}}}})}this.vScrollInstance.valuechanged=function(j){if(e.virtualsizeinfo){e._closemenu();if(e.scrollmode!="physical"){e._renderrows(e.virtualsizeinfo);e.currentScrollValue=j.currentValue}else{if(e.currentScrollValue!=undefined&&Math.abs(e.currentScrollValue-j.currentValue)>=5){e._renderrows(e.virtualsizeinfo);e.currentScrollValue=j.currentValue}else{e._renderrows(e.virtualsizeinfo);e.currentScrollValue=j.currentValue}}if(!e.pageable&&!e.groupable&&e.dataview.virtualmode){if(e.loadondemandupdate){clearTimeout(e.loadondemandupdate)}e.loadondemandupdate=setTimeout(function(){e.loadondemand=true;e._renderrows(e.virtualsizeinfo)},100)}if(d){e._lastScroll=new Date()}}};this.hScrollInstance.valuechanged=function(l){if(e.virtualsizeinfo){e._closemenu();var k=function(){e._renderhorizontalscroll();e._renderrows(e.virtualsizeinfo);if(e.editcell&&!e.editrow){if(e._showcelleditor&&e.editcell.editing){if(!e.hScrollInstance.isScrolling()){e._showcelleditor(e.editcell.row,e.getcolumn(e.editcell.column),e.editcell.element,e.editcell.init)}}}};var j=e._browser==undefined?e._isIE10():e._browser;if(navigator&&navigator.userAgent.indexOf("Safari")!=-1){if(e._hScrollTimer){clearTimeout(e._hScrollTimer)}e._hScrollTimer=setTimeout(function(){k()},1)}else{if(b.jqx.browser.mozilla||b.jqx.browser.msie){if(e._hScrollTimer){clearTimeout(e._hScrollTimer)}e._hScrollTimer=setTimeout(function(){k()},0.01)}else{k()}}if(d){e._lastScroll=new Date()}}};this._mousewheelfunc=this._mousewheelfunc||function(j){if(!e.editcell&&e.enablemousewheel){e.wheel(j,e);return false}};this.removeHandler(this.host,"mousewheel",this._mousewheelfunc);this.addHandler(this.host,"mousewheel",this._mousewheelfunc);var h="mousedown.jqxgrid";if(d){h=b.jqx.mobile.getTouchEventName("touchend")}this.addHandler(this.host,h,function(k){if(e.isTouchDevice()){e._newScroll=new Date();if(e._newScroll-e._lastScroll<500){return false}if(b(k.target).ischildof(e.vScrollBar)){return false}if(b(k.target).ischildof(e.hScrollBar)){return false}}e._mousedown=new Date();var j=e._handlemousedown(k,e);if(e.isNestedGrid){if(!e.resizablecolumn&&!e.columnsreorder){k.stopPropagation()}}e._lastmousedown=new Date();return j});if(!d){this.addHandler(this.host,"dblclick.jqxgrid",function(k){if(e.editable&&e.begincelledit&&e.editmode=="dblclick"){e._handledblclick(k,e)}else{if(b.jqx.browser.msie&&b.jqx.browser.version<9){var j=e._handlemousedown(k,e)}}e.mousecaptured=false;e._lastmousedown=new Date();return true});this._mousemovefunc=function(j){if(e._handlemousemove){return e._handlemousemove(j,e)}};this.addHandler(this.content,"mousemove",this._mousemovefunc);if(e._handlemousemoveselection){this._mousemovedocumentfunc=function(j){if(e._handlemousemoveselection){return e._handlemousemoveselection(j,e)}};this.addHandler(b(document),"mousemove.selection"+this.element.id,this._mousemovedocumentfunc)}this.addHandler(b(document),"mouseup.selection"+this.element.id,function(j){if(e._handlemouseupselection){e._handlemouseupselection(j,e)}})}try{if(document.referrer!=""||window.frameElement){if(window.top!=null&&window.top!=window.self){var i=null;if(window.parent&&document.referrer){i=document.referrer}if(i&&i.indexOf(document.location.host)!=-1){var g=function(j){if(e._handlemouseupselection){e._handlemouseupselection(j,e)}};if(window.top.document.addEventListener){window.top.document.addEventListener("mouseup",g,false)}else{if(window.top.document.attachEvent){window.top.document.attachEvent("onmouseup",g)}}}}}}catch(f){}this.focused=false;if(!d){this.addHandler(this.content,"mouseenter",function(j){e.focused=true;if(e.wrapper){e.wrapper.parent().attr("tabindex",0);e.wrapper.attr("tabindex",1);e.content.attr("tabindex",2)}if(e._overlayElement){if(e.vScrollInstance.isScrolling()||e.hScrollInstance.isScrolling()){e._overlayElement[0].style.visibility="visible"}else{e._overlayElement[0].style.visibility="hidden"}}});this.addHandler(this.content,"mouseleave",function(j){if(e.wrapper){e.wrapper.parent().removeAttr("tabindex");e.wrapper.removeAttr("tabindex");e.content.removeAttr("tabindex")}if(e._handlemousemove){if(e.enablehover){e._clearhoverstyle()}}if(e._overlayElement){e._overlayElement[0].style.visibility="hidden"}e.focused=false});if(this.groupable||this.columnsreorder){this.addHandler(b(document),"selectstart."+this.element.id,function(j){if(e.__drag===true){return false}})}this.addHandler(this.content,"selectstart."+this.element.id,function(j){if(e.enablebrowserselection){return true}if(e.showfilterrow){if(b(j.target).ischildof(e.filterrow)){return true}}if(!e.editcell){return false}});this.addHandler(b(document),"keyup.edit"+this.element.id,function(j){e._keydown=false});this.addHandler(b(document),"keydown.edit"+this.element.id,function(l){e._keydown=true&&!e.editcell;var k=l.charCode?l.charCode:l.keyCode?l.keyCode:0;if(e.handlekeyboardnavigation){var m=e.handlekeyboardnavigation(l);if(m==true){return false}}if(e.editable&&e.editcell){if(k==13||k==27){if(e._handleeditkeydown){j=e._handleeditkeydown(l,e)}}}if(k==27){e.mousecaptured=false;if(e.selectionarea.css("visibility")=="visible"){e.selectionarea.css("visibility","hidden")}}if(b.jqx.browser.msie&&b.jqx.browser.version<8&&e.focused&&!e.isNestedGrid){if(k==13&&j==false){return j}var j=true;var k=l.charCode?l.charCode:l.keyCode?l.keyCode:0;if(!e.editcell&&e.editable&&e.editmode!="programmatic"){if(e._handleeditkeydown){j=e._handleeditkeydown(l,e)}}if(j&&e.keyboardnavigation&&e._handlekeydown){j=e._handlekeydown(l,e);if(!j){if(l.preventDefault){l.preventDefault()}if(l.stopPropagation!=undefined){l.stopPropagation()}}return j}}return true});this.addHandler(this.host,"keydown.edit"+this.element.id,function(k){var j=true;if(e.handlekeyboardnavigation){var l=e.handlekeyboardnavigation(k);if(l==true){return false}}if(e.editable&&e.editmode!="programmatic"){if(e._handleeditkeydown){j=e._handleeditkeydown(k,e)}}if(!(b.jqx.browser.msie&&b.jqx.browser.version<8)){if(j&&e.keyboardnavigation&&e._handlekeydown){j=e._handlekeydown(k,e);if(e.isNestedGrid){k.stopPropagation()}}}else{if(e.isNestedGrid){if(j&&e.keyboardnavigation&&e._handlekeydown){j=e._handlekeydown(k,e);k.stopPropagation()}}}if(!j){if(k.preventDefault){k.preventDefault()}if(k.stopPropagation!=undefined){k.stopPropagation()}}return j})}},_hittestrow:function(s,q){if(this.vScrollInstance==null||this.hScrollInstance==null){return}if(s==undefined){s=0}if(q==undefined){q==0}var l=this.vScrollInstance;var k=this.hScrollInstance;var f=l.value;if(this.vScrollBar.css("visibility")!="visible"){f=0}var m=k.value;if(this.hScrollBar.css("visibility")!="visible"){m=0}if(this.scrollmode=="deferred"&&this._newmax!=null){if(f>this._newmax){f=this._newmax}}var r=parseInt(f)+q;var j=parseInt(m)+s;if(this.visiblerows==null){return}var e=false;var i=this._findvisiblerow(r,this.visiblerows);if(i>=0){var o=this.visiblerows[i];var d=this.rowdetails&&o.rowdetails;var n=!o.rowdetailshidden;if(d){var g=this.visiblerows[i-1];if(g==o){o=g;i--}if(n){var h=b(this.hittestinfo[i].visualrow).position().top+parseInt(this.table.css("top"));var p=b(this.hittestinfo[i].visualrow).height();if(!(q>=h&&q<=h+p)){i++;o=this.visiblerows[i];e=true}}}}return{index:i,row:o,details:e}},getcellatposition:function(j,q){var r=this.that;var z=this.showheader?this.columnsheader.height()+2:0;var s=this._groupsheader()?this.groupsheader.height():0;var B=this.showtoolbar?this.toolbarheight:0;s+=B;var g=this.host.coord();if(this.hasTransform){g=b.jqx.utilities.getOffset(this.host)}var p=j-g.left;var n=q-z-g.top-s;var d=this._hittestrow(p,n);var k=d.row;var l=d.index;var t=this.table[0].rows[l];if(this.dataview&&this.dataview.records.length==0){var o=this.table[0].rows;var C=0;for(var w=0;w<o.length;w++){if(n>=C&&n<C+this.rowsheight){t=o[w];break}C+=this.rowsheight}k={boundindex:w}}if(t==null){return true}var u=this.hScrollInstance;var v=u.value;var f=0;var m=this.groupable?this.groups.length:0;for(var w=0;w<t.cells.length;w++){var h=parseInt(b(this.columnsrow[0].cells[w]).css("left"));var j=h-v;if(r.columns.records[w].pinned){j=h}var A=j+b(this.columnsrow[0].cells[w]).width();if(A>=p&&p>=j){f=w;break}}if(k!=null){var e=this._getcolumnat(f);return{row:this.getboundindex(k),column:e.datafield,value:this.getcellvalue(this.getboundindex(k),e.datafield)}}return null},_handlemousedown:function(P,l){if(P.target==null){return true}if(l.disabled){return true}if(b(P.target).ischildof(this.columnsheader)){return true}var m;if(P.which){m=(P.which==3)}else{if(P.button){m=(P.button==2)}}var I;if(P.which){I=(P.which==2)}else{if(P.button){I=(P.button==1)}}if(I){return true}if(this.showstatusbar){if(b(P.target).ischildof(this.statusbar)){return true}if(P.target==this.statusbar[0]){return true}}if(!this.columnsheader){return true}var N=this.showheader?this.columnsheader.height()+2:0;var u=this._groupsheader()?this.groupsheader.height():0;var z=this.showtoolbar?this.toolbarheight:0;u+=z;var L=this.host.coord();if(this.hasTransform){L=b.jqx.utilities.getOffset(this.host);var R=this._getBodyOffset();L.left-=R.left;L.top-=R.top}var h=parseInt(P.pageX);var j=parseInt(P.pageY);if(this.isTouchDevice()){var Q=l.getTouches(P);var H=Q[0];h=parseInt(H.pageX);j=parseInt(H.pageY);if(l.touchmode==true){h=parseInt(H._pageX);j=parseInt(H._pageY)}}var C=h-L.left;var B=j-N-L.top-u;if(this.pageable&&!this.autoheight&&this.gotopage){var d=this.pager.coord().top-L.top-u-N;if(B>d){return}}var M=this._hittestrow(C,B);if(!M){return}if(M.details){return}var p=M.row;var w=M.index;var q=P.target.className;var g=this.table[0].rows[w];if(g==null){if(l.editable&&l.begincelledit){if(l.editcell){l.endcelledit(l.editcell.row,l.editcell.column,false,true)}}return true}l.mousecaptured=true;l.mousecaptureposition={left:P.pageX,top:P.pageY-u,clickedrow:g};var k=this.hScrollInstance;var s=k.value;if(this.rtl){if(this.hScrollBar.css("visibility")!="hidden"){s=k.max-k.value}}var A=-1;var v=this.groupable?this.groups.length:0;if(this.rtl){if(this.vScrollBar[0].style.visibility!="hidden"){s-=this.scrollbarsize+4}if(this.hScrollBar[0].style.visibility=="hidden"){s=-parseInt(this.content.css("left"))}}for(var J=0;J<g.cells.length;J++){var K=parseInt(b(this.columnsrow[0].cells[J]).css("left"));var h=K-s;if(l.columns.records[J].pinned&&!l.rtl){h=K}var D=this._getcolumnat(J);if(D!=null&&D.hidden){continue}var E=h+b(this.columnsrow[0].cells[J]).width();if(E>=C&&C>=h){A=J;l.mousecaptureposition.clickedcell=J;break}}if(this.rtl&&this._haspinned){for(var J=g.cells.length-1;J>=0;J--){if(!l.columns.records[J].pinned){break}var K=b(this.columnsrow[0].cells[J]).coord().left-this.host.coord().left;var h=K;var D=this._getcolumnat(J);if(D!=null&&D.hidden){continue}var E=h+b(this.columnsrow[0].cells[J]).width();if(E>=C&&C>=h){A=J;l.mousecaptureposition.clickedcell=J;break}}}if(p!=null&&A>=0){this._raiseEvent(1,{rowindex:this.getboundindex(p),visibleindex:p.visibleindex,group:p.group,rightclick:m,originalEvent:P});var D=this._getcolumnat(A);var F=this.getcellvalue(this.getboundindex(p),D.datafield);if(this.editable&&this.editcell){if(D.datafield==this.editcell.column){if(this.getboundindex(p)==this.editcell.row){this.mousecaptured=false}}}this._raiseEvent(8,{rowindex:this.getboundindex(p),column:D?D.getcolumnproperties():null,datafield:D?D.datafield:null,columnindex:A,value:F,rightclick:m,originalEvent:P});if(this.isTouchDevice()){if(D.columntype=="checkbox"&&this.editable&&this._overlayElement){if(!this.editcell){this._overlayElement.css("visibility","hidden");this.editcell=this.getcell(w,D.datafield);return true}}else{if(D.columntype=="button"&&this._overlayElement){if(D.buttonclick){D.buttonclick(g.cells[A].buttonrow,P)}return true}}}var f=false;if(this._lastmousedown!=null){if(this._mousedown-this._lastmousedown<300){if(this._clickedrowindex==this.getboundindex(p)){this._raiseEvent(22,{rowindex:this.getboundindex(p),visibleindex:p.visibleindex,group:p.group,rightclick:m,originalEvent:P});if(this._clickedcolumn==D.datafield){this._raiseEvent(23,{rowindex:this.getboundindex(p),column:D?D.getcolumnproperties():null,datafield:D?D.datafield:null,columnindex:A,value:F,rightclick:m,originalEvent:P})}f=true;this._clickedrowindex=-1;this._clickedcolumn=null;if(P.isPropagationStopped&&P.isPropagationStopped()){return false}}}}if(m){return true}if(!f){this._clickedrowindex=this.getboundindex(p);this._clickedcolumn=D.datafield}var e=b.jqx.utilities.getBrowser();if(e.browser=="msie"&&parseInt(e.version)<=7){if(A==0&&this.rowdetails){q="jqx-grid-group-collapse"}if(v>0){if(A<=v){q="jqx-grid-group-collapse"}}}if(q.indexOf("jqx-grid-group-expand")!=-1||q.indexOf("jqx-grid-group-collapse")!=-1){if(!this.rtl){if(v>0&&A<v&&this._togglegroupstate){this._togglegroupstate(p.bounddata,true)}else{if(A==v&&this.rowdetails&&this.showrowdetailscolumn){this._togglerowdetails(p.bounddata,true);this.gridcontent[0].scrollTop=0;this.gridcontent[0].scrollLeft=0}}}else{if(v>0&&A>g.cells.length-v-1&&this._togglegroupstate){this._togglegroupstate(p.bounddata,true)}else{if(A==g.cells.length-1-v&&this.rowdetails&&this.showrowdetailscolumn){this._togglerowdetails(p.bounddata,true);this.gridcontent[0].scrollTop=0;this.gridcontent[0].scrollLeft=0}}}}else{if(p.boundindex!=-1){var n=this.selectedrowindexes.slice(0);var O=false;if(l.selectionmode!="none"&&l.selectionmode!="checkbox"&&this._selectrowwithmouse){if(l.selectionmode=="multiplecellsadvanced"||l.selectionmode=="multiplecellsextended"||l.selectionmode=="multiplerowsextended"||l.selectionmode=="multiplerowsadvanced"){if(!P.ctrlKey&&!P.shiftKey){l.selectedrowindexes=new Array();l.selectedcells=new Array()}}var t=false;var o=this.getboundindex(p);if(l._oldselectedrow===o||l.selectionmode==="none"){t=true}if(l.selectionmode.indexOf("cell")==-1){if((l.selectionmode!="singlerow")||(l.selectedrowindex!=o&&l.selectionmode=="singlerow")){this._applyrowselection(o,true,false,null,D.datafield);this._selectrowwithmouse(l,M,n,D.datafield,P.ctrlKey,P.shiftKey)}}else{if(D.datafield!=null){this._selectrowwithmouse(l,M,n,D.datafield,P.ctrlKey,P.shiftKey);this._applycellselection(o,D.datafield,true,false)}}if(l._oldselectedcell){if(l._oldselectedcell.datafield==l.selectedcell.datafield&&l._oldselectedcell.rowindex==l.selectedcell.rowindex){O=true}}l._oldselectedcell=l.selectedcell;l._oldselectedrow=o}if(l.autosavestate){if(l.savestate){l.savestate()}}if(l.editable&&l.begincelledit){if(P.isPropagationStopped&&P.isPropagationStopped()){return false}if(l.editmode=="selectedrow"){if(t&&!l.editcell){if(D.columntype!=="checkbox"){var r=l.beginrowedit(this.getboundindex(p))}}else{if(l.editcell&&!t&&l.selectionmode!="none"){var r=l.endrowedit(l.editcell.row)}}}else{var G=l.editmode=="click"||(O&&l.editmode=="selectedcell");if(l.selectionmode.indexOf("cell")==-1){if(l.editmode!="dblclick"){G=true}}if(G){if(p.boundindex!=undefined&&D.editable){var r=l.begincelledit(this.getboundindex(p),D.datafield,D.defaulteditorvalue)}}if(l.selectionmode.indexOf("cell")!=-1){if(l.editmode=="selectedcell"&&!O&&l.editcell){l.endcelledit(l.editcell.row,l.editcell.column,false,true)}}}return true}}}}return true},_columnPropertyChanged:function(e,d,g,f){},_rowPropertyChanged:function(g,d,f,e){},_serializeObject:function(d){if(d==null){return""}var e="";b.each(d,function(g){var h=this;if(g>0){e+=", "}e+="[";var f=0;for(obj in h){if(f>0){e+=", "}e+="{"+obj+":"+h[obj]+"}";f++}e+="]"});return e},propertyChangedHandler:function(d,e,h,g){if(this.isInitialized==undefined||this.isInitialized==false){return}e=e.toLowerCase();switch(e){case"enablebrowserselection":if(!d.showfilterrow){if(!d.showstatusbar&&!d.showtoolbar){d.host.addClass("jqx-disableselect")}d.content.addClass("jqx-disableselect")}if(d.enablebrowserselection){d.content.removeClass("jqx-disableselect");d.host.removeClass("jqx-disableselect")}break;case"columnsheight":if(d.columnsheight!=25||d.columngroups){d._measureElement("column")}d._render(true,true,true,false,false);break;case"rowsheight":if(g!=h){if(d.rowsheight!=25){d._measureElement("cell")}d.virtualsizeinfo=null;d.rendergridcontent(true,false);d.refresh()}break;case"scrollMode":d.vScrollInstance.thumbStep=d.rowsheight;break;case"showdefaultloadelement":d._builddataloadelement();break;case"showfiltermenuitems":case"showsortmenuitems":case"showgroupmenuitems":case"filtermode":d._initmenu();break;case"touchmode":if(h!=g){d._removeHandlers();d.touchDevice=null;d.vScrollBar.jqxScrollBar({touchMode:g});d.hScrollBar.jqxScrollBar({touchMode:g});d._updateTouchScrolling();d._arrange();d._updatecolumnwidths();d._updatecellwidths();d._addHandlers()}break;case"autoshowcolumnsmenubutton":if(h!=g){d._rendercolumnheaders()}break;case"rendergridrows":if(h!=g){d.updatebounddata()}break;case"editmode":if(h!=g){d._removeHandlers();d._addHandlers()}break;case"source":d.virtualsizeinfo=null;if(d.showfilterrow&&d.filterable&&d.filterrow){if(d.clearfilters){d.clearfilters(false)}d.filterrow.remove();d._filterrowcache=new Array();d.filterrow=null}else{if(d.filterable){if(d.clearfilters){d.clearfilters(false)}}}if(d.groupable){d.dataview.groups=[];d.groups=[]}if(d.pageable){d.pagenum=0;d.dataview.pagenum=0}if(d.sortable){d.sortcolumn=null;d.sortdirection="";d.dataview.sortfielddirection="";d.dataview.clearsortdata()}d.updatebounddata();if(d.virtualmode&&!d._loading){d.loadondemand=true;d._renderrows(d.virtualsizeinfo)}break;case"horizontalscrollbarstep":case"verticalscrollbarstep":case"horizontalscrollbarlargestep":case"verticalscrollbarlargestep":this.vScrollBar.jqxScrollBar({step:this.verticalscrollbarstep,largestep:this.verticalscrollbarlargestep});this.hScrollBar.jqxScrollBar({step:this.horizontalscrollbarstep,largestep:this.horizontalscrollbarlargestep});break;case"closeablegroups":if(d._initgroupsheader){d._initgroupsheader()}break;case"showgroupsheader":if(h!=g){d.rendergridcontent()}break;case"theme":if(g!=h){if(d.pager){d.pager.removeClass();d.pager.addClass(d.toTP("jqx-grid-pager"));d.pager.addClass(d.toTP("jqx-widget-header"));if(d.pageable&&d._updatepagertheme){d._updatepagertheme()}}if(d.groupsheader){d.groupsheader.removeClass();d.groupsheader.addClass(d.toTP("jqx-grid-groups-header"));d.groupsheader.addClass(d.toTP("jqx-widget-header"))}d.toolbar.removeClass();d.toolbar.addClass(d.toTP("jqx-grid-toolbar"));d.toolbar.addClass(d.toTP("jqx-widget-header"));d.statusbar.removeClass();d.statusbar.addClass(d.toTP("jqx-grid-statusbar"));d.statusbar.addClass(d.toTP("jqx-widget-content"));d.vScrollBar.jqxScrollBar({theme:d.theme});d.hScrollBar.jqxScrollBar({theme:d.theme});d.host.removeClass();d.host.addClass(d.toTP("jqx-grid"));d.host.addClass(d.toTP("jqx-reset"));d.host.addClass(d.toTP("jqx-rc-all"));d.host.addClass(d.toTP("jqx-widget"));d.host.addClass(d.toTP("jqx-widget-content"));d.bottomRight.removeClass();d.bottomRight.addClass(d.toTP("jqx-grid-bottomright"));d.toolbar.addClass(d.toTP("jqx-grid-toolbar"));d.toolbar.addClass(d.toTP("jqx-widget-header"));d.statusbar.addClass(d.toTP("jqx-grid-statusbar"));d.statusbar.addClass(d.toTP("jqx-widget-header"));d.render()}break;case"showtoolbar":case"toolbarheight":if(h!=g){d._arrange();d.refresh()}break;case"showstatusbar":if(h!=g){if(d.statusbar){if(g){d.statusbar.show()}else{d.statusbar.hide()}}d._arrange();d.refresh()}break;case"statusbarheight":if(h!=g){d._arrange();d.refresh()}break;case"filterable":case"showfilterrow":if(h!=g){d.render()}break;case"autoshowfiltericon":case"showfiltercolumnbackground":case"showpinnedcolumnbackground":case"showsortcolumnbackground":if(h!=g){d.rendergridcontent()}break;case"showrowdetailscolumn":if(h!=g){d.render()}break;case"scrollbarsize":if(h!=g){d._arrange()}break;case"width":case"height":if(h!=g){d._updatesize(true,true);d._resizeWindow();if(d.virtualmode&&!d._loading){d.vScrollInstance.setPosition(0)}}break;case"altrows":case"altstart":case"altstep":if(h!=g){d._renderrows(d.virtualsizeinfo)}break;case"groupsheaderheight":if(h!=g){d._arrange();if(d._initgroupsheader){d._initgroupsheader()}}break;case"pagerheight":if(h!=g){d._initpager()}break;case"selectedrowindex":d.selectrow(g);break;case"selectionmode":if(h!=g){if(g=="none"){d.selectedrowindexes=new Array();d.selectedcells=new Array();d.selectedrowindex=-1}d._renderrows(d.virtualsizeinfo)}break;case"showheader":if(g){d.columnsheader.css("display","block")}else{d.columnsheader.css("display","none")}break;case"virtualmode":if(h!=g){d.dataview.virtualmode=d.virtualmode;d.dataview.refresh(false);d._render(false,false,false)}break;case"columnsmenu":if(h!=g){d.render()}break;case"columngroups":d._render(true,true,true,false,false);break;case"columns":if(d._serializeObject(d._cachedcolumns)!==d._serializeObject(g)){d._columns=null;d._filterrowcache=[];d.render();d._cachedcolumns=d.columns}else{d._initializeColumns()}break;case"autoheight":if(h!=g){d._render(false,false,true)}break;case"pagermode":case"pagerbuttonscount":case"pagesizeoptions":case"pageable":case"pagesize":if(h!=g){if(d._loading){throw new Error("jqxGrid: "+d.loadingerrormessage);return}if(!d.host.jqxDropDownList||!d.host.jqxListBox){d._testmodules();return}if(d._initpager){if(e!="pageable"){if(typeof(g)=="string"){var f="The expected value type is: Int.";if(e!="pagesize"){var f="The expected value type is: Array of Int values."}throw new Error("Invalid Value for: "+e+". "+f)}}d.dataview.pageable=d.pageable;d.dataview.pagenum=0;d.dataview.pagesize=d._getpagesize();if(d.virtualmode){d.updatebounddata()}d.dataview.refresh(true);d._initpager();if(e=="pagesizeoptions"){if(g!=null&&g.length>0){d.pagesize=parseInt(g[0]);d.dataview.pagesize=parseInt(g[0]);d.prerenderrequired=true;d._requiresupdate=true;d.dataview.pagenum=-1;d.gotopage(0)}}}d._render(false,false,false)}break;case"groups":if(d._serializeObject(h)!==d._serializeObject(g)){d.dataview.groups=g;d._refreshdataview();d._render(true,true,true,false)}break;case"groupable":if(h!=g){d.dataview.groupable=d.groupable;d.dataview.pagenum=0;d.dataview.refresh(false);d._render(false,false,true)}break;case"renderstatusbar":if(g!=null){d.renderstatusbar(d.statusbar)}break;case"rendertoolbar":if(g!=null){d.rendertoolbar(d.toolbar)}break;case"disabled":if(g){d.host.addClass(d.toThemeProperty("jqx-fill-state-disabled"))}else{d.host.removeClass(d.toThemeProperty("jqx-fill-state-disabled"))}b.jqx.aria(d,"aria-disabled",d.disabled);if(d.pageable){if(d.pagerrightbutton){d.pagerrightbutton.jqxButton({disabled:g});d.pagerleftbutton.jqxButton({disabled:g});d.pagershowrowscombo.jqxDropDownList({disabled:g});d.pagergotoinput.attr("disabled",g)}}d.vScrollBar.jqxScrollBar({disabled:g});d.hScrollBar.jqxScrollBar({disabled:g});break}}});function c(d,e){this.owner=d;this.datafield=null;this.displayfield=null;this.text="";this.sortable=true;this.hideable=true;this.editable=true;this.hidden=false;this.groupable=true;this.renderer=null;this.cellsrenderer=null;this.checkchange=null,this.threestatecheckbox=false;this.buttonclick=null,this.columntype=null;this.cellsformat="";this.align="left";this.cellsalign="left";this.width="auto";this.minwidth=25;this.maxwidth="auto";this.pinned=false;this.visibleindex=-1;this.filterable=true;this.filter=null;this.filteritems=[];this.resizable=true;this.initeditor=null;this.createeditor=null;this.destroyeditor=null;this.geteditorvalue=null;this.validation=null;this.classname="";this.cellclassname="";this.cellendedit=null;this.cellbeginedit=null;this.cellvaluechanging=null;this.aggregates=null;this.aggregatesrenderer=null;this.menu=true;this.createfilterwidget=null;this.filtertype="default";this.filtercondition=null;this.rendered=null;this.exportable=true;this.exporting=false;this.draggable=true;this.nullable=true;this.enabletooltips=true;this.columngroup=null;this.getcolumnproperties=function(){return{nullable:this.nullable,sortable:this.sortable,hideable:this.hideable,hidden:this.hidden,groupable:this.groupable,width:this.width,align:this.align,editable:this.editable,minwidth:this.minwidth,maxwidth:this.maxwidth,resizable:this.resizable,datafield:this.datafield,text:this.text,exportable:this.exportable,cellsalign:this.cellsalign,pinned:this.pinned,cellsformat:this.cellsformat,columntype:this.columntype,classname:this.classname,cellclassname:this.cellclassname,menu:this.menu}},this.setproperty=function(f,g){if(this[f]){var h=this[f];this[f]=g;this.owner._columnPropertyChanged(this,f,g,h)}else{if(this[f.toLowerCase()]){var h=this[f.toLowerCase()];this[f.toLowerCase()]=g;this.owner._columnPropertyChanged(this,f.toLowerCase(),g,h)}}};this._initfields=function(g){if(g!=null){var f=this.that;if(b.jqx.hasProperty(g,"dataField")){this.datafield=b.jqx.get(g,"dataField")}if(b.jqx.hasProperty(g,"displayField")){this.displayfield=b.jqx.get(g,"displayField")}else{this.displayfield=this.datafield}if(b.jqx.hasProperty(g,"enableTooltips")){this.enabletooltips=b.jqx.get(g,"enableTooltips")}if(b.jqx.hasProperty(g,"text")){this.text=b.jqx.get(g,"text")}if(b.jqx.hasProperty(g,"sortable")){this.sortable=b.jqx.get(g,"sortable")}if(b.jqx.hasProperty(g,"hideable")){this.hideable=b.jqx.get(g,"hideable")}if(b.jqx.hasProperty(g,"hidden")){this.hidden=b.jqx.get(g,"hidden")}if(b.jqx.hasProperty(g,"groupable")){this.groupable=b.jqx.get(g,"groupable")}if(b.jqx.hasProperty(g,"renderer")){this.renderer=b.jqx.get(g,"renderer")}if(b.jqx.hasProperty(g,"align")){this.align=b.jqx.get(g,"align")}if(b.jqx.hasProperty(g,"cellsAlign")){this.cellsalign=b.jqx.get(g,"cellsAlign")}if(b.jqx.hasProperty(g,"cellsFormat")){this.cellsformat=b.jqx.get(g,"cellsFormat")}if(b.jqx.hasProperty(g,"width")){this.width=b.jqx.get(g,"width")}if(b.jqx.hasProperty(g,"minWidth")){this.minwidth=b.jqx.get(g,"minWidth")}if(b.jqx.hasProperty(g,"maxWidth")){this.maxwidth=b.jqx.get(g,"maxWidth")}if(b.jqx.hasProperty(g,"cellsRenderer")){this.cellsrenderer=b.jqx.get(g,"cellsRenderer")}if(b.jqx.hasProperty(g,"columnType")){this.columntype=b.jqx.get(g,"columnType")}if(b.jqx.hasProperty(g,"checkChange")){this.checkchange=b.jqx.get(g,"checkChange")}if(b.jqx.hasProperty(g,"buttonClick")){this.buttonclick=b.jqx.get(g,"buttonClick")}if(b.jqx.hasProperty(g,"pinned")){this.pinned=b.jqx.get(g,"pinned")}if(b.jqx.hasProperty(g,"visibleIndex")){this.visibleindex=b.jqx.get(g,"visibleIndex")}if(b.jqx.hasProperty(g,"filterable")){this.filterable=b.jqx.get(g,"filterable")}if(b.jqx.hasProperty(g,"filter")){this.filter=b.jqx.get(g,"filter")}if(b.jqx.hasProperty(g,"resizable")){this.resizable=b.jqx.get(g,"resizable")}if(b.jqx.hasProperty(g,"editable")){this.editable=b.jqx.get(g,"editable")}if(b.jqx.hasProperty(g,"initEditor")){this.initeditor=b.jqx.get(g,"initEditor")}if(b.jqx.hasProperty(g,"createEditor")){this.createeditor=b.jqx.get(g,"createEditor")}if(b.jqx.hasProperty(g,"destroyEditor")){this.destroyeditor=b.jqx.get(g,"destroyEditor")}if(b.jqx.hasProperty(g,"getEditorValue")){this.geteditorvalue=b.jqx.get(g,"getEditorValue")}if(b.jqx.hasProperty(g,"validation")){this.validation=b.jqx.get(g,"validation")}if(b.jqx.hasProperty(g,"cellBeginEdit")){this.cellbeginedit=b.jqx.get(g,"cellBeginEdit")}if(b.jqx.hasProperty(g,"cellEndEdit")){this.cellendedit=b.jqx.get(g,"cellEndEdit")}if(b.jqx.hasProperty(g,"className")){this.classname=b.jqx.get(g,"className")}if(b.jqx.hasProperty(g,"cellClassName")){this.cellclassname=b.jqx.get(g,"cellClassName")}if(b.jqx.hasProperty(g,"menu")){this.menu=b.jqx.get(g,"menu")}if(b.jqx.hasProperty(g,"aggregates")){this.aggregates=b.jqx.get(g,"aggregates")}if(b.jqx.hasProperty(g,"aggregatesRenderer")){this.aggregatesrenderer=b.jqx.get(g,"aggregatesRenderer")}if(b.jqx.hasProperty(g,"createFilterWidget")){this.createfilterwidget=b.jqx.get(g,"createFilterWidget")}if(b.jqx.hasProperty(g,"filterType")){this.filtertype=b.jqx.get(g,"filterType")}if(b.jqx.hasProperty(g,"rendered")){this.rendered=b.jqx.get(g,"rendered")}if(b.jqx.hasProperty(g,"exportable")){this.exportable=b.jqx.get(g,"exportable")}if(b.jqx.hasProperty(g,"filterItems")){this.filteritems=b.jqx.get(g,"filterItems")}if(b.jqx.hasProperty(g,"cellValueChanging")){this.cellvaluechanging=b.jqx.get(g,"cellValueChanging")}if(b.jqx.hasProperty(g,"draggable")){this.draggable=b.jqx.get(g,"draggable")}if(b.jqx.hasProperty(g,"filterCondition")){this.filtercondition=b.jqx.get(g,"filterCondition")}if(b.jqx.hasProperty(g,"threeStateCheckbox")){this.threestatecheckbox=b.jqx.get(g,"threeStateCheckbox")}if(b.jqx.hasProperty(g,"nullable")){this.nullable=b.jqx.get(g,"nullable")}if(b.jqx.hasProperty(g,"columnGroup")){this.columngroup=b.jqx.get(g,"columnGroup")}if(!g instanceof String&&!(typeof g=="string")){for(var h in g){if(!f.hasOwnProperty(h)){if(!f.hasOwnProperty(h.toLowerCase())){d.host.remove();throw new Error("jqxGrid: Invalid property name - "+h+".")}}}}}};this._initfields(e);return this}function a(d,e){this.setdata=function(f){if(f!=null){this.bounddata=f;this.boundindex=f.boundindex;this.visibleindex=f.visibleindex;this.group=f.group;this.parentbounddata=f.parentItem;this.uniqueid=f.uniqueid;this.level=f.level}};this.setdata(e);this.parentrow=null;this.subrows=new Array();this.owner=d;this.height=25;this.hidden=false;this.rowdetails=null;this.rowdetailsheight=100;this.rowdetailshidden=true;this.top=-1;this.setrowinfo=function(f){this.hidden=f.hidden;this.rowdetails=f.rowdetails;this.rowdetailsheight=f.rowdetailsheight;this.rowdetailshidden=!f.showdetails;this.height=f.height};return this}b.jqx.collection=function(d){this.records=new Array();this.owner=d;this.updating=false;this.beginupdate=function(){this.updating=true};this.resumeupdate=function(){this.updating=false};this._raiseEvent=function(e){};this.clear=function(){this.records=new Array()};this.replace=function(f,e){this.records[f]=e;if(!this.updating){this._raiseEvent({type:"replace",element:e})}};this.isempty=function(e){if(this.records[e]==undefined){return true}return false};this.initialize=function(e){if(e<1){e=1}this.records[e-1]=-1};this.length=function(){return this.records.length};this.indexOf=function(e){return this.records.indexOf(e)};this.add=function(e){if(e==null){return false}this.records[this.records.length]=e;if(!this.updating){this._raiseEvent({type:"add",element:e})}return true};this.insertAt=function(f,e){if(f==null||f==undefined){return false}if(e==null){return false}if(f>=0){if(f<this.records.length){this.records.splice(f,0,e);if(!this.updating){this._raiseEvent({type:"insert",index:f,element:e})}return true}else{return this.add(e)}}return false};this.remove=function(f){if(f==null||f==undefined){return false}var e=this.records.indexOf(f);if(e!=-1){this.records.splice(e,1);if(!this.updating){this._raiseEvent({type:"remove",element:f})}return true}return false};this.removeAt=function(f){if(f==null||f==undefined){return false}if(f<0){return false}if(f<this.records.length){var e=this.records[f];this.records.splice(f,1);if(!this.updating){this._raiseEvent({type:"removeAt",index:f,element:e})}return true}return false};return this};b.jqx.dataview=function(){this.self=this;this.grid=null;this.uniqueId="id";this.records=[];this.rows=[];this.columns=[];this.groups=[];this.filters=new Array();this.updated=null;this.update=null;this.suspend=false;this.pagesize=0;this.pagenum=0;this.totalrows=0;this.totalrecords=0;this.groupable=true;this.loadedrecords=[];this.loadedrootgroups=[];this.loadedgroups=[];this.loadedgroupsByKey=[];this.virtualmode=true;this._cachegrouppages=new Array();this.source=null;this.changedrecords=new Array();this.rowschangecallback=null;this.that=this;this.destroy=function(){delete this.self;delete this.grid;delete this.uniqueId;delete this.records;delete this.rows;delete this.columns;delete this.groups;delete this.filters;delete this.updated;delete this.update;delete this.suspend;delete this.pagesize;delete this.pagenum;delete this.totalrows;delete this.totalrecords;delete this.groupable;delete this.loadedrecords;delete this.loadedrootgroups;delete this.loadedgroups;delete this.loadedgroupsByKey;delete this.virtualmode;delete this._cachegrouppages;delete this.source;delete this.changedrecords;delete this.rowschangecallback;delete this.that},this.suspendupdate=function(){this.suspend=true},this.isupdating=function(){return this.suspend},this.resumeupdate=function(d){this.suspend=false;if(d==undefined){d=true}this.refresh(d)},this.getrecords=function(){return this.records},this.clearrecords=function(){this.recordids=new Array()};this.databind=function(q,l){var p=q._source?true:false;var g=null;if(p){g=q;q=q._source}else{g=new b.jqx.dataAdapter(q,{autoBind:false})}var e=function(m){g.recordids=[];g.records=new Array();g.cachedrecords=new Array();g.originaldata=new Array();g._options.virtualmode=m.virtualmode;g._options.totalrecords=m.totalrecords;g._options.originaldata=m.originaldata;g._options.recordids=m.recordids;g._options.cachedrecords=new Array();g._options.pagenum=m.pagenum;g._options.pageable=m.pageable;if(q.type!=undefined){g._options.type=q.type}if(q.formatdata!=undefined){g._options.formatData=q.formatdata}if(q.contenttype!=undefined){g._options.contentType=q.contenttype}if(q.async!=undefined){g._options.async=q.async}if(q.updaterow!=undefined){g._options.updaterow=q.updaterow}if(q.addrow!=undefined){g._options.addrow=q.addrow}if(q.deleterow!=undefined){g._options.deleterow=q.deleterow}if(m.pagesize==0){m.pagesize=10}g._options.pagesize=m.pagesize};var t=function(C){C.totalrecords=g.totalrecords;if(!C.virtualmode){C.originaldata=g.originaldata;C.records=g.records;C.recordids=g.recordids;C.cachedrecords=g.cachedrecords}else{var x={startindex:C.pagenum*C.pagesize,endindex:(C.pagenum*C.pagesize+C.pagesize)};if(q.recordstartindex){x.startindex=q.recordstartindex}if(q.recordendindex){x.endindex=q.recordendindex}else{if(!C.grid.pageable){x.endindex=x.startindex+100;if(C.grid.autoheight){x.endindex=x.startindex+C.totalrecords}}}x.data=g.records;if(C.grid.rendergridrows&&C.totalrecords>0){var E=0;q.records=C.grid.rendergridrows(x);if(q.records&&!q.records[x.startindex]){var m=new Array();var D=x.startindex;b.each(q.records,function(){m[D]=this;D++;E++});q.records=m}if(E==0){if(q.records){b.each(q.records,function(){E++})}}if(E>0&&E<x.endindex-x.startindex){var A=q.records[0];for(var z=0;z<x.endindex-x.startindex-E;z++){var B={};for(obj in A){B[obj]=""}if(q.records.push){q.records.push(B)}}}}if(!q.records||C.totalrecords==0){q.records=new Array()}C.originaldata=q.records;C.records=q.records;C.cachedrecords=q.records}};e(this);this.source=q;if(l!==undefined){uniqueId=l}var y=this.that;switch(q.datatype){case"local":case"array":default:if(q.localdata==null){q.localdata=[]}if(q.localdata!=null){g.unbindBindingUpdate(y.grid.element.id);g.dataBind();var k=function(x){if(x!=undefined&&x!=""){var z=g._changedrecords[0];if(z){b.each(g._changedrecords,function(D){var A=this.index;var B=this.record;y.grid._updateFromAdapter=true;switch(x){case"update":var C=y.grid.getrowid(A);if(D==g._changedrecords.length-1){y.grid.updaterow(C,B)}else{y.grid.updaterow(C,B,false)}y.grid._updateFromAdapter=false;return;case"add":y.grid.addrow(null,B);y.grid._updateFromAdapter=false;return;case"remove":var C=y.grid.getrowid(A);y.grid.deleterow(C);y.grid._updateFromAdapter=false;return}})}if(x=="update"){return}}var m=y.totalrecords;t(y,x);if(x=="updateData"){y.refresh();y.grid._updateGridData()}else{if(q.recordstartindex&&this.virtualmode){y.updateview(q.recordstartindex,q.recordstartindex+y.pagesize)}else{y.refresh()}y.update(m!=y.totalrecords)}};k();g.bindBindingUpdate(y.grid.element.id,k)}break;case"json":case"jsonp":case"xml":case"xhtml":case"script":case"text":case"csv":case"tab":if(q.localdata!=null){g.unbindBindingUpdate(y.grid.element.id);g.dataBind();var k=function(x){var m=y.totalrecords;t(y);if(x=="updateData"){y.refresh();y.grid._updateGridData()}else{if(q.recordstartindex){y.updateview(q.recordstartindex,q.recordstartindex+y.pagesize)}else{y.refresh()}y.update(m!=y.totalrecords)}};k();g.bindBindingUpdate(y.grid.element.id,k);return}var u={};var o=0;var v={};for(var i=0;i<this.filters.length;i++){var f=this.filters[i].datafield;var j=this.filters[i].filter;var h=j.getfilters();v[f+"operator"]=j.operator;for(var s=0;s<h.length;s++){h[s].datafield=f;var n=h[s].value;if(h[s].type=="datefilter"){if(h[s].value&&h[s].value.toLocaleString){var d=this.grid.getcolumn(h[s].datafield);if(d.cellsformat){var r=this.grid.source.formatDate(h[s].value,d.cellsformat,this.grid.gridlocalization);if(r){v["filtervalue"+o]=r}else{v["filtervalue"+o]=h[s].value.toLocaleString()}}else{v["filtervalue"+o]=n.toString()}}else{v["filtervalue"+o]=n.toString()}}else{v["filtervalue"+o]=n.toString()}v["filtercondition"+o]=h[s].condition;v["filteroperator"+o]=h[s].operator;v["filterdatafield"+o]=f;o++}}v.filterscount=o;v.groupscount=y.groups.length;for(var i=0;i<y.groups.length;i++){v["group"+i]=y.groups[i]}if(q.recordstartindex==undefined){q.recordstartindex=0}if(q.recordendindex==undefined||q.recordendindex==0){if(y.grid.height&&y.grid.height.toString().indexOf("%")==-1){q.recordendindex=parseInt(y.grid.height)/y.grid.rowsheight;q.recordendindex+=2}else{q.recordendindex=b(window).height()/y.grid.rowsheight}if(this.pageable){q.recordendindex=this.pagesize}}b.extend(v,{sortdatafield:y.sortfield,sortorder:y.sortfielddirection,pagenum:y.pagenum,pagesize:y.grid.pagesize,recordstartindex:q.recordstartindex,recordendindex:q.recordendindex});var w=g._options.data;if(g._options.data){b.extend(g._options.data,v)}else{if(q.data){b.extend(v,q.data)}g._options.data=v}var k=function(){var x=b.jqx.browser.msie&&b.jqx.browser.version<9;var z=function(){var A=y.totalrecords;t(y);if(q.recordstartindex){y.updateview(q.recordstartindex,q.recordstartindex+y.pagesize)}else{y.refresh()}y.update(A!=y.totalrecords)};if(x){try{z()}catch(m){}}else{z()}};g.unbindDownloadComplete(y.grid.element.id);g.bindDownloadComplete(y.grid.element.id,k);g.dataBind();g._options.data=w}};this.getid=function(g,e,f){if(b(g,e).length>0){return b(g,e).text()}if(g){if(g.toString().length>0){var d=b(e).attr(g);if(d!=null&&d.toString().length>0){return d}}}return f};this.getvaluebytype=function(g,d){var e=g;if(d.type=="date"){var f=new Date(g);if(f.toString()=="NaN"||f.toString()=="Invalid Date"){if(b.jqx.dataFormat){g=b.jqx.dataFormat.tryparsedate(g)}else{g=f}}else{g=f}if(g==null){g=e}}else{if(d.type=="float"){var g=parseFloat(g);if(isNaN(g)){g=e}}else{if(d.type=="int"){var g=parseInt(g);if(isNaN(g)){g=e}}else{if(d.type=="bool"){if(g!=null){if(g.toLowerCase()=="false"){g=false}else{if(g.toLowerCase()=="true"){g=true}}}if(g==1){g=true}else{if(g==0){g=false}else{g=""}}}}}}return g};this.setpaging=function(d){if(d.pageSize!=undefined){this.pagesize=d.pageSize}if(d.pageNum!=undefined){this.pagenum=Math.min(d.pageNum,Math.ceil(this.totalrows/this.pagesize))}this.refresh()};this.getpagingdetails=function(){return{pageSize:this.pagesize,pageNum:this.pagenum,totalrows:this.totalrows}};this._clearcaches=function(){this.sortcache={};this.sortdata=null;this.changedrecords=new Array();this.records=new Array();this.rows=new Array();this.cacheddata=new Array();this.originaldata=new Array();this.bounditems=new Array();this.loadedrecords=new Array();this.loadedrootgroups=new Array();this.loadedgroups=new Array();this.loadedgroupsByKey=new Array();this._cachegrouppages=new Array();this.recordsbyid=new Array();this.cachedrecords=new Array();this.recordids=new Array()};this.addfilter=function(g,f){var e=-1;for(var d=0;d<this.filters.length;d++){if(this.filters[d].datafield==g){e=d;break}}if(e==-1){this.filters[this.filters.length]={filter:f,datafield:g}}else{this.filters[e]={filter:f,datafield:g}}};this.removefilter=function(e){for(var d=0;d<this.filters.length;d++){if(this.filters[d].datafield==e){this.filters.splice(d,1);break}}};this.getItemFromIndex=function(d){return this.records[d]};this.updaterow=function(d,n,l){var e=this.filters&&this.filters.length>0;if(!e&&n!=undefined&&d!=undefined){n.uid=d;if(!(n[this.source.id])){n[this.source.id]=n.uid}var j=this.recordsbyid["id"+d];var k=this.records.indexOf(j);if(k==-1){return false}this.records[k]=n;if(this.cachedrecords){this.cachedrecords[k]=n}if(l==true||l==undefined){this.refresh()}this.changedrecords[n.uid]={Type:"Update",OldData:j,Data:n};return true}else{if(this.filters&&this.filters.length>0){var f=this.cachedrecords;var j=null;var k=-1;for(var h=0;h<f.length;h++){if(f[h].uid==d){j=f[h];k=h;break}}if(j){var m=this.that;for(var g in n){m.cachedrecords[k][g]=n[g]}if(l==true||l==undefined){this.refresh()}return true}}}return false};this.addrow=function(h,i,d,g){if(i!=undefined){if(!h){i.uid=this.getid(this.source.id,i,this.totalrecords);var e=this.recordsbyid["id"+i.uid];while(e!=null){var f=Math.floor(Math.random()*10000).toString();i.uid=f;e=this.recordsbyid["id"+f]}}else{i.uid=h}if(!(i[this.source.id])){if(this.source.id!=undefined){i[this.source.id]=i.uid}}if(d=="last"){this.records.push(i)}else{if(typeof d==="number"&&isFinite(d)){this.records.splice(d,0,i)}else{this.records.splice(0,0,i)}}if(this.filters&&this.filters.length>0){if(d=="last"){this.cachedrecords.push(i)}else{if(typeof d==="number"&&isFinite(d)){this.cachedrecords.splice(d,0,i)}else{this.cachedrecords.splice(0,0,i)}}}this.totalrecords++;if(this.virtualmode){this.source.totalrecords=this.totalrecords}if(g==true||g==undefined){this.refresh()}this.changedrecords[i.uid]={Type:"New",Data:i};return true}return false};this.deleterow=function(j,h){if(j!=undefined){var d=this.filters&&this.filters.length>0;if(this.recordsbyid["id"+j]&&!d){var e=this.recordsbyid["id"+j];var k=this.records.indexOf(e);this.changedrecords[j]={Type:"Delete",Data:this.records[k]};this.records.splice(k,1);this.totalrecords--;if(this.virtualmode){this.source.totalrecords=this.totalrecords}if(h==true||h==undefined){this.refresh()}return true}else{if(this.filters&&this.filters.length>0){var f=this.cachedrecords;var e=null;var k=-1;for(var g=0;g<f.length;g++){if(f[g].uid==j){e=f[g];k=g;break}}if(e){this.cachedrecords.splice(k,1);if(h==true||h==undefined){this.totalrecords=0;this.records=this.cachedrecords;this.refresh()}return true}}}return false}return false};this.reload=function(f,d,r,g,h,u,t){var m=this.that;var l=new Array();var o=f;var i=d;var j=r;var p=g;var k=i.length;var w=0;var e=0;var s,n;this.columns=[];this.bounditems=new Array();this.loadedrecords=new Array();this.loadedrootgroups=new Array();this.loadedgroups=new Array();this.loadedgroupsByKey=new Array();this._cachegrouppages=new Array();this.recordsbyid={};if(this.totalrecords==0){Object.size=function(z){var y=0,x;for(x in z){if(z.hasOwnProperty(x)){y++}}return y};var v=Object.size(o);this.totalrecords=v;b.each(this.records,function(y){var z=this;var x=0;b.each(z,function(A,B){m.columns[x++]=A});return false})}if(this.virtualmode){if(this.pageable){this.updateview();return}var u=0;if(!this.groupable){this.updateview();return}else{var t=this.totalrecords}}else{var u=0;var t=this.totalrecords}if(this.groupable&&this.groups.length>0&&this.loadgrouprecords){var q=u;q=this.loadgrouprecords(0,u,t,j,e,p,i,k,l)}else{w=this.loadflatrecords(u,t,j,e,p,i,k,l)}if(k>e){i.splice(e,k-e)}if(this.groups.length>0&&this.groupable){this.totalrows=q}else{this.totalrows=w}return l};this.loadflatrecords=function(d,o,e,p,l,u,n,q){var t=this.that;var k=d;var m=d;o=Math.min(o,this.totalrecords);var g=this.sortdata!=null;var f=this.source.id&&(this.source.datatype=="local"||this.source.datatype=="array"||this.source.datatype=="");var j=g?this.sortdata:this.records;for(var h=d;h<o;h++){var s={};if(!g){s=b.extend({},j[h]);id=s[t.uniqueId];s.boundindex=k;t.loadedrecords[k]=s;if(s.uid==undefined){s.uid=t.getid(t.source.id,s,k)}t.recordsbyid["id"+s.uid]=j[h];s.uniqueid=t.generatekey();t.bounditems[this.bounditems.length]=s}else{s=b.extend({},j[h].value);id=s[t.uniqueId];s.boundindex=j[h].index;if(s.uid==undefined){s.uid=t.getid(t.source.id,s,s.boundindex)}t.recordsbyid["id"+s.uid]=j[h].value;t.loadedrecords[k]=s;s.uniqueid=t.generatekey();t.bounditems[s.boundindex]=s}if(p>=n||id!=u[p][t.uniqueId]||(l&&l[id])){q[q.length]=p}u[p]=s;p++;s.visibleindex=m;m++;k++}if(t.grid.summaryrows){var r=k;b.each(t.grid.summaryrows,function(){var i=b.extend({},this);i.boundindex=o++;t.loadedrecords[r]=i;i.uniqueid=t.generatekey();t.bounditems[t.bounditems.length]=i;u[p]=i;p++;i.visibleindex=m;m++;r++})}return m},this.updateview=function(o,p){var r=this.that;var k=this.pagesize*this.pagenum;var n=0;var s=new Array();var e=this.filters;var j=this.updated;var l=s.length;if(this.pageable){if(this.virtualmode){if(!this.groupable||this.groups.length==0){this.loadflatrecords(this.pagesize*this.pagenum,this.pagesize*(1+this.pagenum),e,n,j,s,l,[]);this.totalrows=s.length}else{if(this.groupable&&this.groups.length>0&&this.loadgrouprecords){if(this._cachegrouppages[this.pagenum+"_"+this.pagesize]!=undefined){this.rows=this._cachegrouppages[this.pagenum+"_"+this.pagesize];this.totalrows=this.rows.length;return}var m=this.pagesize*(1+this.pagenum);if(m>this.totalrecords){m=this.totalrecords}this.loadgrouprecords(0,this.pagesize*this.pagenum,m,e,n,j,s,l,[]);this._cachegrouppages[this.pagenum+"_"+this.pagesize]=this.rows;this.totalrows=this.rows.length;return}}}}else{if(this.virtualmode&&(!this.groupable||this.groups.length==0)){var g=this.pagesize;if(g==0){g=Math.min(100,this.totalrecords)}var d=g*this.pagenum;if(this.loadedrecords.length==0){d=0}if(o!=null&&p!=null){this.loadflatrecords(o,p,e,n,j,s,l,[])}else{this.loadflatrecords(this.pagesize*this.pagenum,this.pagesize*(1+this.pagenum),e,n,j,s,l,[])}this.totalrows=this.loadedrecords.length;this.rows=s;if(s.length>=g){return}}}if(this.groupable&&this.pageable&&this.groups.length>0&&this._updategroupsinpage){s=this._updategroupsinpage(r,e,k,n,l,this.pagesize*this.pagenum,this.pagesize*(1+this.pagenum))}else{for(var h=this.pagesize*this.pagenum;h<this.pagesize*(1+this.pagenum);h++){var q=h<this.loadedrecords.length?this.loadedrecords[h]:null;if(q==null){continue}if(!this.pagesize||(k>=this.pagesize*this.pagenum&&k<=this.pagesize*(this.pagenum+1))){s[n]=q;n++}k++}}if((s.length==0||s.length<this.pagesize)&&!this.pageable&&this.virtualmode){n=s.length;var f=s.length;for(var h=this.pagesize*this.pagenum;h<this.pagesize*(1+this.pagenum)-f;h++){var q={};q.boundindex=h+f;q.visibleindex=h+f;q.uniqueid=r.generatekey();q.empty=true;r.bounditems[h+f]=q;s[n]=q;n++}}this.rows=s};this.generatekey=function(){var d=function(){return(((1+Math.random())*16)|0)};return(""+d()+d()+"-"+d()+"-"+d()+"-"+d()+"-"+d()+d()+d())};this.reloaddata=function(){this.reload(this.records,this.rows,this.filter,this.updated,true)};this.refresh=function(h){if(this.suspend){return}if(h==undefined){h=true}var l=this.rows.length;var k=this.totalrows;if(this.filters.length>0&&!this.virtualmode){var e="";var g=this.cachedrecords.length;var s=new Array();this.totalrecords=0;var n=this.cachedrecords;this._dataIndexToBoundIndex=new Array();var f=this.filters.length;if(this.source!=null&&this.source.filter!=undefined&&this.source.localdata!=undefined){s=this.source.filter(this.filters,n,g);if(s==undefined){s=new Array()}this.records=s}else{if(this.source.filter==null||this.source.filter==undefined){for(var u=0;u<g;u++){var o=n[u];var d=undefined;for(var m=0;m<f;m++){var e=this.filters[m].filter;var r=o[this.filters[m].datafield];var t=e.evaluate(r);if(d==undefined){d=t}else{if(e.operator=="or"){d=d||t}else{d=d&&t}}}if(d){s[s.length]=b.extend({dataindex:u},o);this._dataIndexToBoundIndex[u]={boundindex:s.length-1}}else{this._dataIndexToBoundIndex[u]=null}}this.records=s}}if(this.sortdata){var i=this.sortfield;if(this.sortcache[i]){this.sortdata=null;var p=this.sortcache[i].direction;this.sortcache[i]=null;this.sortby(this.sortfield,p);return}}}else{if(this.filters.length==0&&!this.virtualmode){if(this.cachedrecords){this.totalrecords=0;var n=this.cachedrecords;this.records=n;if(this.sortdata){var i=this.sortfield;if(this.sortcache[i]){this.sortdata=null;var p=this.sortcache[i].direction;this.sortcache[i]=null;this.sortby(this.sortfield,p);return}}}}}var q=this.reload(this.records,this.rows,this.filter,this.updated,h);this.updated=null;if(this.rowschangecallback!=null){if(k!=totalrows){this.rowschangecallback({type:"PagingChanged",data:getpagingdetails()})}if(l!=rows.length){this.rowschangecallback({type:"RowsCountChanged",data:{previous:l,current:rows.length}})}if(q.length>0||l!=rows.length){this.rowschangecallback({type:"RowsChanged",data:{previous:l,current:rows.length,diff:q}})}}};return this}})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.dataview.sort=function(){this.sortby=function(d,f,p){var m=Object.prototype.toString;if(f==null){this.sortdata=null;this.refresh();return}if(f==undefined){f=true}if(f=="a"||f=="asc"||f=="ascending"||f==true){f=true}else{f=false}var g=d;this.sortfield=d;this.sortfielddirection=f?"asc":"desc";if(this.sortcache==undefined){this.sortcache={}}this.sortdata=[];var b=[];var c=false;if(g=="constructor"){g=""}if(!this.virtualmode&&this.sortcache[g]!=null){var o=this.sortcache[g];b=o._sortdata;if(o.direction==f){b.reverse()}else{if(!o.direction&&f){b.reverse()}c=true}if(b.length<this.totalrecords){this.sortcache={};c=false;b=[]}}Object.prototype.toString=(typeof d=="function")?d:function(){return this[d]};var r=this.records;var t=this.that;var n="";if(this.source.datafields){a.each(this.source.datafields,function(){if(this.name==d){if(this.type){n=this.type}return false}})}if(b.length==0){if(r.length){var h=r.length;for(var q=0;q<h;q++){var e=r[q];if(e!=null){var j=e;var s=j.toString();b.push({sortkey:s,value:j,index:q})}}}else{var l=false;for(obj in r){var e=r[obj];if(e==undefined){l=true;break}var j=e;b.push({sortkey:j.toString(),value:j,index:obj})}if(l){a.each(r,function(u,v){b.push({sortkey:v.toString(),value:v,index:u})})}}}if(!c){if(p==null){this._sortcolumntype=n;var k=this;b.sort(function(u,i){return k._compare(u,i,n)})}else{b.sort(p)}}if(!f){b.reverse()}Object.prototype.toString=m;this.sortdata=b;this.sortcache[g]={_sortdata:b,direction:f};this.reload(this.records,this.rows,this.filters,this.updated,true)},this.clearsortdata=function(){this.sortcache={};this.sortdata=null};this._compare=function(c,b,e){var c=c.sortkey;var b=b.sortkey;if(c===undefined){c=null}if(b===undefined){b=null}if(c===null&&b===null){return 0}if(c===null&&b!==null){return 1}if(c!==null&&b===null){return -1}if(a.jqx.dataFormat){if(e&&e!=""){switch(e){case"number":case"int":case"float":if(c<b){return -1}if(c>b){return 1}return 0;case"date":case"time":if(c<b){return -1}if(c>b){return 1}return 0;case"string":case"text":c=String(c).toLowerCase();b=String(b).toLowerCase();break}}else{if(a.jqx.dataFormat.isNumber(c)&&a.jqx.dataFormat.isNumber(b)){if(c<b){return -1}if(c>b){return 1}return 0}else{if(a.jqx.dataFormat.isDate(c)&&a.jqx.dataFormat.isDate(b)){if(c<b){return -1}if(c>b){return 1}return 0}else{if(!a.jqx.dataFormat.isNumber(c)&&!a.jqx.dataFormat.isNumber(b)){c=String(c).toLowerCase();b=String(b).toLowerCase()}}}}}try{if(c<b){return -1}if(c>b){return 1}}catch(d){var f=d}return 0};this._equals=function(c,b){return(this._compare(c,b)===0)}};a.extend(a.jqx._jqxGrid.prototype,{_rendersortcolumn:function(){var b=this.that;var d=this.getsortcolumn();if(this.sortdirection){var c=function(f,g){var e=b.getcolumn(f);if(e){if(g.ascending){a.jqx.aria(e.element,"aria-sort","ascending")}else{if(g.descending){a.jqx.aria(e.element,"aria-sort","descending")}else{a.jqx.aria(e.element,"aria-sort","none")}}}};if(this._oldsortinfo){if(this._oldsortinfo.column){c(this._oldsortinfo.column,{ascending:false,descending:false})}}c(d,this.sortdirection)}this._oldsortinfo={column:d,direction:this.sortdirection};if(this.sortdirection){a.each(this.columns.records,function(f,g){var e=a.data(document.body,"groupsortelements"+this.displayfield);if(d==null||this.displayfield!=d){a(this.sortasc).hide();a(this.sortdesc).hide();if(e!=null){e.sortasc.hide();e.sortdesc.hide()}}else{if(b.sortdirection.ascending){a(this.sortasc).show();a(this.sortdesc).hide();if(e!=null){e.sortasc.show();e.sortdesc.hide()}}else{a(this.sortasc).hide();a(this.sortdesc).show();if(e!=null){e.sortasc.hide();e.sortdesc.show()}}}})}},getsortcolumn:function(){if(this.sortcolumn){return this.sortcolumn}return null},removesort:function(){this.sortby(null)},sortby:function(d,g,f,e,b){if(this._loading&&b!==false){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}if(d==null){g=null;d=this.sortcolumn}if(d){var c=this.that;if(f==undefined&&c.source.sortcomparer!=null){f=c.source.sortcomparer}if(g=="a"||g=="asc"||g=="ascending"||g==true){ascending=true}else{ascending=false}if(g!=null){c.sortdirection={ascending:ascending,descending:!ascending}}else{c.sortdirection={ascending:false,descending:false}}if(g!=null){c.sortcolumn=d}else{c.sortcolumn=null}if(c.source.sort||c.virtualmode){c.dataview.sortfield=d;if(g==null){c.dataview.sortfielddirection=""}else{c.dataview.sortfielddirection=ascending?"asc":"desc"}if(c.source.sort&&!this._loading){c.source.sort(d,g);c._raiseEvent(6,{sortinformation:c.getsortinformation()});return}}else{c.dataview.sortby(d,g,f)}if(e===false){return}if(c.groupable&&c.groups.length>0){c._render(true,false,false);if(c._updategroupheadersbounds&&c.showgroupsheader){c._updategroupheadersbounds()}}else{if(c.pageable){c.dataview.updateview()}c._updaterowsproperties();c.rendergridcontent(true)}c._raiseEvent(6,{sortinformation:c.getsortinformation()})}},_togglesort:function(d){var b=this.that;if(this.disabled){return}if(d.sortable&&b.sortable){var c=b.getsortinformation();var e=null;if(c.sortcolumn!=null&&c.sortcolumn==d.displayfield){e=c.sortdirection.ascending;if(b.sorttogglestates>1){if(e==true){e=false}else{e=null}}else{e=!e}}else{e=true}b.sortby(d.displayfield,e,null)}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.extend(a.jqx._jqxGrid.prototype,{_initpager:function(){var n=this.that;var c=this.gridlocalization.pagergotopagestring;var m=this.gridlocalization.pagerrangestring;var q=this.gridlocalization.pagershowrowsstring;var o=(this.pagerheight-17)/2;this.pagerdiv=this.pagerdiv||a('<div style="width: 100%; height: 100%; position: relative;"></div>');if(!this.pageable){this.pagerdiv.remove();this.vScrollBar.jqxScrollBar({thumbSize:0});return}if(!this.pagerrenderer){this.pagerdiv.css("top",o);this.pager.append(this.pagerdiv);this.pagergotoinput=this.pagergotoinput||a('<div style="margin-right: 7px; width: 27px; height: 17px; float: right;"><input style="margin-top: 0px; text-align: right; width: 27px;" type="text"/></div>');this.pagergoto=this.pagergoto||a('<div style="float: right; margin-right: 7px;"></div>');this.pagerrightbutton=this.pagerrightbutton||a('<div type="button" style="padding: 0px; margin-top: 0px; margin-right: 3px; width: 27px; float: right;"></div>');this.pagerleftbutton=this.pagerleftbutton||a('<div type="button" style="padding: 0px; margin-top: 0px; margin-right: 3px; width: 27px; float: right;"></div>');this.pagerdetails=this.pagerdetails||a('<div style="margin-right: 7px; float: right;"></div>');this.pagershowrows=this.pagershowrows||a('<div style="margin-right: 7px; float: right;"></div>');this.pagerbuttons=a('<div style="margin-right: 3px; float: right;"></div>');if(this.pagershowrowscombo&&this.pagershowrowscombo.jqxDropDownList){this.pagershowrowscombo.remove();this.pagershowrowscombo=null}this.pagergotoinput.attr("disabled",this.disabled);this.pagerfirstbutton=a('<div type="button" style="padding: 0px; margin-top: 0px; margin-left: 3px; margin-right: 3px; width: 27px; float: right;"></div>');this.pagerlastbutton=a('<div type="button" style="padding: 0px; margin-top: 0px; margin-right: 3px; width: 27px; float: right;"></div>');this.pagershowrowscombo=this.pagershowrowscombo||a('<div id="gridpagerlist" style="margin-top: 0px; margin-right: 7px; float: right;"></div>');this.pagerdiv.children().remove();this.pagershowrowscombo[0].id="gridpagerlist"+this.element.id;this.removeHandler(this.pagerrightbutton,"mousedown");this.removeHandler(this.pagerrightbutton,"mouseup");this.removeHandler(this.pagerrightbutton,"click");this.removeHandler(this.pagerleftbutton,"mousedown");this.removeHandler(this.pagerleftbutton,"mouseup");this.removeHandler(this.pagerleftbutton,"click");this.removeHandler(this.pagerfirstbutton,"mousedown");this.removeHandler(this.pagerfirstbutton,"mouseup");this.removeHandler(this.pagerfirstbutton,"click");this.removeHandler(this.pagerlastbutton,"mousedown");this.removeHandler(this.pagerlastbutton,"mouseup");this.removeHandler(this.pagerlastbutton,"click");this.pagerleftbutton.attr("title",this.gridlocalization.pagerpreviousbuttonstring);this.pagerrightbutton.attr("title",this.gridlocalization.pagernextbuttonstring);if(this.pagermode=="simple"){if(a.jqx.browser.msie&&a.jqx.browser.version<8){this.pagerbuttons.css("overflow","visible");this.pagerbuttons.css("padding","3px")}this.pagerfirstbutton.attr("title",this.gridlocalization.pagerfirstbuttonstring);this.pagerlastbutton.attr("title",this.gridlocalization.pagerlastbuttonstring);var k=a("<div style='margin-left: 6px; width: 15px; height: 15px;'></div>");k.addClass(this.toThemeProperty("jqx-icon-arrow-first"));this.pagerfirstbutton.wrapInner(k);var s=a("<div style='margin-left: 6px; width: 15px; height: 15px;'></div>");s.addClass(this.toThemeProperty("jqx-icon-arrow-last"));this.pagerlastbutton.wrapInner(s);this.pagerdiv.append(this.pagerfirstbutton);this.pagerdiv.append(this.pagerleftbutton);this.pagerdiv.append(this.pagerbuttons);this.pagerdiv.append(this.pagerrightbutton);this.pagerdiv.append(this.pagerlastbutton);this.pagerlastbutton.jqxButton({cursor:"pointer",disabled:this.disabled,theme:this.theme});this.pagerfirstbutton.jqxButton({cursor:"pointer",disabled:this.disabled,theme:this.theme});this.pagerbuttons.css("float","left");this.pagerlastbutton.css("float","left");this.pagerfirstbutton.css("float","left");this.pagerrightbutton.css("float","left");this.pagerleftbutton.css("float","left");this.pagergotoinput.hide();this.pagershowrowscombo.hide();this.pagergoto.hide();this.pagershowrows.hide()}else{this.pagergotoinput.show();this.pagershowrowscombo.show();this.pagergoto.show();this.pagershowrows.show();this.pagerdiv.append(this.pagerrightbutton);this.pagerdiv.append(this.pagerleftbutton)}this.pagerrightbutton.jqxButton({cursor:"pointer",disabled:this.disabled,theme:this.theme});this.pagerleftbutton.jqxButton({cursor:"pointer",disabled:this.disabled,theme:this.theme});this.pagerleftbutton.find(".jqx-icon-arrow-left").remove();this.pagerrightbutton.find(".jqx-icon-arrow-right").remove();var d=a("<div style='margin-left: 6px; width: 15px; height: 15px;'></div>");d.addClass(this.toThemeProperty("jqx-icon-arrow-left"));this.pagerleftbutton.wrapInner(d);var l=a("<div style='margin-left: 6px; width: 15px; height: 15px;'></div>");l.addClass(this.toThemeProperty("jqx-icon-arrow-right"));this.pagerrightbutton.wrapInner(l);this.pagerdiv.append(this.pagerdetails);if(this.pagermode!="simple"){this.pagerdiv.append(this.pagershowrowscombo);this.pagerdiv.append(this.pagershowrows);this.pagerdiv.append(this.pagergotoinput);this.pagerdiv.append(this.pagergoto)}var b=this.pagesizeoptions;if(!this.pagershowrowscombo.jqxDropDownList){throw new Error("jqxGrid: jqxdropdownlist.js is not loaded.");return}this.pagershowrowscombo.jqxDropDownList({rtl:this.rtl,disabled:this.disabled,source:b,enableBrowserBoundsDetection:true,keyboardSelection:false,autoDropDownHeight:true,width:44,height:16,theme:this.theme});var h=0;for(var f=0;f<b.length;f++){if(this.pagesize>=b[f]){h=f}}this.pagershowrows[0].innerHTML=q;this.pagergoto[0].innerHTML=c;this.updatepagerdetails();this.pagershowrowscombo.jqxDropDownList({selectedIndex:h});this.pagerpageinput=this.pagergotoinput.find("input");this.pagerpageinput.addClass(this.toThemeProperty("jqx-input"));this.pagerpageinput.addClass(this.toThemeProperty("jqx-widget-content"));if(this.rtl){this.pagerpageinput.css("direction","rtl")}var n=this.that;this.removeHandler(this.pagershowrowscombo,"select");this.addHandler(this.pagershowrowscombo,"select",function(v){if(v.args){if(n.vScrollInstance){n.vScrollInstance.setPosition(0)}if(n.editcell!=null&&n.endcelledit){n.endcelledit(n.editcell.row,n.editcell.column,true,false)}var t=v.args.index;var w=n.dataview.pagenum*n.dataview.pagesize;var u=b[t];var x=n.pagesize;n.pagesize=parseInt(u);if(isNaN(n.pagesize)){n.pagesize=10}if(u>=100){n.pagershowrowscombo.jqxDropDownList({width:55})}else{n.pagershowrowscombo.jqxDropDownList({width:44})}n.dataview.pagesize=n.pagesize;var i=Math.floor(w/n.dataview.pagesize);n.prerenderrequired=true;n._requiresupdate=true;n._raiseEvent(10,{pagenum:i,oldpagesize:x,pagesize:n.dataview.pagesize});n.gotopage(i);if(n.autoheight&&n._updatesizeonwindowresize){n._updatesize(true);setTimeout(function(){n._updatesize(true)},500)}}});var p=this.pagergotoinput.find("input");p.addClass(this.toThemeProperty("jqx-grid-pager-input"));p.addClass(this.toThemeProperty("jqx-rc-all"));this.removeHandler(p,"keydown");this.removeHandler(p,"change");this.addHandler(p,"keydown",function(i){if(i.keyCode>=65&&i.keyCode<=90){return false}if(i.keyCode=="13"){var t=p.val();t=parseInt(t);if(!isNaN(t)){n.gotopage(t-1)}return false}});this.addHandler(p,"change",function(){var i=p.val();i=parseInt(i);if(!isNaN(i)){n.gotopage(i-1)}});this.addHandler(this.pagerrightbutton,"mouseenter",function(){l.addClass(n.toThemeProperty("jqx-icon-arrow-right-hover"))});this.addHandler(this.pagerleftbutton,"mouseenter",function(){d.addClass(n.toThemeProperty("jqx-icon-arrow-left-hover"))});this.addHandler(this.pagerrightbutton,"mouseleave",function(){l.removeClass(n.toThemeProperty("jqx-icon-arrow-right-hover"))});this.addHandler(this.pagerleftbutton,"mouseleave",function(){d.removeClass(n.toThemeProperty("jqx-icon-arrow-left-hover"))});this.addHandler(this.pagerrightbutton,"mousedown",function(){l.addClass(n.toThemeProperty("jqx-icon-arrow-right-selected"))});this.addHandler(this.pagerrightbutton,"mouseup",function(){l.removeClass(n.toThemeProperty("jqx-icon-arrow-right-selected"))});this.addHandler(this.pagerleftbutton,"mousedown",function(){d.addClass(n.toThemeProperty("jqx-icon-arrow-left-selected"))});this.addHandler(this.pagerleftbutton,"mouseup",function(){d.removeClass(n.toThemeProperty("jqx-icon-arrow-left-selected"))});this.addHandler(a(document),"mouseup.pagerbuttons"+this.element.id,function(){l.removeClass(n.toThemeProperty("jqx-icon-arrow-right-selected"));d.removeClass(n.toThemeProperty("jqx-icon-arrow-left-selected"))});this.addHandler(this.pagerrightbutton,"click",function(){if(!n.pagerrightbutton.jqxButton("disabled")){n.gotonextpage()}});this.addHandler(this.pagerleftbutton,"click",function(){if(!n.pagerleftbutton.jqxButton("disabled")){n.gotoprevpage()}});var j=this;if(this.pagermode==="simple"){var g=this.pagerfirstbutton;var r=this.pagerlastbutton;this.addHandler(r,"mouseenter",function(){s.addClass(j.toThemeProperty("jqx-icon-arrow-last-hover"))});this.addHandler(g,"mouseenter",function(){k.addClass(j.toThemeProperty("jqx-icon-arrow-first-hover"))});this.addHandler(r,"mouseleave",function(){s.removeClass(j.toThemeProperty("jqx-icon-arrow-last-hover"))});this.addHandler(g,"mouseleave",function(){k.removeClass(j.toThemeProperty("jqx-icon-arrow-first-hover"))});this.addHandler(r,"mousedown",function(){s.addClass(j.toThemeProperty("jqx-icon-arrow-last-selected"))});this.addHandler(g,"mousedown",function(){k.addClass(j.toThemeProperty("jqx-icon-arrow-first-selected"))});this.addHandler(r,"mouseup",function(){s.removeClass(j.toThemeProperty("jqx-icon-arrow-last-selected"))});this.addHandler(g,"mouseup",function(){k.removeClass(j.toThemeProperty("jqx-icon-arrow-first-selected"))});this.addHandler(a(document),"mouseup.pagerbuttons"+name+this.element.id,function(){l.removeClass(j.toThemeProperty("jqx-icon-arrow-right-selected"));d.removeClass(j.toThemeProperty("jqx-icon-arrow-left-selected"));if(s){s.removeClass(j.toThemeProperty("jqx-icon-arrow-last-selected"));k.removeClass(j.toThemeProperty("jqx-icon-arrow-first-selected"))}});this.addHandler(g,"click",function(){if(!g.jqxButton("disabled")){j.gotopage(0)}});this.addHandler(r,"click",function(){if(!r.jqxButton("disabled")){var t=j.dataview.totalrecords;var i=Math.ceil(t/j.pagesize);j.gotopage(i-1)}})}}else{this.pagerdiv.children().remove();var e=this.pagerrenderer();if(e!=null){this.pagerdiv.append(a(e))}this.pager.append(this.pagerdiv)}this.vScrollBar.jqxScrollBar({thumbSize:this.host.height()/5});this.vScrollBar.jqxScrollBar("refresh");this._arrange()},_updatepagertheme:function(){if(this.pagershowrowscombo==null){return}this.pagershowrowscombo.jqxDropDownList({theme:this.theme});this.pagerrightbutton.jqxButton({theme:this.theme});this.pagerleftbutton.jqxButton({theme:this.theme});this.pagerpageinput.removeClass();var c=this.pagergotoinput.find("input");c.removeClass();c.addClass(this.toThemeProperty("jqx-grid-pager-input"));c.addClass(this.toThemeProperty("jqx-rc-all"));this.pagerpageinput.addClass(this.toThemeProperty("jqx-input"));this.pagerpageinput.addClass(this.toThemeProperty("jqx-widget-content"));this.pagerleftbutton.find(".jqx-icon-arrow-left").remove();this.pagerrightbutton.find(".jqx-icon-arrow-right").remove();var d=a("<div style='margin-left: 6px; width: 15px; height: 15px;'></div>");d.addClass(this.toThemeProperty("jqx-icon-arrow-left"));this.pagerleftbutton.wrapInner(d);var e=a("<div style='margin-left: 6px; width: 15px; height: 15px;'></div>");e.addClass(this.toThemeProperty("jqx-icon-arrow-right"));this.pagerrightbutton.wrapInner(e);if(this.pagermode=="simple"){if(a.jqx.browser.msie&&a.jqx.browser.version<8){this.pagerbuttons.css("overflow","visible");this.pagerbuttons.css("padding","3px")}this.pagerfirstbutton.attr("title",this.gridlocalization.pagerfirstbuttonstring);this.pagerlastbutton.attr("title",this.gridlocalization.pagerlastbuttonstring);var h=a("<div style='margin-left: 6px; width: 15px; height: 15px;'></div>");h.addClass(this.toThemeProperty("jqx-icon-arrow-first"));this.pagerfirstbutton.wrapInner(h);var g=a("<div style='margin-left: 6px; width: 15px; height: 15px;'></div>");g.addClass(this.toThemeProperty("jqx-icon-arrow-last"));this.pagerlastbutton.wrapInner(g);this.pagerdiv.append(this.pagerfirstbutton);this.pagerdiv.append(this.pagerleftbutton);this.pagerdiv.append(this.pagerbuttons);this.pagerdiv.append(this.pagerrightbutton);this.pagerdiv.append(this.pagerlastbutton);this.pagerlastbutton.jqxButton({cursor:"pointer",disabled:this.disabled,theme:this.theme});this.pagerfirstbutton.jqxButton({cursor:"pointer",disabled:this.disabled,theme:this.theme});this.pagerbuttons.css("float","left");this.pagerlastbutton.css("float","left");this.pagerfirstbutton.css("float","left");this.pagerrightbutton.css("float","left");this.pagerleftbutton.css("float","left");this.pagergotoinput.hide();this.pagershowrowscombo.hide();this.pagergoto.hide();this.pagershowrows.hide()}else{this.pagergotoinput.show();this.pagershowrowscombo.show();this.pagergoto.show();this.pagershowrows.show()}var b=function(j,i){j.removeHandler(i,"mouseenter");j.removeHandler(i,"mouseleave");j.removeHandler(i,"mousedown");j.removeHandler(i,"mouseup")};b(this,this.pagerrightbutton);b(this,this.pagerleftbutton);var f=this.that;this.addHandler(this.pagerrightbutton,"mouseenter",function(){e.addClass(f.toThemeProperty("jqx-icon-arrow-right-hover"))});this.addHandler(this.pagerleftbutton,"mouseenter",function(){d.addClass(f.toThemeProperty("jqx-icon-arrow-left-hover"))});this.addHandler(this.pagerrightbutton,"mouseleave",function(){e.removeClass(f.toThemeProperty("jqx-icon-arrow-right-hover"))});this.addHandler(this.pagerleftbutton,"mouseleave",function(){d.removeClass(f.toThemeProperty("jqx-icon-arrow-left-hover"))});this.addHandler(this.pagerrightbutton,"mousedown",function(){e.addClass(f.toThemeProperty("jqx-icon-arrow-right-selected"))});this.addHandler(this.pagerrightbutton,"mouseup",function(){e.removeClass(f.toThemeProperty("jqx-icon-arrow-right-selected"))});this.addHandler(this.pagerleftbutton,"mousedown",function(){d.addClass(f.toThemeProperty("jqx-icon-arrow-left-selected"))});this.addHandler(this.pagerleftbutton,"mouseup",function(){d.removeClass(f.toThemeProperty("jqx-icon-arrow-left-selected"))})},gotopage:function(d){if(d==null||d==undefined){d=0}if(d==-1){d=0}if(d<0){return}var c=this.dataview.totalrecords;if(this.summaryrows){c+=this.summaryrows.length}var e=this.pagenum;this._raiseEvent(25,{oldpagenum:this.dataview.pagenum,pagenum:d,pagesize:this.dataview.pagesize});var b=Math.ceil(c/this.pagesize);if(d>=b){if(this.dataview.totalrecords==0){this.dataview.pagenum=0;this.updatepagerdetails()}if(d>0){d=b-1}}if(this.dataview.pagenum!=d||this._requiresupdate){if(this.pageable){if(this.source.pager){this.source.pager(d,this.dataview.pagesize,this.dataview.pagenum)}this.dataview.pagenum=d;if(this.virtualmode){this.hiddens=new Array();this.expandedgroups=new Array();if(this.rendergridrows){var h=d*this.dataview.pagesize;var g=h+this.dataview.pagesize;if(h!=null&&g!=null){if(this.pagerrightbutton){this.pagerrightbutton.jqxButton({disabled:true});this.pagerleftbutton.jqxButton({disabled:true});this.pagershowrowscombo.jqxDropDownList({disabled:true})}this.updatebounddata("pagechanged");this._raiseEvent(9,{pagenum:d,oldpagenum:e,pagesize:this.dataview.pagesize});this.updatepagerdetails();if(this.autosavestate){if(this.savestate){this.savestate()}}return}}}else{this.dataview.updateview()}this._loadrows();this._updatepageviews();this.tableheight=null;this._updatecolumnwidths();this._updatecellwidths();this._renderrows(this.virtualsizeinfo);this.updatepagerdetails();if(this.autoheight||this.autorowheight){var f=this.host.height()-this._gettableheight();height=f+this._pageviews[0].height;if(height!=this.host.height()){this._arrange();this._updatepageviews();if(this.autorowheight){this._renderrows(this.virtualsizeinfo)}}}if(this.editcell!=null&&this.endcelledit){this.endcelledit(this.editcell.row,this.editcell.column,true,false)}this._raiseEvent(9,{pagenum:d,oldpagenum:e,pagesize:this.dataview.pagesize});if(this.autosavestate){if(this.savestate){this.savestate()}}}}},gotoprevpage:function(){if(this.dataview.pagenum>0){this.gotopage(this.dataview.pagenum-1)}else{if(this.pagermode!="simple"){var c=this.dataview.totalrecords;if(this.summaryrows){c+=this.summaryrows.length}var b=Math.ceil(c/this.pagesize);this.gotopage(b-1)}}},gotonextpage:function(){var c=this.dataview.totalrecords;if(this.summaryrows){c+=this.summaryrows.length}var b=Math.ceil(c/this.pagesize);if(this.dataview.pagenum<b-1){this.gotopage(this.dataview.pagenum+1)}else{if(this.pagermode!="simple"){this.gotopage(0)}}},updatepagerdetails:function(){if(this.pagerdetails!=null&&this.pagerdetails.length>0){var n=this.dataview.pagenum*this.pagesize;var d=(this.dataview.pagenum+1)*this.pagesize;if(d>=this.dataview.totalrecords){d=this.dataview.totalrecords}var q=this.dataview.totalrecords;if(this.summaryrows){q+=this.summaryrows.length;if((this.dataview.pagenum+1)*this.pagesize>this.dataview.totalrecords){d=q}}n++;var g=Math.ceil(q/this.dataview.pagesize);if(g>=1){g--}g++;if(this.pagermode!=="simple"){var o=this.pagergotoinput.find("input");o.val(this.dataview.pagenum+1)}else{var b="";var f=this.pagerbuttonscount;if(f==0||!f){f=5}for(var h=0;h<f;h++){var m=1+h;var k=this.dataview.pagenum/f;var e=Math.floor(k);m+=e*f;var l=this.toTP("jqx-grid-pager-number");l+=" "+this.toTP("jqx-rc-all");if(m>g){break}if(h==0&&m>f){b+="<a class='"+l+"' tabindex=-1 href='javascript:;' data-page='"+(-1+m)+"'>...</a>"}if(this.dataview.pagenum===m-1){l+=" "+this.toTP("jqx-fill-state-pressed")}b+="<a class='"+l+"' tabindex=-1 href='javascript:;' data-page='"+m+"'>"+m+"</a>";if(h===f-1){var l=this.toTP("jqx-grid-pager-number");if(g>=1+m){b+="<a class='"+l+"' tabindex=-1 href='javascript:;' data-page='"+(1+m)+"'>...</a>"}}}var p=this["pagerbuttons"].find("a");this.removeHandler(p,"click");this.removeHandler(p,"mouseenter");this.removeHandler(p,"mouseleave");this["pagerbuttons"][0].innerHTML=b;var j=this;var c=function(){j.addHandler(p,"click",function(i){var r=a(i.target).attr("data-page");j.gotopage(parseInt(r)-1);return false});j.addHandler(p,"mouseenter",function(i){a(i.target).addClass(j.toTP("jqx-fill-state-hover"))});j.addHandler(p,"mouseleave",function(i){a(i.target).removeClass(j.toTP("jqx-fill-state-hover"))})};var p=this["pagerbuttons"].find("a");c(p)}this.pagergotoinput.attr("title","1 - "+g);if(d==0&&d<n){n=0}this.pagerdetails[0].innerHTML=n+"-"+d+this.gridlocalization.pagerrangestring+q;if(n>d){this.gotoprevpage()}}},_updatepagedview:function(e,g,b){var j=this.that;if(this.dataview.rows.length!=this.dataview.pagesize){this.dataview.updateview()}var k=this.dataview.rows.length;for(var d=0;d<k;d++){var f=this.dataview.rows[d].visibleindex;var h={index:f,height:this.heights[f],hidden:this.hiddens[f],details:this.details[f]};if(this.heights[f]==undefined){this.heights[f]=this.rowsheight;h.height=this.rowsheight}if(this.hiddens[f]==undefined){this.hiddens[f]=false;h.hidden=false}if(this.details[f]==undefined){this.details[f]=null}if(h.height!=j.rowsheight){g-=j.rowsheight;g+=h.height}if(h.hidden){g-=h.height}else{b+=h.height;var c=0;if(this.rowdetails){if(h.details&&h.details.rowdetails&&!h.details.rowdetailshidden){c=h.details.rowdetailsheight;b+=c;g+=c}}}}this._pageviews[0]={top:0,height:b};return g}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.extend(a.jqx._jqxGrid.prototype,{selectallrows:function(){this._trigger=false;var c=this.virtualmode?this.dataview.totalrecords:this.getboundrows().length;this.selectedrowindexes=new Array();for(var b=0;b<c;b++){this.selectedrowindexes[b]=b}if(this.selectionmode=="checkbox"&&!this._checkboxcolumnupdating){if(this._checkboxcolumn){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:true})}}this._renderrows(this.virtualsizeinfo);this._trigger=true},selectrow:function(b,c){this._applyrowselection(b,true,c);if(c!==false){this._updatecheckboxselection()}},_updatecheckboxselection:function(){if(this.selectionmode=="checkbox"){var c=this.getrows();if(c&&this._checkboxcolumn){if(c.length===0){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:false});return}var b=this.selectedrowindexes.length;if(b===c.length){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:true})}else{if(b===0){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:false})}else{this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:null})}}}}},unselectrow:function(b,c){this._applyrowselection(b,false,c);if(c!==false){this._updatecheckboxselection()}},selectcell:function(c,b){this._applycellselection(c,b,true)},unselectcell:function(c,b){this._applycellselection(c,b,false)},clearselection:function(c,d){this._trigger=false;this.selectedrowindex=-1;if(d!==false){for(var b=0;b<this.selectedrowindexes.length;b++){this._raiseEvent(3,{rowindex:this.selectedrowindexes[b]})}}this.selectedrowindexes=new Array();this.selectedcells=new Array();if(this.selectionmode=="checkbox"&&!this._checkboxcolumnupdating){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:false})}if(false===c){this._trigger=true;return}this._renderrows(this.virtualsizeinfo);this._trigger=true},getselectedrowindex:function(){return this.selectedrowindex},getselectedrowindexes:function(){return this.selectedrowindexes},getselectedcell:function(){return this.selectedcell},getselectedcells:function(){var b=new Array();for(obj in this.selectedcells){b[b.length]=this.selectedcells[obj]}return b},_getcellsforcopypaste:function(){var e=new Array();if(this.selectionmode.indexOf("cell")==-1){var h=this.selectedrowindexes;for(var d=0;d<h.length;d++){var c=h[d];for(var f=0;f<this.columns.records.length;f++){var g=c+"_"+this.columns.records[f].datafield;var b={rowindex:c,datafield:this.columns.records[f].datafield};e.push(b)}}}return e},deleteselection:function(){var d=this;var f=d.getselectedcells();if(this.selectionmode.indexOf("cell")==-1){f=this._getcellsforcopypaste()}if(f!=null&&f.length>0){for(var e=0;e<f.length;e++){var b=f[e];var g=d.getcolumn(b.datafield);var h=d.getcellvalue(b.rowindex,b.datafield);if(!g){continue}if(h!==""){var c=null;if(g.columntype=="checkbox"){if(!g.threestatecheckbox){c=false}}d._raiseEvent(17,{rowindex:b.rowindex,datafield:b.datafield,value:h});if(e==f.length-1){d.setcellvalue(b.rowindex,b.datafield,c,true);if(g.displayfield!=g.datafield){d.setcellvalue(b.rowindex,g.displayfield,c,true)}}else{d.setcellvalue(b.rowindex,b.datafield,c,false);if(g.displayfield!=g.datafield){d.setcellvalue(b.rowindex,g.displayfield,c,true)}}d._raiseEvent(18,{rowindex:b.rowindex,datafield:b.datafield,oldvalue:h,value:c})}}this.dataview.updateview();this._renderrows(this.virtualsizeinfo)}},copyselection:function(){var f="";var l=this;this.clipboardselection={};this._clipboardselection=[];var k=l.getselectedcells();if(this.selectionmode.indexOf("cell")==-1){k=this._getcellsforcopypaste()}if(k!=null&&k.length>0){var m=999999999999999;var j=-1;for(var d=0;d<k.length;d++){var g=k[d];var b=l.getcolumn(g.datafield);if(b!=null){var h=l.getcellvalue(g.rowindex,g.datafield);if(!this.clipboardselection[g.rowindex]){this.clipboardselection[g.rowindex]={}}this.clipboardselection[g.rowindex][g.datafield]=h;m=Math.min(m,g.rowindex);j=Math.max(j,g.rowindex)}}for(var c=m;c<=j;c++){var e=0;this._clipboardselection[this._clipboardselection.length]=new Array();if(this.clipboardselection[c]!=undefined){a.each(this.clipboardselection[c],function(i,n){if(e>0){f+="\t"}var o=n;if(n==null){o=""}l._clipboardselection[l._clipboardselection.length-1][e]=o;e++;f+=o})}if(c<j){f+="\n"}}}this.clipboardselectedtext=f;return f},pasteselection:function(){var k=this.getselectedcells();if(this.selectionmode.indexOf("cell")==-1){k=this._getcellsforcopypaste()}if(k!=null&&k.length>0){var j=k[0].rowindex;var d=k[0].datafield;var h=this._getcolumnindex(d);var g=0;if(!this._clipboardselection){return}for(var l=0;l<this._clipboardselection.length;l++){for(var f=0;f<this._clipboardselection[l].length;f++){var e=this.getcolumnat(h+f);if(!e){continue}var i=this.getcell(j+l,e.datafield);var b=null;b=this._clipboardselection[l][f];if(b!=null){this._raiseEvent(17,{rowindex:j+l,datafield:i.datafield,value:b});this.setcellvalue(i.row,i.column,b,false);this._raiseEvent(18,{rowindex:j+l,datafield:i.datafield,oldvalue:this.getcellvalue(i.rowindex,i.datafield),value:b});this._applycellselection(j+l,i.datafield,true,false)}}}this.dataview.updateview();this._renderrows(this.virtualsizeinfo)}},_applyrowselection:function(e,i,f,h,b){if(e==null){return false}var j=this.selectedrowindex;if(this.selectionmode=="singlerow"){if(i){this._raiseEvent(2,{rowindex:e,row:this.getrowdata(e)})}else{this._raiseEvent(3,{rowindex:e,row:this.getrowdata(e)})}this._raiseEvent(3,{rowindex:j});this.selectedrowindexes=new Array();this.selectedcells=new Array()}if(h==true){this.selectedrowindexes=new Array()}if(this.dataview.filters.length>0){var c=this.getrowdata(e);if(c&&c.dataindex!==undefined){e=c.dataindex}else{if(c&&c.dataindex===undefined){if(c.uid){e=this.getrowboundindexbyid(c.uid)}}}}var d=this.selectedrowindexes.indexOf(e);if(i){this.selectedrowindex=e;if(d==-1){this.selectedrowindexes.push(e);if(this.selectionmode!="singlerow"){this._raiseEvent(2,{rowindex:e,row:this.getrowdata(e)})}}else{if(this.selectionmode=="multiplerows"){this.selectedrowindexes.splice(d,1);this._raiseEvent(3,{rowindex:this.selectedrowindex,row:this.getrowdata(e)});this.selectedrowindex=this.selectedrowindexes.length>0?this.selectedrowindexes[this.selectedrowindexes.length-1]:-1}}}else{if(d>=0||this.selectionmode=="singlerow"||this.selectionmode=="multiplerowsextended"||this.selectionmode=="multiplerowsadvanced"){var g=this.selectedrowindexes[d];this.selectedrowindexes.splice(d,1);this._raiseEvent(3,{rowindex:g,row:this.getrowdata(e)});this.selectedrowindex=-1}}if(f==undefined||f){this._rendervisualrows()}return true},_applycellselection:function(e,b,h,f){if(e==null){return false}if(b==null){return false}var j=this.selectedrowindex;if(this.selectionmode=="singlecell"){var d=this.selectedcell;if(d!=null){this._raiseEvent(16,{rowindex:d.rowindex,datafield:d.datafield})}this.selectedcells=new Array()}if(this.selectionmode=="multiplecellsextended"||this.selectionmode=="multiplecellsadvanced"){var d=this.selectedcell;if(d!=null){this._raiseEvent(16,{rowindex:d.rowindex,datafield:d.datafield})}}var g=e+"_"+b;if(this.dataview.filters.length>0){var c=this.getrowdata(e);if(c&&c.dataindex!==undefined){e=c.dataindex;var g=e+"_"+b}else{if(c&&c.dataindex===undefined){if(c.uid){e=this.getrowboundindexbyid(c.uid);var g=e+"_"+b}}}}var i={rowindex:e,datafield:b};if(h){this.selectedcell=i;if(!this.selectedcells[g]){this.selectedcells[g]=i;this.selectedcells.length++;this._raiseEvent(15,i)}else{if(this.selectionmode=="multiplecells"||this.selectionmode=="multiplecellsextended"||this.selectionmode=="multiplecellsadvanced"){delete this.selectedcells[g];this.selectedcells.length--;this._raiseEvent(16,i)}}}else{delete this.selectedcells[g];this.selectedcells.length--;this._raiseEvent(16,i)}if(f==undefined||f){this._rendervisualrows()}return true},_getcellindex:function(b){var c=-1;a.each(this.selectedcells,function(){c++;if(this[b]){return false}});return c},_clearhoverstyle:function(){if(undefined==this.hoveredrow||this.hoveredrow==-1){return}if(this.vScrollInstance.isScrolling()){return}if(this.hScrollInstance.isScrolling()){return}var b=this.table.find(".jqx-grid-cell-hover");if(b.length>0){b.removeClass(this.toTP("jqx-grid-cell-hover"));b.removeClass(this.toTP("jqx-fill-state-hover"))}this.hoveredrow=-1},_clearselectstyle:function(){var k=this.table[0].rows.length;var p=this.table[0].rows;var l=this.toTP("jqx-grid-cell-selected");var c=this.toTP("jqx-fill-state-pressed");var m=this.toTP("jqx-grid-cell-hover");var h=this.toTP("jqx-fill-state-hover");for(var g=0;g<k;g++){var b=p[g];var f=b.cells.length;var o=b.cells;for(var e=0;e<f;e++){var d=o[e];var n=a(d);if(d.className.indexOf("jqx-grid-cell-selected")!=-1){n.removeClass(l);n.removeClass(c)}if(d.className.indexOf("jqx-grid-cell-hover")!=-1){n.removeClass(m);n.removeClass(h)}}}},_selectpath:function(n,e){var l=this;var i=this._lastClickedCell?Math.min(this._lastClickedCell.row,n):0;var k=this._lastClickedCell?Math.max(this._lastClickedCell.row,n):0;if(i<=k){var h=this._getcolumnindex(this._lastClickedCell.column);var g=this._getcolumnindex(e);var f=Math.min(h,g);var d=Math.max(h,g);this.selectedcells=new Array();var m=this.dataview.loadedrecords;for(var b=i;b<=k;b++){for(var j=f;j<=d;j++){var n=m[b];this._applycellselection(l.getboundindex(n),l._getcolumnat(j).datafield,true,false)}}this._rendervisualrows()}},_selectrowpath:function(f){if(this.selectionmode=="multiplerowsextended"){var c=this;var b=this._lastClickedCell?Math.min(this._lastClickedCell.row,f):0;var g=this._lastClickedCell?Math.max(this._lastClickedCell.row,f):0;var e=this.dataview.loadedrecords;if(b<=g){this.selectedrowindexes=new Array();for(var d=b;d<=g;d++){var f=e[d];this._applyrowselection(d,true,false)}this._rendervisualrows()}}},_selectrowwithmouse:function(p,b,c,f,d,s){var j=b.row;if(j==undefined){return}var k=b.index;if(this.hittestinfo[k]==undefined){return}var t=this.hittestinfo[k].visualrow;if(this.hittestinfo[k].details){return}var m=t.cells[0].className;if(j.group){return}if(this.selectionmode=="multiplerows"||this.selectionmode=="multiplecells"||this.selectionmode=="checkbox"||(this.selectionmode.indexOf("multiple")!=-1&&(s==true||d==true))){var l=this.getboundindex(j);if(this.dataview.filters.length>0){var v=this.getrowdata(l);if(v){l=v.dataindex}}var q=c.indexOf(l)!=-1;var w=this.getboundindex(j)+"_"+f;if(this.selectionmode.indexOf("cell")!=-1){var h=this.selectedcells[w]!=undefined;if(this.selectedcells[w]!=undefined&&h){this._selectcellwithstyle(p,false,k,f,t)}else{this._selectcellwithstyle(p,true,k,f,t)}if(s&&this._lastClickedCell==undefined){var g=this.getselectedcells();if(g&&g.length>0){this._lastClickedCell={row:g[0].rowindex,column:g[0].datafield}}}if(s&&this._lastClickedCell){this._selectpath(j.visibleindex,f);this.mousecaptured=false;if(this.selectionarea.css("visibility")=="visible"){this.selectionarea.css("visibility","hidden")}}}else{if(q){if(d){this._applyrowselection(this.getboundindex(j),false)}else{this._selectrowwithstyle(p,t,false,f)}}else{this._selectrowwithstyle(p,t,true,f)}if(s&&this._lastClickedCell==undefined){var i=this.getselectedrowindexes();if(i&&i.length>0){this._lastClickedCell={row:i[0],column:f}}}if(s&&this._lastClickedCell){this.selectedrowindexes=new Array();var e=this._lastClickedCell?Math.min(this._lastClickedCell.row,j.visibleindex):0;var u=this._lastClickedCell?Math.max(this._lastClickedCell.row,j.visibleindex):0;var n=this.dataview.loadedrecords;for(var o=e;o<=u;o++){var j=n[o];this._applyrowselection(this.getboundindex(j),true,false,false)}this._rendervisualrows()}}}else{this._clearselectstyle();this._selectrowwithstyle(p,t,true,f);if(this.selectionmode.indexOf("cell")!=-1){this._selectcellwithstyle(p,true,k,f,t)}}if(!s){this._lastClickedCell={row:j.visibleindex,column:f}}},_selectcellwithstyle:function(d,c,g,f,e){var b=a(e.cells[d._getcolumnindex(f)]);b.removeClass(this.toTP("jqx-grid-cell-hover"));b.removeClass(this.toTP("jqx-fill-state-hover"));if(c){b.addClass(this.toTP("jqx-grid-cell-selected"));b.addClass(this.toTP("jqx-fill-state-pressed"))}else{b.removeClass(this.toTP("jqx-grid-cell-selected"));b.removeClass(this.toTP("jqx-fill-state-pressed"))}},_selectrowwithstyle:function(e,h,b,j){var c=h.cells.length;var f=0;if(e.rowdetails&&e.showrowdetailscolumn){if(!this.rtl){f=1+this.groups.length}else{c-=1;c-=this.groups.length}}else{if(this.groupable){if(!this.rtl){f=this.groups.length}else{c-=this.groups.length}}}for(var g=f;g<c;g++){var d=h.cells[g];if(b){a(d).removeClass(this.toTP("jqx-grid-cell-hover"));a(d).removeClass(this.toTP("jqx-fill-state-hover"));if(e.selectionmode.indexOf("cell")==-1){a(d).addClass(this.toTP("jqx-grid-cell-selected"));a(d).addClass(this.toTP("jqx-fill-state-pressed"))}}else{a(d).removeClass(this.toTP("jqx-grid-cell-hover"));a(d).removeClass(this.toTP("jqx-grid-cell-selected"));a(d).removeClass(this.toTP("jqx-fill-state-hover"));a(d).removeClass(this.toTP("jqx-fill-state-pressed"))}}},_handlemousemoveselection:function(ab,o){if((o.selectionmode=="multiplerowsextended"||o.selectionmode=="multiplecellsextended"||o.selectionmode=="multiplecellsadvanced")&&o.mousecaptured){if(o.multipleselectionbegins){var b=o.multipleselectionbegins(ab);if(b===false){return true}}var aa=this.showheader?this.columnsheader.height()+2:0;var I=this._groupsheader()?this.groupsheader.height():0;var K=this.showtoolbar?this.toolbarheight:0;I+=K;var Z=this.host.coord();if(this.hasTransform){Z=a.jqx.utilities.getOffset(this.host);var ad=this._getBodyOffset();Z.left-=ad.left;Z.top-=ad.top}var M=ab.pageX;var L=ab.pageY-I;if(Math.abs(this.mousecaptureposition.left-M)>3||Math.abs(this.mousecaptureposition.top-L)>3){var f=parseInt(this.columnsheader.coord().top);if(this.hasTransform){f=a.jqx.utilities.getOffset(this.columnsheader).top}if(M<Z.left){M=Z.left}if(M>Z.left+this.host.width()){M=Z.left+this.host.width()}var X=Z.top+aa;if(L<X){L=X+5}var J=parseInt(Math.min(o.mousecaptureposition.left,M));var g=-5+parseInt(Math.min(o.mousecaptureposition.top,L));var H=parseInt(Math.abs(o.mousecaptureposition.left-M));var P=parseInt(Math.abs(o.mousecaptureposition.top-L));J-=Z.left;g-=Z.top;this.selectionarea.css("visibility","visible");if(o.selectionmode=="multiplecellsadvanced"){var M=J;var t=M+H;var G=M;var n=o.hScrollInstance;var v=n.value;if(this.rtl){if(this.hScrollBar.css("visibility")!="hidden"){v=n.max-n.value}if(this.vScrollBar[0].style.visibility!="hidden"){}}var h=o.table[0].rows[0];var T=0;var B=o.mousecaptureposition.clickedcell;var A=B;var m=false;var r=0;var ac=h.cells.length;if(o.mousecaptureposition.left<=ab.pageX){r=B}for(var W=r;W<ac;W++){var Y=parseInt(a(this.columnsrow[0].cells[W]).css("left"));var j=Y-v;if(o.columns.records[W].pinned){j=Y;continue}var O=this._getcolumnat(W);if(O!=null&&O.hidden){continue}if(o.groupable&&o.groups.length>0){if(W<o.groups.length){continue}}var S=j+a(this.columnsrow[0].cells[W]).width();if(o.mousecaptureposition.left>ab.pageX){if(S>=M&&M>=j){A=W;m=true;break}}else{if(S>=t&&t>=j){A=W;m=true;break}}}if(!m){if(o.mousecaptureposition.left>ab.pageX){a.each(this.columns.records,function(i,k){if(o.groupable&&o.groups.length>0){if(i<o.groups.length){return true}}if(!this.pinned&&!this.hidden){A=i;return false}})}else{if(!o.groupable||(o.groupable&&!o.groups.length>0)){A=h.cells.length-1}}}var N=B;B=Math.min(B,A);A=Math.max(N,A);g+=5;g+=I;var R=o.table[0].rows.indexOf(o.mousecaptureposition.clickedrow);var w=0;var e=-1;var u=-1;var d=0;for(var W=0;W<o.table[0].rows.length;W++){var s=a(o.table[0].rows[W]);if(W==0){d=s.coord().top}var F=s.height();var z=d-Z.top;if(e==-1&&z+F>=g){var c=false;for(var Q=0;Q<o.groups.length;Q++){var V=s[0].cells[Q].className;if(V.indexOf("jqx-grid-group-collapse")!=-1||V.indexOf("jqx-grid-group-expand")!=-1){c=true;break}}if(c){continue}e=W}d+=F;if(o.groupable&&o.groups.length>0){var c=false;for(var Q=0;Q<o.groups.length;Q++){var V=s[0].cells[Q].className;if(V.indexOf("jqx-grid-group-collapse")!=-1||V.indexOf("jqx-grid-group-expand")!=-1){c=true;break}}if(c){continue}var T=0;for(var U=o.groups.length;U<s[0].cells.length;U++){var E=s[0].cells[U];if(a(E).html()==""){T++}}if(T==s[0].cells.length-o.groups.length){continue}}if(e!=-1){w+=F}if(z+F>g+P){u=W;break}}if(e!=-1){g=a(o.table[0].rows[e]).coord().top-Z.top-I-2;var D=0;if(this.filterable&&this.showfilterrow){D=this.filterrowheight}if(parseInt(o.table[0].style.top)<0&&g<this.rowsheight+D){g-=parseInt(o.table[0].style.top);w+=parseInt(o.table[0].style.top)}P=w;var l=a(this.columnsrow[0].cells[B]);var C=a(this.columnsrow[0].cells[A]);J=parseInt(l.css("left"));H=parseInt(C.css("left"))-parseInt(J)+C.width()-2;J-=v;if(o.editcell&&o.editable&&o.endcelledit&&(B!=A||e!=u)){if(o.editcell.validated==false){return}o.endcelledit(o.editcell.row,o.editcell.column,true,true)}}}this.selectionarea.width(H);this.selectionarea.height(P);this.selectionarea.css("left",J);this.selectionarea.css("top",g)}}},_handlemouseupselection:function(u,o){if(!this.selectionarea){return}if(this.selectionarea.css("visibility")!="visible"){o.mousecaptured=false;return true}if(o.mousecaptured&&(o.selectionmode=="multiplerowsextended"||o.selectionmode=="multiplerowsadvanced"||o.selectionmode=="multiplecellsextended"||o.selectionmode=="multiplecellsadvanced")){o.mousecaptured=false;if(this.selectionarea.css("visibility")=="visible"){this.selectionarea.css("visibility","hidden");var w=this.showheader?this.columnsheader.height()+2:0;var p=this._groupsheader()?this.groupsheader.height():0;var B=this.showtoolbar?this.toolbarheight:0;p+=B;var C=this.selectionarea.coord();var c=this.host.coord();if(this.hasTransform){c=a.jqx.utilities.getOffset(this.host);C=a.jqx.utilities.getOffset(this.selectionarea)}var n=C.left-c.left;var k=C.top-w-c.top-p;var s=k;var g=n+this.selectionarea.width();var D=n;var l=new Array();var e=new Array();if(o.selectionmode=="multiplerowsextended"){while(k<s+this.selectionarea.height()){var b=this._hittestrow(n,k);var f=b.row;var h=b.index;if(h!=-1){if(!e[h]){e[h]=true;l[l.length]=b}}k+=20}var s=0;a.each(l,function(){var i=this;var m=this.row;if(o.selectionmode!="none"&&o._selectrowwithmouse){if(u.ctrlKey){o._applyrowselection(o.getboundindex(m),true,false,false)}else{if(s==0){o._applyrowselection(o.getboundindex(m),true,false,true)}else{o._applyrowselection(o.getboundindex(m),true,false,false)}}s++}})}else{if(o.selectionmode=="multiplecellsadvanced"){k+=2}var r=o.hScrollInstance;var t=r.value;if(this.rtl){if(this.hScrollBar.css("visibility")!="hidden"){t=r.max-r.value}if(this.vScrollBar[0].style.visibility!="hidden"){t-=this.scrollbarsize+4}}var q=o.table[0].rows[0];var j=o.selectionarea.height();if(!u.ctrlKey&&j>0){o.selectedcells=new Array()}var A=j;while(k<s+A){var b=o._hittestrow(n,k);var f=b.row;var h=b.index;if(h!=-1){if(!e[h]){e[h]=true;for(var v=0;v<q.cells.length;v++){var d=parseInt(a(o.columnsrow[0].cells[v]).css("left"))-t;var z=d+a(o.columnsrow[0].cells[v]).width();if((D>=d&&D<=z)||(g>=d&&g<=z)||(d>=D&&d<=g)){o._applycellselection(o.getboundindex(f),o._getcolumnat(v).datafield,true,false)}}}}k+=5}}if(o.autosavestate){if(o.savestate){o.savestate()}}o._renderrows(o.virtualsizeinfo)}}},selectprevcell:function(e,c){var f=this._getcolumnindex(c);var b=this.columns.records.length;var d=this._getprevvisiblecolumn(f);if(d!=null){this.clearselection();this.selectcell(e,d.datafield)}},selectnextcell:function(e,d){var f=this._getcolumnindex(d);var c=this.columns.records.length;var b=this._getnextvisiblecolumn(f);if(b!=null){this.clearselection();this.selectcell(e,b.datafield)}},_getfirstvisiblecolumn:function(){var b=this;var e=this.columns.records.length;for(var c=0;c<e;c++){var d=this.columns.records[c];if(!d.hidden&&d.datafield!=null){return d}}return null},_getlastvisiblecolumn:function(){var b=this;var e=this.columns.records.length;for(var c=e-1;c>=0;c--){var d=this.columns.records[c];if(!d.hidden&&d.datafield!=null){return d}}return null},_handlekeydown:function(v,o){if(o.groupable){return true}var A=v.charCode?v.charCode:v.keyCode?v.keyCode:0;if(o.editcell&&o.selectionmode!="multiplecellsadvanced"){return true}else{if(o.editcell&&o.selectionmode=="multiplecellsadvanced"){if(A>=33&&A<=40){if(!v.altKey){if(o._cancelkeydown==undefined||o._cancelkeydown==false){if(o.editmode!=="selectedrow"){o.endcelledit(o.editcell.row,o.editcell.column,false,true);o._cancelkeydown=false;if(o.editcell&&!o.editcell.validated){o._rendervisualrows();o.endcelledit(o.editcell.row,o.editcell.column,false,true);return false}}else{return true}}else{o._cancelkeydown=false;return true}}else{o._cancelkeydown=false;return true}}else{return true}}}if(o.selectionmode=="none"){return true}if(o.showfilterrow&&o.filterable){if(this.filterrow){if(a(v.target).ischildof(this.filterrow)){return true}}}if(o.pageable){if(a(v.target).ischildof(this.pager)){return true}}if(this.showtoolbar){if(a(v.target).ischildof(this.toolbar)){return true}}if(this.showstatusbar){if(a(v.target).ischildof(this.statusbar)){return true}}var n=false;if(v.altKey){return true}if(v.ctrlKey){if(this.clipboard){var b=String.fromCharCode(A).toLowerCase();if(b=="c"||b=="x"){var m=this.copyselection();if(window.clipboardData){window.clipboardData.setData("Text",m)}}else{if(b=="v"){this.pasteselection()}}if(b=="x"){this.deleteselection()}}}var j=Math.round(o._gettableheight());var t=Math.round(j/o.rowsheight);var f=o.getdatainformation();switch(o.selectionmode){case"singlecell":case"multiplecells":case"multiplecellsextended":case"multiplecellsadvanced":var B=o.getselectedcell();if(B!=null){var e=this.getrowvisibleindex(B.rowindex);var h=e;var l=B.datafield;var q=o._getcolumnindex(l);var c=o.columns.records.length;var r=function(F,D,E){var C=function(J,G){var I=o.dataview.loadedrecords[J];if(I!=undefined&&G!=null){if(E||E==undefined){o.clearselection()}var H=o.getboundindex(I);o.selectcell(H,G);o._oldselectedcell=o.selectedcell;n=true;o.ensurecellvisible(J,G);return true}return false};if(!C(F,D)){o.ensurecellvisible(F,D);C(F,D);if(o.virtualmode){o.host.focus()}}if(v.shiftKey&&A!=9){if(o.selectionmode=="multiplecellsextended"||o.selectionmode=="multiplecellsadvanced"){if(o._lastClickedCell){o._selectpath(F,D);o.selectedcell={rowindex:F,datafield:D};return}}}else{if(!v.shiftKey){o._lastClickedCell={row:F,column:D}}}};var w=v.shiftKey&&o.selectionmode!="singlecell"&&o.selectionmode!="multiplecells";var x=function(){r(0,l,!w)};var g=function(){var C=f.rowscount-1;r(C,l,!w)};var d=A==9&&!v.shiftKey;var i=A==9&&v.shiftKey;if(d||i){w=false}var k=v.ctrlKey;if(k&&A==37){var z=o._getfirstvisiblecolumn(q);if(z!=null){r(h,z.datafield)}}else{if(k&&A==39){var p=o._getlastvisiblecolumn(q);if(p!=null){r(h,p.datafield)}}else{if(A==39||d){var s=o._getnextvisiblecolumn(q);if(s!=null){r(h,s.datafield,!w)}else{if(!d){n=true}}}else{if(A==37||i){var z=o._getprevvisiblecolumn(q);if(z!=null){r(h,z.datafield,!w)}else{if(!i){n=true}}}else{if(A==36){x()}else{if(A==35){g()}else{if(A==33){if(h-t>=0){var y=h-t;r(y,l,!w)}else{x()}}else{if(A==34){if(f.rowscount>h+t){var y=h+t;r(y,l,!w)}else{g()}}else{if(A==38){if(k){x()}else{if(h>0){r(h-1,l,!w)}else{n=true}}}else{if(A==40){if(k){g()}else{if(f.rowscount>h+1){r(h+1,l,!w)}else{n=true}}}}}}}}}}}}}break;case"singlerow":case"multiplerows":case"multiplerowsextended":case"multiplerowsadvanced":var h=o.getselectedrowindex();if(h==null||h==-1){return true}h=this.getrowvisibleindex(h);var u=function(D,E){var C=function(H){var J=o.dataview.loadedrecords[H];if(J!=undefined){var I=o.getboundindex(J);var G=o.selectedrowindex;if(E||E==undefined){o.clearselection()}o.selectedrowindex=G;o.selectrow(I,false);var F=o.ensurerowvisible(H);if(!F||o.autoheight||o.groupable){o._rendervisualrows()}n=true;return true}return false};if(!C(D)){o.ensurerowvisible(D);C(D,E);if(o.virtualmode){o.host.focus()}}if(v.shiftKey&&A!=9){if(o.selectionmode=="multiplerowsextended"){if(o._lastClickedCell){o._selectrowpath(D);o.selectedrowindex=D;return}}}else{if(!v.shiftKey){o._lastClickedCell={row:D}}}};var w=v.shiftKey&&o.selectionmode!="singlerow"&&o.selectionmode!="multiplerows";var x=function(){u(0,!w)};var g=function(){var C=f.rowscount-1;u(C,!w)};var k=v.ctrlKey;if(A==36||(k&&A==38)){x()}else{if(A==35||(k&&A==40)){g()}else{if(A==33){if(h-t>=0){var y=h-t;u(y,!w)}else{x()}}else{if(A==34){if(f.rowscount>h+t){var y=h+t;u(y,!w)}else{g()}}else{if(A==38){if(h>0){u(h-1,!w)}else{n=true}}else{if(A==40){if(f.rowscount>h+1){u(h+1,!w)}else{n=true}}}}}}}break}if(n){if(o.autosavestate){if(o.savestate){o.savestate()}}return false}return true},_handlemousemove:function(u,p){if(p.vScrollInstance.isScrolling()){return}if(p.hScrollInstance.isScrolling()){return}var w;var q;var f;var n;var m;if(p.enablehover||p.selectionmode=="multiplerows"){w=this.showheader?this.columnsheader.height()+2:0;q=this._groupsheader()?this.groupsheader.height():0;var A=this.showtoolbar?this.toolbarheight:0;q+=A;f=this.host.coord();if(this.hasTransform){f=a.jqx.utilities.getOffset(this.host);var k=this._getBodyOffset();f.left-=k.left;f.top-=k.top}n=u.pageX-f.left;m=u.pageY-w-f.top-q}if(p.selectionmode=="multiplerowsextended"||p.selectionmode=="multiplecellsextended"||p.selectionmode=="multiplecellsadvanced"){if(p.mousecaptured==true){return}}if(p.enablehover){if(p.disabled){return}if(this.vScrollInstance.isScrolling()||this.hScrollInstance.isScrolling()){return}var c=this._hittestrow(n,m);if(!c){return}var h=c.row;var j=c.index;if(this.hoveredrow!=-1&&j!=-1&&this.hoveredrow==j&&this.selectionmode.indexOf("cell")==-1&&this.selectionmode!="checkbox"){return}this._clearhoverstyle();if(j==-1||h==undefined){return}var r=this.hittestinfo[j].visualrow;if(r==null){return}if(this.hittestinfo[j].details){return}if(u.clientX>a(r).width()+a(r).coord().left){return}var B=0;var o=r.cells.length;if(p.rowdetails&&p.showrowdetailscolumn){if(!this.rtl){B=1+this.groups.length}else{o-=1;o-=this.groups.length}}else{if(this.groupable){if(!this.rtl){B=this.groups.length}else{o-=this.groups.length}}}if(r.cells.length==0){return}var l=r.cells[B].className;if(h.group||(this.selectionmode.indexOf("row")>=0&&l.indexOf("jqx-grid-cell-selected")!=-1)){return}this.hoveredrow=j;if(this.selectionmode.indexOf("cell")!=-1||this.selectionmode=="checkbox"){var e=-1;var s=this.hScrollInstance;var t=s.value;if(this.rtl){if(this.hScrollBar.css("visibility")!="hidden"){t=s.max-s.value}}for(var v=B;v<o;v++){var g=parseInt(a(this.columnsrow[0].cells[v]).css("left"))-t;var z=g+a(this.columnsrow[0].cells[v]).width();if(z>=n&&n>=g){e=v;break}}if(e!=-1){var b=r.cells[e];if(b.className.indexOf("jqx-grid-cell-selected")==-1){if(this.editcell){var d=this._getcolumnat(e);if(d){if(this.editcell.row==j&&this.editcell.column==d.datafield){return}}}a(b).addClass(this.toTP("jqx-grid-cell-hover"));a(b).addClass(this.toTP("jqx-fill-state-hover"))}}return}for(var v=B;v<o;v++){var b=r.cells[v];a(b).addClass(this.toTP("jqx-grid-cell-hover"));a(b).addClass(this.toTP("jqx-fill-state-hover"))}}else{return true}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.extend(a.jqx._jqxGrid.prototype,{autoresizecolumns:function(z,g){if(z!="cells"&&z!="all"&&z!="column"){z="all"}var A=this.that;var n=this.getrows();if(this.pageable){n=this.dataview.rows;if(this.groupable){n=this.dataview.records}}if(g==undefined){g=0}else{g=parseInt(g)}var e=n.length;if(e==undefined&&n!=undefined){var t=new Array();a.each(n,function(i){t.push(this)});n=t;e=n.length}var w=a("<span></span>");w.addClass(this.toThemeProperty("jqx-widget"));w.addClass(this.toThemeProperty("jqx-grid-cell"));a(document.body).append(w);var c=[];var f=[];var b=[];var q=[];var o=A.host.width();if(A.vScrollBar[0].style.visibility!="hidden"){o-=this.scrollbarsize+5}if(o<0){o=0}for(var x=0;x<e;x++){var k=n[x];for(var v=0;v<this.columns.records.length;v++){var d=this.columns.records[v];if(d.hidden){continue}if(f[d.displayfield]==undefined){f[d.displayfield]=0}if(b[d.displayfield]==undefined){b[d.displayfield]=""}var r=k[d.displayfield];if(d.cellsformat!=""){if(a.jqx.dataFormat){if(a.jqx.dataFormat.isDate(r)){r=a.jqx.dataFormat.formatdate(r,d.cellsformat,this.gridlocalization)}else{if(a.jqx.dataFormat.isNumber(r)){r=a.jqx.dataFormat.formatnumber(r,d.cellsformat,this.gridlocalization)}}}}else{if(d.cellsrenderer){var s=A._defaultcellsrenderer(r,d);var p=d.cellsrenderer(x,d.datafield,r,s,d.getcolumnproperties(),k);if(p!=undefined){r=a(p).text()}}}if(z==undefined||z=="cells"||z=="all"){if(r!=null){var c=r.toString().length;var u=r.toString();var B=u.replace(/[^A-Z]/g,"").length;if(c>f[d.displayfield]){f[d.displayfield]=c;b[d.displayfield]=r;q[d.displayfield]=B}if(c>0&&c>=B){var m=B*20+(c-B)*15;var l=q[d.displayfield]*20+(f[d.displayfield]-q[d.displayfield])*15;if(m>l&&m>0&&l>0){f[d.displayfield]=c;b[d.displayfield]=r;q[d.displayfield]=B}}}}if(z=="column"||z=="all"){if(d.text.toString().length>f[d.displayfield]){b[d.displayfield]=d.text;f[d.displayfield]=d.text.length;var u=d.text.toString();var B=u.replace(/[^A-Z]/g,"").length;q[d.displayfield]=B}var r=d.text;var c=r.toString().length;var u=r.toString();var B=u.replace(/[^A-Z]/g,"").length;if(c>0&&c>=B){var m=B*20+(c-B)*15;var l=q[d.displayfield]*20+(f[d.displayfield]-q[d.displayfield])*15;if(m>l&&m>0&&l>0){f[d.displayfield]=c;b[d.displayfield]=r;q[d.displayfield]=B}}}}}if(!this.columns.records){return}for(var v=0;v<this.columns.records.length;v++){var d=this.columns.records[v];if(b[d.displayfield]==undefined){b[d.displayfield]=d.text}w[0].innerHTML=b[d.displayfield].toString();var y=w.outerWidth()+10;if(w.children().length>0){y=w.children().outerWidth()+10}if(a.jqx.browser.msie&&a.jqx.browser.version<8){y+=10}if(this.filterable&&this.showfilterrow){y+=5}y+=g;if(y>d.maxwidth){y=d.maxwidth}if(d._width!=undefined){d.__width=d._width}d._width=null;if(d.maxwidth=="auto"||y<=d.maxwidth){var h=d.width;if(y<d.minwidth){y=d.minwidth}d.width=y;if(d._percentagewidth!=undefined){d._percentagewidth=null}this._raiseEvent(14,{columntext:d.text,column:d.getcolumnproperties(),datafield:d.datafield,displayfield:d.displayfield,oldwidth:h,newwidth:y})}}w.remove();this._updatecolumnwidths();this._updatecellwidths();this._renderrows(this.virtualsizeinfo);for(var v=0;v<this.columns.records.length;v++){var d=this.columns.records[v];if(d.__width!=undefined){d._width=d.__width}}},autoresizecolumn:function(p,v,g){if(v!="cells"&&v!="all"&&v!="column"){v="all"}if(p==undefined){return false}var l=this.getrows();if(this.pageable){l=this.dataview.rows;if(this.groupable){l=this.dataview.records}}var d=this.getcolumn(p);if(d==undefined){return false}if(g==undefined){g=0}else{g=parseInt(g)}var e=l.length;var s=a("<span></span>");s.addClass(this.toThemeProperty("jqx-widget"));s.addClass(this.toThemeProperty("jqx-grid-cell"));a(document.body).append(s);var f=0;var b="";var o=0;var w=this.that;var m=w.host.width();if(w.vScrollBar[0].style.visibility!="hidden"){m-=this.scrollbarsize+5}if(m<0){m=0}if(v==undefined||v=="cells"||v=="all"){for(var t=0;t<e;t++){var q=l[t][d.displayfield];if(d.cellsformat!=""){if(a.jqx.dataFormat){if(a.jqx.dataFormat.isDate(q)){q=a.jqx.dataFormat.formatdate(q,d.cellsformat,this.gridlocalization)}else{if(a.jqx.dataFormat.isNumber(q)){q=a.jqx.dataFormat.formatnumber(q,d.cellsformat,this.gridlocalization)}}}}else{if(d.cellsrenderer){var n=d.cellsrenderer(t,d,q);if(n!=undefined){q=a(n).text()}}}if(q!=null){var c=q.toString().length;var r=q.toString();var x=r.replace(/[^A-Z]/g,"").length;if(c>f){f=c;b=q;o=x}if(c>0&&c>=x){var k=x*20+(c-x)*15;var j=o*20+(f-o)*15;if(k>j&&k>0&&j>0){f=c;b=q;o=x}}}}}if(v=="column"||v=="all"){if(d.text.toString().length>f){b=d.text}var q=d.text.toString();var c=q.toString().length;var r=q.toString();var x=r.replace(/[^A-Z]/g,"").length;if(c>0&&c>=x){var k=x*20+(c-x)*15;var j=o*20+(f-o)*15;if(k>j&&k>0&&j>0){f=c;b=q;o=x}}}if(b==undefined){b=d.text}s[0].innerHTML=b;var u=s.outerWidth()+10;if(a.jqx.browser.msie&&a.jqx.browser.version<8){u+=5}if(this.filterable&&this.showfilterrow){u+=5}u+=g;s.remove();if(u>d.maxwidth){u=d.maxwidth}if(d.maxwidth=="auto"||u<=d.maxwidth){var h=d.width;if(u<d.minwidth){u=d.minwidth}d.width=u;if(d._width!=undefined){d.__width=d._width}d._width=null;if(d._percentagewidth!=undefined){d._percentagewidth=null}this._updatecolumnwidths();this._updatecellwidths();this._raiseEvent(14,{columntext:d.text,column:d.getcolumnproperties(),datafield:p,displayfield:d.displayfield,oldwidth:h,newwidth:u});this._renderrows(this.virtualsizeinfo);if(d._width!=undefined){d._width=d.__width}}},_handlecolumnsresize:function(){var j=this.that;if(this.columnsresize){var i=false;if(j.isTouchDevice()&&j.touchmode!==true){i=true}var f="mousemove.resize"+this.element.id;var c="mousedown.resize"+this.element.id;var d="mouseup.resize"+this.element.id;if(i){var f=a.jqx.mobile.getTouchEventName("touchmove")+".resize"+this.element.id;var c=a.jqx.mobile.getTouchEventName("touchstart")+".resize"+this.element.id;var d=a.jqx.mobile.getTouchEventName("touchend")+".resize"+this.element.id}this.removeHandler(a(document),f);this.addHandler(a(document),f,function(m){var n=a.data(document.body,"contextmenu"+j.element.id);if(n!=null&&j.autoshowcolumnsmenubutton){return true}if(j.resizablecolumn!=null&&!j.disabled&&j.resizing){if(j.resizeline!=null){var s=j.resizablecolumn.columnelement;var p=j.host.coord();var v=parseInt(j.resizestartline.coord().left);var k=v-j._startcolumnwidth;var w=j.resizablecolumn.column.minwidth;if(w=="auto"){w=0}else{w=parseInt(w)}var l=j.resizablecolumn.column.maxwidth;if(l=="auto"){l=0}else{l=parseInt(l)}var q=m.pageX;if(i){var t=j.getTouches(m);var r=t[0];q=r.pageX}k+=w;var u=l>0?v+l:0;var o=l==0?true:j._startcolumnwidth+q-v<l?true:false;if(j.rtl){var o=true}if(o){if(!j.rtl){if(q>=p.left&&q>=k&&q<=p.left+j.host.width()){if(u!=0&&m.pageX<u){j.resizeline.css("left",q)}else{if(u==0){j.resizeline.css("left",q)}}if(i){return false}}}else{if(q>=p.left&&q<=p.left+j.host.width()){j.resizeline.css("left",q);if(i){return false}}}}}}if(!i&&j.resizablecolumn!=null){return false}});this.removeHandler(a(document),c);this.addHandler(a(document),c,function(m){var l=a.data(document.body,"contextmenu"+j.element.id);if(l!=null&&j.autoshowcolumnsmenubutton){return true}if(j.resizablecolumn!=null&&!j.disabled){var k=j.resizablecolumn.columnelement;if(k.coord().top+k.height()+5<m.pageY){j.resizablecolumn=null;return}if(k.coord().top-5>m.pageY){j.resizablecolumn=null;return}j._startcolumnwidth=j.resizablecolumn.column.width;j.resizablecolumn.column._width=null;a(document.body).addClass("jqx-disableselect");a(document.body).addClass("jqx-position-reset");j._mouseDownResize=new Date();j.resizing=true;j._resizecolumn=j.resizablecolumn.column;j.resizeline=j.resizeline||a('<div style="position: absolute;"></div>');j.resizestartline=j.resizestartline||a('<div style="position: absolute;"></div>');j.resizebackground=j.resizebackground||a('<div style="position: absolute; left: 0; top: 0; background: #000;"></div>');j.resizebackground.css("opacity",0.01);j.resizebackground.css("cursor","col-resize");j.resizeline.css("cursor","col-resize");j.resizestartline.css("cursor","col-resize");j.resizeline.addClass(j.toThemeProperty("jqx-grid-column-resizeline"));j.resizestartline.addClass(j.toThemeProperty("jqx-grid-column-resizestartline"));a(document.body).append(j.resizeline);a(document.body).append(j.resizestartline);a(document.body).append(j.resizebackground);var n=j.resizablecolumn.columnelement.coord();j.resizebackground.css("left",j.host.coord().left);j.resizebackground.css("top",j.host.coord().top);j.resizebackground.width(j.host.width());j.resizebackground.height(j.host.height());j.resizebackground.css("z-index",9999);var o=function(q){if(!j.rtl){q.css("left",parseInt(n.left)+j._startcolumnwidth)}else{q.css("left",parseInt(n.left))}var t=j._groupsheader();var s=t?j.groupsheader.height():0;var v=j.showtoolbar?j.toolbarheight:0;s+=v;var p=j.showstatusbar?j.statusbarheight:0;s+=p;var r=0;if(j.pageable){r=j.pagerheight}var u=j.hScrollBar.css("visibility")=="visible"?17:0;q.css("top",parseInt(n.top));q.css("z-index",99999);if(j.columngroups){q.height(j.host.height()+j.resizablecolumn.columnelement.height()-r-s-u-j.columngroupslevel*j.columnsheight)}else{q.height(j.host.height()-r-s-u)}if(j.enableanimations){q.show("fast")}else{q.show()}};o(j.resizeline);o(j.resizestartline);j.dragmousedown=null}});var e=function(){a(document.body).removeClass("jqx-disableselect");a(document.body).removeClass("jqx-position-reset");if(!j.resizing){return}j._mouseUpResize=new Date();var r=j._mouseUpResize-j._mouseDownResize;if(r<200){j.resizing=false;if(j._resizecolumn!=null&&j.resizeline!=null&&j.resizeline.css("display")=="block"){j._resizecolumn=null;j.resizeline.hide();j.resizestartline.hide();j.resizebackground.remove()}return}j.resizing=false;if(j.disabled){return}var p=j.host.width();if(j.vScrollBar[0].style.visibility!="hidden"){p-=20}if(p<0){p=0}if(j._resizecolumn!=null&&j.resizeline!=null&&j.resizeline.css("display")=="block"){var s=parseInt(j.resizeline.css("left"));var o=parseInt(j.resizestartline.css("left"));var l=j._startcolumnwidth+s-o;if(j.rtl){var l=j._startcolumnwidth-s+o}var q=j._resizecolumn.width;j._closemenu();j._resizecolumn.width=l;if(j._resizecolumn._percentagewidth!=undefined){j._resizecolumn._percentagewidth=(l/p)*100}for(var k=0;k<j._columns.length;k++){if(j._columns[k].datafield===j._resizecolumn.datafield){j._columns[k].width=j._resizecolumn.width;break}}var n=j.hScrollBar[0].style.visibility;j._updatecolumnwidths();j._updatecellwidths();j._raiseEvent(14,{columntext:j._resizecolumn.text,column:j._resizecolumn.getcolumnproperties(),datafield:j._resizecolumn.datafield,oldwidth:q,newwidth:l});j._renderrows(j.virtualsizeinfo);if(j.autosavestate){if(j.savestate){j.savestate()}}if(n!=j.hScrollBar[0].style.visibility){j.hScrollInstance.setPosition(0)}if(j.rtl){j._arrange()}j._resizecolumn=null;j.resizeline.hide();j.resizestartline.hide();j.resizebackground.remove();j.resizablecolumn=null}else{j.resizablecolumn=null}};try{if(document.referrer!=""||window.frameElement){var b=null;if(window.top!=null&&window.top!=window.self){if(window.parent&&document.referrer){b=document.referrer}}if(b&&b.indexOf(document.location.host)!=-1){var g=function(k){e()};if(window.top.document.addEventListener){window.top.document.addEventListener("mouseup",g,false)}else{if(window.top.document.attachEvent){window.top.document.attachEvent("onmouseup",g)}}}}}catch(h){}this.removeHandler(a(document),d);this.addHandler(a(document),d,function(l){var k=a.data(document.body,"contextmenu"+j.element.id);if(k!=null&&j.autoshowcolumnsmenubutton){return true}e()})}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.extend(a.jqx._jqxGrid.prototype,{_updatefilterrowui:function(f){var l=this.columns.records.length;var e=0;for(var h=0;h<l;h++){var g=this.columns.records[h];var c=g.width;if(c<g.minwidth){c=g.minwidth}if(c>g.maxwidth){c=g.maxwidth}var k=a(this.filterrow[0].cells[h]);k.css("left",e);var i=true;if(k.width()==c){i=false}if(f){i=true}k.width(c);k[0].left=e;if(!(g.hidden&&g.hideable)){e+=c}else{k.css("display","none")}if(!i){continue}if(g.createfilterwidget&&g.filtertype=="custom"){g.createfilterwidget(g,k)}else{if(g.filterable){var d=function(m,n){var j=a(n.children()[0]);j.width(c-10)};switch(g.filtertype){case"number":a(k.children()[0]).width(c);k.find("input").width(c-30);break;case"date":if(this.host.jqxDateTimeInput){a(k.children()[0]).jqxDateTimeInput({width:c-10})}else{d(this,k)}break;case"textbox":case"default":d(this,k);break;case"list":case"checkedlist":if(this.host.jqxDropDownList){a(k.children()[0]).jqxDropDownList({width:c-10})}else{d(this,k)}break;case"bool":case"boolean":if(!this.host.jqxCheckBox){d(this,k)}break}}}}var b=a(this.filterrow.children()[0]);b.width(parseInt(e)+2);b.height(this.filterrowheight)},clearfilterrow:function(){this._disablefilterrow=true;var b=this.columns.records.length;var f=0;for(var d=0;d<b;d++){var c=this.columns.records[d];var g=a(this.filterrow[0].cells[d]);if(c.filterable){var e=function(i,j){var h=a(j.children()[0]);h.val("");if(h[0]){i["_oldWriteText"+h[0].id]=""}};switch(c.filtertype){case"number":g.find("input").val("");break;case"date":if(this.host.jqxDateTimeInput){a(g.children()[0]).jqxDateTimeInput("setDate",null)}else{e(this,g)}break;case"textbox":case"default":e(this,g);break;case"list":if(this.host.jqxDropDownList){a(g.children()[0]).jqxDropDownList("clearSelection")}else{e(this,g)}break;case"checkedlist":if(this.host.jqxDropDownList){a(g.children()[0]).jqxDropDownList("checkAll",false)}else{e(this,g)}break;case"bool":case"boolean":if(!this.host.jqxCheckBox){e(this,g)}else{a(g.children()[0]).jqxCheckBox({checked:null})}break}}}this._disablefilterrow=false},_applyfilterfromfilterrow:function(){if(this._disablefilterrow==true){return}var z=this.columns.records.length;var C=this.that;for(var t=0;t<z;t++){var k=new a.jqx.filter();var u=this.columns.records[t];if(!u.filterable){continue}if(u.datafield===null){continue}var f=C._getcolumntypebydatafield(u);var d=C._getfiltertype(f);var l=1;var D=true;var e=u.filtertype;var A=function(j,K,H){var i=true;if(j._filterwidget){var F=j._filterwidget.val();if(F!=""){var I="equal";if(K=="stringfilter"){var I="contains"}if(K=="numericfilter"){if(C.gridlocalization.decimalseparator==","){if(F.indexOf(C.gridlocalization.decimalseparator)>=0){F=F.replace(C.gridlocalization.decimalseparator,".")}}}if(K!="stringfilter"){var J=0;if(F.indexOf(">")!=-1){I="greater_than";J=1}if(F.indexOf("<")!=-1){I="less_than";J=1}if(F.indexOf("=")!=-1){if(I=="greater_than"){I="greater_than_or_equal";J=2}else{if(I=="less_than"){I="less_than_or_equal";J=2}else{I="equal";J=1}}}if(J!=0){F=F.substring(J);if(F.length<1){return false}}}if(j.filtercondition!=undefined){I=j.filtercondition}if(K=="datefilter"){var G=H.createfilter(K,F,I,null,j.cellsformat,C.gridlocalization)}else{var G=H.createfilter(K,F,I)}H.addfilter(l,G)}else{i=false}}return i};switch(u.filtertype){case"date":if(u._filterwidget.jqxDateTimeInput){var p=u._filterwidget.jqxDateTimeInput("getRange");if(p!=null&&p.from!=null&&p.to!=null){var o="GREATER_THAN_OR_EQUAL";var r=new Date(0);r.setHours(0);r.setFullYear(p.from.getFullYear(),p.from.getMonth(),p.from.getDate());var q=new Date(0);q.setHours(0);q.setFullYear(p.to.getFullYear(),p.to.getMonth(),p.to.getDate());q.setHours(p.to.getHours());q.setMinutes(p.to.getMinutes());q.setSeconds(p.to.getSeconds());var y=k.createfilter(d,r,o);k.addfilter(0,y);var c="LESS_THAN_OR_EQUAL";var x=k.createfilter(d,q,c);k.addfilter(0,x)}else{D=false}}else{D=A(u,d,k)}break;case"number":if(u._filterwidget){var p=u._filterwidget.find("input").val();if(C.gridlocalization.decimalseparator==","){if(p.indexOf(C.gridlocalization.decimalseparator)>=0){p=p.replace(C.gridlocalization.decimalseparator,".")}}var h=u._filterwidget.find(".filter").jqxDropDownList("selectedIndex");var w=k.getoperatorsbyfiltertype(d)[h];if(C.updatefilterconditions){var E=C.updatefilterconditions(d,k.getoperatorsbyfiltertype(d));if(E!=undefined){k.setoperatorsbyfiltertype(d,E)}var w=k.getoperatorsbyfiltertype(d)[h]}var n=w=="NULL"||w=="NOT_NULL";var s=w=="EMPTY"||w=="NOT_EMPTY";if(p!=undefined&&p.length>0||n||s){y=k.createfilter(d,new Number(p),w,null,u.cellsformat,C.gridlocalization);k.addfilter(0,y)}else{D=false}}else{D=false}break;case"textbox":case"default":D=A(u,d,k);break;case"bool":case"boolean":if(u._filterwidget.jqxCheckBox){var p=u._filterwidget.jqxCheckBox("checked");if(p!=null){var o="equal";var m=k.createfilter(d,p,o);k.addfilter(l,m)}else{D=false}}else{D=A(u,d,k)}break;case"list":var g=u._filterwidget.jqxDropDownList("listBox");if(g.selectedIndex>0){var b=g.getItem(g.selectedIndex);var p=b.label;var o="equal";var m=k.createfilter(d,p,o);k.addfilter(l,m)}else{D=false}break;case"checkedlist":if(u._filterwidget.jqxDropDownList){var g=u._filterwidget.jqxDropDownList("listBox");var B=g.getCheckedItems();if(B.length==0){for(var v=1;v<g.items.length;v++){var p=g.items[v].label;var o="not_equal";var m=k.createfilter(d,p,o);k.addfilter(0,m)}D=true}else{if(B.length!=g.items.length){for(var v=0;v<B.length;v++){var p=B[v].label;var o="equal";var m=k.createfilter(d,p,o);k.addfilter(l,m)}}else{D=false}}}else{D=A(u,d,k)}break}if(!this._loading){if(D){this.addfilter(u.displayfield,k,false)}else{this.removefilter(u.displayfield,false)}}}if(!this._loading){this.applyfilters("filterrow")}},_updatefilterrow:function(){var b=a('<div style="position: relative;" id="row00'+this.element.id+'"></div>');var f=0;var o=this.columns.records.length;var m=this.toThemeProperty("jqx-grid-cell");m+=" "+this.toThemeProperty("jqx-grid-cell-pinned");m+=" "+this.toThemeProperty("jqx-grid-cell-filter-row");var q=o+10;var r=new Array();var n=this.that;this.filterrow[0].cells=r;b.height(this.filterrowheight);this.filterrow.children().detach();this.filterrow.append(b);if(!this._filterrowcache){this._filterrowcache=new Array()}this._initcolumntypes();var g=false;var d=new Array();for(var h=0;h<o;h++){var e=this.columns.records[h];var c=e.width;if(c<e.minwidth){c=e.minwidth}if(c>e.maxwidth){c=e.maxwidth}var l=a('<div style="overflow: hidden; position: absolute; height: 100%;" class="'+m+'"></div>');b.append(l);l.css("left",f);if(this.rtl){l.css("z-index",q++);l.css("border-left-width","1px")}else{l.css("z-index",q--)}l.width(c);l[0].left=f;if(!(e.hidden&&e.hideable)){f+=c}else{l.css("display","none")}r[r.length]=l[0];var k=true;if(!this.rtl){if(this.groupable){var p=(this.showrowdetailscolumn&&this.rowdetails)?1:0;if(this.groups.length+p>h){k=false}}if(this.showrowdetailscolumn&&this.rowdetails&&h==0){k=false}}else{if(this.groupable){var p=(this.showrowdetailscolumn&&this.rowdetails)?1:0;if(this.groups.length+p+h>o-1){k=false}}if(this.showrowdetailscolumn&&this.rowdetails&&h==o-1){k=false}}if(k){if(e.filtertype=="custom"&&e.createfilterwidget){var i=function(){n._applyfilterfromfilterrow()};e.createfilterwidget(e,l,i)}else{if(e.filterable){if(this._filterrowcache[e.datafield]){g=true;l.append(this._filterrowcache[e.datafield]);e._filterwidget=this._filterrowcache[e.datafield]}else{this._addfilterwidget(e,l,c);d[e.datafield]=e._filterwidget}}}}}this._filterrowcache=d;if(a.jqx.browser.msie&&a.jqx.browser.version<8){b.css("z-index",q--)}b.width(parseInt(f)+2);this.filterrow.addClass(m);this.filterrow.css("border-top-width","1px");this.filterrow.css("border-right-width","0px");if(g){this._updatefilterrowui(true)}},_addfilterwidget:function(A,d,y){var E=this.that;var x="";for(var C=0;C<E.dataview.filters.length;C++){var v=E.dataview.filters[C];if(v.datafield&&v.datafield==A.datafield){x=v.filter.getfilters()[0].value;break}}var g=function(F,G){var f=a('<input autocomplete="off" type="textarea"/>');f[0].id=a.jqx.utilities.createId();f.addClass(F.toThemeProperty("jqx-widget"));f.addClass(F.toThemeProperty("jqx-input"));f.addClass(F.toThemeProperty("jqx-widget-content"));if(F.rtl){f.css("direction","rtl")}f.appendTo(G);f.width(y-10);f.height(F.filterrowheight-10);f.css("margin","4px");if(A.createfilterwidget){A.createfilterwidget(A,G,f)}A._filterwidget=f;f.focus(function(){F.focusedfilter=f;f.addClass(F.toThemeProperty("jqx-fill-state-focus"))});f.blur(function(){f.removeClass(F.toThemeProperty("jqx-fill-state-focus"))});f.keydown(function(H){if(H.keyCode=="13"){F._applyfilterfromfilterrow()}if(f[0]._writeTimer){clearTimeout(f[0]._writeTimer)}f[0]._writeTimer=setTimeout(function(){if(!F._loading){if(F["_oldWriteText"+f[0].id]!=f.val()){F._applyfilterfromfilterrow();F["_oldWriteText"+f[0].id]=f.val()}}},800);F.focusedfilter=f});F.host.removeClass("jqx-disableselect");F.content.removeClass("jqx-disableselect");f.val(x)};if(A.datatype!=null){if(A.filtertype=="number"){if(A.datatype=="string"||A.datatype=="date"||A.datatype=="bool"){A.filtertype="textbox"}}if(A.filtertype=="date"){if(A.datatype=="string"||A.datatype=="number"||A.datatype=="bool"){A.filtertype="textbox"}}if(A.filtertype=="bool"){if(A.datatype=="string"||A.datatype=="number"||A.datatype=="date"){A.filtertype="textbox"}}}switch(A.filtertype){case"number":var l=a("<div></div>");l.width(d.width());l.height(this.filterrowheight);d.append(l);var y=d.width()-20;var q=function(G,H,f){var F=a('<input style="float: left;" autocomplete="off" type="textarea"/>');if(E.rtl){F.css("float","right");F.css("direction","rtl")}F[0].id=a.jqx.utilities.createId();F.addClass(E.toThemeProperty("jqx-widget"));F.addClass(E.toThemeProperty("jqx-input"));F.addClass(E.toThemeProperty("jqx-widget-content"));F.appendTo(G);F.width(H-10);F.height(E.filterrowheight-10);F.css("margin","4px");F.css("margin-right","2px");F.focus(function(){E.focusedfilter=F;F.addClass(E.toThemeProperty("jqx-fill-state-focus"))});F.blur(function(){F.removeClass(E.toThemeProperty("jqx-fill-state-focus"))});F.keydown(function(I){if(I.keyCode=="13"){E._applyfilterfromfilterrow()}if(F[0]._writeTimer){clearTimeout(F[0]._writeTimer)}F[0]._writeTimer=setTimeout(function(){if(!E._loading){if(E["_oldWriteText"+F[0].id]!=F.val()){E._applyfilterfromfilterrow();E["_oldWriteText"+F[0].id]=F.val()}}},800);E.focusedfilter=F});F.val(x);return F};q(l,y);var z=E._getfiltersbytype("number");var r=a("<div class='filter' style='float: left;'></div>");r.css("margin-top","4px");r.appendTo(l);if(E.rtl){r.css("float","right")}var h=0;if(A.filtercondition!=null){var e=z.indexOf(A.filtercondition);if(e!=-1){h=e}}r.jqxDropDownList({touchMode:E.touchmode,rtl:E.rtl,dropDownHorizontalAlignment:"right",enableBrowserBoundsDetection:true,selectedIndex:h,width:18,height:20,dropDownHeight:150,dropDownWidth:170,source:z,theme:E.theme});r.jqxDropDownList({selectionRenderer:function(f){return""}});r.jqxDropDownList("setContent","");r.find(".jqx-dropdownlist-content").hide();if(A.createfilterwidget){A.createfilterwidget(A,d,l)}A._filterwidget=l;var j=null;this.addHandler(r,"select",function(){var f=r.jqxDropDownList("getSelectedItem").label;if(A._filterwidget.find("input").val().length>0&&!E.refreshingfilter){E._applyfilterfromfilterrow()}else{if(A._filterwidget.find("input").val().length==0&&!E.refreshingfilter){if(j=="null"||j=="not null"||f=="null"||f=="not null"){E._applyfilterfromfilterrow()}}}j=f});break;case"textbox":case"default":default:g(this,d);break;case"none":break;case"date":if(this.host.jqxDateTimeInput){var b=a("<div></div>");b.css("margin","4px");b.appendTo(d);var m={calendar:this.gridlocalization,todayString:this.gridlocalization.todaystring,clearString:this.gridlocalization.clearstring};b.jqxDateTimeInput({localization:m,rtl:E.rtl,showFooter:true,formatString:A.cellsformat,selectionMode:"range",value:null,theme:this.theme,width:y-10,height:this.filterrowheight-10});if(A.createfilterwidget){A.createfilterwidget(A,d,b)}A._filterwidget=b;this.addHandler(b,"valuechanged",function(f){if(!E.refreshingfilter){E._applyfilterfromfilterrow();E.focusedfilter=null}})}else{g(this,d)}break;case"list":case"checkedlist":if(this.host.jqxDropDownList){var p=this._getfilterdataadapter(A);var k=false;var r=a("<div></div>");r.css("margin","4px");var s=A.datafield;var t=A.filtertype=="checkedlist"?true:false;var B=y<150?220:"auto";r.jqxDropDownList({touchMode:E.touchmode,rtl:E.rtl,checkboxes:t,dropDownWidth:B,source:p,autoDropDownHeight:k,theme:this.theme,width:y-10,height:this.filterrowheight-10,displayMember:A.displayfield,valueMember:s});r.appendTo(d);var o=r.jqxDropDownList("getItems");var c=r.jqxDropDownList("listBox");if(o.length<8){r.jqxDropDownList("autoDropDownHeight",true)}else{r.jqxDropDownList("autoDropDownHeight",false);k=false}if(t){r.jqxDropDownList({selectionRenderer:function(){return E.gridlocalization.filterselectstring}});var w=a('<span style="top: 2px; position: relative; color: inherit; border: none; background-color: transparent;">'+E.gridlocalization.filterselectstring+"</span>");w.addClass(this.toThemeProperty("jqx-item"));if(c!=undefined){if(!k){c.host.height(200)}c.insertAt(E.gridlocalization.filterselectallstring,0);r.jqxDropDownList("setContent",w);var i=true;var D=new Array();c.checkAll(false);E.addHandler(c.host,"checkChange",function(G){r[0]._selectionChanged=true;if(!i){return}if(G.args.label!=E.gridlocalization.filterselectallstring){i=false;c.host.jqxListBox("checkIndex",0,true,false);var f=c.host.jqxListBox("getCheckedItems");var F=c.host.jqxListBox("getItems");if(f.length==1){c.host.jqxListBox("uncheckIndex",0,true,false)}else{if(F.length!=f.length){c.host.jqxListBox("indeterminateIndex",0,true,false)}}i=true}else{i=false;if(G.args.checked){c.host.jqxListBox("checkAll",false)}else{c.host.jqxListBox("uncheckAll",false)}i=true}})}}else{c.insertAt({label:this.gridlocalization.filterchoosestring,value:""},0);r.jqxDropDownList({selectedIndex:0})}if(A.createfilterwidget){A.createfilterwidget(A,d,r)}A._filterwidget=r;var n=r.jqxDropDownList("dropdownlistWrapper");if(A.filtertype=="list"){this.addHandler(r,"select",function(f){if(!E.refreshingfilter){if(f.args&&f.args.type!="none"){E._applyfilterfromfilterrow();E.focusedfilter=null}}})}else{this.addHandler(r,"close",function(f){if(r[0]._selectionChanged){E._applyfilterfromfilterrow();E.focusedfilter=null;r[0]._selectionChanged=false}})}}else{g(this,d)}break;case"bool":case"boolean":if(this.host.jqxCheckBox){var u=a('<div tabIndex=0 style="opacity: 0.99; position: absolute; top: 50%; left: 50%; margin-top: -7px; margin-left: -10px;"></div>');u.appendTo(d);u.jqxCheckBox({enableContainerClick:false,animationShowDelay:0,animationHideDelay:0,hasThreeStates:true,theme:this.theme,checked:null});if(A.createfilterwidget){A.createfilterwidget(A,d,u)}if(x===true||x=="true"){u.jqxCheckBox({checked:true})}else{if(x===false||x=="false"){u.jqxCheckBox({checked:false})}}A._filterwidget=u;this.addHandler(u,"change",function(f){if(!E.refreshingfilter){if(f.args){E.focusedfilter=null;E._applyfilterfromfilterrow()}}})}else{g(this,d)}break}},_getfilterdataadapter:function(b){var c=this.source._source?true:false;if(!c){dataadapter=new a.jqx.dataAdapter(this.source,{autoBind:false,uniqueDataFields:[b.displayfield],autoSort:true,autoSortField:b.displayfield,async:false})}else{var e={localdata:this.source.records,datatype:this.source.datatype,async:false};var d=this;dataadapter=new a.jqx.dataAdapter(e,{autoBind:false,autoSort:true,autoSortField:b.displayfield,async:false,uniqueDataFields:[b.displayfield],beforeLoadComplete:function(f){var k=new Array();if(b.cellsformat){var j=d._getcolumntypebydatafield(b);for(var g=0;g<f.length;g++){k.push(f[g]);var h=f[g][b.displayfield];f[g][b.displayfield+"JQValue"]=h;if(j==="date"){f[g][b.displayfield]=dataadapter.formatDate(h,b.cellsformat,d.gridlocalization)}else{if(j==="number"||j==="float"||j==="int"){f[g][b.displayfield]=dataadapter.formatNumber(h,b.cellsformat,d.gridlocalization)}}}return k}else{return f}}})}if(b.filteritems&&b.filteritems.length>0){var e={localdata:b.filteritems,datatype:this.source.datatype,async:false};dataadapter=new a.jqx.dataAdapter(e,{autoBind:false,async:false})}else{if(b.filteritems){if(b.filteritems._source){b.filteritems._options.autoBind=false;b.filteritems._options.async=false;return b.filteritems}else{if(a.isFunction(b.filteritems)){return b.filteritems()}}}}return dataadapter},refreshfilterrow:function(){if(!this.showfilterrow){return}this.refreshingfilter=true;this._updatefilterrowui();this._updatelistfilters(true,true);var h=this.that;var l=this.columns.records.length;for(var d=0;d<l;d++){var c=this.columns.records[d];if(c.filterable){if(c.filter){var b=c.filter.getfilters();if(b.length>0){var k=b[0].value;var e=c._filterwidget;var f=c._filterwidget.parent();if(e!=null){switch(c.filtertype){case"number":f.find("input").val(k);if(this.host.jqxDropDownList){var i=c.filter.getoperatorsbyfiltertype("numericfilter");e.find(".filter").jqxDropDownList("selectIndex",i.indexOf(b[0].condition))}break;case"date":if(this.host.jqxDateTimeInput){var k=c.filter.getfilterat(0).filtervalue;if(k!=undefined){if(c.filter.getfilterat(1)){var g=c.filter.getfilterat(1).filtervalue}else{g=k}a(f.children()[0]).jqxDateTimeInput("setRange",new Date(k),new Date(g))}}else{e.val(k)}break;case"textbox":case"default":e.val(k);h["_oldWriteText"+e[0].id]=k;break;case"bool":case"boolean":if(!this.host.jqxCheckBox){e.val(k)}else{a(f.children()[0]).jqxCheckBox({checked:k})}break}}}}}}this.refreshingfilter=false},_destroyedfilters:function(){var g=this.that;var b=this.columns.records.length;for(var f=0;f<b;f++){var c=this.columns.records[f];if(c.filterable){var h=c._filterwidget;if(c.filtertype=="list"||c.filtertype=="checkedlist"){this.removeHandler(h,"select");this.removeHandler(h,"close");h.jqxDropDownList("destroy")}else{if(c.filtertype=="date"){this.removeHandler(h,"valuechanged");h.jqxDateTimeInput("destroy")}else{if(c.filtertype=="bool"){this.removeHandler(h,"change");h.jqxCheckBox("destroy")}else{if(c.filtertype=="number"){var d=h.find(".jqx-input");this.removeHandler(d,"keydown");var e=a(h.children()[1]);e.jqxDropDownList("destroy")}else{this.removeHandler(h,"keydown")}}}}h.remove()}}},_updatelistfilters:function(n,t){var o=this.that;var r=this.columns.records.length;for(var h=0;h<r;h++){var e=this.columns.records[h];if(e.filterable){if(e.filtertype=="list"||e.filtertype=="checkedlist"){var m=e._filterwidget;if(!n){if(e.filter==undefined){m.jqxDropDownList("renderSelection");continue}}else{var b=this._getfilterdataadapter(e);m.jqxDropDownList({source:b});var g=m.jqxDropDownList("getItems");var s=true;if(g.length!=b.records.length+1){s=false}if(s){for(var k=1;k<g.length;k++){if(g[k].label!=b.records[k-1][e.displayfield]){s=false;break}}}if(s&&!t){continue}}var l=e.filtertype=="checkedlist"?true:false;var g=m.jqxDropDownList("getItems");var c=m.jqxDropDownList("listBox");m.jqxDropDownList("dataBind");if(l){m.jqxDropDownList({selectionRenderer:function(){return o.gridlocalization.filterselectstring}});c.insertAt(this.gridlocalization.filterselectallstring,0);m.jqxDropDownList("setContent",this.gridlocalization.filterselectstring);c.checkAll(false);if(e.filter){var d=e.filter.getfilters();for(var k=0;k<c.items.length;k++){var q=c.items[k].label;a.each(d,function(){if(this.condition=="NOT_EQUAL"){if(q==this.value){c.uncheckIndex(k,false,false)}else{c.checkIndex(k,false,false)}}else{if(this.condition=="EQUAL"){if(q==this.value){c.checkIndex(k,false,false)}else{c.uncheckIndex(k,false,false)}}}})}c._updateCheckedItems();var p=c.getCheckedItems().length;if(c.items.length!=p&&p>0){c.host.jqxListBox("indeterminateIndex",0,true,false)}}}else{c.insertAt({label:this.gridlocalization.filterchoosestring,value:""},0);m.jqxDropDownList({selectedIndex:0});if(e.filter){var d=e.filter.getfilters();var f=-1;for(var k=0;k<c.items.length;k++){var q=c.items[k].label;a.each(d,function(){if(this.condition=="NOT_EQUAL"){return true}if(q==this.value){f=k;return false}})}if(f!=-1){c.selectIndex(f)}}}if(g.length<8){m.jqxDropDownList("autoDropDownHeight",true)}else{m.jqxDropDownList("autoDropDownHeight",false)}}}}},_renderfiltercolumn:function(){var b=this.that;if(this.filterable){a.each(this.columns.records,function(c,d){if(b.autoshowfiltericon){if(this.filter){a(this.filtericon).show()}else{a(this.filtericon).hide()}}else{if(this.filterable){a(this.filtericon).show()}}})}},_initcolumntypes:function(){if(this.columns&&this.columns.records){var b=this.source._source.datafields;if(b){for(var c=0;c<this.columns.records.length;c++){var d=this.columns.records[c];if(d.datatype){continue}var e="";a.each(b,function(){if(this.name==d.displayfield){if(this.type){e=this.type}return false}});if(e!=""){d.datatype=e}else{d.datatype=""}}}}},_getcolumntypebydatafield:function(f){var g=this.that;var e="string";var d=g.source.datafields||((g.source._source)?g.source._source.datafields:null);if(d){var i="";a.each(d,function(){if(this.name==f.displayfield){if(this.type){i=this.type}return false}});if(i){return i}}if(f!=null){if(this.dataview.cachedrecords==undefined){return e}var b=null;if(!this.virtualmode){if(this.dataview.cachedrecords.length==0){return e}b=this.dataview.cachedrecords[0][f.displayfield];if(b!=null&&b.toString()==""){return"string"}}else{a.each(this.dataview.cachedrecords,function(){b=this[f.displayfield];return false})}if(b!=null){if(typeof b=="boolean"){e="boolean"}else{if(a.jqx.dataFormat.isNumber(b)){e="number"}else{var h=new Date(b);if(h.toString()=="NaN"||h.toString()=="Invalid Date"){if(a.jqx.dataFormat){h=a.jqx.dataFormat.tryparsedate(b);if(h!=null){if(h&&h.getFullYear()){if(h.getFullYear()==1970&&h.getMonth()==0&&h.getDate()==1){var c=new Number(b);if(!isNaN(c)){return"number"}return"string"}}return"date"}else{e="string"}}else{e="string"}}else{e="date"}}}}}return e},_getfiltersbytype:function(b){var c=this.that;var d="";switch(b){case"number":case"float":case"int":d=c.gridlocalization.filternumericcomparisonoperators;break;case"date":d=c.gridlocalization.filterdatecomparisonoperators;break;case"boolean":case"bool":d=c.gridlocalization.filterbooleancomparisonoperators;break;case"string":default:d=c.gridlocalization.filterstringcomparisonoperators;break}return d},_updatefilterpanel:function(K,e,f){if(K==null||K==undefined){K=this}var g=K._getcolumntypebydatafield(f);var C=K._getfiltersbytype(g);if(!K.host.jqxDropDownList){throw new Error("jqxGrid: Missing reference to jqxdropdownlist.js.");return}var A=a(e);var w=A.find("#filterclearbutton"+K.element.id);var l=A.find("#filterbutton"+K.element.id);var F=A.find("#filter1"+K.element.id);var B=A.find("#filter2"+K.element.id);var D=A.find("#filter3"+K.element.id);var z=A.find(".filtertext1"+K.element.id);var y=A.find(".filtertext2"+K.element.id);z.val("");y.val("");this.removeHandler(l,"click");this.addHandler(l,"click",function(){K._buildfilter(K,e,f);K._closemenu()});this.removeHandler(w,"click");this.addHandler(w,"click",function(){K._clearfilter(K,e,f);K._closemenu()});if(this.filtermode==="default"){if(F.jqxDropDownList("source")!=C){F.jqxDropDownList({enableBrowserBoundsDetection:false,source:C});D.jqxDropDownList({enableBrowserBoundsDetection:false,source:C})}if(g=="boolean"||g=="bool"){F.jqxDropDownList({autoDropDownHeight:true,selectedIndex:0});D.jqxDropDownList({autoDropDownHeight:true,selectedIndex:0})}else{var h=false;if(C&&C.length){if(C.length<5){h=true}}F.jqxDropDownList({autoDropDownHeight:h,selectedIndex:2});D.jqxDropDownList({autoDropDownHeight:h,selectedIndex:2})}B.jqxDropDownList({selectedIndex:0});var u=f.filter;var o=new a.jqx.filter();var d="";switch(g){case"number":case"int":case"float":case"decimal":d="numericfilter";n=o.getoperatorsbyfiltertype("numericfilter");break;case"boolean":case"bool":d="booleanfilter";n=o.getoperatorsbyfiltertype("booleanfilter");break;case"date":case"time":d="datefilter";n=o.getoperatorsbyfiltertype("datefilter");break;case"string":d="stringfilter";n=o.getoperatorsbyfiltertype("stringfilter");break}if(u!=null){var H=u.getfilterat(0);var G=u.getfilterat(1);var s=u.getoperatorat(0);if(K.updatefilterconditions){var n=[];var L=K.updatefilterconditions(d,n);if(L!=undefined){for(var I=0;I<L.length;I++){L[I]=L[I].toUpperCase()}u.setoperatorsbyfiltertype(d,L);n=L}}var r=this.enableanimations?"default":"none";if(H!=null){var k=n.indexOf(H.comparisonoperator);var x=H.filtervalue;z.val(x);F.jqxDropDownList({selectedIndex:k,animationType:r})}if(G!=null){var j=n.indexOf(G.comparisonoperator);var v=G.filtervalue;y.val(v);D.jqxDropDownList({selectedIndex:j,animationType:r})}if(u.getoperatorat(0)==undefined){B.jqxDropDownList({selectedIndex:0,animationType:r})}else{if(u.getoperatorat(0)=="and"||u.getoperatorat(0)==0){B.jqxDropDownList({selectedIndex:0})}else{B.jqxDropDownList({selectedIndex:1})}}}if(K.updatefilterpanel){K.updatefilterpanel(F,D,B,z,y,l,w,u,d,n)}z.focus();setTimeout(function(){z.focus()},10)}else{var m=K._getfilterdataadapter(f);var d=K._getfiltertype(g);if(f.cellsformat){F.jqxListBox({displayMember:f.displayfield,valueMember:f.displayfield+"JQValue",source:m})}else{F.jqxListBox({displayMember:f.displayfield,valueMember:f.displayfield,source:m})}F.jqxListBox("insertAt",K.gridlocalization.filterselectallstring,0);var b=F.data().jqxListBox.instance;b.checkAll(false);var p=this;if(f.filter){b.uncheckAll(false);var t=f.filter.getfilters();for(var E=0;E<b.items.length;E++){var q=b.items[E].value;a.each(t,function(){if(this.condition=="NOT_EQUAL"){if(q!=this.value){b.uncheckIndex(E,false,false);return false}}else{if(this.condition=="EQUAL"){if(q==this.value){b.checkIndex(E,false,false);return false}}}})}b._updateCheckedItems();var J=b.getCheckedItems().length;if(b.items.length!=J&&J>0){b.host.jqxListBox("indeterminateIndex",0,true,false)}if(J===b.items.length-1){b.host.jqxListBox("checkIndex",0,true,false)}}}},_getfiltertype:function(b){var c="stringfilter";switch(b){case"number":case"int":case"float":case"decimal":c="numericfilter";break;case"boolean":case"bool":c="booleanfilter";break;case"date":case"time":c="datefilter";break;case"string":c="stringfilter";break}return c},_buildfilter:function(r,l,F){var f=a(l).find("#filter1"+r.element.id);var G=a(l).find("#filter2"+r.element.id);var J=a(l).find("#filter3"+r.element.id);var k=a(l).find(".filtertext1"+r.element.id);var j=a(l).find(".filtertext2"+r.element.id);var A=k.val();var y=j.val();var L=r._getcolumntypebydatafield(F);var t=r._getfiltersbytype(L);var I=new a.jqx.filter();var w=r._getfiltertype(L);if(r.filtermode==="default"){var E=f.jqxDropDownList("selectedIndex");var c=G.jqxDropDownList("selectedIndex");var D=J.jqxDropDownList("selectedIndex");var e=null;var d=null;if(r.updatefilterconditions){var p=r.updatefilterconditions(w,I.getoperatorsbyfiltertype(w));if(p!=undefined){I.setoperatorsbyfiltertype(w,p)}}var q=false;var K=I.getoperatorsbyfiltertype(w)[E];var J=I.getoperatorsbyfiltertype(w)[D];var v=K=="NULL"||K=="NOT_NULL";var h=K=="EMPTY"||K=="NOT_EMPTY";if(K==undefined){K=I.getoperatorsbyfiltertype(w)[0]}if(J==undefined){J=I.getoperatorsbyfiltertype(w)[0]}if(A.length>0||v||h){e=I.createfilter(w,A,K,null,F.cellsformat,r.gridlocalization);I.addfilter(c,e);q=true}var u=J=="NULL"||J=="NOT_NULL";var g=J=="EMPTY"||J=="NOT_EMPTY";if(y.length>0||u||g){d=I.createfilter(w,y,J,null,F.cellsformat,r.gridlocalization);I.addfilter(c,d);q=true}if(q){var C=F.displayfield;this.addfilter(C,I,true)}else{this._clearfilter(r,l,F)}}else{var B=this;var n=false;var x=f.data().jqxListBox.instance;var o=x.getCheckedItems();if(o.length==0){for(var H=1;H<x.items.length;H++){var m=x.items[H].value;var b="not_equal";var z=I.createfilter(w,m,b,null);I.addfilter(0,z)}n=true}else{if(o.length!=x.items.length){n=true;for(var H=0;H<o.length;H++){if(r.gridlocalization.filterselectallstring===o[H].value){continue}var m=o[H].value;var b="equal";var z=I.createfilter(w,m,b,null);var s=1;I.addfilter(s,z)}}else{n=false}}if(n){var C=F.displayfield;this.addfilter(C,I,true)}else{var C=F.displayfield;this.removefilter(C,true)}}},_clearfilter:function(e,c,d){var b=d.displayfield;this.removefilter(b,true)},addfilter:function(d,e,c){if(this._loading){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}var f=this.getcolumn(d);var b=this._getcolumn(d);if(f==undefined||f==null){return}f.filter=e;b.filter=e;this.dataview.addfilter(d,e);if(c==true&&c!=undefined){this.applyfilters("add")}},removefilter:function(d,c){if(this._loading){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}var e=this.getcolumn(d);var b=this._getcolumn(d);if(e==undefined||e==null){return}if(e.filter==null){return}this.dataview.removefilter(d,e.filter);e.filter=null;b.filter=null;if(c==true||c!==false){this.applyfilters("remove")}},applyfilters:function(f){var c=false;if(this.dataview.filters.length>=0&&(this.virtualmode||!this.source.localdata)){if(this.source!=null&&this.source.filter){var g=-1;if(this.pageable){g=this.dataview.pagenum;this.dataview.pagenum=0}else{this.vScrollInstance.setPosition(0);this.loadondemand=true;this._renderrows(this.virtualsizeinfo)}this.source.filter(this.dataview.filters,this.dataview.records,this.dataview.records.length);if(this.pageable){this.dataview.pagenum=g}}}if(this.dataview.clearsortdata){this.dataview.clearsortdata()}if(!this.virtualmode){var b=this.selectedrowindexes;var d=this.that;this.dataview.refresh();if(this.dataview.clearsortdata){if(this.sortcolumn&&this.sortdirection){var e=this.sortdirection.ascending?"asc":"desc";if(!this._loading){this.sortby(this.sortcolumn,e,null,false)}else{this.sortby(this.sortcolumn,e,null,false,false)}}}}else{if(this.pageable){this.dataview.updateview();if(this.gotopage){this.gotopage(0)}}this.rendergridcontent(false,false);if(this.showfilterrow){if(typeof f!="string"&&a.isEmptyObject(f)){this.refreshfilterrow()}}this._raiseEvent(13,{filters:this.dataview.filters});return}if(this.pageable){this.dataview.updateview();if(this.gotopage){this.gotopage(0);this.updatepagerdetails()}}this._updaterowsproperties();if(!this.groupable||(this.groupable&&this.groups.length==0)){this._rowdetailscache=new Array();this.virtualsizeinfo=null;this._pagescache=new Array();if(this.columns&&this.columns.records&&this.columns.records.length>0&&!this.columns.records[0].filtericon){this.prerenderrequired=true}this.rendergridcontent(true,false);this._updatecolumnwidths();this._updatecellwidths();this._renderrows(this.virtualsizeinfo);if(this.showaggregates&&this._updatecolumnsaggregates){this._updatecolumnsaggregates()}}else{this._rowdetailscache=new Array();this._render(true,true,false,false,false);if(this.showfilterrow){this._updatefocusedfilter()}this._updatecolumnwidths();this._updatecellwidths();this._renderrows(this.virtualsizeinfo)}if(this.showfilterrow){if(typeof f!="string"&&a.isEmptyObject(f)){this.refreshfilterrow()}}this._raiseEvent(13,{filters:this.dataview.filters})},getfilterinformation:function(){var d=new Array();for(var b=0;b<this.dataview.filters.length;b++){var c=this.getcolumn(this.dataview.filters[b].datafield);d[b]={filter:this.dataview.filters[b].filter,filtercolumn:c.datafield,filtercolumntext:c.text}}return d},clearfilters:function(b){var d=this.that;if(this.showfilterrow){this.clearfilterrow()}if(this.columns.records){var c=b==true||b!==false;a.each(this.columns.records,function(){d.removefilter(this.displayfield,!c)})}if(b===false){return}if(b==true||b!==false){this.applyfilters("clear")}},_destroyfilterpanel:function(){var e=a(a.find("#filterclearbutton"+this.element.id));var d=a(a.find("#filterbutton"+this.element.id));var h=a(a.find("#filter1"+this.element.id));var c=a(a.find("#filter2"+this.element.id));var g=a(a.find("#filter3"+this.element.id));var f=a(a.find(".filtertext1"+this.element.id));var b=a(a.find(".filtertext2"+this.element.id));if(f.length>0&&b.length>0){f.removeClass();b.removeClass();f.remove();b.remove()}if(e.length>0){e.jqxButton("destroy");d.jqxButton("destroy");this.removeHandler(e,"click");this.removeHandler(d,"click")}if(h.length>0){h.jqxDropDownList("destroy")}if(c.length>0){c.jqxDropDownList("destroy")}if(g.length>0){g.jqxDropDownList("destroy")}},_initfilterpanel:function(v,b,c,n){if(v==null||v==undefined){v=this}b[0].innerHTML="";var r=a("<div class='filter' style='margin-left: 7px;'></div>");b.append(r);var m=a("<div class='filter' style='margin-top: 3px; margin-bottom: 3px;'></div>");m.text(v.gridlocalization.filtershowrowstring);var s=a("<div class='filter' id='filter1"+v.element.id+"'></div>");var h=a("<div class='filter' id='filter2"+v.element.id+"' style='margin-bottom: 3px;'></div>");var q=a("<div class='filter' id='filter3"+v.element.id+"'></div>");var e=v._getcolumntypebydatafield(c);if(!s.jqxDropDownList){throw new Error("jqxGrid: jqxdropdownlist.js is not loaded.");return}var o=v._getfiltersbytype(e);var j=a("<div class='filter'><input class='filtertext1"+v.element.id+"' style='height: 20px; margin-top: 3px; margin-bottom: 3px;' type='text'></input></div>");var l=j.find("input");l.addClass(this.toThemeProperty("jqx-input"));l.addClass(this.toThemeProperty("jqx-widget-content"));l.addClass(this.toThemeProperty("jqx-rc-all"));l.width(n-15);var k=a("<div class='filter'><input class='filtertext2"+v.element.id+"' style='height: 20px; margin-top: 3px;' type='text'></input></div>");var i=k.find("input");i.addClass(this.toThemeProperty("jqx-input"));i.addClass(this.toThemeProperty("jqx-widget-content"));i.addClass(this.toThemeProperty("jqx-rc-all"));i.width(n-15);if(v.rtl){l.css("direction","rtl");i.css("direction","rtl")}var g=a("<div class='filter' style='height: 25px; margin-left: 20px; margin-top: 7px;'></div>");var f=a('<span tabIndex=0 id="filterbutton'+v.element.id+'" class="filterbutton" style="padding: 4px 12px; margin-left: 2px;">'+v.gridlocalization.filterstring+"</span>");g.append(f);var t=a('<span tabIndex=0 id="filterclearbutton'+v.element.id+'" class="filterclearbutton" style="padding: 4px 12px; margin-left: 5px;">'+v.gridlocalization.filterclearstring+"</span>");g.append(t);f.jqxButton({height:20,theme:v.theme});t.jqxButton({height:20,theme:v.theme});var u=function(x){if(x){if(x.text().indexOf("case sensitive")!=-1){var w=x.text();w=w.replace("case sensitive","match case");x.text(w)}x.css("font-family",v.host.css("font-family"));x.css("font-size",v.host.css("font-size"));return x}return""};if(this.filtermode==="default"){r.append(m);r.append(s);s.jqxDropDownList({rtl:v.rtl,enableBrowserBoundsDetection:false,selectedIndex:2,width:n-15,height:20,dropDownHeight:150,dropDownWidth:n-15,selectionRenderer:u,source:o,theme:v.theme});r.append(j);var p=new Array();p[0]=v.gridlocalization.filterandconditionstring;p[1]=v.gridlocalization.filterorconditionstring;h.jqxDropDownList({rtl:v.rtl,enableBrowserBoundsDetection:false,autoDropDownHeight:true,selectedIndex:0,width:60,height:20,source:p,selectionRenderer:u,theme:v.theme});r.append(h);q.jqxDropDownList({rtl:v.rtl,enableBrowserBoundsDetection:false,selectedIndex:2,width:n-15,height:20,dropDownHeight:150,dropDownWidth:n-15,selectionRenderer:u,source:o,theme:v.theme});r.append(q);r.append(k)}else{r.append(m);r.append(s);s.jqxListBox({rtl:v.rtl,checkboxes:true,selectedIndex:2,width:n-15,height:120,theme:v.theme});var d=true;v.addHandler(s,"checkChange",function(y){if(!d){return}if(y.args.label!=v.gridlocalization.filterselectallstring){d=false;s.jqxListBox("checkIndex",0,true,false);var w=s.jqxListBox("getCheckedItems");var x=s.jqxListBox("getItems");if(w.length==1){s.jqxListBox("uncheckIndex",0,true,false)}else{if(x.length!=w.length){s.jqxListBox("indeterminateIndex",0,true,false)}}d=true}else{d=false;if(y.args.checked){s.jqxListBox("checkAll",false)}else{s.jqxListBox("uncheckAll",false)}d=true}})}r.append(g);if(v.updatefilterpanel){v.updatefilterpanel(s,q,h,j,k,f,t,null,null,o)}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.extend(a.jqx._jqxGrid.prototype,{_handledblclick:function(t,n){if(t.target==null){return}if(n.disabled){return}if(a(t.target).ischildof(this.columnsheader)){return}var w;if(t.which){w=(t.which==3)}else{if(t.button){w=(t.button==2)}}if(w){return}var B;if(t.which){B=(t.which==2)}else{if(t.button){B=(t.button==1)}}if(B){return}var v=this.showheader?this.columnsheader.height()+2:0;var o=this._groupsheader()?this.groupsheader.height():0;var A=this.showtoolbar?this.toolbarheight:0;o+=A;var e=this.host.offset();var m=t.pageX-e.left;var l=t.pageY-v-e.top-o;var b=this._hittestrow(m,l);var h=b.row;var j=b.index;var q=t.target.className;var p=this.table[0].rows[j];if(p==null){return}n.mousecaptured=true;n.mousecaptureposition={left:t.pageX,top:t.pageY-o};var r=this.hScrollInstance;var s=r.value;var d=0;var k=this.groupable?this.groups.length:0;for(var u=0;u<p.cells.length;u++){var f=parseInt(a(this.columnsrow[0].cells[u]).css("left"));var g=f-s;if(n.columns.records[u].pinned){g=f}var c=this._getcolumnat(u);if(c!=null&&c.hidden){continue}var z=g+a(this.columnsrow[0].cells[u]).width();if(z>=m&&m>=g){d=u;break}}if(h!=null){var c=this._getcolumnat(d);if(!(q.indexOf("jqx-grid-group-expand")!=-1||q.indexOf("jqx-grid-group-collapse")!=-1)){if(h.boundindex!=-1){n.begincelledit(n.getboundindex(h),c.datafield,c.defaulteditorvalue)}}}},_getpreveditablecolumn:function(c){var b=this;while(c>0){c--;var d=b.getcolumnat(c);if(!d){return null}if(!d.editable){continue}if(!d.hidden){return d}}return null},_getnexteditablecolumn:function(c){var b=this;while(c<this.columns.records.length){c++;var d=b.getcolumnat(c);if(!d){return null}if(!d.editable){continue}if(!d.hidden){return d}}return null},_handleeditkeydown:function(B,v){if(v.handlekeyboardnavigation){var n=v.handlekeyboardnavigation(B);if(n==true){return true}}var F=B.charCode?B.charCode:B.keyCode?B.keyCode:0;if(v.showfilterrow&&v.filterable){if(this.filterrow){if(a(B.target).ischildof(this.filterrow)){return true}}}if(v.pageable){if(a(B.target).ischildof(this.pager)){return true}}if(this.showtoolbar){if(a(B.target).ischildof(this.toolbar)){return true}}if(this.showstatusbar){if(a(B.target).ischildof(this.statusbar)){return true}}if(this.rowdetails){if(a(B.target).ischildof(this.content.find("[role='rowgroup']"))){return true}}if(this.editcell){if(this.editmode==="selectedrow"){if(F===13){this.endrowedit(this.editcell.row,false)}else{if(F===27){this.endrowedit(this.editcell.row,true)}}if(F===9){return false}return true}if(this.editcell.columntype==null||this.editcell.columntype=="textbox"||this.editcell.columntype=="numberinput"||this.editcell.columntype=="combobox"||this.editcell.columntype=="datetimeinput"){if(F>=33&&F<=40&&v.selectionmode=="multiplecellsadvanced"){var h=this.editcell.columntype=="textbox"||this.editcell.columntype==null?this.editcell.editor:this.editcell.editor.find("input");var G=v._selection(h);var w=h.val().length;if(G.length>0&&this.editcell.columntype!="datetimeinput"){v._cancelkeydown=true}if(G.start>0&&F==37){v._cancelkeydown=true}if(G.start<w&&F==39&&this.editcell.columntype!="datetimeinput"){v._cancelkeydown=true}if(this.editcell.columntype=="datetimeinput"&&F==39){if(G.start+G.length<w){v._cancelkeydown=true}}}}else{if(this.editcell.columntype=="dropdownlist"){if(F==37||F==39&&v.selectionmode=="multiplecellsadvanced"){v._cancelkeydown=false}}else{if(this.selectionmode=="multiplecellsadvanced"&&this.editcell.columntype!="textbox"&&this.editcell.columntype!="numberinput"){v._cancelkeydown=true}}}if(F==32){if(v.editcell.columntype=="checkbox"){var e=v.getcolumn(v.editcell.datafield);if(e.editable){var l=!v.getcellvalue(v.editcell.row,v.editcell.column);if(e.cellbeginedit){var b=e.cellbeginedit(v.editcell.row,e.datafield,e.columntype,!l);if(b==false){return false}}v.setcellvalue(v.editcell.row,v.editcell.column,l,true);v._raiseEvent(18,{rowindex:v.editcell.row,datafield:v.editcell.column,oldvalue:!l,value:l,columntype:"checkbox"});return false}}}if(F==9){var g=this.editcell.row;var t=this.editcell.column;var k=t;var y=v._getcolumnindex(t);var s=false;var d=v.getrowvisibleindex(g);this.editchar="";if(this.editcell.validated!=false){if(B.shiftKey){var e=v._getpreveditablecolumn(y);if(e){t=e.datafield;s=true;if(v.selectionmode.indexOf("cell")!=-1){v.selectprevcell(g,k);setTimeout(function(){v.ensurecellvisible(d,t)},10)}}}else{var e=v._getnexteditablecolumn(y);if(e){t=e.datafield;s=true;if(v.selectionmode.indexOf("cell")!=-1){v.selectnextcell(g,k);v._oldselectedcell=v.selectedcell;setTimeout(function(){v.ensurecellvisible(d,t)},10)}}}if(s){v.begincelledit(g,t);if(this.editcell!=null&&this.editcell.columntype=="checkbox"){this._renderrows(this.virtualsizeinfo)}}else{if(this.editcell!=null){v.endcelledit(g,t,false);this._renderrows(this.virtualsizeinfo)}return true}}return false}else{if(F==13){var r=this.selectedcell;if(r){var u=this.getrowvisibleindex(r.rowindex)}this.endcelledit(this.editcell.row,this.editcell.column,false,true);if(this.selectionmode=="multiplecellsadvanced"){var c=v.getselectedcell();if(c!=null){if(v.selectcell){if(this.editcell==null){if(c.rowindex+1<this.dataview.totalrecords){if(this.sortcolumn!=c.datafield){var d=this.getrowvisibleindex(c.rowindex);var E=this.dataview.loadedrecords[d+1];if(E){if(!this.pageable||(this.pageable&&d+1<(this.dataview.pagenum+1)*this.pagesize)){this.clearselection(false);this.selectcell(this.getboundindex(E),c.datafield);var c=this.getselectedcell();this.ensurecellvisible(E.visibleindex,c.datafield)}}}else{if(r!=null){var D=this.dataview.loadedrecords[u+1];if(D){if(!this.pageable||(this.pageable&&u+1<this.pagesize)){this.clearselection(false);this.selectcell(this.getboundindex(D),c.datafield)}else{if(this.pageable&&u+1>=this.pagesize){this.clearselection(false);var D=this.dataview.loadedrecords[u];this.selectcell(this.getboundindex(D),c.datafield)}}}}}}}}}}return false}else{if(F==27){this.endcelledit(this.editcell.row,this.editcell.column,true,true);return false}}}}else{var x=false;if(F==113){x=true}if(!B.ctrlKey&&!B.altKey){if(F>=48&&F<=57){this.editchar=String.fromCharCode(F);x=true}if(F>=65&&F<=90){this.editchar=String.fromCharCode(F);var q=false;if(B.shiftKey){q=B.shiftKey}else{if(B.modifiers){q=!!(B.modifiers&4)}}if(!q){this.editchar=this.editchar.toLowerCase()}x=true}else{if(F>=96&&F<=105){this.editchar=F-96;this.editchar=this.editchar.toString();x=true}}var p=a(".jqx-grid").length;x=x&&(p==1||(p>1&&v.focused));var j=a.data(document.body,"jqxgrid.edit");if(j!==undefined&&j!==""){if(F===13||x){if(j!=v.element.id){return true}}}}if(F==13||x){if(v.getselectedrowindex){var g=v.getselectedrowindex();switch(v.selectionmode){case"singlerow":case"multiplerows":case"multiplerowsextended":if(g>=0){var t="";for(var z=0;z<v.columns.records.length;z++){var e=v.getcolumnat(z);if(e.editable){t=e.datafield;break}}v.begincelledit(g,t)}break;case"singlecell":case"multiplecells":case"multiplecellsextended":var c=v.getselectedcell();if(c!=null){var e=v._getcolumnbydatafield(c.datafield);if(e.columntype!="checkbox"){v.begincelledit(c.rowindex,c.datafield)}}break;case"multiplecellsadvanced":var c=v.getselectedcell();if(c!=null){if(F==13){if(v.selectcell){if(c.rowindex+1<v.dataview.totalrecords){var d=this.getrowvisibleindex(c.rowindex);var E=this.dataview.loadedrecords[d+1];if(E){this.clearselection(false);this.selectcell(this.getboundindex(E),c.datafield);var c=this.getselectedcell();this.ensurecellvisible(E.visibleindex,c.datafield)}}}}else{if(v.editmode!=="selectedrow"){v.begincelledit(c.rowindex,c.datafield)}}}break}return false}}if(F==46){var f=v.getselectedcells();if(v.selectionmode.indexOf("cell")==-1){if(v._getcellsforcopypaste){f=v._getcellsforcopypaste()}}if(f!=null&&f.length>0){for(var o=0;o<f.length;o++){var c=f[o];if(!c.datafield){continue}var e=v.getcolumn(c.datafield);var C=v.getcellvalue(c.rowindex,c.datafield);if(C!==""&&e.editable&&v.enablekeyboarddelete){var i=null;if(e.columntype=="checkbox"){if(!e.threestatecheckbox){i=false}}if(e.cellbeginedit){var b=e.cellbeginedit(c.rowindex,e.datafield,e.columntype,i);if(b==false){return false}}v._raiseEvent(17,{rowindex:c.rowindex,datafield:c.datafield,value:C});if(o==f.length-1){v.setcellvalue(c.rowindex,c.datafield,i,true);if(e.displayfield!=e.datafield){v.setcellvalue(c.rowindex,e.displayfield,i,true)}}else{v.setcellvalue(c.rowindex,c.datafield,i,false);if(e.displayfield!=e.datafield){v.setcellvalue(c.rowindex,e.displayfield,i,true)}}if(e.cellendedit){var A=e.cellendedit(c.rowindex,e.datafield,e.columntype,i)}v._raiseEvent(18,{rowindex:c.rowindex,datafield:c.datafield,oldvalue:C,value:i})}}this.dataview.updateview();this._renderrows(this.virtualsizeinfo);return false}}if(F==32){var c=v.getselectedcell();if(c!=null){var e=v.getcolumn(c.datafield);if(e.columntype=="checkbox"&&e.editable){var l=!v.getcellvalue(c.rowindex,c.datafield);if(e.cellbeginedit){var b=e.cellbeginedit(c.rowindex,e.datafield,e.columntype,!l);if(b==false){return false}}v._raiseEvent(17,{rowindex:c.rowindex,datafield:c.datafield,value:!l,columntype:"checkbox"});v.setcellvalue(c.rowindex,c.datafield,l,true);v._raiseEvent(18,{rowindex:c.rowindex,datafield:c.datafield,oldvalue:!l,value:l,columntype:"checkbox"});return false}}}}return true},begincelledit:function(m,e,k,g,c){var f=this.getcolumn(e);this._cellscache=new Array();if(e==null){return}if(f.columntype=="number"||f.columntype=="button"){return}if(this.groupable){if(this.groups.indexOf(e)>=0){return}if(this.groups.indexOf(f.displayfield)>=0){return}}if(this.editrow!=undefined){return}if(this.editcell){if(this.editcell.row==m&&this.editcell.column==e){return true}if(this.editmode==="selectedrow"){if(this.editcell.row==m){return}}var d=this.endcelledit(this.editcell.row,this.editcell.column,false,true,false);if(false==d){return}}var h=f.columntype=="checkbox"||f.columntype=="button";this.host.removeClass("jqx-disableselect");this.content.removeClass("jqx-disableselect");if(f.editable){if(f.cellbeginedit){var j=this.getcell(m,e);var l=f.cellbeginedit(m,e,f.columntype,j!=null?j.value:null);if(l==false){return}}var i=this.getrowvisibleindex(m);this.editcell=this.getcell(m,e);if(this.editcell){this.editcell.visiblerowindex=i;if(!this.editcell.editing){if(!h){this.editcell.editing=true}this.editcell.columntype=f.columntype;this.editcell.defaultvalue=k;if(f.defaultvalue!=undefined){this.editcell.defaultvalue=f.defaultvalue}this.editcell.init=true;if(f.columntype!="checkbox"){this._raiseEvent(17,{rowindex:m,datafield:f.datafield,value:this.editcell.value,columntype:f.columntype})}a.data(document.body,"jqxgrid.edit",this.element.id);if(!h){var b=this.getrowvisibleindex(m);if(g!==false){this.ensurecellvisible(b,f.datafield)}if(c!==false){this._renderrows(this.virtualsizeinfo)}}if(this.editcell){this.editcell.init=false;return true}}}}else{if(!this.editcell){return}this.editcell.editor=null;this.editcell.editing=false;if(c!==false){this._renderrows(this.virtualsizeinfo)}this.editcell=null}},getScrollTop:function(){if(this._py){return pageYOffset}this._py=typeof pageYOffset!="undefined";if(this._py){return pageYOffset}else{var c=document.body;var b=document.documentElement;b=(b.clientHeight)?b:c;return b.scrollTop}},getScrollLeft:function(){if(typeof pageXOffset!="undefined"){return pageXOffset}else{var c=document.body;var b=document.documentElement;b=(b.clientHeight)?b:c;return b.scrollLeft}},endcelledit:function(g,m,i,e,n){if(g==undefined||m==undefined){if(this.editcell){g=this.editcell.row;m=this.editcell.column}if(i==undefined){i=true}}if(!this.editcell){return}var d=this.getcolumn(m);var t=this;if(t.editmode==="selectedrow"){this.endrowedit(g,i);return}var s=function(){if(n!=false){if(t.isTouchDevice()){return}if(!t.isNestedGrid){var u=t.getScrollTop();var w=t.getScrollLeft();try{t.element.focus();t.content.focus();if(u!=t.getScrollTop()){window.scrollTo(w,u)}setTimeout(function(){t.element.focus();t.content.focus();if(u!=t.getScrollTop()){window.scrollTo(w,u)}},10)}catch(v){}}}};if(d.columntype=="checkbox"||d.columntype=="button"){if(this.editcell){this.editcell.editor=null;this.editcell.editing=false;this.editcell=null}return true}var h=this._geteditorvalue(d);var f=function(v){v._hidecelleditor();if(d.cellendedit){d.cellendedit(g,m,d.columntype,v.editcell.value,h)}v.editchar=null;if(d.displayfield!=d.datafield){var u=v.getcellvalue(v.editcell.row,d.displayfield);var w=v.editcell.value;oldvalue={value:w,label:u}}else{oldvalue=v.editcell.value}v._raiseEvent(18,{rowindex:g,datafield:m,displayfield:d.displayfield,oldvalue:h,value:h,columntype:d.columntype});v.editcell.editor=null;v.editcell.editing=false;v.editcell=null;if(e||e==undefined){v._renderrows(v.virtualsizeinfo)}s();if(!v.enablebrowserselection){v.host.addClass("jqx-disableselect");v.content.addClass("jqx-disableselect")}};if(i){f(this);return false}if(this.validationpopup){this.validationpopup.hide();this.validationpopuparrow.hide()}if(d.cellvaluechanging){var b=d.cellvaluechanging(g,m,d.columntype,this.editcell.value,h);if(b!=undefined){h=b}}if(d.validation){var c=this.getcell(g,m);try{var o=d.validation(c,h);var k=this.gridlocalization.validationstring;if(o.message!=undefined){k=o.message}var l=typeof o=="boolean"?o:o.result;if(!l){if(o.showmessage==undefined||o.showmessage==true){this._showvalidationpopup(g,m,k)}this.editcell.validated=false;return false}}catch(q){this._showvalidationpopup(g,m,this.gridlocalization.validationstring);this.editcell.validated=false;return false}}if(d.displayfield!=d.datafield){var j=this.getcellvalue(this.editcell.row,d.displayfield);var p=this.editcell.value;oldvalue={value:p,label:j}}else{oldvalue=this.editcell.value}if(d.cellendedit){var r=d.cellendedit(g,m,d.columntype,this.editcell.value,h);if(r==false){this._raiseEvent(18,{rowindex:g,datafield:m,displayfield:d.displayfield,oldvalue:oldvalue,value:oldvalue,columntype:d.columntype});f(this);return false}}this._raiseEvent(18,{rowindex:g,datafield:m,displayfield:d.displayfield,oldvalue:oldvalue,value:h,columntype:d.columntype});this._hidecelleditor(false);if(this.editcell!=undefined){this.editcell.editor=null;this.editcell.editing=false}this.editcell=null;this.editchar=null;this.setcellvalue(g,m,h,e);if(!this.enablebrowserselection){this.host.addClass("jqx-disableselect");this.content.addClass("jqx-disableselect")}s();a.data(document.body,"jqxgrid.edit","");return true},beginrowedit:function(c){var b=this;var d=-1;this._cellscache=new Array();a.each(this.columns.records,function(f,g){if(b.editable&&this.editable){var e=b.getcell(c,this.datafield);b.begincelledit(c,this.datafield,null,false,false)}});if(b.editcell){b.editcell.init=true}this._renderrows(this.virtualsizeinfo)},endrowedit:function(k,n){var z=this;if(!this.editcell){return false}if(this.editcell.editor==undefined){return false}var y=function(){if(focus!=false){if(z.isTouchDevice()){return}if(!z.isNestedGrid){var i=z.getScrollTop();var B=z.getScrollLeft();try{z.element.focus();z.content.focus();if(i!=z.getScrollTop()){window.scrollTo(B,i)}setTimeout(function(){z.element.focus();z.content.focus();if(i!=z.getScrollTop()){window.scrollTo(B,i)}},10)}catch(A){}}}};var h=false;var d={};if(this.validationpopup){this.validationpopup.hide();this.validationpopuparrow.hide()}for(var x=0;x<this.columns.records.length;x++){var e=this.columns.records[x];if(!e.editable){continue}if(e.columntype=="checkbox"){continue}var l=this._geteditorvalue(e);var g=function(B){B._hidecelleditor();var A=B.getcellvalue(B.editcell.row,e.displayfield);if(e.cellendedit){e.cellendedit(k,r,e.columntype,A,l)}B.editchar=null;if(e.displayfield!=e.datafield){var i=B.getcellvalue(B.editcell.row,e.displayfield);var C=A;m={value:C,label:i}}else{m=A}B._raiseEvent(18,{rowindex:k,datafield:r,displayfield:e.displayfield,oldvalue:A,value:A,columntype:e.columntype});B.editcell.editing=false};if(n){g(this);continue}if(e.cellvaluechanging){var m=this.getcellvalue(this.editcell.row,e.displayfield);var b=e.cellvaluechanging(k,r,e.columntype,m,l);if(b!=undefined){l=b}}var r=e.datafield;if(e.validation){var c=this.getcell(k,e.datafield);try{var s=e.validation(c,l);var p=this.gridlocalization.validationstring;if(s.message!=undefined){p=s.message}var q=typeof s=="boolean"?s:s.result;if(!q){if(s.showmessage==undefined||s.showmessage==true){this._showvalidationpopup(k,r,p)}h=true;this.editcell[e.datafield].validated=false;continue}}catch(v){this._showvalidationpopup(k,r,this.gridlocalization.validationstring);this.editcell[e.datafield].validated=false;h=true;continue}}if(e.displayfield!=e.datafield){var o=this.getcellvalue(this.editcell.row,e.displayfield);var t=this.editcell.value;m={value:t,label:o}}else{m=this.getcellvalue(this.editcell.row,e.displayfield)}d[e.datafield]={newvalue:l,oldvalue:m}}var u={};if(!h){this._hidecelleditor(false);for(var x=0;x<this.columns.records.length;x++){var e=this.columns.records[x];var r=e.datafield;if(!e.editable){continue}if(e.columntype=="checkbox"){continue}if(!d[e.datafield]){continue}var l=d[e.datafield].newvalue;var m=d[e.datafield].oldvalue;if(e.cellendedit){var w=e.cellendedit(k,r,e.columntype,m,l);if(w==false){this._raiseEvent(18,{rowindex:k,datafield:r,displayfield:e.displayfield,oldvalue:m,value:m,columntype:e.columntype});g(this);continue}}this._raiseEvent(18,{rowindex:k,datafield:e.datafield,displayfield:e.displayfield,oldvalue:m,value:l,columntype:e.columntype});u[e.datafield]=l}var j=this.getrowid(k);var f=this.getrowdata(k);a.each(u,function(i,A){f[i]=A});if(!this.enablebrowserselection){this.host.addClass("jqx-disableselect");this.content.addClass("jqx-disableselect")}a.data(document.body,"jqxgrid.edit","");this.editcell=null;this.editchar=null;this.updaterow(j,f)}return h},_selection:function(b){if("selectionStart" in b[0]){var g=b[0];var h=g.selectionEnd-g.selectionStart;return{start:g.selectionStart,end:g.selectionEnd,length:h,text:g.value}}else{var d=document.selection.createRange();if(d==null){return{start:0,end:g.value.length,length:0}}var c=b[0].createTextRange();var f=c.duplicate();c.moveToBookmark(d.getBookmark());f.setEndPoint("EndToStart",c);var h=d.text.length;return{start:f.text.length,end:f.text.length+d.text.length,length:h,text:d.text}}},_setSelection:function(e,b,d){if("selectionStart" in d[0]){d[0].focus();d[0].setSelectionRange(e,b)}else{var c=d[0].createTextRange();c.collapse(true);c.moveEnd("character",b);c.moveStart("character",e);c.select()}},findRecordIndex:function(g,c,b){var b=b;if(c){var e=b.length;for(var h=0;h<e;h++){var f=b[h];var d=f.label;if(g==d){return h}}}return -1},_destroyeditors:function(){var b=this;a.each(this.columns.records,function(f,h){var c=a.trim(this.datafield).split(" ").join("");switch(this.columntype){case"dropdownlist":var g=b.editors["dropdownlist_"+c];if(g){g.jqxDropDownList("destroy");b.editors["dropdownlist_"+c]=null}break;case"combobox":var j=b.editors["combobox_"+c];if(j){j.jqxComboBox("destroy");b.editors["combobox_"+c]=null}break;case"datetimeinput":var d=b.editors["datetimeinput_"+this.datafield];if(d){d.jqxDateTimeInput("destroy");b.editors["datetimeinput_"+c]=null}break;case"numberinput":var e=b.editors["numberinput_"+c];if(e){e.jqxNumberInput("destroy");b.editors["numberinput_"+c]=null}break;case"custom":case"template":if(this.destroycustomeditor){this.destroycustomeditor(b.editors["customeditor_"+c]);b.editors["customeditor_"+c]=null}if(this.destrotemplateeditor){var l=b.getrows.length();for(var k=0;k<l;k++){this.destrotemplateeditor(b.editors["templateeditor_"+c+"_"+k]);b.editors["templateeditor_"+c+"_"+k]=null}}break}});b.editors=new Array()},_showcelleditor:function(q,G,n,J,w){if(n==undefined){return}if(this.editcell==null){return}if(G.columntype=="checkbox"&&G.editable){return}if(w==undefined){w=true}if(this.editmode=="selectedrow"){this.editchar="";w=false}var E=G.datafield;var g=a(n);var s=this;var d=this.editcell.editor;var H=this.getcellvalue(q,E);var C=this.getcelltext(q,E);var j=this.hScrollInstance;var t=j.value;var i=parseInt(t);var I=this.columns.records.indexOf(G);this.editcell.element=n;if(this.editcell.validated==false){this._showvalidationpopup()}var l=function(O){if(s.hScrollInstance.isScrolling()||s.vScrollInstance.isScrolling()){return}if(!w){return}if(s.isTouchDevice()){return}if(!s.isNestedGrid){O.focus()}if(s.gridcontent[0].scrollTop!=0){s.scrolltop(Math.abs(s.gridcontent[0].scrollTop));s.gridcontent[0].scrollTop=0}if(s.gridcontent[0].scrollLeft!=0){s.gridcontent[0].scrollLeft=0}};switch(G.columntype){case"dropdownlist":if(this.host.jqxDropDownList){n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");var A=a.trim(G.displayfield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}if(A.indexOf(".")!=-1){A=A.replace(".","")}var k=this.editors["dropdownlist_"+D];d=k==undefined?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='dropdownlisteditor'></div>"):k;d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(k==undefined){d.prependTo(this.table);d[0].id="dropdownlisteditor"+this.element.id+D;var f=this.source._source?true:false;var x=null;if(!f){x=new a.jqx.dataAdapter(this.source,{autoBind:false,uniqueDataFields:[A],async:false,autoSort:true,autoSortField:A})}else{var o={localdata:this.source.records,datatype:this.source.datatype,async:false};x=new a.jqx.dataAdapter(o,{autoBind:false,async:false,uniqueDataFields:[A],autoSort:true,autoSortField:A})}var u=!G.createeditor?true:false;d.jqxDropDownList({enableBrowserBoundsDetection:true,keyboardSelection:false,source:x,rtl:this.rtl,autoDropDownHeight:u,theme:this.theme,width:g.width()-2,height:g.height()-2,displayMember:A,valueMember:E});d.removeAttr("tabindex");d.find("div").removeAttr("tabindex");this.editors["dropdownlist_"+D]=d;if(G.createeditor){G.createeditor(q,H,d)}}if(G._requirewidthupdate){d.jqxDropDownList({width:g.width()-2})}var c=d.jqxDropDownList("listBox").visibleItems;if(!G.createeditor){if(c.length<8){d.jqxDropDownList("autoDropDownHeight",true)}else{d.jqxDropDownList("autoDropDownHeight",false)}}var H=this.getcellvalue(q,A);var z=this.findRecordIndex(H,A,c);if(J){if(H!=""){d.jqxDropDownList("selectIndex",z,true)}else{d.jqxDropDownList("selectIndex",-1)}}if(this.editcell.defaultvalue!=undefined){d.jqxDropDownList("selectIndex",this.editcell.defaultvalue,true)}if(w){d.jqxDropDownList("focus")}}break;case"combobox":if(this.host.jqxComboBox){n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");var A=a.trim(G.displayfield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}if(A.indexOf(".")!=-1){A=A.replace(".","")}var r=this.editors["combobox_"+D];d=r==undefined?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='comboboxeditor'></div>"):r;d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(r==undefined){d.prependTo(this.table);d[0].id="comboboxeditor"+this.element.id+D;var f=this.source._source?true:false;var x=null;if(!f){x=new a.jqx.dataAdapter(this.source,{autoBind:false,uniqueDataFields:[A],async:false,autoSort:true,autoSortField:A})}else{var o={localdata:this.source.records,datatype:this.source.datatype,async:false};x=new a.jqx.dataAdapter(o,{autoBind:false,async:false,uniqueDataFields:[A],autoSort:true,autoSortField:A})}var u=!G.createeditor?true:false;d.jqxComboBox({enableBrowserBoundsDetection:true,keyboardSelection:false,source:x,rtl:this.rtl,autoDropDownHeight:u,theme:this.theme,width:g.width()-2,height:g.height()-2,displayMember:A,valueMember:E});d.removeAttr("tabindex");d.find("div").removeAttr("tabindex");this.editors["combobox_"+D]=d;if(G.createeditor){G.createeditor(q,H,d)}}if(G._requirewidthupdate){d.jqxComboBox({width:g.width()-2})}var c=d.jqxComboBox("listBox").visibleItems;if(!G.createeditor){if(c.length<8){d.jqxComboBox("autoDropDownHeight",true)}else{d.jqxComboBox("autoDropDownHeight",false)}}var H=this.getcellvalue(q,A);var z=this.findRecordIndex(H,A,c);if(J){if(H!=""){d.jqxComboBox("selectIndex",z,true);d.jqxComboBox("val",H)}else{d.jqxComboBox("selectIndex",-1);d.jqxComboBox("val",H)}}if(this.editcell.defaultvalue!=undefined){d.jqxComboBox("selectIndex",this.editcell.defaultvalue,true)}if(this.editchar&&this.editchar.length>0){d.jqxComboBox("input").val(this.editchar)}if(w){setTimeout(function(){l(d.jqxComboBox("input"));d.jqxComboBox("_setSelection",0,0);if(s.editchar){d.jqxComboBox("_setSelection",1,1);s.editchar=null}else{var O=d.jqxComboBox("input").val();d.jqxComboBox("_setSelection",0,O.length)}},10)}}break;case"datetimeinput":if(this.host.jqxDateTimeInput){n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}var v=this.editors["datetimeinput_"+D];d=v==undefined?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='datetimeeditor'></div>"):v;d.show();d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(v==undefined){d.prependTo(this.table);d[0].id="datetimeeditor"+this.element.id+D;var F={calendar:this.gridlocalization};d.jqxDateTimeInput({enableBrowserBoundsDetection:true,localization:F,_editor:true,theme:this.theme,rtl:this.rtl,width:g.width(),height:g.height(),formatString:G.cellsformat});this.editors["datetimeinput_"+D]=d;if(G.createeditor){G.createeditor(q,H,d)}}if(G._requirewidthupdate){d.jqxDateTimeInput({width:g.width()-2})}if(J){if(H!=""&&H!=null){var K=new Date(H);if(K=="Invalid Date"){if(this.source.getvaluebytype){K=this.source.getvaluebytype(H,{name:G.datafield,type:"date"})}}d.jqxDateTimeInput("setDate",K)}else{d.jqxDateTimeInput("setDate",null)}if(this.editcell.defaultvalue!=undefined){d.jqxDateTimeInput("setDate",this.editcell.defaultvalue)}}if(w){setTimeout(function(){l(d.jqxDateTimeInput("dateTimeInput"))},10)}}break;case"numberinput":if(this.host.jqxNumberInput){n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}var M=this.editors["numberinput_"+D];d=M==undefined?a("<div style='border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='numbereditor'></div>"):M;d.show();d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(M==undefined){d.prependTo(this.table);d[0].id="numbereditor"+this.element.id+D;var m="";var y="left";var L=2;if(G.cellsformat){if(G.cellsformat.indexOf("c")!=-1){m=this.gridlocalization.currencysymbol;y=this.gridlocalization.currencysymbolposition;if(y=="before"){y="left"}else{y="right"}if(G.cellsformat.length>1){L=parseInt(G.cellsformat.substring(1),10)}}else{if(G.cellsformat.indexOf("p")!=-1){m=this.gridlocalization.percentsymbol;y="right";if(G.cellsformat.length>1){L=parseInt(G.cellsformat.substring(1),10)}}}}else{L=0}d.jqxNumberInput({decimalSeparator:this.gridlocalization.decimalseparator,decimalDigits:L,inputMode:"simple",theme:this.theme,rtl:this.rtl,width:g.width()-1,height:g.height()-1,spinButtons:true,symbol:m,symbolPosition:y});this.editors["numberinput_"+D]=d;if(G.createeditor){G.createeditor(q,H,d)}}if(G._requirewidthupdate){d.jqxNumberInput({width:g.width()-2})}if(J){if(H!=""&&H!=null){var N=H;d.jqxNumberInput("setDecimal",N)}else{d.jqxNumberInput("setDecimal",0)}if(this.editcell.defaultvalue!=undefined){d.jqxNumberInput("setDecimal",this.editcell.defaultvalue)}if(this.editchar&&this.editchar.length>0){var p=parseInt(this.editchar);if(!isNaN(p)){d.jqxNumberInput("setDecimal",p)}}if(w){setTimeout(function(){l(d.jqxNumberInput("numberInput"));d.jqxNumberInput("_setSelectionStart",0);if(s.editchar){if(G.cellsformat.length>0){d.jqxNumberInput("_setSelectionStart",2)}else{d.jqxNumberInput("_setSelectionStart",1)}s.editchar=null}else{var O=d.jqxNumberInput("spinButtons");if(O){var P=d.jqxNumberInput("numberInput").val();s._setSelection(d.jqxNumberInput("numberInput")[0],P.length,P.length)}else{var P=d.jqxNumberInput("numberInput").val();s._setSelection(d.jqxNumberInput("numberInput")[0],0,P.length)}}},10)}}}break;case"custom":n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}var B=this.editors["customeditor_"+D+"_"+q];d=B==undefined?a("<div style='overflow: hidden; border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='customeditor'></div>"):B;d.show();d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(B==undefined){d.prependTo(this.table);d[0].id="customeditor"+this.element.id+D+"_"+q;this.editors["customeditor_"+D+"_"+q]=d;var b=g.width()-1;var e=g.height()-1;d.width(b);d.height(e);if(G.createeditor){G.createeditor(q,H,d,C,b,e,this.editchar)}}if(G._requirewidthupdate){d.width(g.width()-2)}break;case"template":n.innerHTML="";var D=a.trim(G.datafield).split(" ").join("");if(D.indexOf(".")!=-1){D=D.replace(".","")}var h=this.editors["templateeditor_"+D];d=h==undefined?a("<div style='overflow: hidden; border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; z-index: 99999; top: 0px; left: 0px; position: absolute;' id='templateeditor'></div>"):h;d.show();d.css("top",a(n).parent().position().top);if(this.oldhscroll){d.css("left",-i+parseInt(a(n).position().left))}else{d.css("left",parseInt(a(n).position().left))}if(G.pinned){d.css("left",i+parseInt(a(n).position().left))}if(h==undefined){d.prependTo(this.table);d[0].id="templateeditor"+this.element.id+D;this.editors["templateeditor_"+D]=d;var b=g.width()-1;var e=g.height()-1;d.width(b);d.height(e);if(G.createeditor){G.createeditor(q,H,d,C,b,e,this.editchar)}}if(G._requirewidthupdate){d.width(g.width()-2)}break;case"textbox":default:n.innerHTML="";d=this.editors["textboxeditor_"+G.datafield]||a("<input autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' type='textbox' id='textboxeditor'/>");d[0].id="textboxeditor"+this.element.id+G.datafield;d.appendTo(g);if(this.rtl){d.css("direction","rtl")}if(J){d.addClass(this.toThemeProperty("jqx-input"));d.addClass(this.toThemeProperty("jqx-widget-content"));if(this.editchar&&this.editchar.length>0){d.val(this.editchar)}else{if(G.cellsformat!=""){H=this.getcelltext(q,E)}d.val(H)}if(this.editcell.defaultvalue!=undefined){d.val(this.editcell.defaultvalue)}d.width(g.width()+1);d.height(g.height()+1);if(G.createeditor){G.createeditor(q,H,d)}if(G.cellsformat!=""){if(G.cellsformat.indexOf("p")!=-1||G.cellsformat.indexOf("c")!=-1||G.cellsformat.indexOf("n")!=-1||G.cellsformat.indexOf("f")!=-1){if(!this.editors["textboxeditor_"+G.datafield]){d.keydown(function(P){var V=P.charCode?P.charCode:P.keyCode?P.keyCode:0;var S=String.fromCharCode(V);var T=parseInt(S);if(isNaN(T)){return true}if(s._selection(d).length>0){return true}var R="";var Q=d.val();if(G.cellsformat.length>1){var U=parseInt(G.cellsformat.substring(1));if(isNaN(U)){U=0}}else{var U=0}if(U>0){if(Q.indexOf(s.gridlocalization.decimalseparator)!=-1){if(s._selection(d).start>Q.indexOf(s.gridlocalization.decimalseparator)){return true}}}for(var W=0;W<Q.length-U;W++){var O=Q.substring(W,W+1);if(O.match(/^[0-9]+$/)!=null){R+=O}}if(R.length>=11){return false}})}}}}this.editors["textboxeditor_"+G.datafield]=d;if(J){if(w){setTimeout(function(){l(d);if(s.editchar){s._setSelection(d[0],1,1);s.editchar=null}else{s._setSelection(d[0],0,d.val().length)}},10)}}break}if(J){if(G.initeditor){G.initeditor(q,H,d,C,this.editchar)}}if(d){d[0].style.zIndex=1+n.style.zIndex;if(a.jqx.browser.msie&&a.jqx.browser.version<8){d[0].style.zIndex=1+this.columns.records.length+n.style.zIndex}d.css("display","block");this.editcell.editor=d;if(!this.editcell[E]){this.editcell[E]={};this.editcell[E].editor=d}else{this.editcell[E].editor=d}}if(s.isTouchDevice()){return}setTimeout(function(){if(s.content){s.content[0].scrollTop=0;s.content[0].scrollLeft=0}if(s.gridcontent){s.gridcontent[0].scrollLeft=0;s.gridcontent[0].scrollTop=0}},10)},_setSelection:function(d,g,b){try{if("selectionStart" in d){d.setSelectionRange(g,b)}else{var c=d.createTextRange();c.collapse(true);c.moveEnd("character",b);c.moveStart("character",g);c.select()}}catch(e){var f=e}},_hideeditors:function(){if(this.editcells!=null){var b=this;for(var c in this.editcells){b.editcell=b.editcells[c];b._hidecelleditor()}}},_hidecelleditor:function(b){if(!this.editcell){return}if(this.editmode==="selectedrow"){for(var c=0;c<this.columns.records.length;c++){var e=this.columns.records[c];if(this.editcell[e.datafield]&&this.editcell[e.datafield].editor){this.editcell[e.datafield].editor.hide();var d=this.editcell[e.datafield].editor;switch(e.columntype){case"dropdownlist":d.jqxDropDownList({closeDelay:0});d.jqxDropDownList("hideListBox");d.jqxDropDownList({closeDelay:300});break;case"combobox":d.jqxComboBox({closeDelay:0});d.jqxComboBox("hideListBox");d.jqxComboBox({closeDelay:300});break;case"datetimeinput":if(d.jqxDateTimeInput("isOpened")){d.jqxDateTimeInput({closeDelay:0});d.jqxDateTimeInput("hideCalendar");d.jqxDateTimeInput({closeDelay:300})}break}}}if(this.validationpopup){this.validationpopup.hide();this.validationpopuparrow.hide()}return}if(this.editcell.columntype=="checkbox"){return}if(this.editcell.editor){this.editcell.editor.hide();switch(this.editcell.columntype){case"dropdownlist":this.editcell.editor.jqxDropDownList({closeDelay:0});this.editcell.editor.jqxDropDownList("hideListBox");this.editcell.editor.jqxDropDownList({closeDelay:300});break;case"combobox":this.editcell.editor.jqxComboBox({closeDelay:0});this.editcell.editor.jqxComboBox("hideListBox");this.editcell.editor.jqxComboBox({closeDelay:300});break;case"datetimeinput":var f=this.editcell.editor;if(f.jqxDateTimeInput("isOpened")){f.jqxDateTimeInput({closeDelay:0});f.jqxDateTimeInput("hideCalendar");f.jqxDateTimeInput({closeDelay:300})}break}}if(this.validationpopup){this.validationpopup.hide();this.validationpopuparrow.hide()}if(!this.isNestedGrid){if(b!=false){this.element.focus()}}},_geteditorvalue:function(h){var n=new String();if(!this.editcell){return null}var k=this.editcell.editor;if(this.editmode=="selectedrow"){if(this.editcell[h.datafield]){var k=this.editcell[h.datafield].editor}}if(k){switch(h.columntype){case"textbox":default:n=k.val();if(h.cellsformat!=""){var m="string";var e=this.source.datafields||((this.source._source)?this.source._source.datafields:null);if(e){var o="";a.each(e,function(){if(this.name==h.displayfield){if(this.type){o=this.type}return false}});if(o){m=o}}var i=m==="number"||m==="float"||m==="int"||m==="integer";var f=m==="date"||m==="time";if(i||(m==="string"&&(h.cellsformat.indexOf("p")!=-1||h.cellsformat.indexOf("c")!=-1||h.cellsformat.indexOf("n")!=-1||h.cellsformat.indexOf("f")!=-1))){if(n===""&&h.nullable){return""}if(n.indexOf(this.gridlocalization.currencysymbol)>-1){n=n.replace(this.gridlocalization.currencysymbol,"")}var l=function(v,t,u){var r=v;if(t==u){return v}var s=r.indexOf(t);while(s!=-1){r=r.replace(t,u);s=r.indexOf(t)}return r};n=l(n,this.gridlocalization.thousandsseparator,"");n=n.replace(this.gridlocalization.decimalseparator,".");if(n.indexOf(this.gridlocalization.percentsymbol)>-1){n=n.replace(this.gridlocalization.percentsymbol,"")}var d="";for(var q=0;q<n.length;q++){var b=n.substring(q,q+1);if(b==="-"){d+="-"}if(b==="."){d+="."}if(b.match(/^[0-9]+$/)!=null){d+=b}}n=d;n=n.replace(/ /g,"");n=new Number(n);if(isNaN(n)){n=""}}if(f||(m==="string"&&(h.cellsformat.indexOf("H")!=-1||h.cellsformat.indexOf("m")!=-1||h.cellsformat.indexOf("M")!=-1||h.cellsformat.indexOf("y")!=-1||h.cellsformat.indexOf("h")!=-1||h.cellsformat.indexOf("d")!=-1))){if(n===""&&h.nullable){return""}var c=n;n=new Date(n);if(n=="Invalid Date"||n==null){if(a.jqx.dataFormat){n=a.jqx.dataFormat.tryparsedate(c,this.gridlocalization)}if(n=="Invalid Date"||n==null){n=""}}}}if(h.displayfield!=h.datafield){n={label:n,value:n}}break;case"datetimeinput":if(k.jqxDateTimeInput){k.jqxDateTimeInput({isEditing:false});k.jqxDateTimeInput("_validateValue");n=k.jqxDateTimeInput("getDate");if(n==null){return null}n=new Date(n.toString());if(h.displayfield!=h.datafield){n={label:n,value:n}}}break;case"dropdownlist":if(k.jqxDropDownList){var g=k.jqxDropDownList("selectedIndex");var p=k.jqxDropDownList("listBox").getVisibleItem(g);if(h.displayfield!=h.datafield){if(p){n={label:p.label,value:p.value}}else{n=""}}else{if(p){n=p.label}else{n=""}}if(n==null){n=""}}break;case"combobox":if(k.jqxComboBox){n=k.jqxComboBox("val");if(h.displayfield!=h.datafield){var p=k.jqxComboBox("getSelectedItem");if(p!=null){n={label:n,value:p.value}}}if(n==null){n=""}}break;case"numberinput":if(k.jqxNumberInput){if(this.touchdevice){k.jqxNumberInput("_doTouchHandling")}var j=k.jqxNumberInput("getDecimal");n=new Number(j);n=parseFloat(n);if(isNaN(n)){n=0}if(h.displayfield!=h.datafield){n={label:n,value:n}}}break}if(h.geteditorvalue){if(this.editmode=="selectedrow"){n=h.geteditorvalue(this.editcell.row,this.getcellvalue(this.editcell.row,h.datafield),k)}else{n=h.geteditorvalue(this.editcell.row,this.editcell.value,k)}}}return n},hidevalidationpopups:function(){if(this.popups){a.each(this.popups,function(){this.validation.remove();this.validationrow.remove()});this.popups=new Array()}if(this.validationpopup){this.validationpopuparrow.hide();this.validationpopup.hide()}},showvalidationpopup:function(o,d,p){if(p==undefined){var p=this.gridlocalization.validationstring}var n=a("<div style='z-index: 99999; top: 0px; left: 0px; position: absolute;'></div>");var m=a("<div style='width: 20px; height: 20px; z-index: 999999; top: 0px; left: 0px; position: absolute;'></div>");n.html(p);m.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));n.addClass(this.toThemeProperty("jqx-grid-validation"));n.addClass(this.toThemeProperty("jqx-rc-all"));n.prependTo(this.table);m.prependTo(this.table);var g=this.hScrollInstance;var i=g.value;var f=parseInt(i);var k=this.getcolumn(d).uielement;var j=a(this.hittestinfo[o].visualrow);n.css("top",parseInt(j.position().top)+30+"px");var b=parseInt(n.css("top"));m.css("top",b-12);m.removeClass();m.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));var e=false;if(b>=this._gettableheight()){m.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));m.addClass(this.toThemeProperty("jqx-grid-validation-arrow-down"));b=parseInt(j.position().top)-this.rowsheight-5;if(b<0){b=0;this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-down"));e=true}n.css("top",b+"px");m.css("top",b+n.outerHeight()-9)}var l=-f+parseInt(a(k).position().left);m.css("left",f+l+30);var c=n.width();if(c+l>this.host.width()-20){var h=c+l-this.host.width()+40;l-=h}if(!e){n.css("left",f+l)}else{n.css("left",f+parseInt(a(k).position().left)-n.outerWidth())}n.show();m.show();if(!this.popups){this.popups=new Array()}this.popups[this.popups.length]={validation:n,validationrow:m}},_showvalidationpopup:function(p,e,q){var k=this.editcell.editor;if(this.editmode=="selectedrow"){var c=this.editcell[e];if(c&&c.editor){k=c.editor;c.element=k}}if(!k){return}if(!this.validationpopup){var n=a("<div style='z-index: 99999; top: 0px; left: 0px; position: absolute;'></div>");var m=a("<div style='width: 20px; height: 20px; z-index: 999999; top: 0px; left: 0px; position: absolute;'></div>");n.html(q);m.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));n.addClass(this.toThemeProperty("jqx-grid-validation"));n.addClass(this.toThemeProperty("jqx-rc-all"));n.prependTo(this.table);m.prependTo(this.table);this.validationpopup=n;this.validationpopuparrow=m}else{this.validationpopup.html(q)}var h=this.hScrollInstance;var j=h.value;var g=parseInt(j);this.validationpopup.css("top",parseInt(a(this.editcell.element).parent().position().top)+(this.rowsheight+5)+"px");var b=parseInt(this.validationpopup.css("top"));this.validationpopuparrow.css("top",b-12);this.validationpopuparrow.removeClass();this.validationpopuparrow.addClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));var o=this._gettableheight();var f=false;if(b>=o){this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-up"));this.validationpopuparrow.addClass(this.toThemeProperty("jqx-grid-validation-arrow-down"));b=parseInt(a(this.editcell.element).parent().position().top)-this.rowsheight-5;if(b<0){b=0;this.validationpopuparrow.removeClass(this.toThemeProperty("jqx-grid-validation-arrow-down"));f=true}this.validationpopup.css("top",b+"px");this.validationpopuparrow.css("top",b+this.validationpopup.outerHeight()-9)}var l=-g+parseInt(a(k).position().left);this.validationpopuparrow.css("left",g+l+30);var d=this.validationpopup.width();if(d+l>this.host.width()-20){var i=d+l-this.host.width()+40;l-=i}if(!f){this.validationpopup.css("left",g+l)}else{this.validationpopup.css("left",g+parseInt(a(this.editcell.element).position().left)-this.validationpopup.outerWidth())}this.validationpopup.show();this.validationpopuparrow.show()}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.jqxWidget("jqxComboBox","",{});a.extend(a.jqx._jqxComboBox.prototype,{defineInstance:function(){this.disabled=false;this.width=200;this.height=25;this.items=new Array();this.selectedIndex=-1;this.selectedItems=new Array();this._selectedItems=new Array();this.source=null;this.scrollBarSize=a.jqx.utilities.scrollBarSize;this.arrowSize=18;this.enableHover=true;this.enableSelection=true;this.visualItems=new Array();this.groups=new Array();this.equalItemsWidth=true;this.itemHeight=-1;this.visibleItems=new Array();this.emptyGroupText="Group";this.emptyString="";if(this.openDelay==undefined){this.openDelay=250}if(this.closeDelay==undefined){this.closeDelay=300}this.animationType="default";this.dropDownWidth="auto";this.dropDownHeight="200px";this.autoDropDownHeight=false;this.enableBrowserBoundsDetection=false;this.dropDownHorizontalAlignment="left";this.searchMode="startswithignorecase";this.autoComplete=false;this.remoteAutoComplete=false;this.remoteAutoCompleteDelay=500;this.minLength=2;this.displayMember="";this.valueMember="";this.keyboardSelection=true;this.renderer=null;this.autoOpen=false;this.checkboxes=false;this.promptText="";this.placeHolder="";this.rtl=false;this.listBox=null;this.renderSelectedItem=null;this.search=null;this.popupZIndex=100000;this.searchString=null;this.multiSelect=false;this.showArrow=true;this.touchMode="auto";this.aria={"aria-disabled":{name:"disabled",type:"boolean"}};this.events=["open","close","select","unselect","change","checkChange","bindingComplete"]},createInstance:function(b){var c=this;this.host.attr("role","combobox");a.jqx.aria(this,"aria-autocomplete","both");if(a.jqx._jqxListBox==null||a.jqx._jqxListBox==undefined){throw new Error("jqxComboBox: Missing reference to jqxlistbox.js.")}a.jqx.aria(this);if(this.promptText!=""){this.placeHolder=this.promptText}this.render()},render:function(){this.removeHandlers();this.isanimating=false;this.id=a.jqx.utilities.createId();this.element.innerHTML="";var d=a("<div style='background-color: transparent; -webkit-appearance: none; outline: none; width:100%; height: 100%; padding: 0px; margin: 0px; border: 0px; position: relative;'><div id='dropdownlistWrapper' style='padding: 0; margin: 0; border: none; background-color: transparent; float: left; width:100%; height: 100%; position: relative;'><div id='dropdownlistContent' style='padding: 0; margin: 0; border-top: none; border-bottom: none; float: left; position: absolute;'/><div id='dropdownlistArrow' style='padding: 0; margin: 0; border-left-width: 1px; border-bottom-width: 0px; border-top-width: 0px; border-right-width: 0px; float: right; position: absolute;'/></div></div>");this.comboStructure=d;if(a.jqx._jqxListBox==null||a.jqx._jqxListBox==undefined){throw"jqxComboBox: Missing reference to jqxlistbox.js."}this.touch=a.jqx.mobile.isTouchDevice();if(this.touchMode===true){this.touch=true}this.host.append(d);this.dropdownlistWrapper=this.host.find("#dropdownlistWrapper");this.dropdownlistArrow=this.host.find("#dropdownlistArrow");this.dropdownlistContent=this.host.find("#dropdownlistContent");this.dropdownlistContent.addClass(this.toThemeProperty("jqx-combobox-content"));this.dropdownlistContent.addClass(this.toThemeProperty("jqx-widget-content"));this.dropdownlistWrapper[0].id="dropdownlistWrapper"+this.element.id;this.dropdownlistArrow[0].id="dropdownlistArrow"+this.element.id;this.dropdownlistContent[0].id="dropdownlistContent"+this.element.id;this.dropdownlistContent.append(a('<input autocomplete="off" style="margin: 0; padding: 0; border: 0;" type="textarea"/>'));this.input=this.dropdownlistContent.find("input");this.input.addClass(this.toThemeProperty("jqx-combobox-input"));this.input.addClass(this.toThemeProperty("jqx-widget-content"));this._addInput();if(this.rtl){this.input.css({direction:"rtl"});this.dropdownlistContent.addClass(this.toThemeProperty("jqx-combobox-content-rtl"))}try{var l="listBox"+this.id;var g=a(a.find("#"+l));if(g.length>0){g.remove()}a.jqx.aria(this,"aria-owns",l);a.jqx.aria(this,"aria-haspopup",true);a.jqx.aria(this,"aria-multiline",false);var b=a("<div style='overflow: hidden; border: none; background-color: transparent; position: absolute;' id='listBox"+this.id+"'><div id='innerListBox"+this.id+"'></div></div>");b.hide();b.appendTo(document.body);this.container=b;this.listBoxContainer=a(a.find("#innerListBox"+this.id));var c=this.width;if(this.dropDownWidth!="auto"){c=this.dropDownWidth}if(this.dropDownHeight==null){this.dropDownHeight=200}var j=this;this.container.width(parseInt(c)+25);this.container.height(parseInt(this.dropDownHeight)+25);this.addHandler(this.listBoxContainer,"bindingComplete",function(e){j._raiseEvent("6")});var h=true;this.listBoxContainer.jqxListBox({_checkForHiddenParent:false,checkboxes:this.checkboxes,emptyString:this.emptyString,renderer:this.renderer,rtl:this.rtl,itemHeight:this.itemHeight,selectedIndex:this.selectedIndex,incrementalSearch:false,width:c,scrollBarSize:this.scrollBarSize,autoHeight:this.autoDropDownHeight,height:this.dropDownHeight,displayMember:this.displayMember,valueMember:this.valueMember,source:this.source,theme:this.theme,rendered:function(){j.listBox=a.data(j.listBoxContainer[0],"jqxListBox").instance;if(j.remoteAutoComplete){if(j.autoDropDownHeight){j.container.height(j.listBox.virtualSize.height+25);j.listBoxContainer.height(j.listBox.virtualSize.height);j.listBox._arrange()}else{j.listBox._arrange();j.listBox.ensureVisible(0);j.listBox._renderItems();j.container.height(j.listBoxContainer.height()+25)}if(j.searchString!=undefined&&j.searchString.length>=j.minLength){var e=j.listBoxContainer.jqxListBox("items");if(e){if(e.length>0){if(!j.isOpened()){j.open()}}else{j.close()}}else{j.close()}}else{j.close()}}else{j.renderSelection("mouse");if(j.multiSelect){j.doMultiSelect(false)}}if(j.rendered){j.rendered()}}});this.listBoxContainer.css({position:"absolute",zIndex:this.popupZIndex,top:0,left:0});this.listBoxContainer.css("border-top-width","1px");this.listBoxContainer.addClass(this.toThemeProperty("jqx-popup"));if(a.jqx.browser.msie){this.listBoxContainer.addClass(this.toThemeProperty("jqx-noshadow"))}this.listBox=a.data(this.listBoxContainer[0],"jqxListBox").instance;this.listBox.enableSelection=this.enableSelection;this.listBox.enableHover=this.enableHover;this.listBox.equalItemsWidth=this.equalItemsWidth;this.listBox._arrange();this.addHandler(this.listBoxContainer,"unselect",function(e){if(!j.multiSelect){j._raiseEvent("3",{index:e.args.index,type:e.args.type,item:e.args.item})}});this.addHandler(this.listBoxContainer,"change",function(e){if(!j.multiSelect){j._raiseEvent("4",{index:e.args.index,type:e.args.type,item:e.args.item})}});if(this.animationType=="none"){this.container.css("display","none")}else{this.container.hide()}h=false}catch(i){}var m=this;m.input.attr("disabled",m.disabled);var f=a.jqx.browser.msie&&a.jqx.browser.version<8;if(!f){m.input.attr("placeholder",m.placeHolder)}this.propertyChangeMap.disabled=function(e,o,n,p){if(p){e.host.addClass(m.toThemeProperty("jqx-combobox-state-disabled"));e.host.addClass(m.toThemeProperty("jqx-fill-state-disabled"));e.dropdownlistContent.addClass(m.toThemeProperty("jqx-combobox-content-disabled"))}else{e.host.removeClass(m.toThemeProperty("jqx-combobox-state-disabled"));e.host.removeClass(m.toThemeProperty("jqx-fill-state-disabled"));e.dropdownlistContent.removeClass(m.toThemeProperty("jqx-combobox-content-disabled"))}e.input.attr("disabled",e.disabled);a.jqx.aria(e,"aria-disabled",e.disabled);e.input.attr("disabled",m.disabled)};if(this.disabled){this.host.addClass(this.toThemeProperty("jqx-combobox-state-disabled"));this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"));this.dropdownlistContent.addClass(this.toThemeProperty("jqx-combobox-content-disabled"))}this.host.addClass(this.toThemeProperty("jqx-combobox-state-normal"));this.host.addClass(this.toThemeProperty("jqx-combobox"));this.host.addClass(this.toThemeProperty("jqx-rc-all"));this.host.addClass(this.toThemeProperty("jqx-widget"));this.host.addClass(this.toThemeProperty("jqx-widget-content"));this.dropdownlistArrowIcon=a("<div></div>");this.dropdownlistArrowIcon.addClass(this.toThemeProperty("jqx-icon-arrow-down"));this.dropdownlistArrowIcon.addClass(this.toThemeProperty("jqx-icon"));this.dropdownlistArrow.append(this.dropdownlistArrowIcon);this.dropdownlistArrow.addClass(this.toThemeProperty("jqx-combobox-arrow-normal"));this.dropdownlistArrow.addClass(this.toThemeProperty("jqx-fill-state-normal"));if(!this.rtl){this.dropdownlistArrow.addClass(this.toThemeProperty("jqx-rc-r"))}else{this.dropdownlistArrow.addClass(this.toThemeProperty("jqx-rc-l"))}this._setSize();this._updateHandlers();this.addHandler(this.input,"keyup.textchange",function(e){var n=j._search(e);if(j.cinput&&j.input){j.cinput[0].value=j.input[0].value}});if(a.jqx.browser.msie&&a.jqx.browser.version<8){if(this.host.parents(".jqx-window").length>0){var k=this.host.parents(".jqx-window").css("z-index");b.css("z-index",k+10);this.listBoxContainer.css("z-index",k+10)}}if(this.checkboxes){this.input.attr("readonly",true);a.jqx.aria(this,"aria-readonly",true)}else{a.jqx.aria(this,"aria-readonly",false)}if(!this.remoteAutoComplete){this.searchString=""}},_addInput:function(){var b=this.host.attr("name");if(!b){b=this.element.id}this.cinput=a("<input type='hidden'/>");this.host.append(this.cinput);this.cinput.attr("name",b)},_updateInputSelection:function(){if(this.cinput){if(this.selectedIndex==-1){this.cinput.val("")}else{var d=this.getSelectedItem();if(d!=null){this.cinput.val(d.value)}else{this.cinput.val(this.dropdownlistContent.text())}}if(this.checkboxes||this.multiSelect){if(!this.multiSelect){var b=this.getCheckedItems()}else{var b=this.getSelectedItems()}var e="";if(b!=null){for(var c=0;c<b.length;c++){if(c==b.length-1){e+=b[c].value}else{e+=b[c].value+","}}}this.cinput.val(e)}}},_search:function(m){if(m.keyCode==9){return}if(this.searchMode=="none"||this.searchMode==null||this.searchMode=="undefined"){return}if(m.keyCode==16||m.keyCode==17||m.keyCode==20){return false}if(this.checkboxes){return false}if(this.multiSelect){var n=a("<span style='visibility: hidden; white-space: nowrap;'>"+this.input.val()+"</span>");n.addClass(this.toThemeProperty("jqx-widget"));a(document.body).append(n);var j=n.width()+15;n.remove();if(j>this.host.width()){j=this.host.width()}if(j<25){j=25}this.input.css("width",j+"px");var f=parseInt(this._findPos(this.host[0])[1])+parseInt(this.host.outerHeight())-1+"px";var o=a.jqx.mobile.isSafariMobileBrowser()||a.jqx.mobile.isWindowsPhone();var c=a.jqx.utilities.hasTransform(this.host);if(c||(o!=null&&o)){f=a.jqx.mobile.getTopPos(this.element)+parseInt(this.host.outerHeight());if(a("body").css("border-top-width")!="0px"){f=parseInt(f)-this._getBodyOffset().top+"px"}}this.container.css("top",f);var i=parseInt(this.host.height());this.dropdownlistArrow.height(i)}if(!this.isanimating){if(m.altKey&&m.keyCode==38){this.hideListBox("altKey");return false}if(m.altKey&&m.keyCode==40){if(!this.isOpened()){this.showListBox("altKey")}return false}}if(m.keyCode==37||m.keyCode==39){return false}if(m.altKey||m.keyCode==18){return}if(m.keyCode>=33&&m.keyCode<=40){return}if(m.ctrlKey||this.ctrlKey){return}var l=this.input.val();if(l.length==0&&!this.autoComplete){this.listBox.searchString=this.input.val();this.hideListBox("search");this.searchString=this.input.val();return}if(this.remoteAutoComplete){var s=this;var p=function(){s.listBox.vScrollInstance.value=0};if(l.length>=s.minLength){if(!m.ctrlKey&&!m.altKey){if(s.searchString!=l){var k=s.listBoxContainer.jqxListBox("source");if(k==null){s.listBoxContainer.jqxListBox({source:s.source})}if(this._searchTimer){clearTimeout(this._searchTimer)}if(m.keyCode!=13&&m.keyCode!=27){this._searchTimer=setTimeout(function(){p();if(s.autoDropDownHeight){s.listBox.autoHeight=true}s.searchString=s.input.val();if(s.search!=null){s.search(s.input.val())}else{throw"'search' function is not defined"}},this.remoteAutoCompleteDelay)}}s.searchString=l}}else{if(this._searchTimer){clearTimeout(this._searchTimer)}p();s.searchString="";s.listBoxContainer.jqxListBox({source:null})}return}var s=this;if(l===s.searchString){return}if(!(m.keyCode=="27"||m.keyCode=="13")){var b=this._updateItemsVisibility(l);var e=b.matchItems;var d=b.index;if(!this.autoComplete&&!this.removeAutoComplete){if(!this.multiSelect||(this.multiSelect&&d>=0)){this.listBox.selectIndex(d);var r=this.listBox.isIndexInView(d);if(!r){this.listBox.ensureVisible(d)}else{this.listBox._renderItems()}}}if(this.autoComplete&&e.length===0){this.hideListBox("search")}}if(m.keyCode=="13"){var g=this.container.css("display")=="block";if(g&&!this.isanimating){this.hideListBox("keyboard");this._oldvalue=this.listBox.selectedValue;return}}else{if(m.keyCode=="27"){var g=this.container.css("display")=="block";if(g&&!this.isanimating){if(!h.multiSelect){var q=this.listBox.getVisibleItem(this._oldvalue);if(q){var h=this;setTimeout(function(){if(h.autoComplete){h._updateItemsVisibility("")}h.listBox.selectIndex(q.index);h.renderSelection("api")},h.closeDelay)}else{this.clearSelection()}}else{h.input.val("");h.listBox.selectedValue=null}this.hideListBox("keyboard");this.renderSelection("api");m.preventDefault();return false}}else{if(!this.isOpened()&&!this.opening&&!m.ctrlKey){if(this.listBox.visibleItems&&this.listBox.visibleItems.length>0){if(this.input.val()!=this.searchString&&this.searchString!=undefined&&d!=-1){this.showListBox("search")}}}this.searchString=this.input.val();if(this.searchString==""){d=-1}var q=this.listBox.getVisibleItem(d);if(q!=undefined){this._updateInputSelection()}}}},val:function(c){if(!this.input){return""}if(typeof c==="object"||arguments.length==0){var b=this.getSelectedItem();if(b){return b.value}return this.input.val()}else{var b=this.getItemByValue(c);if(b!=null){this.selectItem(b)}else{this.input.val(c)}return this.input.val()}},focus:function(){var c=this;var b=function(){c.input.focus();var d=c.input.val();c._setSelection(0,d.length)};b();setTimeout(function(){b()},10)},_setSelection:function(e,b){try{if("selectionStart" in this.input[0]){this.input[0].focus();this.input[0].setSelectionRange(e,b)}else{var c=this.input[0].createTextRange();c.collapse(true);c.moveEnd("character",b);c.moveStart("character",e);c.select()}}catch(d){}},setContent:function(b){this.input.val(b)},_updateItemsVisibility:function(l){var i=this.getItems();if(i==undefined){return{index:-1,matchItem:new Array()}}var j=this;var g=-1;var m=new Array();var k=0;a.each(i,function(p){var r="";if(!this.isGroup){if(this.label){r=this.label}else{if(this.value){r=this.value}else{if(this.title){r=this.title}else{r="jqxItem"}}}var q=false;switch(j.searchMode){case"containsignorecase":q=a.jqx.string.containsIgnoreCase(r,l);break;case"contains":q=a.jqx.string.contains(r,l);break;case"equals":q=a.jqx.string.equals(r,l);break;case"equalsignorecase":q=a.jqx.string.equalsIgnoreCase(r,l);break;case"startswith":q=a.jqx.string.startsWith(r,l);break;case"startswithignorecase":q=a.jqx.string.startsWithIgnoreCase(r,l);break;case"endswith":q=a.jqx.string.endsWith(r,l);break;case"endswithignorecase":q=a.jqx.string.endsWithIgnoreCase(r,l);break}if(j.autoComplete&&!q){this.visible=false}if(q&&j.autoComplete){m[k++]=this;this.visible=true;g=this.visibleIndex}if(l==""&&j.autoComplete){this.visible=true;q=false}if(j.multiSelect){this.disabled=false;if(j.selectedItems.indexOf(this.value)>=0){this.disabled=true;q=false}}if(!j.multiSelect){if(q&&!j.autoComplete){g=this.visibleIndex;return false}}else{if(q&&!j.autoComplete){if(g===-1){g=this.visibleIndex}return true}}}});this.listBox.searchString=l;var f=this;var h=function(){if(!f.multiSelect){return}var p=0;var s=false;var r=null;for(var q=0;q<f.listBox.items.length;q++){f.listBox.selectedIndexes[q]=-1;if(!f.listBox.items[q].disabled){if(s==false){r=f.listBox.items[q];p=r.visibleIndex;s=true}}}f.listBox.selectedIndex=-1;f.listBox.selectedIndex=p;f.listBox.selectedIndexes[p]=p;if(f.listBox.visibleItems.length>0){if(r){f.listBox.selectedValue=r.value}else{f.listBox.selectedValue=null}}else{f.listBox.selectedValue=null}f.listBox.ensureVisible(0)};if(!this.autoComplete){h();return{index:g,matchItems:m}}this.listBox.renderedVisibleItems=new Array();var b=this.listBox.vScrollInstance.value;this.listBox.vScrollInstance.value=0;this.listBox.visibleItems=new Array();this.listBox._renderItems();var e=this.listBox.selectedValue;var o=this.listBox.getItemByValue(e);if(!this.multiSelect){if(o){if(o.visible){this.listBox.selectedIndex=o.visibleIndex;for(var d=0;d<this.listBox.items.length;d++){this.listBox.selectedIndexes[d]=-1}this.listBox.selectedIndexes[o.visibleIndex]=o.visibleIndex}else{for(var d=0;d<this.listBox.items.length;d++){this.listBox.selectedIndexes[d]=-1}this.listBox.selectedIndex=-1}}}else{h()}this.listBox._renderItems();var n=this.listBox._calculateVirtualSize().height;if(n<b){b=0;this.listBox.vScrollInstance.refresh()}if(this.autoDropDownHeight){this._disableSelection=true;if(this.listBox.autoHeight!=this.autoDropDownHeight){this.listBoxContainer.jqxListBox({autoHeight:this.autoDropDownHeight})}this.container.height(n+25);this.listBox.invalidate();this._disableSelection=false}else{if(n<parseInt(this.dropDownHeight)){var c=this.listBox.hScrollBar[0].style.visibility=="hidden"?0:20;this.listBox.height=c+n;this.container.height(n+25+c);this.listBox.invalidate()}else{this.listBox.height=parseInt(this.dropDownHeight);this.container.height(parseInt(this.dropDownHeight)+25);this.listBox.invalidate()}}this.listBox.vScrollInstance.setPosition(b);return{index:g,matchItems:m}},findItems:function(e){var b=this.getItems();var d=this;var c=0;var f=new Array();a.each(b,function(g){var j="";if(!this.isGroup){if(this.label){j=this.label}else{if(this.value){j=this.value}else{if(this.title){j=this.title}else{j="jqxItem"}}}var h=false;switch(d.searchMode){case"containsignorecase":h=a.jqx.string.containsIgnoreCase(j,e);break;case"contains":h=a.jqx.string.contains(j,e);break;case"equals":h=a.jqx.string.equals(j,e);break;case"equalsignorecase":h=a.jqx.string.equalsIgnoreCase(j,e);break;case"startswith":h=a.jqx.string.startsWith(j,e);break;case"startswithignorecase":h=a.jqx.string.startsWithIgnoreCase(j,e);break;case"endswith":h=a.jqx.string.endsWith(j,e);break;case"endswithignorecase":h=a.jqx.string.endsWithIgnoreCase(j,e);break}if(h){f[c++]=this}}});return f},_resetautocomplete:function(){a.each(this.listBox.items,function(b){this.visible=true});this.listBox.vScrollInstance.value=0;this.listBox._addItems();this.listBox.autoHeight=false;this.listBox.height=this.dropDownHeight;this.container.height(parseInt(this.dropDownHeight)+25);this.listBoxContainer.height(parseInt(this.dropDownHeight));this.listBox._arrange();this.listBox._addItems();this.listBox._renderItems()},getItems:function(){var b=this.listBox.items;return b},getVisibleItems:function(){return this.listBox.getVisibleItems()},_setSize:function(){if(this.width!=null&&this.width.toString().indexOf("px")!=-1){this.host.width(this.width)}else{if(this.width!=undefined&&!isNaN(this.width)){this.host.width(this.width)}}if(this.height!=null&&this.height.toString().indexOf("px")!=-1){this.host.height(this.height)}else{if(this.height!=undefined&&!isNaN(this.height)){this.host.height(this.height)}}var e=false;if(this.width!=null&&this.width.toString().indexOf("%")!=-1){e=true;this.host.width(this.width)}if(this.height!=null&&this.height.toString().indexOf("%")!=-1){e=true;this.host.height(this.height)}if(e){var c=this;var b=this.host.width();if(this.dropDownWidth!="auto"){b=this.dropDownWidth}this.listBoxContainer.jqxListBox({width:b});this.container.width(parseInt(b)+25);this._arrange()}var d=function(){if(c.multiSelect){c.host.height(c.height)}c._arrange();if(c.multiSelect){c.host.height("auto")}if(c.dropDownWidth=="auto"){var f=c.host.width();c.listBoxContainer.jqxListBox({width:f});c.container.width(parseInt(f)+25)}};a.jqx.utilities.resize(this.host,function(){d()})},isOpened:function(){var c=this;var b=a.data(document.body,"openedComboJQXListBox"+this.element.id);if(this.container.css("display")!="block"){return false}if(b!=null&&b==c.listBoxContainer){return true}return false},_updateHandlers:function(){var d=this;var e=false;this.removeHandlers();if(this.multiSelect){this.addHandler(this.dropdownlistContent,"click",function(f){if(f.target.href){return false}d.input.focus();setTimeout(function(){d.input.focus()},10)});this.addHandler(this.dropdownlistContent,"focus",function(f){if(f.target.href){return false}d.input.focus();setTimeout(function(){d.input.focus()},10)})}if(!this.touch){if(this.host.parents()){this.addHandler(this.host.parents(),"scroll.combobox"+this.element.id,function(f){var g=d.isOpened();if(g){d.close()}})}this.addHandler(this.host,"mouseenter",function(){if(!d.disabled&&d.enableHover){e=true;d.host.addClass(d.toThemeProperty("jqx-combobox-state-hover"));d.dropdownlistArrowIcon.addClass(d.toThemeProperty("jqx-icon-arrow-down-hover"));d.dropdownlistArrow.addClass(d.toThemeProperty("jqx-combobox-arrow-hover"));d.dropdownlistArrow.addClass(d.toThemeProperty("jqx-fill-state-hover"))}});this.addHandler(this.host,"mouseleave",function(){if(!d.disabled&&d.enableHover){d.host.removeClass(d.toThemeProperty("jqx-combobox-state-hover"));d.dropdownlistArrowIcon.removeClass(d.toThemeProperty("jqx-icon-arrow-down-hover"));d.dropdownlistArrow.removeClass(d.toThemeProperty("jqx-combobox-arrow-hover"));d.dropdownlistArrow.removeClass(d.toThemeProperty("jqx-fill-state-hover"));e=false}})}if(d.autoOpen){this.addHandler(this.host,"mouseenter",function(){var f=d.isOpened();if(!f&&d.autoOpen){d.open();d.host.focus()}});this.addHandler(a(document),"mousemove."+d.id,function(i){var h=d.isOpened();if(h&&d.autoOpen){var m=d.host.coord();var l=m.top;var k=m.left;var j=d.container.coord();var f=j.left;var g=j.top;canClose=true;if(i.pageY>=l&&i.pageY<=l+d.host.height()+2){if(i.pageX>=k&&i.pageX<k+d.host.width()){canClose=false}}if(i.pageY>=g&&i.pageY<=g+d.container.height()-20){if(i.pageX>=f&&i.pageX<f+d.container.width()){canClose=false}}if(canClose){d.close()}}})}var c="mousedown";if(this.touch){c=a.jqx.mobile.getTouchEventName("touchstart")}var b=function(h){if(!d.disabled){var f=d.container.css("display")=="block";if(!d.isanimating){if(f){d.hideListBox("api");if(!a.jqx.mobile.isTouchDevice()){d.input.focus();setTimeout(function(){d.input.focus()},10)}return false}else{if(d.autoDropDownHeight){d.container.height(d.listBoxContainer.height()+25);var g=d.listBoxContainer.jqxListBox("autoHeight");if(!g){d.listBoxContainer.jqxListBox({autoHeight:d.autoDropDownHeight});d.listBox._arrange();d.listBox.ensureVisible(0);d.listBox._renderItems();d.container.height(d.listBoxContainer.height()+25)}}d.showListBox("api");if(!a.jqx.mobile.isTouchDevice()){d.focus()}else{return false}}}}};this.addHandler(this.dropdownlistArrow,c,function(f){b(f);return false});this.addHandler(this.dropdownlistArrowIcon,c,function(f){b(f);return false});this.addHandler(this.host,"focus",function(){d.focus()});this.addHandler(this.input,"focus",function(f){d.focused=true;d.host.addClass(d.toThemeProperty("jqx-combobox-state-focus"));d.host.addClass(d.toThemeProperty("jqx-fill-state-focus"));d.dropdownlistContent.addClass(d.toThemeProperty("jqx-combobox-content-focus"));if(f.stopPropagation){f.stopPropagation()}if(f.preventDefault){f.preventDefault()}return false});this.addHandler(this.input,"blur",function(){d.focused=false;if(!d.isOpened()&&!d.opening){d.host.removeClass(d.toThemeProperty("jqx-combobox-state-focus"));d.host.removeClass(d.toThemeProperty("jqx-fill-state-focus"));d.dropdownlistContent.removeClass(d.toThemeProperty("jqx-combobox-content-focus"))}if(d._searchTimer){clearTimeout(d._searchTimer)}});this.addHandler(a(document),"mousedown."+this.id,d.closeOpenedListBox,{me:this,listbox:this.listBox,id:this.id});if(this.touch){this.addHandler(a(document),a.jqx.mobile.getTouchEventName("touchstart")+"."+this.id,d.closeOpenedListBox,{me:this,listbox:this.listBox,id:this.id})}this.addHandler(this.host,"keydown",function(k){var h=d.container.css("display")=="block";d.ctrlKey=k.ctrlKey;if(d.host.css("display")=="none"){return true}if(k.keyCode=="13"||k.keyCode=="9"){if(h&&!d.isanimating){if(d.listBox.selectedIndex!=-1){d.renderSelection("mouse");var f=d.listBox.selectedIndex;var j=d.listBox.getVisibleItem(f);if(j){d.listBox.selectedValue=j.value}d._setSelection(d.input.val().length,d.input.val().length);d.hideListBox("keyboard")}if(k.keyCode=="13"){d._oldvalue=d.listBox.selectedValue}if(!d.keyboardSelection){d._raiseEvent("2",{index:d.selectedIndex,type:"keyboard",item:d.getItem(d.selectedIndex)})}if(k.keyCode=="9"){return true}return false}}if(k.keyCode==115){if(!d.isanimating){if(!d.isOpened()){d.showListBox("keyboard")}else{if(d.isOpened()){d.hideListBox("keyboard")}}}return false}if(k.altKey){if(d.host.css("display")=="block"){if(!d.isanimating){if(k.keyCode==38){if(d.isOpened()){d.hideListBox("altKey")}}else{if(k.keyCode==40){if(!d.isOpened()){d.showListBox("altKey")}}}}}}if(k.keyCode=="27"||k.keyCode=="9"){if(d.isOpened()&&!d.isanimating){if(k.keyCode=="27"){if(!d.multiSelect){var j=d.listBox.getVisibleItem(d._oldvalue);if(j){setTimeout(function(){if(d.autoComplete){d._updateItemsVisibility("")}d.listBox.selectIndex(j.index);d.renderSelection("api")},d.closeDelay)}else{d.clearSelection()}}else{d.listBox.selectedValue=null;d.input.val("")}}d.hideListBox("keyboard");if(k.keyCode=="9"){return true}d.renderSelection("api");k.preventDefault();return false}}var g=k.keyCode;if(h&&!d.disabled&&g!=8){return d.listBox._handleKeyDown(k)}else{if(!d.disabled&&!h){var g=k.keyCode;if(g==33||g==34||g==35||g==36||g==38||g==40){return d.listBox._handleKeyDown(k)}}}if(g===8&&d.multiSelect){if(d.input.val().length===0){var i=d.selectedItems[d.selectedItems.length-1];d.selectedItems.pop();d._selectedItems.pop();if(i){d._raiseEvent("3",{index:i.index,type:"keyboard",item:i});d._raiseEvent("4",{index:i.index,type:"keyboard",item:i})}d.listBox.selectedValue=null;d.doMultiSelect();return false}}});this.addHandler(this.listBoxContainer,"checkChange",function(f){d.renderSelection("mouse");d._updateInputSelection();d._raiseEvent(5,{label:f.args.label,value:f.args.value,checked:f.args.checked,item:f.args.item})});this.addHandler(this.listBoxContainer,"select",function(f){if(!d.disabled){if(f.args.type!="keyboard"||d.keyboardSelection){d.renderSelection(f.args.type);if(!d.multiSelect){d._raiseEvent("2",{index:f.args.index,type:f.args.type,item:f.args.item})}if(f.args.type=="mouse"){d._oldvalue=d.listBox.selectedValue;if(!d.checkboxes){d.hideListBox("mouse");if(!d.touch){d.input.focus()}else{return false}}}}}});if(this.listBox!=null&&this.listBox.content!=null){this.addHandler(this.listBox.content,"click",function(f){if(!d.disabled){if(d.listBox.itemswrapper){if(f.target===d.listBox.itemswrapper[0]){return true}}if(f.target&&f.target.className){if(f.target.className.indexOf("jqx-fill-state-disabled")>=0){return true}}d.renderSelection("mouse");d._oldvalue=d.listBox.selectedValue;if(!d.touch&&!d.ishiding){if(!d.checkboxes){d.hideListBox("mouse");d.input.focus()}}if(d.touch===true){if(!d.checkboxes){d.hideListBox("mouse")}}}})}},removeHandlers:function(){var c=this;if(this.dropdownlistWrapper!=null){this.removeHandler(this.dropdownlistWrapper,"mousedown")}if(this.dropdownlistContent){this.removeHandler(this.dropdownlistContent,"click");this.removeHandler(this.dropdownlistContent,"focus")}this.removeHandler(this.host,"keydown");this.removeHandler(this.host,"focus");if(this.input!=null){this.removeHandler(this.input,"focus");this.removeHandler(this.input,"blur")}this.removeHandler(this.host,"mouseenter");this.removeHandler(this.host,"mouseleave");this.removeHandler(a(document),"mousemove."+c.id);if(this.listBoxContainer){this.removeHandler(this.listBoxContainer,"checkChange");this.removeHandler(this.listBoxContainer,"select")}if(this.dropdownlistArrowIcon&&this.dropdownlistArrow){var b="mousedown";if(this.touch){b=a.jqx.mobile.getTouchEventName("touchstart")}this.removeHandler(this.dropdownlistArrowIcon,b);this.removeHandler(this.dropdownlistArrow,b)}},getItem:function(b){var c=this.listBox.getItem(b);return c},getItemByValue:function(c){var b=this.listBox.getItemByValue(c);return b},getVisibleItem:function(b){var c=this.listBox.getVisibleItem(b);return c},renderSelection:function(j){if(j==undefined||j=="none"){return}if(this._disableSelection===true){return}if(this.listBox==null){return}if(this.multiSelect){return}var k=this.listBox.visibleItems[this.listBox.selectedIndex];if(this.autoComplete&&!this.checkboxes){if(this.listBox.selectedValue!==undefined){var k=this.getItemByValue(this.listBox.selectedValue)}}if(this.checkboxes){var f=this.getCheckedItems();if(f!=null&&f.length>0){k=f[0]}else{k=null}}if(k==null){var d=a.jqx.browser.msie&&a.jqx.browser.version<8;this.input.val("");if(!d){this.input.attr("placeholder",this.placeHolder)}this._updateInputSelection();return}this.selectedIndex=this.listBox.selectedIndex;var c=a("<span></span>");if(k.label!=undefined&&k.label!=null&&k.label.toString().length>0){a.jqx.utilities.html(c,k.label)}else{if(k.value!=undefined&&k.value!=null&&k.value.toString().length>0){a.jqx.utilities.html(c,k.value)}else{if(k.title!=undefined&&k.title!=null&&k.title.toString().length>0){a.jqx.utilities.html(c,k.title)}else{a.jqx.utilities.html(c,this.emptyString)}}}var b=c.outerHeight();if(this.checkboxes){var g=this.getCheckedItems();var h="";for(var e=0;e<g.length;e++){if(e==g.length-1){h+=g[e].label}else{h+=g[e].label+", "}}this.input.val(h)}else{this.input.val(c.text())}c.remove();if(this.renderSelectedItem){var l=this.renderSelectedItem(this.listBox.selectedIndex,k);if(l!=undefined){this.input.val(l)}}this._updateInputSelection();if(this.listBox&&this.listBox._activeElement){a.jqx.aria(this,"aria-activedescendant",this.listBox._activeElement.id)}},dataBind:function(){this.listBoxContainer.jqxListBox({source:this.source});this.renderSelection("mouse");if(this.source==null){this.clearSelection()}},clear:function(){this.listBoxContainer.jqxListBox({source:null});this.clearSelection()},clearSelection:function(b){this.selectedIndex=-1;this.listBox.clearSelection();this.input.val("");if(this.multiSelect){this.selectedItems=new Array();this._selectedItems=new Array();this.doMultiSelect(false)}},unselectIndex:function(b,c){if(isNaN(b)){return}this.listBox.unselectIndex(b,c);this.renderSelection("mouse");if(this.multiSelect){this.doMultiSelect(false)}},selectIndex:function(b,d,e,c){this.listBox.selectIndex(b,d,e,c);this.renderSelection("mouse");this.selectedIndex=b;if(this.multiSelect){this.doMultiSelect()}},selectItem:function(b){if(this.listBox!=undefined){this.listBox.selectItem(b);this.selectedIndex=this.listBox.selectedIndex;this.renderSelection("mouse");if(this.multiSelect){this.doMultiSelect(false)}}},unselectItem:function(b){if(this.listBox!=undefined){this.listBox.unselectItem(b);this.renderSelection("mouse");if(this.multiSelect){this.doMultiSelect(false)}}},checkItem:function(b){if(this.listBox!=undefined){this.listBox.checkItem(b)}},uncheckItem:function(b){if(this.listBox!=undefined){this.listBox.uncheckItem(b)}},indeterminateItem:function(b){if(this.listBox!=undefined){this.listBox.indeterminateItem(b)}},getSelectedValue:function(){return this.listBox.selectedValue},getSelectedIndex:function(){return this.selectedIndex},getSelectedItem:function(){return this.getVisibleItem(this.selectedIndex)},getSelectedItems:function(){var c=new Array();var b=this;a.each(this.selectedItems,function(){var d=b.getItemByValue(this);if(d){c.push(d)}else{var d=b._selectedItems[this];if(d){c.push(d)}}});return c},getCheckedItems:function(){return this.listBox.getCheckedItems()},checkIndex:function(b){this.listBox.checkIndex(b)},uncheckIndex:function(b){this.listBox.uncheckIndex(b)},indeterminateIndex:function(b){this.listBox.indeterminateIndex(b)},checkAll:function(){this.listBox.checkAll()},uncheckAll:function(){this.listBox.uncheckAll()},insertAt:function(c,b){if(c==null){return false}return this.listBox.insertAt(c,b)},addItem:function(b){return this.listBox.addItem(b)},removeAt:function(c){var b=this.listBox.removeAt(c);this.renderSelection("mouse");return b},removeItem:function(c){var b=this.listBox.removeItem(c);this.renderSelection("mouse");return b},updateItem:function(c,d){var b=this.listBox.updateItem(c,d);this.renderSelection("mouse");return b},updateAt:function(d,c){var b=this.listBox.updateAt(d,c);this.renderSelection("mouse");return b},ensureVisible:function(b){return this.listBox.ensureVisible(b)},disableAt:function(b){return this.listBox.disableAt(b)},enableAt:function(b){return this.listBox.enableAt(b)},disableItem:function(b){return this.listBox.disableItem(b)},enableItem:function(b){return this.listBox.enableItem(b)},_findPos:function(c){while(c&&(c.type=="hidden"||c.nodeType!=1||a.expr.filters.hidden(c))){c=c.nextSibling}if(c){var b=a(c).coord(true);return[b.left,b.top]}},testOffset:function(h,f,c){var g=h.outerWidth();var j=h.outerHeight();var i=a(window).width()+a(window).scrollLeft();var e=a(window).height()+a(window).scrollTop();if(f.left+g>i){if(g>this.host.width()){var d=this.host.coord().left;var b=g-this.host.width();f.left=d-b+2}}if(f.left<0){f.left=parseInt(this.host.coord().left)+"px"}f.top-=Math.min(f.top,(f.top+j>e&&e>j)?Math.abs(j+c+23):0);return f},open:function(){if(!this.isOpened()&&!this.opening){this.showListBox("api")}},close:function(){if(this.isOpened()){this.hideListBox("api")}},_getBodyOffset:function(){var c=0;var b=0;if(a("body").css("border-top-width")!="0px"){c=parseInt(a("body").css("border-top-width"));if(isNaN(c)){c=0}}if(a("body").css("border-left-width")!="0px"){b=parseInt(a("body").css("border-left-width"));if(isNaN(b)){b=0}}return{left:b,top:c}},showListBox:function(k){if(this.listBox.items&&this.listBox.items.length==0){return}if(this.autoComplete||this.multiSelect&&!this.remoteAutoComplete){if(k!="search"){this._updateItemsVisibility("")}}if(this.remoteAutoComplete){this.listBox.clearSelection()}if(k!="search"){this._oldvalue=this.listBox.selectedValue}a.jqx.aria(this,"aria-expanded",true);if(this.dropDownWidth=="auto"&&this.width!=null&&this.width.indexOf&&this.width.indexOf("%")!=-1){if(this.listBox.host.width()!=this.host.width()){var p=this.host.width();this.listBoxContainer.jqxListBox({width:p});this.container.width(parseInt(p)+25)}}var n=this;var h=this.listBoxContainer;var s=this.listBox;var e=a(window).scrollTop();var f=a(window).scrollLeft();var l=parseInt(this._findPos(this.host[0])[1])+parseInt(this.host.outerHeight())-1+"px";var d,o=parseInt(Math.round(this.host.coord(true).left));d=o+"px";var r=a.jqx.mobile.isSafariMobileBrowser()||a.jqx.mobile.isWindowsPhone();this.ishiding=false;var g=a.jqx.utilities.hasTransform(this.host);if(g||(r!=null&&r)){d=a.jqx.mobile.getLeftPos(this.element);l=a.jqx.mobile.getTopPos(this.element)+parseInt(this.host.outerHeight());if(a("body").css("border-top-width")!="0px"){l=parseInt(l)-this._getBodyOffset().top+"px"}if(a("body").css("border-left-width")!="0px"){d=parseInt(d)-this._getBodyOffset().left+"px"}}this.host.addClass(this.toThemeProperty("jqx-combobox-state-selected"));this.dropdownlistArrowIcon.addClass(this.toThemeProperty("jqx-icon-arrow-down-selected"));this.dropdownlistArrow.addClass(this.toThemeProperty("jqx-combobox-arrow-selected"));this.dropdownlistArrow.addClass(this.toThemeProperty("jqx-fill-state-pressed"));this.host.addClass(this.toThemeProperty("jqx-combobox-state-focus"));this.host.addClass(this.toThemeProperty("jqx-fill-state-focus"));this.dropdownlistContent.addClass(this.toThemeProperty("jqx-combobox-content-focus"));this.container.css("left",d);this.container.css("top",l);s._arrange();var c=true;var b=false;if(this.dropDownHorizontalAlignment=="right"||this.rtl){var j=this.container.outerWidth();var q=Math.abs(j-this.host.width());if(j>this.host.width()){this.container.css("left",25+parseInt(Math.round(o))-q+"px")}else{this.container.css("left",25+parseInt(Math.round(o))+q+"px")}}if(this.enableBrowserBoundsDetection){var i=this.testOffset(h,{left:parseInt(this.container.css("left")),top:parseInt(l)},parseInt(this.host.outerHeight()));if(parseInt(this.container.css("top"))!=i.top){b=true;h.css("top",23)}else{h.css("top",0)}this.container.css("top",i.top);this.container.css("top",i.top);if(parseInt(this.container.css("left"))!=i.left){this.container.css("left",i.left)}}if(this.animationType=="none"){this.container.css("display","block");a.data(document.body,"openedComboJQXListBoxParent",n);a.data(document.body,"openedComboJQXListBox"+n.element.id,h);h.css("margin-top",0);h.css("opacity",1)}else{this.container.css("display","block");var m=h.outerHeight();h.stop();if(this.animationType=="fade"){h.css("margin-top",0);h.css("opacity",0);h.animate({opacity:1},this.openDelay,function(){n.isanimating=false;n.opening=false;a.data(document.body,"openedComboJQXListBoxParent",n);a.data(document.body,"openedComboJQXListBox"+n.element.id,h)})}else{h.css("opacity",1);if(b){h.css("margin-top",m)}else{h.css("margin-top",-m)}this.isanimating=true;this.opening=true;h.animate({"margin-top":0},this.openDelay,function(){n.isanimating=false;n.opening=false;a.data(document.body,"openedComboJQXListBoxParent",n);a.data(document.body,"openedComboJQXListBox"+n.element.id,h)})}}s._renderItems();if(!b){this.host.addClass(this.toThemeProperty("jqx-rc-b-expanded"));h.addClass(this.toThemeProperty("jqx-rc-t-expanded"));this.dropdownlistArrow.addClass(this.toThemeProperty("jqx-rc-b-expanded"))}else{this.host.addClass(this.toThemeProperty("jqx-rc-t-expanded"));h.addClass(this.toThemeProperty("jqx-rc-b-expanded"));this.dropdownlistArrow.addClass(this.toThemeProperty("jqx-rc-t-expanded"))}h.addClass(this.toThemeProperty("jqx-fill-state-focus"));this._raiseEvent("0",s)},doMultiSelect:function(c){if(this.checkboxes){this.multiSelect=false}var e=this;if(!this.multiSelect){var g=e.dropdownlistContent.find(".jqx-button");var d="mousedown";if(this.touch){d=a.jqx.mobile.getTouchEventName("touchstart")}this.removeHandler(g,d);this.removeHandler(g.find(".jqx-icon-close"),d);g.remove();this.selectedItems=new Array();this._selectedItems=new Array();return}if(this.validateSelection){var k=this.validateSelection(this.listBox.selectedValue);if(!k){return}}var h=this.selectedItems;if(this.listBox.selectedValue){if(this.selectedItems.indexOf(this.listBox.selectedValue)===-1){this.selectedItems.push(this.listBox.selectedValue);var j=this.getItemByValue(this.listBox.selectedValue);if(j){this._selectedItems.push(j);this._raiseEvent("2",{index:j.index,item:j});this._raiseEvent("4",{index:j.index,item:j})}}this.listBox.selectedIndex=0}var f=this.listBox.items;for(var b=0;b<f.length;b++){f[b].disabled=false;if(this.selectedItems.indexOf(f[b].value)>=0){f[b].disabled=true}}this.listBox._renderItems();this.searchString="";this.input.val("");var f="";var d="mousedown";var g=e.dropdownlistContent.find(".jqx-button");if(this.touch){d=a.jqx.mobile.getTouchEventName("touchstart")}this.removeHandler(g,d);this.removeHandler(g.find(".jqx-icon-close"),d);g.remove();e.input.detach();e.input.css("width","25px");a.each(this.selectedItems,function(i){var m=e.getItemByValue(this);if(!m||e.remoteAutoComplete){m=e._selectedItems[i]}var o=a('<div style="overflow: hidden; float: left;"></div>');o.addClass(e.toThemeProperty("jqx-button"));o.addClass(e.toThemeProperty("jqx-combobox-multi-item"));o.addClass(e.toThemeProperty("jqx-fill-state-normal"));o.addClass(e.toThemeProperty("jqx-rc-all"));if(m){var p=m.label;if(o[0].innerHTML==""){o[0].innerHTML='<a data-value="'+m.value+'" style="float: left;" href="#">'+p+"</a>"}if(e.rtl){o[0].innerHTML='<a data-value="'+m.value+'" style="float: right;" href="#">'+p+"</a>"}var n=!e.rtl?"right":"left";var l='<div style="position: relative; overflow: hidden; float: '+n+'; min-height: 16px; min-width: 18px;"><div style="position: absolute; left: 100%; top: 50%; margin-left: -18px; margin-top: -7px; float: none; width: 16px; height: 16px;" class="'+e.toThemeProperty("jqx-icon-close")+'"></div></div>';if(a.jqx.browser.msie&&a.jqx.browser.version<8){l='<div style="position: relative; overflow: hidden; float: left; min-height: 16px; min-width: 18px;"><div style="position: absolute; left: 100%; top: 50%; margin-left: -18px; margin-top: -7px; float: none; width: 16px; height: 16px;" class="'+e.toThemeProperty("jqx-icon-close")+'"></div></div>'}if(e.rtl){var l='<div style="position: relative; overflow: hidden; float: '+n+'; min-height: 16px; min-width: 18px;"><div style="position: absolute; left: 0px; top: 50%; margin-top: -7px; float: none; width: 16px; height: 16px;" class="'+e.toThemeProperty("jqx-icon-close")+'"></div></div>';if(a.jqx.browser.msie&&a.jqx.browser.version<8){l='<div style="position: relative; overflow: hidden; float: left; min-height: 16px; min-width: 18px;"><div style="position: absolute; left: 0px; top: 50%; margin-top: -7px; float: none; width: 16px; height: 16px;" class="'+e.toThemeProperty("jqx-icon-close")+'"></div></div>'}}o[0].innerHTML+=l}else{if(o[0].innerHTML==""){o[0].innerHTML='<a href="#"></a>'}}e.dropdownlistContent.append(o)});e.dropdownlistContent.append(e.input);e.input.val("");if(c!==false){e.input.focus();setTimeout(function(){e.input.focus()},10)}var g=e.dropdownlistContent.find(".jqx-button");if(this.touchMode===true){d="mousedown"}this.addHandler(g,d,function(l){if(l.target.className.indexOf("jqx-icon-close")>=0){return true}var m=a(l.target).attr("data-value");var i=e.getItemByValue(m);if(i){e.listBox.selectedValue=null;e.listBox.clearSelection()}e.listBox.scrollTo(0,0);e.open();if(l.preventDefault){l.preventDefault()}if(l.stopPropagation){l.stopPropagation()}return false});this.addHandler(g.find(".jqx-icon-close"),d,function(m){var n=a(m.target).parent().parent().find("a").attr("data-value");var l=e.getItemByValue(n);if(l){e.listBox.selectedValue=null;var i=e.selectedItems.indexOf(n);if(i>=0){e.selectedItems.splice(i,1);e._selectedItems.splice(i,1);e._raiseEvent("3",{index:l.index,type:"mouse",item:l});e._raiseEvent("4",{index:l.index,type:"mouse",item:l});e.doMultiSelect()}}});e.dropdownlistArrow.height(this.host.height());e._updateInputSelection()},hideListBox:function(h){var f=this.listBoxContainer;var g=this.listBox;var c=this.container;if(this.container.css("display")=="none"){return}a.jqx.aria(this,"aria-expanded",false);if(h=="keyboard"||h=="mouse"){this.listBox.searchString=""}if(h=="keyboard"||h=="mouse"&&this.multiSelect){this.doMultiSelect()}var d=this;a.data(document.body,"openedComboJQXListBox"+this.element.id,null);if(this.animationType=="none"){this.opening=false;this.container.css("display","none")}else{if(!this.ishiding){var b=f.outerHeight();f.css("margin-top",0);f.stop();this.opening=false;this.isanimating=true;var e=-b;if(parseInt(this.container.coord().top)<parseInt(this.host.coord().top)){e=b}if(this.animationType=="fade"){f.css({opacity:1});f.animate({opacity:0},this.closeDelay,function(){d.isanimating=false;c.css("display","none");d.ishiding=false})}else{f.animate({"margin-top":e},this.closeDelay,function(){d.isanimating=false;c.css("display","none");d.ishiding=false})}}}this.ishiding=true;this.host.removeClass(this.toThemeProperty("jqx-combobox-state-selected"));this.dropdownlistArrowIcon.removeClass(this.toThemeProperty("jqx-icon-arrow-down-selected"));this.dropdownlistArrow.removeClass(this.toThemeProperty("jqx-combobox-arrow-selected"));this.dropdownlistArrow.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));if(!this.focused){this.host.removeClass(this.toThemeProperty("jqx-combobox-state-focus"));this.host.removeClass(this.toThemeProperty("jqx-fill-state-focus"));this.dropdownlistContent.removeClass(this.toThemeProperty("jqx-combobox-content-focus"))}this.host.removeClass(this.toThemeProperty("jqx-rc-b-expanded"));f.removeClass(this.toThemeProperty("jqx-rc-t-expanded"));this.host.removeClass(this.toThemeProperty("jqx-rc-t-expanded"));f.removeClass(this.toThemeProperty("jqx-rc-b-expanded"));f.removeClass(this.toThemeProperty("jqx-fill-state-focus"));this.dropdownlistArrow.removeClass(this.toThemeProperty("jqx-rc-t-expanded"));this.dropdownlistArrow.removeClass(this.toThemeProperty("jqx-rc-b-expanded"));this._raiseEvent("1",g)},closeOpenedListBox:function(e){var d=e.data.me;var b=a(e.target);var c=e.data.listbox;if(c==null){return true}if(a(e.target).ischildof(e.data.me.host)){return}var f=d;var g=false;a.each(b.parents(),function(){if(this.className!="undefined"){if(this.className.indexOf){if(this.className.indexOf("jqx-listbox")!=-1){g=true;return false}if(this.className.indexOf("jqx-combobox")!=-1){if(d.element.id==this.id){g=true}return false}}}});if(c!=null&&!g){d.hideListBox("api");d.input.blur()}return true},loadFromSelect:function(b){this.listBox.loadFromSelect(b)},refresh:function(b){this._setSize();this._arrange();if(this.listBox){this.renderSelection()}},_arrange:function(){var d=parseInt(this.host.width());var j=parseInt(this.host.height());var e=this.arrowSize;var f=this.arrowSize;var h=1;if(!this.showArrow){f=0;e=0;this.dropdownlistArrow.hide();h=0;this.host.css("cursor","arrow")}var b=d-f-1*h;if(b>0){this.dropdownlistContent.width(b+"px")}if(this.rtl){this.dropdownlistContent.width(-1+b+"px")}this.dropdownlistContent.height(j);this.dropdownlistContent.css("left",0);this.dropdownlistContent.css("top",0);this.dropdownlistArrow.width(f+1);this.dropdownlistArrow.height(j);this.dropdownlistArrow.css("left",1+b+"px");this.input.css("width","100%");var c=this.input.height();if(c==0){c=parseInt(this.input.css("font-size"))+3}this.input.addClass(this.toThemeProperty("jqx-rc-all"));var i=parseInt(j)/2-parseInt(c)/2;if(i>0){this.input.css("margin-top",i)}if(this.rtl){this.dropdownlistArrow.css("left","0px");this.dropdownlistContent.css("left",this.dropdownlistArrow.width());if(a.jqx.browser.msie&&a.jqx.browser.version<=8){this.dropdownlistContent.css("left",1+this.dropdownlistArrow.width())}}if(this.multiSelect){this.input.css("float","left");this.input.width(25);this.dropdownlistWrapper.parent().css("height","auto");this.dropdownlistContent.css("height","auto");this.dropdownlistWrapper.css("height","auto");this.dropdownlistContent.css("position","relative");this.dropdownlistContent.css("cursor","text");this.host.css("height","auto");this.host.css("min-height",this.height);this.dropdownlistContent.css("min-height",this.height);var j=parseInt(this.host.height());this.dropdownlistArrow.height(j);var g=parseInt(this.host.css("min-height"));var i=parseInt(g)/2-parseInt(c)/2;if(i>0){this.input.css("margin-top",i)}}},destroy:function(){if(this.source&&this.source.unbindBindingUpdate){this.source.unbindBindingUpdate(this.element.id);this.source.unbindBindingUpdate(this.listBoxContainer[0].id);this.source.unbindDownloadComplete(this.element.id);this.source.unbindDownloadComplete(this.listBoxContainer[0].id)}a.jqx.utilities.resize(this.host,null,true);this.removeHandler(this.listBoxContainer,"select");this.removeHandler(this.listBoxContainer,"unselect");this.removeHandler(this.listBoxContainer,"change");this.removeHandler(this.listBoxContainer,"bindingComplete");this.removeHandler(this.dropdownlistWrapper,"selectstart");this.removeHandler(this.dropdownlistWrapper,"mousedown");this.removeHandler(this.host,"keydown");this.removeHandler(this.listBoxContainer,"select");this.removeHandler(this.listBox.content,"click");this.removeHandlers();this.removeHandler(this.input,"keyup.textchange");this.listBoxContainer.jqxListBox("destroy");this.listBoxContainer.remove();this.host.removeClass();this.removeHandler(a(document),"mousedown."+this.id,this.closeOpenedListBox);if(this.touch){this.removeHandler(a(document),a.jqx.mobile.getTouchEventName("touchstart")+"."+this.id)}this.cinput.remove();delete this.cinput;this.dropdownlistArrow.remove();delete this.dropdownlistArrow;this.dropdownlistArrowIcon.remove();delete this.dropdownlistArrowIcon;delete this.dropdownlistWrapper;delete this.listBoxContainer;delete this.input;delete this.dropdownlistContent;delete this.comboStructure;this.container.remove();delete this.listBox;delete this.container;var b=a.data(this.element,"jqxComboBox");if(b){delete b.instance}this.host.removeData();this.host.remove();delete this.host;delete this.set;delete this.get;delete this.call;delete this.element},_raiseEvent:function(f,c){if(c==undefined){c={owner:null}}var d=this.events[f];args=c;args.owner=this;var e=new jQuery.Event(d);e.owner=this;if(f==2||f==3||f==4||f==5){e.args=c}var b=this.host.trigger(e);return b},propertyChangedHandler:function(b,c,f,e){if(b.isInitialized==undefined||b.isInitialized==false){return}if(c==="touchMode"){b.listBoxContainer.jqxListBox({touchMode:e});b.touch=a.jqx.mobile.isTouchDevice();if(b.touchMode===true){b.touch=true}b._updateHandlers()}if(c=="multiSelect"){if(e){b.doMultiSelect(false)}else{b.doMultiSelect(false);b.dropdownlistWrapper.parent().css("height","100%");b.dropdownlistContent.css("height","100");b.dropdownlistWrapper.css("height","100");b.dropdownlistContent.css("position","relative");b.host.css("min-height",null);b._setSize();b._arrange()}}if(c=="showArrow"){b._arrange();if(b.multiSelect){b.doMultiSelect(false)}}if(c=="popupZIndex"){b.listBoxContainer.css({zIndex:b.popupZIndex})}if(c=="promptText"){b.placeHolder=e}if(c=="autoOpen"){b._updateHandlers()}if(c=="renderer"){b.listBox.renderer=b.renderer}if(c=="itemHeight"){b.listBox.itemHeight=e}if(c=="source"){b.input.val("");b.listBoxContainer.jqxListBox({source:b.source});b.renderSelection("mouse");if(b.source==null){b.clearSelection()}if(b.multiSelect){b.selectedItems=new Array();b._selectedItems=new Array();b.doMultiSelect(false)}}if(c=="rtl"){if(e){b.dropdownlistArrow.css("float","left");b.dropdownlistContent.css("float","right")}else{b.dropdownlistArrow.css("float","right");b.dropdownlistContent.css("float","left")}b.listBoxContainer.jqxListBox({rtl:b.rtl})}if(c=="displayMember"||c=="valueMember"){b.listBoxContainer.jqxListBox({displayMember:b.displayMember,valueMember:b.valueMember});b.renderSelection("mouse")}if(c=="autoDropDownHeight"){b.listBoxContainer.jqxListBox({autoHeight:b.autoDropDownHeight});if(b.autoDropDownHeight){b.container.height(b.listBoxContainer.height()+25)}else{b.listBoxContainer.jqxListBox({height:b.dropDownHeight});b.container.height(parseInt(b.dropDownHeight)+25)}}if(c=="dropDownHeight"){if(!b.autoDropDownHeight){b.listBoxContainer.jqxListBox({height:b.dropDownHeight});b.container.height(parseInt(b.dropDownHeight)+25)}}if(c=="dropDownWidth"||c=="scrollBarSize"){var d=b.width;if(b.dropDownWidth!="auto"){d=b.dropDownWidth}b.listBoxContainer.jqxListBox({width:d,scrollBarSize:b.scrollBarSize});b.container.width(parseInt(d)+25)}if(c=="autoComplete"){b._resetautocomplete()}if(c=="checkboxes"){b.listBoxContainer.jqxListBox({checkboxes:b.checkboxes});if(b.checkboxes){b.input.attr("readonly",true);a.jqx.aria(b,"aria-readonly",true)}else{a.jqx.aria(b,"aria-readonly",false)}}if(c=="theme"&&e!=null){b.listBoxContainer.jqxListBox({theme:e});b.listBoxContainer.addClass(b.toThemeProperty("jqx-popup"));if(a.jqx.browser.msie){b.listBoxContainer.addClass(b.toThemeProperty("jqx-noshadow"))}b.dropdownlistContent.removeClass();b.dropdownlistContent.addClass(b.toThemeProperty("jqx-combobox-content"));b.dropdownlistContent.addClass(b.toThemeProperty("jqx-widget-content"));b.input.removeClass();b.input.addClass(b.toThemeProperty("jqx-combobox-input"));b.input.addClass(this.toThemeProperty("jqx-widget-content"));b.host.removeClass();b.host.addClass(b.toThemeProperty("jqx-combobox-state-normal"));b.host.addClass(b.toThemeProperty("jqx-rc-all"));b.host.addClass(b.toThemeProperty("jqx-widget"));b.host.addClass(b.toThemeProperty("jqx-widget-content"));b.dropdownlistArrow.removeClass();b.dropdownlistArrowIcon.addClass(b.toThemeProperty("jqx-icon-arrow-down"));b.dropdownlistArrow.addClass(b.toThemeProperty("jqx-combobox-arrow-normal"));b.dropdownlistArrow.addClass(b.toThemeProperty("jqx-fill-state-normal"))}if(c=="width"||c=="height"){b._setSize();if(c=="width"){if(b.dropDownWidth=="auto"){var d=b.host.width();b.listBoxContainer.jqxListBox({width:d});b.container.width(parseInt(d)+25)}}b._arrange()}if(c=="selectedIndex"){b.listBox.selectIndex(e);b.renderSelection("mouse")}}})})(jQuery);

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.jqxWidget("jqxWindow","",{});a.extend(a.jqx._jqxWindow.prototype,{defineInstance:function(){this.height="auto";this.width=200;this.minHeight=50;this.maxHeight=600;this.minWidth=50;this.maxWidth=800;this.showCloseButton=true;this.disabled=false;this.autoOpen=true;this.keyboardCloseKey="esc";this.title="";this.content="";this.draggable=true;this.resizable=true;this.animationType="fade";this.closeAnimationDuration=250;this.showAnimationDuration=250;this.isModal=false;this.position="center";this.closeButtonSize=16;this.closeButtonAction="hide";this.modalOpacity=0.3;this.dragArea=null;this.okButton=null;this.cancelButton=null;this.dialogResult={OK:false,Cancel:false,None:true};this.collapsed=false;this.showCollapseButton=false;this.collapseAnimationDuration=150;this.collapseButtonSize=16;this.rtl=false;this.keyboardNavigation=true;this.headerHeight=null;this._events=["created","closed","moving","moved","open","collapse","expand","open","close","resize"];this.initContent=null;this.enableResize=true;this.restricter=null;this.closing=null;this._invalidArgumentExceptions={invalidHeight:"Invalid height!",invalidWidth:"Invalid width!",invalidMinHeight:"Invalid minHeight!",invalidMaxHeight:"Invalid maxHeight!",invalidMinWidth:"Invalid minWidth!",invalidMaxWidth:"Invalid maxWidth",invalidKeyCode:"Invalid keyCode!",invalidAnimationType:"Invalid animationType!",invalidCloseAnimationDuration:"Invalid closeAnimationDuration!",invalidShowAnimationDuration:"Invalid showAnimationDuration!",invalidPosition:"Invalid position!",invalidCloseButtonSize:"Invalid closeButtonSize!",invalidCollapseButtonSize:"Invalid collapseButtonSize!",invalidCloseButtonAction:"Invalid cluseButtonAction!",invalidModalOpacity:"Invalid modalOpacity!",invalidDragArea:"Invalid dragArea!",invalidDialogResult:"Invalid dialogResult!",invalidIsModal:"You can have just one modal window!"};this._enableResizeCollapseBackup;this._enableResizeBackup;this._heightBeforeCollapse;this._minHeightBeforeCollapse;this._mouseDown=false;this._isDragging=false;this._rightContentWrapper=null;this._leftContentWrapper=null;this._headerContentWrapper=null;this._closeButton=null;this._collapseButton=null;this._title=null;this._content=null;this._mousePosition={};this._windowPosition={};this._modalBackground=null;this._SCROLL_WIDTH=21;this._visible=true;this.modalBackgroundZIndex=12990;this.modalZIndex=18000;this.zIndex=9001;this._touchEvents={mousedown:a.jqx.mobile.getTouchEventName("touchstart"),mouseup:a.jqx.mobile.getTouchEventName("touchend"),mousemove:a.jqx.mobile.getTouchEventName("touchmove"),mouseenter:"mouseenter",mouseleave:"mouseleave",click:a.jqx.mobile.getTouchEventName("touchstart")}},createInstance:function(){this.host.attr("role","dialog");this.host.detach();a(document.body).append(this.host);var f=this;var g=function(){var i=parseInt(a(f.restricter).css("padding-top"));var h=parseInt(a(f.restricter).css("padding-left"));var k=parseInt(a(f.restricter).css("padding-bottom"));var m=parseInt(a(f.restricter).css("padding-right"));var l=a(f.restricter).coord();f.dragArea={left:h+l.left,top:i+l.top,width:m+a(f.restricter).width(),height:k+a(f.restricter).height()}};if(this.restricter){g()}if(this.restricter){this.addHandler(a(window),"resize."+this.element.id,function(){g()});this.addHandler(a(window),"orientationchanged."+this.element.id,function(){g()});this.addHandler(a(window),"orientationchange."+this.element.id,function(){g()})}this._isTouchDevice=a.jqx.mobile.isTouchDevice();this._validateProperties();this._createStructure();this._refresh();if(!this.autoOpen){this.host.css("display","none")}if(a.jqx.browser.msie){this.host.addClass(this.toThemeProperty("jqx-noshadow"))}if(!this.isModal){this._fixWindowZIndex()}this._setStartupSettings();this._positionWindow();this._raiseEvent(0);if(this.autoOpen){this._performLayout();var e=this;if(e.initContent){e.initContent();e._contentInitialized=true}if(this.isModal){this._fixWindowZIndex("modal-show")}}},refresh:function(){this._performLayout()},_setStartupSettings:function(){if(this.disabled){this.disable()}if(this.collapsed){this.collapsed=false;this.collapse(0)}if(!this.autoOpen){this.hide(null,0.001,true);this._visible=false}if(this.title!==null&&this.title!==""){this.setTitle(this.title)}if(this.content!==null&&this.content!==""){this.setContent(this.content)}this.title=this._headerContentWrapper.html();this.content=this._content.html()},_fixWindowZIndex:function(m){var e=a.data(document.body,"jqxwindows-list")||[],n=this.zIndex,h;if(!this.isModal){if(this._indexOf(this.host,e)<0){e.push(this.host)}a.data(document.body,"jqxwindows-list",e);if(e.length>1){var f=e[e.length-2];n=parseInt(f.css("z-index"),10)+1}}else{if(e){e=this._removeFromArray(this.host,e);a.data(document.body,"jqxwindows-list",e)}var g=a.data(document.body,"jqxwindows-modallist");if(!g){if(m=="modal-show"){var k=new Array();k.push(this.host);a.data(document.body,"jqxwindows-modallist",k);g=k}else{a.data(document.body,"jqxwindows-modallist",new Array());g=new Array()}}else{if(m=="modal-show"){g.push(this.host)}else{var i=g.indexOf(this.host);if(i!=-1){g.splice(i,1)}}}n=this.modalZIndex;var l=this;a.each(g,function(q){if(this.data()){if(this.data().jqxWindow){var o=this.data().jqxWindow.instance;o._modalBackground.css("z-index",n);o.host.css("z-index",n+1);n+=2}}});a.data(document.body,"jqxwindow-modal",this.host);return}this.host.css("z-index",n);this._sortByStyle("z-index",e)},_validateProperties:function(){try{this._validateSize();this._validateAnimationProperties();this._validateInteractionProperties();this._validateModalProperties();if(!this.position){throw new Error(this._invalidArgumentExceptions.invalidPosition)}if(isNaN(this.closeButtonSize)||parseInt(this.closeButtonSize)<0){throw new Error(this._invalidArgumentExceptions.invalidCloseButtonSize)}if(isNaN(this.collapseButtonSize)||parseInt(this.collapseButtonSize)<0){throw new Error(this._invalidArgumentExceptions.invalidCollapseButtonSize)}}catch(e){alert(e)}},_validateModalProperties:function(){if(this.modalOpacity<0||this.modalOpacity>1){throw new Error(this._invalidArgumentExceptions.invalidModalOpacity)}if(this.isModal&&!this._singleModalCheck()){throw new Error(this._invalidArgumentExceptions.invalidIsModal)}},_validateSize:function(){this._validateSizeLimits();if(this.height!=="auto"&&isNaN(parseInt(this.height))){throw new Error(this._invalidArgumentExceptions.invalidHeight)}if(this.width!=="auto"&&isNaN(parseInt(this.width))){throw new Error(this._invalidArgumentExceptions.invalidWidth)}if(this.height!=="auto"&&this.height<this.minHeight){this.height=this.minHeight}if(this.width<this.minWidth){this.width=this.minWidth}if(this.height!=="auto"&&this.height>this.maxHeight){this.height=this.maxHeight}if(this.width>this.maxWidth){this.width=this.maxWidth}if(this.dragArea===null){return}if(this.dragArea&&((this.dragArea.height!==null&&this.host.height()>this.dragArea.height)||(parseInt(this.height,10)>this.dragArea.height))||(this.dragArea.width!==null&&this.width>this.dragArea.width)||(this.maxHeight>this.dragArea.height||this.maxWidth>this.dragArea.width)){}},_validateSizeLimits:function(){if(isNaN(parseInt(this.minHeight))){throw new Error(this._invalidArgumentExceptions.invalidMinHeight)}if(isNaN(parseInt(this.maxHeight))){throw new Error(this._invalidArgumentExceptions.invalidMaxHeight)}if(isNaN(parseInt(this.minWidth))){throw new Error(this._invalidArgumentExceptions.invalidMinWidth)}if(isNaN(parseInt(this.maxWidth))){throw new Error(this._invalidArgumentExceptions.invalidMaxWidth)}if(this.minHeight>this.maxHeight){throw new Error(this._invalidArgumentExceptions.invalidMinHeight)}if(this.minWidth>this.maxWidth){throw new Error(this._invalidArgumentExceptions.invalidMinWidth)}},_validateAnimationProperties:function(){if(this.animationType!=="fade"&&this.animationType!=="slide"&&this.animationType!=="combined"&&this.animationType!=="none"){throw new Error(this._invalidArgumentExceptions.invalidAnimationType)}if(isNaN(parseInt(this.closeAnimationDuration),10)||this.closeAnimationDuration<0){throw new Error(this._invalidArgumentExceptions.invalidCloseAnimationDuration)}if(isNaN(parseInt(this.showAnimationDuration),10)||this.showAnimationDuration<0){throw new Error(this._invalidArgumentExceptions.invalidShowAnimationDuration)}},_validateInteractionProperties:function(){if(parseInt(this.keyCode,10)<0||parseInt(this.keyCode,10)>130&&this.keyCode!=="esc"){throw new Error(this._invalidArgumentExceptions.invalidKeyCode)}if(this.dragArea!==null&&(typeof this.dragArea.width==="undefined"||typeof this.dragArea.height==="undefined"||typeof this.dragArea.left==="undefined"||typeof this.dragArea.top==="undefined")){throw new Error(this._invalidArgumentExceptions.invalidDragArea)}if(!this.dialogResult||(!this.dialogResult.OK&&!this.dialogResult.Cancel&&!this.dialogResult.None)){throw new Error(this._invalidArgumentExceptions.invalidDialogResult)}if(this.closeButtonAction!=="hide"&&this.closeButtonAction!=="close"){throw new Error(this._invalidArgumentExceptions.invalidCloseButtonAction)}},_singleModalCheck:function(){var e=a.data(document.body,"jqxwindows-list")||[],f=e.length;while(f){f-=1;if(a(e[f].attr("id")).length>0){if(a(e[f].attr("id")).jqxWindow("isModal")){return false}}}return true},_createStructure:function(){var e=this.host.children("DIV");if(e.length===1){this._header=a("<div>"+this.host.attr("caption")+"</div>");this.host.prepend(this._header);this.host.attr("caption","");this._content=a(e[0])}else{if(e.length===2){this._header=a(e[0]);this._content=a(e[1])}else{throw new Error("Invalid structure!")}}},_refresh:function(){this._render();this._addStyles();this._performLayout();this._removeEventHandlers();this._addEventHandlers();this._initializeResize()},_render:function(){this._addHeaderWrapper();this._addCloseButton();this._addCollapseButton();this._removeModal();this._makeModal()},_addHeaderWrapper:function(){if(!this._headerContentWrapper){this._header.wrapInner('<div style="float:left;"></div>');this._headerContentWrapper=this._header.children(0);if(this.headerHeight!==null){this._header.height(this.headerHeight)}}},_addCloseButton:function(){if(!this._closeButton){this._closeButtonWrapper=a('<div class="'+this.toThemeProperty("jqx-window-close-button-background")+'"></div>');this._closeButton=a('<div style="width: 100%; height: 100%;" class="'+this.toThemeProperty("jqx-window-close-button")+'"></div>');this._closeButtonWrapper.append(this._closeButton);this._header.append(this._closeButtonWrapper)}},_addCollapseButton:function(){if(!this._collapseButton){this._collapseButtonWrapper=a('<div class="'+this.toThemeProperty("jqx-window-collapse-button-background")+'"></div>');this._collapseButton=a('<div style="width: 100%; height: 100%;" class="'+this.toThemeProperty("jqx-window-collapse-button")+'"></div>');this._collapseButtonWrapper.append(this._collapseButton);this._header.append(this._collapseButtonWrapper)}},_removeModal:function(){if(!this.isModal&&typeof this._modalBackground==="object"&&this._modalBackground!==null&&this._modalBackground.length>=1){a("."+this.toThemeProperty("jqx-window-modal")).remove();this._modalBackground=null}},focus:function(){try{this.host.focus();var f=this;setTimeout(function(){f.host.focus()},10)}catch(e){}},_makeModal:function(){if(this.isModal&&(!this._modalBackground||this._modalBackground.length<1)){var g=a.data(document.body,"jqxwindows-list");if(g){this._removeFromArray(this.host,g);a.data(document.body,"jqxwindows-list",g)}this._modalBackground=a("<div></div>");this._modalBackground.addClass(this.toThemeProperty("jqx-window-modal"));this._setModalBackgroundStyles();a(document.body).append(this._modalBackground);this.addHandler(this._modalBackground,this._getEvent("click"),function(){return false});var f=this;var e=function(i,k){var h=a(i).parents().get();for(j=0;j<h.length;j++){if(a(h[j]).is(k)){return true}}return false};this.addHandler(this._modalBackground,"mouseup",function(h){f._stopResizing(f);h.preventDefault()});this.addHandler(this._modalBackground,"mousedown",function(i){var h=f._getTabbables();if(h.length>0){h[0].focus(1);setTimeout(function(){h[0].focus(1)},100)}i.preventDefault();return false});this.addHandler(a(document),"keydown.window"+this.element.id,function(k){if(k.keyCode!==9){return}var i=f._getTabbables();var l=null;var h=null;if(i.length>0){l=i[0];h=i[i.length-1]}if(k.target==f.element){return}if(l==null){return}if(!e(k.target,f.host)){l.focus(1);return false}if(k.target===h&&!k.shiftKey){l.focus(1);return false}else{if(k.target===l&&k.shiftKey){h.focus(1);return false}}})}},_addStyles:function(){this.host.addClass(this.toThemeProperty("jqx-rc-all"));this.host.addClass(this.toThemeProperty("jqx-window"));this.host.addClass(this.toThemeProperty("jqx-popup"));if(a.jqx.browser.msie){this.host.addClass(this.toThemeProperty("jqx-noshadow"))}this.host.addClass(this.toThemeProperty("jqx-widget"));this.host.addClass(this.toThemeProperty("jqx-widget-content"));this._header.addClass(this.toThemeProperty("jqx-window-header"));this._content.addClass(this.toThemeProperty("jqx-window-content"));this._header.addClass(this.toThemeProperty("jqx-widget-header"));this._content.addClass(this.toThemeProperty("jqx-widget-content"));this._header.addClass(this.toThemeProperty("jqx-disableselect"));this._header.addClass(this.toThemeProperty("jqx-rc-t"));this._content.addClass(this.toThemeProperty("jqx-rc-b"));this.element.tabIndex=0;this.host.find("DIV").css("tab-index",0);this.host.attr("hideFocus","true").css("outline","none")},_performHeaderLayout:function(){this._handleHeaderButtons();this._header.css("position","relative");if(this.rtl){this._headerContentWrapper.css("direction","rtl");this._headerContentWrapper.css("float","right")}else{this._headerContentWrapper.css("direction","ltr");this._headerContentWrapper.css("float","left")}this._performHeaderCloseButtonLayout();this._performHeaderCollapseButtonLayout();this._centerElement(this._headerContentWrapper,this._header,"y","margin");if(this.headerHeight){this._centerElement(this._closeButtonWrapper,this._header,"y","margin");this._centerElement(this._collapseButtonWrapper,this._header,"y","margin")}},_handleHeaderButtons:function(){if(!this._closeButtonWrapper){return}if(!this.showCloseButton){this._closeButtonWrapper.css("visibility","hidden")}else{this._closeButtonWrapper.css("visibility","visible");this._closeButtonWrapper.width(this.closeButtonSize);this._closeButtonWrapper.height(this.closeButtonSize)}if(!this.showCollapseButton){this._collapseButtonWrapper.css("visibility","hidden")}else{this._collapseButtonWrapper.css("visibility","visible");this._collapseButtonWrapper.width(this.collapseButtonSize);this._collapseButtonWrapper.height(this.collapseButtonSize)}},_performHeaderCloseButtonLayout:function(){if(!this._closeButtonWrapper){return}var e=parseInt(this._header.css("padding-right"),10);if(!isNaN(e)){this._closeButtonWrapper.width(this._closeButton.width());if(!this.rtl){this._closeButtonWrapper.css("margin-right",e);this._closeButtonWrapper.css("margin-left","0px")}else{this._closeButtonWrapper.css("margin-left",e);this._closeButtonWrapper.css("margin-right","0px")}}if(!this.rtl){this._closeButtonWrapper.css({position:"absolute",right:"0px",left:""})}else{this._closeButtonWrapper.css({position:"absolute",left:"0px",right:""})}},_performHeaderCollapseButtonLayout:function(){if(!this._closeButtonWrapper){return}var e=parseInt(this._header.css("padding-right"),10);if(!isNaN(e)){this._collapseButtonWrapper.width(this.collapseButtonSize);this._collapseButtonWrapper.height(this.collapseButtonSize);if(!this.rtl){this._collapseButtonWrapper.css("margin-right",e);this._collapseButtonWrapper.css("margin-left","0px")}else{this._collapseButtonWrapper.css("margin-left",e);this._collapseButtonWrapper.css("margin-right","0px")}}if(!this.rtl){this._collapseButtonWrapper.css({position:"absolute",right:(this.showCloseButton)?this._closeButton.outerWidth(true):0,left:""})}else{this._collapseButtonWrapper.css({position:"absolute",left:(this.showCloseButton)?this._closeButton.outerWidth(true):0,right:""})}this._centerElement(this._collapseButton,this._collapseButton.parent(),"y")},_performWidgetLayout:function(){var e;if(this.width!=="auto"){this.host.css("width",this.width)}if(!this.collapsed){if(this.height!=="auto"){this.host.height(this.height)}else{this.host.height(this.host.height())}this.host.css("min-height",this.minHeight)}this._setChildrenLayout();e=this._validateMinSize();this.host.css({"max-height":this.maxHeight,"min-width":this.minWidth,"max-width":this.maxWidth});if(!e){this._setChildrenLayout()}},_setChildrenLayout:function(){this._header.width(this.host.width()-(this._header.outerWidth(true)-this._header.width()));this._content.width(this.host.width()-(this._content.outerWidth(true)-this._content.width()));this._content.height(this.host.height()-this._header.outerHeight(true)-(this._content.outerHeight(true)-this._content.height()))},_validateMinSize:function(){var f=true;if(this.minHeight<this._header.height()){this.minHeight=this._header.height();f=false}var h=this._header.children(0).outerWidth(true),e=this._header.children(1).outerWidth(true),g=h+e;if(this.minWidth<100){this.minWidth=Math.min(g,100);f=false}return f},_centerElement:function(h,f,e,g){if(typeof f.left==="number"&&typeof f.top==="number"&&typeof f.height==="number"&&typeof f.width==="number"){this._centerElementInArea(h,f,e)}else{this._centerElementInParent(h,f,e,g)}},_centerElementInParent:function(e,m,h,f){h=h.toLowerCase();if(f){f+="-"}else{f=""}if(h.indexOf("y")>=0){var g=e.outerHeight(true),k=m.height(),i=(Math.max(0,k-g))/2;e.css(f+"top",i+"px")}if(h.indexOf("x")>=0){var o=e.outerWidth(true);var n=m.width();var l=(Math.max(0,n-o))/2;e.css(f+"left",l+"px")}},_centerElementInArea:function(f,e,h){h=h.toLowerCase();if(h.indexOf("y")>=0){var g=f.outerHeight(true);var k=e.height;var i=(k-g)/2;f.css("top",i+e.top+"px")}if(h.indexOf("x")>=0){var n=f.outerWidth(true);var m=e.width;var l=(m-n)/2;f.css("left",l+e.left+"px")}},_removeEventHandlers:function(){this.removeHandler(this._header,this._getEvent("mousedown"));this.removeHandler(this._header,this._getEvent("mousemove"));this.removeHandler(this._header,"focus");this.removeHandler(a(document),this._getEvent("mousemove")+"."+this.host.attr("id"));this.removeHandler(a(document),this._getEvent("mouseup")+"."+this.host.attr("id"));this.removeHandler(this.host,"keydown");this.removeHandler(this._closeButton,this._getEvent("click"));this.removeHandler(this._closeButton,this._getEvent("mouseenter"));this.removeHandler(this._closeButton,this._getEvent("mouseleave"));this.removeHandler(this._collapseButton,this._getEvent("click"));this.removeHandler(this._collapseButton,this._getEvent("mouseenter"));this.removeHandler(this._collapseButton,this._getEvent("mouseleave"));this.removeHandler(this.host,this._getEvent("mousedown"));this.removeHandler(a(this.okButton),this._getEvent("click"),this._setDialogResultHandler);this.removeHandler(a(this.cancelButton),this._getEvent("click"),this._setDialogResultHandler);this.removeHandler(this._header,this._getEvent("mouseenter"));this.removeHandler(this._header,this._getEvent("mouseleave"));this.removeHandler(this.host,"resizing",this._windowResizeHandler)},_removeFromArray:function(e,g){var f=this._indexOf(e,g);if(f>=0){return g.splice(this._indexOf(e,g),1)}else{return g}},_sortByStyle:function(e,l){for(var h=0;h<l.length;h++){for(var f=l.length-1;f>h;f--){var m=l[f],k=l[f-1],g;if(parseInt(m.css(e),10)<parseInt(k.css(e),10)){g=m;l[f]=k;l[f-1]=g}}}},_initializeResize:function(){if(this.resizable){var e=this;this.initResize({target:this.host,alsoResize:e._content,maxWidth:e.maxWidth,minWidth:e.minWidth,maxHeight:e.maxHeight,minHeight:e.minHeight,indicatorSize:10,resizeParent:e.dragArea})}},_removeResize:function(){this.removeResize()},_getEvent:function(e){if(this._isTouchDevice){return this._touchEvents[e]}else{return e}},_addEventHandlers:function(){this._addDragDropHandlers();this._addCloseHandlers();this._addCollapseHandlers();this._addFocusHandlers();this._documentResizeHandlers();this._closeButtonHover();this._collapseButtonHover();this._addDialogButtonsHandlers();this._addHeaderHoverEffect();this._addResizeHandlers();var e=this;this.addHandler(this._header,this._getEvent("mousemove"),function(f){e._addHeaderCursorHandlers(e)})},_addResizeHandlers:function(){var e=this;this.addHandler(this.host,"resizing",this._windowResizeHandler,{self:this})},_windowResizeHandler:function(f){var e=f.data.self;e._header.width(e.host.width()-(e._header.outerWidth(true)-e._header.width()));e.width=f.args.width;e.height=f.args.height},_addHeaderHoverEffect:function(){var e=this;this.addHandler(this._header,this._getEvent("mouseenter"),function(){a(this).addClass(e.toThemeProperty("jqx-window-header-hover"))});this.addHandler(this._header,this._getEvent("mouseleave"),function(){a(this).removeClass(e.toThemeProperty("jqx-window-header-hover"))})},_addDialogButtonsHandlers:function(){if(this.okButton){this.addHandler(a(this.okButton),this._getEvent("click"),this._setDialogResultHandler,{self:this,result:"ok"})}if(this.cancelButton){this.addHandler(a(this.cancelButton),this._getEvent("click"),this._setDialogResultHandler,{self:this,result:"cancel"})}},_documentResizeHandlers:function(){var e=this;if(this.isModal){a(window).resize(function(){if(typeof e._modalBackground==="object"&&e._modalBackground!==null){if(e.isOpen()){e._modalBackground.hide()}e._modalBackground.width(e._getDocumentSize().width);e._modalBackground.height(e._getDocumentSize().height);if(e.isOpen()){e._modalBackground.show()}}})}},_setDialogResultHandler:function(f){var e=f.data.self;e._setDialogResult(f.data.result);e.closeWindow()},_setDialogResult:function(e){this.dialogResult.OK=false;this.dialogResult.None=false;this.dialogResult.Cancel=false;e=e.toLowerCase();switch(e){case"ok":this.dialogResult.OK=true;break;case"cancel":this.dialogResult.Cancel=true;break;default:this.dialogResult.None=true}},_getDocumentSize:function(){var e=a.jqx.browser.msie&&a.jqx.browser.version<9;var f=e?4:0;var g=f;if(document.body.scrollHeight>document.body.clientHeight&&e){f=this._SCROLL_WIDTH}if(document.body.scrollWidth>document.body.clientWidth&&e){g=this._SCROLL_WIDTH}return{width:a(document).width()-f,height:a(document).height()-g}},_closeButtonHover:function(){var e=this;this.addHandler(this._closeButton,this._getEvent("mouseenter"),function(){e._closeButton.addClass(e.toThemeProperty("jqx-window-close-button-hover"))});this.addHandler(this._closeButton,this._getEvent("mouseleave"),function(){e._closeButton.removeClass(e.toThemeProperty("jqx-window-close-button-hover"))})},_collapseButtonHover:function(){var e=this;this.addHandler(this._collapseButton,this._getEvent("mouseenter"),function(){e._collapseButton.addClass(e.toThemeProperty("jqx-window-collapse-button-hover"))});this.addHandler(this._collapseButton,this._getEvent("mouseleave"),function(){e._collapseButton.removeClass(e.toThemeProperty("jqx-window-collapse-button-hover"))})},_setModalBackgroundStyles:function(){if(this.isModal){this._modalBackground.fadeTo(0,this.modalOpacity);this._modalBackground.css({position:"absolute",top:"0px",left:"0px",width:this._getDocumentSize().width,height:this._getDocumentSize().height,"z-index":this.modalBackgroundZIndex});if(!this.autoOpen){this._modalBackground.css("display","none")}}},_addFocusHandlers:function(){var e=this;this.addHandler(this.host,this._getEvent("mousedown"),function(){if(!e.isModal){e.bringToFront()}})},_indexOf:function(f,g){for(var e=0;e<g.length;e++){if(g[e][0]===f[0]){return e}}return -1},_addCloseHandlers:function(){var e=this;this.addHandler(this._closeButton,this._getEvent("click"),function(f){return e._closeWindow(f)});if(this.keyboardCloseKey!=="none"){if(typeof this.keyboardCloseKey!=="number"&&this.keyboardCloseKey.toLowerCase()==="esc"){this.keyboardCloseKey=27}}this.addHandler(this.host,"keydown",function(f){if(f.keyCode===e.keyboardCloseKey&&e.keyboardCloseKey!=null&&e.keyboardCloseKey!="none"){e._closeWindow(f)}else{e._handleKeys(f)}},{self:this});this.addHandler(this.host,"keyup",function(f){if(!e.keyboardNavigation){return}if(e._moved){var i=e.host.coord();var h=i.left;var g=i.top;e._raiseEvent(3,h,g,h,g);e._moved=false}})},_handleKeys:function(f){if(!this.keyboardNavigation){return}if(!this._headerFocused){return}var e=f.ctrlKey;var n=f.keyCode;var l=this.host.coord();var k=l.left;var m=l.top;var g=this._getDraggingArea();var h=this.host.width();var o=this.host.height();var p=true;var i=10;switch(n){case 37:if(!e){if(this.draggable){if(k-i>=0){this.move(k-i,m)}}}else{if(this.resizable){this.resize(h-i,o)}}p=false;break;case 38:if(!e){if(this.draggable){if(m-i>=0){this.move(k,m-i)}}}else{if(this.resizable){this.resize(h,o-i)}}p=false;break;case 39:if(!e){if(this.draggable){if(k+h+i<=g.width){this.move(k+i,m)}}}else{if(this.resizable){this.resize(h+i,o)}}p=false;break;case 40:if(!e){if(this.draggable){if(m+o+i<=g.height){this.move(k,m+i)}}}else{if(this.resizable){this.resize(h,o+i)}}p=false;break}if(!p){if(f.preventDefault){f.preventDefault()}if(f.stopPropagation){f.stopPropagation()}}return p},_addCollapseHandlers:function(){var e=this;this.addHandler(this._collapseButton,this._getEvent("click"),function(){if(!e.collapsed){e.collapse()}else{e.expand()}})},_closeWindow:function(e){this.closeWindow();return false},_addHeaderCursorHandlers:function(e){if(e.resizeArea&&e.resizable){e._header.css("cursor",e._resizeWrapper.css("cursor"));return}else{if(e.draggable){e._header.css("cursor","move");return}}e._header.css("cursor","default");if(e._resizeWrapper&&e._resizeWrapper.length>0){e._resizeWrapper.css("cursor","default")}},_addDragDropHandlers:function(){if(this.draggable){var e=this;this.addHandler(this.host,"focus",function(){e._headerFocused=true});this.addHandler(this.host,"blur",function(){e._headerFocused=false});this.addHandler(this._header,"focus",function(){e._headerFocused=true;return false});this.addHandler(this._header,this._getEvent("mousedown"),function(i){e._headerMouseDownHandler(e,i);return true});this.addHandler(this._header,"dragstart",function(i){if(i.preventDefault){i.preventDefault()}return false});this.addHandler(this._header,this._getEvent("mousemove"),function(i){return e._headerMouseMoveHandler(e,i)});this.addHandler(a(document),this._getEvent("mousemove")+"."+this.host.attr("id"),function(i){return e._dragHandler(e,i)});this.addHandler(a(document),this._getEvent("mouseup")+"."+this.host.attr("id"),function(i){return e._dropHandler(e,i)});try{if(document.referrer!=""||window.frameElement){var h=null;if(window.top!=null&&window.top!=window.self){if(window.parent&&document.referrer){h=document.referrer}}if(h&&h.indexOf(document.location.host)!=-1){var g=function(i){e._dropHandler(e,i)};if(window.top.document.addEventListener){window.top.document.addEventListener("mouseup",g,false)}else{if(window.top.document.attachEvent){window.top.document.attachEvent("onmouseup",g)}}}}}catch(f){}}},_headerMouseDownHandler:function(f,g){if(!f.isModal){f.bringToFront()}if(f._resizeDirection==null){var h=a.jqx.mobile.getTouches(g);var i=h[0];var e=a.jqx.position(g);f._mousePosition.x=e.left;f._mousePosition.y=e.top;f._mouseDown=true;f._isDragging=false}},_headerMouseMoveHandler:function(f,i){if(f._mouseDown&&!f._isDragging){var k=a.jqx.mobile.getTouches(i);var l=k[0];var h=l.pageX,g=l.pageY;var e=a.jqx.position(i);h=e.left;g=e.top;if((h+3<f._mousePosition.x||h-3>f._mousePosition.x)||(g+3<f._mousePosition.y||g-3>f._mousePosition.y)){f._isDragging=true;f._mousePosition={x:h,y:g};f._windowPosition={x:f.host.coord().left,y:f.host.coord().top};a(document.body).addClass(f.toThemeProperty("jqx-disableselect"))}if(f._isTouchDevice){i.preventDefault();return true}return false}if(f._isDragging){if(f._isTouchDevice){i.preventDefault();return true}return false}return true},_dropHandler:function(g,k){var f=true;if(g._isDragging&&!g.isResizing&&!g._resizeDirection){var e=parseInt(g.host.css("left"),10),l=parseInt(g.host.css("top"),10),i=(g._isTouchDevice)?0:k.pageX,h=(g._isTouchDevice)?0:k.pageY;g.enableResize=g._enableResizeBackup;g._enableResizeBackup="undefined";g._raiseEvent(3,e,l,i,h);f=false;if(k.preventDefault!="undefined"){k.preventDefault()}if(k.originalEvent!=null){k.originalEvent.mouseHandled=true}if(k.stopPropagation!="undefined"){k.stopPropagation()}}g._isDragging=false;g._mouseDown=false;a(document.body).removeClass(g.toThemeProperty("jqx-disableselect"));return f},_dragHandler:function(p,h){if(p._isDragging&&!p.isResizing&&!p._resizeDirection){var o=(p._isTouchDevice)?h.originalEvent.which:h.which;if(typeof p._enableResizeBackup==="undefined"){p._enableResizeBackup=p.enableResize}p.enableResize=false;if(o===0&&a.jqx.browser.msie&&a.jqx.browser.version<8){return p._dropHandler(p,h)}var m=a.jqx.mobile.getTouches(h);var l=m[0];var n=a.jqx.position(h);var k=n.left,i=n.top,g=k-p._mousePosition.x,f=i-p._mousePosition.y,e=p._windowPosition.x+g,q=p._windowPosition.y+f;p.move(e,q,h);h.preventDefault();return false}return true},_validateCoordinates:function(e,l,i,k){var h=this._getDraggingArea();e=(e<h.left)?h.left:e;l=(l<h.top)?h.top:l;var f=this.host.outerWidth(true);var g=this.host.outerHeight(true);if(e+f>=h.width+h.left-2*k){e=h.width+h.left-f-k}if(l+g>=h.height+h.top-i){l=h.height+h.top-g-i}return{x:e,y:l}},_performLayout:function(){this._performHeaderLayout();this._performWidgetLayout()},_parseDragAreaAttributes:function(){if(this.dragArea!==null){this.dragArea.height=parseInt(this.dragArea.height,10);this.dragArea.width=parseInt(this.dragArea.width,10);this.dragArea.top=parseInt(this.dragArea.top,10);this.dragArea.left=parseInt(this.dragArea.left,10)}},_positionWindow:function(){this._parseDragAreaAttributes();if(this.position instanceof Array&&this.position.length===2&&typeof this.position[0]==="number"&&typeof this.position[1]==="number"){this.host.css({left:this.position[0],top:this.position[1]})}else{if(this.position instanceof Object&&this.position.x!=="undefined"&&this.position.y!="undefined"){this.host.css({left:this.position.x,top:this.position.y})}else{this._positionFromLiteral()}}},_getDraggingArea:function(){var e={};e.left=((this.dragArea&&this.dragArea.left)?this.dragArea.left:0);e.top=((this.dragArea&&this.dragArea.top)?this.dragArea.top:0);e.width=((this.dragArea&&this.dragArea.width)?this.dragArea.width:this._getDocumentSize().width);e.height=((this.dragArea&&this.dragArea.height)?this.dragArea.height:this._getDocumentSize().height);return e},_positionFromLiteral:function(){if(!(this.position instanceof Array)){this.position=this.position.split(",")}var e=this.position.length,f=this._getDraggingArea();while(e){e-=1;this.position[e]=this.position[e].replace(/ /g,"");switch(this.position[e]){case"top":this.host.css("top",f.top);break;case"left":this.host.css("left",f.left);break;case"bottom":this.host.css("top",f.height-this.host.height()+f.top);break;case"right":this.host.css("left",f.left+f.width-this.host.width());break;default:if(!this.dragArea){f=a(window)}this._centerElement(this.host,f,"xy");break}}},_raiseEvent:function(g){var f=this._events[g],h=a.Event(f),e={};if(g===2||g===3){e.x=arguments[1];e.y=arguments[2];e.pageX=arguments[3];e.pageY=arguments[4]}if(f==="closed"||f==="close"){e.dialogResult=this.dialogResult}h.args=e;return this.host.trigger(h)},destroy:function(){this._removeEventHandlers();this._destroy()},_destroy:function(){if(this.restricter){this.removeHandler(a(window),"resize."+this.element.id);this.removeHandler(a(window),"orientationchanged."+this.element.id);this.removeHandler(a(window),"orientationchange."+this.element.id)}this.host.remove();if(this._modalBackground!==null){this._modalBackground.remove()}},_toClose:function(f,e){return((f&&e[0]===this.element)||(e[0]!==this.element&&typeof e[0]==="object"))},propertyChangedHandler:function(e,f,h,g){this._validateProperties();switch(f){case"rtl":this._performLayout();break;case"dragArea":this._positionWindow();break;case"collapseButtonSize":this._performLayout();break;case"closeButtonSize":this._performLayout();break;case"isModal":this._refresh();this._fixWindowZIndex();break;case"keyboardCloseKey":this._removeEventHandlers();this._addEventHandlers();break;case"disabled":if(g){this.disable()}else{this.disabled=true;this.enable()}break;case"showCloseButton":case"showCollapseButton":this._performLayout();break;case"height":this._performLayout();break;case"width":this._performLayout();break;case"title":this.setTitle(g);this.title=g;break;case"content":this.setContent(g);break;case"draggable":this._removeEventHandlers();this._addEventHandlers();this._initializeResize();break;case"resizable":this.enableResize=g;if(this.collapsed&&g){this.resizable=h}else{if(g){this._initializeResize()}else{this._removeResize()}}break;case"position":this._positionWindow();break;case"modalOpacity":this._setModalBackgroundStyles();break;case"okButton":if(g){this._addDialogButtonsHandlers()}else{this.removeHandler(this.okButton)}break;case"cancelButton":if(g){this._addDialogButtonsHandlers()}else{this.removeHandler(this.cancelButton)}break;case"collapsed":if(g){if(!h){this.collapsed=false;this.collapse(0)}}else{if(h){this.collapsed=true;this.expand(0)}}case"theme":a.jqx.utilities.setTheme(h,g,this.host);break;case"enableResize":return;default:return}},collapse:function(g){if(!this.collapsed&&!this.host.is(":animated")){if(this.host.css("display")=="none"){return}if(this.enableResize){this._enableResizeCollapseBackup=true;this.enableResize=false}var e=this,h=this._header.outerHeight(true),i=parseInt(this._header.css("border-bottom-width"),10),f=parseInt(this._header.css("margin-bottom"),10),g=!isNaN(parseInt(g))?g:this.collapseAnimationDuration;if(!isNaN(i)){h-=2*i}if(!isNaN(f)){h+=f}this._heightBeforeCollapse=this.host.height();this._minHeightBeforeCollapse=this.host.css("min-height");this.host.css("min-height",h);this.host.animate({height:h},g,function(){e.collapsed=true;e._collapseButton.addClass(e.toThemeProperty("jqx-window-collapse-button-collapsed"));e._content.css("display","none");e._raiseEvent(5);e._raiseEvent(9);a.jqx.aria(e,"aria-expanded",false)})}},expand:function(f){if(this.collapsed&&!this.host.is(":animated")){var e=this,f=!isNaN(parseInt(f))?f:this.collapseAnimationDuration;this.host.animate({height:this._heightBeforeCollapse},f,function(){e.collapsed=false;e.host.css("min-height",e._minHeightBeforeCollapse);e._collapseButton.removeClass(e.toThemeProperty("jqx-window-collapse-button-collapsed"));if(e._enableResizeCollapseBackup){e.enableResize=true}e._content.css("display","block");e._raiseEvent(6);e._performWidgetLayout();e._raiseEvent(9);a.jqx.aria(e,"aria-expanded",true)})}},closeAll:function(h){var h=true;var g=a.data(document.body,"jqxwindows-list"),f=g.length,e=a.data(document.body,"jqxwindow-modal")||[];while(f){f-=1;if(this._toClose(h,g[f])){g[f].jqxWindow("closeWindow","close");g.splice(f,1)}}if(this._toClose(h,e)){e.jqxWindow("closeWindow","close");a.data(document.body,"jqxwindow-modal",[])}a.data(document.body,"jqxwindows-list",g)},setTitle:function(e){a.jqx.utilities.html(this._headerContentWrapper,e);this._performLayout()},setContent:function(f){this._contentInitialized=false;var e=this._content,g=false;while(!g){e.css("height","auto");e.css("width","auto");if(e.is(".jqx-window")){g=true}else{e=e.parent()}}a.jqx.utilities.html(this._content,f);this._performLayout()},disable:function(){this.disabled=true;this._removeEventHandlers();this._header.addClass(this.toThemeProperty("jqx-window-header-disabled"));this._closeButton.addClass(this.toThemeProperty("jqx-window-close-button-disabled"));this._collapseButton.addClass(this.toThemeProperty("jqx-window-collapse-button-disabled"));this._content.addClass(this.toThemeProperty("jqx-window-content-disabled"));this.host.addClass(this.toThemeProperty("jqx-window-disabled"));this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"));this._removeResize()},enable:function(){if(this.disabled){this._addEventHandlers();this._header.removeClass(this.toThemeProperty("jqx-window-header-disabled"));this._content.removeClass(this.toThemeProperty("jqx-window-content-disabled"));this._closeButton.removeClass(this.toThemeProperty("jqx-window-close-button-disabled"));this._collapseButton.removeClass(this.toThemeProperty("jqx-window-collapse-button-disabled"));this.host.removeClass(this.toThemeProperty("jqx-window-disabled"));this.host.removeClass(this.toThemeProperty("jqx-fill-state-disabled"));this.disabled=false;this._initializeResize()}},isOpen:function(){return this._visible},closeWindow:function(f){var e=this;f=(typeof f==="undefined")?this.closeButtonAction:f;this.hide(function(){if(f==="close"){e._destroy()}})},bringToFront:function(){var f=a.data(document.body,"jqxwindows-list");if(f.length==0){if(this.isModal){f=a.data(document.body,"jqxwindows-modallist")}this._fixWindowZIndex("modal-hide");this._fixWindowZIndex("modal-show");return}var l=f[f.length-1],k=parseInt(l.css("z-index"),10),g=this._indexOf(this.host,f);for(var e=f.length-1;e>g;e-=1){var h=parseInt(f[e].css("z-index"),10)-1;f[e].css("z-index",h)}this.host.css("z-index",k);this._sortByStyle("z-index",f)},hide:function(h,g,e){if(this.closing){var f=this.closing();if(f==false){return}}g=g||this.closeAnimationDuration;switch(this.animationType){case"none":this.host.css("display","none");break;case"fade":this.host.fadeOut(g,function(){if(h instanceof Function){h()}});case"slide":this.host.slideUp(g,function(){if(h instanceof Function){h()}});case"combined":this.host.hide(g,function(){if(h instanceof Function){h()}})}this._visible=false;if(this.isModal){this._modalBackground.hide();this._fixWindowZIndex("modal-hide")}if(e!==true){this._raiseEvent(1);this._raiseEvent(8)}},open:function(f,e){this.show(f,e)},close:function(g,f,e){this.hide(g,f,e)},show:function(h,g){this._setDialogResult("none");g=g||this.showAnimationDuration;switch(this.animationType){case"none":this.host.css("display","block");break;case"fade":this.host.fadeIn(g,function(){if(h instanceof Function){h()}});case"slide":this.host.slideDown(g,function(){if(h instanceof Function){h()}});case"combined":this.host.show(g,function(){if(h instanceof Function){h()}})}if(this.isModal){this._modalBackground.show();this._fixWindowZIndex("modal-show")}var f=this;if(!this._visible){if(g>150&&this.animationType!="none"){setTimeout(function(){if(!f._contentInitialized){if(f.initContent){f.initContent();f._contentInitialized=true}}f._raiseEvent(7);f._raiseEvent(9)},g-150)}else{if(!f._contentInitialized){if(f.initContent){f.initContent();f._contentInitialized=true}}this._raiseEvent(7);f._raiseEvent(9)}}this._visible=true;this._performLayout();var e=function(){f._content.focus()};e();setTimeout(function(){e()},100)},_getTabbables:function(){var f=this._content.find("*");var e=new Array();a.each(f,function(){if(d(this)){e[e.length]=this}});return e},move:function(q,p,e,h){var g=0,f=0,n,k,i,q=parseInt(q,10),p=parseInt(p,10);if(a.jqx.browser.msie){if(a(window).width()>a(document).width()&&!this.dragArea){f=this._SCROLL_WIDTH}if(a(window).height()<a(document).height()&&document.documentElement.clientWidth>document.documentElement.scrollWidth&&!this.dragArea){g=this._SCROLL_WIDTH}}n=this._validateCoordinates(q,p,f,g);if(parseInt(this.host.css("left"),10)!==n.x||parseInt(this.host.css("top"),10)!==n.y){if(e){var m=a.jqx.mobile.getTouches(e);var l=m[0];var o=a.jqx.position(e);k=o.left;i=o.top}if(k==undefined){k=q}if(i==undefined){i=p}if(h!==false){this._raiseEvent(2,n.x,n.y,k,i)}}this.element.style.left=n.x+"px";this.element.style.top=n.y+"px";this._moved=true}});function c(g,e){var k=g.nodeName.toLowerCase();if("area"===k){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(k)?!g.disabled:"a"==k?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.css(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function d(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}}(jQuery));(function(b){var a=(function(c){return{resizeConfig:function(){this.resizeTarget=null;this.resizeIndicatorSize=5;this.resizeTargetChildren=null;this.isResizing=false;this.resizeArea=false;this.minWidth=1;this.maxWidth=100;this.minHeight=1;this.maxHeight=100;this.resizeParent=null;this.enableResize=true;this._cursorBackup;this._resizeEvents=["resizing","resized","resize"];this._resizeMouseDown=false;this._resizeCurrentMode=null;this._mouseResizePosition={};this._resizeMethods=null;this._SCROLL_WIDTH=21},_resizeExceptions:{invalidTarget:"Invalid target!",invalidMinHeight:"Invalid minimal height!",invalidMaxHeight:"Invalid maximum height!",invalidMinWidth:"Invalid minimum width!",invalidMaxWidth:"Invalid maximum width!",invalidIndicatorSize:"Invalid indicator size!",invalidSize:"Invalid size!"},removeResize:function(){if(this.resizeTarget){var f=c(this.resizeTarget.children(".jqx-resize"));f.detach();var e=f.children();this._removeResizeEventListeners();for(var d=0;d<e.length;d+=1){c(e[d]).detach();this.resizeTarget.append(e[d])}f.remove()}},initResize:function(d){this.resizeConfig();this.resizeTarget=c(d.target);this.resizeIndicatorSize=d.indicatorSize||10;this.maxWidth=d.maxWidth||100;this.minWidth=d.minWidth||1;this.maxHeight=d.maxHeight||100;this.minHeight=d.minHeight||1;this.resizeParent=d.resizeParent;this._parseResizeParentProperties();this._validateResizeProperties();this._validateResizeTargetDimensions();this._getChildren(this.resizeTarget.maxWidth,this.resizeTarget.minWidth,this.resizeTarget.maxHeight,this.resizeTarget.minHeight,d.alsoResize);this._refreshResize();this._cursorBackup=this.resizeTarget.css("cursor");if(this._cursorBackup==="auto"){this._cursorBackup="default"}},_validateResizeTargetDimensions:function(){this.resizeTarget.maxWidth=this.maxWidth;this.resizeTarget.minWidth=((3*this.resizeIndicatorSize>this.minWidth)?3*this.resizeIndicatorSize:this.minWidth);this.resizeTarget.maxHeight=this.maxHeight;this.resizeTarget.minHeight=((3*this.resizeIndicatorSize>this.minHeight)?3*this.resizeIndicatorSize:this.minHeight)},_parseResizeParentProperties:function(){if(this.resizeParent){this.resizeParent.left=parseInt(this.resizeParent.left,10);this.resizeParent.top=parseInt(this.resizeParent.top,10);this.resizeParent.width=parseInt(this.resizeParent.width,10);this.resizeParent.height=parseInt(this.resizeParent.height,10)}},_getChildren:function(h,e,g,i,d){this.resizeTargetChildren=c(d);this.resizeTargetChildren.toArray();var f=this.resizeTargetChildren.length;while(f){f-=1;this.resizeTargetChildren[f]=c(this.resizeTargetChildren[f])}},_refreshResize:function(){this._renderResize();this._performResizeLayout();this._removeResizeEventListeners();this._addResizeEventHandlers()},_renderResize:function(){this.resizeTarget.wrapInner(c("<div></div>"));this._resizeWrapper=this.resizeTarget.children(0);this._resizeWrapper.addClass("jqx-resize");this._resizeWrapper.addClass("jqx-rc-all");this._resizeWrapper.css("z-index",8000)},_performResizeLayout:function(){this._resizeWrapper.height(this.resizeTarget.height());this._resizeWrapper.width(this.resizeTarget.width())},_removeResizeEventListeners:function(){var d=this.resizeTarget.attr("id");this.removeHandler(this._resizeWrapper,"mousemove.resize"+d);this.removeHandler(this._resizeWrapper,"mousedown.resize"+d);this.removeHandler(c(document),"mousemove.resize"+d);this.removeHandler(c(document),"mouseup.resize"+d)},_addResizeEventHandlers:function(){var g=this.resizeTarget.attr("id");var d=this;this.addHandler(this._resizeWrapper,"mousemove.resize."+g,function(h){d._resizeCursorChangeHandler(d,h)});this.addHandler(this._resizeWrapper,"mousedown.resize."+g,function(h){d._resizeMouseDownHandler(d,h)});this.addHandler(c(document),"mousemove.resize."+g,function(h){return d._resizeHandler(d,h)});this.addHandler(c(document),"mouseup.resize."+g,function(h){d._stopResizing(d,h)});try{if(document.referrer!=""||window.frameElement){var f=function(h){d._stopResizing(d,h)};if(window.top.document.addEventListener){window.top.document.addEventListener("mouseup",f,false)}else{if(window.top.document.attachEvent){window.top.document.attachEvent("onmouseup",f)}}}}catch(e){}},_stopResizing:function(d,e){if(d.enableResize){if(d.isResizing){d._raiseResizeEvent(1)}d._resizeMouseDown=false;d.isResizing=false;d._resizeDirection=null;if(d.resizeTarget){d.resizeTarget.removeClass("jqx-disableselect")}}if(d._cursorBackup=="undefined"){d._cursorBackup="default"}if(d._resizeWrapper){d._resizeWrapper.css("cursor",d._cursorBackup)}},_resizeHandler:function(d,e){if(d.enableResize){if(d.isResizing&&d._resizeDirection){if(e.which===0&&c.jqx.browser.msie&&c.jqx.browser.version<9){d._stopResizing(e)}d._performResize(e.pageX,e.pageY);return false}else{return d._resizeCaptureCursor(e.pageX,e.pageY)}}},_resizeCaptureCursor:function(e,d){if(this._resizeMouseDown&&!this.isResizing&&this._resizeDirection){if((e+3<this._mouseResizePosition.x||e-3>this._mouseResizePosition.x)||(d+3<this._mouseResizePosition.y||d-3>this._mouseResizePosition.y)){this._changeCursor(e-parseInt(this.resizeTarget.css("left")),d-parseInt(this.resizeTarget.css("top")));this._mouseResizePosition={x:e,y:d};this._prepareResizeMethods(this._resizeDirection);this._resizeBackupData();this.isResizing=true;this.resizeTarget.addClass("jqx-disableselect");return false}}},_resizeBackupData:function(){this.resizeTarget.lastWidth=this.resizeTarget.width();this.resizeTarget.lastHeight=this.resizeTarget.height();this.resizeTarget.x=parseInt(this.resizeTarget.css("left"),10);this.resizeTarget.y=parseInt(this.resizeTarget.css("top"),10);this._resizeBackupChildrenSize()},_resizeBackupChildrenSize:function(){var d=this.resizeTargetChildren.length,e;while(d){d-=1;e=this.resizeTargetChildren[d];this.resizeTargetChildren[d].lastWidth=e.width();this.resizeTargetChildren[d].lastHeight=e.height()}},_performResize:function(g,f){var e=g-this._mouseResizePosition.x,d=f-this._mouseResizePosition.y;if(this._resizeDirection){this._resize(this.resizeTarget,e,d)}},_resizeCursorChangeHandler:function(d,e){if(d.enableResize){if(!d.isResizing){d._changeCursor(e.pageX-parseInt(d.resizeTarget.css("left")),e.pageY-parseInt(d.resizeTarget.css("top")))}}},_resizeMouseDownHandler:function(d,e){if(d.enableResize){if(d._resizeDirection!==null){d._resizeMouseDown=true;d._mouseResizePosition.x=e.pageX;d._mouseResizePosition.y=e.pageY;e.preventDefault()}}},_validateResizeProperties:function(){try{if(!this.resizeTarget||this.resizeTarget.length!==1){throw new Error(this._resizeExceptions.invalidTarget)}if(this.minHeight<0||isNaN(parseInt(this.minHeight))){throw new Error(this._resizeExceptions.invalidMinHeight)}if(this.maxHeight<=0||isNaN(parseInt(this.maxHeight))){throw new Error(this._resizeExceptions.invalidMaxHeight)}if(this.minWidth<0||isNaN(parseInt(this.minWidth))){throw new Error(this._resizeExceptions.invalidMinWidth)}if(this.maxWidth<0||isNaN(parseInt(this.maxWidth))){throw new Error(this._resizeExceptions.invalidMaxWidth)}if(this.resizeIndicatorSize<0||isNaN(parseInt(this.resizeIndicatorSize))){throw new Error(this._resizeExceptions.invalidIndicatorSize)}if(this.minHeight>this.maxHeight||this.minWidth>this.maxWidth){throw new Error(this._resizeExceptions.invalidSize)}if(this.resizeParent&&this.resizeParent.width&&this.resizeParent.height&&this.resizeParent.left&&this.resizeParent.top&&((this.resizeParent.width<this.resizeTarget.width()||this.resizeParent.width<this.maxWidth)||(this.resizeParent.height<this.resizeTarget.height()||this.resizeParent.height<this.maxHeight))){throw new Error(this._resizeExceptions.invalidSize)}}catch(d){alert(d)}},_changeCursor:function(d,e){if(this.isResizing||this._resizeMouseDown){return}this.resizeArea=true;if(d<=this.resizeIndicatorSize&&d>=0&&e<=this.resizeIndicatorSize&&e>0){this._resizeWrapper.css("cursor","nw-resize");this._resizeDirection="topleft"}else{if(e<=this.resizeIndicatorSize&&e>0&&d>=this.resizeTarget.width()-this.resizeIndicatorSize){this._resizeWrapper.css("cursor","ne-resize");this._resizeDirection="topright"}else{if(e>=this.resizeTarget.height()-this.resizeIndicatorSize&&e<this.resizeTarget.height()&&d<=this.resizeIndicatorSize&&d>=0){this._resizeWrapper.css("cursor","sw-resize");this._resizeDirection="bottomleft"}else{if(e>=this.resizeTarget.height()-this.resizeIndicatorSize&&e<this.resizeTarget.height()&&d>=this.resizeTarget.width()-this.resizeIndicatorSize&&d<this.resizeTarget.width()){this._resizeWrapper.css("cursor","se-resize");this._resizeDirection="bottomright"}else{if(d<=this.resizeIndicatorSize&&d>=0){this._resizeWrapper.css("cursor","e-resize");this._resizeDirection="left"}else{if(e<=this.resizeIndicatorSize&&e>0){this._resizeWrapper.css("cursor","n-resize");this._resizeDirection="top"}else{if(e>=this.resizeTarget.height()-this.resizeIndicatorSize&&e<this.resizeTarget.height()){this._resizeWrapper.css("cursor","n-resize");this._resizeDirection="bottom"}else{if(d>=this.resizeTarget.width()-this.resizeIndicatorSize&&d<this.resizeTarget.width()){this._resizeWrapper.css("cursor","e-resize");this._resizeDirection="right"}else{this._resizeWrapper.css("cursor",this._cursorBackup);this._resizeDirection=null;this.resizeArea=false}}}}}}}}},_prepareResizeMethods:function(d){this._resizeMethods=[];if(d.indexOf("left")>=0){this._resizeMethods.push(this._resizeLeft)}if(d.indexOf("top")>=0){this._resizeMethods.push(this._resizeTop)}if(d.indexOf("right")>=0){this._resizeMethods.push(this._resizeRight)}if(d.indexOf("bottom")>=0){this._resizeMethods.push(this._resizeBottom)}},_validateResize:function(g,d,h,f,e){if(h==="horizontal"||h==="both"){return this._validateWidth(g,f,e)}else{if(h==="vertical"||h==="both"){return this._validateHeight(d,f,e)}}return{result:false,fix:0}},_getParent:function(){if(this.resizeParent!==null&&this.resizeParent!=="undefined"&&this.resizeParent.height&&this.resizeParent.width&&this.resizeParent.top&&this.resizeParent.left){return this.resizeParent}return{left:0,top:0,width:c(document).width(),height:c(document).height()}},_validateHeight:function(f,k,i){var l=0,e=2,d=false,h=f,g=this._getParent();if(c(window).width()>c(document).width()&&c.jqx.browser.msie&&g.height===c(document).height()){l=this._SCROLL_WIDTH}if(i==="bottom"&&(f+k.position().top+l+e>g.height+g.top)){return{fix:g.height-k.position().top-l-e+g.top,result:false}}if(i==="top"&&k.lastHeight-f+k.y<g.top){return{fix:f+(k.lastHeight-f+k.y)-g.top,result:false}}if(f<k.minHeight){return{fix:k.minHeight,result:false}}if(f>k.maxHeight){return{fix:k.maxHeight,result:false}}return{result:true,fix:f}},_validateWidth:function(k,i,h){var l=0,e=2,d=false,g=k,f=this._getParent();if(c(window).height()<c(document).height()&&c.jqx.browser.msie&&document.documentElement.clientWidth>=document.documentElement.scrollWidth&&f.width===c(document).width()){l=this._SCROLL_WIDTH}if(h==="right"&&(k+i.position().left+l+e>f.width+f.left)){return{fix:f.width-i.position().left-l-e+f.left,result:false}}if(h==="left"&&(i.lastWidth-k+i.x<f.left)){return{fix:k+(i.lastWidth-k+i.x)-f.left,result:false}}if(k<i.minWidth){return{fix:i.minWidth,result:false}}if(k>i.maxWidth){return{fix:i.maxWidth,result:false}}return{result:true,fix:k}},_resize:function(h,e,d){var l=this._resizeDirection;var k=this._resizeMethods.length;for(var g=0;g<k;g++){if(this._resizeMethods[g] instanceof Function){var f={element:h,x:e,y:d,self:this};this._resizeMethods[g](f)}}this._performResizeLayout()},resize:function(g,d){if(this.resizable){var f=g-this.host.width();var e=d-this.host.height();var h="right";if(e!=0){h="bottom"}this._resizeDirection=h;this._prepareResizeMethods(this._resizeDirection);this._resizeBackupData();this.isResizing=true;this._resize(this.resizeTarget,f,e);this.isResizing=false}},_setResizeChildrenSize:function(e,f){var h=this.resizeTargetChildren.length;while(h){h--;if(f==="width"){var g=this.resizeTargetChildren[h].lastWidth-(this.resizeTarget.lastWidth-e);if(g<this.resizeTarget.maxWidth&&g>0){this.resizeTargetChildren[h].width(g)}}else{var d=this.resizeTargetChildren[h].lastHeight-(this.resizeTarget.lastHeight-e);if(d<this.resizeTarget.maxHeight&&d>0){this.resizeTargetChildren[h].height(d)}}}},_resizeRight:function(e){var f=e.element.lastWidth+e.x,d=e.self._validateResize(f,0,"horizontal",e.element,"right");if(!d.result){f=d.fix}if(e.element.width()!==f){e.self._setResizeChildrenSize(f,"width");e.element.width(f);e.self._raiseResizeEvent(0)}return f},_resizeLeft:function(f){var g=f.element.lastWidth-f.x,e=f.self._validateResize(g,0,"horizontal",f.element,"left"),d=f.element.x+f.x;if(!e.result){d=f.element.x+(f.element.lastWidth-e.fix);g=e.fix;return}if(f.element.width()!==g){f.self._setResizeChildrenSize(g,"width");f.element.width(g);f.element.css("left",d);f.self._raiseResizeEvent(0)}return g},_resizeBottom:function(f){var e=f.element.lastHeight+f.y,d=f.self._validateResize(0,e,"vertical",f.element,"bottom");if(!d.result){e=d.fix}if(f.element.height()!==e){f.self._setResizeChildrenSize(e,"height");f.element.height(e);f.self._raiseResizeEvent(0)}return e},_resizeTop:function(f){var e=f.element.lastHeight-f.y,d=f.self._validateResize(0,e,"vertical",f.element,"top"),g=f.element.y+f.y;if(!d.result){g=f.element.y+(f.element.lastHeight-d.fix);e=d.fix;return}if(f.element.height()!==e){f.self._setResizeChildrenSize(e,"height");f.element.height(e);f.element.css("top",g);f.self._raiseResizeEvent(0)}return e},_raiseResizeEvent:function(f){var e=this._resizeEvents[f],g=c.Event(e),d={};d.width=parseInt(this.resizeTarget[0].style.width);d.height=parseInt(this.resizeTarget[0].style.height);g.args=d;if(f==0){var e=this._resizeEvents[2],h=c.Event(e);h.args=d;this.resizeTarget.trigger(h)}return this.resizeTarget.trigger(g)}}}(jQuery));b.extend(b.jqx._jqxWindow.prototype,a)}(jQuery));

/*
jQWidgets v3.0.3 (2013-Oct-01)
Copyright (c) 2011-2013 jQWidgets.
License: http://jqwidgets.com/license/
*/

(function(a){a.jqx.jqxWidget("jqxNumberInput","",{});a.extend(a.jqx._jqxNumberInput.prototype,{defineInstance:function(){this.value=null;this.decimal=0;this.min=-99999999;this.max=99999999;this.width=null;this.validationMessage="Invalid value";this.height=50;this.textAlign="right";this.readOnly=false;this.promptChar="_";this.decimalDigits=2;this.decimalSeparator=".";this.groupSeparator=",";this.groupSize=3;this.symbol="";this.symbolPosition="left";this.digits=8;this.negative=false;this.negativeSymbol="-";this.disabled=false;this.inputMode="advanced";this.spinButtons=false;this.spinButtonsWidth=18;this.spinButtonsStep=1;this.autoValidate=true;this.spinMode="advanced";this.touchMode="auto";this.rtl=false;this.events=["valuechanged","textchanged","mousedown","mouseup","keydown","keyup","keypress","change"];this.aria={"aria-valuenow":{name:"decimal",type:"number"},"aria-valuemin":{name:"min",type:"number"},"aria-valuemax":{name:"max",type:"number"},"aria-disabled":{name:"disabled",type:"boolean"}};this.invalidArgumentExceptions=["invalid argument exception"]},createInstance:function(b){var c=this.host.attr("value");if(c!=undefined){this.decimal=c}if(this.value!=null){this.decimal=this.value}this.render()},_doTouchHandling:function(){var e=this;var g=e.savedValue;if(!e.parsing){e.parsing=true}if(e.parsing){if(e.numberInput.val()&&e.numberInput.val().indexOf("-")==0){e.setvalue("negative",true)}else{e.setvalue("negative",false)}var f=e.numberInput.val();for(var c=0;c<f.length-1;c++){var d=f.substring(c,c+1);if(isNaN(parseFloat(d))&&d!=e.symbol&&d!="%"&&d!="$"&&d!="."&&d!=","&&d!="-"){e.numberInput[0].value=g;e.parsing=false;return}}e.ValueString=e.GetValueString(e.numberInput.val(),e.decimalSeparator,e.decimalSeparator!="");e.ValueString=new Number(e.ValueString).toFixed(e.decimalDigits);e._parseDecimalInSimpleMode();e.decimal=e.ValueString;var b=e.getvalue("negative");if(b){e.decimal="-"+e.ValueString}e.parsing=false}},render:function(){this.host.attr({role:"spinbutton"});this.host.attr("data-role","input");a.jqx.aria(this);a.jqx.aria(this,"aria-multiline",false);var f=this;a.jqx.utilities.resize(this.host,function(){f._render()});if(this.officeMode||(this.theme&&this.theme.indexOf("office")!=-1)){if(this.spinButtonsWidth==18){this.spinButtonsWidth=15}}if(a.jqx.mobile.isTouchDevice()||this.touchMode===true){this.inputMode="textbox";this.spinMode="simple"}if(this.decimalSeparator==""){this.decimalSeparator=" "}this.host.addClass(this.toThemeProperty("jqx-input"));this.host.addClass(this.toThemeProperty("jqx-rc-all"));this.host.addClass(this.toThemeProperty("jqx-widget"));this.host.addClass(this.toThemeProperty("jqx-widget-content"));this.host.addClass(this.toThemeProperty("jqx-numberinput"));if(this.spinButtons){this._spinButtons()}else{this.numberInput=a("<input autocomplete='off' type='textarea'/>").appendTo(this.host);this.numberInput.addClass(this.toThemeProperty("jqx-input-content"));this.numberInput.addClass(this.toThemeProperty("jqx-widget-content"))}var d=this.host.attr("name");if(!d){d=this.element.id}this.numberInput.attr("name",d);if(a.jqx.mobile.isTouchDevice()||this.touchMode===true||this.inputMode=="textbox"){var f=this;f.savedValue="";this.addHandler(this.numberInput,"focus",function(){f.savedValue=f.numberInput[0].value});this.addHandler(this.numberInput,"change",function(){f._doTouchHandling()})}var h=a.data(this.host[0],"jqxNumberInput");h.jqxNumberInput=this;var f=this;this.removeHandler(this.host,"loadContent");this.addHandler(this.host,"loadContent",function(n){f._render()});if(this.host.parents("form").length>0){this.removeHandler(this.host.parents("form"),"loadContent");this.addHandler(this.host.parents("form"),"reset",function(){setTimeout(function(){f.setDecimal(0)},10)})}this.propertyChangeMap.disabled=function(n,q,o,r){if(r){n.numberInput.addClass(c.toThemeProperty("jqx-input-disabled"));n.numberInput.attr("disabled",true)}else{n.host.removeClass(c.toThemeProperty("jqx-input-disabled"));n.numberInput.attr("disabled",false)}if(n.spinButtons&&n.host.jqxRepeatButton){n.upbutton.jqxRepeatButton({disabled:r});n.downbutton.jqxRepeatButton({disabled:r})}};if(this.disabled){this.numberInput.addClass(this.toThemeProperty("jqx-input-disabled"));this.numberInput.attr("disabled",true);this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"))}this.selectedText="";this.decimalSeparatorPosition=-1;var l=this.element.id;var e=this.element;var c=this;this.oldValue=this._value();this.items=new Array();var g=this.value;var b=this.decimal;this._initializeLiterals();this._render();this.setDecimal(b);var f=this;setTimeout(function(){f._render(false)},100);this._addHandlers()},refresh:function(b){if(!b){this._render()}},wheel:function(d,c){var e=0;if(!d){d=window.event}if(d.originalEvent&&d.originalEvent.wheelDelta){d.wheelDelta=d.originalEvent.wheelDelta}if(d.wheelDelta){e=d.wheelDelta/120}else{if(d.detail){e=-d.detail/3}}if(e){var b=c._handleDelta(e);if(d.preventDefault){d.preventDefault()}if(d.originalEvent!=null){d.originalEvent.mouseHandled=true}if(d.stopPropagation!=undefined){d.stopPropagation()}if(b){b=false;d.returnValue=b;return b}else{return false}}if(d.preventDefault){d.preventDefault()}d.returnValue=false},_handleDelta:function(b){if(b<0){this.spinDown()}else{this.spinUp()}return true},_addHandlers:function(){var b=this;this.addHandler(this.numberInput,"mousedown",function(d){return b._raiseEvent(2,d)});this._mousewheelfunc=this._mousewheelfunc||function(d){if(!b.editcell){b.wheel(d,b);return false}};this.removeHandler(this.host,"mousewheel",this._mousewheelfunc);this.addHandler(this.host,"mousewheel",this._mousewheelfunc);var c="";this.addHandler(this.numberInput,"focus",function(d){a.data(b.numberInput,"selectionstart",b._selection().start);b.host.addClass(b.toThemeProperty("jqx-fill-state-focus"));if(b.spincontainer){b.spincontainer.addClass(b.toThemeProperty("jqx-numberinput-focus"))}c=b.numberInput.val()});this.addHandler(this.numberInput,"blur",function(e){if(b.inputMode=="simple"){b._exitSimpleInputMode(e,b,false,c)}if(b.autoValidate){var f=parseFloat(b.decimal);var d=b.getvalue("negative");if(d&&b.decimal>0){f=-parseFloat(b.decimal)}if(f>b.max){b._disableSetSelection=true;b.setDecimal(b.max);b._disableSetSelection=false}if(f<b.min){b._disableSetSelection=true;b.setDecimal(b.min);b._disableSetSelection=false}}b.host.removeClass(b.toThemeProperty("jqx-fill-state-focus"));if(b.spincontainer){b.spincontainer.removeClass(b.toThemeProperty("jqx-numberinput-focus"))}if(b.numberInput.val()!=c){b._raiseEvent(7,e);a.jqx.aria(b,"aria-valuenow",b.decimal);b.element.value=b.decimal}return true});this.addHandler(this.numberInput,"mouseup",function(d){return b._raiseEvent(3,d)});this.addHandler(this.numberInput,"keydown",function(d){return b._raiseEvent(4,d)});this.addHandler(this.numberInput,"keyup",function(d){return b._raiseEvent(5,d)});this.addHandler(this.numberInput,"keypress",function(d){return b._raiseEvent(6,d)})},focus:function(){try{this.numberInput.focus()}catch(b){}},_removeHandlers:function(){var b=this;this.removeHandler(this.numberInput,"mousedown");var c=a.jqx.mobile.isOperaMiniMobileBrowser();if(c){this.removeHandler(a(document),"click."+this.element.id,b._exitSimpleInputMode,b)}this.removeHandler(this.numberInput,"focus");this.removeHandler(this.numberInput,"blur");this.removeHandler(this.numberInput,"mouseup");this.removeHandler(this.numberInput,"keydown");this.removeHandler(this.numberInput,"keyup");this.removeHandler(this.numberInput,"keypress")},_spinButtons:function(){if(this.host.jqxRepeatButton){if(!this.numberInput){this.numberInput=a("<input autocomplete='off' style='position: relative; float: left;' type='textarea'/>");this.numberInput.appendTo(this.host);this.numberInput.addClass(this.toThemeProperty("jqx-input-content"));this.numberInput.addClass(this.toThemeProperty("jqx-widget-content"))}else{this.numberInput.css("float","left")}if(this.spincontainer){if(this.upbutton){this.upbutton.jqxRepeatButton("destroy")}if(this.downbutton){this.downbutton.jqxRepeatButton("destroy")}this.spincontainer.remove()}this.spincontainer=a('<div style="float: right; height: 100%; overflow: hidden; position: relative;"></div>');if(this.rtl){this.spincontainer.css("float","right");this.numberInput.css("float","right")}this.host.append(this.spincontainer);this.upbutton=a('<div style="overflow: hidden; padding: 0px; margin-left: -1px; position: relative;"><div></div></div>');this.spincontainer.append(this.upbutton);this.upbutton.jqxRepeatButton({overrideTheme:true,disabled:this.disabled,roundedCorners:"top-right"});this.downbutton=a('<div style="overflow: hidden; padding: 0px; margin-left: -1px; position: relative;"><div></div></div>');this.spincontainer.append(this.downbutton);this.downbutton.jqxRepeatButton({overrideTheme:true,disabled:this.disabled,roundedCorners:"bottom-right"});var d=this;this.downbutton.addClass(this.toThemeProperty("jqx-fill-state-normal"));this.upbutton.addClass(this.toThemeProperty("jqx-fill-state-normal"));this.upbutton.addClass(this.toThemeProperty("jqx-rc-tr"));this.downbutton.addClass(this.toThemeProperty("jqx-rc-br"));this.addHandler(this.downbutton,"mouseup",function(e){if(!d.disabled){d.downbutton.removeClass(d.toThemeProperty("jqx-fill-state-pressed"));d._downArrow.removeClass(d.toThemeProperty("jqx-icon-arrow-down-selected"))}});this.addHandler(this.upbutton,"mouseup",function(e){if(!d.disabled){d.upbutton.removeClass(d.toThemeProperty("jqx-fill-state-pressed"));d._upArrow.removeClass(d.toThemeProperty("jqx-icon-arrow-up-selected"))}});this.removeHandler(a(document),"mouseup."+this.element.id);this.addHandler(a(document),"mouseup."+this.element.id,function(e){d.upbutton.removeClass(d.toThemeProperty("jqx-fill-state-pressed"));d._upArrow.removeClass(d.toThemeProperty("jqx-icon-arrow-up-selected"));d.downbutton.removeClass(d.toThemeProperty("jqx-fill-state-pressed"));d._downArrow.removeClass(d.toThemeProperty("jqx-icon-arrow-down-selected"))});this.addHandler(this.downbutton,"mousedown",function(e){if(!d.disabled){if(a.jqx.browser.msie&&a.jqx.browser.version<9){d._inputSelection=d._selection()}d.downbutton.addClass(d.toThemeProperty("jqx-fill-state-pressed"));d._downArrow.addClass(d.toThemeProperty("jqx-icon-arrow-down-selected"));e.preventDefault();e.stopPropagation();return false}});this.addHandler(this.upbutton,"mousedown",function(e){if(!d.disabled){if(a.jqx.browser.msie&&a.jqx.browser.version<9){d._inputSelection=d._selection()}d.upbutton.addClass(d.toThemeProperty("jqx-fill-state-pressed"));d._upArrow.addClass(d.toThemeProperty("jqx-icon-arrow-up-selected"));e.preventDefault();e.stopPropagation();return false}});this.addHandler(this.upbutton,"mouseenter",function(e){d.upbutton.addClass(d.toThemeProperty("jqx-fill-state-hover"));d._upArrow.addClass(d.toThemeProperty("jqx-icon-arrow-up-hover"))});this.addHandler(this.upbutton,"mouseleave",function(e){d.upbutton.removeClass(d.toThemeProperty("jqx-fill-state-hover"));d._upArrow.removeClass(d.toThemeProperty("jqx-icon-arrow-up-hover"))});this.addHandler(this.downbutton,"mouseenter",function(e){d.downbutton.addClass(d.toThemeProperty("jqx-fill-state-hover"));d._downArrow.addClass(d.toThemeProperty("jqx-icon-arrow-down-hover"))});this.addHandler(this.downbutton,"mouseleave",function(e){d.downbutton.removeClass(d.toThemeProperty("jqx-fill-state-hover"));d._downArrow.removeClass(d.toThemeProperty("jqx-icon-arrow-down-hover"))});this.upbutton.css("border-width","0px");this.downbutton.css("border-width","0px");if(this.disabled){this.upbutton[0].disabled=true;this.downbutton[0].disabled=true}else{this.upbutton[0].disabled=false;this.downbutton[0].disabled=false}this.spincontainer.addClass(this.toThemeProperty("jqx-input"));this.spincontainer.addClass(this.toThemeProperty("jqx-rc-r"));this.spincontainer.css("border-width","0px");if(!this.rtl){this.spincontainer.css("border-left-width","1px")}else{this.spincontainer.css("border-right-width","1px")}this._upArrow=this.upbutton.find("div");this._downArrow=this.downbutton.find("div");this._upArrow.addClass(this.toThemeProperty("jqx-icon-arrow-up"));this._downArrow.addClass(this.toThemeProperty("jqx-icon-arrow-down"));this._upArrow.addClass(this.toThemeProperty("jqx-input-icon"));this._downArrow.addClass(this.toThemeProperty("jqx-input-icon"));var d=this;this._upArrow.hover(function(){if(!d.disabled){d._upArrow.addClass(d.toThemeProperty("jqx-icon-arrow-up-hover"))}},function(){d._upArrow.removeClass(d.toThemeProperty("jqx-icon-arrow-up-hover"))});this._downArrow.hover(function(){if(!d.disabled){d._downArrow.addClass(d.toThemeProperty("jqx-icon-arrow-down-hover"))}},function(){d._downArrow.removeClass(d.toThemeProperty("jqx-icon-arrow-down-hover"))});var b=a.jqx.mobile.isTouchDevice();var c="click";if(b){c=a.jqx.mobile.getTouchEventName("touchstart")}this.addHandler(this.downbutton,c,function(e){if(!b){if(d._selection().start==0){d._setSelectionStart(d.numberInput.val().length)}if(a.jqx.browser.msie&&a.jqx.browser.version<9){d._setSelectionStart(d._inputSelection.start)}}else{e.preventDefault();e.stopPropagation()}d.spinDown();return false});this.addHandler(this.upbutton,c,function(e){if(!b){if(d._selection().start==0){d._setSelectionStart(d.numberInput.val().length)}if(a.jqx.browser.msie&&a.jqx.browser.version<9){d._setSelectionStart(d._inputSelection.start)}}else{e.preventDefault();e.stopPropagation()}d.spinUp();return false})}else{throw new Error("jqxNumberInput: Missing reference to jqxbuttons.js.")}},spinDown:function(){var o=this;if(o.spinMode=="none"){return}var b=this.getvalue("negative");var t=b?-1:0;if(a.jqx.mobile.isTouchDevice()||this.inputMode=="textbox"){o._doTouchHandling()}if(!o.disabled){var r=this._selection();var q=this.decimal;var l=this.getDecimal();if(l<this.min){l=this.min;this.setDecimal(this.min);this._setSelectionStart(r.start);this.spinDown();return}else{if(l>this.max){l=this.max;this.setDecimal(this.max);this._setSelectionStart(r.start);this.spinDown();return}}if(o.spinButtonsStep<0){o.spinButtonsStep=1}var d=parseInt(o.decimal)+o.spinButtonsStep;d=d.toString().length;var f=t+d<=o.digits;if(o.spinMode!="advanced"){if(l-o.spinButtonsStep>=o.min&&f){var v=1;for(g=0;g<o.decimalDigits;g++){v=v*10}var e=(v*l)-(v*o.spinButtonsStep);e=e/v;e=this._parseDecimalValueToEditorValue(e);o.setDecimal(e)}}else{var s=this._getspindecimal();var n=this._getSeparatorPosition();var l=parseFloat(s.decimal);if(o.spinButtonsStep<0){o.spinButtonsStep=1}var d=parseInt(l)+o.spinButtonsStep;d=d.toString().length;var f=t+d<=o.digits;var v=1;var c=s.decimal.indexOf(".");if(c!=-1){var h=s.decimal.length-c-1;var v=1;for(var g=0;g<h;g++){v=v*10}l-=new Number(o.spinButtonsStep/v);l=l.toFixed(h);var c=l.toString().indexOf(".");if(c==-1){l=l.toString()+"."}var u=l.toString()+s.afterdecimal;u=new Number(u);u=u.toFixed(o.decimalDigits);if(u>=o.min){u=this._parseDecimalValueToEditorValue(u);o.setDecimal(u)}}else{if(l-o.spinButtonsStep>=o.min&&f){var e=(v*l)-(v*o.spinButtonsStep);e=e/v;var u=e.toString()+s.afterdecimal;if(u>=o.min){u=this._parseDecimalValueToEditorValue(u);o.setDecimal(u)}}}}if(u==undefined||this.inputMode!="simple"){this._setSelectionStart(r.start);o.savedValue=o.numberInput[0].value;return}u=this.decimal.toString();var b=this.getvalue("negative");if(t==0&&b){this._setSelectionStart(r.start+1)}else{if((u!=undefined&&(q==undefined||q.toString().length==u.length))){this._setSelectionStart(r.start)}else{if(b){this._setSelectionStart(r.start+1)}else{this._setSelectionStart(r.start-1)}}}}},_getspindecimal:function(){var q=this._selection();var r="";var n=this._getSeparatorPosition();var t=this._getVisibleItems();var e=this._getHiddenPrefixCount();var s=this.numberInput.val();if(this.numberInput.val().length==q.start&&q.length==0){this._setSelection(q.start,q.start+1);q=this._selection()}var l=this.inputMode!="advanced";for(var c=0;c<q.start;c++){if(l){var o=s.substring(c,c+1);var h=(!isNaN(parseInt(o)));if(h){r+=o}if(o==this.decimalSeparator){r+=o}continue}if(t[c].canEdit&&t[c].character!=this.promptChar){r+=t[c].character}else{if(!t[c].canEdit&&this.decimalSeparatorPosition!=-1&&t[c]==t[this.decimalSeparatorPosition-e]){if(r.length==0){r="0"}r+=t[c].character}}}var g="";for(var c=q.start;c<t.length;c++){if(l){var o=s.substring(c,c+1);var h=(!isNaN(parseInt(o)));if(h){g+=o}if(o==this.decimalSeparator){g+=o}continue}if(t[c].canEdit&&t[c].character!=this.promptChar){g+=t[c].character}else{if(!t[c].canEdit&&this.decimalSeparatorPosition!=-1&&t[c]==t[this.decimalSeparatorPosition-e]){g+=t[c].character}}}var b=this.getvalue("negative");var f=b?"-"+this._parseDecimalValue(r).toString():this._parseDecimalValue(r).toString();return{decimal:f,afterdecimal:this._parseDecimalValue(g)}},_parseDecimalValue:function(c){if(this.decimalSeparator!="."){var d=c.toString().indexOf(this.decimalSeparator);if(d>=0){var b=c.toString().substring(0,d)+"."+c.toString().substring(d+1);return b}}return c},_parseDecimalValueToEditorValue:function(c){if(this.decimalSeparator!="."){var d=c.toString().indexOf(".");if(d>=0){var b=c.toString().substring(0,d)+this.decimalSeparator+c.toString().substring(d+1);return b}}return c},spinUp:function(){var q=this;if(q.spinMode=="none"){return}if(a.jqx.mobile.isTouchDevice()||this.inputMode=="textbox"){q._doTouchHandling()}var b=this.getvalue("negative");var u=b?-1:0;if(!q.disabled){var s=this._selection();var r=q.decimal;var n=q.getDecimal();if(n<this.min){n=this.min;this.setDecimal(this.min);this._setSelectionStart(s.start);this.spinUp();return}else{if(n>this.max){n=this.max;this.setDecimal(this.max);this._setSelectionStart(s.start);this.spinUp();return}}if(q.spinButtonsStep<0){q.spinButtonsStep=1}var d=parseInt(q.decimal)+q.spinButtonsStep;d=d.toString().length;var g=u+d<=q.digits;if(q.spinMode!="advanced"){if(n+q.spinButtonsStep<=q.max&&g){var w=1;for(var l=0;l<q.decimalDigits;l++){w=w*10}var f=(w*n)+(w*q.spinButtonsStep);f=f/w;f=this._parseDecimalValueToEditorValue(f);q.setDecimal(f)}}else{var t=this._getspindecimal();var o=this._getSeparatorPosition();var n=parseFloat(t.decimal);if(q.spinButtonsStep<0){q.spinButtonsStep=1}var d=parseInt(n)+q.spinButtonsStep;d=d.toString().length;var g=u+d<=q.digits;var w=1;var c=t.decimal.indexOf(".");if(c!=-1){var h=t.decimal.length-c-1;var w=1;for(var l=0;l<h;l++){w=w*10}n+=new Number(q.spinButtonsStep/w);n=n.toFixed(h);var c=n.toString().indexOf(".");if(c==-1){n=n.toString()+"."}var v=n.toString()+t.afterdecimal;v=new Number(v);v=v.toFixed(q.decimalDigits);var e=new Number(v).toFixed(q.decimalDigits);if(e<=q.max){v=this._parseDecimalValueToEditorValue(v);q.setDecimal(v)}else{v=undefined}}else{if(n+q.spinButtonsStep<=q.max&&g){var f=(w*n)+(w*q.spinButtonsStep);f=f/w;var v=f.toString()+t.afterdecimal;var e=new Number(v).toFixed(q.decimalDigits);if(e<=q.max){v=this._parseDecimalValueToEditorValue(v);if(b&&v.indexOf("-")==-1){if(t.decimal!="-0"){v="-"+v}}q.setDecimal(v)}else{v=undefined}}}}if(v==undefined||this.inputMode!="simple"){this._setSelectionStart(s.start);q.savedValue=q.numberInput[0].value;return}v=this.decimal.toString();var b=this.getvalue("negative");if(u==-1&&!b){this._setSelectionStart(-1+s.start)}else{if((v!=undefined&&(r==undefined||r.toString().length==v.length))){this._setSelectionStart(s.start)}else{if(b){this._setSelectionStart(-1+s.start)}else{this._setSelectionStart(1+s.start)}}}}},_exitSimpleInputMode:function(b,o,h,d){if(o==undefined){o=b.data}if(o==null){return}if(h==undefined){if(b.target!=null&&o.element!=null){if((b.target.id!=undefined&&b.target.id.toString().length>0&&o.host.find("#"+b.target.id).length>0)||b.target==o.element){return}}var f=o.host.offset();var e=f.left;var g=f.top;var c=o.host.width();var n=o.host.height();var q=a(b.target).offset();if(q.left>=e&&q.left<=e+c){if(q.top>=g&&q.top<=g+n){return}}}if(a.jqx.mobile.isOperaMiniBrowser()){o.numberInput.attr("readonly",true)}if(o.disabled||o.readOnly){return}var l=a.data(o.numberInput,"simpleInputMode");if(l==null){return}a.data(o.numberInput,"simpleInputMode",null);this._parseDecimalInSimpleMode();return false},_getDecimalInSimpleMode:function(){var d=this.decimal;if(this.decimalSeparator!="."){var b=d.toString().indexOf(this.decimalSeparator);if(b>0){var c=d.toString().substring(0,b);var d=c+"."+d.toString().substring(b+1)}}return d},_parseDecimalInSimpleMode:function(d){var o=this;var b=o.getvalue("negative");var e=this.ValueString;if(e==undefined){e=this.GetValueString(this.numberInput.val(),this.decimalSeparator,this.decimalSeparator!="")}if(this.decimalSeparator!="."){var g=e.toString().indexOf(".");if(g>0){var f=e.toString().substring(0,g);var c=f+this.decimalSeparator+e.toString().substring(g+1);e=c}}var h=b?"-":"";if(this.symbolPosition=="left"){h+=this.symbol}var l=this.digits%this.groupSize;if(l==0){l=this.groupSize}var n=e.toString();h+=n;if(this.symbolPosition=="right"){h+=this.symbol}if(d!=false){o.numberInput.val(h)}},_enterSimpleInputMode:function(f,d){if(d==undefined){d=f.data}var e=this._selection();if(d==null){return}var c=d.getvalue("negative");var b=d.decimal;if(c){if(b>0){b=-b}}d.numberInput.val(b);a.data(d.numberInput,"simpleInputMode",true);if(a.jqx.mobile.isOperaMiniBrowser()){d.numberInput.attr("readonly",false)}this._parseDecimalInSimpleMode();this._setSelectionStart(e.start)},setvalue:function(b,c){if(this[b]!=undefined){if(b=="decimal"){this._setDecimal(c)}else{this[b]=c;this.propertyChangedHandler(this,b,c,c)}}},getvalue:function(b){if(b=="decimal"){if(this.negative!=undefined&&this.negative==true){return -Math.abs(this[b])}}if(b in this){return this[b]}return null},_getString:function(){var c="";for(var b=0;b<this.items.length;b++){var d=this.items[b].character;c+=d}return c},_literal:function(d,b,c,e){return{character:d,regex:b,canEdit:c,isSeparator:e}},_initializeLiterals:function(){if(this.inputMode=="textbox"){return}var h=0;var e=this.negativeSymbol.length;for(var d=0;d<e;d++){var g=this.negativeSymbol.substring(d,d+1);var n="";var b=false;var o=null;if(this.negative){o=this._literal(g,n,b,false)}else{o=this._literal("",n,b,false)}this.items[h]=o;h++}var c=this.symbol.length;if(this.symbolPosition=="left"){for(d=0;d<c;d++){var g=this.symbol.substring(d,d+1);var n="";var b=false;var o=this._literal(g,n,b,false);this.items[h]=o;h++}}var f=this.digits%this.groupSize;if(f==0){f=this.groupSize}for(var d=0;d<this.digits;d++){var g=this.promptChar;var n="\\d";var b=true;var o=this._literal(g,n,b,false);this.items[h]=o;h++;if(d<this.digits-1&&this.groupSeparator!=undefined&&this.groupSeparator.length>0){f--;if(f==0){f=this.groupSize;var l=this._literal(this.groupSeparator,"",false,false);this.items[h]=l;h++}}else{if(d==this.digits-1){o.character=0}}}this.decimalSeparatorPosition=-1;if(this.decimalDigits!=undefined&&this.decimalDigits>0){var g=this.decimalSeparator;if(g.length==0){g="."}var o=this._literal(g,"",false,true);this.items[h]=o;this.decimalSeparatorPosition=h;h++;for(var d=0;d<this.decimalDigits;d++){var r=0;var n="\\d";var q=this._literal(r,n,true,false);this.items[h]=q;h++}}if(this.symbolPosition=="right"){for(var d=0;d<c;d++){var g=this.symbol.substring(d,d+1);var n="";var b=false;var o=this._literal(g,n,b);this.items[h]=o;h++}}},_match:function(c,b){var d=new RegExp(b,"i");return d.test(c)},_raiseEvent:function(f,w){var v=this.events[f];var n={};n.owner=this;if(this.host.css("display")=="none"){return true}var u=w.charCode?w.charCode:w.keyCode?w.keyCode:0;var x=true;var t=this.readOnly;var o=this;if(f==3||f==2){if(!this.disabled){if(this.inputMode!="simple"&&this.inputMode!="textbox"){this._handleMouse(w)}else{return true}}}if(f==0){var d=this.getvalue("decimal");if((this.max<d)||(this.min>d)){this.host.addClass(this.toThemeProperty("jqx-input-invalid"))}else{this.host.removeClass(this.toThemeProperty("jqx-input-invalid"));this.host.addClass(this.toThemeProperty("jqx-input"));this.host.addClass(this.toThemeProperty("jqx-rc-all"))}}var c=new jQuery.Event(v);c.owner=this;n.value=this.getvalue("decimal");n.text=this.numberInput.val();c.args=n;x=this.host.trigger(c);var o=this;if(this.inputMode=="textbox"){return x}if(this.inputMode!="simple"){if(f==4){if(t||this.disabled){return false}x=o._handleKeyDown(w,u)}else{if(f==5){if(t||this.disabled){x=false}}else{if(f==6){if(t||this.disabled){return false}x=o._handleKeyPress(w,u)}}}}else{if(f==4||f==5||f==6){if(a.jqx.mobile.isTouchDevice()||this.touchMode===true){return true}if(t||this.disabled){return false}var g=String.fromCharCode(u);var q=parseInt(g);var h=true;if(!w.ctrlKey&&!w.shiftKey){if(u>=65&&u<=90){h=false}}if(f==6&&a.jqx.browser.opera!=undefined){if(u==8){return false}}if(h){if(f==4){h=o._handleSimpleKeyDown(w,u)}if(u==189||u==45||u==109||u==173){var s=o._selection();if(f==4){var b=o.getvalue("negative");if(b==false){o.setvalue("negative",true)}else{o.setvalue("negative",false)}o._parseDecimalInSimpleMode();o._setSelectionStart(s.start);h=false}}if(!a.jqx.browser.msie){var l=w;if((l.ctrlKey&&u==99)||(l.ctrlKey&&u==67)||(l.ctrlKey&&u==122)||(l.ctrlKey&&u==90)||(l.ctrlKey&&u==118)||(l.ctrlKey&&u==86)||(l.shiftKey&&u==45)){if(f==6&&a.jqx.browser.webkit){o._handleSimpleKeyDown(w,u)}return false}}if((w.ctrlKey&&u==97)||(w.ctrlKey&&u==65)){return true}if(f==6&&h){var r=this._isSpecialKey(u);return r}}return h}}return x},GetSelectionInValue:function(h,g,f,e){var c=0;for(i=0;i<g.length;i++){if(i>=h){break}var d=g.substring(i,i+1);var b=(!isNaN(parseInt(d)));if(b||(e&&g.substring(i,i+1)==f)){c++}}return c},GetSelectionLengthInValue:function(g,h,f,e){var c=0;for(i=0;i<f.length;i++){if(i>=g+h){break}var d=f.substring(i,i+1);var b=(!isNaN(parseInt(d)));if(h>0&&i>=g&&b||(i>=g&&f[i].toString()==e)){c++}}return c},GetInsertTypeByPositionInValue:function(e,g,h,f){var c="before";var b=this.GetValueString(h,g,f);var d=this.GetDigitsToSeparator(0,b,g);if(e>d){c="after"}return c},RemoveRange:function(f,e,q,g,w,b){var h=this.digits;var r=f;var x=e;var c=0;var s=this.decimal;var B=this._selection();var q=this.numberInput.val();var g=this.decimalSeparator;var l=g!="";if(x==0&&this.ValueString.length<this.decimalPossibleChars-1){return c}var y=this.GetSeparatorPositionInText(g,q);if(!w){y=this.GetSeparatorPositionInText(g,q)}if(y<0&&!l&&q.length>1){y=q.length}if(y==-1){y=q.length}var d=l?1:0;if(e<2&&b==true){var A=this.ValueString.length-this.decimalDigits-d;if((A)==h&&f+e<y){x++}}var n="";for(var v=0;v<q.length;v++){if(v<r||v>=r+x){n+=q.substring(v,v+1);continue}else{var u=q.substring(v,v+1);if(u==g){n+=g;continue}else{var u=q.substring(v,v+1);if(v>y){n+="0";continue}}}var u=q.substring(v,v+1);var t=(!isNaN(parseInt(u)));if(t){c++}}if(n.length==0){n="0"}if(w){this.numberInput.val(n)}else{this.ValueString=n}var o=n.substring(0,1);if(o==g&&isNaN(parseInt(o))){var z="0"+n;n=z}this.ValueString=this.GetValueString(n,g,l);this.decimal=this.ValueString;this._parseDecimalInSimpleMode();this._setSelectionStart(r);return c},InsertDigit:function(v,B){if(typeof this.digits!="number"){this.digits=parseInt(this.digits)}if(typeof this.decimalDigits!="number"){this.decimalDigits=parseInt(this.decimalDigits)}var l=1+this.digits;var C=this._selection();var q=this.getvalue("negative");var d=false;if(C.start==0&&this.symbol!=""&&this.symbolPosition=="left"){this._setSelectionStart(C.start+1);C=this._selection();d=true}if((q&&d)||(q&&!d&&C.start==0)){this._setSelectionStart(C.start+1);C=this._selection()}var z=this.numberInput.val().substring(C.start,C.start+1);var s=this.numberInput.val();var g=this.decimalSeparator;var n=g!=""&&this.decimalDigits>0;if(z==this.symbol&&this.symbolPosition=="right"){if(this.decimalDigits==0){this.ValueString=this.GetValueString(s,g,n);if(this.ValueString.length>=l){return}}else{return}}this.ValueString=this.GetValueString(s,g,n);var y=this.ValueString;if(this.decimalDigits>0&&B>=y.length){B=y.length-1}var t="";if(B<y.length){t=y.substring(B,B+1)}var h=false;var A=false;var e=this.GetInsertTypeByPositionInValue(B,g,s,n);if(e=="after"){h=true}var b=n?1:0;if(t!=g&&(this.ValueString.length-this.decimalDigits-b)>=l-1){h=true}var u=false;var w=n?1:0;if(!h&&this.ValueString&&this.ValueString.length>=this.digits+this.decimalDigits+w){return}if(h&&t!=g){if(u){B++}var r=y.substring(0,B);if(r.length==y.length){if(this.ValueString.length>=this.digits+this.decimalDigits+w){return}}var x=v;var c="";if(B+1<y.length){c=y.substring(B+1)}var o=r+x+c;this.ValueString=o}else{var r=y.substring(0,B);var x=v;var c=y.substring(B);var o=r+x+c;if(y.substring(0,1)=="0"){o=x+y.substring(1);if(t==g){this._setSelectionStart(C.start-1);C=this._selection()}}this.ValueString=o}if(q){this.decimal=-this.ValueString}else{this.decimal=this.ValueString}this._parseDecimalInSimpleMode();var f=C.start;f+=1;this._setSelectionStart(f);this.value=this.decimal;this._raiseEvent(0,this.value);this._raiseEvent(1,this.numberInput.val())},GetStringToSeparator:function(h,f,e){var d="";var b=f;var g=this.GetSeparatorPositionInText(f,h);var c=h.subString(0,g);d=this.GetValueString(c,f,e);return d},GetSeparatorPositionInText:function(c,d){var b=-1;for(i=0;i<d.length;i++){if(d.substring(i,i+1)==c){b=i;break}}return b},GetValueString:function(h,g,f){var d="";for(var c=0;c<h.length;c++){var e=h.substring(c,c+1);var b=(!isNaN(parseInt(e)));if(b){d+=e}if(e==g){d+=g}}return d},Backspace:function(){var d=this._selection();var e=this._selection();var f=this.numberInput.val();if(d.start==0&&d.length==0){return}this.isBackSpace=true;var c=f.substring[d.start,d.start+1];var b=(!isNaN(parseInt(c)));if(d.start>0&&d.length==0){this._setSelectionStart(d.start-1);var d=this._selection()}this.Delete();this._setSelectionStart(e.start-1);this.isBackSpace=false},Delete:function(c){var e=this._selection();var g=this.numberInput.val();var f=e.start;var h=e.length;h=Math.max(h,1);this.ValueString=this.GetValueString(g,this.decimalSeparator,this.decimalSeparator!="");this.RemoveRange(e.start,h,this.ValueString,".",false);var d=this.ValueString.substring(0,1);var b=(!isNaN(parseInt(d)));if(!b){this.ValueString="0"+this.ValueString}this.decimal=this.ValueString;this._parseDecimalInSimpleMode();this._setSelectionStart(f);this.value=this.decimal;this._raiseEvent(0,this.value);this._raiseEvent(1,this.numberInput.val())},insertsimple:function(d){var l=this._selection();var n=this.numberInput.val();if(l.start==n.length&&this.decimalDigits>0){return}var b=this.decimal;var g=this.decimalSeparator;this.ValueString=this.GetValueString(n,g,g!="");var h=this.GetSelectionInValue(l.start,n,g,g!="");var e=this.GetSelectionLengthInValue(l.start,l.length,n,g);var f=this.GetDigitsToSeparator(0,this.ValueString,g);var c=false;if(this.decimalDigits>0&&h>=this.ValueString.length){h--}this.RemoveRange(l.start,e,this.ValueString,g,false,true);this.InsertDigit(d,h,l)},GetDigitsToSeparator:function(c,b,d){if(d==undefined){d="."}if(b.indexOf(d)<0){return b.length}for(i=0;i<b.length;i++){if(b.substring(i,i+1)==d){c=i;break}}return c},_handleSimpleKeyDown:function(h,t){var s=this._selection();if(s.start>=0&&s.start<this.items.length){var c=String.fromCharCode(t)}if(this.rtl&&t==37){var b=h.shiftKey;var d=b?1:0;if(b){this._setSelection(s.start+1-d,s.start+s.length+1)}else{this._setSelection(s.start+1-d,s.start+1)}return false}else{if(this.rtl&&t==39){var b=h.shiftKey;var d=b?1:0;if(b){this._setSelection(s.start-1,s.length+d+s.start-1)}else{this._setSelection(s.start-1,s.start-1)}return false}}if(t==8){this.Backspace();return false}if(t==190||t==110){var g=this.GetSeparatorPositionInText(this.decimalSeparator,this.numberInput.val());this._setSelectionStart(g+1);return false}if(t==188){var r=this.numberInput.val();for(f=s.start;f<r.length;f++){if(r[f]==this.groupSeparator){this._setSelectionStart(1+f);break}}return false}if((h.ctrlKey&&t==99)||(h.ctrlKey&&t==67)){var s=this._selection();var u="";var q=this.numberInput.val();if(s.start>0||s.length>0){for(var f=s.start;f<s.end;f++){u+=q.substring(f,f+1)}}if(a.jqx.browser.msie){window.clipboardData.setData("Text",u)}this.savedText=u;return false}if((h.ctrlKey&&t==122)||(h.ctrlKey&&t==90)){return false}if((h.ctrlKey&&t==118)||(h.ctrlKey&&t==86)||(h.shiftKey&&t==45)){if(this.savedText!=null&&this.savedText.length>0){for(var f=0;f<this.savedText.length;f++){var n=parseInt(this.savedText.substring(f,f+1));if(!isNaN(n)){this.insertsimple(n)}}}return false}var c=String.fromCharCode(t);var n=parseInt(c);if(t>=96&&t<=105){n=t-96;t=t-48}if(!isNaN(n)){var l=this;this.insertsimple(n);return false}if(t==46){this.Delete();return false}if(t==38){this.spinUp();return false}else{if(t==40){this.spinDown();return false}}var o=this._isSpecialKey(t);if(!a.jqx.browser.mozilla){return true}return o},_getEditRange:function(){var c=0;var b=0;for(i=0;i<this.items.length;i++){if(this.items[i].canEdit){c=i;break}}for(i=this.items.length-1;i>=0;i--){if(this.items[i].canEdit){b=i;break}}return{start:c,end:b}},_getVisibleItems:function(){var b=new Array();var c=0;for(i=0;i<this.items.length;i++){if(this.items[i].character.toString().length>0){b[c]=this.items[i];c++}}return b},_hasEmptyVisibleItems:function(){var b=this._getVisibleItems();for(i=0;i<b.length;i++){if(b[i].canEdit&&b[i].character==this.promptChar){return true}}return false},_getFirstVisibleNonEmptyIndex:function(){var b=this._getVisibleItems();for(i=0;i<b.length;i++){if(b[i].canEdit&&b[i].character!=this.promptChar){return i}}},_handleMouse:function(f,b){var d=this._selection();if(d.length<=1){var c=this._getFirstVisibleNonEmptyIndex();if(d.start<c){this._setSelectionStart(c)}}},_insertKey:function(l){this.numberInput[0].focus();var d=String.fromCharCode(l);var e=parseInt(d);if(isNaN(e)){return}var q=0;for(i=0;i<this.items.length;i++){if(this.items[i].character.length==0){q++}}var g=this._selection();var b=this;if(g.start>=0&&g.start<=this.items.length){var f=false;var h=this._getFirstVisibleNonEmptyIndex();if(g.start<h&&g.length==0){if(!isNaN(d)||d==" "){this._setSelectionStart(h);g=this._selection()}}var c=this._getFirstEditableItemIndex();var o=this._getLastEditableItemIndex();var n=this._getVisibleItems();a.each(n,function(x,B){if(g.start>x&&x!=n.length-1){return}var E=n[x];if(x>o){E=n[o]}if(isNaN(d)||d==" "){return}if(!E.canEdit){return}var A=b._getSeparatorPosition();if(b._match(d,E.regex)){if(!f&&g.length>0){for(j=g.start+q;j<g.end+q;j++){if(b.items[j].canEdit){if(j>A){b.items[j].character="0"}else{b.items[j].character=b.promptChar}}}var D=b._getString();f=true}var A=b._getSeparatorPosition();var y=b._hasEmptyVisibleItems();if(g.start<=A&&y){var v=x;if(b.decimalSeparatorPosition==-1&&g.start==A){v=x+1}var u="";for(p=0;p<v;p++){if(n[p].canEdit&&n[p].character!=b.promptChar){u+=n[p].character}}u+=d;var w=b.decimal<1?1:0;if(g.start==A&&b.decimalSeparatorPosition!=-1){u+=b.decimalSeparator;w=0}for(p=v+w;p<n.length;p++){if(n[p].character==b.decimalSeparator&&n[p].isSeparator){u+=n[p].character}else{if(n[p].canEdit&&n[p].character!=b.promptChar){u+=n[p].character}}}if(b.decimalSeparator!="."){u=b._parseDecimalValue(u)}u=parseFloat(u).toString();u=new Number(u);u=u.toFixed(b.decimalDigits);if(b.decimalSeparator!="."){u=b._parseDecimalValueToEditorValue(u)}b.setvalue("decimal",u);var D=b._getString();if(g.end<A){b._setSelectionStart(g.end+w)}else{b._setSelectionStart(g.end)}if(g.length>=1){b._setSelectionStart(g.end)}if(g.length==b.numberInput.val().length){var r=b._moveCaretToDecimalSeparator();var C=b.decimalSeparatorPosition>=0?1:0;b._setSelectionStart(r-C)}}else{if(g.start<A||g.start>A){if(b.numberInput.val().length==g.start&&b.decimalSeparatorPosition!=-1){return false}else{if(b.numberInput.val().length==g.start&&b.decimalSeparatorPosition==-1&&!y){return false}}var u="";var s=false;for(p=0;p<x;p++){if(n[p].canEdit&&n[p].character!=b.promptChar){u+=n[p].character}if(n[p].character==b.decimalSeparator&&n[p].isSeparator){u+=n[p].character;s=true}}u+=d;var w=b.decimal<1?1:0;if(!s&&g.start==A-1){u+=b.decimalSeparator;s=true}for(p=x+1;p<n.length;p++){if(!s&&n[p].character==b.decimalSeparator&&n[p].isSeparator){u+=n[p].character}else{if(n[p].canEdit&&n[p].character!=b.promptChar){u+=n[p].character}}}b.setvalue("decimal",u);var D=b._getString();if(b.decimalSeparatorPosition<0&&E==n[o]){b._setSelectionStart(x);return false}var z=D.indexOf(b.symbol);var t=!b.getvalue("negative")?0:1;if(z<=t){z=D.length}if(g.start<z){b._setSelectionStart(x+1)}else{b._setSelectionStart(x)}if(g.length>=1){}if(g.length==b.numberInput.val().length){var r=b._moveCaretToDecimalSeparator();b._setSelectionStart(r-1)}}}return false}})}},_handleKeyPress:function(h,d){var f=this._selection();var b=this;if((h.ctrlKey&&d==97)||(h.ctrlKey&&d==65)){return true}if(d==8){if(f.start>0){b._setSelectionStart(f.start)}return false}if(d==46){if(f.start<this.items.length){b._setSelectionStart(f.start)}return false}if(d==45||d==173||d==109||d==189){var c=this.getvalue("negative");if(c==false){this.setvalue("negative",true)}else{this.setvalue("negative",false)}}if(a.jqx.browser.msie){this._insertKey(d)}var g=this._isSpecialKey(d);return g},_deleteSelectedText:function(){var d=this._selection();var c="";var f=this._getSeparatorPosition();var b=this._getVisibleItems();var e=this._getHiddenPrefixCount();if(this.numberInput.val().length==d.start&&d.length==0){this._setSelection(d.start,d.start+1);d=this._selection()}for(i=0;i<d.start;i++){if(b[i].canEdit&&b[i].character!=this.promptChar){c+=b[i].character}else{if(!b[i].canEdit&&this.decimalSeparatorPosition!=-1&&b[i]==b[this.decimalSeparatorPosition-e]){if(c.length==0){c="0"}c+=b[i].character}}}for(i=d.start;i<d.end;i++){if(i>f&&this.decimalSeparatorPosition!=-1){if(b[i].canEdit&&b[i].character!=this.promptChar){c+="0"}}else{if(!b[i].canEdit&&this.decimalSeparatorPosition!=-1&&b[i]==b[this.decimalSeparatorPosition-e]){if(c.length==0){c="0"}c+=b[i].character}}}for(i=d.end;i<b.length;i++){if(b[i].canEdit&&b[i].character!=this.promptChar){c+=b[i].character}else{if(!b[i].canEdit&&this.decimalSeparatorPosition!=-1&&b[i]==b[this.decimalSeparatorPosition-e]){if(c.length==0){c="0"}c+=b[i].character}}}this.setvalue("decimal",c);return d.length>0},_restoreInitialState:function(){var b=parseInt(this.decimalDigits);if(b>0){b+=2}for(k=this.items.length-1;k>this.items.length-1-b;k--){if(this.items[k].canEdit&&this.items[k].character==this.promptChar){this.items[k].character=0}}},clear:function(){this.setDecimal(0)},clearDecimal:function(){if(this.inputMode=="textbox"){this.numberInput.val();return}for(var b=0;b<this.items.length;b++){if(this.items[b].canEdit){this.items[b].character=this.promptChar}}this._restoreInitialState()},_saveSelectedText:function(){var c=this._selection();var d="";var b=this._getVisibleItems();if(c.start>0||c.length>0){for(i=c.start;i<c.end;i++){if(b[i].canEdit&&b[i].character!=this.promptChar){d+=b[i].character}else{if(b[i].isSeparator){d+=b[i].character}}}}if(a.jqx.browser.msie){window.clipboardData.setData("Text",d)}return d},_pasteSelectedText:function(){var f=this._selection();var h="";var c=0;this.selectedText=a.data(document.body,"jqxSelection");if(window.clipboardData){var d=window.clipboardData.getData("Text");if(d!=this.selectedText&&d.length>0){this.selectedText=window.clipboardData.getData("Text");if(this.selectedText==null||this.selectedText==undefined){return}}}var e=f.start;var n=this._getVisibleItems();if(this.selectedText!=null){for(var l=0;l<this.selectedText.length;l++){var b=parseInt(this.selectedText[l]);if(!isNaN(b)){var g=48+b;this._insertKey(g)}}}},_getHiddenPrefixCount:function(){var b=0;if(!this.negative){b++}if(this.symbolPosition=="left"){for(i=0;i<this.symbol.length;i++){if(this.symbol.substring(i,i+1)==""){b++}}}return b},_getEditableItem:function(){var b=this._selection();for(i=0;i<this.items.length;i++){if(i<b.start){if(this.items[i].canEdit&&this.items[i].character!=this.promptChar){return this.items[i]}}}return null},_getEditableItems:function(){var c=new Array();var b=0;for(i=0;i<this.items.length;i++){if(this.items[i].canEdit){c[b]=this.items[i];b++}}return c},_getValidSelectionStart:function(b){for(i=this.items.length-1;i>=0;i--){if(this.items[i].canEdit&&this.items[i].character!=this.promptChar){return i}}return -1},_getEditableItemIndex:function(c){var e=this._selection();var f=this._getHiddenPrefixCount();var b=this._getVisibleItems();var d=e.start;var g=-1;for(i=0;i<d;i++){if(i<b.length&&b[i].canEdit){g=i+f}}if(g==-1&&e.length>0){d=e.end;for(i=0;i<d;i++){if(i<b.length&&b[i].canEdit){g=i+f;break}}}return g},_getEditableItemByIndex:function(b){for(k=0;k<this.items.length;k++){if(k>b){if(this.items[k].canEdit&&this.items[k].character!=this.promptChar){return k}}}return -1},_getFirstEditableItemIndex:function(){var b=this._getVisibleItems();for(m=0;m<b.length;m++){if(b[m].character!=this.promptChar&&b[m].canEdit&&b[m].character!="0"){return m}}return -1},_getLastEditableItemIndex:function(){var b=this._getVisibleItems();for(m=b.length-1;m>=0;m--){if(b[m].character!=this.promptChar&&b[m].canEdit){return m}}return -1},_moveCaretToDecimalSeparator:function(){for(i=this.items.length-1;i>=0;i--){if(this.items[i].character==this.decimalSeparator&&this.items[i].isSeparator){if(!this.negative){this._setSelectionStart(i);return i}else{this._setSelectionStart(i+1);return i}break}}return this.numberInput.val().length},_handleBackspace:function(){var e=this._selection();var f=this._getHiddenPrefixCount();var b=this._getEditableItemIndex()-f;if(b>=0){if(e.length==0&&b!=-1){this._setSelection(b,b+1)}var g=e.start>this._getSeparatorPosition()+1&&this.decimalSeparatorPosition>0;if(g){e=this._selection()}var d=this._deleteSelectedText();if(e.length<1||g){this._setSelectionStart(e.start)}else{if(e.length>=1){this._setSelectionStart(e.end)}}if(e.length==this.numberInput.val().length){var c=this._moveCaretToDecimalSeparator();this._setSelectionStart(c-1)}}else{this._setSelectionStart(e.start)}},_handleKeyDown:function(f,q){var o=this._selection();if(this.rtl&&q==37){var b=f.shiftKey;var d=b?1:0;if(b){this._setSelection(o.start+1-d,o.start+o.length+1)}else{this._setSelection(o.start+1-d,o.start+1)}return false}else{if(this.rtl&&q==39){var b=f.shiftKey;var d=b?1:0;if(b){this._setSelection(o.start-1,o.length+d+o.start-1)}else{this._setSelection(o.start-1,o.start-1)}return false}}if((f.ctrlKey&&q==97)||(f.ctrlKey&&q==65)){return true}if((f.ctrlKey&&q==120)||(f.ctrlKey&&q==88)){this.selectedText=this._saveSelectedText(f);a.data(document.body,"jqxSelection",this.selectedText);this._handleBackspace();return false}if((f.ctrlKey&&q==99)||(f.ctrlKey&&q==67)){this.selectedText=this._saveSelectedText(f);a.data(document.body,"jqxSelection",this.selectedText);return false}if((f.ctrlKey&&q==122)||(f.ctrlKey&&q==90)){return false}if((f.ctrlKey&&q==118)||(f.ctrlKey&&q==86)||(f.shiftKey&&q==45)){this._pasteSelectedText();return false}if(o.start>=0&&o.start<this.items.length){var c=String.fromCharCode(q);var s=this.items[o.start]}if(q==8){this._handleBackspace();return false}if(q==190||q==110){this._moveCaretToDecimalSeparator();return false}if(q==188){var n=this.numberInput.val();for(i=o.start;i<n.length;i++){if(n[i]==this.groupSeparator){this._setSelectionStart(1+i);break}}return false}if(a.jqx.browser.msie==null){var c=String.fromCharCode(q);var h=parseInt(c);if(q>=96&&q<=105){h=q-96;q=q-48}if(!isNaN(h)){var g=this;g._insertKey(q);return false}}if(q==46){var r=this._getVisibleItems();if(o.start<r.length){var d=r[o.start].canEdit==false?2:1;if(o.length==0){this._setSelection(o.start+d,o.start+d+o.length)}this._handleBackspace();if(new Number(this.decimal)<1||o.start>this._getSeparatorPosition()){this._setSelectionStart(o.end+d)}else{if(o.start+1<this.decimalSeparatorPosition){this._setSelectionStart(o.end+d)}}}return false}if(q==38){this.spinUp();return false}else{if(q==40){this.spinDown();return false}}var l=this._isSpecialKey(q);if(!a.jqx.browser.mozilla){return true}return l},_isSpecialKey:function(b){if(b!=8&&b!=9&&b!=13&&b!=35&&b!=36&&b!=37&&b!=39&&b!=27&&b!=46){return false}return true},_selection:function(){try{if("selectionStart" in this.numberInput[0]){var g=this.numberInput[0];var h=g.selectionEnd-g.selectionStart;return{start:g.selectionStart,end:g.selectionEnd,length:h,text:g.value}}else{var d=document.selection.createRange();if(d==null){return{start:0,end:g.value.length,length:0}}var c=this.numberInput[0].createTextRange();var f=c.duplicate();c.moveToBookmark(d.getBookmark());f.setEndPoint("EndToStart",c);var h=d.text.length;return{start:f.text.length,end:f.text.length+d.text.length,length:h,text:d.text}}}catch(b){return{start:0,end:0,length:0}}},_setSelection:function(f,b){if(this._disableSetSelection==true){return}var e=a.jqx.mobile.isTouchDevice();if(e||this.touchMode==true){return}try{if("selectionStart" in this.numberInput[0]){this.numberInput[0].focus();this.numberInput[0].setSelectionRange(f,b)}else{var c=this.numberInput[0].createTextRange();c.collapse(true);c.moveEnd("character",b);c.moveStart("character",f);c.select()}}catch(d){}},_setSelectionStart:function(b){this._setSelection(b,b);a.data(this.numberInput,"selectionstart",b)},_render:function(f){var c=parseInt(this.host.css("border-left-width"));var h=parseInt(this.host.css("border-left-width"));var g=parseInt(this.host.css("border-left-width"));var d=parseInt(this.host.css("border-left-width"));this.numberInput.css("padding-top","0px");this.numberInput.css("padding-bottom","0px");this.host.height(this.height);this.host.width(this.width);var e=this.host.width();var o=this.host.height();this.numberInput.css({"border-left-width":0,"border-right-width":0,"border-bottom-width":0,"border-top-width":0});this.numberInput.css("text-align",this.textAlign);var q=this.numberInput.css("font-size");this.numberInput.css("height",parseInt(q)+4+"px");this.numberInput.css("width",e-2);var n=o-2*g-parseInt(q)-2;if(isNaN(n)){n=0}if(n<0){n=0}if(this.spinButtons&&this.spincontainer){e-=parseInt(this.spinButtonsWidth-2);var l=a.jqx.mobile.isTouchDevice();if(!l&&this.touchMode!==true){this.spincontainer.width(this.spinButtonsWidth);this.upbutton.width(this.spinButtonsWidth+2);this.downbutton.width(this.spinButtonsWidth+2);this.upbutton.height("50%");this.downbutton.height("50%");this.spincontainer.width(this.spinButtonsWidth)}else{this.spincontainer.width(2*(this.spinButtonsWidth));e-=this.spinButtonsWidth;this.upbutton.height("100%");this.downbutton.height("100%");this.downbutton.css("float","left");this.upbutton.css("float","right");this.upbutton.width(this.spinButtonsWidth);this.downbutton.width(1+this.spinButtonsWidth)}this._upArrow.height("100%");this._downArrow.height("100%");this.numberInput.css("width",e-6);this.numberInput.css("margin-right","2px")}var b=n/2;if(a.jqx.browser.msie&&a.jqx.browser.version<8){b=n/4}this.numberInput.css("padding-left","0px");this.numberInput.css("padding-right","0px");this.numberInput.css("padding-top",Math.round(b)+"px");this.numberInput.css("padding-bottom",Math.round(b)+"px");if(f==undefined||f==true){this.numberInput.val(this._getString());if(this.inputMode!="advanced"){this._parseDecimalInSimpleMode()}}},destroy:function(){this._removeHandlers();this.host.remove()},inputValue:function(b){if(b===undefined){return this._value()}this.propertyChangedHandler(this,"value",this._value,b);this._refreshValue();return this},_value:function(){var b=this.numberInput.val();return b},val:function(b){if(b!=undefined&&typeof b!="object"){this.setDecimal(b)}else{return this.getDecimal()}},getDecimal:function(){if(this.inputMode=="simple"){this._parseDecimalInSimpleMode(false);this.decimal=this._getDecimalInSimpleMode(this.decimal)}if(this.decimal==""){return 0}var b=this.getvalue("negative");if(b&&this.decimal>0){return -parseFloat(this.decimal)}return parseFloat(this.decimal)},setDecimal:function(d){var b=d;if(this.decimalSeparator!="."){d=d.toString();var f=d.indexOf(".");if(f!=-1){var c=d.substring(0,f);var e=d.substring(f+1);d=c+this.decimalSeparator+e}if(d<0){this.setvalue("negative",true)}else{this.setvalue("negative",false)}this._setDecimal(d)}else{if(d<0){this.setvalue("negative",true)}else{this.setvalue("negative",false)}this._setDecimal(Math.abs(d))}if(b==null){this.numberInput.val("")}},_setDecimal:function(r){if(r==null||r==undefined){r=0}if(r.toString().indexOf("e")!=-1){r=0}this.clearDecimal();var s=r.toString();var t="";var b="";var d=true;if(s.length==0){s="0"}for(var g=0;g<s.length;g++){if(s.substring(g,g+1)==this.decimalSeparator){d=false;continue}if(d){t+=s.substring(g,g+1)}else{b+=s.substring(g,g+1)}}if(t.length>0){t=parseFloat(t).toString()}var o=this.digits;if(o<t.length){t=t.substr(0,o)}var f=0;var q=this._getSeparatorPosition();var n=this._getHiddenPrefixCount();q=q+n;for(var g=q;g>=0;g--){if(g<this.items.length&&this.items[g].canEdit){if(f<t.length){this.items[g].character=t.substring(t.length-f-1,t.length-f);f++}}}f=0;for(var g=q;g<this.items.length;g++){if(this.items[g].canEdit){if(f<b.length){this.items[g].character=b.substring(f,f+1);f++}}}this._refreshValue();if(this.decimalSeparator=="."){this.ValueString=new Number(r).toFixed(this.decimalDigits)}else{var l=r.toString().indexOf(this.decimalSeparator);if(l>0){var h=r.toString().substring(0,l);var e=h+"."+r.toString().substring(l+1);this.ValueString=new Number(e).toFixed(this.decimalDigits)}else{this.ValueString=new Number(r).toFixed(this.decimalDigits)}}if(this.inputMode!="advanced"){this._parseDecimalInSimpleMode();this._raiseEvent(1,this.ValueString)}if(this.inputMode=="textbox"){this.decimal=this.ValueString;var c=this.getvalue("negative");if(c){this.decimal="-"+this.ValueString}}var r=this.val();if(r<this.min||r>this.max){this.host.addClass("jqx-input-invalid")}else{this.host.removeClass("jqx-input-invalid")}},_getSeparatorPosition:function(){var b=this._getHiddenPrefixCount();if(this.decimalSeparatorPosition>0){return this.decimalSeparatorPosition-b}return this.items.length-b},_setTheme:function(){this.host.removeClass();this.host.addClass(this.toThemeProperty("jqx-input"));this.host.addClass(this.toThemeProperty("jqx-rc-all"));this.host.addClass(this.toThemeProperty("jqx-widget"));this.host.addClass(this.toThemeProperty("jqx-widget-content"));this.host.addClass(this.toThemeProperty("jqx-numberinput"));if(this.spinButtons){this.downbutton.removeClass();this.upbutton.removeClass();this.downbutton.addClass(this.toThemeProperty("jqx-scrollbar-button-state-normal"));this.upbutton.addClass(this.toThemeProperty("jqx-scrollbar-button-state-normal"));this._upArrow.removeClass();this._downArrow.removeClass();this._upArrow.addClass(this.toThemeProperty("jqx-icon-arrow-up"));this._downArrow.addClass(this.toThemeProperty("jqx-icon-arrow-down"))}this.numberInput.removeClass();this.numberInput.addClass(this.toThemeProperty("jqx-input-content"))},propertyChangedHandler:function(c,d,g,f){if(d=="digits"||d=="groupSize"||d=="decimalDigits"){if(f<0){throw new Exception(this.invalidArgumentExceptions[0])}}if(d==="theme"){a.jqx.utilities.setTheme(g,f,c.host)}if(d=="digits"){if(f!=g){c.digits=parseInt(f)}}if(d=="min"||d=="max"){a.jqx.aria(c,"aria-value"+d,f.toString());c._refreshValue()}if(d=="decimalDigits"){if(f!=g){c.decimalDigits=parseInt(f)}}if(d=="decimalSeparator"||d=="digits"||d=="symbol"||d=="symbolPosition"||d=="groupSize"||d=="groupSeparator"||d=="decimalDigits"||d=="negativeSymbol"){var b=c.decimal;if(d=="decimalSeparator"&&f==""){f=" "}if(g!=f){var e=c._selection();c.items=new Array();c._initializeLiterals();c.value=c._getString();c._refreshValue();c._setDecimal(b)}}if(d=="rtl"){if(c.rtl){if(c.spincontainer){c.spincontainer.css("float","right");c.spincontainer.css("border-right-width","1px")}c.numberInput.css("float","right")}else{if(c.spincontainer){c.spincontainer.css("float","right");c.spincontainer.css("border-right-width","1px")}c.numberInput.css("float","left")}}if(d=="spinButtons"){if(c.spincontainer){if(!f){c.spincontainer.css("display","none")}else{c.spincontainer.css("display","block")}c._render()}else{c._spinButtons()}}if(d==="touchMode"){c.inputMode="textbox";c.spinMode="simple";c.render()}if(d=="negative"&&c.inputMode=="advanced"){var e=c._selection();var h=0;if(f){c.items[0].character=c.negativeSymbol[0];h=1}else{c.items[0].character="";h=-1}c._refreshValue();if(c.isInitialized){c._setSelection(e.start+h,e.end+h)}}if(d=="decimal"){c.value=f;c.setDecimal(f)}if(d==="value"){c.value=f;c.setDecimal(f);c._raiseEvent(1,f)}if(d=="textAlign"){c.textAlign=f;c._render()}if(d=="disabled"){c.numberInput.attr("disabled",f);if(c.disabled){c.host.addClass(c.toThemeProperty("jqx-fill-state-disabled"))}else{c.host.removeClass(c.toThemeProperty("jqx-fill-state-disabled"))}a.jqx.aria(c,"aria-disabled",f.toString())}if(d=="readOnly"){c.readOnly=f}if(d=="promptChar"){for(i=0;i<c.items.length;i++){if(c.items[i].character==c.promptChar){c.items[i].character=f}}c.promptChar=f}if(d=="width"){c.width=f;c._render()}else{if(d=="height"){c.height=f;c._render()}}},_value:function(){var b=this.value;return b},_refreshValue:function(){var g=this.value;var b=0;if(this.inputMode==="textbox"){return}this.value=this._getString();g=this.value;var f="";for(var c=0;c<this.items.length;c++){var e=this.items[c];if(e.canEdit&&e.character!=this.promptChar){f+=e.character}if(c==this.decimalSeparatorPosition){f+="."}}this.decimal=f;var d=false;if(this.oldValue!==g){this.oldValue=g;this._raiseEvent(0,g);d=true}if(this.inputMode!="simple"){this.numberInput.val(g);if(d){this._raiseEvent(1,g)}}if(g==null){this.numberInput.val("")}}})})(jQuery);