// Labels for Ajax javascripts
// $Id: labels.js 40591 2009-02-06 10:54:29Z mark $
//

window.labels								= new Object();

window.labels["main"] 						= new Object();
window.labels["main"]["loading"]			= "loading...";

/* autocomplete */
window.labels["autocomplete"] 				= new Object();
window.labels["autocomplete"]["cancel"]		= "Cancel";

/* annotations */
window.labels["annotations"] 				= new Object();
window.labels["annotations"]["makeactor"]	= "Make a new actor";
window.labels["annotations"]["popuptitle"]	= "Choose actor";
window.labels["annotations"]["needtologin"]	= "You need to login";
window.labels["annotations"]["addingactor"]	= "Adding Actor";
window.labels["annotations"]["actoralreadyadded"]	= "Actor already added";
window.labels["annotations"]["wasaproblem"]	= "There was a problem, please try again";

/* sortable */
window.labels["sortable"]	 				= new Object();

/* lightbox */
window.labels["lightbox"]					= new Object();
window.labels["lightbox"]["cancel"]			= "Cancel";
window.labels["lightbox"]["save"]			= "Save";

/* editatonce */
window.labels["editatonce"] 				= new Object();
window.labels["editatonce"]["saving"]		= "saving ...";

/* editinplace */
window.labels["editinplace"] 				= new Object();
window.labels["editinplace"]["cancel"]		= "Cancel";
window.labels["editinplace"]["save"]		= "Save";
window.labels["editinplace"]["onempty"]		= "Add value";
window.labels["editinplace"]["saving"]		= "saving ...";
window.labels["editinplace"]["fetching"]	= "fetching ...";
window.labels["editinplace"]["validate"]			= new Object();
window.labels["editinplace"]["validate"]["msg"]		= "Please enter valid information";
window.labels["editinplace"]["validate"]["out"]		= "Value out of range";
window.labels["editinplace"]["validate"]["integer"]	= "Enter numbers between 0-9 only";
window.labels["editinplace"]["validate"]["float"]	= "Enter numbers between 0-9 only";

/* unlink */
window.labels["unlink"] 					= new Object();
window.labels["unlink"]["cancel"]			= "No";
window.labels["unlink"]["yes"]				= "Yes";
window.labels["unlink"]["confirm"]			= "Remove";
window.labels["unlink"]["title"]			= "Remove";

/* shoutbox */
window.labels['shoutbox'] 					= new Object();
window.labels['shoutbox']['away']	  		= "You seem to be away from this window. Shutting down shoutbox.";
window.labels['shoutbox']['changed']		= "The default conversation for this page has changed. Refreshing in a few seconds.";
window.labels['shoutbox']['noconv']			= "No conversation exists for this thing yet.";
window.labels['shoutbox']['emptytext']		= "Text is empty. You need to type something";
window.labels['shoutbox']['votedthis']		= "Voted this:";
window.labels['shoutbox']['showsms']		= "Show SMS";
window.labels['shoutbox']['hidesms']		= "Hide SMS";


/* wysiwyg */
window.labels['wysiwyg'] 					= new Object();
window.labels['wysiwyg']['add_link']		= "Add the link";
window.labels['wysiwyg']['add_youtube']		= "Add YouTube code";
window.labels['wysiwyg']['add_title']		= "Add the title of the link";
window.labels["wysiwyg"]['cancel']			= "Cancel";
window.labels["wysiwyg"]['ok']				= "OK";
window.labels["wysiwyg"]['youtube_expl']	= "You can find the YouTube code in the url on YouTube, for example http://www.youtube.com/watch?v=<strong>nogDHP0gl9M</strong>";

window.labels['wysiwyg']['buttons']				= new Object();
window.labels['wysiwyg']['buttons']['italic'] 	= "italic";
window.labels['wysiwyg']['buttons']['bold'] 	= "bold";
window.labels['wysiwyg']['buttons']['link']	 	= "link";
window.labels['wysiwyg']['buttons']['youtube']	= "link";
window.labels['wysiwyg']['buttons']['h1'] 		= "huge subhead";
window.labels['wysiwyg']['buttons']['h2'] 		= "medium subhead";
window.labels['wysiwyg']['buttons']['h3'] 		= "subhead";
window.labels['wysiwyg']['buttons']['h4'] 		= "small subhead";
/*
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-06-19 14:59:23 +0200 (Thu, 19 Jun 2008) $
 * $Rev: 36544 $
 *
 * 
 */

(function(){

// Map over jQuery in case of overwrite
var _jQuery = window.jQuery,
// Map over the $ in case of overwrite
	_$ = window.$;

var jQuery = window.jQuery = window.$ = function( selector, context ) {
	// The jQuery object is actually just the init constructor 'enhanced'
	return new jQuery.fn.init( selector, context );
};

// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,

// Is it a simple selector
	isSimple = /^.[^:#\[\.]*$/,

// Will speed up references to undefined, and allows munging its name.
	undefined;

jQuery.fn = jQuery.prototype = {
	init: function( selector, context ) {
		// Make sure that a selection was provided
		selector = selector || document;

		// Handle $(DOMElement)
		if ( selector.nodeType ) {
			this[0] = selector;
			this.length = 1;
			return this;
		}
		// Handle HTML strings
		if ( typeof selector == "string" ) {
			// Are we dealing with HTML string or an ID?
			var match = quickExpr.exec( selector );

			// Verify a match, and that no context was specified for #id
			if ( match && (match[1] || !context) ) {

				// HANDLE: $(html) -> $(array)
				if ( match[1] )
					selector = jQuery.clean( [ match[1] ], context );

				// HANDLE: $("#id")
				else {
					var elem = document.getElementById( match[3] );

					// Make sure an element was located
					if ( elem ){
						// Handle the case where IE and Opera return items
						// by name instead of ID
						if ( elem.id != match[3] )
							return jQuery().find( selector );

						// Otherwise, we inject the element directly into the jQuery object
						return jQuery( elem );
					}
					selector = [];
				}

			// HANDLE: $(expr, [context])
			// (which is just equivalent to: $(content).find(expr)
			} else
				return jQuery( context ).find( selector );

		// HANDLE: $(function)
		// Shortcut for document ready
		} else if ( jQuery.isFunction( selector ) )
			return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );

		return this.setArray(jQuery.makeArray(selector));
	},

	// The current version of jQuery being used
	jquery: "1.2.6",

	// The number of elements contained in the matched element set
	size: function() {
		return this.length;
	},

	// The number of elements contained in the matched element set
	length: 0,

	// Get the Nth element in the matched element set OR
	// Get the whole matched element set as a clean array
	get: function( num ) {
		return num == undefined ?

			// Return a 'clean' array
			jQuery.makeArray( this ) :

			// Return just the object
			this[ num ];
	},

	// Take an array of elements and push it onto the stack
	// (returning the new matched element set)
	pushStack: function( elems ) {
		// Build a new jQuery matched element set
		var ret = jQuery( elems );

		// Add the old object onto the stack (as a reference)
		ret.prevObject = this;

		// Return the newly-formed element set
		return ret;
	},

	// Force the current matched set of elements to become
	// the specified array of elements (destroying the stack in the process)
	// You should use pushStack() in order to do this, but maintain the stack
	setArray: function( elems ) {
		// Resetting the length to 0, then using the native Array push
		// is a super-fast way to populate an object with array-like properties
		this.length = 0;
		Array.prototype.push.apply( this, elems );

		return this;
	},

	// Execute a callback for every element in the matched set.
	// (You can seed the arguments with an array of args, but this is
	// only used internally.)
	each: function( callback, args ) {
		return jQuery.each( this, callback, args );
	},

	// Determine the position of an element within
	// the matched set of elements
	index: function( elem ) {
		var ret = -1;

		// Locate the position of the desired element
		return jQuery.inArray(
			// If it receives a jQuery object, the first element is used
			elem && elem.jquery ? elem[0] : elem
		, this );
	},

	attr: function( name, value, type ) {
		var options = name;

		// Look for the case where we're accessing a style value
		if ( name.constructor == String )
			if ( value === undefined )
				return this[0] && jQuery[ type || "attr" ]( this[0], name );

			else {
				options = {};
				options[ name ] = value;
			}

		// Check to see if we're setting style values
		return this.each(function(i){
			// Set all the styles
			for ( name in options )
				jQuery.attr(
					type ?
						this.style :
						this,
					name, jQuery.prop( this, options[ name ], type, i, name )
				);
		});
	},

	css: function( key, value ) {
		// ignore negative width and height values
		if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
			value = undefined;
		return this.attr( key, value, "curCSS" );
	},

	text: function( text ) {
		if ( typeof text != "object" && text != null )
			return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );

		var ret = "";

		jQuery.each( text || this, function(){
			jQuery.each( this.childNodes, function(){
				if ( this.nodeType != 8 )
					ret += this.nodeType != 1 ?
						this.nodeValue :
						jQuery.fn.text( [ this ] );
			});
		});

		return ret;
	},

	wrapAll: function( html ) {
		if ( this[0] )
			// The elements to wrap the target around
			jQuery( html, this[0].ownerDocument )
				.clone()
				.insertBefore( this[0] )
				.map(function(){
					var elem = this;

					while ( elem.firstChild )
						elem = elem.firstChild;

					return elem;
				})
				.append(this);

		return this;
	},

	wrapInner: function( html ) {
		return this.each(function(){
			jQuery( this ).contents().wrapAll( html );
		});
	},

	wrap: function( html ) {
		return this.each(function(){
			jQuery( this ).wrapAll( html );
		});
	},

	append: function() {
		return this.domManip(arguments, true, false, function(elem){
			if (this.nodeType == 1)
				this.appendChild( elem );
		});
	},

	prepend: function() {
		return this.domManip(arguments, true, true, function(elem){
			if (this.nodeType == 1)
				this.insertBefore( elem, this.firstChild );
		});
	},

	before: function() {
		return this.domManip(arguments, false, false, function(elem){
			this.parentNode.insertBefore( elem, this );
		});
	},

	after: function() {
		return this.domManip(arguments, false, true, function(elem){
			this.parentNode.insertBefore( elem, this.nextSibling );
		});
	},

	end: function() {
		return this.prevObject || jQuery( [] );
	},

	find: function( selector ) {
		var elems = jQuery.map(this, function(elem){
			return jQuery.find( selector, elem );
		});

		return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
			jQuery.unique( elems ) :
			elems );
	},

	clone: function( events ) {
		// Do the clone
		var ret = this.map(function(){
			if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
				// IE copies events bound via attachEvent when
				// using cloneNode. Calling detachEvent on the
				// clone will also remove the events from the orignal
				// In order to get around this, we use innerHTML.
				// Unfortunately, this means some modifications to
				// attributes in IE that are actually only stored
				// as properties will not be copied (such as the
				// the name attribute on an input).
				var clone = this.cloneNode(true),
					container = document.createElement("div");
				container.appendChild(clone);
				return jQuery.clean([container.innerHTML])[0];
			} else
				return this.cloneNode(true);
		});

		// Need to set the expando to null on the cloned set if it exists
		// removeData doesn't work here, IE removes it from the original as well
		// this is primarily for IE but the data expando shouldn't be copied over in any browser
		var clone = ret.find("*").andSelf().each(function(){
			if ( this[ expando ] != undefined )
				this[ expando ] = null;
		});

		// Copy the events from the original to the clone
		if ( events === true )
			this.find("*").andSelf().each(function(i){
				if (this.nodeType == 3)
					return;
				var events = jQuery.data( this, "events" );

				for ( var type in events )
					for ( var handler in events[ type ] )
						jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
			});

		// Return the cloned set
		return ret;
	},

	filter: function( selector ) {
		return this.pushStack(
			jQuery.isFunction( selector ) &&
			jQuery.grep(this, function(elem, i){
				return selector.call( elem, i );
			}) ||

			jQuery.multiFilter( selector, this ) );
	},

	not: function( selector ) {
		if ( selector.constructor == String )
			// test special case where just one selector is passed in
			if ( isSimple.test( selector ) )
				return this.pushStack( jQuery.multiFilter( selector, this, true ) );
			else
				selector = jQuery.multiFilter( selector, this );

		var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
		return this.filter(function() {
			return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
		});
	},

	add: function( selector ) {
		return this.pushStack( jQuery.unique( jQuery.merge(
			this.get(),
			typeof selector == 'string' ?
				jQuery( selector ) :
				jQuery.makeArray( selector )
		)));
	},

	is: function( selector ) {
		return !!selector && jQuery.multiFilter( selector, this ).length > 0;
	},

	hasClass: function( selector ) {
		return this.is( "." + selector );
	},

	val: function( value ) {
		if ( value == undefined ) {

			if ( this.length ) {
				var elem = this[0];

				// We need to handle select boxes special
				if ( jQuery.nodeName( elem, "select" ) ) {
					var index = elem.selectedIndex,
						values = [],
						options = elem.options,
						one = elem.type == "select-one";

					// Nothing was selected
					if ( index < 0 )
						return null;

					// Loop through all the selected options
					for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
						var option = options[ i ];

						if ( option.selected ) {
							// Get the specifc value for the option
							value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;

							// We don't need an array for one selects
							if ( one )
								return value;

							// Multi-Selects return an array
							values.push( value );
						}
					}

					return values;

				// Everything else, we just grab the value
				} else
					return (this[0].value || "").replace(/\r/g, "");

			}

			return undefined;
		}

		if( value.constructor == Number )
			value += '';

		return this.each(function(){
			if ( this.nodeType != 1 )
				return;

			if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
				this.checked = (jQuery.inArray(this.value, value) >= 0 ||
					jQuery.inArray(this.name, value) >= 0);

			else if ( jQuery.nodeName( this, "select" ) ) {
				var values = jQuery.makeArray(value);

				jQuery( "option", this ).each(function(){
					this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
						jQuery.inArray( this.text, values ) >= 0);
				});

				if ( !values.length )
					this.selectedIndex = -1;

			} else
				this.value = value;
		});
	},

	html: function( value ) {
		return value == undefined ?
			(this[0] ?
				this[0].innerHTML :
				null) :
			this.empty().append( value );
	},

	replaceWith: function( value ) {
		return this.after( value ).remove();
	},

	eq: function( i ) {
		return this.slice( i, i + 1 );
	},

	slice: function() {
		return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
	},

	map: function( callback ) {
		return this.pushStack( jQuery.map(this, function(elem, i){
			return callback.call( elem, i, elem );
		}));
	},

	andSelf: function() {
		return this.add( this.prevObject );
	},

	data: function( key, value ){
		var parts = key.split(".");
		parts[1] = parts[1] ? "." + parts[1] : "";

		if ( value === undefined ) {
			var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);

			if ( data === undefined && this.length )
				data = jQuery.data( this[0], key );

			return data === undefined && parts[1] ?
				this.data( parts[0] ) :
				data;
		} else
			return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
				jQuery.data( this, key, value );
			});
	},

	removeData: function( key ){
		return this.each(function(){
			jQuery.removeData( this, key );
		});
	},

	domManip: function( args, table, reverse, callback ) {
		var clone = this.length > 1, elems;

		return this.each(function(){
			if ( !elems ) {
				elems = jQuery.clean( args, this.ownerDocument );

				if ( reverse )
					elems.reverse();
			}

			var obj = this;

			if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
				obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );

			var scripts = jQuery( [] );

			jQuery.each(elems, function(){
				var elem = clone ?
					jQuery( this ).clone( true )[0] :
					this;

				// execute all scripts after the elements have been injected
				if ( jQuery.nodeName( elem, "script" ) )
					scripts = scripts.add( elem );
				else {
					// Remove any inner scripts for later evaluation
					if ( elem.nodeType == 1 )
						scripts = scripts.add( jQuery( "script", elem ).remove() );

					// Inject the elements into the document
					callback.call( obj, elem );
				}
			});

			scripts.each( evalScript );
		});
	}
};

// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;

function evalScript( i, elem ) {
	if ( elem.src )
		jQuery.ajax({
			url: elem.src,
			async: false,
			dataType: "script"
		});

	else
		jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );

	if ( elem.parentNode )
		elem.parentNode.removeChild( elem );
}

function now(){
	return +new Date;
}

jQuery.extend = jQuery.fn.extend = function() {
	// copy reference to target object
	var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;

	// Handle a deep copy situation
	if ( target.constructor == 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" && typeof target != "function" )
		target = {};

	// extend jQuery itself if only one argument is passed
	if ( length == i ) {
		target = this;
		--i;
	}

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

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

				// Recurse if we're merging object values
				if ( deep && copy && typeof copy == "object" && !copy.nodeType )
					target[ name ] = jQuery.extend( deep, 
						// Never move original objects, clone them
						src || ( copy.length != null ? [ ] : { } )
					, copy );

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

			}

	// Return the modified object
	return target;
};

var expando = "jQuery" + now(), uuid = 0, windowData = {},
	// exclude the following css properties to add px
	exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
	// cache defaultView
	defaultView = document.defaultView || {};

jQuery.extend({
	noConflict: function( deep ) {
		window.$ = _$;

		if ( deep )
			window.jQuery = _jQuery;

		return jQuery;
	},

	// See test/unit/core.js for details concerning this function.
	isFunction: function( fn ) {
		return !!fn && typeof fn != "string" && !fn.nodeName &&
			fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
	},

	// check if an element is in a (or is an) XML document
	isXMLDoc: function( elem ) {
		return elem.documentElement && !elem.body ||
			elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
	},

	// Evalulates a script in a global context
	globalEval: function( data ) {
		data = jQuery.trim( data );

		if ( data ) {
			// Inspired by code by Andrea Giammarchi
			// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
			var head = document.getElementsByTagName("head")[0] || document.documentElement,
				script = document.createElement("script");

			script.type = "text/javascript";
			if ( jQuery.browser.msie )
				script.text = data;
			else
				script.appendChild( document.createTextNode( data ) );

			// Use insertBefore instead of appendChild  to circumvent an IE6 bug.
			// This arises when a base node is used (#2709).
			head.insertBefore( script, head.firstChild );
			head.removeChild( script );
		}
	},

	nodeName: function( elem, name ) {
		return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
	},

	cache: {},

	data: function( elem, name, data ) {
		elem = elem == window ?
			windowData :
			elem;

		var id = elem[ expando ];

		// Compute a unique ID for the element
		if ( !id )
			id = elem[ expando ] = ++uuid;

		// Only generate the data cache if we're
		// trying to access or manipulate it
		if ( name && !jQuery.cache[ id ] )
			jQuery.cache[ id ] = {};

		// Prevent overriding the named cache with undefined values
		if ( data !== undefined )
			jQuery.cache[ id ][ name ] = data;

		// Return the named cache data, or the ID for the element
		return name ?
			jQuery.cache[ id ][ name ] :
			id;
	},

	removeData: function( elem, name ) {
		elem = elem == window ?
			windowData :
			elem;

		var id = elem[ expando ];

		// If we want to remove a specific section of the element's data
		if ( name ) {
			if ( jQuery.cache[ id ] ) {
				// Remove the section of cache data
				delete jQuery.cache[ id ][ name ];

				// If we've removed all the data, remove the element's cache
				name = "";

				for ( name in jQuery.cache[ id ] )
					break;

				if ( !name )
					jQuery.removeData( elem );
			}

		// Otherwise, we want to remove all of the element's data
		} else {
			// Clean up the element expando
			try {
				delete elem[ expando ];
			} catch(e){
				// IE has trouble directly removing the expando
				// but it's ok with using removeAttribute
				if ( elem.removeAttribute )
					elem.removeAttribute( expando );
			}

			// Completely remove the data cache
			delete jQuery.cache[ id ];
		}
	},

	// args is for internal usage only
	each: function( object, callback, args ) {
		var name, i = 0, length = object.length;

		if ( args ) {
			if ( length == undefined ) {
				for ( name in object )
					if ( callback.apply( object[ name ], args ) === false )
						break;
			} else
				for ( ; i < length; )
					if ( callback.apply( object[ i++ ], args ) === false )
						break;

		// A special, fast, case for the most common use of each
		} else {
			if ( length == undefined ) {
				for ( name in object )
					if ( callback.call( object[ name ], name, object[ name ] ) === false )
						break;
			} else
				for ( var value = object[0];
					i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
		}

		return object;
	},

	prop: function( elem, value, type, i, name ) {
		// Handle executable functions
		if ( jQuery.isFunction( value ) )
			value = value.call( elem, i );

		// Handle passing in a number to a CSS property
		return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
			value + "px" :
			value;
	},

	className: {
		// internal only, use addClass("class")
		add: function( elem, classNames ) {
			jQuery.each((classNames || "").split(/\s+/), function(i, className){
				if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
					elem.className += (elem.className ? " " : "") + className;
			});
		},

		// internal only, use removeClass("class")
		remove: function( elem, classNames ) {
			if (elem.nodeType == 1)
				elem.className = classNames != undefined ?
					jQuery.grep(elem.className.split(/\s+/), function(className){
						return !jQuery.className.has( classNames, className );
					}).join(" ") :
					"";
		},

		// internal only, use hasClass("class")
		has: function( elem, className ) {
			return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
		}
	},

	// A method for quickly swapping in/out CSS properties to get correct calculations
	swap: function( elem, options, callback ) {
		var old = {};
		// Remember the old values, and insert the new ones
		for ( var name in options ) {
			old[ name ] = elem.style[ name ];
			elem.style[ name ] = options[ name ];
		}

		callback.call( elem );

		// Revert the old values
		for ( var name in options )
			elem.style[ name ] = old[ name ];
	},

	css: function( elem, name, force ) {
		if ( name == "width" || name == "height" ) {
			var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];

			function getWH() {
				val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
				var padding = 0, border = 0;
				jQuery.each( which, function() {
					padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
					border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
				});
				val -= Math.round(padding + border);
			}

			if ( jQuery(elem).is(":visible") )
				getWH();
			else
				jQuery.swap( elem, props, getWH );

			return Math.max(0, val);
		}

		return jQuery.curCSS( elem, name, force );
	},

	curCSS: function( elem, name, force ) {
		var ret, style = elem.style;

		// A helper method for determining if an element's values are broken
		function color( elem ) {
			if ( !jQuery.browser.safari )
				return false;

			// defaultView is cached
			var ret = defaultView.getComputedStyle( elem, null );
			return !ret || ret.getPropertyValue("color") == "";
		}

		// We need to handle opacity special in IE
		if ( name == "opacity" && jQuery.browser.msie ) {
			ret = jQuery.attr( style, "opacity" );

			return ret == "" ?
				"1" :
				ret;
		}
		// Opera sometimes will give the wrong display answer, this fixes it, see #2037
		if ( jQuery.browser.opera && name == "display" ) {
			var save = style.outline;
			style.outline = "0 solid black";
			style.outline = save;
		}

		// Make sure we're using the right name for getting the float value
		if ( name.match( /float/i ) )
			name = styleFloat;

		if ( !force && style && style[ name ] )
			ret = style[ name ];

		else if ( defaultView.getComputedStyle ) {

			// Only "float" is needed here
			if ( name.match( /float/i ) )
				name = "float";

			name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();

			var computedStyle = defaultView.getComputedStyle( elem, null );

			if ( computedStyle && !color( elem ) )
				ret = computedStyle.getPropertyValue( name );

			// If the element isn't reporting its values properly in Safari
			// then some display: none elements are involved
			else {
				var swap = [], stack = [], a = elem, i = 0;

				// Locate all of the parent display: none elements
				for ( ; a && color(a); a = a.parentNode )
					stack.unshift(a);

				// Go through and make them visible, but in reverse
				// (It would be better if we knew the exact display type that they had)
				for ( ; i < stack.length; i++ )
					if ( color( stack[ i ] ) ) {
						swap[ i ] = stack[ i ].style.display;
						stack[ i ].style.display = "block";
					}

				// Since we flip the display style, we have to handle that
				// one special, otherwise get the value
				ret = name == "display" && swap[ stack.length - 1 ] != null ?
					"none" :
					( computedStyle && computedStyle.getPropertyValue( name ) ) || "";

				// Finally, revert the display styles back
				for ( i = 0; i < swap.length; i++ )
					if ( swap[ i ] != null )
						stack[ i ].style.display = swap[ i ];
			}

			// We should always get a number back from opacity
			if ( name == "opacity" && ret == "" )
				ret = "1";

		} else if ( elem.currentStyle ) {
			var camelCase = name.replace(/\-(\w)/g, function(all, letter){
				return letter.toUpperCase();
			});

			ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];

			// From the awesome hack by Dean Edwards
			// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291

			// If we're not dealing with a regular pixel number
			// but a number that has a weird ending, we need to convert it to pixels
			if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
				// Remember the original values
				var left = style.left, rsLeft = elem.runtimeStyle.left;

				// Put in the new values to get a computed value out
				elem.runtimeStyle.left = elem.currentStyle.left;
				style.left = ret || 0;
				ret = style.pixelLeft + "px";

				// Revert the changed values
				style.left = left;
				elem.runtimeStyle.left = rsLeft;
			}
		}

		return ret;
	},

	clean: function( elems, context ) {
		var ret = [];
		context = context || document;
		// !context.createElement fails in IE with an error but returns typeof 'object'
		if (typeof context.createElement == 'undefined')
			context = context.ownerDocument || context[0] && context[0].ownerDocument || document;

		jQuery.each(elems, function(i, elem){
			if ( !elem )
				return;

			if ( elem.constructor == Number )
				elem += '';

			// Convert html string into DOM nodes
			if ( typeof elem == "string" ) {
				// Fix "XHTML"-style tags in all browsers
				elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
					return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
						all :
						front + "></" + tag + ">";
				});

				// Trim whitespace, otherwise indexOf won't work as expected
				var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");

				var wrap =
					// option or optgroup
					!tags.indexOf("<opt") &&
					[ 1, "<select multiple='multiple'>", "</select>" ] ||

					!tags.indexOf("<leg") &&
					[ 1, "<fieldset>", "</fieldset>" ] ||

					tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
					[ 1, "<table>", "</table>" ] ||

					!tags.indexOf("<tr") &&
					[ 2, "<table><tbody>", "</tbody></table>" ] ||

				 	// <thead> matched above
					(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
					[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||

					!tags.indexOf("<col") &&
					[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||

					// IE can't serialize <link> and <script> tags normally
					jQuery.browser.msie &&
					[ 1, "div<div>", "</div>" ] ||

					[ 0, "", "" ];

				// Go to html and back, then peel off extra wrappers
				div.innerHTML = wrap[1] + elem + wrap[2];

				// Move to the right depth
				while ( wrap[0]-- )
					div = div.lastChild;

				// Remove IE's autoinserted <tbody> from table fragments
				if ( jQuery.browser.msie ) {

					// String was a <table>, *may* have spurious <tbody>
					var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
						div.firstChild && div.firstChild.childNodes :

						// String was a bare <thead> or <tfoot>
						wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
							div.childNodes :
							[];

					for ( var j = tbody.length - 1; j >= 0 ; --j )
						if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
							tbody[ j ].parentNode.removeChild( tbody[ j ] );

					// IE completely kills leading whitespace when innerHTML is used
					if ( /^\s/.test( elem ) )
						div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );

				}

				elem = jQuery.makeArray( div.childNodes );
			}

			if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
				return;

			if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
				ret.push( elem );

			else
				ret = jQuery.merge( ret, elem );

		});

		return ret;
	},

	attr: function( elem, name, value ) {
		// don't set attributes on text and comment nodes
		if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
			return undefined;

		var notxml = !jQuery.isXMLDoc( elem ),
			// Whether we are setting (or getting)
			set = value !== undefined,
			msie = jQuery.browser.msie;

		// Try to normalize/fix the name
		name = notxml && jQuery.props[ name ] || name;

		// Only do all the following if this is a node (faster for style)
		// IE elem.getAttribute passes even for style
		if ( elem.tagName ) {

			// These attributes require special treatment
			var special = /href|src|style/.test( name );

			// Safari mis-reports the default selected property of a hidden option
			// Accessing the parent's selectedIndex property fixes it
			if ( name == "selected" && jQuery.browser.safari )
				elem.parentNode.selectedIndex;

			// If applicable, access the attribute via the DOM 0 way
			if ( name in elem && notxml && !special ) {
				if ( set ){
					// We can't allow the type property to be changed (since it causes problems in IE)
					if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
						throw "type property can't be changed";

					elem[ name ] = value;
				}

				// browsers index elements by id/name on forms, give priority to attributes.
				if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
					return elem.getAttributeNode( name ).nodeValue;

				return elem[ name ];
			}

			if ( msie && notxml &&  name == "style" )
				return jQuery.attr( elem.style, "cssText", value );

			if ( set )
				// convert the value to a string (all browsers do this but IE) see #1070
				elem.setAttribute( name, "" + value );

			var attr = msie && notxml && special
					// Some attributes require a special call on IE
					? elem.getAttribute( name, 2 )
					: elem.getAttribute( name );

			// Non-existent attributes return null, we normalize to undefined
			return attr === null ? undefined : attr;
		}

		// elem is actually elem.style ... set the style

		// IE uses filters for opacity
		if ( msie && name == "opacity" ) {
			if ( set ) {
				// IE has trouble with opacity if it does not have layout
				// Force it by setting the zoom level
				elem.zoom = 1;

				// Set the alpha filter to set the opacity
				elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
					(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
			}

			return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
				(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
				"";
		}

		name = name.replace(/-([a-z])/ig, function(all, letter){
			return letter.toUpperCase();
		});

		if ( set )
			elem[ name ] = value;

		return elem[ name ];
	},

	trim: function( text ) {
		return (text || "").replace( /^\s+|\s+$/g, "" );
	},

	makeArray: function( array ) {
		var ret = [];

		if( array != null ){
			var i = array.length;
			//the window, strings and functions also have 'length'
			if( i == null || array.split || array.setInterval || array.call )
				ret[0] = array;
			else
				while( i )
					ret[--i] = array[i];
		}

		return ret;
	},

	inArray: function( elem, array ) {
		for ( var i = 0, length = array.length; i < length; i++ )
		// Use === because on IE, window == document
			if ( array[ i ] === elem )
				return i;

		return -1;
	},

	merge: function( first, second ) {
		// We have to loop this way because IE & Opera overwrite the length
		// expando of getElementsByTagName
		var i = 0, elem, pos = first.length;
		// Also, we need to make sure that the correct elements are being returned
		// (IE returns comment nodes in a '*' query)
		if ( jQuery.browser.msie ) {
			while ( elem = second[ i++ ] )
				if ( elem.nodeType != 8 )
					first[ pos++ ] = elem;

		} else
			while ( elem = second[ i++ ] )
				first[ pos++ ] = elem;

		return first;
	},

	unique: function( array ) {
		var ret = [], done = {};

		try {

			for ( var i = 0, length = array.length; i < length; i++ ) {
				var id = jQuery.data( array[ i ] );

				if ( !done[ id ] ) {
					done[ id ] = true;
					ret.push( array[ i ] );
				}
			}

		} catch( e ) {
			ret = array;
		}

		return ret;
	},

	grep: function( elems, callback, inv ) {
		var ret = [];

		// Go through the array, only saving the items
		// that pass the validator function
		for ( var i = 0, length = elems.length; i < length; i++ )
			if ( !inv != !callback( elems[ i ], i ) )
				ret.push( elems[ i ] );

		return ret;
	},

	map: function( elems, callback ) {
		var ret = [];

		// Go through the array, translating each of the items to their
		// new value (or values).
		for ( var i = 0, length = elems.length; i < length; i++ ) {
			var value = callback( elems[ i ], i );

			if ( value != null )
				ret[ ret.length ] = value;
		}

		return ret.concat.apply( [], ret );
	}
});

var userAgent = navigator.userAgent.toLowerCase();

// Figure out what browser is being used
jQuery.browser = {
	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
	safari: /webkit/.test( userAgent ),
	opera: /opera/.test( userAgent ),
	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};

var styleFloat = jQuery.browser.msie ?
	"styleFloat" :
	"cssFloat";

jQuery.extend({
	// Check to see if the W3C box model is being used
	boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",

	props: {
		"for": "htmlFor",
		"class": "className",
		"float": styleFloat,
		cssFloat: styleFloat,
		styleFloat: styleFloat,
		readonly: "readOnly",
		maxlength: "maxLength",
		cellspacing: "cellSpacing"
	}
});

jQuery.each({
	parent: function(elem){return elem.parentNode;},
	parents: function(elem){return jQuery.dir(elem,"parentNode");},
	next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
	prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
	nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
	prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
	siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
	children: function(elem){return jQuery.sibling(elem.firstChild);},
	contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
}, function(name, fn){
	jQuery.fn[ name ] = function( selector ) {
		var ret = jQuery.map( this, fn );

		if ( selector && typeof selector == "string" )
			ret = jQuery.multiFilter( selector, ret );

		return this.pushStack( jQuery.unique( ret ) );
	};
});

jQuery.each({
	appendTo: "append",
	prependTo: "prepend",
	insertBefore: "before",
	insertAfter: "after",
	replaceAll: "replaceWith"
}, function(name, original){
	jQuery.fn[ name ] = function() {
		var args = arguments;

		return this.each(function(){
			for ( var i = 0, length = args.length; i < length; i++ )
				jQuery( args[ i ] )[ original ]( this );
		});
	};
});

jQuery.each({
	removeAttr: function( name ) {
		jQuery.attr( this, name, "" );
		if (this.nodeType == 1)
			this.removeAttribute( name );
	},

	addClass: function( classNames ) {
		jQuery.className.add( this, classNames );
	},

	removeClass: function( classNames ) {
		jQuery.className.remove( this, classNames );
	},

	toggleClass: function( classNames ) {
		jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
	},

	remove: function( selector ) {
		if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
			// Prevent memory leaks
			jQuery( "*", this ).add(this).each(function(){
				jQuery.event.remove(this);
				jQuery.removeData(this);
			});
			if (this.parentNode)
				this.parentNode.removeChild( this );
		}
	},

	empty: function() {
		// Remove element nodes and prevent memory leaks
		jQuery( ">*", this ).remove();

		// Remove any remaining nodes
		while ( this.firstChild )
			this.removeChild( this.firstChild );
	}
}, function(name, fn){
	jQuery.fn[ name ] = function(){
		return this.each( fn, arguments );
	};
});

jQuery.each([ "Height", "Width" ], function(i, name){
	var type = name.toLowerCase();

	jQuery.fn[ type ] = function( size ) {
		// Get window width or height
		return this[0] == window ?
			// Opera reports document.body.client[Width/Height] properly in both quirks and standards
			jQuery.browser.opera && document.body[ "client" + name ] ||

			// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
			jQuery.browser.safari && window[ "inner" + name ] ||

			// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
			document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :

			// Get document width or height
			this[0] == document ?
				// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
				Math.max(
					Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
					Math.max(document.body["offset" + name], document.documentElement["offset" + name])
				) :

				// Get or set width or height on the element
				size == undefined ?
					// Get width or height on the element
					(this.length ? jQuery.css( this[0], type ) : null) :

					// Set the width or height on the element (default to pixels if value is unitless)
					this.css( type, size.constructor == String ? size : size + "px" );
	};
});

// Helper function used by the dimensions and offset modules
function num(elem, prop) {
	return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
		"(?:[\\w*_-]|\\\\.)" :
		"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
	quickChild = new RegExp("^>\\s*(" + chars + "+)"),
	quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
	quickClass = new RegExp("^([#.]?)(" + chars + "*)");

jQuery.extend({
	expr: {
		"": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
		"#": function(a,i,m){return a.getAttribute("id")==m[2];},
		":": {
			// Position Checks
			lt: function(a,i,m){return i<m[3]-0;},
			gt: function(a,i,m){return i>m[3]-0;},
			nth: function(a,i,m){return m[3]-0==i;},
			eq: function(a,i,m){return m[3]-0==i;},
			first: function(a,i){return i==0;},
			last: function(a,i,m,r){return i==r.length-1;},
			even: function(a,i){return i%2==0;},
			odd: function(a,i){return i%2;},

			// Child Checks
			"first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
			"last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
			"only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},

			// Parent Checks
			parent: function(a){return a.firstChild;},
			empty: function(a){return !a.firstChild;},

			// Text Check
			contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},

			// Visibility
			visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
			hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},

			// Form attributes
			enabled: function(a){return !a.disabled;},
			disabled: function(a){return a.disabled;},
			checked: function(a){return a.checked;},
			selected: function(a){return a.selected||jQuery.attr(a,"selected");},

			// Form elements
			text: function(a){return "text"==a.type;},
			radio: function(a){return "radio"==a.type;},
			checkbox: function(a){return "checkbox"==a.type;},
			file: function(a){return "file"==a.type;},
			password: function(a){return "password"==a.type;},
			submit: function(a){return "submit"==a.type;},
			image: function(a){return "image"==a.type;},
			reset: function(a){return "reset"==a.type;},
			button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
			input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},

			// :has()
			has: function(a,i,m){return jQuery.find(m[3],a).length;},

			// :header
			header: function(a){return /h\d/i.test(a.nodeName);},

			// :animated
			animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
		}
	},

	// The regular expressions that power the parsing engine
	parse: [
		// Match: [@value='test'], [@foo]
		/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,

		// Match: :contains('foo')
		/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,

		// Match: :even, :last-child, #id, .class
		new RegExp("^([:.#]*)(" + chars + "+)")
	],

	multiFilter: function( expr, elems, not ) {
		var old, cur = [];

		while ( expr && expr != old ) {
			old = expr;
			var f = jQuery.filter( expr, elems, not );
			expr = f.t.replace(/^\s*,\s*/, "" );
			cur = not ? elems = f.r : jQuery.merge( cur, f.r );
		}

		return cur;
	},

	find: function( t, context ) {
		// Quickly handle non-string expressions
		if ( typeof t != "string" )
			return [ t ];

		// check to make sure context is a DOM element or a document
		if ( context && context.nodeType != 1 && context.nodeType != 9)
			return [ ];

		// Set the correct context (if none is provided)
		context = context || document;

		// Initialize the search
		var ret = [context], done = [], last, nodeName;

		// Continue while a selector expression exists, and while
		// we're no longer looping upon ourselves
		while ( t && last != t ) {
			var r = [];
			last = t;

			t = jQuery.trim(t);

			var foundToken = false,

			// An attempt at speeding up child selectors that
			// point to a specific element tag
				re = quickChild,

				m = re.exec(t);

			if ( m ) {
				nodeName = m[1].toUpperCase();

				// Perform our own iteration and filter
				for ( var i = 0; ret[i]; i++ )
					for ( var c = ret[i].firstChild; c; c = c.nextSibling )
						if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
							r.push( c );

				ret = r;
				t = t.replace( re, "" );
				if ( t.indexOf(" ") == 0 ) continue;
				foundToken = true;
			} else {
				re = /^([>+~])\s*(\w*)/i;

				if ( (m = re.exec(t)) != null ) {
					r = [];

					var merge = {};
					nodeName = m[2].toUpperCase();
					m = m[1];

					for ( var j = 0, rl = ret.length; j < rl; j++ ) {
						var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
						for ( ; n; n = n.nextSibling )
							if ( n.nodeType == 1 ) {
								var id = jQuery.data(n);

								if ( m == "~" && merge[id] ) break;

								if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
									if ( m == "~" ) merge[id] = true;
									r.push( n );
								}

								if ( m == "+" ) break;
							}
					}

					ret = r;

					// And remove the token
					t = jQuery.trim( t.replace( re, "" ) );
					foundToken = true;
				}
			}

			// See if there's still an expression, and that we haven't already
			// matched a token
			if ( t && !foundToken ) {
				// Handle multiple expressions
				if ( !t.indexOf(",") ) {
					// Clean the result set
					if ( context == ret[0] ) ret.shift();

					// Merge the result sets
					done = jQuery.merge( done, ret );

					// Reset the context
					r = ret = [context];

					// Touch up the selector string
					t = " " + t.substr(1,t.length);

				} else {
					// Optimize for the case nodeName#idName
					var re2 = quickID;
					var m = re2.exec(t);

					// Re-organize the results, so that they're consistent
					if ( m ) {
						m = [ 0, m[2], m[3], m[1] ];

					} else {
						// Otherwise, do a traditional filter check for
						// ID, class, and element selectors
						re2 = quickClass;
						m = re2.exec(t);
					}

					m[2] = m[2].replace(/\\/g, "");

					var elem = ret[ret.length-1];

					// Try to do a global search by ID, where we can
					if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
						// Optimization for HTML document case
						var oid = elem.getElementById(m[2]);

						// Do a quick check for the existence of the actual ID attribute
						// to avoid selecting by the name attribute in IE
						// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
						if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
							oid = jQuery('[@id="'+m[2]+'"]', elem)[0];

						// Do a quick check for node name (where applicable) so
						// that div#foo searches will be really fast
						ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
					} else {
						// We need to find all descendant elements
						for ( var i = 0; ret[i]; i++ ) {
							// Grab the tag name being searched for
							var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];

							// Handle IE7 being really dumb about <object>s
							if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
								tag = "param";

							r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
						}

						// It's faster to filter by class and be done with it
						if ( m[1] == "." )
							r = jQuery.classFilter( r, m[2] );

						// Same with ID filtering
						if ( m[1] == "#" ) {
							var tmp = [];

							// Try to find the element with the ID
							for ( var i = 0; r[i]; i++ )
								if ( r[i].getAttribute("id") == m[2] ) {
									tmp = [ r[i] ];
									break;
								}

							r = tmp;
						}

						ret = r;
					}

					t = t.replace( re2, "" );
				}

			}

			// If a selector string still exists
			if ( t ) {
				// Attempt to filter it
				var val = jQuery.filter(t,r);
				ret = r = val.r;
				t = jQuery.trim(val.t);
			}
		}

		// An error occurred with the selector;
		// just return an empty set instead
		if ( t )
			ret = [];

		// Remove the root context
		if ( ret && context == ret[0] )
			ret.shift();

		// And combine the results
		done = jQuery.merge( done, ret );

		return done;
	},

	classFilter: function(r,m,not){
		m = " " + m + " ";
		var tmp = [];
		for ( var i = 0; r[i]; i++ ) {
			var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
			if ( !not && pass || not && !pass )
				tmp.push( r[i] );
		}
		return tmp;
	},

	filter: function(t,r,not) {
		var last;

		// Look for common filter expressions
		while ( t && t != last ) {
			last = t;

			var p = jQuery.parse, m;

			for ( var i = 0; p[i]; i++ ) {
				m = p[i].exec( t );

				if ( m ) {
					// Remove what we just matched
					t = t.substring( m[0].length );

					m[2] = m[2].replace(/\\/g, "");
					break;
				}
			}

			if ( !m )
				break;

			// :not() is a special case that can be optimized by
			// keeping it out of the expression list
			if ( m[1] == ":" && m[2] == "not" )
				// optimize if only one selector found (most common case)
				r = isSimple.test( m[3] ) ?
					jQuery.filter(m[3], r, true).r :
					jQuery( r ).not( m[3] );

			// We can get a big speed boost by filtering by class here
			else if ( m[1] == "." )
				r = jQuery.classFilter(r, m[2], not);

			else if ( m[1] == "[" ) {
				var tmp = [], type = m[3];

				for ( var i = 0, rl = r.length; i < rl; i++ ) {
					var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];

					if ( z == null || /href|src|selected/.test(m[2]) )
						z = jQuery.attr(a,m[2]) || '';

					if ( (type == "" && !!z ||
						 type == "=" && z == m[5] ||
						 type == "!=" && z != m[5] ||
						 type == "^=" && z && !z.indexOf(m[5]) ||
						 type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
						 (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
							tmp.push( a );
				}

				r = tmp;

			// We can get a speed boost by handling nth-child here
			} else if ( m[1] == ":" && m[2] == "nth-child" ) {
				var merge = {}, tmp = [],
					// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
					test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
						m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
						!/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
					// calculate the numbers (first)n+(last) including if they are negative
					first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;

				// loop through all the elements left in the jQuery object
				for ( var i = 0, rl = r.length; i < rl; i++ ) {
					var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);

					if ( !merge[id] ) {
						var c = 1;

						for ( var n = parentNode.firstChild; n; n = n.nextSibling )
							if ( n.nodeType == 1 )
								n.nodeIndex = c++;

						merge[id] = true;
					}

					var add = false;

					if ( first == 0 ) {
						if ( node.nodeIndex == last )
							add = true;
					} else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
						add = true;

					if ( add ^ not )
						tmp.push( node );
				}

				r = tmp;

			// Otherwise, find the expression to execute
			} else {
				var fn = jQuery.expr[ m[1] ];
				if ( typeof fn == "object" )
					fn = fn[ m[2] ];

				if ( typeof fn == "string" )
					fn = eval("false||function(a,i){return " + fn + ";}");

				// Execute it against the current filter
				r = jQuery.grep( r, function(elem, i){
					return fn(elem, i, m, r);
				}, not );
			}
		}

		// Return an array of filtered elements (r)
		// and the modified expression string (t)
		return { r: r, t: t };
	},

	dir: function( elem, dir ){
		var matched = [],
			cur = elem[dir];
		while ( cur && cur != document ) {
			if ( cur.nodeType == 1 )
				matched.push( cur );
			cur = cur[dir];
		}
		return matched;
	},

	nth: function(cur,result,dir,elem){
		result = result || 1;
		var num = 0;

		for ( ; cur; cur = cur[dir] )
			if ( cur.nodeType == 1 && ++num == result )
				break;

		return cur;
	},

	sibling: function( n, elem ) {
		var r = [];

		for ( ; n; n = n.nextSibling ) {
			if ( n.nodeType == 1 && n != elem )
				r.push( n );
		}

		return r;
	}
});
/*
 * A number of helper functions used for managing events.
 * Many of the ideas behind this code orignated from
 * Dean Edwards' addEvent library.
 */
jQuery.event = {

	// Bind an event to an element
	// Original by Dean Edwards
	add: function(elem, types, handler, data) {
		if ( elem.nodeType == 3 || elem.nodeType == 8 )
			return;

		// For whatever reason, IE has trouble passing the window object
		// around, causing it to be cloned in the process
		if ( jQuery.browser.msie && elem.setInterval )
			elem = window;

		// Make sure that the function being executed has a unique ID
		if ( !handler.guid )
			handler.guid = this.guid++;

		// if data is passed, bind to handler
		if( data != undefined ) {
			// Create temporary function pointer to original handler
			var fn = handler;

			// Create unique handler function, wrapped around original handler
			handler = this.proxy( fn, function() {
				// Pass arguments and context to original handler
				return fn.apply(this, arguments);
			});

			// Store data in unique handler
			handler.data = data;
		}

		// Init the element's event structure
		var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
			handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
				// Handle the second event of a trigger and when
				// an event is called after a page has unloaded
				if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
					return jQuery.event.handle.apply(arguments.callee.elem, arguments);
			});
		// Add elem as a property of the handle function
		// This is to prevent a memory leak with non-native
		// event in IE.
		handle.elem = elem;

		// Handle multiple events separated by a space
		// jQuery(...).bind("mouseover mouseout", fn);
		jQuery.each(types.split(/\s+/), function(index, type) {
			// Namespaced event handlers
			var parts = type.split(".");
			type = parts[0];
			handler.type = parts[1];

			// Get the current list of functions bound to this event
			var handlers = events[type];

			// Init the event handler queue
			if (!handlers) {
				handlers = events[type] = {};

				// Check for a special event handler
				// Only use addEventListener/attachEvent if the special
				// events handler returns false
				if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
					// Bind the global event handler to the element
					if (elem.addEventListener)
						elem.addEventListener(type, handle, false);
					else if (elem.attachEvent)
						elem.attachEvent("on" + type, handle);
				}
			}

			// Add the function to the element's handler list
			handlers[handler.guid] = handler;

			// Keep track of which events have been used, for global triggering
			jQuery.event.global[type] = true;
		});

		// Nullify elem to prevent memory leaks in IE
		elem = null;
	},

	guid: 1,
	global: {},

	// Detach an event or set of events from an element
	remove: function(elem, types, handler) {
		// don't do events on text and comment nodes
		if ( elem.nodeType == 3 || elem.nodeType == 8 )
			return;

		var events = jQuery.data(elem, "events"), ret, index;

		if ( events ) {
			// Unbind all events for the element
			if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
				for ( var type in events )
					this.remove( elem, type + (types || "") );
			else {
				// types is actually an event object here
				if ( types.type ) {
					handler = types.handler;
					types = types.type;
				}

				// Handle multiple events seperated by a space
				// jQuery(...).unbind("mouseover mouseout", fn);
				jQuery.each(types.split(/\s+/), function(index, type){
					// Namespaced event handlers
					var parts = type.split(".");
					type = parts[0];

					if ( events[type] ) {
						// remove the given handler for the given type
						if ( handler )
							delete events[type][handler.guid];

						// remove all handlers for the given type
						else
							for ( handler in events[type] )
								// Handle the removal of namespaced events
								if ( !parts[1] || events[type][handler].type == parts[1] )
									delete events[type][handler];

						// remove generic event handler if no more handlers exist
						for ( ret in events[type] ) break;
						if ( !ret ) {
							if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
								if (elem.removeEventListener)
									elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
								else if (elem.detachEvent)
									elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
							}
							ret = null;
							delete events[type];
						}
					}
				});
			}

			// Remove the expando if it's no longer used
			for ( ret in events ) break;
			if ( !ret ) {
				var handle = jQuery.data( elem, "handle" );
				if ( handle ) handle.elem = null;
				jQuery.removeData( elem, "events" );
				jQuery.removeData( elem, "handle" );
			}
		}
	},

	trigger: function(type, data, elem, donative, extra) {
		// Clone the incoming data, if any
		data = jQuery.makeArray(data);

		if ( type.indexOf("!") >= 0 ) {
			type = type.slice(0, -1);
			var exclusive = true;
		}

		// Handle a global trigger
		if ( !elem ) {
			// Only trigger if we've ever bound an event for it
			if ( this.global[type] )
				jQuery("*").add([window, document]).trigger(type, data);

		// Handle triggering a single element
		} else {
			// don't do events on text and comment nodes
			if ( elem.nodeType == 3 || elem.nodeType == 8 )
				return undefined;

			var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
				// Check to see if we need to provide a fake event, or not
				event = !data[0] || !data[0].preventDefault;

			// Pass along a fake event
			if ( event ) {
				data.unshift({
					type: type,
					target: elem,
					preventDefault: function(){},
					stopPropagation: function(){},
					timeStamp: now()
				});
				data[0][expando] = true; // no need to fix fake event
			}

			// Enforce the right trigger type
			data[0].type = type;
			if ( exclusive )
				data[0].exclusive = true;

			// Trigger the event, it is assumed that "handle" is a function
			var handle = jQuery.data(elem, "handle");
			if ( handle )
				val = handle.apply( elem, data );

			// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
			if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
				val = false;

			// Extra functions don't get the custom event object
			if ( event )
				data.shift();

			// Handle triggering of extra function
			if ( extra && jQuery.isFunction( extra ) ) {
				// call the extra function and tack the current return value on the end for possible inspection
				ret = extra.apply( elem, val == null ? data : data.concat( val ) );
				// if anything is returned, give it precedence and have it overwrite the previous value
				if (ret !== undefined)
					val = ret;
			}

			// Trigger the native events (except for clicks on links)
			if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
				this.triggered = true;
				try {
					elem[ type ]();
				// prevent IE from throwing an error for some hidden elements
				} catch (e) {}
			}

			this.triggered = false;
		}

		return val;
	},

	handle: function(event) {
		// returned undefined or false
		var val, ret, namespace, all, handlers;

		event = arguments[0] = jQuery.event.fix( event || window.event );

		// Namespaced event handlers
		namespace = event.type.split(".");
		event.type = namespace[0];
		namespace = namespace[1];
		// Cache this now, all = true means, any handler
		all = !namespace && !event.exclusive;

		handlers = ( jQuery.data(this, "events") || {} )[event.type];

		for ( var j in handlers ) {
			var handler = handlers[j];

			// Filter the functions by class
			if ( all || handler.type == namespace ) {
				// Pass in a reference to the handler function itself
				// So that we can later remove it
				event.handler = handler;
				event.data = handler.data;

				ret = handler.apply( this, arguments );

				if ( val !== false )
					val = ret;

				if ( ret === false ) {
					event.preventDefault();
					event.stopPropagation();
				}
			}
		}

		return val;
	},

	fix: function(event) {
		if ( event[expando] == true )
			return event;

		// store a copy of the original event object
		// and "clone" to set read-only properties
		var originalEvent = event;
		event = { originalEvent: originalEvent };
		var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
		for ( var i=props.length; i; i-- )
			event[ props[i] ] = originalEvent[ props[i] ];

		// Mark it as fixed
		event[expando] = true;

		// add preventDefault and stopPropagation since
		// they will not work on the clone
		event.preventDefault = function() {
			// if preventDefault exists run it on the original event
			if (originalEvent.preventDefault)
				originalEvent.preventDefault();
			// otherwise set the returnValue property of the original event to false (IE)
			originalEvent.returnValue = false;
		};
		event.stopPropagation = function() {
			// if stopPropagation exists run it on the original event
			if (originalEvent.stopPropagation)
				originalEvent.stopPropagation();
			// otherwise set the cancelBubble property of the original event to true (IE)
			originalEvent.cancelBubble = true;
		};

		// Fix timeStamp
		event.timeStamp = event.timeStamp || now();

		// Fix target property, if necessary
		if ( !event.target )
			event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either

		// check if target is a textnode (safari)
		if ( event.target.nodeType == 3 )
			event.target = event.target.parentNode;

		// Add relatedTarget, if necessary
		if ( !event.relatedTarget && event.fromElement )
			event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;

		// Calculate pageX/Y if missing and clientX/Y available
		if ( event.pageX == null && event.clientX != null ) {
			var doc = document.documentElement, body = document.body;
			event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
			event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
		}

		// Add which for key events
		if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
			event.which = event.charCode || event.keyCode;

		// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
		if ( !event.metaKey && event.ctrlKey )
			event.metaKey = event.ctrlKey;

		// Add which for click: 1 == left; 2 == middle; 3 == right
		// Note: button is not normalized, so don't use it
		if ( !event.which && event.button )
			event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));

		return event;
	},

	proxy: function( fn, proxy ){
		// Set the guid of unique handler to the same of original handler, so it can be removed
		proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
		// So proxy can be declared as an argument
		return proxy;
	},

	special: {
		ready: {
			setup: function() {
				// Make sure the ready event is setup
				bindReady();
				return;
			},

			teardown: function() { return; }
		},

		mouseenter: {
			setup: function() {
				if ( jQuery.browser.msie ) return false;
				jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
				return true;
			},

			teardown: function() {
				if ( jQuery.browser.msie ) return false;
				jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
				return true;
			},

			handler: function(event) {
				// If we actually just moused on to a sub-element, ignore it
				if ( withinElement(event, this) ) return true;
				// Execute the right handlers by setting the event type to mouseenter
				event.type = "mouseenter";
				return jQuery.event.handle.apply(this, arguments);
			}
		},

		mouseleave: {
			setup: function() {
				if ( jQuery.browser.msie ) return false;
				jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
				return true;
			},

			teardown: function() {
				if ( jQuery.browser.msie ) return false;
				jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
				return true;
			},

			handler: function(event) {
				// If we actually just moused on to a sub-element, ignore it
				if ( withinElement(event, this) ) return true;
				// Execute the right handlers by setting the event type to mouseleave
				event.type = "mouseleave";
				return jQuery.event.handle.apply(this, arguments);
			}
		}
	}
};

jQuery.fn.extend({
	bind: function( type, data, fn ) {
		return type == "unload" ? this.one(type, data, fn) : this.each(function(){
			jQuery.event.add( this, type, fn || data, fn && data );
		});
	},

	one: function( type, data, fn ) {
		var one = jQuery.event.proxy( fn || data, function(event) {
			jQuery(this).unbind(event, one);
			return (fn || data).apply( this, arguments );
		});
		return this.each(function(){
			jQuery.event.add( this, type, one, fn && data);
		});
	},

	unbind: function( type, fn ) {
		return this.each(function(){
			jQuery.event.remove( this, type, fn );
		});
	},

	trigger: function( type, data, fn ) {
		return this.each(function(){
			jQuery.event.trigger( type, data, this, true, fn );
		});
	},

	triggerHandler: function( type, data, fn ) {
		return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
	},

	toggle: function( fn ) {
		// Save reference to arguments for access in closure
		var args = arguments, i = 1;

		// link all the functions, so any of them can unbind this click handler
		while( i < args.length )
			jQuery.event.proxy( fn, args[i++] );

		return this.click( jQuery.event.proxy( fn, function(event) {
			// Figure out which function to execute
			this.lastToggle = ( this.lastToggle || 0 ) % i;

			// Make sure that clicks stop
			event.preventDefault();

			// and execute the function
			return args[ this.lastToggle++ ].apply( this, arguments ) || false;
		}));
	},

	hover: function(fnOver, fnOut) {
		return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
	},

	ready: function(fn) {
		// Attach the listeners
		bindReady();

		// If the DOM is already ready
		if ( jQuery.isReady )
			// Execute the function immediately
			fn.call( document, jQuery );

		// Otherwise, remember the function for later
		else
			// Add the function to the wait list
			jQuery.readyList.push( function() { return fn.call(this, jQuery); } );

		return this;
	}
});

jQuery.extend({
	isReady: false,
	readyList: [],
	// Handle when the DOM is ready
	ready: function() {
		// Make sure that the DOM is not already loaded
		if ( !jQuery.isReady ) {
			// Remember that the DOM is ready
			jQuery.isReady = true;

			// If there are functions bound, to execute
			if ( jQuery.readyList ) {
				// Execute all of them
				jQuery.each( jQuery.readyList, function(){
					this.call( document );
				});

				// Reset the list of functions
				jQuery.readyList = null;
			}

			// Trigger any bound ready events
			jQuery(document).triggerHandler("ready");
		}
	}
});

var readyBound = false;

function bindReady(){
	if ( readyBound ) return;
	readyBound = true;

	// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
	if ( document.addEventListener && !jQuery.browser.opera)
		// Use the handy event callback
		document.addEventListener( "DOMContentLoaded", jQuery.ready, false );

	// If IE is used and is not in a frame
	// Continually check to see if the document is ready
	if ( jQuery.browser.msie && window == top ) (function(){
		if (jQuery.isReady) return;
		try {
			// If IE is used, use the trick by Diego Perini
			// http://javascript.nwbox.com/IEContentLoaded/
			document.documentElement.doScroll("left");
		} catch( error ) {
			setTimeout( arguments.callee, 0 );
			return;
		}
		// and execute any waiting functions
		jQuery.ready();
	})();

	if ( jQuery.browser.opera )
		document.addEventListener( "DOMContentLoaded", function () {
			if (jQuery.isReady) return;
			for (var i = 0; i < document.styleSheets.length; i++)
				if (document.styleSheets[i].disabled) {
					setTimeout( arguments.callee, 0 );
					return;
				}
			// and execute any waiting functions
			jQuery.ready();
		}, false);

	if ( jQuery.browser.safari ) {
		var numStyles;
		(function(){
			if (jQuery.isReady) return;
			if ( document.readyState != "loaded" && document.readyState != "complete" ) {
				setTimeout( arguments.callee, 0 );
				return;
			}
			if ( numStyles === undefined )
				numStyles = jQuery("style, link[rel=stylesheet]").length;
			if ( document.styleSheets.length != numStyles ) {
				setTimeout( arguments.callee, 0 );
				return;
			}
			// and execute any waiting functions
			jQuery.ready();
		})();
	}

	// A fallback to window.onload, that will always work
	jQuery.event.add( window, "load", jQuery.ready );
}

jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
	"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
	"submit,keydown,keypress,keyup,error").split(","), function(i, name){

	// Handle event binding
	jQuery.fn[name] = function(fn){
		return fn ? this.bind(name, fn) : this.trigger(name);
	};
});

// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function(event, elem) {
	// Check if mouse(over|out) are still within the same parent element
	var parent = event.relatedTarget;
	// Traverse up the tree
	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
	// Return true if we actually just moused on to a sub-element
	return parent == elem;
};

// Prevent memory leaks in IE
// And prevent errors on refresh with events like mouseover in other browsers
// Window isn't included so as not to unbind existing unload events
jQuery(window).bind("unload", function() {
	jQuery("*").add(document).unbind();
});
jQuery.fn.extend({
	// Keep a copy of the old load
	_load: jQuery.fn.load,

	load: function( url, params, callback ) {
		if ( typeof url != 'string' )
			return this._load( url );

		var off = url.indexOf(" ");
		if ( off >= 0 ) {
			var selector = url.slice(off, url.length);
			url = url.slice(0, off);
		}

		callback = callback || function(){};

		// Default to a GET request
		var type = "GET";

		// If the second parameter was provided
		if ( params )
			// If it's a function
			if ( jQuery.isFunction( params ) ) {
				// We assume that it's the callback
				callback = params;
				params = null;

			// Otherwise, build a param string
			} else {
				params = jQuery.param( params );
				type = "POST";
			}

		var self = this;

		// Request the remote document
		jQuery.ajax({
			url: url,
			type: type,
			dataType: "html",
			data: params,
			complete: function(res, status){
				// If successful, inject the HTML into all the matched elements
				if ( status == "success" || status == "notmodified" )
					// See if a selector was specified
					self.html( selector ?
						// Create a dummy div to hold the results
						jQuery("<div/>")
							// inject the contents of the document in, removing the scripts
							// to avoid any 'Permission Denied' errors in IE
							.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))

							// Locate the specified elements
							.find(selector) :

						// If not, just inject the full result
						res.responseText );

				self.each( callback, [res.responseText, status, res] );
			}
		});
		return this;
	},

	serialize: function() {
		return jQuery.param(this.serializeArray());
	},
	serializeArray: function() {
		return this.map(function(){
			return jQuery.nodeName(this, "form") ?
				jQuery.makeArray(this.elements) : this;
		})
		.filter(function(){
			return this.name && !this.disabled &&
				(this.checked || /select|textarea/i.test(this.nodeName) ||
					/text|hidden|password/i.test(this.type));
		})
		.map(function(i, elem){
			var val = jQuery(this).val();
			return val == null ? null :
				val.constructor == Array ?
					jQuery.map( val, function(val, i){
						return {name: elem.name, value: val};
					}) :
					{name: elem.name, value: val};
		}).get();
	}
});

// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
	jQuery.fn[o] = function(f){
		return this.bind(o, f);
	};
});

var jsc = now();

jQuery.extend({
	get: function( url, data, callback, type ) {
		// shift arguments if data argument was ommited
		if ( jQuery.isFunction( data ) ) {
			callback = data;
			data = null;
		}

		return jQuery.ajax({
			type: "GET",
			url: url,
			data: data,
			success: callback,
			dataType: type
		});
	},

	getScript: function( url, callback ) {
		return jQuery.get(url, null, callback, "script");
	},

	getJSON: function( url, data, callback ) {
		return jQuery.get(url, data, callback, "json");
	},

	post: function( url, data, callback, type ) {
		if ( jQuery.isFunction( data ) ) {
			callback = data;
			data = {};
		}

		return jQuery.ajax({
			type: "POST",
			url: url,
			data: data,
			success: callback,
			dataType: type
		});
	},

	ajaxSetup: function( settings ) {
		jQuery.extend( jQuery.ajaxSettings, settings );
	},

	ajaxSettings: {
		url: location.href,
		global: true,
		type: "GET",
		timeout: 0,
		contentType: "application/x-www-form-urlencoded",
		processData: true,
		async: true,
		data: null,
		username: null,
		password: null,
		accepts: {
			xml: "application/xml, text/xml",
			html: "text/html",
			script: "text/javascript, application/javascript",
			json: "application/json, text/javascript",
			text: "text/plain",
			_default: "*/*"
		}
	},

	// Last-Modified header cache for next request
	lastModified: {},

	ajax: function( s ) {
		// Extend the settings, but re-extend 's' so that it can be
		// checked again later (in the test suite, specifically)
		s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));

		var jsonp, jsre = /=\?(&|$)/g, status, data,
			type = s.type.toUpperCase();

		// convert data if not already a string
		if ( s.data && s.processData && typeof s.data != "string" )
			s.data = jQuery.param(s.data);

		// Handle JSONP Parameter Callbacks
		if ( s.dataType == "jsonp" ) {
			if ( type == "GET" ) {
				if ( !s.url.match(jsre) )
					s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
			} else if ( !s.data || !s.data.match(jsre) )
				s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
			s.dataType = "json";
		}

		// Build temporary JSONP function
		if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
			jsonp = "jsonp" + jsc++;

			// Replace the =? sequence both in the query string and the data
			if ( s.data )
				s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
			s.url = s.url.replace(jsre, "=" + jsonp + "$1");

			// We need to make sure
			// that a JSONP style response is executed properly
			s.dataType = "script";

			// Handle JSONP-style loading
			window[ jsonp ] = function(tmp){
				data = tmp;
				success();
				complete();
				// Garbage collect
				window[ jsonp ] = undefined;
				try{ delete window[ jsonp ]; } catch(e){}
				if ( head )
					head.removeChild( script );
			};
		}

		if ( s.dataType == "script" && s.cache == null )
			s.cache = false;

		if ( s.cache === false && type == "GET" ) {
			var ts = now();
			// try replacing _= if it is there
			var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
			// if nothing was replaced, add timestamp to the end
			s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
		}

		// If data is available, append data to url for get requests
		if ( s.data && type == "GET" ) {
			s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;

			// IE likes to send both get and post data, prevent this
			s.data = null;
		}

		// Watch for a new set of requests
		if ( s.global && ! jQuery.active++ )
			jQuery.event.trigger( "ajaxStart" );

		// Matches an absolute URL, and saves the domain
		var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;

		// If we're requesting a remote document
		// and trying to load JSON or Script with a GET
		if ( s.dataType == "script" && type == "GET"
				&& remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
			var head = document.getElementsByTagName("head")[0];
			var script = document.createElement("script");
			script.src = s.url;
			if (s.scriptCharset)
				script.charset = s.scriptCharset;

			// Handle Script loading
			if ( !jsonp ) {
				var done = false;

				// Attach handlers for all browsers
				script.onload = script.onreadystatechange = function(){
					if ( !done && (!this.readyState ||
							this.readyState == "loaded" || this.readyState == "complete") ) {
						done = true;
						success();
						complete();
						head.removeChild( script );
					}
				};
			}

			head.appendChild(script);

			// We handle everything using the script element injection
			return undefined;
		}

		var requestDone = false;

		// Create the request object; Microsoft failed to properly
		// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
		var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();

		// Open the socket
		// Passing null username, generates a login popup on Opera (#2865)
		if( s.username )
			xhr.open(type, s.url, s.async, s.username, s.password);
		else
			xhr.open(type, s.url, s.async);

		// Need an extra try/catch for cross domain requests in Firefox 3
		try {
			// Set the correct header, if data is being sent
			if ( s.data )
				xhr.setRequestHeader("Content-Type", s.contentType);

			// Set the If-Modified-Since header, if ifModified mode.
			if ( s.ifModified )
				xhr.setRequestHeader("If-Modified-Since",
					jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );

			// Set header so the called script knows that it's an XMLHttpRequest
			xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");

			// Set the Accepts header for the server, depending on the dataType
			xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
				s.accepts[ s.dataType ] + ", */*" :
				s.accepts._default );
		} catch(e){}

		// Allow custom headers/mimetypes
		if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
			// cleanup active request counter
			s.global && jQuery.active--;
			// close opended socket
			xhr.abort();
			return false;
		}

		if ( s.global )
			jQuery.event.trigger("ajaxSend", [xhr, s]);

		// Wait for a response to come back
		var onreadystatechange = function(isTimeout){
			// The transfer is complete and the data is available, or the request timed out
			if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
				requestDone = true;

				// clear poll interval
				if (ival) {
					clearInterval(ival);
					ival = null;
				}

				status = isTimeout == "timeout" && "timeout" ||
					!jQuery.httpSuccess( xhr ) && "error" ||
					s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
					"success";

				if ( status == "success" ) {
					// Watch for, and catch, XML document parse errors
					try {
						// process the data (runs the xml through httpData regardless of callback)
						data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
					} catch(e) {
						status = "parsererror";
					}
				}

				// Make sure that the request was successful or notmodified
				if ( status == "success" ) {
					// Cache Last-Modified header, if ifModified mode.
					var modRes;
					try {
						modRes = xhr.getResponseHeader("Last-Modified");
					} catch(e) {} // swallow exception thrown by FF if header is not available

					if ( s.ifModified && modRes )
						jQuery.lastModified[s.url] = modRes;

					// JSONP handles its own success callback
					if ( !jsonp )
						success();
				} else
					jQuery.handleError(s, xhr, status);

				// Fire the complete handlers
				complete();

				// Stop memory leaks
				if ( s.async )
					xhr = null;
			}
		};

		if ( s.async ) {
			// don't attach the handler to the request, just poll it instead
			var ival = setInterval(onreadystatechange, 13);

			// Timeout checker
			if ( s.timeout > 0 )
				setTimeout(function(){
					// Check to see if the request is still happening
					if ( xhr ) {
						// Cancel the request
						xhr.abort();

						if( !requestDone )
							onreadystatechange( "timeout" );
					}
				}, s.timeout);
		}

		// Send the data
		try {
			xhr.send(s.data);
		} catch(e) {
			jQuery.handleError(s, xhr, null, e);
		}

		// firefox 1.5 doesn't fire statechange for sync requests
		if ( !s.async )
			onreadystatechange();

		function success(){
			// If a local callback was specified, fire it and pass it the data
			if ( s.success )
				s.success( data, status );

			// Fire the global callback
			if ( s.global )
				jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
		}

		function complete(){
			// Process result
			if ( s.complete )
				s.complete(xhr, status);

			// The request was completed
			if ( s.global )
				jQuery.event.trigger( "ajaxComplete", [xhr, s] );

			// Handle the global AJAX counter
			if ( s.global && ! --jQuery.active )
				jQuery.event.trigger( "ajaxStop" );
		}

		// return XMLHttpRequest to allow aborting the request etc.
		return xhr;
	},

	handleError: function( s, xhr, status, e ) {
		// If a local callback was specified, fire it
		if ( s.error ) s.error( xhr, status, e );

		// Fire the global callback
		if ( s.global )
			jQuery.event.trigger( "ajaxError", [xhr, s, e] );
	},

	// Counter for holding the number of active queries
	active: 0,

	// Determines if an XMLHttpRequest was successful or not
	httpSuccess: function( xhr ) {
		try {
			// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
			return !xhr.status && location.protocol == "file:" ||
				( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
				jQuery.browser.safari && xhr.status == undefined;
		} catch(e){}
		return false;
	},

	// Determines if an XMLHttpRequest returns NotModified
	httpNotModified: function( xhr, url ) {
		try {
			var xhrRes = xhr.getResponseHeader("Last-Modified");

			// Firefox always returns 200. check Last-Modified date
			return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
				jQuery.browser.safari && xhr.status == undefined;
		} catch(e){}
		return false;
	},

	httpData: function( xhr, type, filter ) {
		var ct = xhr.getResponseHeader("content-type"),
			xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
			data = xml ? xhr.responseXML : xhr.responseText;

		if ( xml && data.documentElement.tagName == "parsererror" )
			throw "parsererror";
			
		// Allow a pre-filtering function to sanitize the response
		if( filter )
			data = filter( data, type );

		// If the type is "script", eval it in global context
		if ( type == "script" )
			jQuery.globalEval( data );

		// Get the JavaScript object, if JSON is used.
		if ( type == "json" )
			data = eval("(" + data + ")");

		return data;
	},

	// Serialize an array of form elements or a set of
	// key/values into a query string
	param: function( a ) {
		var s = [];

		// If an array was passed in, assume that it is an array
		// of form elements
		if ( a.constructor == Array || a.jquery )
			// Serialize the form elements
			jQuery.each( a, function(){
				s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
			});

		// Otherwise, assume that it's an object of key/value pairs
		else
			// Serialize the key/values
			for ( var j in a )
				// If the value is an array then the key names need to be repeated
				if ( a[j] && a[j].constructor == Array )
					jQuery.each( a[j], function(){
						s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
					});
				else
					s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );

		// Return the resulting serialization
		return s.join("&").replace(/%20/g, "+");
	}

});
jQuery.fn.extend({
	show: function(speed,callback){
		return speed ?
			this.animate({
				height: "show", width: "show", opacity: "show"
			}, speed, callback) :

			this.filter(":hidden").each(function(){
				this.style.display = this.oldblock || "";
				if ( jQuery.css(this,"display") == "none" ) {
					var elem = jQuery("<" + this.tagName + " />").appendTo("body");
					this.style.display = elem.css("display");
					// handle an edge condition where css is - div { display:none; } or similar
					if (this.style.display == "none")
						this.style.display = "block";
					elem.remove();
				}
			}).end();
	},

	hide: function(speed,callback){
		return speed ?
			this.animate({
				height: "hide", width: "hide", opacity: "hide"
			}, speed, callback) :

			this.filter(":visible").each(function(){
				this.oldblock = this.oldblock || jQuery.css(this,"display");
				this.style.display = "none";
			}).end();
	},

	// Save the old toggle function
	_toggle: jQuery.fn.toggle,

	toggle: function( fn, fn2 ){
		return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
			this._toggle.apply( this, arguments ) :
			fn ?
				this.animate({
					height: "toggle", width: "toggle", opacity: "toggle"
				}, fn, fn2) :
				this.each(function(){
					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
				});
	},

	slideDown: function(speed,callback){
		return this.animate({height: "show"}, speed, callback);
	},

	slideUp: function(speed,callback){
		return this.animate({height: "hide"}, speed, callback);
	},

	slideToggle: function(speed, callback){
		return this.animate({height: "toggle"}, speed, callback);
	},

	fadeIn: function(speed, callback){
		return this.animate({opacity: "show"}, speed, callback);
	},

	fadeOut: function(speed, callback){
		return this.animate({opacity: "hide"}, speed, callback);
	},

	fadeTo: function(speed,to,callback){
		return this.animate({opacity: to}, speed, callback);
	},

	animate: function( prop, speed, easing, callback ) {
		var optall = jQuery.speed(speed, easing, callback);

		return this[ optall.queue === false ? "each" : "queue" ](function(){
			if ( this.nodeType != 1)
				return false;

			var opt = jQuery.extend({}, optall), p,
				hidden = jQuery(this).is(":hidden"), self = this;

			for ( p in prop ) {
				if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
					return opt.complete.call(this);

				if ( p == "height" || p == "width" ) {
					// Store display property
					opt.display = jQuery.css(this, "display");

					// Make sure that nothing sneaks out
					opt.overflow = this.style.overflow;
				}
			}

			if ( opt.overflow != null )
				this.style.overflow = "hidden";

			opt.curAnim = jQuery.extend({}, prop);

			jQuery.each( prop, function(name, val){
				var e = new jQuery.fx( self, opt, name );

				if ( /toggle|show|hide/.test(val) )
					e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
				else {
					var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
						start = e.cur(true) || 0;

					if ( parts ) {
						var end = parseFloat(parts[2]),
							unit = parts[3] || "px";

						// We need to compute starting value
						if ( unit != "px" ) {
							self.style[ name ] = (end || 1) + unit;
							start = ((end || 1) / e.cur(true)) * start;
							self.style[ name ] = start + unit;
						}

						// If a +=/-= token was provided, we're doing a relative animation
						if ( parts[1] )
							end = ((parts[1] == "-=" ? -1 : 1) * end) + start;

						e.custom( start, end, unit );
					} else
						e.custom( start, val, "" );
				}
			});

			// For JS strict compliance
			return true;
		});
	},

	queue: function(type, fn){
		if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
			fn = type;
			type = "fx";
		}

		if ( !type || (typeof type == "string" && !fn) )
			return queue( this[0], type );

		return this.each(function(){
			if ( fn.constructor == Array )
				queue(this, type, fn);
			else {
				queue(this, type).push( fn );

				if ( queue(this, type).length == 1 )
					fn.call(this);
			}
		});
	},

	stop: function(clearQueue, gotoEnd){
		var timers = jQuery.timers;

		if (clearQueue)
			this.queue([]);

		this.each(function(){
			// go in reverse order so anything added to the queue during the loop is ignored
			for ( var i = timers.length - 1; i >= 0; i-- )
				if ( timers[i].elem == this ) {
					if (gotoEnd)
						// force the next step to be the last
						timers[i](true);
					timers.splice(i, 1);
				}
		});

		// start the next in the queue if the last step wasn't forced
		if (!gotoEnd)
			this.dequeue();

		return this;
	}

});

var queue = function( elem, type, array ) {
	if ( elem ){

		type = type || "fx";

		var q = jQuery.data( elem, type + "queue" );

		if ( !q || array )
			q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );

	}
	return q;
};

jQuery.fn.dequeue = function(type){
	type = type || "fx";

	return this.each(function(){
		var q = queue(this, type);

		q.shift();

		if ( q.length )
			q[0].call( this );
	});
};

jQuery.extend({

	speed: function(speed, easing, fn) {
		var opt = speed && speed.constructor == Object ? speed : {
			complete: fn || !fn && easing ||
				jQuery.isFunction( speed ) && speed,
			duration: speed,
			easing: fn && easing || easing && easing.constructor != Function && easing
		};

		opt.duration = (opt.duration && opt.duration.constructor == Number ?
			opt.duration :
			jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;

		// Queueing
		opt.old = opt.complete;
		opt.complete = function(){
			if ( opt.queue !== false )
				jQuery(this).dequeue();
			if ( jQuery.isFunction( opt.old ) )
				opt.old.call( this );
		};

		return opt;
	},

	easing: {
		linear: function( p, n, firstNum, diff ) {
			return firstNum + diff * p;
		},
		swing: function( p, n, firstNum, diff ) {
			return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
		}
	},

	timers: [],
	timerId: null,

	fx: function( elem, options, prop ){
		this.options = options;
		this.elem = elem;
		this.prop = prop;

		if ( !options.orig )
			options.orig = {};
	}

});

jQuery.fx.prototype = {

	// Simple function for setting a style value
	update: function(){
		if ( this.options.step )
			this.options.step.call( this.elem, this.now, this );

		(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );

		// Set display property to block for height/width animations
		if ( this.prop == "height" || this.prop == "width" )
			this.elem.style.display = "block";
	},

	// Get the current size
	cur: function(force){
		if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
			return this.elem[ this.prop ];

		var r = parseFloat(jQuery.css(this.elem, this.prop, force));
		return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
	},

	// Start an animation from one number to another
	custom: function(from, to, unit){
		this.startTime = now();
		this.start = from;
		this.end = to;
		this.unit = unit || this.unit || "px";
		this.now = this.start;
		this.pos = this.state = 0;
		this.update();

		var self = this;
		function t(gotoEnd){
			return self.step(gotoEnd);
		}

		t.elem = this.elem;

		jQuery.timers.push(t);

		if ( jQuery.timerId == null ) {
			jQuery.timerId = setInterval(function(){
				var timers = jQuery.timers;

				for ( var i = 0; i < timers.length; i++ )
					if ( !timers[i]() )
						timers.splice(i--, 1);

				if ( !timers.length ) {
					clearInterval( jQuery.timerId );
					jQuery.timerId = null;
				}
			}, 13);
		}
	},

	// Simple 'show' function
	show: function(){
		// Remember where we started, so that we can go back to it later
		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
		this.options.show = true;

		// Begin the animation
		this.custom(0, this.cur());

		// Make sure that we start at a small width/height to avoid any
		// flash of content
		if ( this.prop == "width" || this.prop == "height" )
			this.elem.style[this.prop] = "1px";

		// Start by showing the element
		jQuery(this.elem).show();
	},

	// Simple 'hide' function
	hide: function(){
		// Remember where we started, so that we can go back to it later
		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
		this.options.hide = true;

		// Begin the animation
		this.custom(this.cur(), 0);
	},

	// Each step of an animation
	step: function(gotoEnd){
		var t = now();

		if ( gotoEnd || t > this.options.duration + this.startTime ) {
			this.now = this.end;
			this.pos = this.state = 1;
			this.update();

			this.options.curAnim[ this.prop ] = true;

			var done = true;
			for ( var i in this.options.curAnim )
				if ( this.options.curAnim[i] !== true )
					done = false;

			if ( done ) {
				if ( this.options.display != null ) {
					// Reset the overflow
					this.elem.style.overflow = this.options.overflow;

					// Reset the display
					this.elem.style.display = this.options.display;
					if ( jQuery.css(this.elem, "display") == "none" )
						this.elem.style.display = "block";
				}

				// Hide the element if the "hide" operation was done
				if ( this.options.hide )
					this.elem.style.display = "none";

				// Reset the properties, if the item has been hidden or shown
				if ( this.options.hide || this.options.show )
					for ( var p in this.options.curAnim )
						jQuery.attr(this.elem.style, p, this.options.orig[p]);
			}

			if ( done )
				// Execute the complete function
				this.options.complete.call( this.elem );

			return false;
		} else {
			var n = t - this.startTime;
			this.state = n / this.options.duration;

			// Perform the easing function, defaults to swing
			this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
			this.now = this.start + ((this.end - this.start) * this.pos);

			// Perform the next step of the animation
			this.update();
		}

		return true;
	}

};

jQuery.extend( jQuery.fx, {
	speeds:{
		slow: 600,
 		fast: 200,
 		// Default speed
 		def: 400
	},
	step: {
		scrollLeft: function(fx){
			fx.elem.scrollLeft = fx.now;
		},

		scrollTop: function(fx){
			fx.elem.scrollTop = fx.now;
		},

		opacity: function(fx){
			jQuery.attr(fx.elem.style, "opacity", fx.now);
		},

		_default: function(fx){
			fx.elem.style[ fx.prop ] = fx.now + fx.unit;
		}
	}
});
// The Offset Method
// Originally By Brandon Aaron, part of the Dimension Plugin
// http://jquery.com/plugins/project/dimensions
jQuery.fn.offset = function() {
	var left = 0, top = 0, elem = this[0], results;

	if ( elem ) with ( jQuery.browser ) {
		var parent       = elem.parentNode,
		    offsetChild  = elem,
		    offsetParent = elem.offsetParent,
		    doc          = elem.ownerDocument,
		    safari2      = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
		    css          = jQuery.curCSS,
		    fixed        = css(elem, "position") == "fixed";

		// Use getBoundingClientRect if available
		if ( elem.getBoundingClientRect ) {
			var box = elem.getBoundingClientRect();

			// Add the document scroll offsets
			add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
				box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));

			// IE adds the HTML element's border, by default it is medium which is 2px
			// IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
			// IE 7 standards mode, the border is always 2px
			// This border/offset is typically represented by the clientLeft and clientTop properties
			// However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
			// Therefore this method will be off by 2px in IE while in quirksmode
			add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );

		// Otherwise loop through the offsetParents and parentNodes
		} else {

			// Initial element offsets
			add( elem.offsetLeft, elem.offsetTop );

			// Get parent offsets
			while ( offsetParent ) {
				// Add offsetParent offsets
				add( offsetParent.offsetLeft, offsetParent.offsetTop );

				// Mozilla and Safari > 2 does not include the border on offset parents
				// However Mozilla adds the border for table or table cells
				if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
					border( offsetParent );

				// Add the document scroll offsets if position is fixed on any offsetParent
				if ( !fixed && css(offsetParent, "position") == "fixed" )
					fixed = true;

				// Set offsetChild to previous offsetParent unless it is the body element
				offsetChild  = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
				// Get next offsetParent
				offsetParent = offsetParent.offsetParent;
			}

			// Get parent scroll offsets
			while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
				// Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
				if ( !/^inline|table.*$/i.test(css(parent, "display")) )
					// Subtract parent scroll offsets
					add( -parent.scrollLeft, -parent.scrollTop );

				// Mozilla does not add the border for a parent that has overflow != visible
				if ( mozilla && css(parent, "overflow") != "visible" )
					border( parent );

				// Get next parent
				parent = parent.parentNode;
			}

			// Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
			// Mozilla doubles body offsets with a non-absolutely positioned offsetChild
			if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
				(mozilla && css(offsetChild, "position") != "absolute") )
					add( -doc.body.offsetLeft, -doc.body.offsetTop );

			// Add the document scroll offsets if position is fixed
			if ( fixed )
				add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
					Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));
		}

		// Return an object with top and left properties
		results = { top: top, left: left };
	}

	function border(elem) {
		add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
	}

	function add(l, t) {
		left += parseInt(l, 10) || 0;
		top += parseInt(t, 10) || 0;
	}

	return results;
};


jQuery.fn.extend({
	position: function() {
		var left = 0, top = 0, results;

		if ( this[0] ) {
			// Get *real* offsetParent
			var offsetParent = this.offsetParent(),

			// Get correct offsets
			offset       = this.offset(),
			parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();

			// Subtract element margins
			// note: when an element has margin: auto the offsetLeft and marginLeft 
			// are the same in Safari causing offset.left to incorrectly be 0
			offset.top  -= num( this, 'marginTop' );
			offset.left -= num( this, 'marginLeft' );

			// Add offsetParent borders
			parentOffset.top  += num( offsetParent, 'borderTopWidth' );
			parentOffset.left += num( offsetParent, 'borderLeftWidth' );

			// Subtract the two offsets
			results = {
				top:  offset.top  - parentOffset.top,
				left: offset.left - parentOffset.left
			};
		}

		return results;
	},

	offsetParent: function() {
		var offsetParent = this[0].offsetParent;
		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
			offsetParent = offsetParent.offsetParent;
		return jQuery(offsetParent);
	}
});


// Create scrollLeft and scrollTop methods
jQuery.each( ['Left', 'Top'], function(i, name) {
	var method = 'scroll' + name;
	
	jQuery.fn[ method ] = function(val) {
		if (!this[0]) return;

		return val != undefined ?

			// Set the scroll offset
			this.each(function() {
				this == window || this == document ?
					window.scrollTo(
						!i ? val : jQuery(window).scrollLeft(),
						 i ? val : jQuery(window).scrollTop()
					) :
					this[ method ] = val;
			}) :

			// Return the scroll offset
			this[0] == window || this[0] == document ?
				self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
					jQuery.boxModel && document.documentElement[ method ] ||
					document.body[ method ] :
				this[0][ method ];
	};
});
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function(i, name){

	var tl = i ? "Left"  : "Top",  // top or left
		br = i ? "Right" : "Bottom"; // bottom or right

	// innerHeight and innerWidth
	jQuery.fn["inner" + name] = function(){
		return this[ name.toLowerCase() ]() +
			num(this, "padding" + tl) +
			num(this, "padding" + br);
	};

	// outerHeight and outerWidth
	jQuery.fn["outer" + name] = function(margin) {
		return this["inner" + name]() +
			num(this, "border" + tl + "Width") +
			num(this, "border" + br + "Width") +
			(margin ?
				num(this, "margin" + tl) + num(this, "margin" + br) : 0);
	};

});})();
/*  */
// 
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(k(D){c A=D.fn.26;D.fn.26=k(){D("*",b).2d(b).3O("26");l A.1G(b,1H)};k C(E){k G(H){c I=H.2v;l(I.56!="4i"&&I.h2!="30")}c F=G(E);(F&&D.1R(D.h1(E,"4e"),k(){l(F=G(b))}));l F}D.1Q(D.h3[":"],{1t:k(F,G,E){l D.1t(F,E[3])},h4:k(F,G,E){c H=F.2q.6Q();l(F.h5>=0&&(("a"==H&&F.di)||(/1k|54|8q|59/.1q(H)&&"30"!=F.6f&&!F.1Y))&&C(F))}});D.8F={h0:8,gZ:20,gV:gU,gW:17,gX:46,gY:40,h6:35,h7:13,hg:27,hf:36,hh:45,hi:37,hj:bn,he:hd,h9:h8,ha:hb,hc:gT,gS:gA,gz:34,gB:33,gC:gD,gy:39,gx:16,gs:32,gr:9,gt:38};k B(I,E,J,H){k G(L){c K=D[I][E][L]||[];l(2n K=="4L"?K.7e(/,?\\s+/):K)}c F=G("de");if(H.1C==1&&2n H[0]=="4L"){F=F.4u(G("cL"))}l(D.gu(J,F)!=-1)}D.4b=k(E,F){c G=E.7e(".")[0];E=E.7e(".")[1];D.fn[E]=k(K){c I=(2n K=="4L"),J=9j.5f.ef.24(1H,1);if(I&&K.gw(0,1)=="aY"){l b}if(I&&B(G,E,K,J)){c H=D.1t(b[0],E);l(H?H[K].1G(H,J):2w)}l b.1R(k(){c L=D.1t(b,E);(!L&&!I&&D.1t(b,E,1w D[G][E](b,K)));(L&&I&&D.7V(L[K])&&L[K].1G(L,J))})};D[G][E]=k(I,J){c H=b;b.69=E;b.aq=D[G][E].gv||E;b.cJ=G+"-"+E;b.q=D.1Q({},D.4b.5v,D[G][E].5v,D.cK&&D.cK.3Q(I)[E],J);b.18=D(I).3c("cd."+E,k(M,K,L){l H.5r(K,L)}).3c("aa."+E,k(L,K){l H.az(K)}).3c("26",k(){l H.6o()});b.6H()};D[G][E].5f=D.1Q({},D.4b.5f,F);D[G][E].cL="7c"};D.4b.5f={6H:k(){},6o:k(){b.18.5I(b.69)},7c:k(G,H){c F=G,E=b;if(2n G=="4L"){if(H===2w){l b.az(G)}F={};F[G]=H}D.1R(F,k(I,J){E.5r(I,J)})},az:k(E){l b.q[E]},5r:k(E,F){b.q[E]=F;if(E=="1Y"){b.18[F?"1I":"2k"](b.cJ+"-1Y")}},et:k(){b.5r("1Y",1g)},eE:k(){b.5r("1Y",1m)},gE:k(F,H,G){c E=(F==b.aq?F:b.aq+F);H=H||D.6K.gF({6f:E,1d:b.18[0]});l b.18.3O(E,[H,G],b.q[F])}};D.4b.5v={1Y:1g};D.p={2u:{2d:k(F,E,I){c H=D.p[F].5f;29(c G in I){H.5q[G]=H.5q[G]||[];H.5q[G].7K([E,I[G]])}},24:k(E,G,F){c I=E.5q[G];if(!I){l}29(c H=0;H<I.1C;H++){if(E.q[I[H][0]]){I[H][1].1G(E.18,F)}}}},8A:{},Z:k(E){if(D.p.8A[E]){l D.p.8A[E]}c F=D(\'<1p 22="p-gO">\').1I(E).Z({1c:"2i",u:"-cI",t:"-cI",56:"8k"}).3T("2g");D.p.8A[E]=!!((!(/3q|4s/).1q(F.Z("2j"))||(/^[1-9]/).1q(F.Z("15"))||(/^[1-9]/).1q(F.Z("v"))||!(/4i/).1q(F.Z("bz"))||!(/5w|eY\\(0, 0, 0, 0\\)/).1q(F.Z("6I"))));9O{D("2g").3Q(0).bh(F.3Q(0))}9U(G){}l D.p.8A[E]},7z:k(E){l D(E).3r("5d","cH").Z("cF","4i").3c("cG.p",k(){l 1g})},gN:k(E){l D(E).3r("5d","gP").Z("cF","").3M("cG.p")},8t:k(H,E){if(D(H).Z("2V")=="30"){l 1g}c G=(E&&E=="t")?"2z":"2A",F=1g;if(H[G]>0){l 1m}H[G]=1;F=(H[G]>0);H[G]=0;l F}};D.p.4r={8Y:k(){c E=b;b.18.3c("9H."+b.69,k(F){l E.ba(F)});if(D.2y.4d){b.cM=b.18.3r("5d");b.18.3r("5d","cH")}b.gQ=1g},8V:k(){b.18.3M("."+b.69);(D.2y.4d&&b.18.3r("5d",b.cM))},ba:k(G){(b.5i&&b.7R(G));b.9x=G;c E=b,H=(G.gR==1),F=(2n b.q.7W=="4L"?D(G.1d).6s().2d(G.1d).e1(b.q.7W).1C:1g);if(!H||F||!b.7G(G)){l 1m}b.99=!b.q.7U;if(!b.99){b.gM=eD(k(){E.99=1m},b.q.7U)}if(b.ak(G)&&b.aA(G)){b.5i=(b.6R(G)!==1g);if(!b.5i){G.9f();l 1m}}b.aH=k(I){l E.cN(I)};b.ax=k(I){l E.7R(I)};D(1n).3c("cT."+b.69,b.aH).3c("cU."+b.69,b.ax);l 1g},cN:k(E){if(D.2y.4d&&!E.59){l b.7R(E)}if(b.5i){b.62(E);l 1g}if(b.ak(E)&&b.aA(E)){b.5i=(b.6R(b.9x,E)!==1g);(b.5i?b.62(E):b.7R(E))}l!b.5i},7R:k(E){D(1n).3M("cT."+b.69,b.aH).3M("cU."+b.69,b.ax);if(b.5i){b.5i=1g;b.6O(E)}l 1g},ak:k(E){l(1i.2c(1i.3A(b.9x.3z-E.3z),1i.3A(b.9x.3u-E.3u))>=b.q.6a)},aA:k(E){l b.99},6R:k(E){},62:k(E){},6O:k(E){},7G:k(E){l 1m}};D.p.4r.5v={7W:1e,6a:1,7U:0}})(1u);(k(A){A.4b("p.1Z",A.1Q({},A.p.4r,{cS:k(C){c B=!b.q.1x||!A(b.q.1x,b.18).1C?1m:1g;A(b.q.1x,b.18).6W("*").cn().1R(k(){if(b==C.1d){B=1m}});l B},cR:k(){c C=b.q;c B=A.7V(C.1j)?A(C.1j.1G(b.18[0],[e])):(C.1j=="89"?b.18.89():b.18);if(!B.6s("2g").1C){B.3T((C.3T=="1J"?b.18[0].4e:C.3T))}if(B[0]!=b.18[0]&&!(/(4I|2i)/).1q(B.Z("1c"))){B.Z("1c","2i")}l B},6H:k(){if(b.q.1j=="cb"&&!(/^(?:r|a|f)/).1q(b.18.Z("1c"))){b.18[0].2v.1c="1O"}(b.q.7o&&b.18.1I(b.q.7o+"-1Z"));(b.q.1Y&&b.18.1I("p-1Z-1Y"));b.8Y()},7G:k(B){c C=b.q;if(b.1j||C.1Y||A(B.1d).is(".p-1l-1x")){l 1g}b.1x=b.cS(B);if(!b.1x){l 1g}l 1m},6R:k(D){c E=b.q;b.1j=b.cR();if(A.p.2F){A.p.2F.4x=b}b.3X={t:(1h(b.18.Z("7Z"),10)||0),u:(1h(b.18.Z("8r"),10)||0)};b.4h=b.1j.Z("1c");b.1b=b.18.1b();b.1b={u:b.1b.u-b.3X.u,t:b.1b.t-b.3X.t};b.1b.2N={t:D.3z-b.1b.t,u:D.3u-b.1b.u};b.cP();b.5b=b.1j.5b();c B=b.5b.1b();if(b.5b[0]==1n.2g&&A.2y.gH){B={u:0,t:0}}b.1b.1J={u:B.u+(1h(b.5b.Z("6Y"),10)||0),t:B.t+(1h(b.5b.Z("6F"),10)||0)};if(b.4h=="1O"){c C=b.18.1c();b.1b.1O={u:C.u-(1h(b.1j.Z("u"),10)||0)+b.6l.2A(),t:C.t-(1h(b.1j.Z("t"),10)||0)+b.6i.2z()}}1o{b.1b.1O={u:0,t:0}}b.2U=b.bE(D);b.bU();if(E.cO){b.cQ(E.cO)}A.1Q(b,{bT:(b.4h=="2i"&&(!b.6l[0].4X||(/(1V|2g)/i).1q(b.6l[0].4X))),bK:(b.4h=="2i"&&(!b.6i[0].4X||(/(1V|2g)/i).1q(b.6i[0].4X))),bR:b.6l[0]!=b.5b[0]&&!(b.6l[0]==1n&&(/(2g|1V)/i).1q(b.5b[0].4X)),bB:b.6i[0]!=b.5b[0]&&!(b.6i[0]==1n&&(/(2g|1V)/i).1q(b.5b[0].4X))});if(E.1U){b.cE()}b.2e("2p",D);b.bU();if(A.p.2F&&!E.cD){A.p.2F.9W(b,D)}b.1j.1I("p-1Z-a4");b.62(D);l 1m},cP:k(){b.6l=k(B){do{if(/3q|5B/.1q(B.Z("2V"))||(/3q|5B/).1q(B.Z("2V-y"))){l B}B=B.1J()}4j(B[0].4e);l A(1n)}(b.1j);b.6i=k(B){do{if(/3q|5B/.1q(B.Z("2V"))||(/3q|5B/).1q(B.Z("2V-x"))){l B}B=B.1J()}4j(B[0].4e);l A(1n)}(b.1j)},cQ:k(B){if(B.t!=2w){b.1b.2N.t=B.t+b.3X.t}if(B.4g!=2w){b.1b.2N.t=b.2T.v-B.4g+b.3X.t}if(B.u!=2w){b.1b.2N.u=B.u+b.3X.u}if(B.4q!=2w){b.1b.2N.u=b.2T.15-B.4q+b.3X.u}},bU:k(){b.2T={v:b.1j.3l(),15:b.1j.3n()}},cE:k(){c E=b.q;if(E.1U=="1J"){E.1U=b.1j[0].4e}if(E.1U=="1n"||E.1U=="4W"){b.1U=[0-b.1b.1O.t-b.1b.1J.t,0-b.1b.1O.u-b.1b.1J.u,A(E.1U=="1n"?1n:4W).v()-b.1b.1O.t-b.1b.1J.t-b.2T.v-b.3X.t-(1h(b.18.Z("7b"),10)||0),(A(E.1U=="1n"?1n:4W).15()||1n.2g.4e.a2)-b.1b.1O.u-b.1b.1J.u-b.2T.15-b.3X.u-(1h(b.18.Z("7i"),10)||0)]}if(!(/^(1n|4W|1J)$/).1q(E.1U)){c C=A(E.1U)[0];c D=A(E.1U).1b();c B=(A(C).Z("2V")!="30");b.1U=[D.t+(1h(A(C).Z("6F"),10)||0)-b.1b.1O.t-b.1b.1J.t,D.u+(1h(A(C).Z("6Y"),10)||0)-b.1b.1O.u-b.1b.1J.u,D.t+(B?1i.2c(C.dh,C.5G):C.5G)-(1h(A(C).Z("6F"),10)||0)-b.1b.1O.t-b.1b.1J.t-b.2T.v-b.3X.t-(1h(b.18.Z("7b"),10)||0),D.u+(B?1i.2c(C.a2,C.5E):C.5E)-(1h(A(C).Z("6Y"),10)||0)-b.1b.1O.u-b.1b.1J.u-b.2T.15-b.3X.u-(1h(b.18.Z("7i"),10)||0)]}},4F:k(C,D){if(!D){D=b.1c}c B=C=="2i"?1:-1;l{u:(D.u+b.1b.1O.u*B+b.1b.1J.u*B-(b.4h=="4I"||b.bT||b.bR?0:b.6l.2A())*B+(b.4h=="4I"?A(1n).2A():0)*B+b.3X.u*B),t:(D.t+b.1b.1O.t*B+b.1b.1J.t*B-(b.4h=="4I"||b.bK||b.bB?0:b.6i.2z())*B+(b.4h=="4I"?A(1n).2z():0)*B+b.3X.t*B)}},bE:k(E){c F=b.q;c B={u:(E.3u-b.1b.2N.u-b.1b.1O.u-b.1b.1J.u+(b.4h=="4I"||b.bT||b.bR?0:b.6l.2A())-(b.4h=="4I"?A(1n).2A():0)),t:(E.3z-b.1b.2N.t-b.1b.1O.t-b.1b.1J.t+(b.4h=="4I"||b.bK||b.bB?0:b.6i.2z())-(b.4h=="4I"?A(1n).2z():0))};if(!b.2U){l B}if(b.1U){if(B.t<b.1U[0]){B.t=b.1U[0]}if(B.u<b.1U[1]){B.u=b.1U[1]}if(B.t>b.1U[2]){B.t=b.1U[2]}if(B.u>b.1U[3]){B.u=b.1U[3]}}if(F.2X){c D=b.2U.u+1i.3f((B.u-b.2U.u)/F.2X[1])*F.2X[1];B.u=b.1U?(!(D<b.1U[1]||D>b.1U[3])?D:(!(D<b.1U[1])?D-F.2X[1]:D+F.2X[1])):D;c C=b.2U.t+1i.3f((B.t-b.2U.t)/F.2X[0])*F.2X[0];B.t=b.1U?(!(C<b.1U[0]||C>b.1U[2])?C:(!(C<b.1U[0])?C-F.2X[0]:C+F.2X[0])):C}l B},62:k(B){b.1c=b.bE(B);b.3I=b.4F("2i");b.1c=b.2e("5x",B)||b.1c;if(!b.q.2f||b.q.2f!="y"){b.1j[0].2v.t=b.1c.t+"2J"}if(!b.q.2f||b.q.2f!="x"){b.1j[0].2v.u=b.1c.u+"2J"}if(A.p.2F){A.p.2F.5x(b,B)}l 1g},6O:k(C){c D=1g;if(A.p.2F&&!b.q.cD){c D=A.p.2F.6q(b,C)}if((b.q.6d=="hk"&&!D)||(b.q.6d=="hl"&&D)||b.q.6d===1m||(A.7V(b.q.6d)&&b.q.6d.24(b.18,D))){c B=b;A(b.1j).2a(b.2U,1h(b.q.hX,10)||hW,k(){B.2e("2M",C);B.bW()})}1o{b.2e("2M",C);b.bW()}l 1g},bW:k(){b.1j.2k("p-1Z-a4");if(b.q.1j!="cb"&&!b.7T){b.1j.26()}b.1j=1e;b.7T=1g},5q:{},83:k(B){l{1j:b.1j,1c:b.1c,a0:b.3I,q:b.q}},2e:k(C,B){A.p.2u.24(b,C,[B,b.83()]);if(C=="5x"){b.3I=b.4F("2i")}l b.18.3O(C=="5x"?C:"5x"+C,[B,b.83()],b.q[C])},6o:k(){if(!b.18.1t("1Z")){l}b.18.5I("1Z").3M(".1Z").2k("p-1Z p-1Z-a4 p-1Z-1Y");b.8V()}}));A.1Q(A.p.1Z,{5v:{3T:"1J",2f:1g,7W:":1k",7U:0,6a:1,1j:"cb",5C:"4s",7o:"p"}});A.p.2u.2d("1Z","2j",{2p:k(D,C){c B=A("2g");if(B.Z("2j")){C.q.c9=B.Z("2j")}B.Z("2j",C.q.2j)},2M:k(C,B){if(B.q.c9){A("2g").Z("2j",B.q.c9)}}});A.p.2u.2d("1Z","2W",{2p:k(D,C){c B=A(C.1j);if(B.Z("2W")){C.q.ce=B.Z("2W")}B.Z("2W",C.q.2W)},2M:k(C,B){if(B.q.ce){A(B.1j).Z("2W",B.q.ce)}}});A.p.2u.2d("1Z","2E",{2p:k(D,C){c B=A(C.1j);if(B.Z("2E")){C.q.c8=B.Z("2E")}B.Z("2E",C.q.2E)},2M:k(C,B){if(B.q.c8){A(B.1j).Z("2E",B.q.c8)}}});A.p.2u.2d("1Z","7J",{2p:k(C,B){A(B.q.7J===1m?"8l":B.q.7J).1R(k(){A(\'<1p 22="p-1Z-7J" 2v="8O: #i0;"></1p>\').Z({v:b.5G+"2J",15:b.5E+"2J",1c:"2i",2E:"0.hV",2W:cy}).Z(A(b).1b()).3T("2g")})},2M:k(C,B){A("1p.p-1Z-7J").1R(k(){b.4e.bh(b)})}});A.p.2u.2d("1Z","5B",{2p:k(D,C){c E=C.q;c B=A(b).1t("1Z");E.4Z=E.4Z||20;E.51=E.51||20;B.4G=k(F){do{if(/3q|5B/.1q(F.Z("2V"))||(/3q|5B/).1q(F.Z("2V-y"))){l F}F=F.1J()}4j(F[0].4e);l A(1n)}(b);B.4S=k(F){do{if(/3q|5B/.1q(F.Z("2V"))||(/3q|5B/).1q(F.Z("2V-x"))){l F}F=F.1J()}4j(F[0].4e);l A(1n)}(b);if(B.4G[0]!=1n&&B.4G[0].4X!="9G"){B.c7=B.4G.1b()}if(B.4S[0]!=1n&&B.4S[0].4X!="9G"){B.c2=B.4S.1b()}},5x:k(E,D){c F=D.q,C=1g;c B=A(b).1t("1Z");if(B.4G[0]!=1n&&B.4G[0].4X!="9G"){if((B.c7.u+B.4G[0].5E)-E.3u<F.4Z){B.4G[0].2A=C=B.4G[0].2A+F.51}if(E.3u-B.c7.u<F.4Z){B.4G[0].2A=C=B.4G[0].2A-F.51}}1o{if(E.3u-A(1n).2A()<F.4Z){C=A(1n).2A(A(1n).2A()-F.51)}if(A(4W).15()-(E.3u-A(1n).2A())<F.4Z){C=A(1n).2A(A(1n).2A()+F.51)}}if(B.4S[0]!=1n&&B.4S[0].4X!="9G"){if((B.c2.t+B.4S[0].5G)-E.3z<F.4Z){B.4S[0].2z=C=B.4S[0].2z+F.51}if(E.3z-B.c2.t<F.4Z){B.4S[0].2z=C=B.4S[0].2z-F.51}}1o{if(E.3z-A(1n).2z()<F.4Z){C=A(1n).2z(A(1n).2z()-F.51)}if(A(4W).v()-(E.3z-A(1n).2z())<F.4Z){C=A(1n).2z(A(1n).2z()+F.51)}}if(C!==1g){A.p.2F.9W(B,E)}}});A.p.2u.2d("1Z","53",{2p:k(D,C){c B=A(b).1t("1Z");B.3V=[];A(C.q.53.4n!=9d?(C.q.53.i1||":1t(1Z)"):C.q.53).1R(k(){c F=A(b);c E=F.1b();if(b!=B.18[0]){B.3V.7K({a1:b,v:F.3l(),15:F.3n(),u:E.u,t:E.t})}})},5x:k(P,K){c E=A(b).1t("1Z");c Q=K.q.i2||20;c O=K.a0.t,N=O+E.2T.v,D=K.a0.u,C=D+E.2T.15;29(c M=E.3V.1C-1;M>=0;M--){c L=E.3V[M].t,J=L+E.3V[M].v,I=E.3V[M].u,R=I+E.3V[M].15;if(!((L-Q<O&&O<J+Q&&I-Q<D&&D<R+Q)||(L-Q<O&&O<J+Q&&I-Q<C&&C<R+Q)||(L-Q<N&&N<J+Q&&I-Q<D&&D<R+Q)||(L-Q<N&&N<J+Q&&I-Q<C&&C<R+Q))){if(E.3V[M].9I){(E.q.53.cr&&E.q.53.cr.24(E.18,1e,A.1Q(E.83(),{ct:E.3V[M].a1})))}E.3V[M].9I=1g;8P}if(K.q.cs!="ib"){c B=1i.3A(I-C)<=Q;c S=1i.3A(R-D)<=Q;c G=1i.3A(L-N)<=Q;c H=1i.3A(J-O)<=Q;if(B){K.1c.u=E.4F("1O",{u:I-E.2T.15,t:0}).u}if(S){K.1c.u=E.4F("1O",{u:R,t:0}).u}if(G){K.1c.t=E.4F("1O",{u:0,t:L-E.2T.v}).t}if(H){K.1c.t=E.4F("1O",{u:0,t:J}).t}}c F=(B||S||G||H);if(K.q.cs!="ic"){c B=1i.3A(I-D)<=Q;c S=1i.3A(R-C)<=Q;c G=1i.3A(L-O)<=Q;c H=1i.3A(J-N)<=Q;if(B){K.1c.u=E.4F("1O",{u:I,t:0}).u}if(S){K.1c.u=E.4F("1O",{u:R-E.2T.15,t:0}).u}if(G){K.1c.t=E.4F("1O",{u:0,t:L}).t}if(H){K.1c.t=E.4F("1O",{u:0,t:J-E.2T.v}).t}}if(!E.3V[M].9I&&(B||S||G||H||F)){(E.q.53.53&&E.q.53.53.24(E.18,1e,A.1Q(E.83(),{ct:E.3V[M].a1})))}E.3V[M].9I=(B||S||G||H||F)}}});A.p.2u.2d("1Z","cq",{2p:k(D,C){c B=A(b).1t("1Z");B.9F=[];A(C.q.cq).1R(k(){if(A.1t(b,"c3")){c E=A.1t(b,"c3");B.9F.7K({1F:E,cp:E.q.6d});E.i8();E.2e("9r",D,B)}})},2M:k(D,C){c B=A(b).1t("1Z");A.1R(B.9F,k(){if(b.1F.7m){b.1F.7m=0;B.7T=1m;b.1F.7T=1g;if(b.cp){b.1F.q.6d=1m}b.1F.6O(D);b.1F.18.3O("i3",[D,A.1Q(b.1F.p(),{i5:B.18})],b.1F.q.i6);b.1F.q.1j=b.1F.q.by}1o{b.1F.2e("8Z",D,B)}})},5x:k(F,E){c D=A(b).1t("1Z"),B=b;c C=k(K){c H=K.t,J=H+K.v,I=K.u,G=I+K.15;l(H<(b.3I.t+b.1b.2N.t)&&(b.3I.t+b.1b.2N.t)<J&&I<(b.3I.u+b.1b.2N.u)&&(b.3I.u+b.1b.2N.u)<G)};A.1R(D.9F,k(G){if(C.24(D,b.1F.hO)){if(!b.1F.7m){b.1F.7m=1;b.1F.3G=A(B).89().3T(b.1F.18).1t("c3-a1",1m);b.1F.q.by=b.1F.q.1j;b.1F.q.1j=k(){l E.1j[0]};F.1d=b.1F.3G[0];b.1F.7G(F,1m);b.1F.6R(F,1m,1m);b.1F.1b.2N.u=D.1b.2N.u;b.1F.1b.2N.t=D.1b.2N.t;b.1F.1b.1J.t-=D.1b.1J.t-b.1F.1b.1J.t;b.1F.1b.1J.u-=D.1b.1J.u-b.1F.1b.1J.u;D.2e("hu",F)}if(b.1F.3G){b.1F.62(F)}}1o{if(b.1F.7m){b.1F.7m=0;b.1F.7T=1m;b.1F.q.6d=1g;b.1F.6O(F,1m);b.1F.q.1j=b.1F.q.by;b.1F.3G.26();if(b.1F.cm){b.1F.cm.26()}D.2e("hn",F)}}})}});A.p.2u.2d("1Z","7n",{2p:k(D,B){c C=A.hm(A(B.q.7n.ho)).hp(k(F,E){l(1h(A(F).Z("2W"),10)||B.q.7n.1W)-(1h(A(E).Z("2W"),10)||B.q.7n.1W)});A(C).1R(k(E){b.2v.2W=B.q.7n.1W+E});b[0].2v.2W=B.q.7n.1W+C.1C}})})(1u);(k(A){A.4b("p.3L",{5r:k(B,C){if(B=="3J"){b.q.3J=C&&A.7V(C)?C:k(D){l D.is(3J)}}1o{A.4b.5f.5r.1G(b,1H)}},6H:k(){c C=b.q,B=C.3J;b.4M=0;b.6g=1;b.q.3J=b.q.3J&&A.7V(b.q.3J)?b.q.3J:k(D){l D.is(B)};b.8n={v:b.18[0].5G,15:b.18[0].5E};A.p.2F.6h[b.q.5C]=A.p.2F.6h[b.q.5C]||[];A.p.2F.6h[b.q.5C].7K(b);(b.q.7o&&b.18.1I(b.q.7o+"-3L"))},5q:{},p:k(B){l{1Z:(B.3G||B.18),1j:B.1j,1c:B.1c,a0:B.3I,q:b.q,18:b.18}},6o:k(){c B=A.p.2F.6h[b.q.5C];29(c C=0;C<B.1C;C++){if(B[C]==b){B.hz(C,1)}}b.18.2k("p-3L-1Y").5I("3L").3M(".3L")},b3:k(C){c B=A.p.2F.4x;if(!B||(B.3G||B.18)[0]==b.18[0]){l}if(b.q.3J.24(b.18,(B.3G||B.18))){A.p.2u.24(b,"4P",[C,b.p(B)]);b.18.3O("hA",[C,b.p(B)],b.q.4P)}},aZ:k(C){c B=A.p.2F.4x;if(!B||(B.3G||B.18)[0]==b.18[0]){l}if(b.q.3J.24(b.18,(B.3G||B.18))){A.p.2u.24(b,"b5",[C,b.p(B)]);b.18.3O("hJ",[C,b.p(B)],b.q.b5)}},cv:k(E,B){c C=B||A.p.2F.4x;if(!C||(C.3G||C.18)[0]==b.18[0]){l 1g}c D=1g;b.18.6W(":1t(3L)").hI(".p-1Z-a4").1R(k(){c F=A.1t(b,"3L");if(F.q.cC&&A.p.73(C,A.1Q(F,{1b:F.18.1b()}),F.q.9T)){D=1m;l 1g}});if(D){l 1g}if(b.q.3J.24(b.18,(C.3G||C.18))){A.p.2u.24(b,"6q",[E,b.p(C)]);b.18.3O("6q",[E,b.p(C)],b.q.6q);l b.18}l 1g},cu:k(C){c B=A.p.2F.4x;A.p.2u.24(b,"9r",[C,b.p(B)]);if(B){b.18.3O("hL",[C,b.p(B)],b.q.9r)}},cB:k(C){c B=A.p.2F.4x;A.p.2u.24(b,"8Z",[C,b.p(B)]);if(B){b.18.3O("hM",[C,b.p(B)],b.q.8Z)}}});A.1Q(A.p.3L,{5v:{1Y:1g,9T:"73",5C:"4s",7o:"p"}});A.p.73=k(I,E,J){if(!E.1b){l 1g}c D=(I.3I||I.1c.2i).t,C=D+I.2T.v,K=(I.3I||I.1c.2i).u,H=K+I.2T.15;c F=E.1b.t,B=F+E.8n.v,L=E.1b.u,G=L+E.8n.15;63(J){1s"hG":l(F<D&&C<B&&L<K&&H<G);1z;1s"73":l(F<D+(I.2T.v/2)&&C-(I.2T.v/2)<B&&L<K+(I.2T.15/2)&&H-(I.2T.15/2)<G);1z;1s"hB":l(F<((I.3I||I.1c.2i).t+(I.6U||I.1b.2N).t)&&((I.3I||I.1c.2i).t+(I.6U||I.1b.2N).t)<B&&L<((I.3I||I.1c.2i).u+(I.6U||I.1b.2N).u)&&((I.3I||I.1c.2i).u+(I.6U||I.1b.2N).u)<G);1z;1s"hE":l((K>=L&&K<=G)||(H>=L&&H<=G)||(K<L&&H>G))&&((D>=F&&D<=B)||(C>=F&&C<=B)||(D<F&&C>B));1z;4s:l 1g;1z}};A.p.2F={4x:1e,6h:{"4s":[]},9W:k(E,H){c B=A.p.2F.6h[E.q.5C];c F=H?H.6f:1e;c G=(E.3G||E.18).6W(":1t(3L)").cn();co:29(c D=0;D<B.1C;D++){if(B[D].q.1Y||(E&&!B[D].q.3J.24(B[D].18,(E.3G||E.18)))){8P}29(c C=0;C<G.1C;C++){if(G[C]==B[D].18[0]){B[D].8n.15=0;8P co}}B[D].8J=B[D].18.Z("56")!="4i";if(!B[D].8J){8P}B[D].1b=B[D].18.1b();B[D].8n={v:B[D].18[0].5G,15:B[D].18[0].5E};if(F=="fk"||F=="fw"){B[D].cu.24(B[D],H)}}},6q:k(B,C){c D=1g;A.1R(A.p.2F.6h[B.q.5C],k(){if(!b.q){l}if(!b.q.1Y&&b.8J&&A.p.73(B,b,b.q.9T)){D=b.cv.24(b,C)}if(!b.q.1Y&&b.8J&&b.q.3J.24(b.18,(B.3G||B.18))){b.6g=1;b.4M=0;b.cB.24(b,C)}});l D},5x:k(B,C){if(B.q.fL){A.p.2F.9W(B,C)}A.1R(A.p.2F.6h[B.q.5C],k(){if(b.q.1Y||b.cA||!b.8J){l}c D=A.p.73(B,b,b.q.9T);c G=!D&&b.4M==1?"6g":(D&&b.4M==0?"4M":1e);if(!G){l}c F;if(b.q.cC){c E=b.18.6s(":1t(3L):eq(0)");if(E.1C){F=A.1t(E[0],"3L");F.cA=(G=="4M"?1:0)}}if(F&&G=="4M"){F.4M=0;F.6g=1;F.aZ.24(F,C)}b[G]=1;b[G=="6g"?"4M":"6g"]=0;b[G=="4M"?"b3":"aZ"].24(b,C);if(F&&G=="6g"){F.6g=0;F.4M=1;F.b3.24(F,C)}})}};A.p.2u.2d("3L","92",{9r:k(C,B){A(b).1I(B.q.92)},8Z:k(C,B){A(b).2k(B.q.92)},6q:k(C,B){A(b).2k(B.q.92)}});A.p.2u.2d("3L","8X",{4P:k(C,B){A(b).1I(B.q.8X)},b5:k(C,B){A(b).2k(B.q.8X)},6q:k(C,B){A(b).2k(B.q.8X)}})})(1u);(k(A){A.4b("p.1l",A.1Q({},A.p.4r,{6H:k(){c L=b,M=b.q;c P=b.18.Z("1c");b.aT=b.18;b.18.1I("p-1l").Z({1c:/66/.1q(P)?"1O":P});A.1Q(M,{8x:!!(M.4Q),1j:M.1j||M.3S||M.2a?M.1j||"fT":1e,5D:M.5D===1m?"p-1l-8z-1x":M.5D});c H="aO cw #g0";M.cV={"p-1l":{56:"8k"},"p-1l-1x":{1c:"2i",8O:"#cz",dV:"0.aO"},"p-1l-n":{2j:"n-2h",15:"4a",t:"2m",4g:"2m",aP:H},"p-1l-s":{2j:"s-2h",15:"4a",t:"2m",4g:"2m",b4:H},"p-1l-e":{2j:"e-2h",v:"4a",u:"2m",4q:"2m",aX:H},"p-1l-w":{2j:"w-2h",v:"4a",u:"2m",4q:"2m",aW:H},"p-1l-3g":{2j:"3g-2h",v:"4a",15:"4a",aX:H,b4:H},"p-1l-3h":{2j:"3h-2h",v:"4a",15:"4a",b4:H,aW:H},"p-1l-3x":{2j:"3x-2h",v:"4a",15:"4a",aX:H,aP:H},"p-1l-3k":{2j:"3k-2h",v:"4a",15:"4a",aW:H,aP:H}};M.aL={"p-1l-1x":{8O:"#cz",br:"aO cw #fZ",15:"cx",v:"cx"},"p-1l-n":{2j:"n-2h",u:"2m",t:"45%"},"p-1l-s":{2j:"s-2h",4q:"2m",t:"45%"},"p-1l-e":{2j:"e-2h",4g:"2m",u:"45%"},"p-1l-w":{2j:"w-2h",t:"2m",u:"45%"},"p-1l-3g":{2j:"3g-2h",4g:"2m",4q:"2m"},"p-1l-3h":{2j:"3h-2h",t:"2m",4q:"2m"},"p-1l-3k":{2j:"3k-2h",t:"2m",u:"2m"},"p-1l-3x":{2j:"3x-2h",4g:"2m",u:"2m"}};M.aQ=b.18[0].2q;if(M.aQ.2I(/fS|8q|1k|54|59|8y/i)){c C=b.18;if(/1O/.1q(C.Z("1c"))&&A.2y.8B){C.Z({1c:"1O",u:"3q",t:"3q"})}C.8L(A(\'<1p 22="p-8G"	2v="2V: 30;"></1p>\').Z({1c:C.Z("1c"),v:C.3l(),15:C.3n(),u:C.Z("u"),t:C.Z("t")}));c J=b.18;b.18=b.18.1J();b.18.1t("1l",b);b.18.Z({7Z:J.Z("7Z"),8r:J.Z("8r"),7b:J.Z("7b"),7i:J.Z("7i")});J.Z({7Z:0,8r:0,7b:0,7i:0});if(A.2y.ee&&M.9f){J.Z("2h","4i")}M.5y=J.Z({1c:"66",fW:1,56:"8k"});b.18.Z({6b:J.Z("6b")});b.8M()}if(!M.2K){M.2K=!A(".p-1l-1x",b.18).1C?"e,s,3g":{n:".p-1l-n",e:".p-1l-e",s:".p-1l-s",w:".p-1l-w",3g:".p-1l-3g",3h:".p-1l-3h",3x:".p-1l-3x",3k:".p-1l-3k"}}if(M.2K.4n==9d){M.2W=M.2W||cy;if(M.2K=="g8"){M.2K="n,e,s,w,3g,3h,3x,3k"}c O=M.2K.7e(",");M.2K={};c I={1x:"1c: 2i; 56: 4i; 2V:30;",n:"u: 6e; v:2x%;",e:"4g: 6e; 15:2x%;",s:"4q: 6e; v:2x%;",w:"t: 6e; 15:2x%;",3g:"4q: 6e; 4g: 2m;",3h:"4q: 6e; t: 2m;",3x:"u: 6e; 4g: 2m;",3k:"u: 6e; t: 2m;"};29(c Q=0;Q<O.1C;Q++){c N=A.eV(O[Q]),K=M.cV,G="p-1l-"+N,E=!A.p.Z(G)&&!M.5D,R=A.p.Z("p-1l-8z-1x"),S=A.1Q(K[G],K["p-1l-1x"]),D=A.1Q(M.aL[G],!R?M.aL["p-1l-1x"]:{});c T=/3h|3g|3x|3k/.1q(N)?{2W:++M.2W}:{};c B=(E?I[N]:""),F=A([\'<1p 22="p-1l-1x \',G,\'" 2v="\',B,I.1x,\'"></1p>\'].8e("")).Z(T);M.2K[N]=".p-1l-"+N;b.18.5e(F.Z(E?S:{}).Z(M.5D?D:{}).1I(M.5D?"p-1l-8z-1x":"").1I(M.5D))}if(M.5D){b.18.1I("p-1l-8z").Z(!A.p.Z("p-1l-8z")?{}:{})}}b.cW=k(Y){Y=Y||b.18;29(c U in M.2K){if(M.2K[U].4n==9d){M.2K[U]=A(M.2K[U],b.18).2R()}if(M.5w){M.2K[U].Z({2E:0})}if(b.18.is(".p-8G")&&M.aQ.2I(/8q|1k|54|59/i)){c W=A(M.2K[U],b.18),X=0;X=/3h|3x|3k|3g|n|s/.1q(U)?W.3n():W.3l();c V=["dP",/3x|3k|n/.1q(U)?"gl":/3g|3h|s/.1q(U)?"fR":/^e$/.1q(U)?"gi":"gh"].8e("");if(!M.5w){Y.Z(V,X)}b.8M()}if(!A(M.2K[U]).1C){8P}}};b.cW(b.18);M.7k=A(".p-1l-1x",L.18);if(M.7z){M.7k.1R(k(U,V){A.p.7z(V)})}M.7k.ge(k(){if(!M.9l){if(b.8E){c U=b.8E.2I(/p-1l-(3g|3h|3x|3k|n|e|s|w)/i)}L.2f=M.2f=U&&U[1]?U[1]:"3g"}});if(M.dg){M.7k.2s();A(L.18).1I("p-1l-aU").gf(k(){A(b).2k("p-1l-aU");M.7k.2R()},k(){if(!M.9l){A(b).1I("p-1l-aU");M.7k.2s()}})}b.8Y()},5q:{},p:k(){l{aT:b.aT,18:b.18,1j:b.1j,1c:b.1c,1r:b.1r,q:b.q,4o:b.4o,2U:b.2U}},2e:k(C,B){A.p.2u.24(b,C,[B,b.p()]);if(C!="2h"){b.18.3O(["2h",C].8e(""),[B,b.p()],b.q[C])}},6o:k(){c C=b.18,B=C.ac(".p-1l").3Q(0);b.8V();c D=k(E){A(E).2k("p-1l p-1l-1Y").5I("1l").3M(".1l").6W(".p-1l-1x").26()};D(C);if(C.is(".p-8G")&&B){C.1J().5e(A(B).Z({1c:C.Z("1c"),v:C.3l(),15:C.3n(),u:C.Z("u"),t:C.Z("t")})).4m().26();D(B)}},7G:k(D){if(b.q.1Y){l 1g}c B=1g;29(c C in b.q.2K){if(A(b.q.2K[C])[0]==D.1d){B=1m}}if(!B){l 1g}l 1m},6R:k(H){c C=b.q,I=b.18.1c(),B=b.18,F=k(M){l 1h(M,10)||0},E=A.2y.4d&&A.2y.8m<7;C.9l=1m;C.aS={u:A(1n).2A(),t:A(1n).2z()};if(B.is(".p-1Z")||(/2i/).1q(B.Z("1c"))){c K=A.2y.4d&&!C.1U&&(/2i/).1q(B.Z("1c"))&&!(/1O/).1q(B.1J().Z("1c"));c J=K?C.aS.u:0,D=K?C.aS.t:0;B.Z({1c:"2i",u:(I.u+J),t:(I.t+D)})}if(A.2y.8B&&/1O/.1q(B.Z("1c"))){B.Z({1c:"1O",u:"3q",t:"3q"})}b.dj();c L=F(b.1j.Z("t")),G=F(b.1j.Z("u"));if(C.1U){L+=A(C.1U).2z()||0;G+=A(C.1U).2A()||0}b.1b=b.1j.1b();b.1c={t:L,u:G};b.1r=C.1j||E?{v:B.3l(),15:B.3n()}:{v:B.v(),15:B.15()};b.4o=C.1j||E?{v:B.3l(),15:B.3n()}:{v:B.v(),15:B.15()};b.2U={t:L,u:G};b.6m={v:B.3l()-B.v(),15:B.3n()-B.15()};b.dl={t:H.3z,u:H.3u};C.4Q=(2n C.4Q=="7Q")?C.4Q:((b.4o.v/b.4o.15)||1);if(C.be){A("2g").Z("2j",b.2f+"-2h")}b.2e("2p",H);l 1m},62:k(I){c C=b.1j,D=b.q,J={},M=b,E=b.dl,K=b.2f;c N=(I.3z-E.t)||0,L=(I.3u-E.u)||0;c H=b.4V[K];if(!H){l 1g}c G=H.1G(b,[I,N,L]),F=A.2y.4d&&A.2y.8m<7,B=b.6m;if(D.8x||I.97){G=b.dm(G,I)}G=b.dk(G,I);b.2e("2h",I);C.Z({u:b.1c.u+"2J",t:b.1c.t+"2J",v:b.1r.v+"2J",15:b.1r.15+"2J"});if(!D.1j&&D.5y){b.8M()}b.bj(G);b.18.3O("2h",[I,b.p()],b.q.2h);l 1g},6O:k(I){b.q.9l=1g;c E=b.q,H=k(M){l 1h(M,10)||0},K=b;if(E.1j){c D=E.5y,C=D&&(/8q/i).1q(D.3Q(0).2q),B=C&&A.p.8t(D.3Q(0),"t")?0:K.6m.15,G=C?0:K.6m.v;c L={v:(K.1r.v-G),15:(K.1r.15-B)},F=(1h(K.18.Z("t"),10)+(K.1c.t-K.2U.t))||1e,J=(1h(K.18.Z("u"),10)+(K.1c.u-K.2U.u))||1e;if(!E.2a){b.18.Z(A.1Q(L,{u:J,t:F}))}if(E.1j&&!E.2a){b.8M()}}if(E.be){A("2g").Z("2j","3q")}b.2e("2M",I);if(E.1j){b.1j.26()}l 1g},bj:k(B){c C=b.q;b.1b=b.1j.1b();if(B.t){b.1c.t=B.t}if(B.u){b.1c.u=B.u}if(B.15){b.1r.15=B.15}if(B.v){b.1r.v=B.v}},dm:k(D,E){c F=b.q,G=b.1c,C=b.1r,B=b.2f;if(D.15){D.v=(C.15*F.4Q)}1o{if(D.v){D.15=(C.v/F.4Q)}}if(B=="3h"){D.t=G.t+(C.v-D.v);D.u=1e}if(B=="3k"){D.u=G.u+(C.15-D.15);D.t=G.t+(C.v-D.v)}l D},dk:k(H,J){c E=b.1j,F=b.q,P=F.8x||J.97,M=b.2f,N=H.v&&F.9p&&F.9p<H.v,D=H.15&&F.96&&F.96<H.15,I=H.v&&F.7S&&F.7S>H.v,O=H.15&&F.7X&&F.7X>H.15;if(I){H.v=F.7S}if(O){H.15=F.7X}if(N){H.v=F.9p}if(D){H.15=F.96}c C=b.2U.t+b.4o.v,L=b.1c.u+b.1r.15;c G=/3h|3k|w/.1q(M),B=/3k|3x|n/.1q(M);if(I&&G){H.t=C-F.7S}if(N&&G){H.t=C-F.9p}if(O&&B){H.u=L-F.7X}if(D&&B){H.u=L-F.96}c K=!H.v&&!H.15;if(K&&!H.t&&H.u){H.u=1e}1o{if(K&&!H.u&&H.t){H.t=1e}}l H},8M:k(){c F=b.q;if(!F.5y){l}c D=F.5y,C=b.1j||b.18;if(!F.7x){c B=[D.Z("6Y"),D.Z("9A"),D.Z("93"),D.Z("6F")],E=[D.Z("eJ"),D.Z("fc"),D.Z("f2"),D.Z("fb")];F.7x=A.9V(B,k(G,I){c H=1h(G,10)||0,J=1h(E[I],10)||0;l H+J})}D.Z({15:(C.15()-F.7x[0]-F.7x[2])+"2J",v:(C.v()-F.7x[1]-F.7x[3])+"2J"})},dj:k(){c C=b.18,E=b.q;b.bo=C.1b();if(E.1j){b.1j=b.1j||A(\'<1p 2v="2V:30;"></1p>\');c B=A.2y.4d&&A.2y.8m<7,F=(B?1:0),D=(B?2:-1);b.1j.1I(E.1j).Z({v:C.3l()+D,15:C.3n()+D,1c:"2i",t:b.bo.t-F+"2J",u:b.bo.u-F+"2J",2W:++E.2W});b.1j.3T("2g");if(E.7z){A.p.7z(b.1j.3Q(0))}}1o{b.1j=C}},4V:{e:k(D,C,B){l{v:b.4o.v+C}},w:k(F,C,B){c G=b.q,D=b.4o,E=b.2U;l{t:E.t+C,v:D.v-C}},n:k(F,C,B){c G=b.q,D=b.4o,E=b.2U;l{u:E.u+B,15:D.15-B}},s:k(D,C,B){l{15:b.4o.15+B}},3g:k(D,C,B){l A.1Q(b.4V.s.1G(b,1H),b.4V.e.1G(b,[D,C,B]))},3h:k(D,C,B){l A.1Q(b.4V.s.1G(b,1H),b.4V.w.1G(b,[D,C,B]))},3x:k(D,C,B){l A.1Q(b.4V.n.1G(b,1H),b.4V.e.1G(b,[D,C,B]))},3k:k(D,C,B){l A.1Q(b.4V.n.1G(b,1H),b.4V.w.1G(b,[D,C,B]))}}}));A.1Q(A.p.1l,{5v:{7W:":1k",6a:1,7U:0,9f:1m,5w:1g,7S:10,7X:10,4Q:1g,7z:1m,be:1m,dg:1g,5D:1g}});A.p.2u.2d("1l","1U",{2p:k(I,J){c G=J.q,M=A(b).1t("1l"),E=M.18;c C=G.1U,F=(C jS A)?C.3Q(0):(/1J/.1q(C))?E.1J().3Q(0):C;if(!F){l}M.bc=A(F);if(/1n/.1q(C)||C==1n){M.7M={t:0,u:0};M.9Z={t:0,u:0};M.7F={18:A(1n),t:0,u:0,v:A(1n).v(),15:A(1n).15()||1n.2g.4e.a2}}1o{M.7M=A(F).1b();M.9Z=A(F).1c();M.a6={15:A(F).9u(),v:A(F).9z()};c K=M.7M,B=M.a6.15,H=M.a6.v,D=(A.p.8t(F,"t")?F.dh:H),L=(A.p.8t(F)?F.a2:B);M.7F={18:F,t:K.t,u:K.u,v:D,15:L}}},2h:k(H,J){c E=J.q,N=A(b).1t("1l"),C=N.a6,K=N.7M,G=N.1r,I=N.1c,M=E.8x||H.97,B={u:0,t:0},D=N.bc;if(D[0]!=1n&&/66/.1q(D.Z("1c"))){B=N.9Z}if(I.t<(E.1j?K.t:B.t)){N.1r.v=N.1r.v+(E.1j?(N.1c.t-K.t):(N.1c.t-B.t));if(M){N.1r.15=N.1r.v/E.4Q}N.1c.t=E.1j?K.t:B.t}if(I.u<(E.1j?K.u:0)){N.1r.15=N.1r.15+(E.1j?(N.1c.u-K.u):N.1c.u);if(M){N.1r.v=N.1r.15*E.4Q}N.1c.u=E.1j?K.u:0}c F=(E.1j?N.1b.t-K.t:(N.1c.t-B.t))+N.6m.v,L=(E.1j?N.1b.u-K.u:N.1c.u)+N.6m.15;if(F+N.1r.v>=N.7F.v){N.1r.v=N.7F.v-F;if(M){N.1r.15=N.1r.v/E.4Q}}if(L+N.1r.15>=N.7F.15){N.1r.15=N.7F.15-L;if(M){N.1r.v=N.1r.15*E.4Q}}},2M:k(G,I){c D=I.q,L=A(b).1t("1l"),H=L.1c,J=L.7M,B=L.9Z,C=L.bc;c F=A(L.1j),M=F.1b(),K=F.9z(),E=F.9u();if(D.1j&&!D.2a&&/1O/.1q(C.Z("1c"))){A(b).Z({t:(M.t-J.t),u:(M.u-J.u),v:K,15:E})}if(D.1j&&!D.2a&&/66/.1q(C.Z("1c"))){A(b).Z({t:B.t+(M.t-J.t),u:B.u+(M.u-J.u),v:K,15:E})}}});A.p.2u.2d("1l","2X",{2h:k(H,J){c D=J.q,L=A(b).1t("1l"),G=L.1r,E=L.4o,F=L.2U,K=L.2f,I=D.8x||H.97;D.2X=2n D.2X=="7Q"?[D.2X,D.2X]:D.2X;c C=1i.3f((G.v-E.v)/(D.2X[0]||1))*(D.2X[0]||1),B=1i.3f((G.15-E.15)/(D.2X[1]||1))*(D.2X[1]||1);if(/^(3g|s|e)$/.1q(K)){L.1r.v=E.v+C;L.1r.15=E.15+B}1o{if(/^(3x)$/.1q(K)){L.1r.v=E.v+C;L.1r.15=E.15+B;L.1c.u=F.u-B}1o{if(/^(3h)$/.1q(K)){L.1r.v=E.v+C;L.1r.15=E.15+B;L.1c.t=F.t-C}1o{L.1r.v=E.v+C;L.1r.15=E.15+B;L.1c.u=F.u-B;L.1c.t=F.t-C}}}}});A.p.2u.2d("1l","2a",{2M:k(I,K){c F=K.q,L=A(b).1t("1l");c E=F.5y,C=E&&(/8q/i).1q(E.3Q(0).2q),B=C&&A.p.8t(E.3Q(0),"t")?0:L.6m.15,H=C?0:L.6m.v;c D={v:(L.1r.v-H),15:(L.1r.15-B)},G=(1h(L.18.Z("t"),10)+(L.1c.t-L.2U.t))||1e,J=(1h(L.18.Z("u"),10)+(L.1c.u-L.2U.u))||1e;L.18.2a(A.1Q(D,J&&G?{u:J,t:G}:{}),{1S:F.kc||"98",2t:F.ke||"b1",bY:k(){c M={v:1h(L.18.Z("v"),10),15:1h(L.18.Z("15"),10),u:1h(L.18.Z("u"),10),t:1h(L.18.Z("t"),10)};if(E){E.Z({v:M.v,15:M.15})}L.bj(M);L.2e("2a",I)}})}});A.p.2u.2d("1l","3S",{2p:k(E,D){c F=D.q,B=A(b).1t("1l"),G=F.5y,C=B.1r;if(!G){B.3S=B.18.89()}1o{B.3S=G.89()}B.3S.Z({2E:0.25,56:"8k",1c:"1O",15:C.15,v:C.v,6b:0,t:0,u:0}).1I("p-1l-3S").1I(2n F.3S=="4L"?F.3S:"");B.3S.3T(B.1j)},2h:k(D,C){c E=C.q,B=A(b).1t("1l"),F=E.5y;if(B.3S){B.3S.Z({1c:"1O",15:B.1r.15,v:B.1r.v})}},2M:k(D,C){c E=C.q,B=A(b).1t("1l"),F=E.5y;if(B.3S&&B.1j){B.1j.3Q(0).bh(B.3S.3Q(0))}}});A.p.2u.2d("1l","4w",{2p:k(D,C){c E=C.q,B=A(b).1t("1l"),F=k(G){A(G).1R(k(){A(b).1t("1l-bk",{v:1h(A(b).v(),10),15:1h(A(b).15(),10),t:1h(A(b).Z("t"),10),u:1h(A(b).Z("u"),10)})})};if(2n(E.4w)=="5j"){if(E.4w.1C){E.4w=E.4w[0];F(E.4w)}1o{A.1R(E.4w,k(G,H){F(G)})}}1o{F(E.4w)}},2h:k(F,E){c G=E.q,B=A(b).1t("1l"),D=B.4o,I=B.2U;c H={15:(B.1r.15-D.15)||0,v:(B.1r.v-D.v)||0,u:(B.1c.u-I.u)||0,t:(B.1c.t-I.t)||0},C=k(J,K){A(J).1R(k(){c N=A(b).1t("1l-bk"),M={},L=K&&K.1C?K:["v","15","u","t"];A.1R(L||["v","15","u","t"],k(O,Q){c P=(N[Q]||0)+(H[Q]||0);if(P&&P>=0){M[Q]=P||1e}});A(b).Z(M)})};if(2n(G.4w)=="5j"){A.1R(G.4w,k(J,K){C(J,K)})}1o{C(G.4w)}},2M:k(C,B){A(b).5I("1l-bk-2p")}})})(1u);(k(A){A.fn.bg=A.fn.bg||k(B){l b.1R(k(){A(b).6s(B).eq(0).bJ(b).26()})};A.4b("p.3E",{5q:{},p:k(B){l{q:b.q,1x:b.1P,1y:b.q.2f!="5a"||!b.q.2f?1i.3f(b.1y(1e,b.q.2f=="4N"?"y":"x")):{x:1i.3f(b.1y(1e,"x")),y:1i.3f(b.1y(1e,"y"))},7B:b.dr()}},2e:k(C,B){A.p.2u.24(b,C,[B,b.p()]);b.18.3O(C=="9Q"?C:"9Q"+C,[B,b.p()],b.q[C])},6o:k(){b.18.2k("p-3E p-3E-1Y").5I("3E").3M(".3E");if(b.1x&&b.1x.1C){b.1x.bg("a");b.1x.1R(k(){A(b).1t("4r").8V()})}b.bf&&b.bf.26()},5r:k(B,C){A.4b.5f.5r.1G(b,1H);if(/1W|2c|6n/.1q(B)){b.bm()}if(B=="7B"){C?b.1x.1C==2&&b.bs():b.du()}},6H:k(){c B=b;b.18.1I("p-3E");b.bm();b.1x=A(b.q.1x,b.18);if(!b.1x.1C){B.1x=B.bf=A(B.q.2K||[0]).9V(k(){c D=A("<1p/>").1I("p-3E-1x").3T(B.18);if(b.id){D.3r("id",b.id)}l D[0]})}c C=k(D){b.18=A(D);b.18.1t("4r",b);b.q=B.q;b.18.3c("9H",k(){if(B.1P){b.dn(B.1P)}B.6X(b,1m)});b.8Y()};A.1Q(C.5f,A.p.4r,{6R:k(D){l B.cl.24(B,D,b.18[0])},6O:k(D){l B.df.24(B,D,b.18[0])},62:k(D){l B.aM.24(B,D,b.18[0])},7G:k(){l 1m},6x:k(D){b.ba(D)}});A(b.1x).1R(k(){1w C(b)}).8L(\'<a di="#" 2v="jW:4i;br:4i;"></a>\').1J().3c("2N",k(){l 1g}).3c("5g",k(D){B.6X(b.bl)}).3c("dn",k(D){B.dx(b.bl)}).3c("8R",k(D){if(!B.q.jR){l B.dw(D.8F,b.bl)}});b.18.3c("9H.3E",k(D){B.dv.1G(B,[D]);B.1P.1t("4r").6x(D);B.9k=B.9k+1});A.1R(b.q.2K||[],k(E,D){B.8H(D.2p,E,1m)});if(!4K(b.q.dq)){b.8H(b.q.dq,0,1m)}b.5K=A(b.1x[0]);if(b.1x.1C==2&&b.q.7B){b.bs()}},bm:k(){c B=b.18[0],C=b.q;b.5P={v:b.18.3l(),15:b.18.3n()};A.1Q(C,{2f:C.2f||(B.5G<B.5E?"4N":"9w"),2c:!4K(1h(C.2c,10))?{x:1h(C.2c,10),y:1h(C.2c,10)}:({x:C.2c&&C.2c.x||2x,y:C.2c&&C.2c.y||2x}),1W:!4K(1h(C.1W,10))?{x:1h(C.1W,10),y:1h(C.1W,10)}:({x:C.1W&&C.1W.x||0,y:C.1W&&C.1W.y||0})});C.5U={x:C.2c.x-C.1W.x,y:C.2c.y-C.1W.y};C.2Q={x:C.2Q&&C.2Q.x||1h(C.2Q,10)||(C.6n?C.5U.x/(C.6n.x||1h(C.6n,10)||C.5U.x):0),y:C.2Q&&C.2Q.y||1h(C.2Q,10)||(C.6n?C.5U.y/(C.6n.y||1h(C.6n,10)||C.5U.y):0)}},dw:k(I,B){c D=I;if(/(33|34|35|36|37|38|39|40)/.1q(D)){c F=b.q,C,H;if(/(35|36)/.1q(D)){C=(D==35)?F.2c.x:F.1W.x;H=(D==35)?F.2c.y:F.1W.y}1o{c G=/(34|37|40)/.1q(D)?"-=":"+=";c E=/(37|38|39|40)/.1q(D)?"8W":"dt";C=G+b[E]("x");H=G+b[E]("y")}b.8H({x:C,y:H},B);l 1g}l 1m},6X:k(B,C){b.1P=A(B).1I("p-3E-1x-77");if(C){b.1P.1J()[0].5g()}},dx:k(B){A(B).2k("p-3E-1x-77");if(b.1P&&b.1P[0]==B){b.5K=b.1P;b.1P=1e}},dv:k(C){c D=[C.3z,C.3u];c B=1g;b.1x.1R(k(){if(b==C.1d){B=1m}});if(B||b.q.1Y||!(b.1P||b.5K)){l}if(!b.1P&&b.5K){b.6X(b.5K,1m)}b.1b=b.18.1b();b.8H({y:b.52(C.3u-b.1b.u-b.1P[0].5E/2,"y"),x:b.52(C.3z-b.1b.t-b.1P[0].5G/2,"x")},1e,!b.q.6a)},bs:k(){if(b.4J){l}b.4J=A("<1p></1p>").1I("p-3E-7B").Z({1c:"2i"}).3T(b.18);b.9K()},du:k(){b.4J.26();b.4J=1e},9K:k(){c C=b.q.2f=="4N"?"u":"t";c B=b.q.2f=="4N"?"15":"v";b.4J.Z(C,(1h(A(b.1x[0]).Z(C),10)||0)+b.6G(0,b.q.2f=="4N"?"y":"x")/2);b.4J.Z(B,(1h(A(b.1x[1]).Z(C),10)||0)-(1h(A(b.1x[0]).Z(C),10)||0))},dr:k(){l b.4J?b.52(1h(b.4J.Z(b.q.2f=="4N"?"15":"v"),10),b.q.2f=="4N"?"y":"x"):1e},ds:k(){l b.1x.dH(b.1P[0])},1y:k(B,D){if(b.1x.1C==1){b.1P=b.1x}if(!D){D=b.q.2f=="4N"?"y":"x"}c C=A(B!=2w&&B!==1e?b.1x[B]||B:b.1P);if(C.1t("4r").9M){l 1h(C.1t("4r").9M[D],10)}1o{l 1h(((1h(C.Z(D=="x"?"t":"u"),10)/(b.5P[D=="x"?"v":"15"]-b.6G(B,D)))*b.q.5U[D])+b.q.1W[D],10)}},52:k(C,B){l b.q.1W[B]+(C/(b.5P[B=="x"?"v":"15"]-b.6G(1e,B)))*b.q.5U[B]},3Y:k(C,B){l((C-b.q.1W[B])/b.q.5U[B])*(b.5P[B=="x"?"v":"15"]-b.6G(1e,B))},8D:k(D,C){if(b.4J){if(b.1P[0]==b.1x[0]&&D>=b.3Y(b.1y(1),C)){D=b.3Y(b.1y(1,C)-b.8W(C),C)}if(b.1P[0]==b.1x[1]&&D<=b.3Y(b.1y(0),C)){D=b.3Y(b.1y(0,C)+b.8W(C),C)}}if(b.q.2K){c B=b.q.2K[b.ds()];if(D<b.3Y(B.1W,C)){D=b.3Y(B.1W,C)}1o{if(D>b.3Y(B.2c,C)){D=b.3Y(B.2c,C)}}}l D},8K:k(C,B){if(C>=b.5P[B=="x"?"v":"15"]-b.6G(1e,B)){C=b.5P[B=="x"?"v":"15"]-b.6G(1e,B)}if(C<=0){C=0}l C},6G:k(B,C){l A(B!=2w&&B!==1e?b.1x[B]:b.1P)[0]["1b"+(C=="x"?"k2":"k0")]},8W:k(B){l b.q.2Q[B]||1},dt:k(B){l 10},cl:k(C,B){c D=b.q;if(D.1Y){l 1g}b.5P={v:b.18.3l(),15:b.18.3n()};if(!b.1P){b.6X(b.5K,1m)}b.1b=b.18.1b();b.b9=b.1P.1b();b.6U={u:C.3u-b.b9.u,t:C.3z-b.b9.t};b.9k=b.1y();b.2e("2p",C);b.aM(C,B);l 1m},df:k(B){b.2e("2M",B);if(b.9k!=b.1y()){b.2e("9E",B)}b.6X(b.1P,1m);l 1g},aM:k(E,C){c F=b.q;c B={u:E.3u-b.1b.u-b.6U.u,t:E.3z-b.1b.t-b.6U.t};if(!b.1P){b.6X(b.5K,1m)}B.t=b.8K(B.t,"x");B.u=b.8K(B.u,"y");if(F.2Q.x){c D=b.52(B.t,"x");D=1i.3f(D/F.2Q.x)*F.2Q.x;B.t=b.3Y(D,"x")}if(F.2Q.y){c D=b.52(B.u,"y");D=1i.3f(D/F.2Q.y)*F.2Q.y;B.u=b.3Y(D,"y")}B.t=b.8D(B.t,"x");B.u=b.8D(B.u,"y");if(F.2f!="4N"){b.1P.Z({t:B.t})}if(F.2f!="9w"){b.1P.Z({u:B.u})}b.1P.1t("4r").9M={x:1i.3f(b.52(B.t,"x"))||0,y:1i.3f(b.52(B.u,"y"))||0};if(b.4J){b.9K()}b.2e("9Q",E);l 1g},8H:k(F,C,I){c G=b.q;b.5P={v:b.18.3l(),15:b.18.3n()};if(C==2w&&!b.1P&&b.1x.1C!=1){l 1g}if(C==2w&&!b.1P){C=0}if(C!=2w){b.1P=b.5K=A(b.1x[C]||C)}if(F.x!==2w&&F.y!==2w){c B=F.x,H=F.y}1o{c B=F,H=F}if(B!==2w&&B.4n!=8p){c E=/^\\-\\=/.1q(B),D=/^\\+\\=/.1q(B);if(E||D){B=b.1y(1e,"x")+1h(B.8c(E?"=":"+=",""),10)}1o{B=4K(1h(B,10))?2w:1h(B,10)}}if(H!==2w&&H.4n!=8p){c E=/^\\-\\=/.1q(H),D=/^\\+\\=/.1q(H);if(E||D){H=b.1y(1e,"y")+1h(H.8c(E?"=":"+=",""),10)}1o{H=4K(1h(H,10))?2w:1h(H,10)}}if(G.2f!="4N"&&B!==2w){if(G.2Q.x){B=1i.3f(B/G.2Q.x)*G.2Q.x}B=b.3Y(B,"x");B=b.8K(B,"x");B=b.8D(B,"x");G.2a?b.1P.2M().2a({t:B},(1i.3A(1h(b.1P.Z("t"))-B))*(!4K(1h(G.2a))?G.2a:5)):b.1P.Z({t:B})}if(G.2f!="9w"&&H!==2w){if(G.2Q.y){H=1i.3f(H/G.2Q.y)*G.2Q.y}H=b.3Y(H,"y");H=b.8K(H,"y");H=b.8D(H,"y");G.2a?b.1P.2M().2a({u:H},(1i.3A(1h(b.1P.Z("u"))-H))*(!4K(1h(G.2a))?G.2a:5)):b.1P.Z({u:H})}if(b.4J){b.9K()}b.1P.1t("4r").9M={x:1i.3f(b.52(B,"x"))||0,y:1i.3f(b.52(H,"y"))||0};if(!I){b.2e("2p",1e);b.2e("2M",1e);b.2e("9E",1e);b.2e("9Q",1e)}}});A.p.3E.de="1y";A.p.3E.5v={1x:".p-3E-1x",6a:1,2a:1g}})(1u);(k($){c 6k="19";k 8Q(){b.cY=1g;b.7C=1e;b.5k=[];b.6w=1g;b.67=1g;b.ay="p-19-1p";b.ai="p-19-2S";b.an="p-19-5e";b.5l="p-19-6x";b.au="p-19-kS";b.av="p-19-7a";b.ae="p-19-1Y";b.bQ="p-19-5d";b.9m="p-19-4x-1N";b.bF=[];b.bF[""]={dW:"kR",dY:"kI 6S 4x 1a",dZ:"d2",dU:"d2 kw 9E",5N:"&#bX;kx",e6:"6u 6S d3 1K",5M:"&#bX;&#bX;",e5:"6u 6S d3 1E",65:"kt&#aK;",e4:"6u 6S 7h 1K",5Z:"&#aK;&#aK;",eK:"6u 6S 7h 1E",6L:"kp",e2:"6u 6S 4x 1K",3e:["kq","kr","ks","kJ","d1","kF","kG","kH","kE","kD","kA","kB"],4A:["kC","kb","jP","iP","d1","iQ","iR","iS","iO","iN","iJ","iK"],e7:"6u a d0 1K",ep:"6u a d0 1E",dF:"iL",8h:"iM iT 6S 1E",3y:["iU","j1","j2","j3","j0","iZ","iV"],3F:["iW","iX","iY","iI","iH","iq","ir"],9b:["it","iu","ip","jQ","ij","ik","il"],9a:"im 8j as iv 5W 1N",6z:"cX 8j, M d",6C:"9c/dd/6B",3H:0,2C:"cX a 1a",3P:1g};b.3C={6N:"5g",4f:"2R",bP:{},57:1e,86:"",5S:"...",7g:"",d4:1g,8w:1m,ap:1g,7L:1g,61:1g,6J:1g,ar:1g,dL:1m,eu:1m,7O:1g,ev:"-10:+10",8f:1m,7d:1g,5Q:1g,8g:1g,9g:b.8T,3K:"+10",2D:1g,dQ:b.6z,2b:1e,2l:1e,1S:"94",8i:1e,8b:1e,68:1e,en:1e,8s:1e,el:1,9J:0,5p:1,5o:12,3U:1g,8C:" - ",8N:"",7v:""};$.1Q(b.3C,b.bF[""]);b.1X=$(\'<1p id="\'+b.ay+\'" 2v="56: 4i;"></1p>\')}$.1Q(8Q.5f,{4D:"iw",ah:k(){if(b.cY){iD.ah.1G("",1H)}},iE:k(1B){72(b.3C,1B||{});l b},es:k(1d,1B){c 7f=1e;29(95 in b.3C){c 91=1d.iF("1a:"+95);if(91){7f=7f||{};9O{7f[95]=iG(91)}9U(d7){7f[95]=91}}}c 2q=1d.2q.6Q();c 2S=(2q=="1p"||2q=="5O");if(!1d.id){1d.id="dp"+(++b.b6)}c h=b.aJ($(1d),2S);h.1B=$.1Q({},1B||{},7f||{});if(2q=="1k"){b.cZ(1d,h)}1o{if(2S){b.dc(1d,h)}}},aJ:k(1d,2S){c id=1d[0].id.8c(/([:\\[\\]\\.])/g,"\\\\\\\\$1");l{id:id,1k:1d,3t:0,3d:0,3p:0,1M:0,1T:0,2S:2S,1X:(!2S?b.1X:$(\'<1p 22="\'+b.ai+\'"></1p>\'))}},cZ:k(1d,h){c 1k=$(1d);if(1k.5F(b.4D)){l}c 86=b.1f(h,"86");c 3P=b.1f(h,"3P");if(86){1k[3P?"db":"bJ"](\'<5O 22="\'+b.an+\'">\'+86+"</5O>")}c 6N=b.1f(h,"6N");if(6N=="5g"||6N=="5a"){1k.5g(b.7D)}if(6N=="59"||6N=="5a"){c 5S=b.1f(h,"5S");c 7g=b.1f(h,"7g");c 6x=$(b.1f(h,"d4")?$("<8y/>").1I(b.5l).3r({bD:7g,d5:5S,88:5S}):$(\'<59 6f="59"></59>\').1I(b.5l).1V(7g==""?5S:$("<8y/>").3r({bD:7g,d5:5S,88:5S})));1k[3P?"db":"bJ"](6x);6x.2N(k(){if($.19.6w&&$.19.7p==1d){$.19.5s()}1o{$.19.7D(1d)}l 1g})}1k.1I(b.4D).8R(b.9o).d6(b.a9).3c("cd.19",k(6K,64,1y){h.1B[64]=1y}).3c("aa.19",k(6K,64){l b.1f(h,64)});$.1t(1d,6k,h)},dc:k(1d,h){c bN=$(1d);if(bN.5F(b.4D)){l}bN.1I(b.4D).5e(h.1X).3c("cd.19",k(6K,64,1y){h.1B[64]=1y}).3c("aa.19",k(6K,64){l b.1f(h,64)});$.1t(1d,6k,h);b.aB(h,b.aI(h));b.4y(h)},iz:k(h){c 2Z=b.79(h);h.1X.v(2Z[1]*$(".p-19",h.1X[0]).v())},iA:k(1k,d9,68,1B,2P){c h=b.da;if(!h){c id="dp"+(++b.b6);b.4U=$(\'<1k 6f="4T" id="\'+id+\'" 1r="1" 2v="1c: 2i; u: -eO;"/>\');b.4U.8R(b.9o);$("2g").5e(b.4U);h=b.da=b.aJ(b.4U,1g);h.1B={};$.1t(b.4U[0],6k,h)}72(h.1B,1B||{});b.4U.6p(d9);b.3W=(2P?(2P.1C?2P:[2P.3z,2P.3u]):1e);if(!b.3W){c 9B=4W.9z||1n.44.c1||1n.2g.c1;c 9S=4W.9u||1n.44.bu||1n.2g.bu;c 71=1n.44.2z||1n.2g.2z;c 6M=1n.44.2A||1n.2g.2A;b.3W=[(9B/2)-2x+71,(9S/2)-bC+6M]}b.4U.Z("t",b.3W[0]+"2J").Z("u",b.3W[1]+"2J");h.1B.68=68;b.67=1m;b.1X.1I(b.au);b.7D(b.4U[0]);if($.8d){$.8d(b.1X)}$.1t(b.4U[0],6k,h);l b},jB:k(1d){c $1d=$(1d);if(!$1d.5F(b.4D)){l}c 2q=1d.2q.6Q();$.5I(1d,6k);if(2q=="1k"){$1d.7l("."+b.an).26().4m().7l("."+b.5l).26().4m().2k(b.4D).3M("5g",b.7D).3M("8R",b.9o).3M("d6",b.a9)}1o{if(2q=="1p"||2q=="5O"){$1d.2k(b.4D).ck()}}},jD:k(1d){c $1d=$(1d);if(!$1d.5F(b.4D)){l}c 2q=1d.2q.6Q();if(2q=="1k"){1d.1Y=1g;$1d.7l("59."+b.5l).1R(k(){b.1Y=1g}).4m().7l("8y."+b.5l).Z({2E:"1.0",2j:""})}1o{if(2q=="1p"||2q=="5O"){$1d.ac("."+b.ae).26()}}b.5k=$.9V(b.5k,k(1y){l(1y==1d?1e:1y)})},jz:k(1d){c $1d=$(1d);if(!$1d.5F(b.4D)){l}c 2q=1d.2q.6Q();if(2q=="1k"){1d.1Y=1m;$1d.7l("59."+b.5l).1R(k(){b.1Y=1m}).4m().7l("8y."+b.5l).Z({2E:"0.5",2j:"4s"})}1o{if(2q=="1p"||2q=="5O"){c 2S=$1d.ac("."+b.ai);c 1b=2S.1b();c 9D={t:0,u:0};2S.6s().1R(k(){if($(b).Z("1c")=="1O"){9D=$(b).1b();l 1g}});$1d.ju(\'<1p 22="\'+b.ae+\'" 2v="\'+($.2y.4d?"8O-8o: 5w; ":"")+"v: "+2S.v()+"2J; 15: "+2S.15()+"2J; t: "+(1b.t-9D.t)+"2J; u: "+(1b.u-9D.u)+\'2J;"></1p>\')}}b.5k=$.9V(b.5k,k(1y){l(1y==1d?1e:1y)});b.5k[b.5k.1C]=1d},dy:k(1d){if(!1d){l 1g}29(c i=0;i<b.5k.1C;i++){if(b.5k[i]==1d){l 1m}}l 1g},3i:k(1d){9O{l $.1t(1d,6k)}9U(d7){7y"eX 1F 1t 29 b 19"}},jx:k(1d,3b,1y){c 1B=3b||{};if(2n 3b=="4L"){1B={};1B[3b]=1y}c h=b.3i(1d);if(h){if(b.7C==h){b.5s(1e)}72(h.1B,1B);c 1a=1w 1A();72(h,{2Y:1e,4k:1e,4v:1e,2L:1e,3t:1a.2o(),3d:1a.2B(),3p:1a.23(),31:1a.2o(),3v:1a.2B(),3j:1a.23(),1M:1a.2B(),1T:1a.23()});b.4y(h)}},jE:k(1d){c h=b.3i(1d);if(h){b.4y(h)}},jF:k(1d,1a,4O){c h=b.3i(1d);if(h){b.aB(h,1a,4O);b.4y(h);b.bx(h)}},jM:k(1d){c h=b.3i(1d);if(h&&!h.2S){b.aj(h)}l(h?b.aE(h):1e)},9o:k(e){c h=$.19.3i(e.1d);c 58=1m;if($.19.6w){63(e.8F){1s 9:$.19.5s(1e,"");1z;1s 13:$.19.bS(e.1d,h.3d,h.3p,$("3D.p-19-7q-6r-4P",h.1X)[0]);l 1g;1z;1s 27:$.19.5s(1e,$.19.1f(h,"1S"));1z;1s 33:$.19.3N(e.1d,(e.3m?-$.19.1f(h,"5o"):-$.19.1f(h,"5p")),"M");1z;1s 34:$.19.3N(e.1d,(e.3m?+$.19.1f(h,"5o"):+$.19.1f(h,"5p")),"M");1z;1s 35:if(e.3m){$.19.ao(e.1d)}58=e.3m;1z;1s 36:if(e.3m){$.19.am(e.1d)}58=e.3m;1z;1s 37:if(e.3m){$.19.3N(e.1d,-1,"D")}58=e.3m;1z;1s 38:if(e.3m){$.19.3N(e.1d,-7,"D")}58=e.3m;1z;1s 39:if(e.3m){$.19.3N(e.1d,+1,"D")}58=e.3m;1z;1s 40:if(e.3m){$.19.3N(e.1d,+7,"D")}58=e.3m;1z;4s:58=1g}}1o{if(e.8F==36&&e.3m){$.19.7D(b)}1o{58=1g}}if(58){e.9f();e.jN()}},a9:k(e){c h=$.19.3i(e.1d);c 5u=$.19.eL($.19.1f(h,"6C"));c aw=9d.jO(e.d8==2w?e.8F:e.d8);l e.3m||(aw<" "||!5u||5u.8a(aw)>-1)},7D:k(1k){1k=1k.1d||1k;if(1k.2q.6Q()!="1k"){1k=$("1k",1k.4e)[0]}if($.19.dy(1k)||$.19.7p==1k){l}c h=$.19.3i(1k);c 8b=$.19.1f(h,"8b");72(h.1B,(8b?8b.1G(1k,[1k,h]):{}));$.19.5s(1e,"");$.19.7p=1k;$.19.aj(h);if($.19.67){1k.1y=""}if(!$.19.3W){$.19.3W=$.19.aN(1k);$.19.3W[1]+=1k.5E}c 3w=1g;$(1k).6s().1R(k(){3w|=$(b).Z("1c")=="4I";l!3w});if(3w&&$.2y.8B){$.19.3W[0]-=1n.44.2z;$.19.3W[1]-=1n.44.2A}c 1b={t:$.19.3W[0],u:$.19.3W[1]};$.19.3W=1e;h.2Y=1e;h.1X.Z({1c:"2i",56:"8k",u:"-jK"});$.19.4y(h);h.1X.v($.19.79(h)[1]*$(".p-19",h.1X[0])[0].5G);1b=$.19.cj(h,1b,3w);h.1X.Z({1c:($.19.67&&$.8d?"66":(3w?"4I":"2i")),56:"4i",t:1b.t+"2J",u:1b.u+"2J"});if(!h.2S){c 4f=$.19.1f(h,"4f")||"2R";c 1S=$.19.1f(h,"1S");c 6Z=k(){$.19.6w=1m;if($.2y.4d&&1h($.2y.8m,10)<7){$("8l.p-19-bI").Z({v:h.1X.v()+4,15:h.1X.15()+4})}};if($.1v&&$.1v[4f]){h.1X.2R(4f,$.19.1f(h,"bP"),1S,6Z)}1o{h.1X[4f](1S,6Z)}if(1S==""){6Z()}if(h.1k[0].6f!="30"){h.1k[0].5g()}$.19.7C=h}},4y:k(h){c bV={v:h.1X.v()+4,15:h.1X.15()+4};h.1X.ck().5e(b.dX(h)).6W("8l.p-19-bI").Z({v:bV.v,15:bV.15});c 2Z=b.79(h);h.1X[(2Z[0]!=1||2Z[1]!=1?"2d":"26")+"ci"]("p-19-js");h.1X[(b.1f(h,"3P")?"2d":"26")+"ci"]("p-19-jd");if(h.1k&&h.1k[0].6f!="30"){$(h.1k[0]).5g()}},cj:k(h,1b,3w){c 2P=h.1k?b.aN(h.1k[0]):1e;c 9B=4W.9z||1n.44.c1;c 9S=4W.9u||1n.44.bu;c 71=1n.44.2z||1n.2g.2z;c 6M=1n.44.2A||1n.2g.2A;if(b.1f(h,"3P")||(1b.t+h.1X.v()-71)>9B){1b.t=1i.2c((3w?0:71),2P[0]+(h.1k?h.1k.v():0)-(3w?71:0)-h.1X.v()-(3w&&$.2y.8B?1n.44.2z:0))}1o{1b.t-=(3w?71:0)}if((1b.u+h.1X.15()-6M)>9S){1b.u=1i.2c((3w?0:6M),2P[1]-(3w?6M:0)-(b.67?0:h.1X.15())-(3w&&$.2y.8B?1n.44.2A:0))}1o{1b.u-=(3w?6M:0)}l 1b},aN:k(6A){4j(6A&&(6A.6f=="30"||6A.jo!=1)){6A=6A.jp}c 1c=$(6A).1b();l[1c.t,1c.u]},5s:k(1k,1S){c h=b.7C;if(!h||(1k&&h!=$.1t(1k,6k))){l}c 3U=b.1f(h,"3U");if(3U&&h.5A){b.90("#"+h.id,b.6D(h,h.31,h.3v,h.3j))}h.5A=1g;if(b.6w){1S=(1S!=1e?1S:b.1f(h,"1S"));c 4f=b.1f(h,"4f");c 6Z=k(){$.19.aF(h)};if(1S!=""&&$.1v&&$.1v[4f]){h.1X.2s(4f,$.19.1f(h,"bP"),1S,6Z)}1o{h.1X[(1S==""?"2s":(4f=="jn"?"jm":(4f=="ji"?"jj":"2s")))](1S,6Z)}if(1S==""){b.aF(h)}c 8s=b.1f(h,"8s");if(8s){8s.1G((h.1k?h.1k[0]:1e),[(h.1k?h.1k.6p():""),h])}b.6w=1g;b.7p=1e;h.1B.7a=1e;if(b.67){b.4U.Z({1c:"2i",t:"0",u:"-eO"});if($.8d){$.jl();$("2g").5e(b.1X)}}b.67=1g}b.7C=1e},aF:k(h){h.1X.2k(b.au).3M(".p-19");$("."+b.av,h.1X).26()},eg:k(6K){if(!$.19.7C){l}c $1d=$(6K.1d);if(($1d.6s("#"+$.19.ay).1C==0)&&!$1d.5F($.19.4D)&&!$1d.5F($.19.5l)&&$.19.6w&&!($.19.67&&$.8d)){$.19.5s(1e,"")}},3N:k(id,1b,4H){c 1d=$(id);c h=b.3i(1d[0]);b.a7(h,1b,4H);b.4y(h)},am:k(id){c 1d=$(id);c h=b.3i(1d[0]);if(b.1f(h,"ar")&&h.31){h.3t=h.31;h.1M=h.3d=h.3v;h.1T=h.3p=h.3j}1o{c 1a=1w 1A();h.3t=1a.2o();h.1M=h.3d=1a.2B();h.1T=h.3p=1a.23()}b.80(h);b.3N(1d)},cc:k(id,54,4H){c 1d=$(id);c h=b.3i(1d[0]);h.9t=1g;h["7P"+(4H=="M"?"f4":"f1")]=h["jk"+(4H=="M"?"f4":"f1")]=1h(54.q[54.jr].1y,10);b.80(h);b.3N(1d)},ca:k(id){c 1d=$(id);c h=b.3i(1d[0]);if(h.1k&&h.9t&&!$.2y.4d){h.1k[0].5g()}h.9t=!h.9t},dD:k(id,1N){c 1d=$(id);c h=b.3i(1d[0]);h.1B.3H=1N;b.4y(h)},bS:k(id,1K,1E,3D){if($(3D).5F(b.bQ)){l}c 1d=$(id);c h=b.3i(1d[0]);c 3U=b.1f(h,"3U");if(3U){h.5A=!h.5A;if(h.5A){$(".p-19 3D",h.1X).2k(b.9m);$(3D).1I(b.9m)}}h.3t=h.31=$("a",3D).1V();h.3d=h.3v=1K;h.3p=h.3j=1E;if(h.5A){h.4k=h.4v=h.2L=1e}1o{if(3U){h.4k=h.31;h.4v=h.3v;h.2L=h.3j}}b.90(id,b.6D(h,h.31,h.3v,h.3j));if(h.5A){h.2Y=1w 1A(h.3j,h.3v,h.31);b.4y(h)}1o{if(3U){h.3t=h.31=h.2Y.2o();h.3d=h.3v=h.2Y.2B();h.3p=h.3j=h.2Y.23();h.2Y=1e;if(h.2S){b.4y(h)}}}},ao:k(id){c 1d=$(id);c h=b.3i(1d[0]);if(b.1f(h,"ap")){l}h.5A=1g;h.4k=h.4v=h.2L=h.2Y=1e;b.90(1d,"")},90:k(id,48){c 1d=$(id);c h=b.3i(1d[0]);48=(48!=1e?48:b.6D(h));if(b.1f(h,"3U")&&48){48=(h.2Y?b.6D(h,h.2Y):48)+b.1f(h,"8C")+48}if(h.1k){h.1k.6p(48)}b.bx(h);c 68=b.1f(h,"68");if(68){68.1G((h.1k?h.1k[0]:1e),[48,h])}1o{if(h.1k){h.1k.6x("9E")}}if(h.2S){b.4y(h)}1o{if(!h.5A){b.5s(1e,b.1f(h,"1S"));b.7p=h.1k[0];if(2n(h.1k[0])!="5j"){h.1k[0].5g()}b.7p=1e}}},bx:k(h){c 8N=b.1f(h,"8N");if(8N){c 7v=b.1f(h,"7v");c 1a=b.aE(h);48=(ed(1a)?(!1a[0]&&!1a[1]?"":b.4R(7v,1a[0],b.43(h))+b.1f(h,"8C")+b.4R(7v,1a[1]||1a[0],b.43(h))):b.4R(7v,1a,b.43(h)));$(8N).1R(k(){$(b).6p(48)})}},jq:k(1a){c 1N=1a.7t();l[(1N>0&&1N<6),""]},8T:k(1a){c 4z=1w 1A(1a.23(),1a.2B(),1a.2o(),(1a.jh()/-60));c 78=1w 1A(4z.23(),1-1,4);c 3H=78.7t()||7;78.9N(78.2o()+1-3H);if(3H<4&&4z<78){4z.9N(4z.2o()-3);l $.19.8T(4z)}1o{if(4z>1w 1A(4z.23(),12-1,28)){3H=1w 1A(4z.23()+1,1-1,4).7t()||7;if(3H>4&&(4z.7t()||7)<3H-3){l 1}}}l 1i.jg(((4z-78)/j9)/7)+1},6z:k(1a,h){l $.19.4R($.19.1f(h,"6z"),1a,$.19.43(h))},ad:k(2H,1y,1B){if(2H==1e||1y==1e){7y"ag 1H"}1y=(2n 1y=="5j"?1y.b0():1y+"");if(1y==""){l 1e}c 3K=(1B?1B.3K:1e)||b.3C.3K;c 3F=(1B?1B.3F:1e)||b.3C.3F;c 3y=(1B?1B.3y:1e)||b.3C.3y;c 4A=(1B?1B.4A:1e)||b.3C.4A;c 3e=(1B?1B.3e:1e)||b.3C.3e;c 1E=-1;c 1K=-1;c 1N=-1;c 6t=-1;c 3R=1g;c 41=k(2I){c 3B=(2r+1<2H.1C&&2H.2O(2r+1)==2I);if(3B){2r++}l 3B};c 7H=k(2I){41(2I);c bq=(2I=="@"?14:(2I=="y"?4:(2I=="o"?3:2)));c 1r=bq;c 5m=0;4j(1r>0&&4p<1y.1C&&1y.2O(4p)>="0"&&1y.2O(4p)<="9"){5m=5m*10+1h(1y.2O(4p++),10);1r--}if(1r==bq){7y"eX 7Q at 1c "+4p}l 5m};c bw=k(2I,9s,9X){c 84=(41(2I)?9X:9s);c 1r=0;29(c j=0;j<84.1C;j++){1r=1i.2c(1r,84[j].1C)}c 3b="";c eW=4p;4j(1r>0&&4p<1y.1C){3b+=1y.2O(4p++);29(c i=0;i<84.1C;i++){if(3b==84[i]){l i+1}}1r--}7y"j8 3b at 1c "+eW};c 9Y=k(){if(1y.2O(4p)!=2H.2O(2r)){7y"j7 3R at 1c "+4p}4p++};c 4p=0;29(c 2r=0;2r<2H.1C;2r++){if(3R){if(2H.2O(2r)=="\'"&&!41("\'")){3R=1g}1o{9Y()}}1o{63(2H.2O(2r)){1s"d":1N=7H("d");1z;1s"D":bw("D",3F,3y);1z;1s"o":6t=7H("o");1z;1s"m":1K=7H("m");1z;1s"M":1K=bw("M",4A,3e);1z;1s"y":1E=7H("y");1z;1s"@":c 1a=1w 1A(7H("@"));1E=1a.23();1K=1a.2B()+1;1N=1a.2o();1z;1s"\'":if(41("\'")){9Y()}1o{3R=1m}1z;4s:9Y()}}}if(1E<2x){1E+=1w 1A().23()-1w 1A().23()%2x+(1E<=3K?0:-2x)}if(6t>-1){1K=1;1N=6t;do{c bp=b.6y(1E,1K-1);if(1N<=bp){1z}1K++;1N-=bp}4j(1m)}c 1a=1w 1A(1E,1K-1,1N);if(1a.23()!=1E||1a.2B()+1!=1K||1a.2o()!=1N){7y"ag 1a"}l 1a},j6:"6B-9c-dd",ja:"D, dd M 6B",jb:"6B-9c-dd",jf:"D, d M y",je:"8j, dd-M-y",jc:"D, d M y",jt:"D, d M 6B",jJ:"D, d M 6B",jI:"D, d M y",jH:"@",jG:"6B-9c-dd",4R:k(2H,1a,1B){if(!1a){l""}c 3F=(1B?1B.3F:1e)||b.3C.3F;c 3y=(1B?1B.3y:1e)||b.3C.3y;c 4A=(1B?1B.4A:1e)||b.3C.4A;c 3e=(1B?1B.3e:1e)||b.3C.3e;c 41=k(2I){c 3B=(2r+1<2H.1C&&2H.2O(2r+1)==2I);if(3B){2r++}l 3B};c 9i=k(2I,1y,eN){c 5m=""+1y;if(41(2I)){4j(5m.1C<eN){5m="0"+5m}}l 5m};c af=k(2I,1y,9s,9X){l(41(2I)?9X[1y]:9s[1y])};c 4l="";c 3R=1g;if(1a){29(c 2r=0;2r<2H.1C;2r++){if(3R){if(2H.2O(2r)=="\'"&&!41("\'")){3R=1g}1o{4l+=2H.2O(2r)}}1o{63(2H.2O(2r)){1s"d":4l+=9i("d",1a.2o(),2);1z;1s"D":4l+=af("D",1a.7t(),3F,3y);1z;1s"o":c 6t=1a.2o();29(c m=1a.2B()-1;m>=0;m--){6t+=b.6y(1a.23(),m)}4l+=9i("o",6t,3);1z;1s"m":4l+=9i("m",1a.2B()+1,2);1z;1s"M":4l+=af("M",1a.2B(),4A,3e);1z;1s"y":4l+=(41("y")?1a.23():(1a.eM()%2x<10?"0":"")+1a.eM()%2x);1z;1s"@":4l+=1a.4c();1z;1s"\'":if(41("\'")){4l+="\'"}1o{3R=1m}1z;4s:4l+=2H.2O(2r)}}}}l 4l},eL:k(2H){c 5u="";c 3R=1g;29(c 2r=0;2r<2H.1C;2r++){if(3R){if(2H.2O(2r)=="\'"&&!41("\'")){3R=1g}1o{5u+=2H.2O(2r)}}1o{63(2H.2O(2r)){1s"d":1s"m":1s"y":1s"@":5u+="jL";1z;1s"D":1s"M":l 1e;1s"\'":if(41("\'")){5u+="\'"}1o{3R=1m}1z;4s:5u+=2H.2O(2r)}}}l 5u},1f:k(h,3b){l h.1B[3b]!==2w?h.1B[3b]:b.3C[3b]},aj:k(h){c 6C=b.1f(h,"6C");c 5J=h.1k?h.1k.6p().7e(b.1f(h,"8C")):1e;h.4k=h.4v=h.2L=1e;c 1a=57=b.aI(h);if(5J.1C>0){c 1B=b.43(h);if(5J.1C>1){1a=b.ad(6C,5J[1],1B)||57;h.4k=1a.2o();h.4v=1a.2B();h.2L=1a.23()}9O{1a=b.ad(6C,5J[0],1B)||57}9U(e){b.ah(e);1a=57}}h.3t=1a.2o();h.1M=h.3d=1a.2B();h.1T=h.3p=1a.23();h.31=(5J[0]?1a.2o():0);h.3v=(5J[0]?1a.2B():0);h.3j=(5J[0]?1a.23():0);b.a7(h)},aI:k(h){c 1a=b.81(b.1f(h,"57"),1w 1A());c 2b=b.5z(h,"1W",1m);c 2l=b.5z(h,"2c");1a=(2b&&1a<2b?2b:1a);1a=(2l&&1a>2l?2l:1a);l 1a},81:k(1a,57){c fg=k(1b){c 1a=1w 1A();1a.dI(1a.dO()+1b);l 1a};c fi=k(1b,aD){c 1a=1w 1A();c 1E=1a.23();c 1K=1a.2B();c 1N=1a.2o();c a8=/([+-]?[0-9]+)\\s*(d|D|w|W|m|M|y|Y)?/g;c 3B=a8.6P(1b);4j(3B){63(3B[2]||"d"){1s"d":1s"D":1N+=1h(3B[1],10);1z;1s"w":1s"W":1N+=1h(3B[1],10)*7;1z;1s"m":1s"M":1K+=1h(3B[1],10);1N=1i.1W(1N,aD(1E,1K));1z;1s"y":1s"Y":1E+=1h(3B[1],10);1N=1i.1W(1N,aD(1E,1K));1z}3B=a8.6P(1b)}l 1w 1A(1E,1K,1N)};1a=(1a==1e?57:(2n 1a=="4L"?fi(1a,b.6y):(2n 1a=="7Q"?(4K(1a)?57:fg(1a)):1a)));l(1a&&1a.b0()=="ag 1A"?57:1a)},aB:k(h,1a,4O){c 5T=!(1a);c fd=h.3d;c dz=h.3p;1a=b.81(1a,1w 1A());h.3t=h.31=1a.2o();h.1M=h.3d=h.3v=1a.2B();h.1T=h.3p=h.3j=1a.23();if(b.1f(h,"3U")){if(4O){4O=b.81(4O,1e);h.4k=4O.2o();h.4v=4O.2B();h.2L=4O.23()}1o{h.4k=h.31;h.4v=h.3v;h.2L=h.3j}}if(fd!=h.3d||dz!=h.3p){b.80(h)}b.a7(h);if(h.1k){h.1k.6p(5T?"":b.6D(h)+(!b.1f(h,"3U")?"":b.1f(h,"8C")+b.6D(h,h.4k,h.4v,h.2L)))}},aE:k(h){c 9y=(!h.3j||(h.1k&&h.1k.6p()=="")?1e:1w 1A(h.3j,h.3v,h.31));if(b.1f(h,"3U")){l[h.2Y||9y,(!h.2L?h.2Y||9y:1w 1A(h.2L,h.4v,h.4k))]}1o{l 9y}},dX:k(h){c 5X=1w 1A();5X=1w 1A(5X.23(),5X.2B(),5X.2o());c 2D=b.1f(h,"2D");c 2C=b.1f(h,"2C")||"&#bH;";c 3P=b.1f(h,"3P");c 5T=(b.1f(h,"ap")?"":\'<1p 22="p-19-5T"><a 4E="1u.19.ao(\\\'#\'+h.id+"\');\\""+b.3Z(2D,h.id,b.1f(h,"dY"),2C)+">"+b.1f(h,"dW")+"</a></1p>");c bA=\'<1p 22="p-19-jw">\'+(3P?"":5T)+\'<1p 22="p-19-jv"><a 4E="1u.19.5s();"\'+b.3Z(2D,h.id,b.1f(h,"dU"),2C)+">"+b.1f(h,"dZ")+"</a></1p>"+(3P?5T:"")+"</1p>";c 7a=b.1f(h,"7a");c 8w=b.1f(h,"8w");c 7L=b.1f(h,"7L");c 61=b.1f(h,"61");c 6J=b.1f(h,"6J");c 2Z=b.79(h);c 9J=b.1f(h,"9J");c 5p=b.1f(h,"5p");c 5o=b.1f(h,"5o");c dB=(2Z[0]!=1||2Z[1]!=1);c 9e=(!h.31?1w 1A(jy,9,9):1w 1A(h.3j,h.3v,h.31));c 2b=b.5z(h,"1W",1m);c 2l=b.5z(h,"2c");c 1M=h.1M-9J;c 1T=h.1T;if(1M<0){1M+=12;1T--}if(2l){c 82=1w 1A(2l.23(),2l.2B()-2Z[1]+1,2l.2o());82=(2b&&82<2b?2b:82);4j(1w 1A(1T,1M,1)>82){1M--;if(1M<0){1M=11;1T--}}}c 5N=b.1f(h,"5N");5N=(!61?5N:b.4R(5N,1w 1A(1T,1M-5p,1),b.43(h)));c 5M=(6J?b.1f(h,"5M"):"");5M=(!61?5M:b.4R(5M,1w 1A(1T,1M-5o,1),b.43(h)));c 8S=\'<1p 22="p-19-8S">\'+(b.c6(h,-1,1T,1M)?(6J?"<a 4E=\\"1u.19.3N(\'#"+h.id+"\', -"+5o+", \'M\');\\""+b.3Z(2D,h.id,b.1f(h,"e5"),2C)+">"+5M+"</a>":"")+"<a 4E=\\"1u.19.3N(\'#"+h.id+"\', -"+5p+", \'M\');\\""+b.3Z(2D,h.id,b.1f(h,"e6"),2C)+">"+5N+"</a>":(7L?"":"<5Y>"+5M+"</5Y><5Y>"+5N+"</5Y>"))+"</1p>";c 65=b.1f(h,"65");65=(!61?65:b.4R(65,1w 1A(1T,1M+5p,1),b.43(h)));c 5Z=(6J?b.1f(h,"5Z"):"");5Z=(!61?5Z:b.4R(5Z,1w 1A(1T,1M+5o,1),b.43(h)));c 7h=\'<1p 22="p-19-7h">\'+(b.c6(h,+1,1T,1M)?"<a 4E=\\"1u.19.3N(\'#"+h.id+"\', +"+5p+", \'M\');\\""+b.3Z(2D,h.id,b.1f(h,"e4"),2C)+">"+65+"</a>"+(6J?"<a 4E=\\"1u.19.3N(\'#"+h.id+"\', +"+5o+", \'M\');\\""+b.3Z(2D,h.id,b.1f(h,"eK"),2C)+">"+5Z+"</a>":""):(7L?"":"<5Y>"+65+"</5Y><5Y>"+5Z+"</5Y>"))+"</1p>";c 6L=b.1f(h,"6L");c al=(b.1f(h,"ar")&&h.31?9e:5X);6L=(!61?6L:b.4R(6L,al,b.43(h)));c 1V=(7a?\'<1p 22="\'+b.av+\'">\'+7a+"</1p>":"")+(8w&&!h.2S?bA:"")+\'<1p 22="p-19-jC">\'+(3P?7h:8S)+(b.c5(h,al)?\'<1p 22="p-19-4x"><a 4E="1u.19.am(\\\'#\'+h.id+"\');\\""+b.3Z(2D,h.id,b.1f(h,"e2"),2C)+">"+6L+"</a></1p>":"")+(3P?8S:7h)+"</1p>";c 3H=b.1f(h,"3H");c 8f=b.1f(h,"8f");c 3y=b.1f(h,"3y");c 3F=b.1f(h,"3F");c 9b=b.1f(h,"9b");c 3e=b.1f(h,"3e");c 8i=b.1f(h,"8i");c 7d=b.1f(h,"7d");c 5Q=b.1f(h,"5Q");c 8g=b.1f(h,"8g");c 9g=b.1f(h,"9g")||b.8T;c 8h=b.1f(h,"8h");c 4Y=(2D?b.1f(h,"9a")||2C:"");c 6z=b.1f(h,"dQ")||b.6z;c 4O=h.4k?1w 1A(h.2L,h.4v,h.4k):9e;29(c 6v=0;6v<2Z[0];6v++){29(c 76=0;76<2Z[1];76++){c 7j=1w 1A(1T,1M,h.3t);1V+=\'<1p 22="p-19-jA-1K\'+(76==0?" p-19-1w-6v":"")+\'">\'+b.dJ(h,1M,1T,2b,2l,7j,6v>0||76>0,2D,2C,3e)+\'<dM 22="p-19" j5="0" j4="0"><dA><9q 22="p-19-88-6v">\'+(8g?"<3D"+b.3Z(2D,h.id,8h,2C)+">"+b.1f(h,"dF")+"</3D>":"");29(c 5n=0;5n<7;5n++){c 1N=(5n+3H)%7;c 9a=(4Y.8a("8j")>-1?4Y.8c(/8j/,3y[1N]):4Y.8c(/D/,3F[1N]));1V+="<3D"+((5n+3H+6)%7>=5?\' 22="p-19-5W-4m-6r"\':"")+">"+(!8f?"<5O":"<a 4E=\\"1u.19.dD(\'#"+h.id+"\', "+1N+\');"\')+b.3Z(2D,h.id,9a,2C)+\' 88="\'+3y[1N]+\'">\'+9b[1N]+(8f?"</a>":"</5O>")+"</3D>"}1V+="</9q></dA><dN>";c bO=b.6y(1T,1M);if(1T==h.3p&&1M==h.3d){h.3t=1i.1W(h.3t,bO)}c 9h=(b.eb(1T,1M)-3H+7)%7;c 8u=1w 1A(1T,1M,1-9h);c 7u=1w 1A(1T,1M,1-9h);c 3s=7u;c dC=(dB?6:1i.iy((9h+bO)/7));29(c bM=0;bM<dC;bM++){1V+=\'<9q 22="p-19-7q-6v">\'+(8g?\'<3D 22="p-19-5W-76"\'+b.3Z(2D,h.id,8h,2C)+">"+9g(3s)+"</3D>":"");29(c 5n=0;5n<7;5n++){c 87=(8i?8i.1G((h.1k?h.1k[0]:1e),[3s]):[1m,""]);c 5R=(3s.2B()!=1M);c 5d=5R||!87[0]||(2b&&3s<2b)||(2l&&3s>2l);1V+=\'<3D 22="p-19-7q-6r\'+((5n+3H+6)%7>=5?" p-19-5W-4m-6r":"")+(5R?" p-19-ix-1K":"")+(3s.4c()==7j.4c()&&1M==h.3d?" p-19-7q-6r-4P":"")+(5d?" "+b.bQ:"")+(5R&&!5Q?"":" "+87[1]+(3s.4c()>=9e.4c()&&3s.4c()<=4O.4c()?" "+b.9m:"")+(3s.4c()==5X.4c()?" p-19-5X":""))+\'"\'+((!5R||5Q)&&87[2]?\' 88="\'+87[2]+\'"\':"")+(5d?(7d?" ch=\\"1u(b).1J().1I(\'p-19-5W-4P\');\\" cf=\\"1u(b).1J().2k(\'p-19-5W-4P\');\\"":""):" ch=\\"1u(b).1I(\'p-19-7q-6r-4P\')"+(7d?".1J().1I(\'p-19-5W-4P\')":"")+";"+(!2D||(5R&&!5Q)?"":"1u(\'#p-19-4Y-"+h.id+"\').1V(\'"+(6z.1G((h.1k?h.1k[0]:1e),[3s,h])||2C)+"\');")+"\\" cf=\\"1u(b).2k(\'p-19-7q-6r-4P\')"+(7d?".1J().2k(\'p-19-5W-4P\')":"")+";"+(!2D||(5R&&!5Q)?"":"1u(\'#p-19-4Y-"+h.id+"\').1V(\'"+2C+"\');")+\'" 4E="1u.19.bS(\\\'#\'+h.id+"\',"+1M+","+1T+\', b);"\')+">"+(5R?(5Q?3s.2o():"&#bH;"):(5d?3s.2o():"<a>"+3s.2o()+"</a>"))+"</3D>";8u.9N(8u.2o()+1);7u.dI(7u.dO()+1);3s=(8u>7u?8u:7u)}1V+="</9q>"}1M++;if(1M>11){1M=0;1T++}1V+="</dN></dM></1p>"}}1V+=(2D?\'<1p 2v="5T: 5a;"></1p><1p id="p-19-4Y-\'+h.id+\'" 22="p-19-4Y">\'+2C+"</1p>":"")+(!8w&&!h.2S?bA:"")+\'<1p 2v="5T: 5a;"></1p>\'+($.2y.4d&&1h($.2y.8m,10)<7&&!h.2S?\'<8l bD="iB:1g;" 22="p-19-bI"></8l>\':"");l 1V},dJ:k(h,1M,1T,2b,2l,7j,bG,2D,2C,3e){2b=(h.2Y&&2b&&7j<2b?7j:2b);c 7O=b.1f(h,"7O");c 1V=\'<1p 22="p-19-iC">\';c 6V="";if(bG||!b.1f(h,"dL")){6V+=3e[1M]+"&#bH;"}1o{c ez=(2b&&2b.23()==1T);c ex=(2l&&2l.23()==1T);6V+=\'<54 22="p-19-1w-1K" eh="1u.19.cc(\\\'#\'+h.id+"\', b, \'M\');\\" 4E=\\"1u.19.ca(\'#"+h.id+"\');\\""+b.3Z(2D,h.id,b.1f(h,"e7"),2C)+">";29(c 1K=0;1K<12;1K++){if((!ez||1K>=2b.2B())&&(!ex||1K<=2l.2B())){6V+=\'<7c 1y="\'+1K+\'"\'+(1K==1M?\' 7P="7P"\':"")+">"+3e[1K]+"</7c>"}}6V+="</54>"}if(!7O){1V+=6V}if(bG||!b.1f(h,"eu")){1V+=1T}1o{c 5V=b.1f(h,"ev").7e(":");c 1E=0;c 2L=0;if(5V.1C!=2){1E=1T-10;2L=1T+10}1o{if(5V[0].2O(0)=="+"||5V[0].2O(0)=="-"){1E=2L=1w 1A().23();1E+=1h(5V[0],10);2L+=1h(5V[1],10)}1o{1E=1h(5V[0],10);2L=1h(5V[1],10)}}1E=(2b?1i.2c(1E,2b.23()):1E);2L=(2l?1i.1W(2L,2l.23()):2L);1V+=\'<54 22="p-19-1w-1E" eh="1u.19.cc(\\\'#\'+h.id+"\', b, \'Y\');\\" 4E=\\"1u.19.ca(\'#"+h.id+"\');\\""+b.3Z(2D,h.id,b.1f(h,"ep"),2C)+">";29(;1E<=2L;1E++){1V+=\'<7c 1y="\'+1E+\'"\'+(1E==1T?\' 7P="7P"\':"")+">"+1E+"</7c>"}1V+="</54>"}if(7O){1V+=6V}1V+="</1p>";l 1V},3Z:k(2D,id,4T,2C){l(2D?" ch=\\"1u(\'#p-19-4Y-"+id+"\').1V(\'"+(4T||2C)+"\');\\" cf=\\"1u(\'#p-19-4Y-"+id+"\').1V(\'"+2C+"\');\\"":"")},a7:k(h,1b,4H){c 1E=h.1T+(4H=="Y"?1b:0);c 1K=h.1M+(4H=="M"?1b:0);c 1N=1i.1W(h.3t,b.6y(1E,1K))+(4H=="D"?1b:0);c 1a=1w 1A(1E,1K,1N);c 2b=b.5z(h,"1W",1m);c 2l=b.5z(h,"2c");1a=(2b&&1a<2b?2b:1a);1a=(2l&&1a>2l?2l:1a);h.3t=1a.2o();h.1M=h.3d=1a.2B();h.1T=h.3p=1a.23();if(4H=="M"||4H=="Y"){b.80(h)}},80:k(h){c bZ=b.1f(h,"en");if(bZ){bZ.1G((h.1k?h.1k[0]:1e),[h.3p,h.3d+1,h])}},79:k(h){c 2Z=b.1f(h,"el");l(2Z==1e?[1,1]:(2n 2Z=="7Q"?[1,2Z]:2Z))},5z:k(h,ek,ei){c 1a=b.81(b.1f(h,ek+"1A"),1e);if(1a){1a.ku(0);1a.kv(0);1a.kP(0);1a.kL(0)}l(!ei||!h.2Y?1a:(!1a||h.2Y>1a?h.2Y:1a))},6y:k(1E,1K){l 32-1w 1A(1E,1K,32).2o()},eb:k(1E,1K){l 1w 1A(1E,1K,1).7t()},c6:k(h,1b,ea,e9){c 2Z=b.79(h);c 1a=1w 1A(ea,e9+(1b<0?1b:2Z[1]),1);if(1b<0){1a.9N(b.6y(1a.23(),1a.2B()))}l b.c5(h,1a)},c5:k(h,1a){c 7r=(!h.2Y?1e:1w 1A(h.3p,h.3d,h.3t));7r=(7r&&h.2Y<7r?h.2Y:7r);c 2b=7r||b.5z(h,"1W");c 2l=b.5z(h,"2c");l((!2b||1a>=2b)&&(!2l||1a<=2l))},43:k(h){c 3K=b.1f(h,"3K");3K=(2n 3K!="4L"?3K:1w 1A().23()%2x+1h(3K,10));l{3K:3K,3F:b.1f(h,"3F"),3y:b.1f(h,"3y"),4A:b.1f(h,"4A"),3e:b.1f(h,"3e")}},6D:k(h,1N,1K,1E){if(!1N){h.31=h.3t;h.3v=h.3d;h.3j=h.3p}c 1a=(1N?(2n 1N=="5j"?1N:1w 1A(1E,1K,1N)):1w 1A(h.3j,h.3v,h.31));l b.4R(b.1f(h,"6C"),1a,b.43(h))}});k 72(1d,7w){$.1Q(1d,7w);29(c 3b in 7w){if(7w[3b]==1e||7w[3b]==2w){1d[3b]=7w[3b]}}l 1d}k ed(a){l(a&&(($.2y.ee&&2n a=="5j"&&a.1C)||(a.4n&&a.4n.b0().2I(/\\9j\\(\\)/))))}$.fn.19=k(q){if(!$.19.b7){$(1n.2g).5e($.19.1X).9H($.19.eg);$.19.b7=1m}c b2=9j.5f.ef.24(1H,1);if(2n q=="4L"&&(q=="kK"||q=="2o")){l $.19["aY"+q+"8Q"].1G($.19,[b[0]].4u(b2))}l b.1R(k(){2n q=="4L"?$.19["aY"+q+"8Q"].1G($.19,[b].4u(b2)):$.19.es(b,q)})};$.19=1w 8Q();$.19.b7=1g;$.19.b6=1w 1A().4c()})(1u);(k(A){A.4b("p.3a",{6H:k(){b.eH=b.q.8I;c B=b,C=b.q,E=(1w 1A()).4c()+1i.kM(),D=C.4T||"0%";b.18.1I("p-3a").v(C.v);A.1Q(b,{77:1g,74:0,7I:0,6T:E,49:A(\'<1p 22="p-3a-49 p-30"></1p>\').Z({v:"2m",2V:"30",2W:2x}),5L:A(\'<1p 22="p-3a-4T"></1p>\').1V(D).Z({v:"2m",2V:"30"}),aV:A(\'<1p 22="p-3a-4T p-3a-4T-kN"></1p>\').1V(D).Z({v:b.18.v()}),8G:A(\'<1p 22="p-3a-8L"></1p>\')});b.8G.5e(b.49.5e(b.5L.1I(C.ew)),b.aV).3T(b.18)},5q:{},p:k(B){l{1F:b,6T:b.6T,q:b.q,18:b.49,5L:b.5L,74:b.74,7I:b.7I}},2e:k(C,B){A.p.2u.24(b,C,[B,b.p()]);b.18.3O(C=="3a"?C:["3a",C].8e(""),[B,b.p()],b.q[C])},6o:k(){b.2M();b.18.2k("p-3a p-3a-1Y").5I("3a").3M(".3a").6W(".p-3a-8L").26();eI 1u.2t[b.6T]},et:k(){b.18.2k("p-3a-1Y");b.1Y=1g},eE:k(){b.18.1I("p-3a-1Y");b.1Y=1m},2p:k(){c B=b,C=b.q;if(b.1Y){l}1u.2t[b.6T]=k(K,L,J,I,H){c G=C.eB,E=C.v,F=((G>E?E:G)/E),D=1i.3f(K/F)*F;l D>1?1:D};B.77=1m;eD(k(){B.77=1g},C.1S);b.eF();b.2e("2p",b.p());l 1g},eF:k(){c C=b,D=b.q,B=D.8I;b.49.2a({v:D.v},{1S:B,2t:b.6T,bY:k(G,E){C.b8((G/D.v)*2x);c H=1w 1A().4c(),F=(H-E.kO);D.8I=B-F},aG:k(){eI 1u.2t[C.6T];C.aR();if(C.77){}}})},aR:k(){if(b.1Y){l}b.49.2M();b.2e("aR",b.p())},2M:k(){b.49.2M();b.49.v(0);b.5L.v(0);b.49.1I("p-30");b.q.8I=b.eH;b.2e("2M",b.p())},4T:k(B){b.5L.1V(B);b.aV.1V(B)},b8:k(B){if(b.49.is(".p-30")){b.49.2k("p-30")}b.7I=B>2x?2x:B;b.74=(b.7I/2x)*b.q.v;b.49.v(b.74);b.5L.v(b.74);if(b.q.7B&&!b.q.4T){b.5L.1V(1i.3f(b.7I)+"%")}b.2e("b8",b.p())}});A.p.3a.5v={v:ky,1S:kn,8I:k1,eB:1,7B:1m,4T:"",1I:"",ew:""}})(1u);(k(C){C.1v=C.1v||{};C.1Q(C.1v,{7N:k(F,G){29(c E=0;E<G.1C;E++){if(G[E]!==1e){C.1t(F[0],"ec.ey."+G[E],F[0].2v[G[E]])}}},6j:k(F,G){29(c E=0;E<G.1C;E++){if(G[E]!==1e){F.Z(G[E],C.1t(F[0],"ec.ey."+G[E]))}}},6E:k(E,F){if(F=="5t"){F=E.is(":30")?"2R":"2s"}l F},fa:k(G,F){c H,E;63(G[0]){1s"u":H=0;1z;1s"e0":H=0.5;1z;1s"4q":H=1;1z;4s:H=G[0]/F.15}63(G[1]){1s"t":E=0;1z;1s"dT":E=0.5;1z;1s"4g":E=1;1z;4s:E=G[1]/F.v}l{x:E,y:H}},aC:k(F){if(F.1J().3r("id")=="bv"){l F}c E={v:F.3l({6b:1m}),15:F.3n({6b:1m}),"dK":F.Z("dK")};F.8L(\'<1p id="bv" 2v="jZ-1r:2x%;8O:5w;br:4i;6b:0;dP:0"></1p>\');c I=F.1J();if(F.Z("1c")=="66"){I.Z({1c:"1O"});F.Z({1c:"1O"})}1o{c H=F.Z("u");if(4K(1h(H))){H="3q"}c G=F.Z("t");if(4K(1h(G))){G="3q"}I.Z({1c:F.Z("1c"),u:H,t:G,2W:F.Z("z-dH")}).2R();F.Z({1c:"1O",u:0,t:0})}I.Z(E);l I},a3:k(E){if(E.1J().3r("id")=="bv"){l E.1J().jT(E)}l E},4t:k(F,G,E,H){H=H||{};C.1R(G,k(J,I){9L=F.eP(I);if(9L[0]>0){H[I]=9L[0]*E+9L[1]}});l H},8v:k(G,J,I,H){c E=(2n I=="k"?I:(H?H:1e));c F=(2n I=="5j"?I:1e);l b.1R(k(){c O={};c M=C(b);c N=M.3r("2v")||"";if(2n N=="5j"){N=N.bd}if(G.5t){M.5F(G.5t)?G.26=G.5t:G.2d=G.5t}c K=C.1Q({},(1n.9R?1n.9R.dE(b,1e):b.dG));if(G.2d){M.1I(G.2d)}if(G.26){M.2k(G.26)}c L=C.1Q({},(1n.9R?1n.9R.dE(b,1e):b.dG));if(G.2d){M.2k(G.2d)}if(G.26){M.1I(G.26)}29(c P in L){if(2n L[P]!="k"&&L[P]&&P.8a("ko")==-1&&P.8a("1C")==-1&&L[P]!=K[P]&&(P.2I(/8o/i)||(!P.2I(/8o/i)&&!4K(1h(L[P],10))))&&(K.1c!="66"||(K.1c=="66"&&!P.2I(/t|u|4q|4g/)))){O[P]=L[P]}}M.2a(O,J,F,k(){if(2n C(b).3r("2v")=="5j"){C(b).3r("2v")["bd"]="";C(b).3r("2v")["bd"]=N}1o{C(b).3r("2v",N)}if(G.2d){C(b).1I(G.2d)}if(G.26){C(b).2k(G.26)}if(E){E.1G(b,1H)}})})}});C.fn.1Q({f5:C.fn.2R,ff:C.fn.2s,f8:C.fn.5t,fe:C.fn.1I,f3:C.fn.2k,eR:C.fn.eQ,4B:k(E,H,F,G){l C.1v[E]?C.1v[E].24(b,{k7:E,q:H||{},1S:F,3o:G}):1e},2R:k(){if(!1H[0]||(1H[0].4n==8p||/(98|94|bb)/.1q(1H[0]))){l b.f5.1G(b,1H)}1o{c E=1H[1]||{};E.4C="2R";l b.4B.1G(b,[1H[0],E,1H[2]||E.1S,1H[3]||E.3o])}},2s:k(){if(!1H[0]||(1H[0].4n==8p||/(98|94|bb)/.1q(1H[0]))){l b.ff.1G(b,1H)}1o{c E=1H[1]||{};E.4C="2s";l b.4B.1G(b,[1H[0],E,1H[2]||E.1S,1H[3]||E.3o])}},5t:k(){if(!1H[0]||(1H[0].4n==8p||/(98|94|bb)/.1q(1H[0]))||(1H[0].4n==ki)){l b.f8.1G(b,1H)}1o{c E=1H[1]||{};E.4C="5t";l b.4B.1G(b,[1H[0],E,1H[2]||E.1S,1H[3]||E.3o])}},1I:k(H,E,G,F){l E?C.1v.8v.1G(b,[{2d:H},E,G,F]):b.fe(H)},2k:k(H,E,G,F){l E?C.1v.8v.1G(b,[{26:H},E,G,F]):b.f3(H)},eQ:k(H,E,G,F){l E?C.1v.8v.1G(b,[{5t:H},E,G,F]):b.eR(H)},eS:k(F,I,E,H,G){l C.1v.8v.1G(b,[{2d:I,26:F},E,H,G])},kh:k(){l b.eS.1G(b,1H)},eP:k(E){c F=b.Z(E),G=[];C.1R(["em","2J","%","kl"],k(H,I){if(F.8a(I)>0){G=[9v(F),I]}});l G}});1u.1R(["6I","kg","kf","ka","k9","8o","k8"],k(F,E){1u.fx.bY[E]=k(G){if(G.kd==0){G.2p=D(G.f0,E);G.4m=A(G.4m)}G.f0.2v[E]="bi("+[1i.2c(1i.1W(1h((G.2P*(G.4m[0]-G.2p[0]))+G.2p[0]),21),0),1i.2c(1i.1W(1h((G.2P*(G.4m[1]-G.2p[1]))+G.2p[1]),21),0),1i.2c(1i.1W(1h((G.2P*(G.4m[2]-G.2p[2]))+G.2p[2]),21),0)].8e(",")+")"}});k A(E){c F;if(E&&E.4n==9j&&E.1C==3){l E}if(F=/bi\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)/.6P(E)){l[1h(F[1]),1h(F[2]),1h(F[3])]}if(F=/bi\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)/.6P(E)){l[9v(F[1])*2.55,9v(F[2])*2.55,9v(F[3])*2.55]}if(F=/#([a-fA-7A-9]{2})([a-fA-7A-9]{2})([a-fA-7A-9]{2})/.6P(E)){l[1h(F[1],16),1h(F[2],16),1h(F[3],16)]}if(F=/#([a-fA-7A-9])([a-fA-7A-9])([a-fA-7A-9])/.6P(E)){l[1h(F[1]+F[1],16),1h(F[2]+F[2],16),1h(F[3]+F[3],16)]}if(F=/eY\\(0, 0, 0, 0\\)/.6P(E)){l B.5w}l B[1u.eV(E).6Q()]}k D(G,E){c F;do{F=1u.km(G,E);if(F!=""&&F!="5w"||1u.2q(G,"2g")){1z}E="6I"}4j(G=G.4e);l A(F)}c B={ii:[0,21,21],kk:[eU,21,21],kj:[eZ,eZ,k6],jX:[0,0,0],jV:[0,0,21],jU:[eG,42,42],jY:[0,21,21],k4:[0,0,7E],k5:[0,7E,7E],k3:[bt,bt,bt],kQ:[0,2x,0],kz:[io,hw,bn],fO:[7E,0,7E],fK:[85,bn,47],fN:[21,eT,0],fJ:[fI,50,fP],fQ:[7E,0,0],fm:[fo,bC,fp],fl:[fj,0,8U],fq:[21,0,21],fr:[21,gp,0],gb:[0,5H,0],gc:[75,0,gj],gk:[eU,f6,eT],g9:[fY,fU,f6],g2:[e8,21,21],g3:[dR,g1,dR],g5:[8U,8U,8U],g7:[21,g6,fV],fX:[21,21,e8],gm:[0,21,0],go:[21,0,21],gn:[5H,0,0],ga:[0,0,5H],gd:[5H,5H,0],gg:[21,eG,0],fs:[21,9P,fu],fy:[5H,0,5H],fz:[5H,0,5H],fM:[21,0,0],fD:[9P,9P,9P],fC:[21,21,21],fB:[21,21,0],5w:[21,21,21]};1u.2t.fE=1u.2t.b1;1u.1Q(1u.2t,{eo:"ej",b1:k(F,G,E,I,H){l 1u.2t[1u.2t.eo](F,G,E,I,H)},fF:k(F,G,E,I,H){l I*(G/=H)*G+E},ej:k(F,G,E,I,H){l-I*(G/=H)*(G-2)+E},ft:k(F,G,E,I,H){if((G/=H/2)<1){l I/2*G*G+E}l-I/2*((--G)*(G-2)-1)+E},fv:k(F,G,E,I,H){l I*(G/=H)*G*G+E},fG:k(F,G,E,I,H){l I*((G=G/H-1)*G*G+1)+E},fH:k(F,G,E,I,H){if((G/=H/2)<1){l I/2*G*G*G+E}l I/2*((G-=2)*G*G+2)+E},g4:k(F,G,E,I,H){l I*(G/=H)*G*G*G+E},ih:k(F,G,E,I,H){l-I*((G=G/H-1)*G*G*G-1)+E},hF:k(F,G,E,I,H){if((G/=H/2)<1){l I/2*G*G*G*G+E}l-I/2*((G-=2)*G*G*G-2)+E},hD:k(F,G,E,I,H){l I*(G/=H)*G*G*G*G+E},hC:k(F,G,E,I,H){l I*((G=G/H-1)*G*G*G*G+1)+E},hH:k(F,G,E,I,H){if((G/=H/2)<1){l I/2*G*G*G*G*G+E}l I/2*((G-=2)*G*G*G*G+2)+E},hK:k(F,G,E,I,H){l-I*1i.er(G/H*(1i.5c/2))+I+E},hq:k(F,G,E,I,H){l I*1i.7Y(G/H*(1i.5c/2))+E},hr:k(F,G,E,I,H){l-I/2*(1i.er(1i.5c*G/H)-1)+E},hs:k(F,G,E,I,H){l(G==0)?E:I*1i.6c(2,10*(G/H-1))+E},ht:k(F,G,E,I,H){l(G==H)?E+I:I*(-1i.6c(2,-10*G/H)+1)+E},hy:k(F,G,E,I,H){if(G==0){l E}if(G==H){l E+I}if((G/=H/2)<1){l I/2*1i.6c(2,10*(G-1))+E}l I/2*(-1i.6c(2,-10*--G)+2)+E},hx:k(F,G,E,I,H){l-I*(1i.a5(1-(G/=H)*G)-1)+E},gq:k(F,G,E,I,H){l I*1i.a5(1-(G=G/H-1)*G)+E},hv:k(F,G,E,I,H){if((G/=H/2)<1){l-I/2*(1i.a5(1-G*G)-1)+E}l I/2*(1i.a5(1-(G-=2)*G)+1)+E},hN:k(F,H,E,L,K){c I=1.7s;c J=0;c G=L;if(H==0){l E}if((H/=K)==1){l E+L}if(!J){J=K*0.3}if(G<1i.3A(L)){G=L;c I=J/4}1o{c I=J/(2*1i.5c)*1i.c4(L/G)}l-(G*1i.6c(2,10*(H-=1))*1i.7Y((H*K-I)*(2*1i.5c)/J))+E},i7:k(F,H,E,L,K){c I=1.7s;c J=0;c G=L;if(H==0){l E}if((H/=K)==1){l E+L}if(!J){J=K*0.3}if(G<1i.3A(L)){G=L;c I=J/4}1o{c I=J/(2*1i.5c)*1i.c4(L/G)}l G*1i.6c(2,-10*H)*1i.7Y((H*K-I)*(2*1i.5c)/J)+L+E},i4:k(F,H,E,L,K){c I=1.7s;c J=0;c G=L;if(H==0){l E}if((H/=K/2)==2){l E+L}if(!J){J=K*(0.3*1.5)}if(G<1i.3A(L)){G=L;c I=J/4}1o{c I=J/(2*1i.5c)*1i.c4(L/G)}if(H<1){l-0.5*(G*1i.6c(2,10*(H-=1))*1i.7Y((H*K-I)*(2*1i.5c)/J))+E}l G*1i.6c(2,-10*(H-=1))*1i.7Y((H*K-I)*(2*1i.5c)/J)*0.5+L+E},i9:k(F,G,E,J,I,H){if(H==2w){H=1.7s}l J*(G/=I)*G*((H+1)*G-H)+E},ig:k(F,G,E,J,I,H){if(H==2w){H=1.7s}l J*((G=G/I-1)*G*((H+1)*G+H)+1)+E},ie:k(F,G,E,J,I,H){if(H==2w){H=1.7s}if((G/=I/2)<1){l J/2*(G*G*(((H*=(1.eC))+1)*G-H))+E}l J/2*((G-=2)*G*(((H*=(1.eC))+1)*G+H)+2)+E},eA:k(F,G,E,I,H){l I-1u.2t.c0(F,H-G,0,I,H)+E},c0:k(F,G,E,I,H){if((G/=H)<(1/2.75)){l I*(7.9C*G*G)+E}1o{if(G<(2/2.75)){l I*(7.9C*(G-=(1.5/2.75))*G+0.75)+E}1o{if(G<(2.5/2.75)){l I*(7.9C*(G-=(2.25/2.75))*G+0.ia)+E}1o{l I*(7.9C*(G-=(2.hT/2.75))*G+0.hS)+E}}}},hR:k(F,G,E,I,H){if(G<H/2){l 1u.2t.eA(F,G*2,0,I,H)*0.5+E}l 1u.2t.c0(F,G*2-H,0,I,H)*0.5+I*0.5+E}})})(1u);(k(A){A.1v.hP=k(B){l b.5h(k(){c E=A(b),K=["1c","u","t"];c J=A.1v.6E(E,B.q.4C||"4B");c O=B.q.e3||"cg";c D=B.q.6a||20;c C=B.q.hQ||5;c G=B.1S||hU;if(/2R|2s/.1q(J)){K.7K("2E")}A.1v.7N(E,K);E.2R();A.1v.aC(E);c F=(O=="cg"||O=="hZ")?"u":"t";c M=(O=="cg"||O=="t")?"2P":"hY";c D=B.q.6a||(F=="u"?E.3n({6b:1m})/3:E.3l({6b:1m})/3);if(J=="2R"){E.Z("2E",0).Z(F,M=="2P"?-D:D)}if(J=="2s"){D=D/(C*2)}if(J!="2s"){C--}if(J=="2R"){c H={2E:1};H[F]=(M=="2P"?"+=":"-=")+D;E.2a(H,G/2,B.q.2t);D=D/2;C--}29(c I=0;I<C;I++){c N={},L={};N[F]=(M=="2P"?"-=":"+=")+D;L[F]=(M=="2P"?"+=":"-=")+D;E.2a(N,G/2,B.q.2t).2a(L,G/2,B.q.2t);D=(J=="2s")?D*2:D/2}if(J=="2s"){c H={2E:0};H[F]=(M=="2P"?"-=":"+=")+D;E.2a(H,G/2,B.q.2t,k(){E.2s();A.1v.6j(E,K);A.1v.a3(E);if(B.3o){B.3o.1G(b,1H)}})}1o{c N={},L={};N[F]=(M=="2P"?"-=":"+=")+D;L[F]=(M=="2P"?"+=":"-=")+D;E.2a(N,G/2,B.q.2t).2a(L,G/2,B.q.2t,k(){A.1v.6j(E,K);A.1v.a3(E);if(B.3o){B.3o.1G(b,1H)}})}E.5h("fx",k(){E.70()});E.70()})}})(1u);(k(A){A.1v.gK=k(B){l b.5h(k(){c E=A(b),D=["bz","6I","2E"];c H=A.1v.6E(E,B.q.4C||"2R");c C=B.q.8o||"#gJ";c G=E.Z("6I");A.1v.7N(E,D);E.2R();E.Z({bz:"4i",6I:C});c F={6I:G};if(H=="2s"){F.2E=0}E.2a(F,{5h:1g,1S:B.1S,2t:B.q.2t,aG:k(){if(H=="2s"){E.2s()}A.1v.6j(E,D);if(H=="2R"&&1u.2y.4d){b.2v.gI("e1")}if(B.3o){B.3o.1G(b,1H)}E.70()}})})}})(1u);(k(A){A.1v.gG=k(B){l b.5h(k(){c G=A(b);c F=A.1Q(1m,{},B.q);c H=A.1v.6E(G,B.q.4C||"2s");c C=1h(B.q.9n)||bC;F.dS=1m;c E={15:G.15(),v:G.v()};c D=C/2x;G.1D=(H=="2s")?E:{15:E.15*D,v:E.v*D};F.1D=G.1D;F.9n=(H=="2s")?C:2x;F.4C=H;G.4B("bL",F,B.1S,B.3o);G.70()})};A.1v.bL=k(B){l b.5h(k(){c H=A(b);c F=A.1Q(1m,{},B.q);c I=A.1v.6E(H,B.q.4C||"4B");c C=1h(B.q.9n)||(1h(B.q.9n)==0?0:(I=="2s"?0:2x));c J=B.q.e3||"5a";c G=B.q.ab;if(I!="4B"){F.ab=G||["e0","dT"];F.6j=1m}c E={15:H.15(),v:H.v()};H.1D=B.q.1D||(I=="2R"?{15:0,v:0}:E);c D={y:J!="9w"?(C/2x):1,x:J!="4N"?(C/2x):1};H.1L={15:E.15*D.y,v:E.v*D.x};if(B.q.dS){if(I=="2R"){H.1D.2E=0;H.1L.2E=1}if(I=="2s"){H.1D.2E=1;H.1L.2E=0}}F.1D=H.1D;F.1L=H.1L;F.4C=I;H.4B("1r",F,B.1S,B.3o);H.70()})};A.1v.1r=k(B){l b.5h(k(){c H=A(b),N=["1c","u","t","v","15","2V","2E"];c D=["1c","u","t","2V","2E"];c F=["v","15","2V"];c O=["dV"];c E=["6Y","93","eJ","f2"];c K=["6F","9A","fb","fc"];c L=A.1v.6E(H,B.q.4C||"4B");c M=B.q.6j||1g;c J=B.q.bL||"5a";c P=B.q.ab;c I={15:H.15(),v:H.v()};H.1D=B.q.1D||I;H.1L=B.q.1L||I;if(P){c G=A.1v.fa(P,I);H.1D.u=(I.15-H.1D.15)*G.y;H.1D.t=(I.v-H.1D.v)*G.x;H.1L.u=(I.15-H.1L.15)*G.y;H.1L.t=(I.v-H.1L.v)*G.x}c C={1D:{y:H.1D.15/I.15,x:H.1D.v/I.v},1L:{y:H.1L.15/I.15,x:H.1L.v/I.v}};if(J=="gL"||J=="5a"){if(C.1D.y!=C.1L.y){N=N.4u(E);H.1D=A.1v.4t(H,E,C.1D.y,H.1D);H.1L=A.1v.4t(H,E,C.1L.y,H.1L)}if(C.1D.x!=C.1L.x){N=N.4u(K);H.1D=A.1v.4t(H,K,C.1D.x,H.1D);H.1L=A.1v.4t(H,K,C.1L.x,H.1L)}}if(J=="f9"||J=="5a"){if(C.1D.y!=C.1L.y){N=N.4u(O);H.1D=A.1v.4t(H,O,C.1D.y,H.1D);H.1L=A.1v.4t(H,O,C.1L.y,H.1L)}}A.1v.7N(H,M?N:D);H.2R();A.1v.aC(H);H.Z("2V","30").Z(H.1D);if(J=="f9"||J=="5a"){E=E.4u(["8r","7i"]).4u(O);K=K.4u(["7Z","7b"]);F=N.4u(E).4u(K);H.6W("*[v]").1R(k(){2G=A(b);if(M){A.1v.7N(2G,F)}c Q={15:2G.15(),v:2G.v()};2G.1D={15:Q.15*C.1D.y,v:Q.v*C.1D.x};2G.1L={15:Q.15*C.1L.y,v:Q.v*C.1L.x};if(C.1D.y!=C.1L.y){2G.1D=A.1v.4t(2G,E,C.1D.y,2G.1D);2G.1L=A.1v.4t(2G,E,C.1L.y,2G.1L)}if(C.1D.x!=C.1L.x){2G.1D=A.1v.4t(2G,K,C.1D.x,2G.1D);2G.1L=A.1v.4t(2G,K,C.1L.x,2G.1L)}2G.Z(2G.1D);2G.2a(2G.1L,B.1S,B.q.2t,k(){if(M){A.1v.6j(2G,F)}})})}H.2a(H.1L,{5h:1g,1S:B.1S,2t:B.q.2t,aG:k(){if(L=="2s"){H.2s()}A.1v.6j(H,M?N:D);A.1v.a3(H);if(B.3o){B.3o.1G(b,1H)}H.70()}})})}})(1u);(k(A){A.1v.f7=k(B){l b.5h(k(){c E=A(b);c F=A.1v.6E(E,B.q.4C||"4B");c G=A(B.q.1L);c C=E.1b();c D=A(\'<1p 22="p-1v-f7"></1p>\').3T(1n.2g);if(B.q.8E){D.1I(B.q.8E)}D.1I(B.q.8E);D.Z({u:C.u,t:C.t,15:E.3n()-1h(D.Z("6Y"))-1h(D.Z("93")),v:E.3l()-1h(D.Z("6F"))-1h(D.Z("9A")),1c:"2i"});C=G.1b();fh={u:C.u,t:C.t,15:G.3n()-1h(D.Z("6Y"))-1h(D.Z("93")),v:G.3l()-1h(D.Z("6F"))-1h(D.Z("9A"))};D.2a(fh,B.1S,B.q.2t,k(){D.26();if(B.3o){B.3o.1G(E[0],1H)}E.70()})})}})(1u);',62,1295,'|||||||||||this|var|||||inst|||function|return||||ui|options|||left|top|width||||||||||||||||||||||||||||||css||||||height|||element|datepicker|date|offset|position|target|null|_get|false|parseInt|Math|helper|input|resizable|true|document|else|div|test|size|case|data|jQuery|effects|new|handle|value|break|Date|settings|length|from|year|instance|apply|arguments|addClass|parent|month|to|drawMonth|day|relative|currentHandle|extend|each|duration|drawYear|containment|html|min|dpDiv|disabled|draggable||255|class|getFullYear|call||remove|||for|animate|minDate|max|add|_propagate|axis|body|resize|absolute|cursor|removeClass|maxDate|0px|typeof|getDate|start|nodeName|iFormat|hide|easing|plugin|style|undefined|100|browser|scrollLeft|scrollTop|getMonth|initStatus|showStatus|opacity|ddmanager|child|format|match|px|handles|endYear|stop|click|charAt|pos|stepping|show|inline|helperProportions|originalPosition|overflow|zIndex|grid|rangeStart|numMonths|hidden|currentDay|||||||||progressbar|name|bind|selectedMonth|monthNames|round|se|sw|_getInst|currentYear|nw|outerWidth|ctrlKey|outerHeight|callback|selectedYear|auto|attr|printDate|selectedDay|pageY|currentMonth|isFixed|ne|dayNames|pageX|abs|matches|_defaults|td|slider|dayNamesShort|currentItem|firstDay|positionAbs|accept|shortYearCutoff|droppable|unbind|_adjustDate|triggerHandler|isRTL|get|literal|ghost|appendTo|rangeSelect|snapElements|_pos|margins|_translateValue|_addStatus||lookAhead||_getFormatConfig|documentElement||||dateStr|bar|4px|widget|getTime|msie|parentNode|showAnim|right|cssPosition|none|while|endDay|output|end|constructor|originalSize|iValue|bottom|mouse|default|setTransition|concat|endMonth|alsoResize|current|_updateDatepicker|checkDate|monthNamesShort|effect|mode|markerClassName|onclick|_convertPositionTo|overflowY|period|fixed|rangeElement|isNaN|string|isover|vertical|endDate|over|aspectRatio|formatDate|overflowX|text|_dialogInput|_change|window|tagName|status|scrollSensitivity||scrollSpeed|_convertValue|snap|select||display|defaultDate|handled|button|both|offsetParent|PI|unselectable|append|prototype|focus|queue|_mouseStarted|object|_disabledInputs|_triggerClass|num|dow|stepBigMonths|stepMonths|plugins|_setData|_hideDatepicker|toggle|chars|defaults|transparent|drag|proportionallyResize|_getMinMaxDate|stayOpen|scroll|scope|knobHandles|offsetHeight|hasClass|offsetWidth|128|removeData|dates|previousHandle|textElement|prevBigText|prevText|span|actualSize|showOtherMonths|otherMonth|buttonText|clear|realMax|years|week|today|label|nextBigText||navigationAsDateFormat|_mouseDrag|switch|key|nextText|static|_inDialog|onSelect|widgetName|distance|margin|pow|revert|0pt|type|isout|droppables|scrollLeftParent|restore|PROP_NAME|scrollTopParent|sizeDiff|steps|destroy|val|drop|cell|parents|doy|Show|row|_datepickerShowing|trigger|_getDaysInMonth|dateStatus|obj|yy|dateFormat|_formatDate|setMode|borderLeftWidth|_handleSize|_init|backgroundColor|showBigPrevNext|event|currentText|scrollY|showOn|_mouseStop|exec|toLowerCase|_mouseStart|the|identifier|clickOffset|monthHtml|find|_focus|borderTopWidth|postProcess|dequeue|scrollX|extendRemove|intersect|pixelState||col|active|firstMon|_getNumberOfMonths|prompt|marginRight|option|highlightWeek|split|inlineSettings|buttonImage|next|marginBottom|selectedDate|_handles|siblings|isOver|stack|cssNamespace|_lastInput|days|newMinDate|70158|getDay|utcDate|altFormat|props|borderDif|throw|disableSelection|F0|range|_curInst|_showDatepicker|139|parentData|_mouseCapture|getNumber|percentState|iframeFix|push|hideIfNoPrevNext|containerOffset|save|showMonthAfterYear|selected|number|_mouseUp|minWidth|cancelHelperRemoval|delay|isFunction|cancel|minHeight|sin|marginLeft|_notifyChange|_determineDate|maxDraw|uiHash|names||appendText|daySettings|title|clone|indexOf|beforeShow|replace|blockUI|join|changeFirstDay|showWeeks|weekStatus|beforeShowDay|DD|block|iframe|version|proportions|color|Number|textarea|marginTop|onClose|hasScroll|tzDate|animateClass|closeAtTop|_aspectRatio|img|knob|cssCache|opera|rangeSeparator|_translateRange|className|keyCode|wrapper|moveTo|interval|visible|_translateLimits|wrap|_proportionallyResize|altField|background|continue|Datepicker|keydown|prev|iso8601Week|211|_mouseDestroy|_oneStep|hoverClass|_mouseInit|deactivate|_selectDate|attrValue|activeClass|borderBottomWidth|normal|attrName|maxHeight|shiftKey|slow|mouseDelayMet|dayStatus|dayNamesMin|mm|String|currentDate|preventDefault|calculateWeek|leadDays|formatNumber|Array|firstValue|resizing|_currentClass|percent|_doKeyDown|maxWidth|tr|activate|shortNames|_selectingMonthYear|innerHeight|parseFloat|horizontal|_mouseDownEvent|startDate|innerWidth|borderRightWidth|browserWidth|5625|relOffset|change|sortables|HTML|mousedown|snapping|showCurrentAtPos|_updateRange|unit|sliderValue|setDate|try|192|slide|defaultView|browserHeight|tolerance|catch|map|prepareOffsets|longNames|checkLiteral|containerPosition|absolutePosition|item|scrollHeight|removeWrapper|dragging|sqrt|containerSize|_adjustInstDate|pattern|_doKeyPress|getData|origin|children|parseDate|_disableClass|formatName|Invalid|log|_inlineClass|_setDateFromField|_mouseDistanceMet|gotoDate|_gotoToday|_appendClass|_clearDate|mandatory|widgetEventPrefix|gotoCurrent|||_dialogClass|_promptClass|chr|_mouseUpDelegate|_mainDivId|_getData|_mouseDelayMet|_setDate|createWrapper|getDaysInMonth|_getDate|_tidyDialog|complete|_mouseMoveDelegate|_getDefaultDate|_newInst|x3e|knobTheme|_drag|_findPos|1px|borderTop|_nodeName|pause|documentScroll|originalElement|autohide|textBg|borderLeft|borderRight|_|_out|toString|swing|otherArgs|_over|borderBottom|out|uuid|initialized|progress|handleOffset|_mouseDown|fast|containerElement|cssText|preserveCursor|generated|unwrap|removeChild|rgb|_updateCache|alsoresize|firstChild|_initBoundaries|107|elementOffset|dim|origSize|border|_createRange|169|clientHeight|fxWrapper|getName|_updateAlternate|_helper|backgroundImage|controls|OFFSET_PARENT_NOT_SCROLL_PARENT_X|150|src|_generatePosition|regional|secondary|xa0|cover|after|PAGEX_INCLUDES_SCROLL|scale|dRow|divSpan|daysInMonth|showOptions|_unselectableClass|OFFSET_PARENT_NOT_SCROLL_PARENT_Y|_selectDay|PAGEY_INCLUDES_SCROLL|cacheHelperProportions|dims|_clear|x3c|step|onChange|easeOutBounce|clientWidth|overflowXOffset|sortable|asin|_isInRange|_canAdjustMonth|overflowYOffset|_opacity|_cursor|_clickMonthYear|original|_selectMonthYear|setData|_zIndex|onmouseout|up|onmouseover|Class|_checkOffset|empty|_start|placeholder|andSelf|droppablesLoop|shouldRevert|connectToSortable|release|snapMode|snapItem|_activate|_drop|solid|8px|1000|F2F2F2|greedyChild|_deactivate|greedy|dropBehaviour|setContainment|MozUserSelect|selectstart|on|5000px|widgetBaseClass|metadata|getterSetter|_mouseUnselectable|_mouseMove|cursorAt|cacheScrollParents|adjustOffsetFromHelper|createHelper|getHandle|mousemove|mouseup|defaultTheme|_renderAxis|Select|debug|_connectDatepicker|different|May|Close|previous|buttonImageOnly|alt|keypress|err|charCode|dateText|_dialogInst|before|_inlineDatepicker||getter|_stop|autoHide|scrollWidth|href|_renderProxy|_respectSize|originalMousePosition|_updateRatio|blur|||startValue|_getRange|_handleIndex|_pageStep|_removeRange|_click|_keydown|_blur|_isDisabledDatepicker|origYear|thead|isMultiMonth|numRows|_changeFirstDay|getComputedStyle|weekHeader|currentStyle|index|setUTCDate|_generateMonthYearHeader|float|changeMonth|table|tbody|getUTCDate|padding|statusForDate|144|fade|center|closeStatus|fontSize|clearText|_generateHTML|clearStatus|closeText|middle|filter|currentStatus|direction|nextStatus|prevBigStatus|prevStatus|monthStatus|224|curMonth|curYear|_getFirstDayOfMonth||isArray|safari|slice|_checkExternalClick|onchange|checkRange|easeOutQuad|minMax|numberOfMonths||onChangeMonthYear|def|yearStatus||cos|_attachDatepicker|enable|changeYear|yearRange|textClass|inMaxYear|storage|inMinYear|easeInBounce|increment|525|setTimeout|disable|_animate|165|_interval|delete|paddingTop|nextBigStatus|_possibleChars|getYear|len|100px|cssUnit|toggleClass|_toggleClass|morph|140|240|trim|iInit|Missing|rgba|245|elem|Year|paddingBottom|_removeClass|Month|_show|230|transfer|__toggle|content|getBaseline|paddingLeft|paddingRight|origMonth|_addClass|_hide|offsetNumeric|animation|offsetString|148|dragstart|darkviolet|darksalmon||233|122|fuchsia|gold|pink|easeInOutQuad|203|easeInCubic|sortactivate||purple|violet||yellow|white|silver|jswing|easeInQuad|easeOutCubic|easeInOutCubic|153|darkorchid|darkolivegreen|refreshPositions|red|darkorange|darkmagenta|204|darkred|Bottom|canvas|proxy|216|193|zoom|lightyellow|173|808080|DEDEDE|238|lightcyan|lightgreen|easeInQuart|lightgrey|182|lightpink|all|lightblue|navy|green|indigo|olive|mouseover|hover|orange|Left|Right|130|khaki|Top|lime|maroon|magenta|215|easeOutCirc|TAB|SPACE|UP|inArray|eventPrefix|substring|SHIFT|RIGHT|PAGE_DOWN|109|PAGE_UP|PERIOD|190|_trigger|fix|puff|mozilla|removeAttribute|ffff99|highlight|box|_mouseDelayTimer|enableSelection|gen|off|started|which|NUMPAD_SUBTRACT|106|188|COMMA|CONTROL|DELETE|DOWN|CAPS_LOCK|BACKSPACE|dir|visibility|expr|tabbable|tabIndex|END|ENTER|111|NUMPAD_DIVIDE|NUMPAD_ENTER|108|NUMPAD_MULTIPLY|110|NUMPAD_DECIMAL|HOME|ESCAPE|INSERT|LEFT|NUMPAD_ADD|invalid|valid|makeArray|fromSortable|group|sort|easeOutSine|easeInOutSine|easeInExpo|easeOutExpo|toSortable|easeInOutCirc|183|easeInCirc|easeInOutExpo|splice|dropover|pointer|easeOutQuint|easeInQuint|touch|easeInOutQuart|fit|easeInOutQuint|not|dropout|easeInSine|dropactivate|dropdeactivate|easeInElastic|containerCache|bounce|times|easeInOutBounce|984375|625|250|001|500|revertDuration|neg|down|fff|items|snapTolerance|sortreceive|easeInOutElastic|sender|receive|easeOutElastic|_refreshItems|easeInBack|9375|inner|outer||easeInOutBack||easeOutBack|easeOutQuart|aqua|Th|Fr|Sa|Set||189|Tu|Fri|Sat||Su|Mo|first|hasDatepicker|other|ceil|_inlineShow|_dialogDatepicker|javascript|header|console|setDefaults|getAttribute|eval|Thu|Wed|Nov|Dec|Wk|Week|Oct|Sep|Apr|Jun|Jul|Aug|of|Sunday|Saturday|Sun|Mon|Tue|Friday|Thursday|Monday|Tuesday|Wednesday|cellspacing|cellpadding|ATOM|Unexpected|Unknown|86400000|COOKIE|ISO_8601|RFC_1036|rtl|RFC_850|RFC_822|floor|getTimezoneOffset|fadeIn|fadeOut|draw|unblockUI|slideUp|slideDown|nodeType|nextSibling|noWeekends|selectedIndex|multi|RFC_1123|prepend|close|control|_changeDatepicker|9999|_disableDatepicker|one|_destroyDatepicker|links|_enableDatepicker|_refreshDatepicker|_setDateDatepicker|W3C|TIMESTAMP|RSS|RFC_2822|1000px|0123456789|_getDateDatepicker|stopPropagation|fromCharCode|Mar|We|noKeyboard|instanceof|replaceWith|brown|blue|outline|black|cyan|font|Height|200|Width|darkgrey|darkblue|darkcyan|220|method|outlineColor|borderTopColor|borderRightColor|Feb|animateDuration|state|animateEasing|borderLeftColor|borderBottomColor|switchClass|Function|beige|azure|pt|curCSS|3000|Moz|Today|January|February|March|Next|setHours|setMinutes|without|Prev|300|darkkhaki|November|December|Jan|October|September|June|July|August|Erase|April|isDisabled|setMilliseconds|random|back|startTime|setSeconds|darkgreen|Clear|dialog'.split('|'),0,{}))
// 
/*  */

// Main library file 
// Contains all functions used by two or more widgets,
// Contains the main initialization and widget management code

/*  */

//
// START Global Initialization code
//

window.widget_manager = null;
$(document).ready(
	function ()
	{
		window.widget_manager = new WidgetManager( window.widget_names );
		if ( window.widget_roots && window.widget_roots.length > 0 )
		{
			for ( var i in window.widget_roots )
			{
				// Initialize widgets at one or more specific root points
				// This option is here for perfomance reasons: it can make
				// a huge difference on a big page with few localized widgets,
				// e.g. admin interface
				init_widgets( window.widget_roots[i] );
			}
		}
		else
		{
			// Initialize the widgets starting from the root
			init_widgets( document.body );
		}
		$( window ).unload( 
			function ()
			{
				// There might be things to save at 
				// the moment a user clicks a link
				window.widget_manager.stopAll();
			}
		);		

		// check if modifier keys influence a link
		modifier_keys();
	}
);

// check if modifier keys influence a link
function modifier_keys( url )
{
	if ($('#editpage'))
	{
		// check if editpage button is clicked
		// if shift key is clicked, use the admin page in new window
		$('#editpage').click(
			function(e)
			{
				if (e.shiftKey && $('#editpage').attr('rel')) 
				{
					uri = $('#editpage').attr('rel');
					win = window.open('','_blank');
					win.location.href = uri;
					return false;
				}
			}
		); 
	}
}

// External callback for the widget 
function widget_save_redir( url )
{
	var n = window.widget_manager.stopAll();
	var t = n > 0 ? 2000 : 1; 
	setTimeout( 
		function ()
		{
			location.href = url;
		},
		t
	);
}

// Start widgets inside a given element/css selector
function init_widgets( context )
{                    
	var x = $( context ).get(0);
	x && window.widget_manager.startWidgets( x );
}

// CLASS WidgetManager
// Handles the inter-widget communication
function WidgetManager( widget_names )
{
	this.widgetNames 	= widget_names;
	this.currentWidgets = {};
	this.allWidgets 	= {};
}

// Return all widgets of a given type
WidgetManager.prototype.widgets = function ( name )
{
	return this.allWidgets[name];
};

// Make the Widget Manager aware of a new widget instance
WidgetManager.prototype.add = function ( name, w )
{
	this.allWidgets[name] = this.allWidgets[name] || [];
	this.allWidgets[name].push( w );
};

// Select all the widget instances of types defined in ws
// that match predicate function f
WidgetManager.prototype.find_all = function ( f, ws )
{
	ws = ws || ['editinplace','editatonce'];
	var rt = [];
	for ( var i in ws )
	{
		var a = this.allWidgets[ws[i]] || [];
		
		for ( var j in a )
		{
			if ( f( a[j] ) )
			{
				rt.push( a[j] );
			}
		}
	}
	return rt;
};

// Finds the first element belonging to one of the types 
// defined in ws that matches predicate function f
WidgetManager.prototype.find = function ( f, ws )
{
	ws = ws || ['editinplace','editatonce'];
	for ( var i in ws )
	{
		var a = this.allWidgets[ws[i]] || [];
		
		for ( var j in a )
		{
			if ( f( a[j] ) )
			{
				return a[j];
			}
		}
	}
	return null;
};

// Returns the current/active widget of type name
WidgetManager.prototype.current = function ( name )
{
	return this.currentWidgets[name];
};

// Stop (blur) all widgets. Used for e.g when the page is unloading
WidgetManager.prototype.stopAll = function ()
{
	var count = 0;
	for ( var name in this.currentWidgets )
	{
		var w = this.currentWidgets[name];
		if ( w )
		{
			if ( w.widgetBlur( name, null ) )
			{
				count += 1;
			}
		}
	}
	return count;
};

// Stop the current/active widget instance of type name
WidgetManager.prototype.stop = function ( name )
{
	var w = this.currentWidgets[name];
	w && w.widgetBlur( name, null );
};

// Defined a widget instance as the new current/active element
// fot the widget type name
WidgetManager.prototype.widgetFocus = function ( name, obj )
{
	for ( i in this.currentWidgets )
	{
		var w = this.currentWidgets[i];
		w.widgetBlur && w.widgetBlur( name, obj );
	}
	
	this.currentWidgets[name] = obj;
};

// Main widget initialization function
// Does a traversal of the tree that starts at root, checking
// the css classes of all elements for the do_<widgetname> pattern
// that matches one of the allowed types defined in window.widgetNames
WidgetManager.prototype.startWidgets = function ( root )
{
	var stack = [root];
	var names = this.widgetNames;
	var names_do = {};
	for ( var i in names )
	{
		names_do['do_' + names[i]] = names[i];
	}
	
	while ( stack.length > 0 )
	{
		var e = stack.pop();
		if ( e.className && e.className.match( /do_[a-z_]+/ ) )
		{
			// Note: IE6 does not recognize the \b escape char 
			// (whitespace in js regexps)
			var clsss = e.className.match( /do_[a-z_]+/g );
			for ( var i = 0; i < clsss.length; i++ )
			{
				var w = names_do[clsss[i]];
				if ( w )
				{
					eval("init_" + w + "( e )");
				}
			}
		}
		
		if ( e.childNodes ) 
		{
			for ( var i = 0 ; i < e.childNodes.length ; i++ )
			{
				if ( e.childNodes[i].nodeType != 3 )
				{
					// Only process if not a text node
					stack.unshift( e.childNodes[i] );
				}
			}
		}
	}
	
	var ends = ['editinplace','editatonce'];
	for ( var i in ends )
	{
		if ( jQuery.inArray( ends[i], names ) > -1)
		{
			eval( 'end_' + ends[i] + '()' );
		}
	}
};

// Convert the name of a validated field into a 
// string usable as a dom id attribute
function validate_field2id ( name )
{
	name = name.replace( /\./g, "_" );
	return 'required_fields_li_' + name;
}

function validate_cmpfield ( l )
{
	return function ( x ) 
	{
		return jQuery.inArray( x.options.ajax.field, l ) > -1; 
	}
}

// Scroll down/up the window to make visible the edit place of 
// a given validate field that was incorrect or missing
function validate_goto ( i )
{
	var e = window.widget_manager.find( validate_cmpfield( [i] ) );
	if ( e )
	{
		var p = jQuery.getPosition( e.container );
		scroll( 0, p.y - 100 );
	}
}

// Update the validate fields error information
function validate_update ()
{
	if ( jQuery.isEmptyObject( window.required_fields ) )
	{
		$( "#required_fields_main"  ).hide();
		$( "#required_fields_other" ).show();
		return;
	}
	
	$( "#required_fields_main" ).show();
	$( "#required_fields_other" ).hide();
	
	var fs = window.required_fields;
	var ul = $( "#required_fields_list" ).get( 0 );
	ul.innerHTML = '';
	var bind_click = function ( li, i )
	{
		var fu = function ( x ) 
		{ 
			return x.options.ajax.field == i; 
		};

		var e = window.widget_manager.find( fu );

		if ( e && e.options )
		{
			var c = e.options.callback;
			c = c || function () {};

			var fc = function ( d )
			{
				delete( window.required_fields[i] );
				validate_update();
				c && c( d );
			}

			e.options.callback = fc;
			
			$( li ).bind( "click",
				function () 
				{
					validate_goto( i );
					return false;
				}
			);
		}
	};
	
	var gs = jQuery.objKeys( fs );
	var fu = validate_cmpfield( gs );
	var ws = window.widget_manager.find_all( fu );
	for ( var i in ws )
	{
		ws[i].addRequiredClass();
	}
	
	for ( var i in fs )
	{
		var li = document.createElement( "li" );
		var an = document.createElement( "a" );
		li.id = validate_field2id( i );
		li.className = "required_field_title";
		an.href='#';
		$( an  ).html( fs[i] );
		$( li ).append( an );
		$( ul ).append( li );
		bind_click( an, i );
	}
}

// Used by all widgets. Override the default widget 'docs' 
// options with those 'o' specific for this instance
function apply_options( docs, o )
{
	for ( var i in docs )
	{
		var d	= docs[i];
		var ds	= d[0].split('.');
		if ( ds.length > 1 )
		{
			o[ds[0]][ds[1]]	= (typeof o[ds[0]][ds[1]] != 'undefined') ? o[ds[0]][ds[1]]	: d[1];
		}
		else
		{
			o[d[0]]			= (typeof o[d[0]] != 'undefined') 		  ? o[d[0]] 		: d[1];
		}
	}
	return o;
}


//
// END Global Initialization code
//

// Identity function
function identity ( x )
{
	return x;
}

jQuery.fn.opacity = function ( v )
{
	this.css('opacity', v );
	if ( jQuery.browser.msie ) 
	{
		this.css('filter', 'alpha(opacity=' + v * 100 + ')');
	}
}

jQuery.extend( {
	
	objKeys: function ( obj )
	{
		var ret = [];
		for ( var i in obj )
		{
			ret.push( i );
		}
		return ret;
	},
	
	label: function ( path, def )
	{
		var names 	= path.split('.');
		var tmp 	= window.labels;

		while ( names.length > 0 && tmp )
		{
			tmp = tmp[names.shift()];
		}

		return tmp || def;
	},
	
	// Create a new cookie
	// @param	name	string		name of the cookie
	// @param	value	string		value to be stored
	// @param	days	int			expiry time in days
	createCookie: function ( name, value, days )
	{
		if ( days ) 
		{
			var date = new Date();
			date.setTime( date.getTime() + ( days * 24 * 60 * 60 * 1000 ) );
			var expires = "; expires=" + date.toGMTString();
		}
		else
		{
			var expires = "";
		}
		document.cookie = name + "=" + value+expires + "; path=/";
	},

	// Read the value of a cookie
	readCookie: function ( name )
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split( ';' );
		for ( var i = 0 ; i < ca.length ; i++ )
		{
			var c = ca[i];
			while ( c.charAt(0) == ' ' )
			{
				c = c.substring( 1, c.length );
			}
			
			if ( c.indexOf( nameEQ ) == 0 ) 
			{
				return c.substring( nameEQ.length, c.length );
			}
		}
		return null;
	},

	// Delete a cookie
	eraseCookie: function( name )
	{
		jQuery.createCookie( name, "", -1 );
	},
	
	// Use the log function of firebug without messing with other browsers 
	log: function () 
	{
		if ( window.console && window.console.log && window.console.assert )
		{
			window.console.log( arguments );
		}
	},
	
	warn: function(where, what)
	{
		if(!what)
		{
			what = "You cannot edit this now.";
		}
		
		anyRest.notifications.add(where+': '+what, 'notice');
	},
	
	error: function ( msg , url , line ) 
	{
		alert( msg + " @ " + url + " @ " + line );
		return false;
	},
	
	// Encode object for get/post request: works with arbitrarily-leveled-nested 
	// arrays and objects. Adapted from PHP (any_functions' http_build_query)
	//
	xparam: function (params)
	{
		var encoder_f = function (f, name, value, sep, uri)
		{
			if (value.constructor == Array)
			{
				for ( var i = 0 ; i < value.length ; i++ )
				{
					f(f, name + '[' + i + ']', value[i], sep, uri);
				}
			}
			else if ( value.constructor == Object )
			{
				for ( var i in value )
				{
					f(f, name + '[' + i + ']', value[i], sep, uri);
				}
			}
			else
			{
				uri.uri += sep.sep + name + '=' + encodeURIComponent(value);
				sep.sep = '&';
			}
		};

		// Hack for simulating call-by-reference in JavaScript
		var sep = {sep:''};
		var uri = {uri:''};

		for ( var i in params )
		{
			encoder_f(encoder_f, i, params[i], sep, uri);
		}

		return uri.uri;
	},
	
	// Get the window size
	windowSize: function ()
	{
		var p = { w: 0, h: 0 };
        var e = document.documentElement;
        var b = document.body;

		if ( typeof( window.innerWidth ) == 'number' )
		{
		  //Non-IE
		  p.w = window.innerWidth;
		  p.h = window.innerHeight;
		}
		else if( e && ( e.clientWidth || e.clientHeight ) )
		{
		  //IE 6+ in 'standards compliant mode'
		  p.w = e.clientWidth;
		  p.h = e.clientHeight;
		}
		else if( b && ( b.clientWidth || b.clientHeight ) )
		{
		  //IE 4 compatible
		  p.w = b.clientWidth;
		  p.h = b.clientHeight;
		}	
		
		return p;
	},
	
	mousePosition: function ( ev )
	{
		ev = ev || window.event;

		var x = 0, y = 0;

		if ( ev.pageX || ev.pageY )
		{
			x = ev.pageX;
			y = ev.pageY;
		}
		else if ( ev.clientX || ev.clientY )
		{
			x = ev.clientX + document.body.scrollLeft;
			y = ev.clientY + jQuery.pageScrollTop(); //document.body.scrollTop;
		}

		return { "x": x, "y": y };
	},
	
	// Coordinates of mouse in relation to the window 
	mouseInWindow: function ( e )
	{
		var ret = {};
		if ( !e )
		{
			var e = window.event;
		}
		
		if ( e.clientX || e.clientY )
		{
			ret.x = e.clientX - Math.max( 0 , document.body.scrollLeft );
			ret.y = e.clientY - Math.max( 0 , document.body.scrollTop ); // document.body.scrollTop*/  + document.documentElement.scrollTop;
		}
		return ret;
	},
	
	// Override r with properties from object a
	assocMergeInto: function ( r , a ) 
	{
		if ( a )
		{
			for( var i in a )
			{
				r[i] = a[i];
			}
		}
		return r;
	},
	
	// Merge two objects (properties of the second 
	// argument override those of the first), result is a new 
	// object in memory
	assocMerge: function ( a , b ) 
	{
	 	return jQuery.assocMergeInto( jQuery.assocMergeInto( {}, a ),  b );
	},
	
	// Output a datetime 
	dateFormat: function ( format , date )
	{
		format = format.replace( /\%Y/ , date.getFullYear() );
		format = format.replace( /\%m/ , date.getMonth() + 1 );
		format = format.replace( /\%d/ , date.getDate() );
		format = format.replace( /\%H/ , date.getHours() );
		format = format.replace( /\%M/ , date.getMinutes() );
		return format;
	},

	// Remove a parameter from the url
	remFromQuery: function ( url , name ) 
	{
		var reg = new RegExp( '&?' + name + '=[^&]*' );
		url = url.replace( reg, '' );
		return url;
	},
	
		
	// Add some query data to a url
	addToQuery: function ( url , data ) 
	{
		return url + ( url.match( /\?/ ) ? '&' : '?' ) + data;
	},
	
	// Parse options given inside the attribute of an element
	attrOptions: function ( e , name )
	{
		var a = e.getAttribute( name ) || '';
		a = a.replace( /,\s*$/ , '' );
		eval( "var tmp = {" + a + "}" );
		return tmp;
	},

	// DEPRECATED: Vertical scroll offset in pixels 
	pageScrollTop: function ()
	{
        var pos = jQuery.getScroll();
        return pos.y;
	},
    
    getScroll: function ()
    {
        var p = {x: 0, y: 0};
        var e = document.documentElement;
        var b = document.body;

        if ( e && ( e.scrollLeft || e.scrollTop ) ) 
        {
            p.x = e.scrollLeft;
            p.y = e.scrollTop;
        
        }
        else if ( b && ( b.scrollLeft || b.scrollTop ) ) 
        {
            p.x = b.scrollLeft;
            p.y = b.scrollTop;
        }
        else if ( window.pageXOffset || window.pageYOffset )
        {
            p.x = window.pageXOffset;
            p.y = window.pageYOffset;
        }
        else if( window.scrollX || window.scrollY ) 
        {
            p.x = window.scrollX;
            p.y = window.scrollY;
        }
        return p;
    },


	// Calculate x,y position of a given dom element
	getPosition: function ( obj, ignoreRelative )
	{
        ignoreRelative = ignoreRelative || false;

		var curleft = curtop = 0;

		// Hack for IE not needed ?
		// Not sure but this check for IE gave problems in the end
		// Keep the if in until we're sure that it is not needed
		if ( false && jQuery.browser.msie )
		{
			// Hack for IE, naturally
			var childImg = false;
			for ( var i in obj.childNodes )
			{
				childImg = childImg || obj.childNodes[i].tagName == 'IMG';
			}

			if ( childImg )
			{
				curleft -= obj.offsetLeft;
			}
		}

		while ( obj )
		{                                        
			if ( !ignoreRelative || jQuery( obj ).css('position') != "relative" )
			{
				curleft += obj.offsetLeft;
				curtop  += obj.offsetTop;
			}
			obj = obj.offsetParent;
		}
		return { x: curleft, y: curtop };
	},
	
	// Calculate dimensions of a dom element
	getSize : function(e)
	{
		var w = jQuery.css(e,'width');
		var h = jQuery.css(e,'height');
		var wb = 0;
		var hb = 0;
		es = e.style;
		
		if ( jQuery(e).css('display') != 'none' ) 
		{
			wb = e.offsetWidth;
			hb = e.offsetHeight;
		}
		else
		{
			oldVisibility = es.visibility;
			oldPosition = es.position;
			es.visibility = 'hidden';
			es.display = 'block';
			es.position = 'absolute';
			wb = e.offsetWidth;
			hb = e.offsetHeight;
			es.display = 'none';
			es.position = oldPosition;
			es.visibility = oldVisibility;
		}
		return { w:w, h:h, wb:wb, hb:hb };
	},
	
	// Get an object position from the upper left viewport corner
	elemInWindow: function ( o )
	{
		// Get the positions from the parent object
		var oLeft = o.offsetLeft;            
		var oTop  = o.offsetTop;            

		// Parse the parent hierarchy up to the document element
		while( o.offsetParent != null )
		{   
			oParent	 = 	o.offsetParent;		// Get parent object reference
			oLeft	+=	oParent.offsetLeft;	// Add parent left position
			oTop	+=	oParent.offsetTop;	// Add parent top position
			o = oParent;
		}
		
		return { l: oLeft , t: oTop };
	},

	validateForm: function ( frm , alrt )
	{
		if ( document.getElementById( frm ) )
		{
			var f = document.getElementById( frm );
		}
		else if ( document.forms[ frm ] )
		{
			var f = document.forms[ frm ];
		}
		else
		{
			f = frm;
		}

		if ( alrt == 'null' )
		{
			alrt = 'All fields are required';
		}

		var isValid		= true;
		var	vFormElems	= new Array();

		for ( i = 0 ; i < f.elements.length ; i++ ) 
		{
			elem  = f.elements[i]; 


			vCode = ( elem['alt'] ) ? elem['alt'] : elem.getAttribute('alt');

			if ( !( typeof vCode == 'undefined' || vCode == null || vCode == "" ) )	
			{
				if ( jQuery.inArray( elem.name, vFormElems ) > -1)
				{
					break;
				}
				else
				{
					v = jQuery.getValue( f.elements[elem.name] );

					if ( vCode == 'required' && v.length < 1 ) 
					{
						isValid = false;
					}
					vFormElems[i] = elem.name;
				}
			}
		}
		if (!isValid) 
		{
			alert( alrt );
		}
		return isValid
	},

	// Returns value of a formfield
	getValue: function ( ffield , def )
	{
		v = '';
		t = ffield.type;
		
		if( !t ) 
		{
			t = ffield[0].type;
		}

		if( t == 'checkbox' )
		{
			if( ffield.length )
			{
				for( gv_i=0 ; gv_i < ffield.length ; gv_i++ )
				{
					if ( ffield[gv_i].checked ) 
					{
						v = ffield[gv_i].value;
					}
				}
			}
			else
			{
				if ( ffield.checked ) 
				{
					v = ffield.value;
				}
			}	
		} 
		else if ( t == 'file' )		v = ffield.value;
		else if ( t == 'hidden' )	v = ffield.value;
		else if ( t == 'password' ) v = ffield.value;
		else if ( t == 'radio' ) 
		{
			if ( ffield.length ) 
			{
				for ( gv_i=0 ; gv_i < ffield.length ; gv_i++) 
				{
					if ( ffield[gv_i].checked ) v = ffield[gv_i].value;
				}
			}
			else
			{
				if ( ffield.checked ) v = ffield.value;
			}	
		} 
		else if (t == 'select-multiple' ) v = ffield.options[ffield.selectedIndex].value;
		else if (t == 'select-one' )	  v = ffield.options[ffield.selectedIndex].value;
		else if (t == 'text' )			  v = ffield.value;
		else if (t == 'textarea' )		  v = ffield.value;
		
		if (def != null && v == '')
		{
			return def;
		}
		return v;
	},
	
	byId: function ( id , doc ) 
	{
		if ( typeof id == "string" || id instanceof String ) 
		{
			if ( !doc )
			{
				doc = document;
			}
			return doc.getElementById ( id );
		}
		// assume it's a node
		return id; 
	},

	textContent: function ( node ) 
	{
		var _result = "";
		if (node == null)
		{ 
			return _result;
		}
		
		for (var i = 0; i < node.childNodes.length; i++) 
		{
			switch (node.childNodes[i].nodeType) 
			{
				case 1: // ELEMENT_NODE
				case 5: // ENTITY_REFERENCE_NODE
					_result += jQuery.textContent(node.childNodes[i]);
					break;
				case 3: // TEXT_NODE
				case 2: // ATTRIBUTE_NODE
				case 4: // CDATA_SECTION_NODE
					_result += node.childNodes[i].nodeValue;
					break;
				default:
					break;
			}
		}
		return _result;
	},

	// used in form validator
	// maybe change in the future
	isEmailAddress: function ( v ) 
	{
		mailvalid = true;
		if ( v.indexOf ( '@' ) < 1 )
		{
			mailvalid = false;
		}
		else if ( v.lastIndexOf ( '.' ) < v.indexOf ( '@' ) ) 
		{
			isvalid = false;
		}
		aapje  = v.indexOf( '@' ); 
		puntje = v.indexOf( '.' );  
		if ( puntje - aapje == 1 ) 
		{
			mailvalid = false;
		}
		return mailvalid;
	},

	// used in form validator
	// maybe change in the future
	isSizeSmaller: function ( v , size ) 
	{
		if ( v.length < size )
		{
			return true;
		}
		else
		{
			return false;
		}
	},

	// used in form validator
	// maybe change in the future
	isSizeGreater: function ( v , size ) 
	{
		if ( v.length > size )
		{
			return true;
		}
		else
		{
			return false;
		}
	},

	// showhide functions
	// used while rest call state is failed/ok/wait
	showHide: function (str)
	{
		a = str.split(',');
		for ( var i = 0 ; i < a.length ; i++ ) 
		{
			s = a[i];
			c = s.charAt(0);
			v = 'block';
			
			if (c == '-') 
			{
				v = 'none';
				s = s.substr( 1 , s.length-1);
			}
			else if ( c == '+') 
			{
				s = s.substr( 1 , s.length - 1 );
			}
			
			if ( $( "#" + s ) ) 
			{
				$("#" + s).css( 'display', v );	
			}
		}
	},

	// Hide all obj in an array or string and optionally show obj b (can be an array)
	// Parameters:	a	which obj to hide (can be an array) 				
	//				b	which obj should openend afterwards (hide all but ...)(can be an array)
	//				s	if s = true search for objects starting with the string 'a'
	hideAllBut: function ( a, b ) 
	{
		if ( jQuery.isObject( a ) )
		{
			for ( var p in a ) 
			{
				$( "#" + a[p] ).hide(); 
			}
		}
		else if ( jQuery.isArray(a) )
		{
			for ( i = 0 ; i < a.length ; i++ )
			{
				$( "#" + a[i] ).hide(); 
			}
		}
		else if ( jQuery.isString( a ) )
		{
			var d = document.getElementsByTagName( 'div' );
			for( i = 0 ; i < d.length ; i++ )
			{
				var l = a.length;
				var id = d[i].id;
				if ( id.substring( 0 , l ) == a )
				{
					$( "#" + d[i].id ).hide(); 
				}
			}
		}
		
		if ( jQuery.isArray( b ) )
		{
			for ( i = 0 ; i < a.length ; i++) 
			{
				$( "#" + b[i] ).show();
			}
		}
		else if ( jQuery.isString( b ) ) 
		{
			$( "#" + b ).show();
		}
	},
		
	
	popup: function ( thg_id, o, l, t, w, h ) 
	{ 
		if ( l == null ) l = 100;
		if ( t == null ) t = 100;
		if ( w == null ) w = 400;
		if ( h == null ) h = 400;

		var aPopupWin = window.open( '', 'PopupWin', 'scrollbars=yes,menubar=no,location=no,directories=no,statusbar=no,toolbar=no,resizable=yes,width=' + w + ',height=' + h + ',top=' + t + ',left=' + l );
		aPopupWin.document.open(); 
		aPopupWin.document.close();
		order = '';
		if ( o != null ) order = '&order='+o;
		var p = 'popup.php?id=' + thg_id + order;

		aPopupWin.document.location.href = p;
		if( aPopupWin && !aPopupWin.closed )
		{
			aPopupWin.focus();
		}	
	},

	resizePopup: function()
	{
		var mw = 400;

		if ( parseInt( navigator.appVersion.charAt( 0 ) ) >= 4 )
		{
			NN = ( navigator.appName=="Netscape" ) ? 1 : 0;
		}

		if ( document.images[0] )
		{
			ww = ( screen.width  );
			wh = ( screen.height );

			if (NN)
			{
				rw = document.images[0].width + 80;
				rh = document.images[0].height;
				if ( ww < rw ) rw = ww;
				if ( rw < mw ) rw = mw;
				if ( wh < rh ) rh = wh;
				if ( rh < wh - 140 ) rh = rh + 160;
				window.top.innerWidth  = rw;
				window.top.innerHeight = rh;
			}
			else
			{
				rw = document.images[0].width + 80;
				rh = document.images[0].height;
				if ( ww < rw ) rw = ww;
				if ( rw < mw ) rw = mw;
				if ( wh < rh ) rh = wh;
				if ( rh < wh - 140 ) rh = rh + 160;
				window.top.resizeTo( rw, rh );
			}
			parent.window.moveTo( ( screen.width - rw ) / 2, ( screen.height - rh ) / 2 );
		}
	},

	// helper function
	isAlien: function ( a ) 
	{
		return jQuery.isObject(a) && typeof a.constructor != 'function';
	},

	isArray: function ( a ) 
	{
		return jQuery.isObject(a) && a.constructor == Array;
	},

	isBoolean: function ( a ) 
	{
		return typeof a == 'boolean';
	},
	
	isEmptyObject: function ( o )
	{
		for ( var i in o )
		{
			return false;
		}
		return true;
	},

	isEmpty: function(o) 
	{
		var i, v;
		if (jQuery.isObject(o)) 
		{
			for (i in o) 
			{
				v = o[i];
				if (jQuery.isUndefined(v) && jQuery.isFunction(v)) 
				{
					return false;
				}
			}
		}
		return true;
	},

	isFunction: function ( a ) 
	{
		return typeof a == 'function';
	},

	isNull: function ( a ) 
	{
		return typeof a == 'object' && !a;
	},

	isNumber: function ( a ) 
	{
		return typeof a == 'number' && isFinite(a);
	},

	isObject: function ( a ) 
	{
		return (a && typeof a == 'object') || jQuery.isFunction(a);
	},

	isString: function ( a ) 
	{
		return typeof a == 'string';
	},

	isUndefined: function ( a ) 
	{
		return typeof a == 'undefined';
	},

	isDomElement: function ( a ) 
	{
		return a && typeof a == 'object' && !jQuery.isUndefined(a.childNodes);
	},
	
	truncate: function(string, chars, after)
	{
		if (string.length <= chars)
		{
			return string;
		}
		
		if (typeof after == 'undefined')
		{
			after = '&hellip;';
		}
		
		string = string.substring(0, chars);
		string = string.replace(/\w+$/, '');
		 
		var re  = new RegExp('[ 	\.\,\:\;\!\?]+$', 'g');
		string  = string.replace(re, '');
		string += ' ' + after;
		
		return string;
	}
});

// CLASS AjaxNotice
function AjaxNotice( sel )
{
	this.sel = sel;
}

// Start the notice
AjaxNotice.prototype.start = function ( text )
{
	if ( text == '...' )
	{
		text = '<img src="http://static.mediamatic.nl/f/smpz/image/throbberdots.gif" />';
	}
	
	text && notice_corner_show( text );
	$( this.sel ).addClass( 'ajax_notice' );	
}

// Stop the notice
AjaxNotice.prototype.stop = function ()
{
	notice_corner_hide();
	$( this.sel ).removeClass( 'ajax_notice' );
}

// Make corner notices have unique ids so that timeout events
// only act if the instance that triggered them is still active
window.notice_corner_count = 0;

// Show the notice in the corner of window
function notice_corner_show ( text )
{
	window.notice_corner_count += 1;
	var x = document.getElementById( 'corner_notice' );
	if ( !x )
	{
		x = document.createElement( 'div' );
		x.id = 'corner_notice';
		$( document.body ).append( x );
	}
	$( x ).html( text );
	$( x ).fadeIn(400);
	
	window.notice_corner_time = (new Date()).getTime();
}

// Hide the notice in the corner of window
function notice_corner_hide ()
{
	window.notice_corner_count -= 1
	if ( window.notice_corner_count > 0 )
	{
		return;
	}
	else
	{
		window.notice_corner_count = 0;
	}
	var now = (new Date()).getTime();
	var dif = now - window.notice_corner_time;
	if ( dif > 1000 )
	{
		$( '#corner_notice' ).fadeOut(400);
	}
	else
	{
		setTimeout(
			function () 
			{
				notice_corner_hide();
			},
			dif
		);
	}
}


// External callback for the documentation functions
function docs_validate()
{
	var lm = jQuery.label( 'editinplace.validate.msg'	, 'Please input a valid value' );
	var lo = jQuery.label( 'editinplace.validate.out'	, 'Value out of range'  );
	
	return { opts:	
		[[ "validate",			{},			"Input format validation" ]
		,[ "validate.regexp",	null,		"Regular expression to validate format" ]
		,[ "validate.name",		null,		"Name of predefined regular expression [integer|float]" ]
		,[ "validate.msg",		lm,			"Alert message to be displayed in case of wrong format" ]
		,[ "validate.min",		null,		"Minimum allowed value" ]
		,[ "validate.max",		null,		"Maximum allowed value" ]
		,[ "validate.empty",	false,		"Input value is allowed to be empty" ]
		,[ "validate.blank",	false,		"Input value is allowed to be empty/whitespace" ]
		,[ "validate.out",		lo,			"Alert message to be displayed in case of out of range number" ]
		]
	};
}

// CLASS Validate
// Used by EditAtOnce and EditInPlace to validate 
// the presence or format of some fields
function Validate( opts )
{
	this.opts = opts;
	if ( "integer" == this.opts.name )
	{
		this.opts.msg		= jQuery.label( 'editinplace.validate.integer'	, 'Please input an integer number' );
		this.opts.regexp	= /^\s*[-+]?\d+\s*$/;
	} 
	else if ( "float" == this.opts.name )
	{
		this.opts.msg		= jQuery.label( 'editinplace.validate.float'	, 'Please input a number' );
		this.opts.regexp	= /^\s*[-+]?\d+(\.\d+)?\s*$/;
	}
}

// Is the value inside this range?
Validate.prototype.range = function ( value )
{
	var fs 	= {'integer': parseInt, 'float': parseFloat};
	var f 	= fs[this.opts.name] || identity;
	value = f( value );
	
	return 	!(	this.opts.min && this.opts.min > value  
			||	this.opts.max && this.opts.max < value );
}

// Is the value not empty?
Validate.prototype.value = function ( value )
{	
	return ( this.opts.blank && value.match( /^\s*$/ ) )
		|| ( this.opts.empty && value == '' )
		|| ( this.opts.regexp && this.opts.regexp.exec( value ) )
		|| ( !this.opts.regexp );
}


// Comment this line to stop server-side reporting of javascript errors
//window.onerror = anyOnError;

window.handlingOnError = false;
window.handledErrors   = [];

// Function used for server-side reporting of javascript errors 
function anyOnError( msg , url , line )
{
	var exclude = [ "uncaught exception: Permission denied to get property HTMLInputElement.parentNode"
				  , "uncaught exception: Permission denied to get property HTMLDivElement.parentNode" ];

	// Don't report errors in black list
	for ( var i in exclude )
	{
		if ( exclude[i] == msg )
		{
			jQuery.log( "Error belongs to blacklist, won't report it." );

			// Stop browser from declaring this error
			return true;
		}
	}

	// Don't report same error twice
	for ( var i in window.handledErrors )
	{
		if ( window.handledErrors[i] == msg )
		{
			jQuery.log( "Error already reported once on this session" );
			
			// Stop browser from declaring same error twice
			return true;
		}
	}
	
	// Don't report errors that may have happened 
	// during the error-processing phase 
	// (danger of infinite recursivity)
	if ( window.handlingOnError )
	{
		jQuery.log( "Trying to report an error while already busy reporting another one" );
		
		// Pass error onto browser
		return false;
	}
	
	// Lock (informal mutex)
	window.handlingOnError = true;

	jQuery.log( "Reporting error: " + msg ); 
	
	// Remember this error
	window.handledErrors.push( msg ); 

	// Values to send to the server
	var params = {};
	params.msg			= msg;
	params.pageurl		= location.href;
	params.scripturl	= url;
	params.linenumber	= line;
	params.referrer		= document.referrer;
	
	// Send error report o server
	anyRest.error.log( params , 
		function ( xml ) 
		{ 
			jQuery.log( 'Error was reported!' ); 
			// Unlock (informal mutex)
			window.handlingOnError = false;
		}
	);
	
	// Pass error onto browser
	return false;
}

// rebuild a scomp ( file ) with a specific dom_id
function rebuild_scp ( ops, xml )
{
	var dom_id	= ops.dom_id;
	var file	= ops.file;
	var thg_id 	= ops.rebuild_scp_thg_id || self.options.id; 

	if ( dom_id == null || file == null || thg_id == null )
	{
		jQuery.log('rebuild_scp - please use all parameters: dom_id, file, thg_id');
	}
	else
	{
		var scomp_options = jQuery.assocMerge( 
			ops.extra,
			{ 	'name': 		file, 
				'thg_id':		thg_id
			}
		);
	
		anyRest.html.scomp ( scomp_options , 
			function ( xml ) 
			{
				if (anyRest.aux.error(xml)) 
				{
					jQuery.log(anyRest.aux.errorMsg(xml));
				}
				else
				{
					var ts = xml.getElementsByTagName( 'html' )[0];
					x = document.getElementById( dom_id );
				
					if ( ts && x )
					{
						var v = anyRest.aux.concatChildNodes( ts );
	
						$( x ).after ( v ).remove();
	
						y = document.getElementById( dom_id );

						init_widgets( y );
					}
					else
					{
						jQuery.log('Internal error: did not get a template from the server or no dom id. Sorry...');
					}
				}
			}
		);
	}
}

// Get a css style attribute for a html node
function anyGetComputedStyle( node , cssSelector , inValue ) 
{
	var cssSelector = toSelectorCase( cssSelector );
	var property = toCamelCase( cssSelector );
	if( !node || !node.style ) 
	{
		return inValue;
	} 
	
	else if ( document.defaultView &&
			// mozilla segfaults when margin-* and node is removed from doc
			// FIXME: need to figure out a if there is quicker workaround
			isDescendantOf( node, node.ownerDocument ) ) 
	{ // W3, gecko, KHTML
		try 
		{
			var cs = document.defaultView.getComputedStyle( node , "" );
			if ( cs ) 
			{
				return cs.getPropertyValue( cssSelector );
			}
		} 
		catch( e )
		{ // reports are that Safari can throw an exception above
			if ( node.style.getPropertyValue ) 
			{ // W3
				return node.style.getPropertyValue( cssSelector );
			} 
			else 
			{
				return inValue;
			}
		}
	} 
	else if ( node.currentStyle ) 
	{ // IE
		return node.currentStyle[property];
	} 
	if ( node.style.getPropertyValue ) 
	{ // W3
		return node.style.getPropertyValue( cssSelector );
	}
	else
	{
		return inValue;
	}
}



// Change from fontSize to font-size
function toSelectorCase( selector )
{
	return selector.replace(/([A-Z])/g, "-$1" ).toLowerCase();
}


// Change from font-size to fontSize
function toCamelCase ( selector ) {
	var arr = selector.split('-'), cc = arr[0];
	for ( var i = 1 ; i < arr.length ; i++ )
	{
		cc += arr[i].charAt( 0 ).toUpperCase() + arr[i].substring( 1 );
	}
	return cc;
}


// Test if node is descendant of a given ancestor
function isDescendantOf( node, ancestor, guaranteeDescendant )
{
	// guaranteeDescendant allows us to be a "true" isDescendantOf function
	if( guaranteeDescendant && node ) 
	{
		node = node.parentNode; 
	}
	
	while( node ) 
	{
		if ( node == ancestor ) 
		{	
			return true;
		}
		node = node.parentNode;
	}
	return false;
}

// Convert these strings '#abc', '#aabbcc', 'abc', etc
// into this string 'aabbcc'
// TODO: Find better name
function validate_hex( s )
{
	s = s.replace( /#/, '' );
	var h3 = s.match(/^[a-fA-F0-9]{3}$/);
	if ( h3 )
	{
		var a = "";
		for ( var i = 0; i < 3; i++ )
		{
			var c = s.slice(i,i+1);
			a += c + c;
		}
		s = a;
	}
	return s;
}

// Get the background color of a dom node and convert it 
// into an array of decimal numbers [255,255,255]
// TODO: Find better name
function parse_dec_a( elem, stl )
{
	var stl = stl || 'background-color';
	var color = anyGetComputedStyle( elem, stl );
	
	if ( color == 'transparent' )
	{
		color = '';	
	}
	else
	{
		var ff_fr = ffrgb_s2dec_a( color );
	
		if ( ff_fr || ff_fr == 'transparent' )
		{
			color = ff_fr;
		}
		else
		{
			color = validate_hex( color );
			color = hex_s2dec_a( color );
		}
	}
	return color;
}

// Convert from firefox-returned color format 'rgb(12,34,12)'
// into an array of decimal numbers [12,34,12]
// TODO: Find better name
function ffrgb_s2dec_a( x )
{
	var a = null;
	var m = x.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);
	
	if ( m )
	{
		a = [];
		for ( var i = 1; i < 4 ; i++ )
		{
			a.push( parseInt( m[i] ) );
		}
	}
	return a;
}

// Make the node in the first argument throb its background color 
// using the bkg color of the second argument as the intermediate
function throb( selector, color_example )
{
	var elem = $( selector      ).get( 0 );
	var exmp = $( color_example ).get( 0 );

	if ( !elem || !exmp )
	{
		jQuery.log( 'throb: did not receive the correct arguments' );
		return;
	}

	// Get the base color
	var frcolor = parse_dec_a( elem );
	var tocolor = parse_dec_a( exmp );
	
	if ( !frcolor || !tocolor )
	{
		jQuery.log( 'throb: color values not parseable' );
		return;
	}
	
	
	// Get the start time for animation
	var start = (new Date()).getTime();
	
	// Total duration of animation
	var total = 5000;
	
	var anim = function () 
	{
		var diff = (new Date()).getTime() - start;
		if ( diff > total )
		{
			elem.style.backgroundColor = '#' + dec_a2hex_s( frcolor );
		}
		else
		{
			var x = [];
			var f = diff / total;
			var g = ( Math.cos(6 * Math.PI * f + Math.PI) + 1 ) / 2;
			for ( var i = 0; i < 3; i++ )
			{
				x[i] = Math.floor( g * tocolor[i] + (1 - g) * frcolor[i] )
			}
			elem.style.backgroundColor = '#' + dec_a2hex_s( x );
		}
	};
	setInterval( anim, 20 );
}



// Parse a mysql datetime field
// @param	String		datetime	The string containing the datetime value "YYYY-MM-DD HH-MM-SS"
// @return	Date					The parsed value
function mysqlDatetimeToDate ( datetime )
{
   var regex = /^([0-9]{2,4})-([0-1][0-9])-([0-3][0-9]) (?:([0-2][0-9]):([0-5][0-9]):([0-5][0-9]))?$/;
   var parts = datetime.replace( regex, "$1 $2 $3 $4 $5 $6" ).split( ' ' );
   return new Date( parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5] );
}



// Show a date relative to a given moment
// @param	Date		date		The date to represent
// @param	Date		now			Optional, used as reference, default new Date()
// @return	String					The formatted string
function showDateRelative( date, now )
{
	now = now || new Date();
	var prefix = '';
	if ( date.getFullYear() != now.getFullYear() || date.getMonth() != now.getMonth() || date.getDay() != now.getDay() )
	{
		prefix = '' + date.getFullYear() + '/' + ( date.getMonth() + 1 ) + '/' + date.getDate() + ' ';
	}
	return prefix + lpad( date.getHours(), 2, '0' ) + ':' + lpad( date.getMinutes(), 2, '0' );
}



// Left-pad a string to a desired length
// @param	String		s		The string to pad
// @param	Number		n		Final length of resulting string
// @param	String		c 		The character to repeat
// @return	String				The padded string
function lpad( s, n, c )
{
	// Make sure it is a string
	s = '' + s; 
	
	while ( s.length < n )
	{
		s = c + s;
	}
	return s
}

// Convert [255,255,255] into 'ffffff'
// TODO: Find better name
function dec_a2hex_s( a )
{
	var x = '';
	for ( var i in a )
	{
		x += lpad( dec2hex( a[i] ), 2, '0' );
	}
	return x;
}

// Convert 'ffffff' into [255,255,255]
// TODO: Find better name
function hex_s2dec_a( s )
{
	var r = [];	
	for ( var i = 0; i <= 4; i += 2 )
	{
		r.push( hex2dec( s.slice( i, i + 2 ) ) );
	}
	return r;
}

// Convert a decimal number/string into a hex string
function dec2hex( x )
{
	x = parseInt( x );
	var m = 16;
	var s = '';
	while ( x > 0 )
	{
		r = x % m;
		r = r > 9 ? "abcdef".slice( r-10, r-9 ) : '' + r;
		s = r + s;
		x = Math.floor( x / m );
	}
	return s;
}

// Convert a hex string into a decimal number
function hex2dec( x )
{
	x = '' + x;
	x = x.toLowerCase();
	s = "0123456789abcdef";
	n = 0;
	for ( var i = 0; i < x.length; i++ )
	{
		n = n * 16 + s.indexOf( x.slice(i,i+1) );
	}
	return n;
}

// Convert an array to string using a separator in between
function implode( arr, sep )
{
    var ret = ''
    for ( var i = 0; i < arr.length; i++ )
    {
        ret += ( i > 0 ? sep : '' ) + arr[i];
    }
    return ret;
}

function strip( str )
{
	str = str || '';
	str = str.replace( /^\s+/g, "" );
	str = str.replace( /\s+$/g, "" );
	return str;
}

jQuery.fn.extend({
	everyTime: function(interval, label, fn, times, belay) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, times, belay);
		});
	},
	oneTime: function(interval, label, fn) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, 1);
		});
	},
	stopTime: function(label, fn) {
		return this.each(function() {
			jQuery.timer.remove(this, label, fn);
		});
	}
});

jQuery.extend({
	timer: {
		guid: 1,
		global: {},
		regex: /^([0-9]+)\s*(.*s)?$/,
		powers: {
			// Yeah this is major overkill...
			'ms': 1,
			'cs': 10,
			'ds': 100,
			's': 1000,
			'das': 10000,
			'hs': 100000,
			'ks': 1000000
		},
		timeParse: function(value) {
			if (value == undefined || value == null)
				return null;
			var result = this.regex.exec(jQuery.trim(value.toString()));
			if (result && result[2]) {
				var num = parseInt(result[1], 10);
				var mult = this.powers[result[2]] || 1;
				return num * mult;
			} else {
				return value;
			}
		},
		add: function(element, interval, label, fn, times, belay) {
			var counter = 0;
			
			if (jQuery.isFunction(label)) {
				if (!times) 
					times = fn;
				fn = label;
				label = interval;
			}
			
			interval = jQuery.timer.timeParse(interval);

			if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
				return;

			if (times && times.constructor != Number) {
				belay = !!times;
				times = 0;
			}
			
			times = times || 0;
			belay = belay || false;
			
			if (!element.$timers) 
				element.$timers = {};
			
			if (!element.$timers[label])
				element.$timers[label] = {};
			
			fn.$timerID = fn.$timerID || this.guid++;
			
			var handler = function() {
				if (belay && this.inProgress) 
					return;
				this.inProgress = true;
				if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
					jQuery.timer.remove(element, label, fn);
				this.inProgress = false;
			};
			
			handler.$timerID = fn.$timerID;
			
			if (!element.$timers[label][fn.$timerID]) 
				element.$timers[label][fn.$timerID] = window.setInterval(handler,interval);
			
			if ( !this.global[label] )
				this.global[label] = [];
			this.global[label].push( element );
			
		},
		remove: function(element, label, fn) {
			var timers = element.$timers, ret;
			
			if ( timers ) {
				
				if (!label) {
					for ( label in timers )
						this.remove(element, label, fn);
				} else if ( timers[label] ) {
					if ( fn ) {
						if ( fn.$timerID ) {
							window.clearInterval(timers[label][fn.$timerID]);
							delete timers[label][fn.$timerID];
						}
					} else {
						for ( var fn in timers[label] ) {
							window.clearInterval(timers[label][fn]);
							delete timers[label][fn];
						}
					}
					
					for ( ret in timers[label] ) break;
					if ( !ret ) {
						ret = null;
						delete timers[label];
					}
				}
				
				for ( ret in timers ) break;
				if ( !ret ) 
					element.$timers = null;
			}
		}
	}
});

if (jQuery.browser.msie)
	jQuery(window).one("unload", function() {
		var global = jQuery.timer.global;
		for ( var label in global ) {
			var els = global[label], i = els.length;
			while ( --i )
				jQuery.timer.remove(els[i], label);
		}
	});


// rounded corners
	
	// adds 4 spans to element, positions using css in utils.css
	/*  EXAMPLE 
	
	if( $.browser.msie){	
		// add rounded corners to these elements for IE
		$('.list-context li').rounded_corners();
	};
	// add rounded corners to these elements for all browsers
	$('.fig li').rounded_corners();
	
	*/
	
	$.fn.rounded_corners = function(){
		if (!$(this).length)
		return false;
		
		$(this)
			.css({position: 'relative'})
			.hover(function(){
				$(this).addClass('cnrs-hovered');
			},function(){
				$(this).removeClass('cnrs-hovered');
			});
			
		$('<span class="cnrs cnr_nw"></span><span class="cnrs cnr_ne"></span><span class="cnrs cnr_sw"></span><span class="cnrs cnr_se"></span>')
		.css({ // will only accept numeric border widths
	 		marginTop: 		'-'+(parseInt($(this).css('border-top-width'))||0),
	 		marginRight: 	'-'+(parseInt($(this).css('border-right-width'))||0),
	 		marginBottom: 	'-'+(parseInt($(this).css('border-bottom-width'))||0),
	 		marginLeft: 	'-'+(parseInt($(this).css('border-left-width'))||0)
	 	})
		.appendTo(this);
		// ie odd values bug fix
		if( $.browser.msie && $.browser.version < 7){
			$(this).each(function(){	
				var h = $(this).height();
				if (h%2){ $('.cnr_sw',this).css({bottom: '-1px'});$('.cnr_se',this).css({bottom: '-1px'}); };
				var w = $(this).width();
				if (w%2){ $('.cnr_ne',this).css({right: '-1px'});$('.cnr_se',this).css({right: '-1px'}); };
			});
		};
	};	
	


/*  */
/*  */
/*  */

// Methods that do not fall inside the standard anyrest call style
var anyRest = {
	'aux':
	{
		'items': function ( xml )
		{
			var rsp = xml.getElementsByTagName( 'rsp' )[0];
			var rst = [];
			for ( var i = 0 ; i < rsp.childNodes.length ; i++ )
			{
				if ( rsp.childNodes[i].tagName == 'item' )
				{
					rst.push( rsp.childNodes[i] );
				}
			}
			return rst;
		},
		
		'status': function ( xml )
		{
			var rsp = xml.getElementsByTagName( 'rsp' );
			return rsp[0].getAttribute( 'stat' );
		},
		
		'error': function ( xml )
		{
			return ( anyRest.aux.status( xml ) != 'ok' );
		},

		'errorMsg': function ( xml )
		{
			var es = xml.getElementsByTagName( 'err' );
			return es[0] ? es[0].getAttribute( 'msg' ) : '';
		},
		
		'skeleton': function ( type , params , callback )
		{
			params.format = params.format || "xml";
			callback = callback || function ( _ ) {};

			var no_notification_check = false;
			if (params.no_notification_check)
			{
				var no_notification_check = true;
				delete params.no_notification_check;
			}

			var opts = {
				"type": type,
				"url": 	"http://www.amsterdamlivinglab.nl/services/rest/"
			};
			
			if ( type == 'GET' ) 
			{
				opts.url += '?' + jQuery.xparam( params );
			}

			if ( type == 'POST' )
			{
				opts.data = jQuery.xparam( params );
			}

			opts.success = function restSuccess ( data )
			{
			    if (type == 'POST' && !no_notification_check) 
			    {
				anyRest.notifications.check();
			    }
			    
			    callback( data );
			}
			opts.error = function restError ( request, text, errorThrown )
			{
				if (request.status == 401)
				{
					var loc = request.getResponseHeader('X-Authorize-Location');
					if (!loc)
					{
						return false;
					}

					$( "#throbberwait" ).remove();

					var target = document;
					if (LightboxHelper.isLightbox())
					{
						target = window.parent.document;
					}

					// Append return_to to callback URI
					if (loc.match(/\?/))
					{
						loc = loc + '&';
					}
					else
					{
						loc = loc + '?';
					}
					loc = loc + 'return_to=' + target.location.href;
					target.location = loc;

				}
			}

			jQuery.ajax( opts );
		}
	}
};

anyRest.aux.concatChildNodes = function ( xmldom )
{
	var str = '';
	for ( var i = 0; i < xmldom.childNodes.length ; i++ )
	{
		str += xmldom.childNodes[i].nodeValue;
	}
	return str;
};

anyRest.aux.checkNotifications = function ( xml, target )
{
	if (!target && LightboxHelper.isLightbox())
	{
		target = window.parent.document;
	}
	else if (!target)
	{
		target = document;
	}

	$(xml).find('item').each( function() {
		var msg = $(this).find('message').text();
		var cls = $(this).find('class').text();
		var el = $('<div></div>', target).html(msg).addClass(cls).hide();
		$('.notification', target).append(el);
		el.slideDown('fast');
	});
	
};

anyRest.notifications = 
{
	check: function ()
	{
		if(LightboxHelper.isLightbox())
		{
			return window.parent.anyRest.notifications.check();
		}
		
		anyRest.get( 'anymeta.notifications.get', [], anyRest.notifications.checkCallback );
	},

	checkCallback: function (xml)
	{

		$(xml).find('item').each( function() {
			var msg = $(this).find('message').text();
			var cls = $(this).find('class').text();
			anyRest.notifications.add(msg, cls);
		});
	},

	add: function (message, cls)
	{
		if(LightboxHelper.isLightbox())
		{
			return window.parent.anyRest.notifications.add(message, cls);
		}
		
		var notification = $('.notification');
		
		$('<div></div>')
			.html(message)
			.addClass(cls)
			.appendTo(notification)
			.parent()
				.hide()
				.animate({height: 'show', opacity: 'show'}, 600, function() 
				{
					message = message.split(' ');
					var notification_time = ((message.length * .9) + 1) * 1000;
					
					$(this).oneTime(notification_time, function() 
					{ 
						notification.animate({height: 'hide', opacity: 'hide'}, 600, function()
						{
							$(this).empty();					
						});
					});
				});
	}
};

// POST
// List of anymeta REST methods, indexed by their name prefix and http verbs
var batch = [
	['anymeta.','POST',
		['edge.attribute.get'
		,'edge.attribute.set'
		,'edge.add'
		,'edge.remove'
		,'edge.order'
		,'edge.addList'
		,'error.log'
		,'tags.add'
		,'predicates.get'
		,'predicates.set'
		,'messages.send'
		,'user.check'
		,'thing.insert'
		]],
	['','POST',
		['contact.add'
		,'contact.change'
		,'contact.remove'
		]],
	['','POST',
		['jury.accuse'
		]],
	['anymeta.','GET',
		['html.template'
		,'html.scomp'
		,'search.live'
		]]]

for ( var i in batch )
{
	// For each of the REST methods, generate a javascript method with the same name. 
	// Mostly here for backwards compatibility, this additional style freedom is not
	// particularly welcome
	var prefix = batch[i][0];
	var http_method = batch[i][1];
	var lis = batch[i][2];

	for ( var j in lis )
	{
		var words = lis[j].split('.');
		var tmp = anyRest;
		for ( var k = 0; k < words.length - 1; k++ )
		{
			if ( !tmp[words[k]] )
			{
				tmp[words[k]] = {};
			}
			tmp = tmp[words[k]];
		}
		
		tmp[words[words.length-1]] = makeRestMethod( http_method, prefix + lis[j] );
		
	}
}

// Produces a ajax method to communicate with anymeta REST services
function makeRestMethod( http_method, rest_method )
{
	return function ( params, callback )
	{
		params.method = rest_method;
		anyRest.aux.skeleton( http_method, params, callback );
	}
}

anyRest.service = function ( name, opts, callback )
{
	opts.method = name;
	anyRest.aux.skeleton( 'POST' , opts , callback );
};

anyRest.call = function ( opts, callback )
{
	anyRest.aux.skeleton( 'POST' , opts , callback );
};

anyRest.post = function ( name, opts, callback )
{
	opts.method = name;
	anyRest.aux.skeleton( 'POST' , opts , callback );
};

anyRest.get = function ( name, opts, callback )
{
	opts.method = name;
	anyRest.aux.skeleton( 'GET' , opts , callback );
};

/**/
/*  */

/*  */

// Notes
// ULs and LIs margin values are set to 0
// LIs get display: block
// Style the menu and get it working first with CSS, then add this JS to make it nicer

// External callback to initialize the widget
// @param	mixed	container	jQuery selector for the object to be used
// @param	dom		context		DOM object used as jQuery context. Defaults to document.body
function init_menu( container, context )
{
	context = context || document.body;
	
	$( container, context ).each( 
		function () 
		{
			var opts = "";
			opts = jQuery.attrOptions( this , "menu" );
			new Menu( this, opts );
		}
	);
}

// External callback for the documentation functions
// @return  object Structure containing 'examples' of usage, 'about' message, default 'opts', and 'classes' (never used...)
function docs_menu()
{
	var a = "Dynamic cascading menu item. Notes: Get it working with CSS only first, then use this file to make it nice.";
	var e = [
		['<ul class="do_menu" menu="animationOver: {ldelim}height:\'show\',opacity: .9{rdelim}, speedOver: 400, dropShadows: true">\n<li>A.root\n\t<ul>\n\t<li>A.1</li>\n\t<li>A.2</li>\n\t</ul>\n</li>\n<li>B.root\n\t<ul>\n\t<li>B.1</li>\n\t</ul>\n</li>\n</ul>',
		"Superfish menu"]
	];
	var c = [];
	
	var o = 
	[[ "hoverClass", 	'sfHover', 		 				"the class applied to hovered list items" ]
	,[ "pathClass", 	'overideThisToUse',				"the class you have applied to list items that lead to the current page" ]
	,[ "pathLevels", 	1,								"the number of levels of submenus that remain open or are restored using pathClass" ]
	,[ "delay",  		400,							"the delay in milliseconds that the mouse can remain outside a submenu without it closing" ]
	,[ 'animationOver',	{height:'show'},				"exmp: {opacity:.85}, {height:'show'}, Animation on mouse over. See jQueryÍs .animate() method" ]
	,[ "speedOver",		300, 			 				"speed of the mouse over animation (in milliseconds). Equivalent to second parameter of jQueryÍs .animate() method" ]
	,[ 'animationOut',	{opacity:'hide',height:'hide'},	"{opacity:'hide'}, {height:'hide'}, Animation on mouse out" ]
	,[ "speedOut", 		200, 			 				"speed of the mouse out animation (in milliseconds). Equivalent to second parameter of jQueryÍs .animate() method" ]
	,[ "autoArrows",	false, 			 				"if true, arrow mark-up generated automatically. Will add .sf-with-ul to anchor of parent. " ]
	,[ "dropShadows",	false, 			 				"completely disable drop shadows by setting this to false" ]
	];
	
	return { 'examples': e, 'about': a, 'opts': o, 'classes': c };
}


// Process the options for this widget (cached)
// @param   object  o   Widget options extracted from the html
// @return  object      Default options overriden by html options
function opts_menu( o )
{
	return apply_options( docs_menu().opts, o );
}



function Menu( container, opts )
{
	opts			= opts_menu( opts );
	this.container	= container;
	this.opts		= opts;
	
	
	$(container).superfish(
	{
		hoverClass: 	this.opts.hoverClass,
		pathClass: 		this.opts.pathClass,
		pathLevels: 	this.opts.pathLevels,
		delay: 			this.opts.delay,
		animationOver:	this.opts.animationOver,
		speedOver:		this.opts.speedOver,
		animationOut:	this.opts.animationOut,
		speedOut:		this.opts.speedOut,
		autoArrows: 	this.opts.autoArrows,
		dropShadows:	this.opts.dropShadows
	}	
	);	
	
}

;(function($){
	$.fn.superfish = function(op){

		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
				},o.delay);	
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
			
		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;
			
			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
				if (o.autoArrows) addArrow( $('>a:first-child',this) );
			})
			.not('.'+c.bcClass)
				.hideSuperfishUl();
			
			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);
			
		}).each(function() {
			menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fixAdd = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows )
			this.addClass(sf.c.shadowClass+'-off');
		};
	sf.IE7fixRemove = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows )
			this.removeClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		disableHI	: true,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}
	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
			not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).find('>ul:visible')
			sf.IE7fixAdd.call($ul);		
			
			// important fix for ff2 opacity issues on a mac
			if (navigator.appVersion.indexOf("Mac")!=-1 && ($.browser.mozilla && $.browser.version.substr(0,3) == 1.8)) o.animationOut.opacity = 1;
			
			$ul.animate(o.animationOut,o.speedOut,function(){$(this).parent().removeClass(o.hoverClass); sf.IE7fixRemove.call($ul);});
			
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
					
			sf.IE7fixAdd.call($ul);
			o.onBeforeShow.call($ul);
			
			// important fix for ff2 opacity issues on a mac
			if (navigator.appVersion.indexOf("Mac")!=-1 && ($.browser.mozilla && $.browser.version.substr(0,3) == 1.8)) o.animationOut.opacity = 1;
						
			$ul.animate(o.animationOver,o.speedOver,function(){ sf.IE7fixRemove.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);

/*  */
//
// External callback to initialize the widget
// @param	mixed	container	jQuery selector for the object to be used
// @param	dom		context		DOM object used as jQuery context. Defaults to document.body
function init_tooltip ( container, context )
{
	context = context || document.body;
	
	$(container, context).each(function()
	{
		var opts = jQuery.attrOptions( this , 'tooltip' );
		new Tooltip( this, opts );
	});
}

// External callback for the documentation functions
// @return  object      Structure containing 'examples' of usage, 'about' message, default 'opts', and 'classes' (never used...)
function docs_tooltip()
{
	var a = 'Mouse-pivoted tooltip that behaves intelligently against screen limits';
	var e = 
	[
		[ '<a class="do_tooltip" title="my tooltip text"', "simple popup using a custom div id" ],
	];
	
	var c = [];
	
	var o = 
	[ 
	 	[ 'timeover'			,50,				  					'Number of milliseconds before tooltip appears' ],
		[ 'effectover'			,{opacity: "show"}, 				 	'Action when hovering over. {opacity: \'toggle\', height: \'toggle\'}' ],
	 	[ 'effectover_duration'	,150,	  								'Duration of out effect' ],
	 	[ 'effectout' 			,{opacity: "hide"},  				  	'Action when hovering out. Other examples can be hide(), fadeOut(\'slow\')' ],
	 	[ 'effectout_duration'	,100,	  								'Duration of hover effect' ],
	 	[ 'offy'				,0, 				  					'Vertical distance from the mouse pointer' ],
	 	[ 'offx'				,5, 				  					'Horizontal distance from the mouse pointer' ],
	 	[ 'follow'				,true,	  								'Follow the mouse cursor' ],
		[ 'extra_image'			,'',									'Add an extra image to the ' ],
	 	[ 'inevent'				,'mouseover', 	  	  					'Bind this action when hovering over, choose mousemove when tooltip should move with mouse' ],
	 	[ 'outevent' 			,'mouseout', 		  					'Bind this action when hovering out' ],
	 	[ 'width'				,'auto', 			  					'Width of the tooltip' ],
	 	[ 'selectable'			,1, 	  	  	  					    'Set to true when it should be possible to select the text in the tooltip' ],
	 	[ 'cursor'				,'', 	  	  	  					    'tooltip parent cursor' ],
	 	[ 'maxwidth'			,'300px',								'the maximum width of the tooltip' ],
	 	[ 'type'				,'',									'is the type an input?' ],
	 	[ 'html'				,'',									'The html to be injected into the tooltip div' ],
	 	[ 'dom_id'				,'',									'what dom id to use for filling the tooltip' ]
	];
	
	return { 'examples': e, 'about': a, 'opts': o, 'classes': c };
}

// Process the options for this widget
// @param   object  o   Widget options extracted from the html
// @return  object      Default options overriden by html options
function opts_tooltip( o )
{
	return apply_options( docs_tooltip().opts, o );
}

function Tooltip( container, options )
{
	options			= opts_tooltip( options );
	this.options	= options;
    this.container  = container;
        
	$(container).tooltip(
    {
    	timein: 			options.timeover,
    	ineffect: 			options.effectover,
    	ineffectduratrion: 	options.effectover_duration, 
    	outeffect: 			options.effectout,
    	outeffectduratrion: options.effectout_duration, 
    	offsetY:			options.offy,
    	offsetX: 			options.offx,
    	follow: 			options.follow,
    	extra_image: 		options.extra_image,
	   	inevent: 			options.inevent,
    	outevent: 			options.outevent,
    	width: 				options.width,
    	cursor:				options.cursor,
    	maxwidth:			options.maxwidth,
    	type:				options.type,
    	html:				options.html,
    	dom_id:				options.dom_id
    });
}

(function(jQuery) 
{
	jQuery.fn.tooltip = function(options)
	{
		var defaults = {
			timein: 			300, 
			ineffect: 			{opacity: 'show'},
			ineffectduration: 	200, 
			outeffect: 			{opacity: 'hide'},
			outeffectduration: 	300, 
			offsetY: 			-15,
			offsetX: 			15,
			follow: 			true,
			extra_image: 		'<span class="tooltip-arrow"></span>',
			inevent: 			'mouseover',
			outevent: 			'mouseout',
			width: 				'auto',
			cursor: 			'',
			maxwidth: 			'330px',
			type: 				'',
			html: 				'',
			dom_id:				''
  		};
  		
  		var options = jQuery.extend(defaults, options);
  			
  		return this.each(function() 
		{
			obj = jQuery(this);
		
			obj.css({cursor: options.cursor});			
			
			if(this.title == '' && !options.dom_id && !options.html)
			{
				obj.unbind(options.inevent, options.outevent);
				return false;
			}

			obj.bind(options.inevent, function(e) 
			{
				this.tip = this.title;
				
				if(options.html)
				{
					var tip_content = options.html;
				}
				else if(options.dom_id)
				{
					var tip_content = $('#' + options.dom_id).html();
				}
				else
				{
					var tip_content = this.tip;
				}
				
				this.title = "";
				
				tip = jQuery('<div></div>')
						.addClass('tooltip')
						.html(options.extra_image + tip_content)
						.css({top: e.pageY + options.offsetY, left: e.pageX + options.offsetX, width: options.width, maxWidth: options.maxwidth });
				
				jQuery(document.body).append(tip);
								
				if(options.follow)
				{
					jQuery(document).bind('mousemove', function(e)
					{ 
						tip.css({top: e.pageY + options.offsetY});
						
						if(e.pageX + tip.width() > jQuery.windowSize().w)
						{
							tip.css({left: e.pageX - options.offsetX - tip.width() - 30});
						}
						else if(e.pageX + tip.width() < jQuery.windowSize().w)
						{
							tip.css({left: e.pageX + options.offsetX });
						}
						else
						{
							tip.css({left: e.pageX + options.offsetX });
						}
					});
				}
				else
				{
					var left = jQuery.getPosition(this).x;
					var top  = jQuery.getPosition(this).y;
					
					tip.css({top: top - tip.height() - 10});
					
					if(left + tip.width() > jQuery.windowSize().w)
					{
						tip.css({left: left - (obj.width() / 2) - (tip.width() / 2 )});
					}
					else
					{
						tip.css({left: left + (obj.width() / 2) - (tip.width() / 2 )});
					}
									
					if(options.type == 'input')
					{
						tip.css({ left: left + obj.width() + 15, top: top});
					}
				}
								
				tip.oneTime(options.timein, function()
				{
					jQuery(this).stop().animate(options.ineffect, options.ineffectduration);
				});
			});
			
			obj.bind(options.outevent, function(e) 
			{
				tip.stop().animate(options.outeffect, options.outeffectduration, function()
				{
					jQuery(this).remove();
				});
				
				jQuery.fn.tooltip.destroy();
				this.title = this.tip;
			});
			
			jQuery.fn.tooltip.destroy = function()
			{
				obj.unbind(options.inevent, options.outevent);
				jQuery(document).unbind('mousemove');
			}
		});			
	}
})(jQuery);
//
// image zoomer
//	

$.fn.img_zoomer = function() 
{
return this.each(function() {
		
	// set object
	var origImg = $(this);	
	
	var imgWidth = origImg.width();
	var imgHeight = origImg.height();

						
	// find the <map> that belongs to this image
	var img_id = origImg.attr('usemap').replace('#','');
	var usemap = $('map[name='+ img_id +']');

	
	var imgVars 		= usemap.attr('title').split(",");
	var originalWidth 	= parseInt(imgVars[0]);
	var originalHeight 	= parseInt(imgVars[1]);
	imgSrc 				= imgVars[2];
	
	var perc = 1;
	
	
	if(imgWidth != originalWidth)
	{ 
		perc = (imgWidth / originalWidth) 
	};
		

	// if image does not need zoomer, finish here, and skip to the next iteration
	if (!perc || perc > .85 || imgWidth < 220)
	{
		return true;
	};
		
	var a = false;
	
	// create wrapper div if it not in the template
	if (!origImg.parents('.img-wrapper').length) 
	{
		// wrap the image in a div for annotation positioning		
		wrapper = $('<div class="img-wrapper"></div>')
						.attr({rel: img_id})
						.css({width: imgWidth,height: imgHeight});
						
		if (origImg.parents('a').length)
		{
			var a = origImg.parents('a');
			origImg.parents('a').wrap(wrapper);
		}
		else
		{
			origImg.wrap(wrapper);
		};
	}
	else
	{
 		if (origImg.parents('a').length)
		{
			var a = origImg.parents('a');
		};
	};
	
	var wrapper = origImg.parents('.img-wrapper');

	
	if($('.img-toolbar',wrapper).length)
	{
		var toolbar = $('.img-toolbar',wrapper);
	}
	else
	{
		// find toolbar div, add it to the wrapper
		var toolbar = wrapper.siblings('.img-toolbar')
					.prependTo(wrapper);
					
	}
	
	
	// bind hovers
	wrapper
		.mouseover(function(){
			
			// load hi res image if present
			if(!$('.img-zoomer-hi-res',this).attr('src') && perc < .85)
			{
				$('.img-zoomer-hi-res',this).load_hi_res_image();
			}
						
			//toolbar = $('.img-toolbar',this);
			
			$(this).addClass('img_hovered');			
			
			if ($.browser.msie) 
			{
				toolbar.show();
				return false;
			}
			
			if (toolbar.length && toolbar.html() != '') 
			{
				toolbar.slideDown(200);
				if (toolbar.css('display') == 'none') 
				{
					toolbar.show();
				}
			}	
						
		})
		.mouseout(function(){	
			//toolbar = $('.img-toolbar',this);
			
			$(this).removeClass('img_hovered');
			
			if ($.browser.msie) 
			{
				toolbar.animate({opacity: 1},800,function(){
					if ( toolbar.length && !objParent.hasClass('img_hovered') )
					{
						toolbar.slideUp(200);
					};
				});
				return false;
			}
			
			$(this).animate({opacity: 1},800,function(){
				toolbar = $('.img-toolbar',this);
				if (!$(this).hasClass('img_hovered')) 
				{
					if (toolbar.length)
					{
						toolbar.slideUp(200);
					};
				}
			});
		});


	
	toolbar
		.prependTo(wrapper)
		.mouseover(function(){
			wrapper.addClass('img_hovered zooming-img');
		})
		.mouseout(function(){
			if( $('.ui-slider',this).slider('value') <= 1)
			{
				wrapper.removeClass('zooming-img');
			};
		});
		
	toolbar = $(toolbar,wrapper);
	
	// add tags button, set binds and title	
	tag_img_btn_title = $('.edit-img-tags',toolbar).text().split(',')
	$('.edit-img-tags',toolbar).text(tag_img_btn_title[0])
	
	var img = $('<img />').addClass('img-zoomer-hi-res').css({position: 'absolute'}).hide().insertAfter(origImg);	
	loader = $('<span></span>', origImg).addClass('loading-toolbar').hide().prependTo(toolbar);
		
	if(!speed)
	{
		var speed = 400;
	};
	
	// if zooming tools don't exist, add them to the toolbar
	if( !$('.img-zoomer-tools',toolbar).length )
	{
		var zoomer = $('<div></div>').addClass('img-zoomer-tools').hide().prependTo(toolbar);
	}
	else 
	{
		var zoomer = $('.img-zoomer-tools',toolbar);
	}
	
	// build zoom slider and add to zoomer
	$('<div></div>').slider(
	{
		max: (perc * 100)+100,
		start: function()
		{
			origImg.hide();
			img.show();
						
			if ( !wrapper.hasClass('zooming-img') )
			{
				wrapper.addClass('zooming-img');
			};
		},
		slide: function()
		{	
			if($('.ui-slider',toolbar).slider('value') > 1)
			{
				$('.img-zoomer-tool-reset',toolbar).animate({opacity: 1},200);
				$('.annotation',wrapper).hide();
			}
			
			var val 		= $(this).slider('value');
			var newPerc 	= ( val / 100 ) + 1 ;			
			var percWidth 	= ( imgWidth * newPerc );
			var percHeight 	= ( imgHeight * newPerc );
			var left 		= ( imgWidth - percWidth ) / 2;
			var top 		= ( imgHeight - percHeight ) / 2;
			
			img.css({width: percWidth,height: percHeight,top: top,left: left});			
		},
		stop: function()
		{					
							
			if (a)
			{
				a.click(function(){ return false });
			};
			
			if($(this).slider('value') < 1)
			{
			 	reset_image($(this))
			};
		}		
	})
	.appendTo(zoomer);
		
	$('<span>+</span>')
		.addClass('img-zoomer-tool-add')
		.mousedown(function(){
			$(this).siblings('.ui-slider').slider("moveTo", "+=15");
		})
		.appendTo(zoomer);
	$('<span>-</span>')
		.addClass('img-zoomer-tool-less')
		.mousedown(function(){
			if($(this).siblings('.ui-slider').slider('value') < 1)
			{
			 	reset_image($(this).siblings('.ui-slider'))
			} 
			else 
			{
				$(this).siblings('.ui-slider').slider("moveTo", "-=15");
			}	
		})
		.prependTo(zoomer);	
	$('<span>r</span>')
		.addClass('img-zoomer-tool-reset')
		.mouseup(function(){
			reset_image($(this).siblings('.ui-slider'));
		})
		.css({opacity: .4})
		.prependTo(zoomer);
		
	$('<span></span>')
		.addClass('img-zoomer-tool-fullscreen')
		.mousedown(function(){
			img_go_fullsize();
		})
		.prependTo(zoomer);
		
	
	$.fn.load_hi_res_image = function(){

		img = this;
		var wrapper = img.parents('div');
		var toolbar = $('.img-toolbar',wrapper);
		var zoomer = $('.img-zoomer-tools',wrapper);
		zoomer.hide();
		
		loader = $('.loading-toolbar',wrapper);
		loader.show();
		
		var imgVars	= $('map[name='+ wrapper.attr('rel') +']').attr('title').split(",");
		var imgSrc 	= imgVars[2];
		
		// load hi-res image	
		img.attr({src: imgSrc})
			.load(function(){
				loader.hide();
				zoomer.fadeIn(300);
				$(this)
					.attr({rel: $(this).width()+','+$(this).height()})
					.css({width: wrapper.width(),height: wrapper.height()})
					.unbind('load');
			})
			.draggable({
				start: function(e,ui){
					uiWidth = - (ui.helper.width() - wrapper.width());
					uiHeight = - (ui.helper.height() - wrapper.height());
				},
				drag: function(e,ui){
									
					if (ui.position.left >= 0)
					{
						ui.position.left = 1
					}
					if (ui.position.top >= 0)
					{		
						ui.position.top = 1
					}
					if (ui.position.left <= uiWidth)
					{		
						ui.position.left = (uiWidth + 1)
					}	
					if (ui.position.top <= uiHeight)
					{		
						ui.position.top = (uiHeight + 1)
					}	
				}
			});
	}
		
	function reset_image(slider){
		if (slider.slider('value') > 1 )
		{
			slider.slider("moveTo", "1");
		};
		img.hide()
	 	origImg.show()
	 	$('.img_zoomer_tool_reset',toolbar).css({opacity: .4});
		$('.annotation',wrapper).show().animate({opacity: 1},300,function(){
			wrapper.removeClass('zooming-img');
		});
		
		if (a)
		a.unbind('click');
	};
	
	function img_go_fullsize(){		
		
		var zoomDimen = img.attr('rel').split(',');
		
		var zoomImgWidth 	= zoomDimen[0];
		var zoomImgHeight 	= zoomDimen[1];
		var fullWidth 		= zoomImgWidth;
		var fullHeight 		= zoomImgHeight;

		// never wider than window
		if (zoomImgWidth > $(window).width())
		{
			fullWidth = $(window).width() - 40;
			fullHeight = zoomImgHeight * (fullWidth / zoomImgWidth);	
		};		
		
		// re-position when window resizes
		$(window).resize(function(){
		
			if( $(window).width() < zoomImgWidth )
			{
				$('.full-screen-img').animate({ 
					width: ($(window).width() - 40),
					height: zoomImgHeight * (($(window).width() - 40) / zoomImgWidth),
					left: ($(window).width() / 2) - (($(window).width() - 40) / 2)
				},200)
			} 
			else
			{
				$('.full-screen-img').animate({ 
					width: zoomImgWidth,
					height: zoomImgHeight,
					left: ($(window).width() / 2) - (zoomImgWidth / 2)
				},200)
			}			
		});
 		
		leftPos = ($(window).width() / 2) - (fullWidth / 2);
		topPos = $(window).scrollTop() + 10;
				
		// overlay
		$('<span class="popup-overlay"></span>')
			.css({opacity: .5,height: $(document).height(),backgroundColor: '#000000'})
			.click(function()
			{
				close_fullscreen_img()	
			})
			.appendTo('body');
			
		// clone the large image, and animate to full screen
		img.clone()
		.show()
		.addClass('full-screen-img')
		.css({left: wrapper.offset().left,top: wrapper.offset().top})
		.appendTo('body')
		.animate({width: fullWidth,height: fullHeight, left: leftPos, top: topPos},300,'easeOutCirc')
		.click(function(){
			close_fullscreen_img()
		});
	};
	
	function close_fullscreen_img(){
		$('.popup-overlay').fadeOut(300,function(){ $(this).remove() })
		$('.full-screen-img').animate({width: origImg.width(),height: origImg.height(), left: wrapper.offset().left,top: wrapper.offset().top},200,function(){ 
			$(this).remove(); 
			toolbar.show();
		})		
	};
	
});
	
};

//	
//	

$.fn.img_annotations = function() 
{
return this.each(function() {
	
	var obj = 		$(this);
	objParent = obj.parent();
		
	// create label for future use
	if ( !$('.annotation-label').length )
	{
		$('<span class="annotation-label"></span>')
			.css({opacity: .9})
			.appendTo('body');
	}
	// ## Set up the image for annotations	##	
	var imgId = $(this).attr('usemap');//+id;
	imgId = imgId.replace("#","");
	// remove usemap
	
	
	var imgWidth = $(this).width();
	var imgHeight = $(this).height();
						
	// find the <map> that belongs to this image
	var usemap = $('map[name='+imgId+']');	
	
	var imgVars 		= usemap.attr('title').split(",");
	var originalWidth 	= parseInt(imgVars[0]);
	var originalHeight 	= parseInt(imgVars[1]);
	
	var percWidth = 1;
	var percHeight = 1;
	
	if(imgWidth != originalWidth){ percWidth = (imgWidth / originalWidth) }
	if(imgHeight != originalHeight){ percHeight = (imgHeight / originalHeight) }
	
	// remove <a> from around image if in edit mode
	if (obj.parents('a:first').length) 
	{
		attachmentLink = obj.parents('a:first').clone();
		obj.parents('a:first').replaceWith(obj);
	}
	
	// create wrapper div if it not in the template
	if (!obj.parents('.img-wrapper').length) 
	{
		// wrap the image in a div for annotation positioning		
		img_wrapper = $('<div class="img-wrapper '+imgId+'_wrap"></div>')
						.addClass('img-with-annotations')
						.attr({rel: imgId})
						.css({width: imgWidth,height: imgHeight});
		
		if (obj.parents('a:first').length)
		{
			obj.parents('a:first').wrap(img_wrapper);
		}
		else
		{
			obj.wrap(img_wrapper);
		};
		
	}
	else 
	{
		img_wrapper = obj.parents('.img-wrapper')
						.addClass('img-with-annotations '+imgId+'_wrap')
						.attr({rel: imgId})
	};		
	
	objParent = obj.parents('.img-wrapper');
	
	
	// find and add toolbar
	if($('.img-toolbar',objParent).length)
	{
		toolbar = $('.img-toolbar',objParent);
	}
	else
	{
		// find toolbar div, add it to the wrapper
		toolbar = objParent.siblings('.img-toolbar:first')
					.prependTo(objParent);
	}
	
	
	// Set up image 
	objParent.siblings('.help-text:first').slideUp();
	objParent.siblings('.temp-actor-list').remove()
	
	objParent.removeClass('in_edit');
	
	actorList = $('.list-actor ul');

	
	
	// highlight annotation when actor li is hovered
	function highlight_annotation_from_li()
	{
		$('li',actorList).unbind('mouseover','mouseout');
		
		$('li',actorList).hover(function(){
			if( !$(".annotation",objParent).length )
			return false;
			
			$('a',this).removeAttr('title');
			
			var li_text = $('span',this).text().replace('\n',' ').split(' ');
			if (li_text.length <= 1)
			{
				var search_text = li_text[0]
			}
			else
			{
				var search_text = li_text[0]+" "+li_text[1]
			}
			
			$(".annotation:contains("+search_text+")",objParent).addClass('hovered');
			objParent.trigger('mouseover');
			
			toolbar.css({top: -9999});	
				
		}, function(){
			if( !$(".annotation",objParent).length )
			return false;
			
			$(".annotation",objParent).removeClass('hovered');
			objParent.trigger('mouseout');
			
			toolbar.hide().css({top: 0});
		});
	};
	
	highlight_annotation_from_li()
	
	
	// ## Create annotations from <map><area>'s ##
	if (obj.siblings('.annotation').length < 1)
	{
		$("area",usemap).each(function(i)
		{	
			// post ids = thing_id , edge_id, actor id
			var postIds = $(this).attr('rel').split(",");
			var thing_id = postIds[0];
			var actor_id = postIds[1];
			var edge_id = postIds[2];
						
			var coords = $(this).attr('coords').split(",");			
			// find the saved dimensions for the annotation
			var width = (coords[2] - coords[0]) * percWidth;
			var height = (coords[3] - coords[1]) * percHeight;
			var left = parseInt(coords[0]) * percHeight;
			var top = parseInt(coords[1]) * percHeight;
			
			
			var full_title = $(this).attr("title").split(",");
	
			// create annotation
			annotation = $('<a id="annot'+actor_id+'" rel="'+postIds+'" href="'+$(this).attr("href")+'"><span class="drag">'+full_title+'</span></a>');

			
			$('span.drag',annotation).css(
			{
				width: width,
				height: height,
				zIndex: ( 9998 - ( width + height ) )
			});
			
			// IE fix
			if ($.browser.msie) 
			{
				$('span.drag',annotation).css({backgroundColor: '#ccc',opacity: 0});
				$('body').addClass('isIE');
			}
			
			// make outer wrapper wider for border
			width = (width + 2);
					
			$(annotation)
			.addClass('annotation')
			.css(
			{
				width: width,
				top: top,
				left: left,
				zIndex: ( 9998 - ( width + height ) ) 
			})
			.prependTo('.'+imgId+'_wrap');
												
		});
	};

	
	// Bind image and annotation hover states
	
	annotations = $('.annotation',objParent);
	annotations.css({opacity: 1})
		// pause before fading
		.animate({opacity: 1},1500,function(){
			// fade annotations out
			$(this).animate({opacity: 0},500,function(){
				// if image has gone into edit, and show annotations
				if ( img_wrapper.hasClass('in_edit') )
				{
					$(this).css({opacity: 1});
				};
			});
		})
		.each(function(){
			// show label on hover
			$(this).hover(function()
			{
				annotations.css({opacity: 1});
							
				if (!labelText) 
				{
					var labelText = $(this).text();
					$('span.annotation-label').text(labelText);
				}
				$(this).mousemove(function(e){
					$('span.annotation-label').css({ left: e.pageX, top: e.pageY, zIndex: 9999999 });
				});
				
				// underline li in actor list that matches annotation title
				var text = $('span:first',this).text().split(',');
				$('li:contains('+text[0]+') a',actorList).css({textDecoration: 'underline'});		
			},function()
			{
				hide_label();
				$('li a',actorList).css({textDecoration: 'none'});
			})
		});
	
	obj.removeAttr('alt');
	
	objParent
		.mouseover(function(){
			annotations = $('.annotation',this);
			toolbar = $('.img-toolbar',this);
			
			$(this).addClass('img_hovered');
			
			if (!objParent.hasClass('zooming-img'))
			{
				annotations.css({opacity: 1});
			}
			
			// load hi res image if present and has not been loaded yet
			if($('.img-zoomer-hi-res',this).length && !$('.img-zoomer-hi-res',this).attr('src'))
			{
				$('.img-zoomer-hi-res',this).load_hi_res_image();
			}
			
			
			if ($.browser.msie && !objParent.hasClass('zooming-img')) 
			{
				annotations.show();
				toolbar.show();
				return false;
			}
			
			if (toolbar.length && toolbar.html() != '') 
			{
				toolbar.slideDown(200);
				if (annotations.css('opacity') < 1 && toolbar.css('display') == 'none') 
				{
					toolbar.show();
				}
			}
			
						
		})
		.mouseout(function(){	
			annotations = $('.annotation',this);
			toolbar = $('.img-toolbar',this);
			
			$(this).removeClass('img_hovered');
			
			if ($.browser.msie) 
			{
				annotations.hide();
				toolbar.animate({opacity: 1},800,function(){
					if ( toolbar.length && !objParent.hasClass('img_hovered') )
					{
						toolbar.slideUp(200);
					};
				});
				return false;
			}
			
			$(this).animate({opacity: 1},800,function(){
				annotations = $('.annotation',this);
				toolbar = $('.img-toolbar',this);
				if (!$(this).hasClass('img_hovered')) 
				{
					annotations.animate({opacity: 0},200);	
					if (toolbar.length)
					{
						toolbar.slideUp(200);
					};
				}
			});
		});
			
			
	// remove areas for edit mode - needed for IE
	$("area",usemap).remove();
	
	function hide_label()
	{
		$('span.annotation-label').css({top: -99999});
	}	

});
	
};
	
//
/*  $Id: lightbox.js 40738 2009-02-17 13:42:13Z tim $ */


// STATIC 

window.lightbox_pointer = null;


// Static hook to kill the currently active lightbox
// @return  undefined
function lightbox_remove()
{
	window.widget_manager.stop( 'lightbox' );
}


// Static hook to add an item to the top bar of the currently active lightbox
// @return  undefined
function lightbox_bar_add( x )
{
	$( "#lightbox-wrap-buttons" ).append( x );
}

// Static hook to add an button to the top bar of the currently active lightbox
// @return  undefined
function lightbox_bar_add_button( value, functionName )
{
	var str =  "<button onclick='lightbox_pointer." + functionName + "();'>" + value + "</button>";
	lightbox_bar_add( str );
}

// External callback to initialize the widget
// @param   mixed   container   jQuery selector for the object to be used
// @param   dom     context     DOM object used as jQuery context. Defaults to document.body
// @return  undefined
function init_lightbox( container, context )
{
	context = context || document;

	$( container, context ).each(
		function ()
		{
			var opts	= jQuery.attrOptions( this , 'lightbox' );
			var ajax	= jQuery.attrOptions( this , 'lightbox_ajax' );
			
			opts.ajax = ajax;
			
			new Lightbox( this, opts );
		}
	);
}


// External callback for the documentation functions
// @return  object      Structure containing 'examples' of usage, 'about' message, default 'opts', and 'classes' (never used...)
function docs_lightbox()
{
	var a = "A slightly too versatile lightbox implementation...";
	var e = [];
	var c = [];
	var s = jQuery.label( 'lightbox.cancel', 'Cancel' );
	var o = 
	[[ 'url', 			null, 	"Url to be loaded. Defaults to the href attribute in the element, and then to null" ]
	,[ 'lbl_cancel',	s, 		"Cancel button name" ]
	,[ 'width',			"60%", 	"Css width of the lightbox" ]
	,[ 'height',		"60%", 	"Css height of the lightbox" ]
	,[ 'freeze',		false, 	"Whether the lightbox size should be fixed instead of adapting to content"]
	,[ 'ajax',			{}, 	"Parameters to be added to lightbox url" ]
	,[ 'className',		"", 	"Class that will be added to the lightbox frame" ]
	];
	
	return { 'examples': e, 'about': a, 'opts': o, 'classes': c };
}


// Process the options for this widget (cached)
// // @param   object  o   Widget options extracted from the html
// // @return  object      Default options overriden by html options
function opts_lightbox( o )
{
	return apply_options( docs_lightbox().opts, o );	
}


function Lightbox( container, options )
{
	options			= opts_lightbox( options, container );
	options.url		= options.url || container.href || null;
	options.width	= ( "" + options.width  ).replace( 'px' , '' );
	options.height	= ( "" + options.height ).replace( 'px' , '' );

	this.options	= options;
	
	container = $( container ).get(0);
	container.obj_lightbox = this;

	var self = this;
	$( container ).click( 
		function (event)
		{
			window.lastEvent = event;
			self.show();
			return false;
		}
	);

	if ( options.showonload )
	{
		// bug#1732
		//
		// http://support.microsoft.com/default.aspx/kb/927917
		// http://clientside.cnet.com/code-snippets/manipulating-the-dom/ie-and-operation-aborted/
		//
		// The "operation is aborted" when we generate DOM content in the parent of a container of a script.
		// It is also aborted when we try to add DOM content to a container that is not yet ready.
		// We fix this IE problem by generating the lightbox inside the container that has the showonload parameter.
		//
		if ($.browser.msie)
		{
			this.show(container);
		}
		else
		{
			this.show();
		}
		container.blur();	
	}
}


// Callback for when the widget gets out of focus
// // @param   string  name    The name of the widget type
// // @param   object  obj     The object replacing this one in the widget focus
// // @return  bool            True if ajax request made, false otherwise
Lightbox.prototype.widgetBlur = function ( name, obj )
{
	if ( obj == null )
	{
		this.remove();
	}
	return false;
};



// Create the dom structure necessary to display lightbox
// @param container optional container where to create the lightbox
// @return  undefined
Lightbox.prototype.domCreate = function ( container )
{
	var self = this;
	
	var lo	= document.createElement( "div" );
	var lf	= document.createElement( "div" );
	var lw	= document.createElement( "div" );
	var lc	= document.createElement( "div" );
	var wb	= document.createElement( "div" );
	
	var cb	= $('<div></div>')
					.attr({id: 'lightbox-cancel', title: this.options.lbl_cancel})
					.click(function() 
					{ 
						self.remove();
					});
	
	lo.id	= "lightbox-overlay";
	lf.id	= "lightbox-frame";
	lw.id	= "lightbox-window";
	lc.id	= "lightbox-bar";
	wb.id	= "lightbox-wrap-buttons";
	
	lf.className = this.options.className;
	
	lf.style.position	= "absolute";
	lw.style.width		= "100%";
	lw.style.height		= "100%";
	
	if (container)
	{
		$( container ).append( lo );
		$( container ).append( lf );
	}
	else
	{
		$( "body" ).append( lo );
		$( "body" ).append( lf );
	}
		
	$( lf ).append( lc );
	$( lf ).append( lw );
	$( wb ).append( cb );
	$( lc ).append( wb );
	$( lc ).addClass('clearfix');
	
};


// Clear the timer used to resize the lightbox
// @return  undefined
Lightbox.prototype.clearResizeInterval = function()
{
	if ( window.lightbox_pointer && window.lightbox_pointer.interval )
	{
		clearInterval( window.lightbox_pointer.interval );
		window.lightbox_pointer.interval = null;
	}
};


// Remove this lightbox
// @return  undefined
Lightbox.prototype.remove = function ()
{
	this.clearResizeInterval();
	
	// $( document ).unkeyup();

	// Timeout is needed when this function is called from within the lightbox itself
	var self = this;
	setTimeout(
		function () 
		{
			$('#lightbox-window,#lightbox-frame,#lightbox-overlay').remove();
			self.showObjects();
		},
		500
	);
};


// Get the height of the page inside the lightbox 
// @return  undefined
Lightbox.prototype.size_of_content = function ()
{
	var fr = document.getElementById("lightbox-iframeContent").contentWindow;
	var h1 = 0;
	var h2 = 0;
	
	if ( fr && fr.document )
	{
		if ( fr.document.documentElement && fr.document.documentElement.scrollHeight )
		{
			h1 = fr.document.documentElement.scrollHeight;
		}

		if ( fr.document.body && fr.document.body.scrollHeight )
		{
			h2 = fr.document.body.scrollHeight;
		}
	}

	var h = Math.max( h1, h2 );
	var s = jQuery.getSize( document.getElementById( 'lightbox-frame'  ) );

	h = s.h < h ? h + 60 : 0;
	
	return h;
};


// Resize the lightbox in accordance to its contents
Lightbox.prototype.size = function ()
{
	if ( document.getElementById( "lightbox-iframeContent" ) )
	{
		var h = this.size_of_content();
		h > 0 && $( "#lightbox-frame" ).css( 'height', h + 'px' );
	}
};


// Convert a size in "%" into a value in "px"
// @param   string      x   Percentage value
// @param   integer     y   Absolute value
// @return  integer         Resulting pixel value
Lightbox.prototype.pixelizeSize = function ( x, y )
{
	x = parseInt( x.match( /\d+/ ) );
	x = Math.max( x , 0 );
	x = Math.min( x , 100 );
	x = Math.round( y * x / 100 );
	return x;
};


// Determine the width (horizontal position)
// @return  undefined
Lightbox.prototype.h_position = function ()
{
	var l = 0;
	var w = this.options.width;
	var d = jQuery.windowSize();

	if ( w.match( /\%/ ) )
	{
		w = this.pixelizeSize( w, d.w );
	}

	l = ( d.w - w ) / 2;

	$( "#lightbox-frame"  ).css( 'left',  l + 'px' );	
	$( "#lightbox-bar" ).css( 'width', w  - 2 + 'px' );
	$( "#lightbox-window" ).css( 'width', w + 'px' );
	
	this.overlaySize();	
};


// Determine the position  (vertical position)
// @return  undefined
Lightbox.prototype.v_position = function ()
{
	var pagesize   = jQuery.windowSize();	
	var pageScroll = jQuery.pageScrollTop();
	
	var t = 0;
	var h = this.options.height;
	var d = jQuery.windowSize();

	if ( h.match( /\%/ ) )
	{
		h = this.pixelizeSize( h, d.h );
	}

	t = ( d.h - h ) / 2;
	
	t = jQuery.pageScrollTop() + t;

	$( "#lightbox-frame" ).css({
		top:    t + 'px',
		height: h + 'px'
	});
};


// Determine size of dark mask 
// @return  undefined
Lightbox.prototype.overlaySize = function ()
{
	if ( window.innerHeight && window.scrollMaxY )
	{	
		yScroll = window.innerHeight + window.scrollMaxY;
	}
	else if ( document.body.scrollHeight > document.body.offsetHeight )
	{
		 // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	}
	else
	{ 
		// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
  	}

	$( "#lightbox-overlay" ).css( {height: yScroll + "px", cursor: 'pointer' })
							.bind('click', function()
							{
								Lightbox.prototype.remove();
							});
};


// Update de size of the lightbox at a regular time interval
// @return  undefined
Lightbox.prototype.setRegularUpdate = function ()
{
	var self 	= this;
	var fr 		= document.getElementById("lightbox-iframeContent");
	fr.interval = setInterval( 
		function () 
		{ 
			self.size() 
		}, 
		800 
	);
};

Lightbox.prototype.hideObjects = function ()
{
	var self = this;
	$( 'embed,select' ).each(
		function ()
		{
			this.preLightboxVisibility = $( this ).css( 'visibility' );
			this.style.visibility = 'hidden';
		}
	);
};

Lightbox.prototype.showObjects = function ()
{
	var self = this;
	$( 'embed,select' ).each(
		function ()
		{
			this.style.visibility = this.preLightboxVisibility;
		}
	);
};


// Show the lightbox
// @param container, optional container where to generate the lightbox
// @return  undefined
Lightbox.prototype.show = function ( container )
{
	try 
	{
		window.widget_manager.widgetFocus( 'lightbox', this );
		
		$( "#lightbox-overlay" ).get( 0 ) || this.domCreate(container);
		
		var scroll = jQuery.pageScrollTop();

/*		window.scrollTo( 0, scroll );*/

		this.overlaySize();

		this.options.before_ajax && this.options.before_ajax( this.options );
		
		// Let the request know it is inside a lightbox
		this.options.ajax.in_lightbox = '1';
		
		var url		= jQuery.addToQuery( this.options.url , jQuery.param( this.options.ajax ) );
		var rand	= Math.floor( Math.random() * 100000 );
		
		if ( document.getElementById( "lightbox-iframeContent" ) == null )
		{
			$("#lightbox-window").append(
				"<iframe src='" + url + "' name='frame" + rand + "' id='lightbox-iframeContent' frameborder='0' border='0' style='width: 100%; height: 100%;'></iframe>" );
		}
		else
		{
			$( "#lightbox-iframeContent").get(0).src = url;
		}
		
		this.v_position();
		this.h_position();
		
 		$( "#lightbox-window,#lightbox-frame" ).css( 'display' , 'block' );

		this.options.freeze || this.setRegularUpdate();
		
		window.lightbox_pointer = window.frames['frame'+rand];
		
		var self = this;
		$( window ).resize(function () 
		{
			self.h_position();
			self.v_position();
		});	
		
		setTimeout(
			function ()
			{
				self.hideObjects();
			},
			20
		)
	}
	catch( e ) 
	{
		jQuery.warn( "Lightbox" , "An error occurred when opening the lightbox." , e );
	}
};

		function autocomplete_add( ajax )
		{
			var current = window.widget_manager && window.widget_manager.current( 'lightbox' );
			
			extra = current.options;
			
			ajax['id']		  = id;
			ajax['predicate'] = pred;
			
			anyRest.edge.add( ajax , 
				function ( xml ) 
				{
					if ( anyRest.aux.error( xml ) ) 
					{
						jQuery.warn( "Autocomplete" , null , anyRest.aux.errorMsg( xml ) );
					}
					else
					{
						edge_inject( extra , xml  );
					}
		
				}
			);
		}


var LightboxHelper = 
{
	isLightbox: function(uri) 
	{
		if (!window.parent || window.parent.document.location.href == document.location.href)
		{
			return false;
		}
		if (!uri) uri = document.location.href;
		if (uri.match(/\bin_lightbox=1\b/))
		{
			return true;
		}
		
		return false;
	},

	openLightbox: function(url, container, options)
	{
		options['url'] = url;
		var lb = new Lightbox (container, options);
		lb.show();
	}
};

/**/
//
// External callback to initialize the widget
// @param	mixed	container	jQuery selector for the object to be used
// @param	dom		context		DOM object used as jQuery context. Defaults to document.body
function init_dialog ( container, context )
{
	context = context || document.body;
	
	$(container, context).each(function()
	{
		var opts = jQuery.attrOptions( this , 'dialog' );
		new Dialog( this, opts );
	});
}

// External callback for the documentation functions
// @return  object      Structure containing 'examples' of usage, 'about' message, default 'opts', and 'classes' (never used...)
function docs_dialog()
{
	var a = 'dialog is a lightweight version of lightbox';
	var e = 
	[
		[ '<a class="do_dialog" dialog="url: ..."', "simple popup using a custom div id" ],
	];
	
	var c = [];
	
	var o = 
	[ 
	 	[ 'width'			,'500px',  							'The width of the dialog' ],
		[ 'height'			,'auto',				 			'The height of the dialog' ],
	 	[ 'url'				,'',	  							'Url to load' ],
	 	[ 'ineffect' 		,{opacity: 'show', height: 'show'}, 'Action when clicked on the launch button. {opacity: \'show\', height: \'show\'}' ],
	 	[ 'ineffectTime'	,250,	  							'Duration of the startup effect' ],
	 	[ 'outeffect'		,{opacity: 'hide'}, 'Action when clicked on the close button. {opacity: \'hide\', height: \'hide\'}' ],
	 	[ 'outeffectTime'	,100, 				  				'Duration of the close effect' ],
	 	[ 'dialog'			,true,	  							'Is this box a dialog? It will become draggable and you get an overlay div, like a real lightbox.' ],
	 	[ 'direct'			,false,	  							'Fire the dialog without a click event'],
	 	[ 'title'			,'',	  							'The title of the dialog if there is no object specified'],
	 	[ 'callback'		,'',	  							'Function that gets called after the dialog is destroyed' ]
	];
	
	return { 'examples': e, 'about': a, 'opts': o, 'classes': c };
}

// Process the options for this widget
// @param   object  o   Widget options extracted from the html
// @return  object      Default options overriden by html options
function opts_dialog( o )
{
	return apply_options( docs_dialog().opts, o );
}

function Dialog( container, options )
{
	options			= opts_dialog( options );
	this.options	= options;
    this.container  = container;
        
	jQuery(container).dialog(
    {
    	width: 			options.width,
		height: 		options.height,
		url:			options.url,
		ineffect:		options.ineffect,
		ineffectTime:	options.ineffectTime,
		outeffect:		options.outEffect,
		outeffectTime:	options.outEffectTime,
		dialog:			options.dialog,
		direct:			options.direct,
		title:			options.title,
		callback:		options.callback
    });
}

;(function(jQuery)
{
	jQuery.fn.dialog = function(options)
	{
  		var options = jQuery.extend({}, jQuery.fn.dialog.defaults, options);

		return this.each(function() 
		{			
			if(options.direct)
			{
				jQuery.addDialog(options, jQuery(this));
			}
			else
			{
				jQuery(this).click(function()
				{
					jQuery.addDialog(options, jQuery(this))
				});
			}
		});
	}
	
	jQuery.extend(
	{                 
    	addDialog: function(options, obj)
		{
			var theBox, closeButton, templateWrapper, dialogContent, overlayDiv, clickedText, dragHandle, dialogTop, dialogLeft, boxHeight, buttonText, obj = obj || '';
			
			opts = options;
			
			if(!jQuery('.dialog').length)
			{
				clickedText		= jQuery('<div></div>').addClass('dialog-loader-text loading');
				closeButton		= jQuery('<span></span>').addClass('dialog-close').html('x');
				templateWrapper	= jQuery('<div></div>').addClass('dialog-template-wrapper');
				overlayDiv		= jQuery('<div></div>').addClass('dialog-overlay').css({zIndex: 100, opacity: .75, height: $(document).height() });
			
				if(typeof opts.height == 'string')
				{
					boxHeight = 'auto';
				}
				else
				{
					boxHeight = opts.height.replace('px', '') - 52;
				}
			
				if(obj != '')
				{
					dialogTop	= obj.position().top;
					dialogLeft	= obj.position().left;
					buttonText	= obj.html();
				}
				else
				{
					dialogTop	= jQuery(document.body).scrollTop() + Math.floor(jQuery(window).height() / 5);
					dialogLeft	= (jQuery(window).width() / 2) - (parseInt(opts.width) / 2);
					buttonText	= opts.title;
				}
				
				theBox 			= jQuery('<div></div>')
									.addClass('dialog')
									.css({position: "absolute", top: dialogTop, left: dialogLeft, width: opts.width, height: opts.height});
				
				dialogContent 	= jQuery('<div></div>')
									.addClass('dialog-content')
									.css({height: boxHeight})
									.append(clickedText)
									.appendTo(theBox);
				
				document.onkeypress = function(e)
				{
					if($.browser.msie) 
					{
						var key = e.which
					}
					else 
					{
						key = e.keyCode
					} 
					
					if(key == 27)
					{
						jQuery.fn.dialog.destroy(theBox);
					}
				}
				
				//clickedText.css({height: dialogContent.css('height') || 16});
													
				if(opts.dialog)
				{
					dragHandle	= jQuery('<div></div>')
									.addClass('dialog-drag-handle')
									.html('<span class="dialog-drag-handle-text">'+buttonText+'</span>')
									.mousedown(function()
									{
										$(this).addClass('pressed');
									})
									.mouseup(function()
									{
										$(this).removeClass('pressed');
									});
				
					theBox
						.draggable({
							handle: dragHandle
						})
						.prepend(dragHandle);
					
					jQuery(document.body).append(overlayDiv);
				}
				
				if(jQuery.browser.msie) 
				{
					theBox.css({background: 'none', padding: 0});
					
					if(jQuery.browser.version < 7)
					{
						jQuery('select').each(function()
						{
							jQuery(this).css({visibility: 'hidden'});
						});
					}
				}
				
				jQuery(document.body).append(theBox);
				
				theBox.animate(opts.ineffect, opts.ineffectTime, function()
				{
					if(opts.url)
					{
						jQuery.ajax({
							type: 'GET',
							url: opts.url,
							success: function(html)
							{
								dialogContent.append(templateWrapper);										
								
								clickedText.animate({opacity: 'hide'}, opts.outeffectTime, function()
								{
									templateWrapper
										.html(html)
										.animate(opts.ineffect, opts.ineffectTime, function()
										{
											var left = jQuery(theBox).position().left;
											var top  = jQuery(theBox).position().top;
											
											if(top + jQuery(this).height() > jQuery(window).height() && top > (jQuery(window).height() / 2))
											{
												var bodyTop = jQuery(document.body).scrollTop() + Math.floor(jQuery(window).height() / 5);
												theBox.animate({top: bodyTop}, 150);
											}
											
											if(left + jQuery(this).width() > jQuery(window).width())
											{
												theBox.animate({left: left - (jQuery(this).width() / 2) - 20}, 150);
											}
										});
										
									jQuery('.dialog-template-wrapper p:last', theBox).css({margin: 0});
									jQuery('.dialog-template-wrapper input:first', theBox).focus();
										
									if(opts.dialog)
									{
										dragHandle.append(closeButton);
									}
									else
									{
										templateWrapper.prepend(closeButton);
									}
								});
							}
						});
					}
					else
					{
						dialogContent.append(templateWrapper);
								
						clickedText.animate(opts.outeffect, opts.outeffectTime, function()
						{
							templateWrapper
								.html('<p>No template to load.</p>')
								.animate(opts.ineffect, opts.ineffectTime);							
						});
					}
				});
				
				closeButton.click(function()
				{
					jQuery.fn.dialog.destroy(theBox);	
				});
			}
		}
	});
	
	jQuery.fn.dialog.destroy = function(theBox)
	{
		var closeButton 	= jQuery('.dialog-close', theBox);
		var templateWrapper = jQuery('.dialog-template-wrapper', theBox);
		var overlayDiv		= jQuery('.dialog-overlay');
		
		templateWrapper.animate(opts.outeffect, opts.outeffectTime, function()
		{
			theBox.animate(opts.outeffect, opts.outeffectTime, function()
			{
				theBox.remove();
				overlayDiv.fadeOut(300, function()
				{
					overlayDiv.remove();
				});
				
				if(jQuery.browser.msie && jQuery.browser.version < 7) 
				{
					jQuery('select').each(function()
					{
						jQuery(this).css({visibility: 'visible'});
					})
				}
					
				if(opts.callback)
				{
					opts.callback();
				}
			});
		});
	}
	
	jQuery.fn.dialog.defaults = {
		width: 			'500px',
		height: 		'auto',
		url:			'',
		ineffect:		{opacity: 'show', height: 'show'},
		ineffectTime:	100,
		outeffect:		{opacity: 'hide'},
		outeffectTime:	100,
		dialog:			false,
		direct:			false,
		title:			'',
		callback:		''
	}

})(jQuery);
//
/* $Id: link.js 40440 2009-01-27 12:01:33Z bas $ */
/*  */



// External callback to initialize the widget
// @param   mixed   container   jQuery selector for the object to be used
// @param   dom     context     DOM object used as jQuery context. Defaults to document.body
// @return  undefined
function init_link( container, context )
{
	context = context || document;
	
	$( container, context ).each(
		function () 
		{
			var options		= jQuery.attrOptions( this , 'link' );
			options.ajax	= jQuery.attrOptions( this , 'link_ajax' );
			options.extra	= jQuery.attrOptions( this , 'link_extra' );
			new Link( this, options );
		}
	);
}



// External callback for the documentation functions
// @return  object      Structure containing 'examples' of usage, 'about' message, default 'opts', and 'classes' (never used...)
function docs_link()
{
	var a = 'Link things';
	var e = [];
	var c = [];
	var o = 
	[[ "id", 			null,				"Id of the element to hide/show during linking - defaults to id of container extracted from the element" ]
	,[ "url",			null,				"Used for connection via url (eg. module)" ]
	,[ "silent",		false,				"Don't jQuery.log on ajax error" ]
	,[ "service",		"anymeta.edge.add",	"Name of REST service" ]
	,[ "dropDown",		null,				"jQuery selector of autocomplete dom element -- used with the imputless dropdow menu" ]
	,[ "showonload",	false,				"Start widget immediatly as page loads" ]
	,[ "toggle",		false,				"Link element switches between two views"]
	,[ "toggle_hide",	null, 				"DOM id of object to hide on link_show"]
	,[ "toggle_show",	null, 				"DOM id of object to show on link_show"]
	,[ "ajax",			{},					"Extra ajax parameters" ]
	,[ "extra",			{},					"Parameters passed to the scomp when creating an instance of the newly-linked element" ]
	,[ "notification",	'',					"The notification the system should give after succes of the ajax call" ]
	];
	
	return { 'examples': e, 'about': a, 'opts': o, 'classes': c };
}



// Process the options for this widget (cached)
// @param   object  o   Widget options extracted from the html
// @return  object      Default options overriden by html options
function opts_link( o )
{
	window.link_opts = window.link_opts || docs_link().opts;
	return apply_options( window.link_opts, o );
}



function Link( container, options )
{
	options			= opts_link( options, container );
	options.id		= options.id 	|| container.id 	|| null;
	options.url		= options.url	|| container.href	|| null;
	this.options	= options;
	this.container	= container;
	var self = this;
	$( container ).click( 
		function (event) 
		{
			window.lastEvent = event;
			self.show();
			return false;
		}
	);

	this.options.showonload && this.show();
}



// Hide the widget
// @return undefined
Link.prototype.hide = function ()
{
	if ( this.options.ajax.link_autocomplete )
	{
		$( "#link_overlay" ).remove();
		this.showObjects();
	}
	$( "#link_" + this.options.id ).remove();
	$( "#" + this.options.id ).show();		


	// could be an automplete box
	$( "#autocomplete_" + this.options.id ).remove();
};


// Static hook to hide the current widget
// @return undefined
function link_hide()
{
	window.widget_manager && window.widget_manager.stop( 'link' );
}



// Callback for when the widget gets out of focus
// @param   string  name    The name of the widget type
// @param   object  obj     The object replacing this one in the widget focus
// @return  bool            True if ajax request made, false otherwise
Link.prototype.widgetBlur = function ( name, obj )
{
	if ( obj != this )
	{
		this.hide();
	}
	return false;
};



// Show the widget
// @return undefined
Link.prototype.show = function ()
{
	window.widget_manager && window.widget_manager.widgetFocus( 'link', this );

	if ( this.options.id && document.getElementById( 'link_' + this.options.id ) )
	{
		return false;
	}

	if ( this.options.url != null )
	{
		this.linkByURL();
	} 
	else if ( this.options.dropDown )
	{
		var auto = $( this.options.dropDown ).get( 0 ).obj_autocomplete;
		auto.show();
	} 
	else 
	{
		this.linkDirectly();
	}
};



// Connect by loading a given scomp first
// @return undefined
Link.prototype.linkByURL = function ()
{
	// connection via url (eg. module)
	var arrowOffset	= this.container.offsetWidth;
	var pos 		= jQuery.elemInWindow( this.container );

	if ( this.options.ajax.link_autocomplete )
	{
		// create overlay link holder 9 i this case for the autocomplete 
		$( "#link_overlay" ).get( 0 ) || this.domCreate( );
		this.overlaySize();

		var ac 		 = document.createElement( 'div' );
		ac.id 		 = 'autocomplete_' + this.options.id;
		ac.className = 'autocomplete-holder';
		$( document.body ).append( ac );

		$( ac )
			.css( { position: "absolute", "z-index": 102, left: 0, top: pos.t + 30 + "px" } )
			.load( jQuery.addToQuery( this.options.url , jQuery.param( this.options.ajax ) ) );
		
		var self 	= this;
		setTimeout(
			function ()
			{
				self.hideObjects();
			},
			20
		);
	}
	else
	{
		var link = document.createElement( 'div' );
		link.id = 'link_' + this.options.id;
		link.className = 'link-holder';
		$( document.body ).append( link );

		$( link )
			.css( { position: "absolute", left: pos.l + "px", top: pos.t + "px" } )
			.load( jQuery.addToQuery( this.options.url , jQuery.param( this.options.ajax ) ) );
	}
};

// Create the dom structure necessary to display lightbox
// @param container optional container where to create the lightbox
// @return  undefined
Link.prototype.domCreate = function ( container )
{
	var lo	= document.createElement( "div" );
	
	lo.id	= "link_overlay";

	if (container)
	{
		$( container ).append( lo );
	}
	else
	{
		$( "body" ).append( lo );
	}
	
};

// Determine size of dark mask 
// @return  undefined
Link.prototype.overlaySize = function ()
{
	if ( window.innerHeight && window.scrollMaxY )
	{	
		yScroll = window.innerHeight + window.scrollMaxY;
	}
	else if ( document.body.scrollHeight > document.body.offsetHeight )
	{
		 // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	}
	else
	{ 
		// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
  	}

	$( "#link_overlay" ).css( "height" , yScroll + "px" );
};


// Connect directly
// @return undefined
Link.prototype.linkDirectly = function ()
{
	// direct connection
	$( this.container ).append(
		'<span id="throbberwait"><img src="http://static.mediamatic.nl/f/smpz/image/throbberwait.gif" alt="" /></span>'
	);
	
	var self 	= this;
	anyRest.service( this.options.service, this.options.ajax, 
		function ( xml ) 
		{
			if ( anyRest.aux.error( xml ) )
			{
				// on error
				var errorMsg = anyRest.aux.errorMsg( xml ) || 'Something went wrong, try again later.';
				$( "#throbberwait" ).remove();
				jQuery.warn( "Link" , null , errorMsg );
			}
			else
			{
				self.options.callback && self.options.callback( xml );
				// on ok
				if ( self.options.writetxt != null ) 
				{
					$( self.container ).remove();
					$( "#throbberwait" ).empty();
					$( "#throbberwait" ).prepend( self.options.writetxt );
				} 
				else if ( self.options.rebuild_scp ) 
				{
					$( "#throbberwait" ).remove();

					rebuild_scp( self.options );
				}
				else if ( self.options.toggle && self.options.toggle_hide != null && self.options.toggle_show != null) 
				{
					$( "#throbberwait" ).remove();
					$( "#" + self.options.toggle_show ).show();
					$( "#" + self.options.toggle_hide ).hide();
				}
				else
				{
					$( "#throbberwait" ).remove();
				}
				
				//if(self.options.notification)
				//{
				//	anyRest.notifications.add(self.options.notification,'success');	
				//}
			}
		}
	);
};

Link.prototype.hideObjects = function ()
{
	$( 'embed,select' ).each(
		function ()
		{
			this.preLinkVisibility = $( this ).css( 'visibility' );
			this.style.visibility = 'hidden';
		}
	);
};

Link.prototype.showObjects = function ()
{
	$( 'embed,select' ).each(
		function ()
		{
			this.style.visibility = this.preLinkVisibility;
		}
	);
};


// STATIC FUNCTIONS


// Static callback for injecting the link results on the page
// Removed from template file because of scoping problems
function edge_clone( oldid , xmlsubs , xml )
{
	var o = document.getElementById( oldid );
	var x = o.cloneNode(true);
	var newid = x.getAttribute( 'newid' );
	
	$( x )
		.attr( 'id', newid )
		.addClass( 'sortable-item' )
		.removeClass( 'link_new' );
	$( o ).before( x );

	for ( var i = 0 ; i < xmlsubs.length ; i++ )
	{
		var r = new RegExp( '\\$' + xmlsubs[i] , 'g' );
		x.innerHTML = x.innerHTML.replace( r , $( xmlsubs[i] , xml ).text() );
		x.id 		= x.id.replace( r , $( xmlsubs[i] , xml ).text() );
	}

	$( x ).show();
	init_unlink( x );
	$( x ).SortableAdd();
}



// Static callback for injecting the link results on the page
function edge_inject( ops, xml )
{
	var dom_id		 = ops.dom_id;
	var file		 = ops.file;
	var manipulation = ops.manipulation || '';
	var new_base	 = ops.new_base 	|| 'list_item';

	if ( jQuery.isObject( dom_id ) )
	{
		for ( var i = 0 ; i < dom_id.length ; i++ )
		{
			fl = jQuery.isObject( file ) 		 ? file[i] 		   : file;
			nb = jQuery.isObject( new_base ) 	 ? new_base[i] 	   : new_base;
			mp = jQuery.isObject( manipulation ) ? manipulation[i] : manipulation;

			_edge_inject( ops, xml, dom_id[i], fl, nb, mp );
		}	
	}
	else
	{
		_edge_inject( ops, xml, dom_id, file, new_base, manipulation );
	}
}

function _edge_inject ( ops, xml, dom_id, file, new_base, manipulation )
{
	var rsp			 = xml.getElementsByTagName( 'rsp' 			)[0];
	var edg_id		 = rsp.getElementsByTagName( 'edg_id' 		)[0].firstChild.nodeValue;
	var predicate_id = rsp.getElementsByTagName( 'predicate_id' )[0].firstChild.nodeValue;
	var thg_id		 = rsp.getElementsByTagName( 'subject' 		)[0].firstChild.nodeValue;
	var list_id		 = rsp.getElementsByTagName( 'object' 		)[0].firstChild.nodeValue;

	// Renamed the thg_id paramater to subject_id
	// thg_id is stronger then list_id in template fetching
	// so the subject list item tempalte is used
	// When a person is added to an article the article list item is fetched
	// TODO: lets see if this works out

	var scomp_options = jQuery.assocMerge( 
		ops.extra,
		{ 	'name': 		file, 
			'edg_id':		edg_id,
			'predicate_id':	predicate_id,
			'list_id':		list_id,
			'new_base':		new_base,
			'subject_id':	thg_id,
			'thg_id':		thg_id
		}
	);

	anyRest.html.scomp ( scomp_options , 
		function ( xml ) 
		{
			if (anyRest.aux.error(xml)) 
			{
				jQuery.log(anyRest.aux.errorMsg(xml));
			}
			else
			{
				var ts = xml.getElementsByTagName( 'html' )[0];
				x = document.getElementById( dom_id );
			
				if ( ts && x )
				{
					var v = anyRest.aux.concatChildNodes( ts );
					//var v = ts.firstChild.nodeValue;
					if ( manipulation == 'replace' )
					{
						$( x ).after ( v ).remove();
					}
					else if ( manipulation == 'inner' )
					{
						$( x ).innerHTML( v );
					}
					else if ( manipulation == 'before' )
					{
						$( x ).before( v );
					}
					else if ( manipulation == 'after' )
					{
						$( x ).after( v );
					}
					else if ( manipulation == 'prepend' )
					{
						$( x ).prepend( v );
					}
					else if ( manipulation == 'append' )
					{
						$( x ).append( v );
					}
					else
					{
						$( x ).before( v );
					}
			
					y = document.getElementById( new_base + '' + edg_id );
			
					init_widgets( y );
					//init_unlink( '.do_unlink' , y );
					//init_lightbox( '.do_lightbox' , y );
					//$( y ).SortableAdd();
			
				}
				else
				{
					jQuery.log('Internal error: did not get a template from the server or no dom id. Sorry...');
				}
			}
		}
	);
}


// Static callback for injecting the link results on the page
// Give access rights to a user
function auth_add( usr_id )
{
	var current = window.widget_manager && window.widget_manager.current( 'link' );
	opts = {};
	opts['usr_id']		= usr_id;
	opts['aco_section']	= current.options.ajax.aco_section;
	opts['aco_value']	= current.options.ajax.aco_value;
	opts['id']			= current.options.ajax.id;

	anyRest.service( 'accesscontrol.user.thing.add', opts,
		function ( xml ) 
		{
			if ( anyRest.aux.error( xml ) )
			{
				jQuery.warn( "Link", null, anyRest.aux.errorMsg( xml ) );
			}
			else
			{
				auth_inject( xml );	
			}
		}
	);
	link_hide();
}



// Inject a scomp for a user that as access rights 
// Static callback for injecting the link results on the page
function auth_inject( xml )
{
	var current		 = window.widget_manager && window.widget_manager.current( 'link' );
	var dom_id		 = current.options.dom_id;
	var manipulation = current.options.manipulation;
	var new_base	 = current.options.new_base 	|| 'list_item';

	var rsp		= xml.getElementsByTagName( 'rsp' 	 )[0];
	var usr_id	= rsp.getElementsByTagName( 'usr_id' )[0].firstChild.nodeValue;
	var gut_id 	= rsp.getElementsByTagName( 'gut_id' )[0].firstChild.nodeValue;

	var scomp_options = jQuery.assocMerge(
		current.options.extra,
		{ 'gut_id': gut_id,
		  'usr_id': usr_id
		}
	);	

	anyRest.service( 'anymeta.html.scomp', scomp_options, 
		function ( xml ) 
		{
			if ( anyRest.aux.error( xml ) )
			{
				jQuery.warn( "Link", null, anyRest.aux.errorMsg( xml ) );
			}
			else 
			{
				//var html = xml.getElementsByTagName( 'html' )[0];
				//$( '#' + dom_id ).append( html.firstChild.nodeValue );
				//init_unlink( '.do_unlink' );

				var ts = xml.getElementsByTagName( 'html' )[0];
				x = document.getElementById( dom_id );
			
				if ( ts && x )
				{
					var v = anyRest.aux.concatChildNodes( ts );
					//var v = ts.firstChild.nodeValue;
					if ( manipulation == 'replace' )
					{
						$( x ).after ( v ).remove();
					}
					else if ( manipulation == 'inner' )
					{
						$( x ).innerHTML( v );
					}
					else if ( manipulation == 'before' )
					{
						$( x ).before( v );
					}
					else if ( manipulation == 'after' )
					{
						$( x ).after( v );
					}
					else if ( manipulation == 'prepend' )
					{
						$( x ).prepend( v );
					}
					else if ( manipulation == 'append' )
					{
						$( x ).append( v );
					}
					else
					{
						$( x ).before( v );
					}
			
					y = document.getElementById( new_base + '' + gut_id );
			
					init_widgets( y );
				}
				else
				{
					jQuery.log('Internal error: did not get a template from the server or no dom id. Sorry...');
				}
			}
		}
	);
}



// Static callback for injecting the link results on the page
function edge_add( ajax )
{
	var current = window.widget_manager && window.widget_manager.current( 'link' );
	extra = current.options;
	ajax['id']		  = extra.ajax.id;
	ajax['predicate'] = extra.ajax.predicate;
	ajaxNotice = new AjaxNotice();

	ajaxNotice.start( '...' );
	anyRest.edge.add( ajax , 
		function ( xml ) 
		{
			ajaxNotice.stop();

			if ( anyRest.aux.error( xml ) ) 
			{
				jQuery.warn( "Link" , null , anyRest.aux.errorMsg( xml ) );
			}
			else
			{
				edge_inject( extra , xml  );
	 		}

		}
	);

	link_hide();
}

function edge_add_lb ( ajax )
{
	var current = window.widget_manager && window.widget_manager.current( 'link' );
	var extra   = current.options;

	var id	  = extra.ajax.id;
	var pred  = extra.ajax.predicate;
	var title = ajax.object_title;

	//var kind  = ajax.object_kind;
	//var type  = ajax.object_type;

	url = '/add/object/ID/PRED';
	
	url = url.replace(/ID/,   escape(id));
	url = url.replace(/PRED/, escape(pred));
	
	b = document.createElement( 'button' );
	b.style.display = 'none';
	
	jQuery( document.body ).append( b );
	
	var l_opt 	 = {};
	l_opt.freeze = true;
	l_opt.width  = '60%';
	l_opt.height = '80%';
	l_opt.url	 = url;
	
	if (title)
	{
		l_opt.url += '?title='+escape(title);
	}

/*	
	if (kind)
	{
		l_opt.url += '&amp;kind=' + escape(kind);
	}
	if (type)
	{
		l_opt.url += '&amp;type=' + escape(type);
	}
*/

	l = new Lightbox( b , l_opt );
	l.show();
}

// Static callback for injecting the link results on the page
function add_tag ( opts , addexisting )
{
	var rest = addexisting ? anyRest.edge.add : anyRest.tags.add;

	var current = window.widget_manager && window.widget_manager.current( 'link' );
	opts['id']  = current.options.ajax.id;

	rest( opts , 
		function ( xml ) 
		{
			if ( anyRest.aux.error( xml ) ) 
			{
				jQuery.warn( "Add tag" , null , anyRest.aux.errorMsg( xml ) );
			}
			else
			{
				edge_inject_tag();
			}
		}
	);

	link_hide();
}



// Static callback for injecting the link results on the page
function edge_inject_tag ()
{
	var current = window.widget_manager && window.widget_manager.current( 'link' );
	var id		= current.options.ajax.id;
	var file	= current.options.file;
	var dom_id	= current.options.dom_id;

	anyRest.html.scomp ( 
		{ 'name': file, 'thg_id': id } , function (xml) { edge_inject_aux ( xml , dom_id ) }
	);
}



// Static callback for injecting the link results on the page
function edge_inject_aux ( xml , dom_id ) 
{
	if (anyRest.aux.error(xml)) 
	{
		jQuery.log(anyRest.aux.errorMsg(xml));
	}
	else
	{
		var ts = xml.getElementsByTagName( 'html' )[0];

		x = document.getElementById( dom_id );
		if ( ts && x )
		{
			$( x ).after( ts.firstChild.nodeValue ).remove();
			
			y = document.getElementById( dom_id );
			init_widgets( y );
			//init_link( '.do_link' , y );
			//init_unlink( '.do_unlink' , y );
			//init_lightbox( '.do_lightbox' , y );
		}
		else
		{
			jQuery.log('Internal error: did not get a template from the server or no dom id. Sorry...');
		}
	}
} 


// Static callback for injecting the link results on the page
function edit_trust ( id, dom_id, file, lang, rem_id, val, field )
{
	fld = field || 'trust.view';
	var options = {
		'id':	 id, 
		'field': fld,
		'value': val,
		'lang':	 lang
	};

	anyRest.predicates.set( 
		options , 
		function ( xml ) 
		{
			if ( anyRest.aux.error( xml ) )
			{
				// on error
				jQuery.log(anyRest.aux.errorMsg(xml));
			}
			else
			{
				// create new scomp with the date
				var scomp_options = {
					'name':	  file, 
					'thg_id': id,
					'list_id': id,
					'dom_id': dom_id,
					'trust': val,
					'field': fld
				};
			
				anyRest.html.scomp ( scomp_options , 
					function ( xml ) 
					{
						if (anyRest.aux.error(xml)) 
						{
							jQuery.showHide(onfail);
							jQuery.log(anyRest.aux.errorMsg(xml));
						}
						else
						{
							var ts = xml.getElementsByTagName( 'html' )[0];

							x = document.getElementById( dom_id );
							if ( ts && x )
							{
								$( x ).after( ts.firstChild.nodeValue ).remove();
								
								y = document.getElementById( dom_id );
								$( "#" + rem_id ).remove();
								init_widgets( y );
							}
							else
							{
								jQuery.log('Internal error: did not get a template from the server or no dom id. Sorry...');
							}
						}
					}
				);
			}
		}
	);

}

/*  */
/*  */
/*  */



// External callback to initialize the widget
// @param   mixed   container   jQuery selector for the object to be used
// @param   dom     context     DOM object used as jQuery context. Defaults to document.body
// @return  undefined
function init_unlink( container , context )
{
	context = context || document;
	
	$( container, context ).each(
		function () 
		{
			var options		= jQuery.attrOptions( this , 'unlink' );
			options.ajax	= jQuery.attrOptions( this , 'unlink_ajax' );

			new Unlink( this, options );
		}
	);
}



// External callback for the documentation functions
// @return  object      Structure containing 'examples' of usage, 'about' message, default 'opts', and 'classes' (never used...)
function docs_unlink()
{
	var a = 'Unlink things';
	var e = [];
	var c = [];
	var o = 
	[[ "unlink", 	jQuery.label( 'unlink.title'	, 'Unlink this item'),	"Label - html 'title' attribute of [x]" ]
	,[ "confirm",	jQuery.label( 'unlink.confirm'	, 'Remove'			),	"Label - confirmation text" ]
	,[ "yes",		jQuery.label( 'unlink.yes'		, 'Yes'				),	"Label - confirmation button" ]
	,[ "cancel",	jQuery.label( 'unlink.cancel'	, 'Cancel'			),	"Label - cancelation button" ]
	,[ "service",	"anymeta.edge.remove",	"Name of REST service" ]
	,[ "use_cross",	true,						"use a cross?" ]
	,[ "ajax",		{},						"Extra ajax parameters" ]
	];
	
	return { 'examples': e, 'about': a, 'opts': o, 'classes': c };
}



// Process the options for this widget (cached)
// @param   object  o   Widget options extracted from the html
// @return  object      Default options overriden by html options
function opts_unlink( o )
{
	window.unlink_opts = window.unlink_opts || docs_unlink().opts;
	return apply_options( window.unlink_opts, o );
}



function Unlink( container, options )
{
	options			= opts_unlink( options );
	this.options	= options;
	this.container	= container;

    this.show();
}



// Callback for when the widget gets out of focus
// @param   string  name    The name of the widget type
// @param   object  obj     The object replacing this one in the widget focus
// @return  bool            True if ajax request made, false otherwise
Unlink.prototype.widgetBlur = function ( name, obj )
{
	if ( obj != this )
	{
		this.selector_dont();
	}
	return false;
};



// Callback for when the [x] is clicked
// @param   event   ev      Click event
// @return  boolean         (Always) false to stop the event propagation
Unlink.prototype.x_fun = function ( ev, obj )
{
	window.widget_manager.widgetFocus( 'unlink', this );
	
    // this.marker.style.display 	= "none";
	// this.selector.style.display = "block";
	
	$(this.selector).fadeIn(300);
	
	var pos = jQuery.elemInWindow( obj );

	$(this.container).addClass('unlinking');

	$( this.selector ).css({
		position: 	"absolute",
		left: 		pos.l,
		top: 		pos.t
	});

	return false;
};



// Make the yes / no confirmation dialog
// @param   string      id      The suffix used in the dom ids of the different elements
// @return  undefined
Unlink.prototype.mk_selector = function ( id )
{
	var div = document.createElement( 'div' );
		div.id = 'unlink_confirm_' + id;
		div.className = 'unlink-confirm';
		div.innerHTML = '<span class="unlink-confirm-text">' + this.options.confirm + '</span>';
		div.style.display = 'none';
		div.style.zIndex = 200;
		$( document.body ).append( div );

	var buty = document.createElement( 'button' );
		buty.className = 'unlink-confirm-yes cancel';
		buty.innerHTML = this.options.yes;
		$( div ).append( buty );

	var butn = document.createElement( 'button' );
		butn.id = 'unlink-confirm-cancel' + id;
		butn.className = 'cancel';
		butn.innerHTML = this.options.cancel;
		$( div ).append( butn );
		
	this.selector = div;
	this.selector_y = buty;
	this.selector_n = butn;
};



// Make the [x] marker
// @param   string      id      The suffix used in the dom ids of the different elements
// @return  undefined
Unlink.prototype.mk_marker = function ( id )
{
	var del = document.createElement( 'span' );
		del.id = 'unlink_' + id;
		del.className = "unlink-marker";

	var axx = document.createElement( 'a' );
		axx.title 			= this.options.unlink;
		axx.href  			= 'javascript:void(0);';
		
		if(this.options.use_cross)
		{
			$(axx).html('<img src="http://static.mediamatic.nl/f/smpz/image/cross.gif" alt="" />');
		}
		
		$(axx).css({cursor: 'pointer'});
		$(axx).addClass('do_tooltip');
		$(axx).attr('tooltip', 'width: \'auto\'');

    $( del ).append( axx );
    $( this.container ).append( del );
    this.marker     = del;
    this.marker_x   = axx;
};

// Show the [x] symbol and initialize other structures
// @return  undefined
Unlink.prototype.show = function ()
{
	$( this.container ).addClass('unlink-hover');

	// the object which should be removed could be anither one of the 
	this.id = this.options.id || this.container.id;
	
	this.marker || this.mk_marker( this.id );
	// this.marker.style.display = 'block';
		
	this.selector || this.mk_selector( this.id );

	if ( this.container.tagName.toLowerCase() == 'button' ) 
	{
		var mdown = this.container;
	}
	else
	{
		var mdown = this.marker_x;
	}
	
	var self = this;
	
	var fdown = function ( ev )
	{ 
		ev.preventDefault();
		// $( mdown ).unbind( 'mousedown' , fdown );
		self.x_fun( ev, this );
		return false;
	} 
	
	$( mdown ).bind( 'mousedown' , fdown );
	
	$( this.selector_y ).click( 
		function ( ev )
		{ 
			self.selector_do();
			ev.preventDefault();
			return false;
		}
	);

	$( this.selector_n ).click( 
		function ( ev )
		{ 
			self.selector_dont();
			ev.preventDefault();
			return false;
		}
	);	
};



// Callback for when 'yes' is press on the confirmation dialog
// @return  undefined
Unlink.prototype.selector_do = function ()
{
	if ( this.is_unlinked && !this.options.toggle)
	{
		return;
	}

	this.is_unlinked = true;

	this.selector && $( this.selector ).remove();
	this.selector = null;

	var self = this;
	anyRest.service( this.options.service, this.options.ajax , 
		function ( xml ) 
		{
			self.options.callback && self.options.callback( xml );

			if ( self.options.rebuild_scp ) 
			{
				rebuild_scp( self.options );
			}
			else if ( self.options.toggle && self.options.toggle_hide != null && self.options.toggle_show != null )
			{
				$( ".unlink-confirm" , self.container ).remove();

				$( "#" + self.options.toggle_show ).show();
				$( "#" + self.options.toggle_hide ).hide();
			} 
			else 
			{
				$( "#" + self.id ).fadeOut('slow');
			}
		}
	);
};



// Callback for when 'no' is pressed in the confirmation dialog
// @return  undefined
Unlink.prototype.selector_dont = function ()
{
    if ( this.selector )
    {
        $(this.selector).slideUp(100);
        // this.selector.style.display = 'none';
    }
	$( this.container ).removeClass('unlink-hover').removeClass('unlinking');
};


/*  */
// Accordion Content script: By Dynamic Drive, at http://www.dynamicdrive.com
// Created: Jan 7th, 08'
// $Id: ddaccordion.js 33924 2008-03-07 11:07:02Z marc $

// 

var ddaccordion={
	
	contentclassname:{}, //object to store corresponding contentclass name based on headerclass

	expandone:function(headerclass, selected){ //PUBLIC function to expand a particular header
		this.toggleone(headerclass, selected, "expand")
	},

	collapseone:function(headerclass, selected){ //PUBLIC function to collapse a particular header
		this.toggleone(headerclass, selected, "collapse")
	},

	expandall:function(headerclass){ //PUBLIC function to expand all headers based on their shared CSS classname
		var $headers=$('.'+headerclass)
		$('.'+this.contentclassname[headerclass]+':hidden').each(function(){
			$headers.eq(parseInt($(this).attr('contentindex'))).click()
		})
	},

	collapseall:function(headerclass){ //PUBLIC function to collapse all headers based on their shared CSS classname
		var $headers=$('.'+headerclass)
		$('.'+this.contentclassname[headerclass]+':visible').each(function(){
			$headers.eq(parseInt($(this).attr('contentindex'))).click()
		})
	},

	toggleone:function(headerclass, selected, optstate){ //PUBLIC function to expand/ collapse a particular header
		var $targetHeader=$('.'+headerclass).eq(selected)
		var $subcontent=$('.'+this.contentclassname[headerclass]).eq(selected)
		if (typeof optstate=="undefined" || optstate=="expand" && $subcontent.is(":hidden") || optstate=="collapse" && $subcontent.is(":visible"))
			$targetHeader.click()
	},

	expandit:function($targetHeader, $targetContent, config){
		$targetContent.slideDown(config.animatespeed)
		this.transformHeader($targetHeader, config, "expand")
	},

	collapseit:function($targetHeader, $targetContent, config){
		$targetContent.slideUp(config.animatespeed)
		this.transformHeader($targetHeader, config, "collapse")
	},

	transformHeader:function($targetHeader, config, state){
		$targetHeader.addClass((state=="expand")? config.cssclass.expand : config.cssclass.collapse) //alternate btw "expand" and "collapse" CSS classes
		.removeClass((state=="expand")? config.cssclass.collapse : config.cssclass.expand)
		if (config.htmlsetting.location=='src'){ //Change header image (assuming header is an image)?
			$targetHeader=($targetHeader.is("img"))? $targetHeader : $targetHeader.find('img').eq(0) //Set target to either header itself, or first image within header
			$targetHeader.attr('src', (state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse) //change header image
		}
		else if (config.htmlsetting.location=="prefix") //if change "prefix" HTML, locate dynamically added ".accordprefix" span tag and change it
			$targetHeader.find('.accordprefix').html((state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse)
		else if (config.htmlsetting.location=="suffix")
			$targetHeader.find('.accordsuffix').html((state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse)
	},

	getCookie:function(Name){ 
		var re=new RegExp(Name+"=[^;]+", "i") //construct RE to search for target name/value pair
		if (document.cookie.match(re)) //if cookie found
			return document.cookie.match(re)[0].split("=")[1] //return its value
		return null
	},

	setCookie:function(name, value){
		document.cookie = name + "=" + value
	},

	init:function(config){
	document.write('<style type="text/css">\n')
	document.write('.'+config.contentclass+'{display: none}\n') //generate CSS to hide contents
	document.write('<\/style>')
	$(document).ready(function(){
		ddaccordion.contentclassname[config.headerclass]=config.contentclass //remember contentclass name based on headerclass
		config.cssclass={collapse: config.toggleclass[0], expand: config.toggleclass[1]} //store expand and contract CSS classes as object properties
		config.htmlsetting={location: config.togglehtml[0], collapse: config.togglehtml[1], expand: config.togglehtml[2]} //store HTML settings as object properties
		var lastexpanded={} //object to hold reference to last expanded header and content (jquery objects)
		var expandedindices=(config.persiststate)? ddaccordion.getCookie(config.headerclass) : config.defaultexpanded
		expandedindices=(typeof expandedindices=='string')? expandedindices.replace(/c/ig, '').split(',') : config.defaultexpanded //test for valid cookie ('string'), otherwise (null, or 1st page load), default to defaultexpanded setting
		var $subcontents=$('.'+config["contentclass"])
		if (config["collapseprev"] && expandedindices.length>1)
			expandedindices=[expandedindices.pop()] //return last array element as an array (for sake of jQuery.inArray())
		$('.'+config["headerclass"]).each(function(index){ //loop through all headers
			if (/(prefix)|(suffix)/i.test(config.htmlsetting.location) && $(this).html()!=""){ //add a SPAN element to header depending on user setting and if header is a container tag
				$('<span class="accordprefix"></span>').prependTo(this)
				$('<span class="accordsuffix"></span>').appendTo(this)
			}
			$(this).attr('headerindex', index+'h') //store position of this header relative to its peers
			$subcontents.eq(index).attr('contentindex', index+'c') //store position of this content relative to its peers
			var $subcontent=$subcontents.eq(index)
			if (jQuery.inArray(index, expandedindices)!=-1){ //check for headers that should be expanded automatically
				if (config.animatedefault==false)
					$subcontent.show()
				ddaccordion.expandit($(this), $subcontent, config)
				lastexpanded={$header:$(this), $content:$subcontent}
			}  //end check
			else{
				$subcontent.hide()
				ddaccordion.transformHeader($(this), config, "collapse")
			}
		})
		$('.'+config["headerclass"]).click(function(){ //assign behavior when headers are clicked on
				var $subcontent=$subcontents.eq(parseInt($(this).attr('headerindex'))) //get subcontent that should be expanded/collapsed
				if ($subcontent.css('display')=="none"){
					ddaccordion.expandit($(this), $subcontent, config)
					if (config["collapseprev"] && lastexpanded.$header && $(this).get(0)!=lastexpanded.$header.get(0)){ //collapse previous content?
						ddaccordion.collapseit(lastexpanded.$header, lastexpanded.$content, config)
					}
					lastexpanded={$header:$(this), $content:$subcontent}
				}
				else{
					ddaccordion.collapseit($(this), $subcontent, config)
				}
				return false
 	})
		$(window).bind('unload', function(){ //clean up and persist on page unload
			$('.'+config["headerclass"]).unbind('click')
			var expandedindices=[]
			$('.'+config["contentclass"]+":visible").each(function(index){ //get indices of expanded headers
				expandedindices.push($(this).attr('contentindex'))
			})
			if (config.persiststate==true){ //persist state?
				expandedindices=(expandedindices.length==0)? '-1c' : expandedindices //No contents expanded, indicate that with dummy '-1c' value?
				ddaccordion.setCookie(config.headerclass, expandedindices)
			}
		})
	})
	}
};

// 