/**
 * Aggregated script. All javascripts under this node will be included.
 */

var contextPath = '';

    /*!
 * jQuery JavaScript Library v1.4.4
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Thu Nov 11 19:04:53 2010 -0500
 */
(function( window, undefined ) {

// Use the correct document accordingly with window argument (sandbox)
var document = window.document;
var jQuery = (function() {

// Define a local copy of jQuery
var jQuery = function( selector, context ) {
		// The jQuery object is actually just the init constructor 'enhanced'
		return new jQuery.fn.init( selector, context );
	},

	// Map over jQuery in case of overwrite
	_jQuery = window.jQuery,

	// Map over the $ in case of overwrite
	_$ = window.$,

	// A central reference to the root jQuery(document)
	rootjQuery,

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

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

	// Check if a string has a non-whitespace character in it
	rnotwhite = /\S/,
	rwhite = /\s/,

	// Used for trimming whitespace
	trimLeft = /^\s+/,
	trimRight = /\s+$/,

	// Check for non-word characters
	rnonword = /\W/,

	// Check for digits
	rdigit = /\d/,

	// Match a standalone tag
	rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,

	// JSON RegExp
	rvalidchars = /^[\],:{}\s]*$/,
	rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
	rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
	rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,

	// Useragent RegExp
	rwebkit = /(webkit)[ \/]([\w.]+)/,
	ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
	rmsie = /(msie) ([\w.]+)/,
	rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,

	// Keep a UserAgent string for use with jQuery.browser
	userAgent = navigator.userAgent,

	// For matching the engine and version of the browser
	browserMatch,
	
	// Has the ready events already been bound?
	readyBound = false,
	
	// The functions to execute on DOM ready
	readyList = [],

	// The ready event handler
	DOMContentLoaded,

	// Save a reference to some core methods
	toString = Object.prototype.toString,
	hasOwn = Object.prototype.hasOwnProperty,
	push = Array.prototype.push,
	slice = Array.prototype.slice,
	trim = String.prototype.trim,
	indexOf = Array.prototype.indexOf,
	
	// [[Class]] -> type pairs
	class2type = {};

jQuery.fn = jQuery.prototype = {
	init: function( selector, context ) {
		var match, elem, ret, doc;

		// Handle $(""), $(null), or $(undefined)
		if ( !selector ) {
			return this;
		}

		// Handle $(DOMElement)
		if ( selector.nodeType ) {
			this.context = this[0] = selector;
			this.length = 1;
			return this;
		}
		
		// The body element only exists once, optimize finding it
		if ( selector === "body" && !context && document.body ) {
			this.context = document;
			this[0] = document.body;
			this.selector = "body";
			this.length = 1;
			return this;
		}

		// Handle HTML strings
		if ( typeof selector === "string" ) {
			// Are we dealing with HTML string or an ID?
			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] ) {
					doc = (context ? context.ownerDocument || context : document);

					// If a single string is passed in and it's a single tag
					// just do a createElement and skip the rest
					ret = rsingleTag.exec( selector );

					if ( ret ) {
						if ( jQuery.isPlainObject( context ) ) {
							selector = [ document.createElement( ret[1] ) ];
							jQuery.fn.attr.call( selector, context, true );

						} else {
							selector = [ doc.createElement( ret[1] ) ];
						}

					} else {
						ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
						selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
					}
					
					return jQuery.merge( this, selector );
					
				// HANDLE: $("#id")
				} else {
					elem = document.getElementById( match[2] );

					// Check parentNode to catch when Blackberry 4.6 returns
					// nodes that are no longer in the document #6963
					if ( elem && elem.parentNode ) {
						// Handle the case where IE and Opera return items
						// by name instead of ID
						if ( elem.id !== match[2] ) {
							return rootjQuery.find( selector );
						}

						// Otherwise, we inject the element directly into the jQuery object
						this.length = 1;
						this[0] = elem;
					}

					this.context = document;
					this.selector = selector;
					return this;
				}

			// HANDLE: $("TAG")
			} else if ( !context && !rnonword.test( selector ) ) {
				this.selector = selector;
				this.context = document;
				selector = document.getElementsByTagName( selector );
				return jQuery.merge( this, selector );

			// HANDLE: $(expr, $(...))
			} else if ( !context || context.jquery ) {
				return (context || rootjQuery).find( selector );

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

		// HANDLE: $(function)
		// Shortcut for document ready
		} else if ( jQuery.isFunction( selector ) ) {
			return rootjQuery.ready( selector );
		}

		if (selector.selector !== undefined) {
			this.selector = selector.selector;
			this.context = selector.context;
		}

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

	// Start with an empty selector
	selector: "",

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

	// The default length of a jQuery object is 0
	length: 0,

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

	toArray: function() {
		return slice.call( this, 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 == null ?

			// Return a 'clean' array
			this.toArray() :

			// Return just the object
			( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
	},

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

		if ( jQuery.isArray( elems ) ) {
			push.apply( ret, elems );
		
		} else {
			jQuery.merge( ret, elems );
		}

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

		ret.context = this.context;

		if ( name === "find" ) {
			ret.selector = this.selector + (this.selector ? " " : "") + selector;
		} else if ( name ) {
			ret.selector = this.selector + "." + name + "(" + selector + ")";
		}

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

	// 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 );
	},
	
	ready: function( fn ) {
		// Attach the listeners
		jQuery.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 if ( readyList ) {
			// Add the function to the wait list
			readyList.push( fn );
		}

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

	first: function() {
		return this.eq( 0 );
	},

	last: function() {
		return this.eq( -1 );
	},

	slice: function() {
		return this.pushStack( slice.apply( this, arguments ),
			"slice", slice.call(arguments).join(",") );
	},

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

	// For internal use only.
	// Behaves like an Array's method, not like a jQuery method.
	push: push,
	sort: [].sort,
	splice: [].splice
};

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

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

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

	// Handle case when target is a string or something (possible in deep copy)
	if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
		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 ( name in options ) {
				src = target[ name ];
				copy = options[ name ];

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

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

					} else {
						clone = src && jQuery.isPlainObject(src) ? src : {};
					}

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

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

	// Return the modified object
	return target;
};

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

		if ( deep ) {
			window.jQuery = _jQuery;
		}

		return jQuery;
	},
	
	// Is the DOM ready to be used? Set to true once it occurs.
	isReady: false,

	// A counter to track how many items to wait for before
	// the ready event fires. See #6781
	readyWait: 1,
	
	// Handle when the DOM is ready
	ready: function( wait ) {
		// A third-party is pushing the ready event forwards
		if ( wait === true ) {
			jQuery.readyWait--;
		}

		// Make sure that the DOM is not already loaded
		if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
			// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
			if ( !document.body ) {
				return setTimeout( jQuery.ready, 1 );
			}

			// Remember that the DOM is ready
			jQuery.isReady = true;

			// If a normal DOM Ready event fired, decrement, and wait if need be
			if ( wait !== true && --jQuery.readyWait > 0 ) {
				return;
			}

			// If there are functions bound, to execute
			if ( readyList ) {
				// Execute all of them
				var fn,
					i = 0,
					ready = readyList;

				// Reset the list of functions
				readyList = null;

				while ( (fn = ready[ i++ ]) ) {
					fn.call( document, jQuery );
				}

				// Trigger any bound ready events
				if ( jQuery.fn.trigger ) {
					jQuery( document ).trigger( "ready" ).unbind( "ready" );
				}
			}
		}
	},
	
	bindReady: function() {
		if ( readyBound ) {
			return;
		}

		readyBound = true;

		// Catch cases where $(document).ready() is called after the
		// browser event has already occurred.
		if ( document.readyState === "complete" ) {
			// Handle it asynchronously to allow scripts the opportunity to delay ready
			return setTimeout( jQuery.ready, 1 );
		}

		// Mozilla, Opera and webkit nightlies currently support this event
		if ( document.addEventListener ) {
			// Use the handy event callback
			document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
			
			// A fallback to window.onload, that will always work
			window.addEventListener( "load", jQuery.ready, false );

		// If IE event model is used
		} else if ( document.attachEvent ) {
			// ensure firing before onload,
			// maybe late but safe also for iframes
			document.attachEvent("onreadystatechange", DOMContentLoaded);
			
			// A fallback to window.onload, that will always work
			window.attachEvent( "onload", jQuery.ready );

			// If IE and not a frame
			// continually check to see if the document is ready
			var toplevel = false;

			try {
				toplevel = window.frameElement == null;
			} catch(e) {}

			if ( document.documentElement.doScroll && toplevel ) {
				doScrollCheck();
			}
		}
	},

	// See test/unit/core.js for details concerning isFunction.
	// Since version 1.3, DOM methods and functions like alert
	// aren't supported. They return false on IE (#2968).
	isFunction: function( obj ) {
		return jQuery.type(obj) === "function";
	},

	isArray: Array.isArray || function( obj ) {
		return jQuery.type(obj) === "array";
	},

	// A crude way of determining if an object is a window
	isWindow: function( obj ) {
		return obj && typeof obj === "object" && "setInterval" in obj;
	},

	isNaN: function( obj ) {
		return obj == null || !rdigit.test( obj ) || isNaN( obj );
	},

	type: function( obj ) {
		return obj == null ?
			String( obj ) :
			class2type[ toString.call(obj) ] || "object";
	},

	isPlainObject: function( obj ) {
		// Must be an Object.
		// Because of IE, we also have to check the presence of the constructor property.
		// Make sure that DOM nodes and window objects don't pass through, as well
		if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
			return false;
		}
		
		// Not own constructor property must be Object
		if ( obj.constructor &&
			!hasOwn.call(obj, "constructor") &&
			!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
			return false;
		}
		
		// Own properties are enumerated firstly, so to speed up,
		// if last one is own, then all properties are own.
	
		var key;
		for ( key in obj ) {}
		
		return key === undefined || hasOwn.call( obj, key );
	},

	isEmptyObject: function( obj ) {
		for ( var name in obj ) {
			return false;
		}
		return true;
	},
	
	error: function( msg ) {
		throw msg;
	},
	
	parseJSON: function( data ) {
		if ( typeof data !== "string" || !data ) {
			return null;
		}

		// Make sure leading/trailing whitespace is removed (IE can't handle it)
		data = jQuery.trim( data );
		
		// Make sure the incoming data is actual JSON
		// Logic borrowed from http://json.org/json2.js
		if ( rvalidchars.test(data.replace(rvalidescape, "@")
			.replace(rvalidtokens, "]")
			.replace(rvalidbraces, "")) ) {

			// Try to use the native JSON parser first
			return window.JSON && window.JSON.parse ?
				window.JSON.parse( data ) :
				(new Function("return " + data))();

		} else {
			jQuery.error( "Invalid JSON: " + data );
		}
	},

	noop: function() {},

	// Evalulates a script in a global context
	globalEval: function( data ) {
		if ( data && rnotwhite.test(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.support.scriptEval ) {
				script.appendChild( document.createTextNode( data ) );
			} else {
				script.text = 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();
	},

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

		if ( args ) {
			if ( isObj ) {
				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 ( isObj ) {
				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;
	},

	// Use native String.trim function wherever possible
	trim: trim ?
		function( text ) {
			return text == null ?
				"" :
				trim.call( text );
		} :

		// Otherwise use our own trimming functionality
		function( text ) {
			return text == null ?
				"" :
				text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
		},

	// results is for internal usage only
	makeArray: function( array, results ) {
		var ret = results || [];

		if ( array != null ) {
			// The window, strings (and functions) also have 'length'
			// The extra typeof function check is to prevent crashes
			// in Safari 2 (See: #3039)
			// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
			var type = jQuery.type(array);

			if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
				push.call( ret, array );
			} else {
				jQuery.merge( ret, array );
			}
		}

		return ret;
	},

	inArray: function( elem, array ) {
		if ( array.indexOf ) {
			return array.indexOf( elem );
		}

		for ( var i = 0, length = array.length; i < length; i++ ) {
			if ( array[ i ] === elem ) {
				return i;
			}
		}

		return -1;
	},

	merge: function( first, second ) {
		var i = first.length,
			j = 0;

		if ( typeof second.length === "number" ) {
			for ( var l = second.length; j < l; j++ ) {
				first[ i++ ] = second[ j ];
			}
		
		} else {
			while ( second[j] !== undefined ) {
				first[ i++ ] = second[ j++ ];
			}
		}

		first.length = i;

		return first;
	},

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

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

		return ret;
	},

	// arg is for internal usage only
	map: function( elems, callback, arg ) {
		var ret = [], value;

		// 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++ ) {
			value = callback( elems[ i ], i, arg );

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

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

	// A global GUID counter for objects
	guid: 1,

	proxy: function( fn, proxy, thisObject ) {
		if ( arguments.length === 2 ) {
			if ( typeof proxy === "string" ) {
				thisObject = fn;
				fn = thisObject[ proxy ];
				proxy = undefined;

			} else if ( proxy && !jQuery.isFunction( proxy ) ) {
				thisObject = proxy;
				proxy = undefined;
			}
		}

		if ( !proxy && fn ) {
			proxy = function() {
				return fn.apply( thisObject || this, arguments );
			};
		}

		// Set the guid of unique handler to the same of original handler, so it can be removed
		if ( fn ) {
			proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
		}

		// So proxy can be declared as an argument
		return proxy;
	},

	// Mutifunctional method to get and set values to a collection
	// The value/s can be optionally by executed if its a function
	access: function( elems, key, value, exec, fn, pass ) {
		var length = elems.length;
	
		// Setting many attributes
		if ( typeof key === "object" ) {
			for ( var k in key ) {
				jQuery.access( elems, k, key[k], exec, fn, value );
			}
			return elems;
		}
	
		// Setting one attribute
		if ( value !== undefined ) {
			// Optionally, function values get executed if exec is true
			exec = !pass && exec && jQuery.isFunction(value);
		
			for ( var i = 0; i < length; i++ ) {
				fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
			}
		
			return elems;
		}
	
		// Getting an attribute
		return length ? fn( elems[0], key ) : undefined;
	},

	now: function() {
		return (new Date()).getTime();
	},

	// Use of jQuery.browser is frowned upon.
	// More details: http://docs.jquery.com/Utilities/jQuery.browser
	uaMatch: function( ua ) {
		ua = ua.toLowerCase();

		var match = rwebkit.exec( ua ) ||
			ropera.exec( ua ) ||
			rmsie.exec( ua ) ||
			ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
			[];

		return { browser: match[1] || "", version: match[2] || "0" };
	},

	browser: {}
});

// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
	class2type[ "[object " + name + "]" ] = name.toLowerCase();
});

browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
	jQuery.browser[ browserMatch.browser ] = true;
	jQuery.browser.version = browserMatch.version;
}

// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
	jQuery.browser.safari = true;
}

if ( indexOf ) {
	jQuery.inArray = function( elem, array ) {
		return indexOf.call( array, elem );
	};
}

// Verify that \s matches non-breaking spaces
// (IE fails on this test)
if ( !rwhite.test( "\xA0" ) ) {
	trimLeft = /^[\s\xA0]+/;
	trimRight = /[\s\xA0]+$/;
}

// All jQuery objects should point back to these
rootjQuery = jQuery(document);

// Cleanup functions for the document ready method
if ( document.addEventListener ) {
	DOMContentLoaded = function() {
		document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
		jQuery.ready();
	};

} else if ( document.attachEvent ) {
	DOMContentLoaded = function() {
		// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
		if ( document.readyState === "complete" ) {
			document.detachEvent( "onreadystatechange", DOMContentLoaded );
			jQuery.ready();
		}
	};
}

// The DOM ready check for Internet Explorer
function doScrollCheck() {
	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(e) {
		setTimeout( doScrollCheck, 1 );
		return;
	}

	// and execute any waiting functions
	jQuery.ready();
}

// Expose jQuery to the global object
return (window.jQuery = window.$ = jQuery);

})();


(function() {

	jQuery.support = {};

	var root = document.documentElement,
		script = document.createElement("script"),
		div = document.createElement("div"),
		id = "script" + jQuery.now();

	div.style.display = "none";
	div.innerHTML = "   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";

	var all = div.getElementsByTagName("*"),
		a = div.getElementsByTagName("a")[0],
		select = document.createElement("select"),
		opt = select.appendChild( document.createElement("option") );

	// Can't get basic test support
	if ( !all || !all.length || !a ) {
		return;
	}

	jQuery.support = {
		// IE strips leading whitespace when .innerHTML is used
		leadingWhitespace: div.firstChild.nodeType === 3,

		// Make sure that tbody elements aren't automatically inserted
		// IE will insert them into empty tables
		tbody: !div.getElementsByTagName("tbody").length,

		// Make sure that link elements get serialized correctly by innerHTML
		// This requires a wrapper element in IE
		htmlSerialize: !!div.getElementsByTagName("link").length,

		// Get the style information from getAttribute
		// (IE uses .cssText insted)
		style: /red/.test( a.getAttribute("style") ),

		// Make sure that URLs aren't manipulated
		// (IE normalizes it by default)
		hrefNormalized: a.getAttribute("href") === "/a",

		// Make sure that element opacity exists
		// (IE uses filter instead)
		// Use a regex to work around a WebKit issue. See #5145
		opacity: /^0.55$/.test( a.style.opacity ),

		// Verify style float existence
		// (IE uses styleFloat instead of cssFloat)
		cssFloat: !!a.style.cssFloat,

		// Make sure that if no value is specified for a checkbox
		// that it defaults to "on".
		// (WebKit defaults to "" instead)
		checkOn: div.getElementsByTagName("input")[0].value === "on",

		// Make sure that a selected-by-default option has a working selected property.
		// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
		optSelected: opt.selected,

		// Will be defined later
		deleteExpando: true,
		optDisabled: false,
		checkClone: false,
		scriptEval: false,
		noCloneEvent: true,
		boxModel: null,
		inlineBlockNeedsLayout: false,
		shrinkWrapBlocks: false,
		reliableHiddenOffsets: true
	};

	// Make sure that the options inside disabled selects aren't marked as disabled
	// (WebKit marks them as diabled)
	select.disabled = true;
	jQuery.support.optDisabled = !opt.disabled;

	script.type = "text/javascript";
	try {
		script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
	} catch(e) {}

	root.insertBefore( script, root.firstChild );

	// Make sure that the execution of code works by injecting a script
	// tag with appendChild/createTextNode
	// (IE doesn't support this, fails, and uses .text instead)
	if ( window[ id ] ) {
		jQuery.support.scriptEval = true;
		delete window[ id ];
	}

	// Test to see if it's possible to delete an expando from an element
	// Fails in Internet Explorer
	try {
		delete script.test;

	} catch(e) {
		jQuery.support.deleteExpando = false;
	}

	root.removeChild( script );

	if ( div.attachEvent && div.fireEvent ) {
		div.attachEvent("onclick", function click() {
			// Cloning a node shouldn't copy over any
			// bound event handlers (IE does this)
			jQuery.support.noCloneEvent = false;
			div.detachEvent("onclick", click);
		});
		div.cloneNode(true).fireEvent("onclick");
	}

	div = document.createElement("div");
	div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";

	var fragment = document.createDocumentFragment();
	fragment.appendChild( div.firstChild );

	// WebKit doesn't clone checked state correctly in fragments
	jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;

	// Figure out if the W3C box model works as expected
	// document.body must exist before we can do this
	jQuery(function() {
		var div = document.createElement("div");
		div.style.width = div.style.paddingLeft = "1px";

		document.body.appendChild( div );
		jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;

		if ( "zoom" in div.style ) {
			// Check if natively block-level elements act like inline-block
			// elements when setting their display to 'inline' and giving
			// them layout
			// (IE < 8 does this)
			div.style.display = "inline";
			div.style.zoom = 1;
			jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;

			// Check if elements with layout shrink-wrap their children
			// (IE 6 does this)
			div.style.display = "";
			div.innerHTML = "<div style='width:4px;'></div>";
			jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
		}

		div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
		var tds = div.getElementsByTagName("td");

		// Check if table cells still have offsetWidth/Height when they are set
		// to display:none and there are still other visible table cells in a
		// table row; if so, offsetWidth/Height are not reliable for use when
		// determining if an element has been hidden directly using
		// display:none (it is still safe to use offsets if a parent element is
		// hidden; don safety goggles and see bug #4512 for more information).
		// (only IE 8 fails this test)
		jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;

		tds[0].style.display = "";
		tds[1].style.display = "none";

		// Check if empty table cells still have offsetWidth/Height
		// (IE < 8 fail this test)
		jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
		div.innerHTML = "";

		document.body.removeChild( div ).style.display = "none";
		div = tds = null;
	});

	// Technique from Juriy Zaytsev
	// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
	var eventSupported = function( eventName ) {
		var el = document.createElement("div");
		eventName = "on" + eventName;

		var isSupported = (eventName in el);
		if ( !isSupported ) {
			el.setAttribute(eventName, "return;");
			isSupported = typeof el[eventName] === "function";
		}
		el = null;

		return isSupported;
	};

	jQuery.support.submitBubbles = eventSupported("submit");
	jQuery.support.changeBubbles = eventSupported("change");

	// release memory in IE
	root = script = div = all = a = null;
})();



var windowData = {},
	rbrace = /^(?:\{.*\}|\[.*\])$/;

jQuery.extend({
	cache: {},

	// Please use with caution
	uuid: 0,

	// Unique for each copy of jQuery on the page	
	expando: "jQuery" + jQuery.now(),

	// The following elements throw uncatchable exceptions if you
	// attempt to add expando properties to them.
	noData: {
		"embed": true,
		// Ban all objects except for Flash (which handle expandos)
		"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
		"applet": true
	},

	data: function( elem, name, data ) {
		if ( !jQuery.acceptData( elem ) ) {
			return;
		}

		elem = elem == window ?
			windowData :
			elem;

		var isNode = elem.nodeType,
			id = isNode ? elem[ jQuery.expando ] : null,
			cache = jQuery.cache, thisCache;

		if ( isNode && !id && typeof name === "string" && data === undefined ) {
			return;
		}

		// Get the data from the object directly
		if ( !isNode ) {
			cache = elem;

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

		// Avoid generating a new cache unless none exists and we
		// want to manipulate it.
		if ( typeof name === "object" ) {
			if ( isNode ) {
				cache[ id ] = jQuery.extend(cache[ id ], name);

			} else {
				jQuery.extend( cache, name );
			}

		} else if ( isNode && !cache[ id ] ) {
			cache[ id ] = {};
		}

		thisCache = isNode ? cache[ id ] : cache;

		// Prevent overriding the named cache with undefined values
		if ( data !== undefined ) {
			thisCache[ name ] = data;
		}

		return typeof name === "string" ? thisCache[ name ] : thisCache;
	},

	removeData: function( elem, name ) {
		if ( !jQuery.acceptData( elem ) ) {
			return;
		}

		elem = elem == window ?
			windowData :
			elem;

		var isNode = elem.nodeType,
			id = isNode ? elem[ jQuery.expando ] : elem,
			cache = jQuery.cache,
			thisCache = isNode ? cache[ id ] : id;

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

				// If we've removed all the data, remove the element's cache
				if ( isNode && jQuery.isEmptyObject(thisCache) ) {
					jQuery.removeData( elem );
				}
			}

		// Otherwise, we want to remove all of the element's data
		} else {
			if ( isNode && jQuery.support.deleteExpando ) {
				delete elem[ jQuery.expando ];

			} else if ( elem.removeAttribute ) {
				elem.removeAttribute( jQuery.expando );

			// Completely remove the data cache
			} else if ( isNode ) {
				delete cache[ id ];

			// Remove all fields from the object
			} else {
				for ( var n in elem ) {
					delete elem[ n ];
				}
			}
		}
	},

	// A method for determining if a DOM node can handle the data expando
	acceptData: function( elem ) {
		if ( elem.nodeName ) {
			var match = jQuery.noData[ elem.nodeName.toLowerCase() ];

			if ( match ) {
				return !(match === true || elem.getAttribute("classid") !== match);
			}
		}

		return true;
	}
});

jQuery.fn.extend({
	data: function( key, value ) {
		var data = null;

		if ( typeof key === "undefined" ) {
			if ( this.length ) {
				var attr = this[0].attributes, name;
				data = jQuery.data( this[0] );

				for ( var i = 0, l = attr.length; i < l; i++ ) {
					name = attr[i].name;

					if ( name.indexOf( "data-" ) === 0 ) {
						name = name.substr( 5 );
						dataAttr( this[0], name, data[ name ] );
					}
				}
			}

			return data;

		} else if ( typeof key === "object" ) {
			return this.each(function() {
				jQuery.data( this, key );
			});
		}

		var parts = key.split(".");
		parts[1] = parts[1] ? "." + parts[1] : "";

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

			// Try to fetch any internally stored data first
			if ( data === undefined && this.length ) {
				data = jQuery.data( this[0], key );
				data = dataAttr( this[0], key, data );
			}

			return data === undefined && parts[1] ?
				this.data( parts[0] ) :
				data;

		} else {
			return this.each(function() {
				var $this = jQuery( this ),
					args = [ parts[0], value ];

				$this.triggerHandler( "setData" + parts[1] + "!", args );
				jQuery.data( this, key, value );
				$this.triggerHandler( "changeData" + parts[1] + "!", args );
			});
		}
	},

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

function dataAttr( elem, key, data ) {
	// If nothing was found internally, try to fetch any
	// data from the HTML5 data-* attribute
	if ( data === undefined && elem.nodeType === 1 ) {
		data = elem.getAttribute( "data-" + key );

		if ( typeof data === "string" ) {
			try {
				data = data === "true" ? true :
				data === "false" ? false :
				data === "null" ? null :
				!jQuery.isNaN( data ) ? parseFloat( data ) :
					rbrace.test( data ) ? jQuery.parseJSON( data ) :
					data;
			} catch( e ) {}

			// Make sure we set the data so it isn't changed later
			jQuery.data( elem, key, data );

		} else {
			data = undefined;
		}
	}

	return data;
}




jQuery.extend({
	queue: function( elem, type, data ) {
		if ( !elem ) {
			return;
		}

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

		// Speed up dequeue by getting out quickly if this is just a lookup
		if ( !data ) {
			return q || [];
		}

		if ( !q || jQuery.isArray(data) ) {
			q = jQuery.data( elem, type, jQuery.makeArray(data) );

		} else {
			q.push( data );
		}

		return q;
	},

	dequeue: function( elem, type ) {
		type = type || "fx";

		var queue = jQuery.queue( elem, type ),
			fn = queue.shift();

		// If the fx queue is dequeued, always remove the progress sentinel
		if ( fn === "inprogress" ) {
			fn = queue.shift();
		}

		if ( fn ) {
			// Add a progress sentinel to prevent the fx queue from being
			// automatically dequeued
			if ( type === "fx" ) {
				queue.unshift("inprogress");
			}

			fn.call(elem, function() {
				jQuery.dequeue(elem, type);
			});
		}
	}
});

jQuery.fn.extend({
	queue: function( type, data ) {
		if ( typeof type !== "string" ) {
			data = type;
			type = "fx";
		}

		if ( data === undefined ) {
			return jQuery.queue( this[0], type );
		}
		return this.each(function( i ) {
			var queue = jQuery.queue( this, type, data );

			if ( type === "fx" && queue[0] !== "inprogress" ) {
				jQuery.dequeue( this, type );
			}
		});
	},
	dequeue: function( type ) {
		return this.each(function() {
			jQuery.dequeue( this, type );
		});
	},

	// Based off of the plugin by Clint Helfers, with permission.
	// http://blindsignals.com/index.php/2009/07/jquery-delay/
	delay: function( time, type ) {
		time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
		type = type || "fx";

		return this.queue( type, function() {
			var elem = this;
			setTimeout(function() {
				jQuery.dequeue( elem, type );
			}, time );
		});
	},

	clearQueue: function( type ) {
		return this.queue( type || "fx", [] );
	}
});




var rclass = /[\n\t]/g,
	rspaces = /\s+/,
	rreturn = /\r/g,
	rspecialurl = /^(?:href|src|style)$/,
	rtype = /^(?:button|input)$/i,
	rfocusable = /^(?:button|input|object|select|textarea)$/i,
	rclickable = /^a(?:rea)?$/i,
	rradiocheck = /^(?:radio|checkbox)$/i;

jQuery.props = {
	"for": "htmlFor",
	"class": "className",
	readonly: "readOnly",
	maxlength: "maxLength",
	cellspacing: "cellSpacing",
	rowspan: "rowSpan",
	colspan: "colSpan",
	tabindex: "tabIndex",
	usemap: "useMap",
	frameborder: "frameBorder"
};

jQuery.fn.extend({
	attr: function( name, value ) {
		return jQuery.access( this, name, value, true, jQuery.attr );
	},

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

	addClass: function( value ) {
		if ( jQuery.isFunction(value) ) {
			return this.each(function(i) {
				var self = jQuery(this);
				self.addClass( value.call(this, i, self.attr("class")) );
			});
		}

		if ( value && typeof value === "string" ) {
			var classNames = (value || "").split( rspaces );

			for ( var i = 0, l = this.length; i < l; i++ ) {
				var elem = this[i];

				if ( elem.nodeType === 1 ) {
					if ( !elem.className ) {
						elem.className = value;

					} else {
						var className = " " + elem.className + " ",
							setClass = elem.className;

						for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
							if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
								setClass += " " + classNames[c];
							}
						}
						elem.className = jQuery.trim( setClass );
					}
				}
			}
		}

		return this;
	},

	removeClass: function( value ) {
		if ( jQuery.isFunction(value) ) {
			return this.each(function(i) {
				var self = jQuery(this);
				self.removeClass( value.call(this, i, self.attr("class")) );
			});
		}

		if ( (value && typeof value === "string") || value === undefined ) {
			var classNames = (value || "").split( rspaces );

			for ( var i = 0, l = this.length; i < l; i++ ) {
				var elem = this[i];

				if ( elem.nodeType === 1 && elem.className ) {
					if ( value ) {
						var className = (" " + elem.className + " ").replace(rclass, " ");
						for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
							className = className.replace(" " + classNames[c] + " ", " ");
						}
						elem.className = jQuery.trim( className );

					} else {
						elem.className = "";
					}
				}
			}
		}

		return this;
	},

	toggleClass: function( value, stateVal ) {
		var type = typeof value,
			isBool = typeof stateVal === "boolean";

		if ( jQuery.isFunction( value ) ) {
			return this.each(function(i) {
				var self = jQuery(this);
				self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
			});
		}

		return this.each(function() {
			if ( type === "string" ) {
				// toggle individual class names
				var className,
					i = 0,
					self = jQuery( this ),
					state = stateVal,
					classNames = value.split( rspaces );

				while ( (className = classNames[ i++ ]) ) {
					// check each className given, space seperated list
					state = isBool ? state : !self.hasClass( className );
					self[ state ? "addClass" : "removeClass" ]( className );
				}

			} else if ( type === "undefined" || type === "boolean" ) {
				if ( this.className ) {
					// store className if set
					jQuery.data( this, "__className__", this.className );
				}

				// toggle whole className
				this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
			}
		});
	},

	hasClass: function( selector ) {
		var className = " " + selector + " ";
		for ( var i = 0, l = this.length; i < l; i++ ) {
			if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
				return true;
			}
		}

		return false;
	},

	val: function( value ) {
		if ( !arguments.length ) {
			var elem = this[0];

			if ( elem ) {
				if ( jQuery.nodeName( elem, "option" ) ) {
					// attributes.value is undefined in Blackberry 4.7 but
					// uses .value. See #6932
					var val = elem.attributes.value;
					return !val || val.specified ? elem.value : elem.text;
				}

				// 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 ];

						// Don't return options that are disabled or in a disabled optgroup
						if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && 
								(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {

							// Get the specific value for the option
							value = jQuery(option).val();

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

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

					return values;
				}

				// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
				if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
					return elem.getAttribute("value") === null ? "on" : elem.value;
				}
				

				// Everything else, we just grab the value
				return (elem.value || "").replace(rreturn, "");

			}

			return undefined;
		}

		var isFunction = jQuery.isFunction(value);

		return this.each(function(i) {
			var self = jQuery(this), val = value;

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

			if ( isFunction ) {
				val = value.call(this, i, self.val());
			}

			// Treat null/undefined as ""; convert numbers to string
			if ( val == null ) {
				val = "";
			} else if ( typeof val === "number" ) {
				val += "";
			} else if ( jQuery.isArray(val) ) {
				val = jQuery.map(val, function (value) {
					return value == null ? "" : value + "";
				});
			}

			if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
				this.checked = jQuery.inArray( self.val(), val ) >= 0;

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

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

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

			} else {
				this.value = val;
			}
		});
	}
});

jQuery.extend({
	attrFn: {
		val: true,
		css: true,
		html: true,
		text: true,
		data: true,
		width: true,
		height: true,
		offset: true
	},
		
	attr: function( elem, name, value, pass ) {
		// don't set attributes on text and comment nodes
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
			return undefined;
		}

		if ( pass && name in jQuery.attrFn ) {
			return jQuery(elem)[name](value);
		}

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

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

		// These attributes require special treatment
		var special = rspecialurl.test( name );

		// Safari mis-reports the default selected property of an option
		// Accessing the parent's selectedIndex property fixes it
		if ( name === "selected" && !jQuery.support.optSelected ) {
			var parent = elem.parentNode;
			if ( parent ) {
				parent.selectedIndex;

				// Make sure that it also works with optgroups, see #5701
				if ( parent.parentNode ) {
					parent.parentNode.selectedIndex;
				}
			}
		}

		// If applicable, access the attribute via the DOM 0 way
		// 'in' checks fail in Blackberry 4.7 #6931
		if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
			if ( set ) {
				// We can't allow the type property to be changed (since it causes problems in IE)
				if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
					jQuery.error( "type property can't be changed" );
				}

				if ( value === null ) {
					if ( elem.nodeType === 1 ) {
						elem.removeAttribute( name );
					}

				} else {
					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;
			}

			// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
			// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
			if ( name === "tabIndex" ) {
				var attributeNode = elem.getAttributeNode( "tabIndex" );

				return attributeNode && attributeNode.specified ?
					attributeNode.value :
					rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
						0 :
						undefined;
			}

			return elem[ name ];
		}

		if ( !jQuery.support.style && notxml && name === "style" ) {
			if ( set ) {
				elem.style.cssText = "" + value;
			}

			return elem.style.cssText;
		}

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

		// Ensure that missing attributes return undefined
		// Blackberry 4.7 returns "" from getAttribute #6938
		if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
			return undefined;
		}

		var attr = !jQuery.support.hrefNormalized && 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;
	}
});




var rnamespaces = /\.(.*)$/,
	rformElems = /^(?:textarea|input|select)$/i,
	rperiod = /\./g,
	rspace = / /g,
	rescape = /[^\w\s.|`]/g,
	fcleanup = function( nm ) {
		return nm.replace(rescape, "\\$&");
	},
	focusCounts = { focusin: 0, focusout: 0 };

/*
 * A number of helper functions used for managing events.
 * Many of the ideas behind this code originated 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.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
			elem = window;
		}

		if ( handler === false ) {
			handler = returnFalse;
		} else if ( !handler ) {
			// Fixes bug #7229. Fix recommended by jdalton
		  return;
		}

		var handleObjIn, handleObj;

		if ( handler.handler ) {
			handleObjIn = handler;
			handler = handleObjIn.handler;
		}

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

		// Init the element's event structure
		var elemData = jQuery.data( elem );

		// If no elemData is found then we must be trying to bind to one of the
		// banned noData elements
		if ( !elemData ) {
			return;
		}

		// Use a key less likely to result in collisions for plain JS objects.
		// Fixes bug #7150.
		var eventKey = elem.nodeType ? "events" : "__events__",
			events = elemData[ eventKey ],
			eventHandle = elemData.handle;
			
		if ( typeof events === "function" ) {
			// On plain objects events is a fn that holds the the data
			// which prevents this data from being JSON serialized
			// the function does not need to be called, it just contains the data
			eventHandle = events.handle;
			events = events.events;

		} else if ( !events ) {
			if ( !elem.nodeType ) {
				// On plain objects, create a fn that acts as the holder
				// of the values to avoid JSON serialization of event data
				elemData[ eventKey ] = elemData = function(){};
			}

			elemData.events = events = {};
		}

		if ( !eventHandle ) {
			elemData.handle = eventHandle = function() {
				// Handle the second event of a trigger and when
				// an event is called after a page has unloaded
				return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
					jQuery.event.handle.apply( eventHandle.elem, arguments ) :
					undefined;
			};
		}

		// Add elem as a property of the handle function
		// This is to prevent a memory leak with non-native events in IE.
		eventHandle.elem = elem;

		// Handle multiple events separated by a space
		// jQuery(...).bind("mouseover mouseout", fn);
		types = types.split(" ");

		var type, i = 0, namespaces;

		while ( (type = types[ i++ ]) ) {
			handleObj = handleObjIn ?
				jQuery.extend({}, handleObjIn) :
				{ handler: handler, data: data };

			// Namespaced event handlers
			if ( type.indexOf(".") > -1 ) {
				namespaces = type.split(".");
				type = namespaces.shift();
				handleObj.namespace = namespaces.slice(0).sort().join(".");

			} else {
				namespaces = [];
				handleObj.namespace = "";
			}

			handleObj.type = type;
			if ( !handleObj.guid ) {
				handleObj.guid = handler.guid;
			}

			// Get the current list of functions bound to this event
			var handlers = events[ type ],
				special = jQuery.event.special[ 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 ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
					// Bind the global event handler to the element
					if ( elem.addEventListener ) {
						elem.addEventListener( type, eventHandle, false );

					} else if ( elem.attachEvent ) {
						elem.attachEvent( "on" + type, eventHandle );
					}
				}
			}
			
			if ( special.add ) { 
				special.add.call( elem, handleObj ); 

				if ( !handleObj.handler.guid ) {
					handleObj.handler.guid = handler.guid;
				}
			}

			// Add the function to the element's handler list
			handlers.push( handleObj );

			// 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;
	},

	global: {},

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

		if ( handler === false ) {
			handler = returnFalse;
		}

		var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
			eventKey = elem.nodeType ? "events" : "__events__",
			elemData = jQuery.data( elem ),
			events = elemData && elemData[ eventKey ];

		if ( !elemData || !events ) {
			return;
		}
		
		if ( typeof events === "function" ) {
			elemData = events;
			events = events.events;
		}

		// types is actually an event object here
		if ( types && types.type ) {
			handler = types.handler;
			types = types.type;
		}

		// Unbind all events for the element
		if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
			types = types || "";

			for ( type in events ) {
				jQuery.event.remove( elem, type + types );
			}

			return;
		}

		// Handle multiple events separated by a space
		// jQuery(...).unbind("mouseover mouseout", fn);
		types = types.split(" ");

		while ( (type = types[ i++ ]) ) {
			origType = type;
			handleObj = null;
			all = type.indexOf(".") < 0;
			namespaces = [];

			if ( !all ) {
				// Namespaced event handlers
				namespaces = type.split(".");
				type = namespaces.shift();

				namespace = new RegExp("(^|\\.)" + 
					jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
			}

			eventType = events[ type ];

			if ( !eventType ) {
				continue;
			}

			if ( !handler ) {
				for ( j = 0; j < eventType.length; j++ ) {
					handleObj = eventType[ j ];

					if ( all || namespace.test( handleObj.namespace ) ) {
						jQuery.event.remove( elem, origType, handleObj.handler, j );
						eventType.splice( j--, 1 );
					}
				}

				continue;
			}

			special = jQuery.event.special[ type ] || {};

			for ( j = pos || 0; j < eventType.length; j++ ) {
				handleObj = eventType[ j ];

				if ( handler.guid === handleObj.guid ) {
					// remove the given handler for the given type
					if ( all || namespace.test( handleObj.namespace ) ) {
						if ( pos == null ) {
							eventType.splice( j--, 1 );
						}

						if ( special.remove ) {
							special.remove.call( elem, handleObj );
						}
					}

					if ( pos != null ) {
						break;
					}
				}
			}

			// remove generic event handler if no more handlers exist
			if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
				if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
					jQuery.removeEvent( elem, type, elemData.handle );
				}

				ret = null;
				delete events[ type ];
			}
		}

		// Remove the expando if it's no longer used
		if ( jQuery.isEmptyObject( events ) ) {
			var handle = elemData.handle;
			if ( handle ) {
				handle.elem = null;
			}

			delete elemData.events;
			delete elemData.handle;

			if ( typeof elemData === "function" ) {
				jQuery.removeData( elem, eventKey );

			} else if ( jQuery.isEmptyObject( elemData ) ) {
				jQuery.removeData( elem );
			}
		}
	},

	// bubbling is internal
	trigger: function( event, data, elem /*, bubbling */ ) {
		// Event object or event type
		var type = event.type || event,
			bubbling = arguments[3];

		if ( !bubbling ) {
			event = typeof event === "object" ?
				// jQuery.Event object
				event[ jQuery.expando ] ? event :
				// Object literal
				jQuery.extend( jQuery.Event(type), event ) :
				// Just the event type (string)
				jQuery.Event(type);

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

			// Handle a global trigger
			if ( !elem ) {
				// Don't bubble custom events when global (to avoid too much overhead)
				event.stopPropagation();

				// Only trigger if we've ever bound an event for it
				if ( jQuery.event.global[ type ] ) {
					jQuery.each( jQuery.cache, function() {
						if ( this.events && this.events[type] ) {
							jQuery.event.trigger( event, data, this.handle.elem );
						}
					});
				}
			}

			// Handle triggering a single element

			// don't do events on text and comment nodes
			if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
				return undefined;
			}

			// Clean up in case it is reused
			event.result = undefined;
			event.target = elem;

			// Clone the incoming data, if any
			data = jQuery.makeArray( data );
			data.unshift( event );
		}

		event.currentTarget = elem;

		// Trigger the event, it is assumed that "handle" is a function
		var handle = elem.nodeType ?
			jQuery.data( elem, "handle" ) :
			(jQuery.data( elem, "__events__" ) || {}).handle;

		if ( handle ) {
			handle.apply( elem, data );
		}

		var parent = elem.parentNode || elem.ownerDocument;

		// Trigger an inline bound script
		try {
			if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
				if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
					event.result = false;
					event.preventDefault();
				}
			}

		// prevent IE from throwing an error for some elements with some event types, see #3533
		} catch (inlineError) {}

		if ( !event.isPropagationStopped() && parent ) {
			jQuery.event.trigger( event, data, parent, true );

		} else if ( !event.isDefaultPrevented() ) {
			var old,
				target = event.target,
				targetType = type.replace( rnamespaces, "" ),
				isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
				special = jQuery.event.special[ targetType ] || {};

			if ( (!special._default || special._default.call( elem, event ) === false) && 
				!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {

				try {
					if ( target[ targetType ] ) {
						// Make sure that we don't accidentally re-trigger the onFOO events
						old = target[ "on" + targetType ];

						if ( old ) {
							target[ "on" + targetType ] = null;
						}

						jQuery.event.triggered = true;
						target[ targetType ]();
					}

				// prevent IE from throwing an error for some elements with some event types, see #3533
				} catch (triggerError) {}

				if ( old ) {
					target[ "on" + targetType ] = old;
				}

				jQuery.event.triggered = false;
			}
		}
	},

	handle: function( event ) {
		var all, handlers, namespaces, namespace_re, events,
			namespace_sort = [],
			args = jQuery.makeArray( arguments );

		event = args[0] = jQuery.event.fix( event || window.event );
		event.currentTarget = this;

		// Namespaced event handlers
		all = event.type.indexOf(".") < 0 && !event.exclusive;

		if ( !all ) {
			namespaces = event.type.split(".");
			event.type = namespaces.shift();
			namespace_sort = namespaces.slice(0).sort();
			namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
		}

		event.namespace = event.namespace || namespace_sort.join(".");

		events = jQuery.data(this, this.nodeType ? "events" : "__events__");

		if ( typeof events === "function" ) {
			events = events.events;
		}

		handlers = (events || {})[ event.type ];

		if ( events && handlers ) {
			// Clone the handlers to prevent manipulation
			handlers = handlers.slice(0);

			for ( var j = 0, l = handlers.length; j < l; j++ ) {
				var handleObj = handlers[ j ];

				// Filter the functions by class
				if ( all || namespace_re.test( handleObj.namespace ) ) {
					// Pass in a reference to the handler function itself
					// So that we can later remove it
					event.handler = handleObj.handler;
					event.data = handleObj.data;
					event.handleObj = handleObj;
	
					var ret = handleObj.handler.apply( this, args );

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

					if ( event.isImmediatePropagationStopped() ) {
						break;
					}
				}
			}
		}

		return event.result;
	},

	props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),

	fix: function( event ) {
		if ( event[ jQuery.expando ] ) {
			return event;
		}

		// store a copy of the original event object
		// and "clone" to set read-only properties
		var originalEvent = event;
		event = jQuery.Event( originalEvent );

		for ( var i = this.props.length, prop; i; ) {
			prop = this.props[ --i ];
			event[ prop ] = originalEvent[ prop ];
		}

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

		// 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 && doc.clientLeft || body && body.clientLeft || 0);
			event.pageY = event.clientY + (doc && doc.scrollTop  || body && body.scrollTop  || 0) - (doc && doc.clientTop  || body && body.clientTop  || 0);
		}

		// Add which for key events
		if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
			event.which = event.charCode != null ? 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 !== undefined ) {
			event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
		}

		return event;
	},

	// Deprecated, use jQuery.guid instead
	guid: 1E8,

	// Deprecated, use jQuery.proxy instead
	proxy: jQuery.proxy,

	special: {
		ready: {
			// Make sure the ready event is setup
			setup: jQuery.bindReady,
			teardown: jQuery.noop
		},

		live: {
			add: function( handleObj ) {
				jQuery.event.add( this,
					liveConvert( handleObj.origType, handleObj.selector ),
					jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); 
			},

			remove: function( handleObj ) {
				jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
			}
		},

		beforeunload: {
			setup: function( data, namespaces, eventHandle ) {
				// We only want to do this special case on windows
				if ( jQuery.isWindow( this ) ) {
					this.onbeforeunload = eventHandle;
				}
			},

			teardown: function( namespaces, eventHandle ) {
				if ( this.onbeforeunload === eventHandle ) {
					this.onbeforeunload = null;
				}
			}
		}
	}
};

jQuery.removeEvent = document.removeEventListener ?
	function( elem, type, handle ) {
		if ( elem.removeEventListener ) {
			elem.removeEventListener( type, handle, false );
		}
	} : 
	function( elem, type, handle ) {
		if ( elem.detachEvent ) {
			elem.detachEvent( "on" + type, handle );
		}
	};

jQuery.Event = function( src ) {
	// Allow instantiation without the 'new' keyword
	if ( !this.preventDefault ) {
		return new jQuery.Event( src );
	}

	// Event object
	if ( src && src.type ) {
		this.originalEvent = src;
		this.type = src.type;
	// Event type
	} else {
		this.type = src;
	}

	// timeStamp is buggy for some events on Firefox(#3843)
	// So we won't rely on the native value
	this.timeStamp = jQuery.now();

	// Mark it as fixed
	this[ jQuery.expando ] = true;
};

function returnFalse() {
	return false;
}
function returnTrue() {
	return true;
}

// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
	preventDefault: function() {
		this.isDefaultPrevented = returnTrue;

		var e = this.originalEvent;
		if ( !e ) {
			return;
		}
		
		// if preventDefault exists run it on the original event
		if ( e.preventDefault ) {
			e.preventDefault();

		// otherwise set the returnValue property of the original event to false (IE)
		} else {
			e.returnValue = false;
		}
	},
	stopPropagation: function() {
		this.isPropagationStopped = returnTrue;

		var e = this.originalEvent;
		if ( !e ) {
			return;
		}
		// if stopPropagation exists run it on the original event
		if ( e.stopPropagation ) {
			e.stopPropagation();
		}
		// otherwise set the cancelBubble property of the original event to true (IE)
		e.cancelBubble = true;
	},
	stopImmediatePropagation: function() {
		this.isImmediatePropagationStopped = returnTrue;
		this.stopPropagation();
	},
	isDefaultPrevented: returnFalse,
	isPropagationStopped: returnFalse,
	isImmediatePropagationStopped: returnFalse
};

// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function( event ) {
	// Check if mouse(over|out) are still within the same parent element
	var parent = event.relatedTarget;

	// Firefox sometimes assigns relatedTarget a XUL element
	// which we cannot access the parentNode property of
	try {
		// Traverse up the tree
		while ( parent && parent !== this ) {
			parent = parent.parentNode;
		}

		if ( parent !== this ) {
			// set the correct event type
			event.type = event.data;

			// handle event if we actually just moused on to a non sub-element
			jQuery.event.handle.apply( this, arguments );
		}

	// assuming we've left the element since we most likely mousedover a xul element
	} catch(e) { }
},

// In case of event delegation, we only need to rename the event.type,
// liveHandler will take care of the rest.
delegate = function( event ) {
	event.type = event.data;
	jQuery.event.handle.apply( this, arguments );
};

// Create mouseenter and mouseleave events
jQuery.each({
	mouseenter: "mouseover",
	mouseleave: "mouseout"
}, function( orig, fix ) {
	jQuery.event.special[ orig ] = {
		setup: function( data ) {
			jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
		},
		teardown: function( data ) {
			jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
		}
	};
});

// submit delegation
if ( !jQuery.support.submitBubbles ) {

	jQuery.event.special.submit = {
		setup: function( data, namespaces ) {
			if ( this.nodeName.toLowerCase() !== "form" ) {
				jQuery.event.add(this, "click.specialSubmit", function( e ) {
					var elem = e.target,
						type = elem.type;

					if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
						e.liveFired = undefined;
						return trigger( "submit", this, arguments );
					}
				});
	 
				jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
					var elem = e.target,
						type = elem.type;

					if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
						e.liveFired = undefined;
						return trigger( "submit", this, arguments );
					}
				});

			} else {
				return false;
			}
		},

		teardown: function( namespaces ) {
			jQuery.event.remove( this, ".specialSubmit" );
		}
	};

}

// change delegation, happens here so we have bind.
if ( !jQuery.support.changeBubbles ) {

	var changeFilters,

	getVal = function( elem ) {
		var type = elem.type, val = elem.value;

		if ( type === "radio" || type === "checkbox" ) {
			val = elem.checked;

		} else if ( type === "select-multiple" ) {
			val = elem.selectedIndex > -1 ?
				jQuery.map( elem.options, function( elem ) {
					return elem.selected;
				}).join("-") :
				"";

		} else if ( elem.nodeName.toLowerCase() === "select" ) {
			val = elem.selectedIndex;
		}

		return val;
	},

	testChange = function testChange( e ) {
		var elem = e.target, data, val;

		if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
			return;
		}

		data = jQuery.data( elem, "_change_data" );
		val = getVal(elem);

		// the current data will be also retrieved by beforeactivate
		if ( e.type !== "focusout" || elem.type !== "radio" ) {
			jQuery.data( elem, "_change_data", val );
		}
		
		if ( data === undefined || val === data ) {
			return;
		}

		if ( data != null || val ) {
			e.type = "change";
			e.liveFired = undefined;
			return jQuery.event.trigger( e, arguments[1], elem );
		}
	};

	jQuery.event.special.change = {
		filters: {
			focusout: testChange, 

			beforedeactivate: testChange,

			click: function( e ) {
				var elem = e.target, type = elem.type;

				if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
					return testChange.call( this, e );
				}
			},

			// Change has to be called before submit
			// Keydown will be called before keypress, which is used in submit-event delegation
			keydown: function( e ) {
				var elem = e.target, type = elem.type;

				if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
					(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
					type === "select-multiple" ) {
					return testChange.call( this, e );
				}
			},

			// Beforeactivate happens also before the previous element is blurred
			// with this event you can't trigger a change event, but you can store
			// information
			beforeactivate: function( e ) {
				var elem = e.target;
				jQuery.data( elem, "_change_data", getVal(elem) );
			}
		},

		setup: function( data, namespaces ) {
			if ( this.type === "file" ) {
				return false;
			}

			for ( var type in changeFilters ) {
				jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
			}

			return rformElems.test( this.nodeName );
		},

		teardown: function( namespaces ) {
			jQuery.event.remove( this, ".specialChange" );

			return rformElems.test( this.nodeName );
		}
	};

	changeFilters = jQuery.event.special.change.filters;

	// Handle when the input is .focus()'d
	changeFilters.focus = changeFilters.beforeactivate;
}

function trigger( type, elem, args ) {
	args[0].type = type;
	return jQuery.event.handle.apply( elem, args );
}

// Create "bubbling" focus and blur events
if ( document.addEventListener ) {
	jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
		jQuery.event.special[ fix ] = {
			setup: function() {
				if ( focusCounts[fix]++ === 0 ) {
					document.addEventListener( orig, handler, true );
				}
			}, 
			teardown: function() { 
				if ( --focusCounts[fix] === 0 ) {
					document.removeEventListener( orig, handler, true );
				}
			}
		};

		function handler( e ) { 
			e = jQuery.event.fix( e );
			e.type = fix;
			return jQuery.event.trigger( e, null, e.target );
		}
	});
}

jQuery.each(["bind", "one"], function( i, name ) {
	jQuery.fn[ name ] = function( type, data, fn ) {
		// Handle object literals
		if ( typeof type === "object" ) {
			for ( var key in type ) {
				this[ name ](key, data, type[key], fn);
			}
			return this;
		}
		
		if ( jQuery.isFunction( data ) || data === false ) {
			fn = data;
			data = undefined;
		}

		var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
			jQuery( this ).unbind( event, handler );
			return fn.apply( this, arguments );
		}) : fn;

		if ( type === "unload" && name !== "one" ) {
			this.one( type, data, fn );

		} else {
			for ( var i = 0, l = this.length; i < l; i++ ) {
				jQuery.event.add( this[i], type, handler, data );
			}
		}

		return this;
	};
});

jQuery.fn.extend({
	unbind: function( type, fn ) {
		// Handle object literals
		if ( typeof type === "object" && !type.preventDefault ) {
			for ( var key in type ) {
				this.unbind(key, type[key]);
			}

		} else {
			for ( var i = 0, l = this.length; i < l; i++ ) {
				jQuery.event.remove( this[i], type, fn );
			}
		}

		return this;
	},
	
	delegate: function( selector, types, data, fn ) {
		return this.live( types, data, fn, selector );
	},
	
	undelegate: function( selector, types, fn ) {
		if ( arguments.length === 0 ) {
				return this.unbind( "live" );
		
		} else {
			return this.die( types, null, fn, selector );
		}
	},
	
	trigger: function( type, data ) {
		return this.each(function() {
			jQuery.event.trigger( type, data, this );
		});
	},

	triggerHandler: function( type, data ) {
		if ( this[0] ) {
			var event = jQuery.Event( type );
			event.preventDefault();
			event.stopPropagation();
			jQuery.event.trigger( event, data, this[0] );
			return event.result;
		}
	},

	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.proxy( fn, args[ i++ ] );
		}

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

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

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

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

var liveMap = {
	focus: "focusin",
	blur: "focusout",
	mouseenter: "mouseover",
	mouseleave: "mouseout"
};

jQuery.each(["live", "die"], function( i, name ) {
	jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
		var type, i = 0, match, namespaces, preType,
			selector = origSelector || this.selector,
			context = origSelector ? this : jQuery( this.context );
		
		if ( typeof types === "object" && !types.preventDefault ) {
			for ( var key in types ) {
				context[ name ]( key, data, types[key], selector );
			}
			
			return this;
		}

		if ( jQuery.isFunction( data ) ) {
			fn = data;
			data = undefined;
		}

		types = (types || "").split(" ");

		while ( (type = types[ i++ ]) != null ) {
			match = rnamespaces.exec( type );
			namespaces = "";

			if ( match )  {
				namespaces = match[0];
				type = type.replace( rnamespaces, "" );
			}

			if ( type === "hover" ) {
				types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
				continue;
			}

			preType = type;

			if ( type === "focus" || type === "blur" ) {
				types.push( liveMap[ type ] + namespaces );
				type = type + namespaces;

			} else {
				type = (liveMap[ type ] || type) + namespaces;
			}

			if ( name === "live" ) {
				// bind live handler
				for ( var j = 0, l = context.length; j < l; j++ ) {
					jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
						{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
				}

			} else {
				// unbind live handler
				context.unbind( "live." + liveConvert( type, selector ), fn );
			}
		}
		
		return this;
	};
});

function liveHandler( event ) {
	var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
		elems = [],
		selectors = [],
		events = jQuery.data( this, this.nodeType ? "events" : "__events__" );

	if ( typeof events === "function" ) {
		events = events.events;
	}

	// Make sure we avoid non-left-click bubbling in Firefox (#3861)
	if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
		return;
	}
	
	if ( event.namespace ) {
		namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
	}

	event.liveFired = this;

	var live = events.live.slice(0);

	for ( j = 0; j < live.length; j++ ) {
		handleObj = live[j];

		if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
			selectors.push( handleObj.selector );

		} else {
			live.splice( j--, 1 );
		}
	}

	match = jQuery( event.target ).closest( selectors, event.currentTarget );

	for ( i = 0, l = match.length; i < l; i++ ) {
		close = match[i];

		for ( j = 0; j < live.length; j++ ) {
			handleObj = live[j];

			if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
				elem = close.elem;
				related = null;

				// Those two events require additional checking
				if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
					event.type = handleObj.preType;
					related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
				}

				if ( !related || related !== elem ) {
					elems.push({ elem: elem, handleObj: handleObj, level: close.level });
				}
			}
		}
	}

	for ( i = 0, l = elems.length; i < l; i++ ) {
		match = elems[i];

		if ( maxLevel && match.level > maxLevel ) {
			break;
		}

		event.currentTarget = match.elem;
		event.data = match.handleObj.data;
		event.handleObj = match.handleObj;

		ret = match.handleObj.origHandler.apply( match.elem, arguments );

		if ( ret === false || event.isPropagationStopped() ) {
			maxLevel = match.level;

			if ( ret === false ) {
				stop = false;
			}
			if ( event.isImmediatePropagationStopped() ) {
				break;
			}
		}
	}

	return stop;
}

function liveConvert( type, selector ) {
	return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
}

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

	// Handle event binding
	jQuery.fn[ name ] = function( data, fn ) {
		if ( fn == null ) {
			fn = data;
			data = null;
		}

		return arguments.length > 0 ?
			this.bind( name, data, fn ) :
			this.trigger( name );
	};

	if ( jQuery.attrFn ) {
		jQuery.attrFn[ name ] = true;
	}
});

// Prevent memory leaks in IE
// Window isn't included so as not to unbind existing unload events
// More info:
//  - http://isaacschlueter.com/2006/10/msie-memory-leaks/
if ( window.attachEvent && !window.addEventListener ) {
	jQuery(window).bind("unload", function() {
		for ( var id in jQuery.cache ) {
			if ( jQuery.cache[ id ].handle ) {
				// Try/Catch is to handle iframes being unloaded, see #4280
				try {
					jQuery.event.remove( jQuery.cache[ id ].handle.elem );
				} catch(e) {}
			}
		}
	});
}


/*!
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){

var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
	done = 0,
	toString = Object.prototype.toString,
	hasDuplicate = false,
	baseHasDuplicate = true;

// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
//   Thus far that includes Google Chrome.
[0, 0].sort(function() {
	baseHasDuplicate = false;
	return 0;
});

var Sizzle = function( selector, context, results, seed ) {
	results = results || [];
	context = context || document;

	var origContext = context;

	if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
		return [];
	}
	
	if ( !selector || typeof selector !== "string" ) {
		return results;
	}

	var m, set, checkSet, extra, ret, cur, pop, i,
		prune = true,
		contextXML = Sizzle.isXML( context ),
		parts = [],
		soFar = selector;
	
	// Reset the position of the chunker regexp (start from head)
	do {
		chunker.exec( "" );
		m = chunker.exec( soFar );

		if ( m ) {
			soFar = m[3];
		
			parts.push( m[1] );
		
			if ( m[2] ) {
				extra = m[3];
				break;
			}
		}
	} while ( m );

	if ( parts.length > 1 && origPOS.exec( selector ) ) {

		if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
			set = posProcess( parts[0] + parts[1], context );

		} else {
			set = Expr.relative[ parts[0] ] ?
				[ context ] :
				Sizzle( parts.shift(), context );

			while ( parts.length ) {
				selector = parts.shift();

				if ( Expr.relative[ selector ] ) {
					selector += parts.shift();
				}
				
				set = posProcess( selector, set );
			}
		}

	} else {
		// Take a shortcut and set the context if the root selector is an ID
		// (but not if it'll be faster if the inner selector is an ID)
		if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
				Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {

			ret = Sizzle.find( parts.shift(), context, contextXML );
			context = ret.expr ?
				Sizzle.filter( ret.expr, ret.set )[0] :
				ret.set[0];
		}

		if ( context ) {
			ret = seed ?
				{ expr: parts.pop(), set: makeArray(seed) } :
				Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );

			set = ret.expr ?
				Sizzle.filter( ret.expr, ret.set ) :
				ret.set;

			if ( parts.length > 0 ) {
				checkSet = makeArray( set );

			} else {
				prune = false;
			}

			while ( parts.length ) {
				cur = parts.pop();
				pop = cur;

				if ( !Expr.relative[ cur ] ) {
					cur = "";
				} else {
					pop = parts.pop();
				}

				if ( pop == null ) {
					pop = context;
				}

				Expr.relative[ cur ]( checkSet, pop, contextXML );
			}

		} else {
			checkSet = parts = [];
		}
	}

	if ( !checkSet ) {
		checkSet = set;
	}

	if ( !checkSet ) {
		Sizzle.error( cur || selector );
	}

	if ( toString.call(checkSet) === "[object Array]" ) {
		if ( !prune ) {
			results.push.apply( results, checkSet );

		} else if ( context && context.nodeType === 1 ) {
			for ( i = 0; checkSet[i] != null; i++ ) {
				if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
					results.push( set[i] );
				}
			}

		} else {
			for ( i = 0; checkSet[i] != null; i++ ) {
				if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
					results.push( set[i] );
				}
			}
		}

	} else {
		makeArray( checkSet, results );
	}

	if ( extra ) {
		Sizzle( extra, origContext, results, seed );
		Sizzle.uniqueSort( results );
	}

	return results;
};

Sizzle.uniqueSort = function( results ) {
	if ( sortOrder ) {
		hasDuplicate = baseHasDuplicate;
		results.sort( sortOrder );

		if ( hasDuplicate ) {
			for ( var i = 1; i < results.length; i++ ) {
				if ( results[i] === results[ i - 1 ] ) {
					results.splice( i--, 1 );
				}
			}
		}
	}

	return results;
};

Sizzle.matches = function( expr, set ) {
	return Sizzle( expr, null, null, set );
};

Sizzle.matchesSelector = function( node, expr ) {
	return Sizzle( expr, null, null, [node] ).length > 0;
};

Sizzle.find = function( expr, context, isXML ) {
	var set;

	if ( !expr ) {
		return [];
	}

	for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
		var match,
			type = Expr.order[i];
		
		if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
			var left = match[1];
			match.splice( 1, 1 );

			if ( left.substr( left.length - 1 ) !== "\\" ) {
				match[1] = (match[1] || "").replace(/\\/g, "");
				set = Expr.find[ type ]( match, context, isXML );

				if ( set != null ) {
					expr = expr.replace( Expr.match[ type ], "" );
					break;
				}
			}
		}
	}

	if ( !set ) {
		set = context.getElementsByTagName( "*" );
	}

	return { set: set, expr: expr };
};

Sizzle.filter = function( expr, set, inplace, not ) {
	var match, anyFound,
		old = expr,
		result = [],
		curLoop = set,
		isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );

	while ( expr && set.length ) {
		for ( var type in Expr.filter ) {
			if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
				var found, item,
					filter = Expr.filter[ type ],
					left = match[1];

				anyFound = false;

				match.splice(1,1);

				if ( left.substr( left.length - 1 ) === "\\" ) {
					continue;
				}

				if ( curLoop === result ) {
					result = [];
				}

				if ( Expr.preFilter[ type ] ) {
					match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );

					if ( !match ) {
						anyFound = found = true;

					} else if ( match === true ) {
						continue;
					}
				}

				if ( match ) {
					for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
						if ( item ) {
							found = filter( item, match, i, curLoop );
							var pass = not ^ !!found;

							if ( inplace && found != null ) {
								if ( pass ) {
									anyFound = true;

								} else {
									curLoop[i] = false;
								}

							} else if ( pass ) {
								result.push( item );
								anyFound = true;
							}
						}
					}
				}

				if ( found !== undefined ) {
					if ( !inplace ) {
						curLoop = result;
					}

					expr = expr.replace( Expr.match[ type ], "" );

					if ( !anyFound ) {
						return [];
					}

					break;
				}
			}
		}

		// Improper expression
		if ( expr === old ) {
			if ( anyFound == null ) {
				Sizzle.error( expr );

			} else {
				break;
			}
		}

		old = expr;
	}

	return curLoop;
};

Sizzle.error = function( msg ) {
	throw "Syntax error, unrecognized expression: " + msg;
};

var Expr = Sizzle.selectors = {
	order: [ "ID", "NAME", "TAG" ],

	match: {
		ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
		CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
		NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
		ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
		TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
		CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
		POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
		PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
	},

	leftMatch: {},

	attrMap: {
		"class": "className",
		"for": "htmlFor"
	},

	attrHandle: {
		href: function( elem ) {
			return elem.getAttribute( "href" );
		}
	},

	relative: {
		"+": function(checkSet, part){
			var isPartStr = typeof part === "string",
				isTag = isPartStr && !/\W/.test( part ),
				isPartStrNotTag = isPartStr && !isTag;

			if ( isTag ) {
				part = part.toLowerCase();
			}

			for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
				if ( (elem = checkSet[i]) ) {
					while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}

					checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
						elem || false :
						elem === part;
				}
			}

			if ( isPartStrNotTag ) {
				Sizzle.filter( part, checkSet, true );
			}
		},

		">": function( checkSet, part ) {
			var elem,
				isPartStr = typeof part === "string",
				i = 0,
				l = checkSet.length;

			if ( isPartStr && !/\W/.test( part ) ) {
				part = part.toLowerCase();

				for ( ; i < l; i++ ) {
					elem = checkSet[i];

					if ( elem ) {
						var parent = elem.parentNode;
						checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
					}
				}

			} else {
				for ( ; i < l; i++ ) {
					elem = checkSet[i];

					if ( elem ) {
						checkSet[i] = isPartStr ?
							elem.parentNode :
							elem.parentNode === part;
					}
				}

				if ( isPartStr ) {
					Sizzle.filter( part, checkSet, true );
				}
			}
		},

		"": function(checkSet, part, isXML){
			var nodeCheck,
				doneName = done++,
				checkFn = dirCheck;

			if ( typeof part === "string" && !/\W/.test(part) ) {
				part = part.toLowerCase();
				nodeCheck = part;
				checkFn = dirNodeCheck;
			}

			checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
		},

		"~": function( checkSet, part, isXML ) {
			var nodeCheck,
				doneName = done++,
				checkFn = dirCheck;

			if ( typeof part === "string" && !/\W/.test( part ) ) {
				part = part.toLowerCase();
				nodeCheck = part;
				checkFn = dirNodeCheck;
			}

			checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
		}
	},

	find: {
		ID: function( match, context, isXML ) {
			if ( typeof context.getElementById !== "undefined" && !isXML ) {
				var m = context.getElementById(match[1]);
				// Check parentNode to catch when Blackberry 4.6 returns
				// nodes that are no longer in the document #6963
				return m && m.parentNode ? [m] : [];
			}
		},

		NAME: function( match, context ) {
			if ( typeof context.getElementsByName !== "undefined" ) {
				var ret = [],
					results = context.getElementsByName( match[1] );

				for ( var i = 0, l = results.length; i < l; i++ ) {
					if ( results[i].getAttribute("name") === match[1] ) {
						ret.push( results[i] );
					}
				}

				return ret.length === 0 ? null : ret;
			}
		},

		TAG: function( match, context ) {
			return context.getElementsByTagName( match[1] );
		}
	},
	preFilter: {
		CLASS: function( match, curLoop, inplace, result, not, isXML ) {
			match = " " + match[1].replace(/\\/g, "") + " ";

			if ( isXML ) {
				return match;
			}

			for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
				if ( elem ) {
					if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
						if ( !inplace ) {
							result.push( elem );
						}

					} else if ( inplace ) {
						curLoop[i] = false;
					}
				}
			}

			return false;
		},

		ID: function( match ) {
			return match[1].replace(/\\/g, "");
		},

		TAG: function( match, curLoop ) {
			return match[1].toLowerCase();
		},

		CHILD: function( match ) {
			if ( match[1] === "nth" ) {
				// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
				var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
					match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
					!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);

				// calculate the numbers (first)n+(last) including if they are negative
				match[2] = (test[1] + (test[2] || 1)) - 0;
				match[3] = test[3] - 0;
			}

			// TODO: Move to normal caching system
			match[0] = done++;

			return match;
		},

		ATTR: function( match, curLoop, inplace, result, not, isXML ) {
			var name = match[1].replace(/\\/g, "");
			
			if ( !isXML && Expr.attrMap[name] ) {
				match[1] = Expr.attrMap[name];
			}

			if ( match[2] === "~=" ) {
				match[4] = " " + match[4] + " ";
			}

			return match;
		},

		PSEUDO: function( match, curLoop, inplace, result, not ) {
			if ( match[1] === "not" ) {
				// If we're dealing with a complex expression, or a simple one
				if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
					match[3] = Sizzle(match[3], null, null, curLoop);

				} else {
					var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);

					if ( !inplace ) {
						result.push.apply( result, ret );
					}

					return false;
				}

			} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
				return true;
			}
			
			return match;
		},

		POS: function( match ) {
			match.unshift( true );

			return match;
		}
	},
	
	filters: {
		enabled: function( elem ) {
			return elem.disabled === false && elem.type !== "hidden";
		},

		disabled: function( elem ) {
			return elem.disabled === true;
		},

		checked: function( elem ) {
			return elem.checked === true;
		},
		
		selected: function( elem ) {
			// Accessing this property makes selected-by-default
			// options in Safari work properly
			elem.parentNode.selectedIndex;
			
			return elem.selected === true;
		},

		parent: function( elem ) {
			return !!elem.firstChild;
		},

		empty: function( elem ) {
			return !elem.firstChild;
		},

		has: function( elem, i, match ) {
			return !!Sizzle( match[3], elem ).length;
		},

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

		text: function( elem ) {
			return "text" === elem.type;
		},
		radio: function( elem ) {
			return "radio" === elem.type;
		},

		checkbox: function( elem ) {
			return "checkbox" === elem.type;
		},

		file: function( elem ) {
			return "file" === elem.type;
		},
		password: function( elem ) {
			return "password" === elem.type;
		},

		submit: function( elem ) {
			return "submit" === elem.type;
		},

		image: function( elem ) {
			return "image" === elem.type;
		},

		reset: function( elem ) {
			return "reset" === elem.type;
		},

		button: function( elem ) {
			return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
		},

		input: function( elem ) {
			return (/input|select|textarea|button/i).test( elem.nodeName );
		}
	},
	setFilters: {
		first: function( elem, i ) {
			return i === 0;
		},

		last: function( elem, i, match, array ) {
			return i === array.length - 1;
		},

		even: function( elem, i ) {
			return i % 2 === 0;
		},

		odd: function( elem, i ) {
			return i % 2 === 1;
		},

		lt: function( elem, i, match ) {
			return i < match[3] - 0;
		},

		gt: function( elem, i, match ) {
			return i > match[3] - 0;
		},

		nth: function( elem, i, match ) {
			return match[3] - 0 === i;
		},

		eq: function( elem, i, match ) {
			return match[3] - 0 === i;
		}
	},
	filter: {
		PSEUDO: function( elem, match, i, array ) {
			var name = match[1],
				filter = Expr.filters[ name ];

			if ( filter ) {
				return filter( elem, i, match, array );

			} else if ( name === "contains" ) {
				return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;

			} else if ( name === "not" ) {
				var not = match[3];

				for ( var j = 0, l = not.length; j < l; j++ ) {
					if ( not[j] === elem ) {
						return false;
					}
				}

				return true;

			} else {
				Sizzle.error( "Syntax error, unrecognized expression: " + name );
			}
		},

		CHILD: function( elem, match ) {
			var type = match[1],
				node = elem;

			switch ( type ) {
				case "only":
				case "first":
					while ( (node = node.previousSibling) )	 {
						if ( node.nodeType === 1 ) { 
							return false; 
						}
					}

					if ( type === "first" ) { 
						return true; 
					}

					node = elem;

				case "last":
					while ( (node = node.nextSibling) )	 {
						if ( node.nodeType === 1 ) { 
							return false; 
						}
					}

					return true;

				case "nth":
					var first = match[2],
						last = match[3];

					if ( first === 1 && last === 0 ) {
						return true;
					}
					
					var doneName = match[0],
						parent = elem.parentNode;
	
					if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
						var count = 0;
						
						for ( node = parent.firstChild; node; node = node.nextSibling ) {
							if ( node.nodeType === 1 ) {
								node.nodeIndex = ++count;
							}
						} 

						parent.sizcache = doneName;
					}
					
					var diff = elem.nodeIndex - last;

					if ( first === 0 ) {
						return diff === 0;

					} else {
						return ( diff % first === 0 && diff / first >= 0 );
					}
			}
		},

		ID: function( elem, match ) {
			return elem.nodeType === 1 && elem.getAttribute("id") === match;
		},

		TAG: function( elem, match ) {
			return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
		},
		
		CLASS: function( elem, match ) {
			return (" " + (elem.className || elem.getAttribute("class")) + " ")
				.indexOf( match ) > -1;
		},

		ATTR: function( elem, match ) {
			var name = match[1],
				result = Expr.attrHandle[ name ] ?
					Expr.attrHandle[ name ]( elem ) :
					elem[ name ] != null ?
						elem[ name ] :
						elem.getAttribute( name ),
				value = result + "",
				type = match[2],
				check = match[4];

			return result == null ?
				type === "!=" :
				type === "=" ?
				value === check :
				type === "*=" ?
				value.indexOf(check) >= 0 :
				type === "~=" ?
				(" " + value + " ").indexOf(check) >= 0 :
				!check ?
				value && result !== false :
				type === "!=" ?
				value !== check :
				type === "^=" ?
				value.indexOf(check) === 0 :
				type === "$=" ?
				value.substr(value.length - check.length) === check :
				type === "|=" ?
				value === check || value.substr(0, check.length + 1) === check + "-" :
				false;
		},

		POS: function( elem, match, i, array ) {
			var name = match[2],
				filter = Expr.setFilters[ name ];

			if ( filter ) {
				return filter( elem, i, match, array );
			}
		}
	}
};

var origPOS = Expr.match.POS,
	fescape = function(all, num){
		return "\\" + (num - 0 + 1);
	};

for ( var type in Expr.match ) {
	Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
	Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}

var makeArray = function( array, results ) {
	array = Array.prototype.slice.call( array, 0 );

	if ( results ) {
		results.push.apply( results, array );
		return results;
	}
	
	return array;
};

// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
	Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;

// Provide a fallback method if it does not work
} catch( e ) {
	makeArray = function( array, results ) {
		var i = 0,
			ret = results || [];

		if ( toString.call(array) === "[object Array]" ) {
			Array.prototype.push.apply( ret, array );

		} else {
			if ( typeof array.length === "number" ) {
				for ( var l = array.length; i < l; i++ ) {
					ret.push( array[i] );
				}

			} else {
				for ( ; array[i]; i++ ) {
					ret.push( array[i] );
				}
			}
		}

		return ret;
	};
}

var sortOrder, siblingCheck;

if ( document.documentElement.compareDocumentPosition ) {
	sortOrder = function( a, b ) {
		if ( a === b ) {
			hasDuplicate = true;
			return 0;
		}

		if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
			return a.compareDocumentPosition ? -1 : 1;
		}

		return a.compareDocumentPosition(b) & 4 ? -1 : 1;
	};

} else {
	sortOrder = function( a, b ) {
		var al, bl,
			ap = [],
			bp = [],
			aup = a.parentNode,
			bup = b.parentNode,
			cur = aup;

		// The nodes are identical, we can exit early
		if ( a === b ) {
			hasDuplicate = true;
			return 0;

		// If the nodes are siblings (or identical) we can do a quick check
		} else if ( aup === bup ) {
			return siblingCheck( a, b );

		// If no parents were found then the nodes are disconnected
		} else if ( !aup ) {
			return -1;

		} else if ( !bup ) {
			return 1;
		}

		// Otherwise they're somewhere else in the tree so we need
		// to build up a full list of the parentNodes for comparison
		while ( cur ) {
			ap.unshift( cur );
			cur = cur.parentNode;
		}

		cur = bup;

		while ( cur ) {
			bp.unshift( cur );
			cur = cur.parentNode;
		}

		al = ap.length;
		bl = bp.length;

		// Start walking down the tree looking for a discrepancy
		for ( var i = 0; i < al && i < bl; i++ ) {
			if ( ap[i] !== bp[i] ) {
				return siblingCheck( ap[i], bp[i] );
			}
		}

		// We ended someplace up the tree so do a sibling check
		return i === al ?
			siblingCheck( a, bp[i], -1 ) :
			siblingCheck( ap[i], b, 1 );
	};

	siblingCheck = function( a, b, ret ) {
		if ( a === b ) {
			return ret;
		}

		var cur = a.nextSibling;

		while ( cur ) {
			if ( cur === b ) {
				return -1;
			}

			cur = cur.nextSibling;
		}

		return 1;
	};
}

// Utility function for retreiving the text value of an array of DOM nodes
Sizzle.getText = function( elems ) {
	var ret = "", elem;

	for ( var i = 0; elems[i]; i++ ) {
		elem = elems[i];

		// Get the text from text nodes and CDATA nodes
		if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
			ret += elem.nodeValue;

		// Traverse everything else, except comment nodes
		} else if ( elem.nodeType !== 8 ) {
			ret += Sizzle.getText( elem.childNodes );
		}
	}

	return ret;
};

// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
	// We're going to inject a fake input element with a specified name
	var form = document.createElement("div"),
		id = "script" + (new Date()).getTime(),
		root = document.documentElement;

	form.innerHTML = "<a name='" + id + "'/>";

	// Inject it into the root element, check its status, and remove it quickly
	root.insertBefore( form, root.firstChild );

	// The workaround has to do additional checks after a getElementById
	// Which slows things down for other browsers (hence the branching)
	if ( document.getElementById( id ) ) {
		Expr.find.ID = function( match, context, isXML ) {
			if ( typeof context.getElementById !== "undefined" && !isXML ) {
				var m = context.getElementById(match[1]);

				return m ?
					m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
						[m] :
						undefined :
					[];
			}
		};

		Expr.filter.ID = function( elem, match ) {
			var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");

			return elem.nodeType === 1 && node && node.nodeValue === match;
		};
	}

	root.removeChild( form );

	// release memory in IE
	root = form = null;
})();

(function(){
	// Check to see if the browser returns only elements
	// when doing getElementsByTagName("*")

	// Create a fake element
	var div = document.createElement("div");
	div.appendChild( document.createComment("") );

	// Make sure no comments are found
	if ( div.getElementsByTagName("*").length > 0 ) {
		Expr.find.TAG = function( match, context ) {
			var results = context.getElementsByTagName( match[1] );

			// Filter out possible comments
			if ( match[1] === "*" ) {
				var tmp = [];

				for ( var i = 0; results[i]; i++ ) {
					if ( results[i].nodeType === 1 ) {
						tmp.push( results[i] );
					}
				}

				results = tmp;
			}

			return results;
		};
	}

	// Check to see if an attribute returns normalized href attributes
	div.innerHTML = "<a href='#'></a>";

	if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
			div.firstChild.getAttribute("href") !== "#" ) {

		Expr.attrHandle.href = function( elem ) {
			return elem.getAttribute( "href", 2 );
		};
	}

	// release memory in IE
	div = null;
})();

if ( document.querySelectorAll ) {
	(function(){
		var oldSizzle = Sizzle,
			div = document.createElement("div"),
			id = "__sizzle__";

		div.innerHTML = "<p class='TEST'></p>";

		// Safari can't handle uppercase or unicode characters when
		// in quirks mode.
		if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
			return;
		}
	
		Sizzle = function( query, context, extra, seed ) {
			context = context || document;

			// Make sure that attribute selectors are quoted
			query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");

			// Only use querySelectorAll on non-XML documents
			// (ID selectors don't work in non-HTML documents)
			if ( !seed && !Sizzle.isXML(context) ) {
				if ( context.nodeType === 9 ) {
					try {
						return makeArray( context.querySelectorAll(query), extra );
					} catch(qsaError) {}

				// qSA works strangely on Element-rooted queries
				// We can work around this by specifying an extra ID on the root
				// and working up from there (Thanks to Andrew Dupont for the technique)
				// IE 8 doesn't work on object elements
				} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
					var old = context.getAttribute( "id" ),
						nid = old || id;

					if ( !old ) {
						context.setAttribute( "id", nid );
					}

					try {
						return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );

					} catch(pseudoError) {
					} finally {
						if ( !old ) {
							context.removeAttribute( "id" );
						}
					}
				}
			}
		
			return oldSizzle(query, context, extra, seed);
		};

		for ( var prop in oldSizzle ) {
			Sizzle[ prop ] = oldSizzle[ prop ];
		}

		// release memory in IE
		div = null;
	})();
}

(function(){
	var html = document.documentElement,
		matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
		pseudoWorks = false;

	try {
		// This should fail with an exception
		// Gecko does not error, returns false instead
		matches.call( document.documentElement, "[test!='']:sizzle" );
	
	} catch( pseudoError ) {
		pseudoWorks = true;
	}

	if ( matches ) {
		Sizzle.matchesSelector = function( node, expr ) {
			// Make sure that attribute selectors are quoted
			expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");

			if ( !Sizzle.isXML( node ) ) {
				try { 
					if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
						return matches.call( node, expr );
					}
				} catch(e) {}
			}

			return Sizzle(expr, null, null, [node]).length > 0;
		};
	}
})();

(function(){
	var div = document.createElement("div");

	div.innerHTML = "<div class='test e'></div><div class='test'></div>";

	// Opera can't find a second classname (in 9.6)
	// Also, make sure that getElementsByClassName actually exists
	if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
		return;
	}

	// Safari caches class attributes, doesn't catch changes (in 3.2)
	div.lastChild.className = "e";

	if ( div.getElementsByClassName("e").length === 1 ) {
		return;
	}
	
	Expr.order.splice(1, 0, "CLASS");
	Expr.find.CLASS = function( match, context, isXML ) {
		if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
			return context.getElementsByClassName(match[1]);
		}
	};

	// release memory in IE
	div = null;
})();

function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
		var elem = checkSet[i];

		if ( elem ) {
			var match = false;

			elem = elem[dir];

			while ( elem ) {
				if ( elem.sizcache === doneName ) {
					match = checkSet[elem.sizset];
					break;
				}

				if ( elem.nodeType === 1 && !isXML ){
					elem.sizcache = doneName;
					elem.sizset = i;
				}

				if ( elem.nodeName.toLowerCase() === cur ) {
					match = elem;
					break;
				}

				elem = elem[dir];
			}

			checkSet[i] = match;
		}
	}
}

function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
		var elem = checkSet[i];

		if ( elem ) {
			var match = false;
			
			elem = elem[dir];

			while ( elem ) {
				if ( elem.sizcache === doneName ) {
					match = checkSet[elem.sizset];
					break;
				}

				if ( elem.nodeType === 1 ) {
					if ( !isXML ) {
						elem.sizcache = doneName;
						elem.sizset = i;
					}

					if ( typeof cur !== "string" ) {
						if ( elem === cur ) {
							match = true;
							break;
						}

					} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
						match = elem;
						break;
					}
				}

				elem = elem[dir];
			}

			checkSet[i] = match;
		}
	}
}

if ( document.documentElement.contains ) {
	Sizzle.contains = function( a, b ) {
		return a !== b && (a.contains ? a.contains(b) : true);
	};

} else if ( document.documentElement.compareDocumentPosition ) {
	Sizzle.contains = function( a, b ) {
		return !!(a.compareDocumentPosition(b) & 16);
	};

} else {
	Sizzle.contains = function() {
		return false;
	};
}

Sizzle.isXML = function( elem ) {
	// documentElement is verified for cases where it doesn't yet exist
	// (such as loading iframes in IE - #4833) 
	var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;

	return documentElement ? documentElement.nodeName !== "HTML" : false;
};

var posProcess = function( selector, context ) {
	var match,
		tmpSet = [],
		later = "",
		root = context.nodeType ? [context] : context;

	// Position selectors must be done after the filter
	// And so must :not(positional) so we move all PSEUDOs to the end
	while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
		later += match[0];
		selector = selector.replace( Expr.match.PSEUDO, "" );
	}

	selector = Expr.relative[selector] ? selector + "*" : selector;

	for ( var i = 0, l = root.length; i < l; i++ ) {
		Sizzle( selector, root[i], tmpSet );
	}

	return Sizzle.filter( later, tmpSet );
};

// EXPOSE
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;


})();


var runtil = /Until$/,
	rparentsprev = /^(?:parents|prevUntil|prevAll)/,
	// Note: This RegExp should be improved, or likely pulled from Sizzle
	rmultiselector = /,/,
	isSimple = /^.[^:#\[\.,]*$/,
	slice = Array.prototype.slice,
	POS = jQuery.expr.match.POS;

jQuery.fn.extend({
	find: function( selector ) {
		var ret = this.pushStack( "", "find", selector ),
			length = 0;

		for ( var i = 0, l = this.length; i < l; i++ ) {
			length = ret.length;
			jQuery.find( selector, this[i], ret );

			if ( i > 0 ) {
				// Make sure that the results are unique
				for ( var n = length; n < ret.length; n++ ) {
					for ( var r = 0; r < length; r++ ) {
						if ( ret[r] === ret[n] ) {
							ret.splice(n--, 1);
							break;
						}
					}
				}
			}
		}

		return ret;
	},

	has: function( target ) {
		var targets = jQuery( target );
		return this.filter(function() {
			for ( var i = 0, l = targets.length; i < l; i++ ) {
				if ( jQuery.contains( this, targets[i] ) ) {
					return true;
				}
			}
		});
	},

	not: function( selector ) {
		return this.pushStack( winnow(this, selector, false), "not", selector);
	},

	filter: function( selector ) {
		return this.pushStack( winnow(this, selector, true), "filter", selector );
	},
	
	is: function( selector ) {
		return !!selector && jQuery.filter( selector, this ).length > 0;
	},

	closest: function( selectors, context ) {
		var ret = [], i, l, cur = this[0];

		if ( jQuery.isArray( selectors ) ) {
			var match, selector,
				matches = {},
				level = 1;

			if ( cur && selectors.length ) {
				for ( i = 0, l = selectors.length; i < l; i++ ) {
					selector = selectors[i];

					if ( !matches[selector] ) {
						matches[selector] = jQuery.expr.match.POS.test( selector ) ? 
							jQuery( selector, context || this.context ) :
							selector;
					}
				}

				while ( cur && cur.ownerDocument && cur !== context ) {
					for ( selector in matches ) {
						match = matches[selector];

						if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
							ret.push({ selector: selector, elem: cur, level: level });
						}
					}

					cur = cur.parentNode;
					level++;
				}
			}

			return ret;
		}

		var pos = POS.test( selectors ) ? 
			jQuery( selectors, context || this.context ) : null;

		for ( i = 0, l = this.length; i < l; i++ ) {
			cur = this[i];

			while ( cur ) {
				if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
					ret.push( cur );
					break;

				} else {
					cur = cur.parentNode;
					if ( !cur || !cur.ownerDocument || cur === context ) {
						break;
					}
				}
			}
		}

		ret = ret.length > 1 ? jQuery.unique(ret) : ret;
		
		return this.pushStack( ret, "closest", selectors );
	},
	
	// Determine the position of an element within
	// the matched set of elements
	index: function( elem ) {
		if ( !elem || typeof elem === "string" ) {
			return jQuery.inArray( this[0],
				// If it receives a string, the selector is used
				// If it receives nothing, the siblings are used
				elem ? jQuery( elem ) : this.parent().children() );
		}
		// Locate the position of the desired element
		return jQuery.inArray(
			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[0] : elem, this );
	},

	add: function( selector, context ) {
		var set = typeof selector === "string" ?
				jQuery( selector, context || this.context ) :
				jQuery.makeArray( selector ),
			all = jQuery.merge( this.get(), set );

		return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
			all :
			jQuery.unique( all ) );
	},

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

// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
	return !node || !node.parentNode || node.parentNode.nodeType === 11;
}

jQuery.each({
	parent: function( elem ) {
		var parent = elem.parentNode;
		return parent && parent.nodeType !== 11 ? parent : null;
	},
	parents: function( elem ) {
		return jQuery.dir( elem, "parentNode" );
	},
	parentsUntil: function( elem, i, until ) {
		return jQuery.dir( elem, "parentNode", until );
	},
	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" );
	},
	nextUntil: function( elem, i, until ) {
		return jQuery.dir( elem, "nextSibling", until );
	},
	prevUntil: function( elem, i, until ) {
		return jQuery.dir( elem, "previousSibling", until );
	},
	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( until, selector ) {
		var ret = jQuery.map( this, fn, until );
		
		if ( !runtil.test( name ) ) {
			selector = until;
		}

		if ( selector && typeof selector === "string" ) {
			ret = jQuery.filter( selector, ret );
		}

		ret = this.length > 1 ? jQuery.unique( ret ) : ret;

		if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
			ret = ret.reverse();
		}

		return this.pushStack( ret, name, slice.call(arguments).join(",") );
	};
});

jQuery.extend({
	filter: function( expr, elems, not ) {
		if ( not ) {
			expr = ":not(" + expr + ")";
		}

		return elems.length === 1 ?
			jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
			jQuery.find.matches(expr, elems);
	},
	
	dir: function( elem, dir, until ) {
		var matched = [],
			cur = elem[ dir ];

		while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
			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;
	}
});

// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
	if ( jQuery.isFunction( qualifier ) ) {
		return jQuery.grep(elements, function( elem, i ) {
			var retVal = !!qualifier.call( elem, i, elem );
			return retVal === keep;
		});

	} else if ( qualifier.nodeType ) {
		return jQuery.grep(elements, function( elem, i ) {
			return (elem === qualifier) === keep;
		});

	} else if ( typeof qualifier === "string" ) {
		var filtered = jQuery.grep(elements, function( elem ) {
			return elem.nodeType === 1;
		});

		if ( isSimple.test( qualifier ) ) {
			return jQuery.filter(qualifier, filtered, !keep);
		} else {
			qualifier = jQuery.filter( qualifier, filtered );
		}
	}

	return jQuery.grep(elements, function( elem, i ) {
		return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
	});
}




var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
	rleadingWhitespace = /^\s+/,
	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
	rtagName = /<([\w:]+)/,
	rtbody = /<tbody/i,
	rhtml = /<|&#?\w+;/,
	rnocache = /<(?:script|object|embed|option|style)/i,
	// checked="checked" or checked (html5)
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
	raction = /\=([^="'>\s]+\/)>/g,
	wrapMap = {
		option: [ 1, "<select multiple='multiple'>", "</select>" ],
		legend: [ 1, "<fieldset>", "</fieldset>" ],
		thead: [ 1, "<table>", "</table>" ],
		tr: [ 2, "<table><tbody>", "</tbody></table>" ],
		td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
		col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
		area: [ 1, "<map>", "</map>" ],
		_default: [ 0, "", "" ]
	};

wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;

// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
	wrapMap._default = [ 1, "div<div>", "</div>" ];
}

jQuery.fn.extend({
	text: function( text ) {
		if ( jQuery.isFunction(text) ) {
			return this.each(function(i) {
				var self = jQuery( this );

				self.text( text.call(this, i, self.text()) );
			});
		}

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

		return jQuery.text( this );
	},

	wrapAll: function( html ) {
		if ( jQuery.isFunction( html ) ) {
			return this.each(function(i) {
				jQuery(this).wrapAll( html.call(this, i) );
			});
		}

		if ( this[0] ) {
			// The elements to wrap the target around
			var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);

			if ( this[0].parentNode ) {
				wrap.insertBefore( this[0] );
			}

			wrap.map(function() {
				var elem = this;

				while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
					elem = elem.firstChild;
				}

				return elem;
			}).append(this);
		}

		return this;
	},

	wrapInner: function( html ) {
		if ( jQuery.isFunction( html ) ) {
			return this.each(function(i) {
				jQuery(this).wrapInner( html.call(this, i) );
			});
		}

		return this.each(function() {
			var self = jQuery( this ),
				contents = self.contents();

			if ( contents.length ) {
				contents.wrapAll( html );

			} else {
				self.append( html );
			}
		});
	},

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

	unwrap: function() {
		return this.parent().each(function() {
			if ( !jQuery.nodeName( this, "body" ) ) {
				jQuery( this ).replaceWith( this.childNodes );
			}
		}).end();
	},

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

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

	before: function() {
		if ( this[0] && this[0].parentNode ) {
			return this.domManip(arguments, false, function( elem ) {
				this.parentNode.insertBefore( elem, this );
			});
		} else if ( arguments.length ) {
			var set = jQuery(arguments[0]);
			set.push.apply( set, this.toArray() );
			return this.pushStack( set, "before", arguments );
		}
	},

	after: function() {
		if ( this[0] && this[0].parentNode ) {
			return this.domManip(arguments, false, function( elem ) {
				this.parentNode.insertBefore( elem, this.nextSibling );
			});
		} else if ( arguments.length ) {
			var set = this.pushStack( this, "after", arguments );
			set.push.apply( set, jQuery(arguments[0]).toArray() );
			return set;
		}
	},
	
	// keepData is for internal use only--do not document
	remove: function( selector, keepData ) {
		for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
			if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
				if ( !keepData && elem.nodeType === 1 ) {
					jQuery.cleanData( elem.getElementsByTagName("*") );
					jQuery.cleanData( [ elem ] );
				}

				if ( elem.parentNode ) {
					 elem.parentNode.removeChild( elem );
				}
			}
		}
		
		return this;
	},

	empty: function() {
		for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
			// Remove element nodes and prevent memory leaks
			if ( elem.nodeType === 1 ) {
				jQuery.cleanData( elem.getElementsByTagName("*") );
			}

			// Remove any remaining nodes
			while ( elem.firstChild ) {
				elem.removeChild( elem.firstChild );
			}
		}
		
		return this;
	},

	clone: function( events ) {
		// Do the clone
		var ret = this.map(function() {
			if ( !jQuery.support.noCloneEvent && !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 html = this.outerHTML,
					ownerDocument = this.ownerDocument;

				if ( !html ) {
					var div = ownerDocument.createElement("div");
					div.appendChild( this.cloneNode(true) );
					html = div.innerHTML;
				}

				return jQuery.clean([html.replace(rinlinejQuery, "")
					// Handle the case in IE 8 where action=/test/> self-closes a tag
					.replace(raction, '="$1">')
					.replace(rleadingWhitespace, "")], ownerDocument)[0];
			} else {
				return this.cloneNode(true);
			}
		});

		// Copy the events from the original to the clone
		if ( events === true ) {
			cloneCopyEvent( this, ret );
			cloneCopyEvent( this.find("*"), ret.find("*") );
		}

		// Return the cloned set
		return ret;
	},

	html: function( value ) {
		if ( value === undefined ) {
			return this[0] && this[0].nodeType === 1 ?
				this[0].innerHTML.replace(rinlinejQuery, "") :
				null;

		// See if we can take a shortcut and just use innerHTML
		} else if ( typeof value === "string" && !rnocache.test( value ) &&
			(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
			!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {

			value = value.replace(rxhtmlTag, "<$1></$2>");

			try {
				for ( var i = 0, l = this.length; i < l; i++ ) {
					// Remove element nodes and prevent memory leaks
					if ( this[i].nodeType === 1 ) {
						jQuery.cleanData( this[i].getElementsByTagName("*") );
						this[i].innerHTML = value;
					}
				}

			// If using innerHTML throws an exception, use the fallback method
			} catch(e) {
				this.empty().append( value );
			}

		} else if ( jQuery.isFunction( value ) ) {
			this.each(function(i){
				var self = jQuery( this );

				self.html( value.call(this, i, self.html()) );
			});

		} else {
			this.empty().append( value );
		}

		return this;
	},

	replaceWith: function( value ) {
		if ( this[0] && this[0].parentNode ) {
			// Make sure that the elements are removed from the DOM before they are inserted
			// this can help fix replacing a parent with child elements
			if ( jQuery.isFunction( value ) ) {
				return this.each(function(i) {
					var self = jQuery(this), old = self.html();
					self.replaceWith( value.call( this, i, old ) );
				});
			}

			if ( typeof value !== "string" ) {
				value = jQuery( value ).detach();
			}

			return this.each(function() {
				var next = this.nextSibling,
					parent = this.parentNode;

				jQuery( this ).remove();

				if ( next ) {
					jQuery(next).before( value );
				} else {
					jQuery(parent).append( value );
				}
			});
		} else {
			return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
		}
	},

	detach: function( selector ) {
		return this.remove( selector, true );
	},

	domManip: function( args, table, callback ) {
		var results, first, fragment, parent,
			value = args[0],
			scripts = [];

		// We can't cloneNode fragments that contain checked, in WebKit
		if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
			return this.each(function() {
				jQuery(this).domManip( args, table, callback, true );
			});
		}

		if ( jQuery.isFunction(value) ) {
			return this.each(function(i) {
				var self = jQuery(this);
				args[0] = value.call(this, i, table ? self.html() : undefined);
				self.domManip( args, table, callback );
			});
		}

		if ( this[0] ) {
			parent = value && value.parentNode;

			// If we're in a fragment, just use that instead of building a new one
			if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
				results = { fragment: parent };

			} else {
				results = jQuery.buildFragment( args, this, scripts );
			}
			
			fragment = results.fragment;
			
			if ( fragment.childNodes.length === 1 ) {
				first = fragment = fragment.firstChild;
			} else {
				first = fragment.firstChild;
			}

			if ( first ) {
				table = table && jQuery.nodeName( first, "tr" );

				for ( var i = 0, l = this.length; i < l; i++ ) {
					callback.call(
						table ?
							root(this[i], first) :
							this[i],
						i > 0 || results.cacheable || this.length > 1  ?
							fragment.cloneNode(true) :
							fragment
					);
				}
			}

			if ( scripts.length ) {
				jQuery.each( scripts, evalScript );
			}
		}

		return this;
	}
});

function root( elem, cur ) {
	return jQuery.nodeName(elem, "table") ?
		(elem.getElementsByTagName("tbody")[0] ||
		elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
		elem;
}

function cloneCopyEvent(orig, ret) {
	var i = 0;

	ret.each(function() {
		if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
			return;
		}

		var oldData = jQuery.data( orig[i++] ),
			curData = jQuery.data( this, oldData ),
			events = oldData && oldData.events;

		if ( events ) {
			delete curData.handle;
			curData.events = {};

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

jQuery.buildFragment = function( args, nodes, scripts ) {
	var fragment, cacheable, cacheresults,
		doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);

	// Only cache "small" (1/2 KB) strings that are associated with the main document
	// Cloning options loses the selected state, so don't cache them
	// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
	// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
	if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
		!rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {

		cacheable = true;
		cacheresults = jQuery.fragments[ args[0] ];
		if ( cacheresults ) {
			if ( cacheresults !== 1 ) {
				fragment = cacheresults;
			}
		}
	}

	if ( !fragment ) {
		fragment = doc.createDocumentFragment();
		jQuery.clean( args, doc, fragment, scripts );
	}

	if ( cacheable ) {
		jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
	}

	return { fragment: fragment, cacheable: cacheable };
};

jQuery.fragments = {};

jQuery.each({
	appendTo: "append",
	prependTo: "prepend",
	insertBefore: "before",
	insertAfter: "after",
	replaceAll: "replaceWith"
}, function( name, original ) {
	jQuery.fn[ name ] = function( selector ) {
		var ret = [],
			insert = jQuery( selector ),
			parent = this.length === 1 && this[0].parentNode;
		
		if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
			insert[ original ]( this[0] );
			return this;
			
		} else {
			for ( var i = 0, l = insert.length; i < l; i++ ) {
				var elems = (i > 0 ? this.clone(true) : this).get();
				jQuery( insert[i] )[ original ]( elems );
				ret = ret.concat( elems );
			}
		
			return this.pushStack( ret, name, insert.selector );
		}
	};
});

jQuery.extend({
	clean: function( elems, context, fragment, scripts ) {
		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;
		}

		var ret = [];

		for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
			if ( typeof elem === "number" ) {
				elem += "";
			}

			if ( !elem ) {
				continue;
			}

			// Convert html string into DOM nodes
			if ( typeof elem === "string" && !rhtml.test( elem ) ) {
				elem = context.createTextNode( elem );

			} else if ( typeof elem === "string" ) {
				// Fix "XHTML"-style tags in all browsers
				elem = elem.replace(rxhtmlTag, "<$1></$2>");

				// Trim whitespace, otherwise indexOf won't work as expected
				var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
					wrap = wrapMap[ tag ] || wrapMap._default,
					depth = wrap[0],
					div = context.createElement("div");

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

				// Move to the right depth
				while ( depth-- ) {
					div = div.lastChild;
				}

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

					// String was a <table>, *may* have spurious <tbody>
					var hasBody = rtbody.test(elem),
						tbody = tag === "table" && !hasBody ?
							div.firstChild && div.firstChild.childNodes :

							// String was a bare <thead> or <tfoot>
							wrap[1] === "<table>" && !hasBody ?
								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 ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
					div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
				}

				elem = div.childNodes;
			}

			if ( elem.nodeType ) {
				ret.push( elem );
			} else {
				ret = jQuery.merge( ret, elem );
			}
		}

		if ( fragment ) {
			for ( i = 0; ret[i]; i++ ) {
				if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
					scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
				
				} else {
					if ( ret[i].nodeType === 1 ) {
						ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
					}
					fragment.appendChild( ret[i] );
				}
			}
		}

		return ret;
	},
	
	cleanData: function( elems ) {
		var data, id, cache = jQuery.cache,
			special = jQuery.event.special,
			deleteExpando = jQuery.support.deleteExpando;
		
		for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
			if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
				continue;
			}

			id = elem[ jQuery.expando ];
			
			if ( id ) {
				data = cache[ id ];
				
				if ( data && data.events ) {
					for ( var type in data.events ) {
						if ( special[ type ] ) {
							jQuery.event.remove( elem, type );

						} else {
							jQuery.removeEvent( elem, type, data.handle );
						}
					}
				}
				
				if ( deleteExpando ) {
					delete elem[ jQuery.expando ];

				} else if ( elem.removeAttribute ) {
					elem.removeAttribute( jQuery.expando );
				}
				
				delete cache[ id ];
			}
		}
	}
});

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 );
	}
}




var ralpha = /alpha\([^)]*\)/i,
	ropacity = /opacity=([^)]*)/,
	rdashAlpha = /-([a-z])/ig,
	rupper = /([A-Z])/g,
	rnumpx = /^-?\d+(?:px)?$/i,
	rnum = /^-?\d/,

	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
	cssWidth = [ "Left", "Right" ],
	cssHeight = [ "Top", "Bottom" ],
	curCSS,

	getComputedStyle,
	currentStyle,

	fcamelCase = function( all, letter ) {
		return letter.toUpperCase();
	};

jQuery.fn.css = function( name, value ) {
	// Setting 'undefined' is a no-op
	if ( arguments.length === 2 && value === undefined ) {
		return this;
	}

	return jQuery.access( this, name, value, true, function( elem, name, value ) {
		return value !== undefined ?
			jQuery.style( elem, name, value ) :
			jQuery.css( elem, name );
	});
};

jQuery.extend({
	// Add in style property hooks for overriding the default
	// behavior of getting and setting a style property
	cssHooks: {
		opacity: {
			get: function( elem, computed ) {
				if ( computed ) {
					// We should always get a number back from opacity
					var ret = curCSS( elem, "opacity", "opacity" );
					return ret === "" ? "1" : ret;

				} else {
					return elem.style.opacity;
				}
			}
		}
	},

	// Exclude the following css properties to add px
	cssNumber: {
		"zIndex": true,
		"fontWeight": true,
		"opacity": true,
		"zoom": true,
		"lineHeight": true
	},

	// Add in properties whose names you wish to fix before
	// setting or getting the value
	cssProps: {
		// normalize float css property
		"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
	},

	// Get and set the style property on a DOM Node
	style: function( elem, name, value, extra ) {
		// Don't set styles on text and comment nodes
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
			return;
		}

		// Make sure that we're working with the right name
		var ret, origName = jQuery.camelCase( name ),
			style = elem.style, hooks = jQuery.cssHooks[ origName ];

		name = jQuery.cssProps[ origName ] || origName;

		// Check if we're setting a value
		if ( value !== undefined ) {
			// Make sure that NaN and null values aren't set. See: #7116
			if ( typeof value === "number" && isNaN( value ) || value == null ) {
				return;
			}

			// If a number was passed in, add 'px' to the (except for certain CSS properties)
			if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
				value += "px";
			}

			// If a hook was provided, use that value, otherwise just set the specified value
			if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
				// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
				// Fixes bug #5509
				try {
					style[ name ] = value;
				} catch(e) {}
			}

		} else {
			// If a hook was provided get the non-computed value from there
			if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
				return ret;
			}

			// Otherwise just get the value from the style object
			return style[ name ];
		}
	},

	css: function( elem, name, extra ) {
		// Make sure that we're working with the right name
		var ret, origName = jQuery.camelCase( name ),
			hooks = jQuery.cssHooks[ origName ];

		name = jQuery.cssProps[ origName ] || origName;

		// If a hook was provided get the computed value from there
		if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
			return ret;

		// Otherwise, if a way to get the computed value exists, use that
		} else if ( curCSS ) {
			return curCSS( elem, name, origName );
		}
	},

	// 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 ( name in options ) {
			elem.style[ name ] = old[ name ];
		}
	},

	camelCase: function( string ) {
		return string.replace( rdashAlpha, fcamelCase );
	}
});

// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;

jQuery.each(["height", "width"], function( i, name ) {
	jQuery.cssHooks[ name ] = {
		get: function( elem, computed, extra ) {
			var val;

			if ( computed ) {
				if ( elem.offsetWidth !== 0 ) {
					val = getWH( elem, name, extra );

				} else {
					jQuery.swap( elem, cssShow, function() {
						val = getWH( elem, name, extra );
					});
				}

				if ( val <= 0 ) {
					val = curCSS( elem, name, name );

					if ( val === "0px" && currentStyle ) {
						val = currentStyle( elem, name, name );
					}

					if ( val != null ) {
						// Should return "auto" instead of 0, use 0 for
						// temporary backwards-compat
						return val === "" || val === "auto" ? "0px" : val;
					}
				}

				if ( val < 0 || val == null ) {
					val = elem.style[ name ];

					// Should return "auto" instead of 0, use 0 for
					// temporary backwards-compat
					return val === "" || val === "auto" ? "0px" : val;
				}

				return typeof val === "string" ? val : val + "px";
			}
		},

		set: function( elem, value ) {
			if ( rnumpx.test( value ) ) {
				// ignore negative width and height values #1599
				value = parseFloat(value);

				if ( value >= 0 ) {
					return value + "px";
				}

			} else {
				return value;
			}
		}
	};
});

if ( !jQuery.support.opacity ) {
	jQuery.cssHooks.opacity = {
		get: function( elem, computed ) {
			// IE uses filters for opacity
			return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
				(parseFloat(RegExp.$1) / 100) + "" :
				computed ? "1" : "";
		},

		set: function( elem, value ) {
			var style = elem.style;

			// IE has trouble with opacity if it does not have layout
			// Force it by setting the zoom level
			style.zoom = 1;

			// Set the alpha filter to set the opacity
			var opacity = jQuery.isNaN(value) ?
				"" :
				"alpha(opacity=" + value * 100 + ")",
				filter = style.filter || "";

			style.filter = ralpha.test(filter) ?
				filter.replace(ralpha, opacity) :
				style.filter + ' ' + opacity;
		}
	};
}

if ( document.defaultView && document.defaultView.getComputedStyle ) {
	getComputedStyle = function( elem, newName, name ) {
		var ret, defaultView, computedStyle;

		name = name.replace( rupper, "-$1" ).toLowerCase();

		if ( !(defaultView = elem.ownerDocument.defaultView) ) {
			return undefined;
		}

		if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
			ret = computedStyle.getPropertyValue( name );
			if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
				ret = jQuery.style( elem, name );
			}
		}

		return ret;
	};
}

if ( document.documentElement.currentStyle ) {
	currentStyle = function( elem, name ) {
		var left, rsLeft,
			ret = elem.currentStyle && elem.currentStyle[ name ],
			style = elem.style;

		// 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 ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
			// Remember the original values
			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 = name === "fontSize" ? "1em" : (ret || 0);
			ret = style.pixelLeft + "px";

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

		return ret === "" ? "auto" : ret;
	};
}

curCSS = getComputedStyle || currentStyle;

function getWH( elem, name, extra ) {
	var which = name === "width" ? cssWidth : cssHeight,
		val = name === "width" ? elem.offsetWidth : elem.offsetHeight;

	if ( extra === "border" ) {
		return val;
	}

	jQuery.each( which, function() {
		if ( !extra ) {
			val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
		}

		if ( extra === "margin" ) {
			val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;

		} else {
			val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
		}
	});

	return val;
}

if ( jQuery.expr && jQuery.expr.filters ) {
	jQuery.expr.filters.hidden = function( elem ) {
		var width = elem.offsetWidth,
			height = elem.offsetHeight;

		return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
	};

	jQuery.expr.filters.visible = function( elem ) {
		return !jQuery.expr.filters.hidden( elem );
	};
}




var jsc = jQuery.now(),
	rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
	rselectTextarea = /^(?:select|textarea)/i,
	rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
	rnoContent = /^(?:GET|HEAD)$/,
	rbracket = /\[\]$/,
	jsre = /\=\?(&|$)/,
	rquery = /\?/,
	rts = /([?&])_=[^&]*/,
	rurl = /^(\w+:)?\/\/([^\/?#]+)/,
	r20 = /%20/g,
	rhash = /#.*$/,

	// Keep a copy of the old load method
	_load = jQuery.fn.load;

jQuery.fn.extend({
	load: function( url, params, callback ) {
		if ( typeof url !== "string" && _load ) {
			return _load.apply( this, arguments );

		// Don't do a request if no elements are being requested
		} else if ( !this.length ) {
			return this;
		}

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

		// 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 if ( typeof params === "object" ) {
				params = jQuery.param( params, jQuery.ajaxSettings.traditional );
				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(rscript, ""))

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

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

				if ( callback ) {
					self.each( callback, [res.responseText, status, res] );
				}
			}
		});

		return this;
	},

	serialize: function() {
		return jQuery.param(this.serializeArray());
	},

	serializeArray: function() {
		return this.map(function() {
			return this.elements ? jQuery.makeArray(this.elements) : this;
		})
		.filter(function() {
			return this.name && !this.disabled &&
				(this.checked || rselectTextarea.test(this.nodeName) ||
					rinput.test(this.type));
		})
		.map(function( i, elem ) {
			var val = jQuery(this).val();

			return val == null ?
				null :
				jQuery.isArray(val) ?
					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);
	};
});

jQuery.extend({
	get: function( url, data, callback, type ) {
		// shift arguments if data argument was omited
		if ( jQuery.isFunction( data ) ) {
			type = type || callback;
			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 ) {
		// shift arguments if data argument was omited
		if ( jQuery.isFunction( data ) ) {
			type = type || callback;
			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",
		contentType: "application/x-www-form-urlencoded",
		processData: true,
		async: true,
		/*
		timeout: 0,
		data: null,
		username: null,
		password: null,
		traditional: false,
		*/
		// This function can be overriden by calling jQuery.ajaxSetup
		xhr: function() {
			return new window.XMLHttpRequest();
		},
		accepts: {
			xml: "application/xml, text/xml",
			html: "text/html",
			script: "text/javascript, application/javascript",
			json: "application/json, text/javascript",
			text: "text/plain",
			_default: "*/*"
		}
	},

	ajax: function( origSettings ) {
		var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
			jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);

		s.url = s.url.replace( rhash, "" );

		// Use original (not extended) context object if it was provided
		s.context = origSettings && origSettings.context != null ? origSettings.context : s;

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

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

		// Build temporary JSONP function
		if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
			jsonp = s.jsonpCallback || ("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
			var customJsonp = window[ jsonp ];

			window[ jsonp ] = function( tmp ) {
				if ( jQuery.isFunction( customJsonp ) ) {
					customJsonp( tmp );

				} else {
					// Garbage collect
					window[ jsonp ] = undefined;

					try {
						delete window[ jsonp ];
					} catch( jsonpError ) {}
				}

				data = tmp;
				jQuery.handleSuccess( s, xhr, status, data );
				jQuery.handleComplete( s, xhr, status, data );
				
				if ( head ) {
					head.removeChild( script );
				}
			};
		}

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

		if ( s.cache === false && noContent ) {
			var ts = jQuery.now();

			// try replacing _= if it is there
			var ret = s.url.replace(rts, "$1_=" + ts);

			// if nothing was replaced, add timestamp to the end
			s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
		}

		// If data is available, append data to url for GET/HEAD requests
		if ( s.data && noContent ) {
			s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
		}

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

		// Matches an absolute URL, and saves the domain
		var parts = rurl.exec( s.url ),
			remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);

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

			// 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;
						jQuery.handleSuccess( s, xhr, status, data );
						jQuery.handleComplete( s, xhr, status, data );

						// Handle memory leak in IE
						script.onload = script.onreadystatechange = null;
						if ( head && script.parentNode ) {
							head.removeChild( script );
						}
					}
				};
			}

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

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

		var requestDone = false;

		// Create the request object
		var xhr = s.xhr();

		if ( !xhr ) {
			return;
		}

		// 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 content-type if data specified and content-body is valid for this type
			if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
				xhr.setRequestHeader("Content-Type", s.contentType);
			}

			// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
			if ( s.ifModified ) {
				if ( jQuery.lastModified[s.url] ) {
					xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
				}

				if ( jQuery.etag[s.url] ) {
					xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
				}
			}

			// Set header so the called script knows that it's an XMLHttpRequest
			// Only send the header if it's not a remote XHR
			if ( !remote ) {
				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 ] + ", */*; q=0.01" :
				s.accepts._default );
		} catch( headerError ) {}

		// Allow custom headers/mimetypes and early abort
		if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
			// Handle the global AJAX counter
			if ( s.global && jQuery.active-- === 1 ) {
				jQuery.event.trigger( "ajaxStop" );
			}

			// close opended socket
			xhr.abort();
			return false;
		}

		if ( s.global ) {
			jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
		}

		// Wait for a response to come back
		var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
			// The request was aborted
			if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
				// Opera doesn't call onreadystatechange before this point
				// so we simulate the call
				if ( !requestDone ) {
					jQuery.handleComplete( s, xhr, status, data );
				}

				requestDone = true;
				if ( xhr ) {
					xhr.onreadystatechange = jQuery.noop;
				}

			// The transfer is complete and the data is available, or the request timed out
			} else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
				requestDone = true;
				xhr.onreadystatechange = jQuery.noop;

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

				var errMsg;

				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 );
					} catch( parserError ) {
						status = "parsererror";
						errMsg = parserError;
					}
				}

				// Make sure that the request was successful or notmodified
				if ( status === "success" || status === "notmodified" ) {
					// JSONP handles its own success callback
					if ( !jsonp ) {
						jQuery.handleSuccess( s, xhr, status, data );
					}
				} else {
					jQuery.handleError( s, xhr, status, errMsg );
				}

				// Fire the complete handlers
				if ( !jsonp ) {
					jQuery.handleComplete( s, xhr, status, data );
				}

				if ( isTimeout === "timeout" ) {
					xhr.abort();
				}

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

		// Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
		// Opera doesn't fire onreadystatechange at all on abort
		try {
			var oldAbort = xhr.abort;
			xhr.abort = function() {
				if ( xhr ) {
					// oldAbort has no call property in IE7 so
					// just do it this way, which works in all
					// browsers
					Function.prototype.call.call( oldAbort, xhr );
				}

				onreadystatechange( "abort" );
			};
		} catch( abortError ) {}

		// Timeout checker
		if ( s.async && s.timeout > 0 ) {
			setTimeout(function() {
				// Check to see if the request is still happening
				if ( xhr && !requestDone ) {
					onreadystatechange( "timeout" );
				}
			}, s.timeout);
		}

		// Send the data
		try {
			xhr.send( noContent || s.data == null ? null : s.data );

		} catch( sendError ) {
			jQuery.handleError( s, xhr, null, sendError );

			// Fire the complete handlers
			jQuery.handleComplete( s, xhr, status, data );
		}

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

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

	// Serialize an array of form elements or a set of
	// key/values into a query string
	param: function( a, traditional ) {
		var s = [],
			add = function( key, value ) {
				// If value is a function, invoke it and return its value
				value = jQuery.isFunction(value) ? value() : value;
				s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
			};
		
		// Set traditional to true for jQuery <= 1.3.2 behavior.
		if ( traditional === undefined ) {
			traditional = jQuery.ajaxSettings.traditional;
		}
		
		// If an array was passed in, assume that it is an array of form elements.
		if ( jQuery.isArray(a) || a.jquery ) {
			// Serialize the form elements
			jQuery.each( a, function() {
				add( this.name, this.value );
			});
			
		} else {
			// If traditional, encode the "old" way (the way 1.3.2 or older
			// did it), otherwise encode params recursively.
			for ( var prefix in a ) {
				buildParams( prefix, a[prefix], traditional, add );
			}
		}

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

function buildParams( prefix, obj, traditional, add ) {
	if ( jQuery.isArray(obj) && obj.length ) {
		// Serialize array item.
		jQuery.each( obj, function( i, v ) {
			if ( traditional || rbracket.test( prefix ) ) {
				// Treat each array item as a scalar.
				add( prefix, v );

			} else {
				// If array item is non-scalar (array or object), encode its
				// numeric index to resolve deserialization ambiguity issues.
				// Note that rack (as of 1.0.0) can't currently deserialize
				// nested arrays properly, and attempting to do so may cause
				// a server error. Possible fixes are to modify rack's
				// deserialization algorithm or to provide an option or flag
				// to force array serialization to be shallow.
				buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
			}
		});
			
	} else if ( !traditional && obj != null && typeof obj === "object" ) {
		if ( jQuery.isEmptyObject( obj ) ) {
			add( prefix, "" );

		// Serialize object item.
		} else {
			jQuery.each( obj, function( k, v ) {
				buildParams( prefix + "[" + k + "]", v, traditional, add );
			});
		}
					
	} else {
		// Serialize scalar item.
		add( prefix, obj );
	}
}

// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({

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

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

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

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

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

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

	handleComplete: function( s, xhr, status ) {
		// Process result
		if ( s.complete ) {
			s.complete.call( s.context, xhr, status );
		}

		// The request was completed
		if ( s.global ) {
			jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
		}

		// Handle the global AJAX counter
		if ( s.global && jQuery.active-- === 1 ) {
			jQuery.event.trigger( "ajaxStop" );
		}
	},
		
	triggerGlobal: function( s, type, args ) {
		(s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
	},

	// 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;
		} catch(e) {}

		return false;
	},

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

		if ( lastModified ) {
			jQuery.lastModified[url] = lastModified;
		}

		if ( etag ) {
			jQuery.etag[url] = etag;
		}

		return xhr.status === 304;
	},

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

		if ( xml && data.documentElement.nodeName === "parsererror" ) {
			jQuery.error( "parsererror" );
		}

		// Allow a pre-filtering function to sanitize the response
		// s is checked to keep backwards compatibility
		if ( s && s.dataFilter ) {
			data = s.dataFilter( data, type );
		}

		// The filter can actually parse the response
		if ( typeof data === "string" ) {
			// Get the JavaScript object, if JSON is used.
			if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
				data = jQuery.parseJSON( data );

			// If the type is "script", eval it in global context
			} else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
				jQuery.globalEval( data );
			}
		}

		return data;
	}

});

/*
 * Create the request object; Microsoft failed to properly
 * implement the XMLHttpRequest in IE7 (can't request local files),
 * so we use the ActiveXObject when it is available
 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
 * we need a fallback.
 */
if ( window.ActiveXObject ) {
	jQuery.ajaxSettings.xhr = function() {
		if ( window.location.protocol !== "file:" ) {
			try {
				return new window.XMLHttpRequest();
			} catch(xhrError) {}
		}

		try {
			return new window.ActiveXObject("Microsoft.XMLHTTP");
		} catch(activeError) {}
	};
}

// Does this browser support XHR requests?
jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();




var elemdisplay = {},
	rfxtypes = /^(?:toggle|show|hide)$/,
	rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
	timerId,
	fxAttrs = [
		// height animations
		[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
		// width animations
		[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
		// opacity animations
		[ "opacity" ]
	];

jQuery.fn.extend({
	show: function( speed, easing, callback ) {
		var elem, display;

		if ( speed || speed === 0 ) {
			return this.animate( genFx("show", 3), speed, easing, callback);

		} else {
			for ( var i = 0, j = this.length; i < j; i++ ) {
				elem = this[i];
				display = elem.style.display;

				// Reset the inline display of this element to learn if it is
				// being hidden by cascaded rules or not
				if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
					display = elem.style.display = "";
				}

				// Set elements which have been overridden with display: none
				// in a stylesheet to whatever the default browser style is
				// for such an element
				if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
					jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
				}
			}

			// Set the display of most of the elements in a second loop
			// to avoid the constant reflow
			for ( i = 0; i < j; i++ ) {
				elem = this[i];
				display = elem.style.display;

				if ( display === "" || display === "none" ) {
					elem.style.display = jQuery.data(elem, "olddisplay") || "";
				}
			}

			return this;
		}
	},

	hide: function( speed, easing, callback ) {
		if ( speed || speed === 0 ) {
			return this.animate( genFx("hide", 3), speed, easing, callback);

		} else {
			for ( var i = 0, j = this.length; i < j; i++ ) {
				var display = jQuery.css( this[i], "display" );

				if ( display !== "none" ) {
					jQuery.data( this[i], "olddisplay", display );
				}
			}

			// Set the display of the elements in a second loop
			// to avoid the constant reflow
			for ( i = 0; i < j; i++ ) {
				this[i].style.display = "none";
			}

			return this;
		}
	},

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

	toggle: function( fn, fn2, callback ) {
		var bool = typeof fn === "boolean";

		if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
			this._toggle.apply( this, arguments );

		} else if ( fn == null || bool ) {
			this.each(function() {
				var state = bool ? fn : jQuery(this).is(":hidden");
				jQuery(this)[ state ? "show" : "hide" ]();
			});

		} else {
			this.animate(genFx("toggle", 3), fn, fn2, callback);
		}

		return this;
	},

	fadeTo: function( speed, to, easing, callback ) {
		return this.filter(":hidden").css("opacity", 0).show().end()
					.animate({opacity: to}, speed, easing, callback);
	},

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

		if ( jQuery.isEmptyObject( prop ) ) {
			return this.each( optall.complete );
		}

		return this[ optall.queue === false ? "each" : "queue" ](function() {
			// XXX 'this' does not always have a nodeName when running the
			// test suite

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

			for ( p in prop ) {
				var name = jQuery.camelCase( p );

				if ( p !== name ) {
					prop[ name ] = prop[ p ];
					delete prop[ p ];
					p = name;
				}

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

				if ( isElement && ( p === "height" || p === "width" ) ) {
					// Make sure that nothing sneaks out
					// Record all 3 overflow attributes because IE does not
					// change the overflow attribute when overflowX and
					// overflowY are set to the same value
					opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];

					// Set display property to inline-block for height/width
					// animations on inline elements that are having width/height
					// animated
					if ( jQuery.css( this, "display" ) === "inline" &&
							jQuery.css( this, "float" ) === "none" ) {
						if ( !jQuery.support.inlineBlockNeedsLayout ) {
							this.style.display = "inline-block";

						} else {
							var display = defaultDisplay(this.nodeName);

							// inline-level elements accept inline-block;
							// block-level elements need to be inline with layout
							if ( display === "inline" ) {
								this.style.display = "inline-block";

							} else {
								this.style.display = "inline";
								this.style.zoom = 1;
							}
						}
					}
				}

				if ( jQuery.isArray( prop[p] ) ) {
					// Create (if needed) and add to specialEasing
					(opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
					prop[p] = prop[p][0];
				}
			}

			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 ( rfxtypes.test(val) ) {
					e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );

				} else {
					var parts = rfxnum.exec(val),
						start = e.cur() || 0;

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

						// We need to compute starting value
						if ( unit !== "px" ) {
							jQuery.style( self, name, (end || 1) + unit);
							start = ((end || 1) / e.cur()) * start;
							jQuery.style( self, 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;
		});
	},

	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;
	}

});

function genFx( type, num ) {
	var obj = {};

	jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
		obj[ this ] = type;
	});

	return obj;
}

// Generate shortcuts for custom animations
jQuery.each({
	slideDown: genFx("show", 1),
	slideUp: genFx("hide", 1),
	slideToggle: genFx("toggle", 1),
	fadeIn: { opacity: "show" },
	fadeOut: { opacity: "hide" },
	fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return this.animate( props, speed, easing, callback );
	};
});

jQuery.extend({
	speed: function( speed, easing, fn ) {
		var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
			complete: fn || !fn && easing ||
				jQuery.isFunction( speed ) && speed,
			duration: speed,
			easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
		};

		opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
			opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;

		// 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: [],

	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 );
	},

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

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

	// Start an animation from one number to another
	custom: function( from, to, unit ) {
		var self = this,
			fx = jQuery.fx;

		this.startTime = jQuery.now();
		this.start = from;
		this.end = to;
		this.unit = unit || this.unit || "px";
		this.now = this.start;
		this.pos = this.state = 0;

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

		t.elem = this.elem;

		if ( t() && jQuery.timers.push(t) && !timerId ) {
			timerId = setInterval(fx.tick, fx.interval);
		}
	},

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

		// Begin the animation
		// Make sure that we start at a small width/height to avoid any
		// flash of content
		this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());

		// 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.style( this.elem, this.prop );
		this.options.hide = true;

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

	// Each step of an animation
	step: function( gotoEnd ) {
		var t = jQuery.now(), done = true;

		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;

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

			if ( done ) {
				// Reset the overflow
				if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
					var elem = this.elem,
						options = this.options;

					jQuery.each( [ "", "X", "Y" ], function (index, value) {
						elem.style[ "overflow" + value ] = options.overflow[index];
					} );
				}

				// Hide the element if the "hide" operation was done
				if ( this.options.hide ) {
					jQuery(this.elem).hide();
				}

				// 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.style( this.elem, p, this.options.orig[p] );
					}
				}

				// 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
			var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
			var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
			this.pos = jQuery.easing[specialEasing || defaultEasing](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, {
	tick: function() {
		var timers = jQuery.timers;

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

		if ( !timers.length ) {
			jQuery.fx.stop();
		}
	},

	interval: 13,

	stop: function() {
		clearInterval( timerId );
		timerId = null;
	},

	speeds: {
		slow: 600,
		fast: 200,
		// Default speed
		_default: 400
	},

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

		_default: function( fx ) {
			if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
				fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
			} else {
				fx.elem[ fx.prop ] = fx.now;
			}
		}
	}
});

if ( jQuery.expr && jQuery.expr.filters ) {
	jQuery.expr.filters.animated = function( elem ) {
		return jQuery.grep(jQuery.timers, function( fn ) {
			return elem === fn.elem;
		}).length;
	};
}

function defaultDisplay( nodeName ) {
	if ( !elemdisplay[ nodeName ] ) {
		var elem = jQuery("<" + nodeName + ">").appendTo("body"),
			display = elem.css("display");

		elem.remove();

		if ( display === "none" || display === "" ) {
			display = "block";
		}

		elemdisplay[ nodeName ] = display;
	}

	return elemdisplay[ nodeName ];
}




var rtable = /^t(?:able|d|h)$/i,
	rroot = /^(?:body|html)$/i;

if ( "getBoundingClientRect" in document.documentElement ) {
	jQuery.fn.offset = function( options ) {
		var elem = this[0], box;

		if ( options ) { 
			return this.each(function( i ) {
				jQuery.offset.setOffset( this, options, i );
			});
		}

		if ( !elem || !elem.ownerDocument ) {
			return null;
		}

		if ( elem === elem.ownerDocument.body ) {
			return jQuery.offset.bodyOffset( elem );
		}

		try {
			box = elem.getBoundingClientRect();
		} catch(e) {}

		var doc = elem.ownerDocument,
			docElem = doc.documentElement;

		// Make sure we're not dealing with a disconnected DOM node
		if ( !box || !jQuery.contains( docElem, elem ) ) {
			return box || { top: 0, left: 0 };
		}

		var body = doc.body,
			win = getWindow(doc),
			clientTop  = docElem.clientTop  || body.clientTop  || 0,
			clientLeft = docElem.clientLeft || body.clientLeft || 0,
			scrollTop  = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop  || body.scrollTop ),
			scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
			top  = box.top  + scrollTop  - clientTop,
			left = box.left + scrollLeft - clientLeft;

		return { top: top, left: left };
	};

} else {
	jQuery.fn.offset = function( options ) {
		var elem = this[0];

		if ( options ) { 
			return this.each(function( i ) {
				jQuery.offset.setOffset( this, options, i );
			});
		}

		if ( !elem || !elem.ownerDocument ) {
			return null;
		}

		if ( elem === elem.ownerDocument.body ) {
			return jQuery.offset.bodyOffset( elem );
		}

		jQuery.offset.initialize();

		var computedStyle,
			offsetParent = elem.offsetParent,
			prevOffsetParent = elem,
			doc = elem.ownerDocument,
			docElem = doc.documentElement,
			body = doc.body,
			defaultView = doc.defaultView,
			prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
			top = elem.offsetTop,
			left = elem.offsetLeft;

		while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
			if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
				break;
			}

			computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
			top  -= elem.scrollTop;
			left -= elem.scrollLeft;

			if ( elem === offsetParent ) {
				top  += elem.offsetTop;
				left += elem.offsetLeft;

				if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
					top  += parseFloat( computedStyle.borderTopWidth  ) || 0;
					left += parseFloat( computedStyle.borderLeftWidth ) || 0;
				}

				prevOffsetParent = offsetParent;
				offsetParent = elem.offsetParent;
			}

			if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
				top  += parseFloat( computedStyle.borderTopWidth  ) || 0;
				left += parseFloat( computedStyle.borderLeftWidth ) || 0;
			}

			prevComputedStyle = computedStyle;
		}

		if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
			top  += body.offsetTop;
			left += body.offsetLeft;
		}

		if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
			top  += Math.max( docElem.scrollTop, body.scrollTop );
			left += Math.max( docElem.scrollLeft, body.scrollLeft );
		}

		return { top: top, left: left };
	};
}

jQuery.offset = {
	initialize: function() {
		var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
			html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";

		jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );

		container.innerHTML = html;
		body.insertBefore( container, body.firstChild );
		innerDiv = container.firstChild;
		checkDiv = innerDiv.firstChild;
		td = innerDiv.nextSibling.firstChild.firstChild;

		this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
		this.doesAddBorderForTableAndCells = (td.offsetTop === 5);

		checkDiv.style.position = "fixed";
		checkDiv.style.top = "20px";

		// safari subtracts parent border width here which is 5px
		this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
		checkDiv.style.position = checkDiv.style.top = "";

		innerDiv.style.overflow = "hidden";
		innerDiv.style.position = "relative";

		this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);

		this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);

		body.removeChild( container );
		body = container = innerDiv = checkDiv = table = td = null;
		jQuery.offset.initialize = jQuery.noop;
	},

	bodyOffset: function( body ) {
		var top = body.offsetTop,
			left = body.offsetLeft;

		jQuery.offset.initialize();

		if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
			top  += parseFloat( jQuery.css(body, "marginTop") ) || 0;
			left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
		}

		return { top: top, left: left };
	},
	
	setOffset: function( elem, options, i ) {
		var position = jQuery.css( elem, "position" );

		// set position first, in-case top/left are set even on static elem
		if ( position === "static" ) {
			elem.style.position = "relative";
		}

		var curElem = jQuery( elem ),
			curOffset = curElem.offset(),
			curCSSTop = jQuery.css( elem, "top" ),
			curCSSLeft = jQuery.css( elem, "left" ),
			calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
			props = {}, curPosition = {}, curTop, curLeft;

		// need to be able to calculate position if either top or left is auto and position is absolute
		if ( calculatePosition ) {
			curPosition = curElem.position();
		}

		curTop  = calculatePosition ? curPosition.top  : parseInt( curCSSTop,  10 ) || 0;
		curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;

		if ( jQuery.isFunction( options ) ) {
			options = options.call( elem, i, curOffset );
		}

		if (options.top != null) {
			props.top = (options.top - curOffset.top) + curTop;
		}
		if (options.left != null) {
			props.left = (options.left - curOffset.left) + curLeft;
		}
		
		if ( "using" in options ) {
			options.using.call( elem, props );
		} else {
			curElem.css( props );
		}
	}
};


jQuery.fn.extend({
	position: function() {
		if ( !this[0] ) {
			return null;
		}

		var elem = this[0],

		// Get *real* offsetParent
		offsetParent = this.offsetParent(),

		// Get correct offsets
		offset       = this.offset(),
		parentOffset = rroot.test(offsetParent[0].nodeName) ? { 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  -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
		offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;

		// Add offsetParent borders
		parentOffset.top  += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
		parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;

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

	offsetParent: function() {
		return this.map(function() {
			var offsetParent = this.offsetParent || document.body;
			while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
				offsetParent = offsetParent.offsetParent;
			}
			return offsetParent;
		});
	}
});


// Create scrollLeft and scrollTop methods
jQuery.each( ["Left", "Top"], function( i, name ) {
	var method = "scroll" + name;

	jQuery.fn[ method ] = function(val) {
		var elem = this[0], win;
		
		if ( !elem ) {
			return null;
		}

		if ( val !== undefined ) {
			// Set the scroll offset
			return this.each(function() {
				win = getWindow( this );

				if ( win ) {
					win.scrollTo(
						!i ? val : jQuery(win).scrollLeft(),
						 i ? val : jQuery(win).scrollTop()
					);

				} else {
					this[ method ] = val;
				}
			});
		} else {
			win = getWindow( elem );

			// Return the scroll offset
			return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
				jQuery.support.boxModel && win.document.documentElement[ method ] ||
					win.document.body[ method ] :
				elem[ method ];
		}
	};
});

function getWindow( elem ) {
	return jQuery.isWindow( elem ) ?
		elem :
		elem.nodeType === 9 ?
			elem.defaultView || elem.parentWindow :
			false;
}




// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {

	var type = name.toLowerCase();

	// innerHeight and innerWidth
	jQuery.fn["inner" + name] = function() {
		return this[0] ?
			parseFloat( jQuery.css( this[0], type, "padding" ) ) :
			null;
	};

	// outerHeight and outerWidth
	jQuery.fn["outer" + name] = function( margin ) {
		return this[0] ?
			parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
			null;
	};

	jQuery.fn[ type ] = function( size ) {
		// Get window width or height
		var elem = this[0];
		if ( !elem ) {
			return size == null ? null : this;
		}
		
		if ( jQuery.isFunction( size ) ) {
			return this.each(function( i ) {
				var self = jQuery( this );
				self[ type ]( size.call( this, i, self[ type ]() ) );
			});
		}

		if ( jQuery.isWindow( elem ) ) {
			// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
			return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
				elem.document.body[ "client" + name ];

		// Get document width or height
		} else if ( elem.nodeType === 9 ) {
			// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
			return Math.max(
				elem.documentElement["client" + name],
				elem.body["scroll" + name], elem.documentElement["scroll" + name],
				elem.body["offset" + name], elem.documentElement["offset" + name]
			);

		// Get or set width or height on the element
		} else if ( size === undefined ) {
			var orig = jQuery.css( elem, type ),
				ret = parseFloat( orig );

			return jQuery.isNaN( ret ) ? orig : ret;

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

});


})(window);

    /*!
 * jQuery UI Widget 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function( $, undefined ) {

// jQuery 1.4+
if ( $.cleanData ) {
	var _cleanData = $.cleanData;
	$.cleanData = function( elems ) {
		for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
			$( elem ).triggerHandler( "remove" );
		}
		_cleanData( elems );
	};
} else {
	var _remove = $.fn.remove;
	$.fn.remove = function( selector, keepData ) {
		return this.each(function() {
			if ( !keepData ) {
				if ( !selector || $.filter( selector, [ this ] ).length ) {
					$( "*", this ).add( [ this ] ).each(function() {
						$( this ).triggerHandler( "remove" );
					});
				}
			}
			return _remove.call( $(this), selector, keepData );
		});
	};
}

$.widget = function( name, base, prototype ) {
	var namespace = name.split( "." )[ 0 ],
		fullName;
	name = name.split( "." )[ 1 ];
	fullName = namespace + "-" + name;

	if ( !prototype ) {
		prototype = base;
		base = $.Widget;
	}

	// create selector for plugin
	$.expr[ ":" ][ fullName ] = function( elem ) {
		return !!$.data( elem, name );
	};

	$[ namespace ] = $[ namespace ] || {};
	$[ namespace ][ name ] = function( options, element ) {
		// allow instantiation without initializing for simple inheritance
		if ( arguments.length ) {
			this._createWidget( options, element );
		}
	};

	var basePrototype = new base();
	// we need to make the options hash a property directly on the new instance
	// otherwise we'll modify the options hash on the prototype that we're
	// inheriting from
//	$.each( basePrototype, function( key, val ) {
//		if ( $.isPlainObject(val) ) {
//			basePrototype[ key ] = $.extend( {}, val );
//		}
//	});
	basePrototype.options = $.extend( true, {}, basePrototype.options );
	$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
		namespace: namespace,
		widgetName: name,
		widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
		widgetBaseClass: fullName
	}, prototype );

	$.widget.bridge( name, $[ namespace ][ name ] );
};

$.widget.bridge = function( name, object ) {
	$.fn[ name ] = function( options ) {
		var isMethodCall = typeof options === "string",
			args = Array.prototype.slice.call( arguments, 1 ),
			returnValue = this;

		// allow multiple hashes to be passed on init
		options = !isMethodCall && args.length ?
			$.extend.apply( null, [ true, options ].concat(args) ) :
			options;

		// prevent calls to internal methods
		if ( isMethodCall && options.charAt( 0 ) === "_" ) {
			return returnValue;
		}

		if ( isMethodCall ) {
			this.each(function() {
				var instance = $.data( this, name ),
					methodValue = instance && $.isFunction( instance[options] ) ?
						instance[ options ].apply( instance, args ) :
						instance;
				// TODO: add this back in 1.9 and use $.error() (see #5972)
//				if ( !instance ) {
//					throw "cannot call methods on " + name + " prior to initialization; " +
//						"attempted to call method '" + options + "'";
//				}
//				if ( !$.isFunction( instance[options] ) ) {
//					throw "no such method '" + options + "' for " + name + " widget instance";
//				}
//				var methodValue = instance[ options ].apply( instance, args );
				if ( methodValue !== instance && methodValue !== undefined ) {
					returnValue = methodValue;
					return false;
				}
			});
		} else {
			this.each(function() {
				var instance = $.data( this, name );
				if ( instance ) {
					instance.option( options || {} )._init();
				} else {
					$.data( this, name, new object( options, this ) );
				}
			});
		}

		return returnValue;
	};
};

$.Widget = function( options, element ) {
	// allow instantiation without initializing for simple inheritance
	if ( arguments.length ) {
		this._createWidget( options, element );
	}
};

$.Widget.prototype = {
	widgetName: "widget",
	widgetEventPrefix: "",
	options: {
		disabled: false
	},
	_createWidget: function( options, element ) {
		// $.widget.bridge stores the plugin instance, but we do it anyway
		// so that it's stored even before the _create function runs
		$.data( element, this.widgetName, this );
		this.element = $( element );
		this.options = $.extend( true, {},
			this.options,
			this._getCreateOptions(),
			options );

		var self = this;
		this.element.bind( "remove." + this.widgetName, function() {
			self.destroy();
		});

		this._create();
		this._trigger( "create" );
		this._init();
	},
	_getCreateOptions: function() {
		return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
	},
	_create: function() {},
	_init: function() {},

	destroy: function() {
		this.element
			.unbind( "." + this.widgetName )
			.removeData( this.widgetName );
		this.widget()
			.unbind( "." + this.widgetName )
			.removeAttr( "aria-disabled" )
			.removeClass(
				this.widgetBaseClass + "-disabled " +
				"ui-state-disabled" );
	},

	widget: function() {
		return this.element;
	},

	option: function( key, value ) {
		var options = key;

		if ( arguments.length === 0 ) {
			// don't return a reference to the internal hash
			return $.extend( {}, this.options );
		}

		if  (typeof key === "string" ) {
			if ( value === undefined ) {
				return this.options[ key ];
			}
			options = {};
			options[ key ] = value;
		}

		this._setOptions( options );

		return this;
	},
	_setOptions: function( options ) {
		var self = this;
		$.each( options, function( key, value ) {
			self._setOption( key, value );
		});

		return this;
	},
	_setOption: function( key, value ) {
		this.options[ key ] = value;

		if ( key === "disabled" ) {
			this.widget()
				[ value ? "addClass" : "removeClass"](
					this.widgetBaseClass + "-disabled" + " " +
					"ui-state-disabled" )
				.attr( "aria-disabled", value );
		}

		return this;
	},

	enable: function() {
		return this._setOption( "disabled", false );
	},
	disable: function() {
		return this._setOption( "disabled", true );
	},

	_trigger: function( type, event, data ) {
		var callback = this.options[ type ];

		event = $.Event( event );
		event.type = ( type === this.widgetEventPrefix ?
			type :
			this.widgetEventPrefix + type ).toLowerCase();
		data = data || {};

		// copy original event properties over to the new event
		// this would happen if we could call $.event.fix instead of $.Event
		// but we don't have a way to force an event to be fixed multiple times
		if ( event.originalEvent ) {
			for ( var i = $.event.props.length, prop; i; ) {
				prop = $.event.props[ --i ];
				event[ prop ] = event.originalEvent[ prop ];
			}
		}

		this.element.trigger( event, data );

		return !( $.isFunction(callback) &&
			callback.call( this.element[0], event, data ) === false ||
			event.isDefaultPrevented() );
	}
};

})( jQuery );

    /**
 * @author trixta 
 */
(function($){
	try {
		if(!window.console){
			window.console = {};
		}
		if(!console.log){
			console.log = $.noop;
		}
	} catch(e){}
	
	if(document.execCommand){
		try{
			document.execCommand('BackgroundImageCache', false, true);
		} catch(e){}
	}
	
	if(!$.support.opacity && !$.opacityRemoveFix){
		var oldStyle = $.style;
		$.style = function(elem, name, value){
			var ret = oldStyle(elem, name, value);
			if(name === 'opacity' && value == 1){
				elem.style.filter = (elem.style.filter || '').replace('alpha(opacity=100)', '');
			}
			return ret;
		};
		$.opacityRemoveFix = true;
	}
	
	$.beget = function(o, cfg){
		var f = function(){};
		o = new f();
		if(o.create && o.create.apply){
			o.create.call(o, cfg || {});
		}
		return o;
	};
	
	var atom 	= ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'p', 'li', 'dt', 'dd', 'blockquote', 'address', 'th', 'td', 'dfn'],
		exp 	= $.expr.filters
	;
	
	exp.focusPoint = function(elem){
		var name = elem.nodeName.toLowerCase();
		return (
				//state check
				( !elem.disabled && elem.type !== 'hidden' && elem.getAttribute('role') !== 'presentation' && elem.getAttribute('aria-disabled') !== 'true') &&
				//style check
				(elem.offsetWidth > 0 && elem.offsetHeight > 0 && $.curCSS(elem, 'visibility') !== 'hidden') &&
				//element check
				( $.inArray(name, atom) !== -1 )
		);
	};
	
	exp.focusAble = function(i, elem){
		return ( $.attr(elem, 'tabindex') !== undefined );
	};
	
	
	$.fn.firstExpOf = function(sel){
		if(!this[0]){
			return this.pushStack([]);
		}
		var elems 	= $('*', this[0]),
			len 	= elems.length,
			ret		= []
		;
		for(var i = 0; i < len; i++){
			if(exp[sel](elems[i], i)){
				ret = [elems[i]];
				break;
			}
		}
		return this.pushStack(ret);
	};
	
	var currentLoc = location.href.split('#')[0];
	$.fn.getHrefHash = function(sel){
		var ret = '';
		if(this[0]){
			ret = this[0].hash || this[0].href.replace(currentLoc, '');
		}
		return ret;
	};
	
	$('html').addClass('js-on');
	
	var body, bodyStyle;
	
	$.SCROLLBARWIDTH = 15;
	$.SCROLLROOT = $($.browser.webkit || document.compatMode == 'BackCompat' ?
				document.body : 
				document.documentElement);
	function setConstants(){
		body = $(document.body);
		bodyStyle = body[0].style;
		
		var testElem 		= $('<div style="position: absolute; visibility: hidden; width: 80px; overflow: scroll;height: 80px;"><div style="width: 99px; height: 99px;" /></div>')
								.appendTo('body');
		$.SCROLLBARWIDTH = testElem.innerWidth() - $('div', testElem).css('width', 'auto').innerWidth();
		testElem.remove();
		testElem = null;
		body.removeClass('js-off');
	}
	
	if(!document.body || !document.body.style){
		$(setConstants);
	} else {
		setConstants();
	}
	
	$.each(['outerHeight', 'outerWidth', 'height', 'width', 'innerHeight', 'innerWidth'], function(i, name){
		$.fn[name +'s'] = function(arg){
			if( (name === 'height' || name === 'width') && arg !== undefined ){
				return $.fn[name].apply(this, arguments);
			}
			var ret = 0;
			this.each(function(){
				ret += $(this)[name](arg);
			});
			return ret;
		};
	});
	
	
})(jQuery);


(function($){
	var allowFocus 	= true;
	
	function stopFocus(){
		allowFocus = false;
		setTimeout(function(){
			allowFocus = true;
		}, 1);
	}
	
	function testDomTarget(e){
		var oE 	= e.originalEvent;
		if(e.target === document || e.target === window || $.nodeName(e.target, 'body') || $.nodeName(e.target, 'html') || $.attr(e.target, 'tabindex') === undefined ){
			stopFocus();
			return false;
		}
		if(oE){
			if(
					allowFocus && e.target && e.target.nodeType === 1 &&
					(oE.explicitOriginalTarget && oE.explicitOriginalTarget && oE.explicitOriginalTarget !== window &&  oE.explicitOriginalTarget !== document && !$(oE.explicitOriginalTarget).is('html, body') ||
					oE.toElement || oE.fromElement)
				) {
					return true;
				} else {
					return false;
				}
		}
		return true;
	}
	
	$.each(['focusin', 'focusout'], function(i, eType){
		
		$.event.special['dom'+ eType] = {
			setup: function(){
				$(this)
					.bind(eType, $.event.special['dom'+ eType].handler);
                return true;
            },
			teardown: function(){
                $(this).unbind(eType, $.event.special['dom'+ eType].handler);
                return true;
            },
            handler: function(e){
				if(testDomTarget(e)){
	                e = $.extend({}, e, {type: 'dom'+ eType});
	                return $.event.handle.call(this, e);
				}
				return undefined;
            }
		};
		
	});
	
	/*
	 * timer
	 */

	var clearInterval 	= window.clearInterval,
		setInterval 	= window.setInterval,
		setTimeout 		= window.setTimeout
	;
	$.createTimer = function(obj){
		
		function clear(name){
			if(obj[name] !== undefined){
				clearInterval(obj[name]);
			}
		}
		
		return {
			setInterval: function(name, fn, delay){
				clear(name); 
				obj[name] = setInterval(function(){fn.call(obj);}, delay);
			},
			setDelay: function(name, fn, delay){
				clear(name);
				obj[name] = setTimeout(function(){fn.call(obj);}, delay);
			},
			clear: clear
		};
	};
})(jQuery);
(function($){
	
	var offsetBaseCSS 	= 'position: absolute; width: 1px; height: 1px; overflow: hidden;margin: 0; padding: 0;top: 0;',
		offsetDir 		= ($('html').attr('dir') === 'rtl') ? 'right: -9999em;' : 'left: -99999em;',
		offsetCSS 		= offsetBaseCSS+offsetDir,
		version 		= parseInt($.browser.version, 10)
	;
	$.support.waiAria = (!$.browser.msie || version > 7);
	$.notIE6 = (!$.browser.msie || version > 6);
	$.browser.lteIE6 = ($.browser.msie && version < 7);
	$.browser.lteIE7 = ($.browser.msie && version < 8);
	$.browser.lteIE8 = ($.browser.msie && version < 9);
	
	if($.fx.interval < 16){
		$.fx.interval = 17;
		if($.browser.lteIE8 || $.browser.mozilla && version < 2){
			$.fx.interval = 25;
		}
		$(function(){
			try{
				if($(window).width() < 490 && $(window).height() < 490){
					$.fx.interval = 33;
				}
			} catch(e){}
		});
	}
	
$(function(){
	
	var style = document.createElement('style'),
		styleS
	;
	
	style.setAttribute('type', 'text/css');
	style = $(style).prependTo('head');
	
	styleS = document.styleSheets[0];
	
	function add(sel, prop){
		if (styleS.cssRules || styleS.rules) {
			if (styleS.insertRule) {
				styleS.insertRule(sel +' {'+ prop +';}', styleS.cssRules.length);
			} else if (styleS.addRule) {
				styleS.addRule(sel, prop);
			}
		}
	}
	
	add('.a11y-js-overflow', 'overflow:visible !important');
	add('.a11y-hidden', 'position:absolute');
	add('.a11y-hidden', offsetDir.replace(';', ''));
	
	
	
	$.cssRule = {
		add: add
	};
});

	$.ui = $.ui ||
		{};
		
	if(!$.ui.keyCode){
		$.ui.keyCode = {
			DOWN: 40,
			END: 35,
			ENTER: 13,
			ESCAPE: 27,
			HOME: 36,
			LEFT: 37,
			PAGE_DOWN: 34,
			PAGE_UP: 33,
			RIGHT: 39,
			SHIFT: 16,
			SPACE: 32,
			TAB: 9,
			UP: 38
		};
	}
		
	
	/*
	 * HCM-Detection
	 */
	$.ui.userMode = (function(){
		var userBg, 
			timer, 
			testDiv;
		
		function testBg(){
			if(console.firebug && console.info){return;}
			testDiv = testDiv || $('<div style="'+ offsetCSS +'"></div>').appendTo('body');
			var black = $.curCSS( testDiv.css({backgroundColor: '#000000'})[0], 'backgroundColor', true),
				white = $.curCSS( testDiv.css({backgroundColor: '#ffffff'})[0], 'backgroundColor', true),
				newBgStatus = (black === white || white === 'transparent')
			;
			
			if(newBgStatus != userBg){
				userBg = newBgStatus;
				$.event.trigger({type: 'usermode', disabled: !userBg, enabled: userBg});
			}
			return userBg;
		}
		
		function init(){
			testBg();
			clearInterval(timer);
			timer = setInterval(testBg, 3000);
		}
				
		$.event.special.usermode = {
			add: function(handler){
				//always trigger
				testBg();
				var elem =  this;
				setTimeout(function(){
					$(elem).trigger({type: 'usermode', disabled: !userBg, enabled: userBg});
				}, 0);
				return handler;
			},
			setup: function(){
				
			},
			teardown: function(){},
            handler: function(){}
		};
		
		return {
			get: testBg,
			init: init
		};
		
	})();
	
	$.fn.userMode = function(fn){
		return this[(fn) ? 'bind' : 'trigger']('usermode', fn);
	};
	
	$(function(){
		$('html').userMode(function(e){
			$(this)[e.enabled ? 'addClass' : 'removeClass']('hcm');
		});
		$.ui.userMode.init();
	});
	
	(function($){
		var preventclick = false;
		
		function handleAriaClick(e){
			if(!preventclick && (!e.keyCode || e.keyCode === 13 || ( e.keyCode === 32 && $.attr(e.target, 'role') === 'button' ) )){
				preventclick = true;
				setTimeout(function(){
					preventclick = false;
				}, 1);
				return $.event.special.ariaclick.handler.apply(this, arguments);
			} else if(preventclick && e.type == 'click'){
				e.preventDefault();
				return false;
			}
			return undefined;
		}
		$.event.special.ariaclick = {
			setup: function(){
				$(this).bind('click keypress', handleAriaClick);
	            return true;
	        },
			teardown: function(){
	            $(this).unbind('click keypress', handleAriaClick);
	            return true;
	        },
	        handler: function(e){
	            e.type = 'ariaclick';
	            return $.event.handle.apply(this, arguments);
	        }
		};
	})(jQuery);
	
	
	/* EM-Change */
	$.bodyDefaultFontsize = 10;
	$.testEm = (function(){
		var body = document.body,
			timer,
			evt = {
					type: 'emchange',
					emPx: 0,
					oldEmPx: 0
			},
			html = $(document.documentElement)
		;
				
		function test(){
			if(console.firebug && console.info){return;}
			var oldEmPx = evt.emPx;
			evt.emPx = parseInt($.curCSS(body, 'fontSize', true), 10);
			if(evt.emPx !== oldEmPx){
				evt.oldEmPx = oldEmPx;
				$.event.trigger(evt);
			}
			return evt;
		}
		
		function addEmClass(e){
			var dif 	= e.emPx - $.bodyDefaultFontsize,
				prefix	= (dif > 0) ? 'em-increased-' : 'em-decreased-',
				newCl 	= []
			;

			dif = Math.abs(dif) + 1;
			while (dif-- > 1) {
				newCl.push(prefix + dif);
			}
			html[0].className = $.grep(html[0].className.split(' '), function(n){
				return (n.indexOf('em-increased-') !== 0 && n.indexOf('em-decreased-') !== 0);
			}).concat(newCl).join(' ');
		}
			
		
		$(function(){
			body = document.body;
			clearInterval(timer);
			setTimeout(function(){
				html.bind('emchange', addEmClass);
				test();
				timer = setInterval(test, 3000);
			}, 0);
		});
		return test;
	})();
		
	(function($){
		var allowFocus 		= true,
			currentFocus 	= document,
			supActiveElem 	= ('activeElement' in document),
			// Jaws 8/9 needs at least 54ms
			minFocusTimer 	= 70,
			keyFocusTimer,
			focusTimer
		;
		
		function stopKeyFocus(e){
			allowFocus = false;
			clearTimeout(keyFocusTimer);
			setTimeout(function(){
				allowFocus = true;
				clearTimeout(keyFocusTimer);
			}, 99);
		}
		
		
		function addFocus(e){
			var jElm = $(e.target).addClass('a11y-focus');
			
			currentFocus = e.target;
			if(!supActiveElem){
				document.activeElement = e.target;
			}
			clearTimeout(keyFocusTimer);
			keyFocusTimer = setTimeout(function(){
				if(allowFocus){
					jElm.addClass('a11y-focus-key').trigger('keyfocus');
				}
			}, 0);
			
		}
		
		$(document)
			.bind('mousedown click', stopKeyFocus)
			.bind('domfocusin', addFocus)
			.bind('focusout', function(e){
				clearTimeout(keyFocusTimer);
				$(e.target)
					.removeClass('a11y-focus-key a11y-focus-widget a11y-focus')
				;
			})
		;
		
		
		function addTabindex(jElm){
			var tabindex = jElm.attr('tabindex');
			if(!(tabindex || tabindex === 0)){
				jElm.css({outline: 'none'}).attr({tabindex: '-1'});
				if( !$.support.waiAria && jElm[0] ){
					jElm[0].hideFocus = true;
				}
			}
			return jElm;
		}
		
		$.fn.setFocus = function(opts){
			if(!this[0]){return this;}
			opts = $.extend({}, $.fn.setFocus.defaults, opts);
			var elem 			= this[0],
				jElm 			= $(elem),
				activeElem		= document.activeElement,
				now				= new Date().getTime(),
				focusFn 		= function(){
								try{
									stopKeyFocus();
									elem.focus();
									jElm.addClass('a11y-focus-widget');
								} catch(e){}
							},
				fxParent
			;
			
			
			if(opts.addTabindex){
				addTabindex(jElm);
			}
			
			$.ui.SR.update();
			
			if( !opts.fast ){
				//update jaws 8/9 buffer
				if(activeElem && activeElem.focus && activeElem.blur){
					activeElem.blur();
					stopKeyFocus();
					activeElem.focus();
				}
				
				clearTimeout(focusTimer);
				
				//falsy focus bounce in ie / no scrollIntoView in ff workaround
				fxParent = jElm.closest(':animated', opts.context);
				if( fxParent[0] ){
					fxParent.queue(function(){
						var time = new Date().getTime() - now - minFocusTimer;
						time = (time > 9) ? time : 9;
						focusTimer = setTimeout( focusFn, time );
						setTimeout(function(){
							fxParent.dequeue();
						}, time + 16);
					});
				} else {
					focusTimer = setTimeout( focusFn, minFocusTimer );//min 54
				}
			} else {
				focusFn();
			}
			return this;
		};
		
		$.fn.setFocus.defaults = {
			addTabindex: true,
			fast: false,
			context: false
		};
			
	})(jQuery);
	
	/* hide/show */
	
	$.fn.ariaHide = function(){
		$.fn.hide.apply(this, arguments);
		return this.attr({'aria-hidden': 'true'});
	};
	
	$.fn.ariaShow = function(){
		$.fn.show.apply(this, arguments);
		return this.attr({'aria-hidden': 'false'});
	};
	
	
	/*
	 * SR-Update
	 */
	$.ui.SR = (function(){
		var input, val = 0, alertBox, boxTimer, statusBox, statusTimer;
		
		function init(){
			alertBox = $('<div class="a11y-hidden" role="alert" style="'+ offsetCSS +'" />').ariaHide().appendTo('body');
			statusBox = $('<div class="a11y-hidden" style="'+ offsetCSS +'"><div aria-live="polite" relevant="additions text" /> </div>').appendTo('body').find('div');
			input = $('<form role="presentation" action="#" class="aural" style="'+ offsetCSS +'"><input name="sr-update" id="sr-update" type="hidden" value="'+val+'" /></form>')
				.appendTo('body')
				.find('input')
				.ajaxComplete(update);
		}
		
		function update(){
			var posStyle, wrapperHeight;
			if(input){
				input[0].setAttribute('value', '' +(++val));
				setTimeout(function(){
					input[0].setAttribute('value', '' +(++val));
				}, 1);
			}
		}
		
		
		function alert(notice){
			clearTimeout(boxTimer);
			alertBox.ariaHide()
				.html(notice)
					.find('*')
					.attr({role: 'presentation'})
				.end()
				.ariaShow();
			
			boxTimer = setTimeout(function(){
				alertBox.ariaHide().empty();
			}, 999);
		}
		
		function giveStatus(text){
			
			text = $('<div>'+ text +'</div>')
					.find('*')
					.attr({role: 'presentation'})
				.end();
			statusBox.html(text);
			clearTimeout(statusTimer);
			statusTimer = setTimeout(function(){
				statusBox.empty();
			}, 999);
		}
		
		
		return {
			update: update,
			alert: alert,
			giveStatus: giveStatus,
			init: init
		};
	})();
	$($.ui.SR.init);
	
	/*
	 * getID-Exts
	 */
	
	if(!$.fn.getID){
		var uId = new Date().getTime();
		$.fn.getID = function(setAll){
			
			function setID(){
				var id 		= this.getAttribute('id');
				if(!id){
					id = 'ID-' + (uId++);
					this.setAttribute('id', id);
				}
				return id;
			}
			if(this[0]){
				if(setAll){
					this.each(setID);
				}
				return setID.call(this[0]);
			}
			return undefined;
		};
	}
	
	$.each({
		labelWith: 'aria-labelledby',
		describeWith: 'aria-describedby',
		ownsThis: 'aria-owns',
		controlsThis: 'aria-controls',
		activateThis: 'aria-activedescendant'
	}, function(name, prop){
		$.fn[name] = function(elem){
			return this.attr(prop, $(elem).getID() || '');
		};
	});
	
	/*
	*  enterLeave
	*  hover = focusblur
	*/
	var inReg 	= /focusin|focus$|mouseenter|mouseover/,
		inID 	= 0
	;	
	$.fn.enterLeave = function(enter, out, opts){
		opts = $.extend({}, $.fn.enterLeave.defaults, opts);
		inID++;
		var dataID = 'enterLeaveData-'+inID;
		var eventTypes 	= 'mouseenter mouseleave focusin focusout';
		
		if(opts.useEventTypes === 'mouse'){
			eventTypes = 'mouseenter mouseleave';
		} else if(opts.useEventTypes === 'focus'){
			eventTypes = 'focusin focusout';
		}
		var handler = function handler(e){
			var fn,
				inOutData = $.data(this, dataID) || $.data(this, dataID, {inEvents: 0}),
				params,
				elem = this,
				evt
			;
			if(inReg.test(e.type)){
				fn = enter;
				params =  [1, 'in', true];
				//webkit autoblur prevention 
				if(opts.useWebkitAutoBlur){
					inOutData.autoBlur = true; 
					setTimeout(function(){
						inOutData.autoBlur = false;
					}, 0);
				}
			} else {
				fn = out;
				params = [-1, 'out', false];
				if(inOutData.autoBlur){
					return;
				}
			}
			
			clearTimeout(inOutData.inOutTimer);
			inOutData.inEvents = Math.max(inOutData.inEvents + params[0], 0);
			inOutData.inOutTimer = setTimeout(function(){
				if(params[2] != inOutData.inOutState && 
						(params[2] || !opts.bothOut || !inOutData.inEvents)){
					
					inOutData.inOutState = params[2];
					evt = $.Event(params[1]);
					evt.originalEvent = e;
					$.extend(evt, {target: e.target, currentTarget: e.currentTarget});
					fn.call(elem, evt);
				}
			}, /focus/.test(e.type) ? opts.keyDelay : opts.mouseDelay);
		};
		return this[opts.bindStyle](eventTypes, handler);
	};
	
	$.fn.enterLeave.defaults = {
		mouseDelay: 0,
		keyDelay: 1,
		bothOut: false,
		useEventTypes: 'both', // both || mouse || focus
		useWebkitAutoBlur: false,
		bindStyle: 'bind'
	};
	
	$.fn.inOut = $.fn.enterLeave;
	
	$.fn.slideParentDown = function(opts){
		opts = $.extend({}, $.fn.slideParentDown.defaults, opts);
		var fn = opts.complete;
		
		return this.each(function(){
			
			var jElm 		= $(this),
				parent		= jElm.parent().css({height: ''}),
				outerHeight
			;
			jElm
				.css((opts.hideStyle === 'visibility') ? {visibility: ''} : {display: 'block'})
			;
			outerHeight = parent.height();
						
			parent
				.css({overflow: 'hidden', height: '0px'})
				.animate(
					{
						height: outerHeight
					}, 
					$.extend({}, opts, {complete: function(){
						parent.css({height: ''});
						fn.apply(this, arguments);
					}})
				)
			;
			
			
		});
	};
	$.fn.slideParentDown.defaults = {
		duration: 400,
		complete: $.noop,
		hideStyle: 'display'
	};
		
	$.fn.slideParentUp = function(opts){
		opts = $.extend({}, $.fn.slideParentUp.defaults, opts);
		var fn = opts.complete;
		return this.each(function(){
			var jElm 		= $(this),
				parent		= jElm.parent().css({overflow: 'hidden'}),
				cssProp 	= {height: '0px'}
			;
			if($.browser.mozilla && opts.flickrFix){
				cssProp.flickrFix = Math.random() * 2;
			}
			parent
				.animate(cssProp, $.extend({}, opts, {
					complete: function(){
						if(opts.hideStyle === 'visibility'){
							jElm.css({visibility: 'hidden'});
						} else {
							jElm.css({display: 'none'});
							parent.css({height: '', overflow: '', display: ''});
						}
						fn.apply(this, arguments);
					}
				}));
		});
	};
	$.fn.slideParentUp.defaults = {
		duration: 400,
		hideStyle: 'display',
		complete: $.noop,
		flickrFix: false
	};
	
	
	/* inline-block support */
	$.support.inlineBlock = true;
	
	$(function() {
		var tElm = $('<div style="display: inline-block;"/>').appendTo('body');
		$.support.inlineBlock = (tElm.css('display') === 'inline-block');
		tElm.remove();
	});
	
})(jQuery);
    /*!
 * jQuery UI 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function( $, undefined ) {

// prevent duplicate loading
// this is only a problem because we proxy existing functions
// and we don't want to double proxy them
$.ui = $.ui || {};
if ( $.ui.version ) {
	return;
}

$.extend( $.ui, {
	version: "1.8.6",

	keyCode: {
		ALT: 18,
		BACKSPACE: 8,
		CAPS_LOCK: 20,
		COMMA: 188,
		COMMAND: 91,
		COMMAND_LEFT: 91, // COMMAND
		COMMAND_RIGHT: 93,
		CONTROL: 17,
		DELETE: 46,
		DOWN: 40,
		END: 35,
		ENTER: 13,
		ESCAPE: 27,
		HOME: 36,
		INSERT: 45,
		LEFT: 37,
		MENU: 93, // COMMAND_RIGHT
		NUMPAD_ADD: 107,
		NUMPAD_DECIMAL: 110,
		NUMPAD_DIVIDE: 111,
		NUMPAD_ENTER: 108,
		NUMPAD_MULTIPLY: 106,
		NUMPAD_SUBTRACT: 109,
		PAGE_DOWN: 34,
		PAGE_UP: 33,
		PERIOD: 190,
		RIGHT: 39,
		SHIFT: 16,
		SPACE: 32,
		TAB: 9,
		UP: 38,
		WINDOWS: 91 // COMMAND
	}
});

// plugins
$.fn.extend({
	_focus: $.fn.focus,
	focus: function( delay, fn ) {
		return typeof delay === "number" ?
			this.each(function() {
				var elem = this;
				setTimeout(function() {
					$( elem ).focus();
					if ( fn ) {
						fn.call( elem );
					}
				}, delay );
			}) :
			this._focus.apply( this, arguments );
	},

	scrollParent: function() {
		var scrollParent;
		if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
			scrollParent = this.parents().filter(function() {
				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		} else {
			scrollParent = this.parents().filter(function() {
				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		}

		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
	},

	zIndex: function( zIndex ) {
		if ( zIndex !== undefined ) {
			return this.css( "zIndex", zIndex );
		}

		if ( this.length ) {
			var elem = $( this[ 0 ] ), position, value;
			while ( elem.length && elem[ 0 ] !== document ) {
				// Ignore z-index if position is set to a value where z-index is ignored by the browser
				// This makes behavior of this function consistent across browsers
				// WebKit always returns auto if the element is positioned
				position = elem.css( "position" );
				if ( position === "absolute" || position === "relative" || position === "fixed" ) {
					// IE returns 0 when zIndex is not specified
					// other browsers return a string
					// we ignore the case of nested elements with an explicit value of 0
					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
					value = parseInt( elem.css( "zIndex" ), 10 );
					if ( !isNaN( value ) && value !== 0 ) {
						return value;
					}
				}
				elem = elem.parent();
			}
		}

		return 0;
	},

	disableSelection: function() {
		return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
			".ui-disableSelection", function( event ) {
				event.preventDefault();
			});
	},

	enableSelection: function() {
		return this.unbind( ".ui-disableSelection" );
	}
});

$.each( [ "Width", "Height" ], function( i, name ) {
	var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
		type = name.toLowerCase(),
		orig = {
			innerWidth: $.fn.innerWidth,
			innerHeight: $.fn.innerHeight,
			outerWidth: $.fn.outerWidth,
			outerHeight: $.fn.outerHeight
		};

	function reduce( elem, size, border, margin ) {
		$.each( side, function() {
			size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
			if ( border ) {
				size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
			}
			if ( margin ) {
				size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
			}
		});
		return size;
	}

	$.fn[ "inner" + name ] = function( size ) {
		if ( size === undefined ) {
			return orig[ "inner" + name ].call( this );
		}

		return this.each(function() {
			$( this ).css( type, reduce( this, size ) + "px" );
		});
	};

	$.fn[ "outer" + name] = function( size, margin ) {
		if ( typeof size !== "number" ) {
			return orig[ "outer" + name ].call( this, size );
		}

		return this.each(function() {
			$( this).css( type, reduce( this, size, true, margin ) + "px" );
		});
	};
});

// selectors
function visible( element ) {
	return !$( element ).parents().andSelf().filter(function() {
		return $.curCSS( this, "visibility" ) === "hidden" ||
			$.expr.filters.hidden( this );
	}).length;
}

$.extend( $.expr[ ":" ], {
	data: function( elem, i, match ) {
		return !!$.data( elem, match[ 3 ] );
	},

	focusable: function( element ) {
		var nodeName = element.nodeName.toLowerCase(),
			tabIndex = $.attr( element, "tabindex" );
		if ( "area" === nodeName ) {
			var map = element.parentNode,
				mapName = map.name,
				img;
			if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
				return false;
			}
			img = $( "img[usemap=#" + mapName + "]" )[0];
			return !!img && visible( img );
		}
		return ( /input|select|textarea|button|object/.test( nodeName )
			? !element.disabled
			: "a" == nodeName
				? element.href || !isNaN( tabIndex )
				: !isNaN( tabIndex ))
			// the element and all of its ancestors must be visible
			&& visible( element );
	},

	tabbable: function( element ) {
		var tabIndex = $.attr( element, "tabindex" );
		return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
	}
});

// support
$(function() {
	var body = document.body,
		div = body.appendChild( div = document.createElement( "div" ) );

	$.extend( div.style, {
		minHeight: "100px",
		height: "auto",
		padding: 0,
		borderWidth: 0
	});

	$.support.minHeight = div.offsetHeight === 100;
	$.support.selectstart = "onselectstart" in div;

	// set display to none to avoid a layout bug in IE
	// http://dev.jquery.com/ticket/4014
	body.removeChild( div ).style.display = "none";
});





// deprecated
$.extend( $.ui, {
	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
	plugin: {
		add: function( module, option, set ) {
			var proto = $.ui[ module ].prototype;
			for ( var i in set ) {
				proto.plugins[ i ] = proto.plugins[ i ] || [];
				proto.plugins[ i ].push( [ option, set[ i ] ] );
			}
		},
		call: function( instance, name, args ) {
			var set = instance.plugins[ name ];
			if ( !set || !instance.element[ 0 ].parentNode ) {
				return;
			}
	
			for ( var i = 0; i < set.length; i++ ) {
				if ( instance.options[ set[ i ][ 0 ] ] ) {
					set[ i ][ 1 ].apply( instance.element, args );
				}
			}
		}
	},
	
	// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
	contains: function( a, b ) {
		return document.compareDocumentPosition ?
			a.compareDocumentPosition( b ) & 16 :
			a !== b && a.contains( b );
	},
	
	// only used by resizable
	hasScroll: function( el, a ) {
	
		//If overflow is hidden, the element might have extra content, but the user wants to hide it
		if ( $( el ).css( "overflow" ) === "hidden") {
			return false;
		}
	
		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
			has = false;
	
		if ( el[ scroll ] > 0 ) {
			return true;
		}
	
		// TODO: determine which cases actually cause this to happen
		// if the element doesn't have the scroll set, see if it's possible to
		// set the scroll
		el[ scroll ] = 1;
		has = ( el[ scroll ] > 0 );
		el[ scroll ] = 0;
		return has;
	},
	
	// these are odd functions, fix the API or move into individual plugins
	isOverAxis: function( x, reference, size ) {
		//Determines when x coordinate is over "b" element axis
		return ( x > reference ) && ( x < ( reference + size ) );
	},
	isOver: function( y, x, top, left, height, width ) {
		//Determines when x, y coordinates is over "b" element
		return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
	}
});

})( jQuery );

    /*!
 * jQuery UI Mouse 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function( $, undefined ) {

$.widget("ui.mouse", {
	options: {
		cancel: ':input,option',
		distance: 1,
		delay: 0
	},
	_mouseInit: function() {
		var self = this;

		this.element
			.bind('mousedown.'+this.widgetName, function(event) {
				return self._mouseDown(event);
			})
			.bind('click.'+this.widgetName, function(event) {
				if(self._preventClickEvent) {
					self._preventClickEvent = false;
					event.stopImmediatePropagation();
					return false;
				}
			});

		this.started = false;
	},

	// TODO: make sure destroying one instance of mouse doesn't mess with
	// other instances of mouse
	_mouseDestroy: function() {
		this.element.unbind('.'+this.widgetName);
	},

	_mouseDown: function(event) {
		// don't let more than one widget handle mouseStart
		// TODO: figure out why we have to use originalEvent
		event.originalEvent = event.originalEvent || {};
		if (event.originalEvent.mouseHandled) { return; }

		// we may have missed mouseup (out of window)
		(this._mouseStarted && this._mouseUp(event));

		this._mouseDownEvent = event;

		var self = this,
			btnIsLeft = (event.which == 1),
			elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
			return true;
		}

		this.mouseDelayMet = !this.options.delay;
		if (!this.mouseDelayMet) {
			this._mouseDelayTimer = setTimeout(function() {
				self.mouseDelayMet = true;
			}, this.options.delay);
		}

		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
			this._mouseStarted = (this._mouseStart(event) !== false);
			if (!this._mouseStarted) {
				event.preventDefault();
				return true;
			}
		}

		// these delegates are required to keep context
		this._mouseMoveDelegate = function(event) {
			return self._mouseMove(event);
		};
		this._mouseUpDelegate = function(event) {
			return self._mouseUp(event);
		};
		$(document)
			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);

		event.preventDefault();
		event.originalEvent.mouseHandled = true;
		return true;
	},

	_mouseMove: function(event) {
		// IE mouseup check - mouseup happened when mouse was out of window
		if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
			return this._mouseUp(event);
		}

		if (this._mouseStarted) {
			this._mouseDrag(event);
			return event.preventDefault();
		}

		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
			this._mouseStarted =
				(this._mouseStart(this._mouseDownEvent, event) !== false);
			(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
		}

		return !this._mouseStarted;
	},

	_mouseUp: function(event) {
		$(document)
			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);

		if (this._mouseStarted) {
			this._mouseStarted = false;
			this._preventClickEvent = (event.target == this._mouseDownEvent.target);
			this._mouseStop(event);
		}

		return false;
	},

	_mouseDistanceMet: function(event) {
		return (Math.max(
				Math.abs(this._mouseDownEvent.pageX - event.pageX),
				Math.abs(this._mouseDownEvent.pageY - event.pageY)
			) >= this.options.distance
		);
	},

	_mouseDelayMet: function(event) {
		return this.mouseDelayMet;
	},

	// These are placeholder methods, to be overriden by extending plugin
	_mouseStart: function(event) {},
	_mouseDrag: function(event) {},
	_mouseStop: function(event) {},
	_mouseCapture: function(event) { return true; }
});

})(jQuery);

    /**
 * @author alexander.farkas
 * @version 1.2
 */
(function($){
    $.testMedia = function(str){
        var date = new Date().getTime(), styleS, div = $('<div class="testMediaQuery' + date + '"></div>').css({
            visibility: 'hidden',
            position: 'absolute'
        }).appendTo('body'), style = document.createElement('style');
        style.setAttribute('type', 'text/css');
    	style.setAttribute('media', str);
        style = $(style).prependTo('head');
        styleS = document.styleSheets[0];
        if (styleS.cssRules || styleS.rules) {
            if (styleS.insertRule) {
                styleS.insertRule('.testMediaQuery' + date + ' {display:none !important;}', styleS.cssRules.length);
            } else if (styleS.addRule) {
                styleS.addRule('.testMediaQuery' + date, 'display:none');
            }
        }
        var ret = div.css('display') === 'none';
        div.remove();
        style.remove();
        return ret;
    };
    $.arrayInString = function(str, arr){
        var ret = -1;
        $.each(arr, function(i, item){
			if (str.indexOf(item) != -1) {
                ret = i;
                return false;
            }
        });
        return ret;
    };
    $.enableMediaQuery = (function(){
        var styles = [], styleLinks, date = new Date().getTime();
        function parseMedia(link){
            var medias = link.getAttribute('media'), 
				pMin = /\(\s*min-width\s*:\s*(\d+)px\s*\)/, 
				pMax = /\(\s*max-width\s*:\s*(\d+)px\s*\)/, 
				resMin, 
				resMax, 
				supportedMedia = ['handheld', 'all', 'screen', 'projection', 'tty', 'tv', 'print'], 
				curMedia, 
	            mediaString = [];
	            medias = (!medias) ? ['all'] : medias.split(',');
			
            for (var i = 0, len = medias.length; i < len; i++) {
				curMedia = $.arrayInString(medias[i], supportedMedia);
				
                if (curMedia != -1) {
					
                    curMedia = supportedMedia[curMedia];
                    if (!resMin) {
                        resMin = pMin.exec(medias[i]);
                        if (resMin) {
                            resMin = parseInt(resMin[1], 10);
                        }
                    }
                    if (!resMax) {
                        resMax = pMax.exec(medias[i]);
                        if (resMax) {
                            resMax = parseInt(resMax[1], 10);
                        }
                    }
                    mediaString.push(curMedia);
                }
            }
			if (resMin || resMax) {
				styles.push({
					obj: link,
					min: resMin,
					max: resMax,
					medium: mediaString.join(','),
					used: false
				});
			}
        }
        return {
            init: function(){
                if (!styleLinks) {
					var resizeTimer;
                    styleLinks = $('link[rel*=style]').each(function(){
                        parseMedia(this);
                    });
                    $.enableMediaQuery.adjust();
                    $(window).bind('resize.mediaQueries', function(){
						clearTimeout(resizeTimer);
						resizeTimer = setTimeout( $.enableMediaQuery.adjust , 29);
					});
                }
            },
            adjust: function(){
                var width 		= $(window).width(),
					addStyles	= [],
					changeQuery,
					shouldUse,
					i, len
				;
				
                for (i = 0, len = styles.length; i < len; i++) {
					shouldUse = !styles[i].obj.disabled && ((!(styles[i].min && styles[i].min > width) && !(styles[i].max && styles[i].max < width)) || (!styles[i].max && !styles[i].min));
                    if ( shouldUse ) {
                        var n = styles[i].obj.cloneNode(true);
                        n.setAttribute('media', styles[i].medium);
                        n.className = 'insertStyleforMedia' + date;
						addStyles.push(n);
						if( !styles[i].used ){
							styles[i].used = true;
							changeQuery = true;
						}
                    } else if( styles[i].used !== shouldUse ){
						styles[i].used = false;
						changeQuery = true;
					}
                }
				
				if(changeQuery){
					$('link.insertStyleforMedia' + date).remove();
					var head = document.getElementsByTagName('head');
					for(i = 0, len = addStyles.length; i < len; i++){
						head[0].appendChild(addStyles[i]);
					}
					//repaint
					$('body').css('zoom', '1').css('zoom', '');
				}
            }
        };
    })();
	//make some odd assumption before dom-ready
	$.support.mediaQueries = !( $.browser.msie && parseFloat($.browser.version, 10) < 9) || ($.browser.mozilla && parseFloat($.browser.version, 10) < 1.9 );
    setTimeout(function(){
		if (!$.isReady && document.body && !$.support.mediaQueries) {
	        try {
				$.enableMediaQuery.init();
	        } catch (e) {}
	    } 
	}, 1);
    $(function(){
		//test media query compatibility
		$.support.mediaQueries = $.testMedia('only all');
		if (!$.support.mediaQueries) {
            $.enableMediaQuery.init();
        }
    });
})(jQuery);

    /*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.4
 * 
 * Requires: 1.2.2+
 */

(function($) {

var types = ['DOMMouseScroll', 'mousewheel'];

$.event.special.mousewheel = {
    setup: function() {
        if ( this.addEventListener ) {
            for ( var i=types.length; i; ) {
                this.addEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = handler;
        }
    },
    
    teardown: function() {
        if ( this.removeEventListener ) {
            for ( var i=types.length; i; ) {
                this.removeEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = null;
        }
    }
};

$.fn.extend({
    mousewheel: function(fn) {
        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
    },
    
    unmousewheel: function(fn) {
        return this.unbind("mousewheel", fn);
    }
});


function handler(event) {
    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
    event = $.event.fix(orgEvent);
    event.type = "mousewheel";
    
    // Old school scrollwheel delta
    if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
    if ( event.detail     ) { delta = -event.detail/3; }
    
    // New school multidimensional scroll (touchpads) deltas
    deltaY = delta;
    
    // Gecko
    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
        deltaY = 0;
        deltaX = -1*delta;
    }
    
    // Webkit
    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
    
    // Add event and delta to the front of the arguments
    args.unshift(event, delta, deltaX, deltaY);
    
    return $.event.handle.apply(this, args);
}

})(jQuery);

/**
 * @author trixta
 * @version 1.2
 */
(function($){

var mwheelI = {
			pos: [-260, -260]
		},
	minDif 	= 3,
	doc 	= document,
	root 	= doc.documentElement,
	body 	= doc.body,
	longDelay, shortDelay
;

function unsetPos(){
	if(this === mwheelI.elem){
		mwheelI.pos = [-260, -260];
		mwheelI.elem = false;
		minDif = 3;
	}
}

$.event.special.mwheelIntent = {
	setup: function(){
		var jElm = $(this).bind('mousewheel', $.event.special.mwheelIntent.handler);
		if( this !== doc && this !== root && this !== body ){
			jElm.bind('mouseleave', unsetPos);
		}
		jElm = null;
        return true;
    },
	teardown: function(){
        $(this)
			.unbind('mousewheel', $.event.special.mwheelIntent.handler)
			.unbind('mouseleave', unsetPos)
		;
        return true;
    },
    handler: function(e, d){
		var pos = [e.clientX, e.clientY];
		if( this === mwheelI.elem || Math.abs(mwheelI.pos[0] - pos[0]) > minDif || Math.abs(mwheelI.pos[1] - pos[1]) > minDif ){
            mwheelI.elem = this;
			mwheelI.pos = pos;
			minDif = 250;
			
			clearTimeout(shortDelay);
			shortDelay = setTimeout(function(){
				minDif = 10;
			}, 200);
			clearTimeout(longDelay);
			longDelay = setTimeout(function(){
				minDif = 3;
			}, 1500);
			e = $.extend({}, e, {type: 'mwheelIntent'});
            return $.event.handle.apply(this, arguments);
		}
    }
};
$.fn.extend({
	mwheelIntent: function(fn) {
		return fn ? this.bind("mwheelIntent", fn) : this.trigger("mwheelIntent");
	},
	
	unmwheelIntent: function(fn) {
		return this.unbind("mwheelIntent", fn);
	}
});

$(function(){
	body = doc.body;
	//assume that document is always scrollable, doesn't hurt if not
	$(doc).bind('mwheelIntent.mwheelIntentDefault', $.noop);
});
})(jQuery);
    /*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

	// We override the animation for all of these color styles
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}

			fx.elem.style[attr] = "rgb(" + [
				Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
			].join(",") + ")";
		}
	});

	// Color Conversion functions from highlightFade
	// By Blair Mitchelmore
	// http://jquery.offput.ca/highlightFade/

	// Parse strings looking for color tuples [255,255,255]
	function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
			return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
			return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
			return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
			return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
			return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}
	
	function getColor(elem, attr) {
		var color;

		do {
			color = jQuery.curCSS(elem, attr);

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
				break; 

			attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
	};
	
	// Some named colors to work with
	// From Interface by Stefan Petre
	// http://interface.eyecon.ro/

	var colors = {
		aqua:[0,255,255],
		azure:[240,255,255],
		beige:[245,245,220],
		black:[0,0,0],
		blue:[0,0,255],
		brown:[165,42,42],
		cyan:[0,255,255],
		darkblue:[0,0,139],
		darkcyan:[0,139,139],
		darkgrey:[169,169,169],
		darkgreen:[0,100,0],
		darkkhaki:[189,183,107],
		darkmagenta:[139,0,139],
		darkolivegreen:[85,107,47],
		darkorange:[255,140,0],
		darkorchid:[153,50,204],
		darkred:[139,0,0],
		darksalmon:[233,150,122],
		darkviolet:[148,0,211],
		fuchsia:[255,0,255],
		gold:[255,215,0],
		green:[0,128,0],
		indigo:[75,0,130],
		khaki:[240,230,140],
		lightblue:[173,216,230],
		lightcyan:[224,255,255],
		lightgreen:[144,238,144],
		lightgrey:[211,211,211],
		lightpink:[255,182,193],
		lightyellow:[255,255,224],
		lime:[0,255,0],
		magenta:[255,0,255],
		maroon:[128,0,0],
		navy:[0,0,128],
		olive:[128,128,0],
		orange:[255,165,0],
		pink:[255,192,203],
		purple:[128,0,128],
		violet:[128,0,128],
		red:[255,0,0],
		silver:[192,192,192],
		white:[255,255,255],
		yellow:[255,255,0]
	};
	
})(jQuery);

    /**
 * @author alexander.farkas
 */
(function($){
	$.widget('ui.scroller', {
		options: {
			//Wrapper Classes:
	        hidingWrapper: 'div.rack',
	        moveWrapper: 'div.rack-design',
	        //Elements Classes
	        atoms: 'div.teaser',
	        nextLink: 'a.next',
	        prevLink: 'a.prev',
	        activeLinkClass: 'show',
			stickyFirstLast: true,
			
	        linkFn: $.noop,
	        moveStep: 'atom',
	        direction: 'horizontal',
			
	        hidingWidth: false,
	        hidingHeight: false,
	        //animate
	        animate: true,
	        animateOptions: {
	            duration: 600,
	            complete: $.noop
	        },
	        enableMwheel: true,
			
	        diashow: false,
			restartDiaShow: true,
			
	        addSubPixel: 0,
			recalcStageOnresize: true,
			updateOnImgLoad: true,
			bindStyle: 'bind',
			
	        pagination: false,
	        paginationAtoms: '<li class="pa-$number"><a href="#">$number</a></li>',
	        paginationTitleFrom: false,
	        activePaginationClass: 'on',
	        paginationFn: false
		},
		_create: function(){
			
			var elem = this.element[0],
				o = this.options,
				that = this,
				fn		= o.animateOptions.complete
			;
			
	        o.animateOptions.complete = function(){
            	if(fn && $.isFunction(fn)){
					fn.call(this, that);
				}
	            that.propagate('end');
	        };
			
	        o.direction = (o.direction == 'vertical') ? {
	            scroll: 'scrollTop',
	            outerD: 'outerHeight',
	            dim: 'height',
				dir: 'Top'
	        } : {
	            scroll: 'scrollLeft',
	            outerD: 'outerWidth',
	            dim: 'width',
				dir: 'Left'
	        };
			
	        this.moveElem = $(o.moveWrapper, elem);
	        this.atomElem = $(o.atoms, elem);
	        this.hidingWrapper = $(o.hidingWrapper, elem);
	        
	        this.nextLink = $(o.nextLink, elem);
	        this.prevLink = $(o.prevLink, elem);
	        
	        this.position = 0;
	        this.atomPos = 0;
	        this.percentage = 0;
	        this.oldPosition = 0;
	        this.oldAtomPos = 0;
	        if (o.hidingHeight || o.hidingWidth) {
	            var css = (o.hidingHeight) ? {
	                height: o.hidingHeight
	            } : {};
	            if ((o.hidingWidth)) {
	                css = $.extend(css, {
	                    width: o.hidingWidth
	                });
	            }
	            this.hidingWrapper.css(css);
	        }
			
			this.selectedFocus = false;
			
			
			if($.fn.setFocus && $.fn.closest){
				var traverse = {};
				if((o.direction.dir === 'Top')){
					traverse[$.ui.keyCode.UP] = 'prev';
					traverse[$.ui.keyCode.DOWN] = 'next';
				} else {
					traverse[$.ui.keyCode.LEFT] = 'prev';
					traverse[$.ui.keyCode.RIGHT] = 'next';
				}
				this.moveElem
					.bind('keyfocus', function(e){
						var atom = $(e.target).closest(o.atoms);
						if(atom[0]){
							that.scrollIntoView(atom);
						}
					})
					.bind('focusin', function(e){
						var atom = $(e.target).closest(o.atoms);
						that.selectedFocus = (atom[0]) ? atom : false;
					})
					.bind('focusout', function(e){
						that.selectedFocus = false;
					})
					.bind('keydown', function(e){
						
						if(that.selectedFocus === false || !traverse[e.keyCode]){return;}
						var selectElement = that.selectedFocus[traverse[e.keyCode]](o.atoms);
						
						if(selectElement && selectElement[0]){
							e.preventDefault();
							selectElement.setFocus();
							that.scrollIntoView(selectElement);
						} else if(that.isSliding){
							e.preventDefault();
						}

					});
			}
			
	        this.dims = [0];
	        this.hidingWrapper[o.direction.scroll](0);
			this.minPos = 0;
	        this.update();
			
			if(o.recalcStageOnresize){
				$(window).bind('resize', function(){
					setTimeout(function(){
						that.stageWidthUpdate.call(that);
					}, 0);
				});
			}
			
			if(o.updateOnImgLoad){
				this.updateOnImgLoad();
			}
			
	        if (o.diashow) {
	            this.startDiashow();
	            this.element.bind('mouseenter focusin', function(){
	                clearInterval(that.diaTimer);
					setTimeout(function(){
						clearInterval(that.diaTimer);
					}, 9);
	            });
				if(o.restartDiaShow){
					this.element
						.bind('mouseleave focusout', function(){
			                that.startDiashow.call(that);
			            });
				}
	        }
			
	        if (o.enableMwheel && $.fn.mwheelIntent) {
				this.hidingWrapper.mwheelIntent(function(e, d){
	                that.stopDiashow.call(that);
	                d = (d < 0) ? '-' : '+';
					if((that.position >= that.maxPos && d === '-') || (d === '+' && that.position <= that.minPos)){
						return !that.isSliding;
					}
					
	                var moveStep = (o.moveStep) ? o.moveStep : 'atom';
	                that.moveTo(d + 'atom1');
	                return false;
	            });
	        }
						
			var handlePrevNext = function(){
	            var dir = ($.inArray(this, that.prevLink) !== -1) ?
					'+' :
					'-';
				that.stopDiashow.call(that);
	            that.moveTo(dir + o.moveStep);
	            return false;
	        };
			
	        this.nextLink
				.bind('click.uiscroller', handlePrevNext);
	        this.prevLink
				.bind('click.uiscroller', handlePrevNext);
			if($.browser.msie && parseInt($.browser.version, 10) < 7){
				var over = function(){$(this).addClass('over');},
					out = function(){$(this).removeClass('over');}
				;
				this.nextLink
					.hover(over, out);
		        this.prevLink
					.hover(over, out);
			}	
			if(o.defaultSelected){
				this.moveTo('goTo'+ o.defaultSelected, false);
			}		
			this.propagate('init');
		},
		stageWidthUpdate: function(){
			this.dims[1] = this.hidingWrapper[this.options.direction.dim]();
			this.maxPos = (this.dims[0] - this.dims[1]);
			this.updatePosition_Controls();
		},
        createPagination: function(hard){
            var content = '<ul>', that = this, tmpContent, o = this.options;
            this.pagination = $(o.pagination, this.element[0]);
            this.atomElem.each(function(i){
                tmpContent = o.paginationAtoms.replace(/\$number/g, i + 1);
                
                content += (o.paginationTitleFrom) ? tmpContent.replace(/\$title/g, $(o.paginationTitleFrom, this).text()) : tmpContent;
            });
            this.pagination.html(content + '</ul>').find('a').each(function(i){
                $(this).click(function(){
                    that.stopDiashow.call(that);
                    that.moveTo.call(that, 'goTo' + i);
                    return false;
                });
            });
        },
		getIndexNearPos: function(nPos){
			var len = this.dims.length;
			while (len--) {
                if (nPos >= this.dims[len]) {					
                    return len;
                }
            }
            return false;
        },
		inView: function(atom){
			var dir 		= this.options.direction,
				stageDim 	= this.dims[1],
				atomDim 	= atom[dir.outerD](),
				curPos		= this.hidingWrapper['scroll' + dir.dir](),
				atomPos 	= atom[0]['offset'+ dir.dir]
			;
			if(curPos > atomPos || stageDim < atomDim + atomPos - curPos){
				return atomPos;
			}
			return false;
		},
		scrollIntoView: function(atom){
			var inView = this.inView(atom);
			if(inView !== false){
				this.moveTo(inView);
			}
		},

        _setOption: function(k, v){
        	var o = this.options;
        	switch(k) {
	        	case 'enableMwheel' :
	        		if( !v && o.enableMwheel){
	        			this.hidingWrapper.unmwheelIntent();
	        		}
	        		break;
	        		
	        	case 'addSubPixel':
	        		if(o.addSubPixel !== v) {
	        			this.dims[0] -= o.addSubPixel;
	        			o.addSubPixel = v;
	        			this.dims[0] += o.addSubPixel;
	        			this.update();
	        		}
	        		break;
        	}
        	$.Widget.prototype._setOption.apply(this, arguments);
        },
        startDiashow: function(){
            var that = this;
            clearInterval(this.diaTimer);
            this.diaTimer = setInterval(function(){
                ((that.position === that.maxPos && that.options.type !== 'carousel') ? that.moveTo(0, false) : that.moveTo('-' + that.options.moveStep));
            }, this.options.diashow);
        },
        stopDiashow: function(){
            this.element.unbind('.diashow');
            clearInterval(this.diaTimer);
        },
		updateOnImgLoad: function(){
			var loadingSize = 0;
			var that = this;
			$('img', this.element).each(function(){
				if(!this.complete){
					loadingSize++;
					$(this).one('load', function(){
						loadingSize--;
						if(!loadingSize){
							that.update(true);
						}
					});
				}
			});
		},
        update: function(hard){
            var that = this, jElm, o = this.options;
            
			if (hard) {
                this.dims = [0];
            }
			
            this.dims[1] = this.hidingWrapper.css({
                overflow: 'hidden',
				position: 'relative'
            })[o.direction.dim]();
			
            var from = this.dims.length - 2;
			for(var i = from, len = this.atomElem.length; i < len; i++){
                jElm = $(this.atomElem[i]);
                that.dims.push(that.dims[0]);
                that.dims[0] += jElm[o.direction.outerD]({margin: true});
			}
			this.dims[0] += o.addSubPixel;
            this.maxPos = (this.dims[0] - this.dims[1]);
			
			var moveCss = {};
			moveCss[o.direction.dim] = this.dims[0] + 'px';
			
            this.moveElem.css(moveCss);
			
            if (o.pagination) {
                this.createPagination(hard);
            }
            this.updatePosition_Controls();
        },
        updatePosition_Controls: function(pos){
			//calculate the curent position
			var o = this.options;
			pos = (isNaN(pos)) ? parseInt(this.hidingWrapper[o.direction.scroll](), 10) : pos;
			
			function changeState(elem, active){
				var doo = (active) ?{
						style: 'addClass'
					} : {
						style: 'removeClass'
					};
				return elem[doo.style](o.activeLinkClass);
			}
			
            if(pos !== this.position){
				this.percentage = pos / (this.maxPos / 100);
	            this.oldPosition = this.position;
	            this.oldAtomPos = this.atomPos;
	            this.position = pos;
				
	            var num = this.getIndexNearPos(this.position);
	           
			    num = (num) ? num - 2 : 0;
	            this.atomPos = num;
			}
			
			this.percentage = pos / (this.maxPos / 100);
            
            if (pos <= this.minPos && this.prevLink.hasClass(o.activeLinkClass)) {
                o.linkFn.call(this.prevLink, 'hide', this.ui());
				changeState(this.prevLink);
            }
            else 
                if (pos > this.minPos && !this.prevLink.hasClass(o.activeLinkClass)) {
                    o.linkFn.call(this.prevLink, 'show', this.ui());
					changeState(this.prevLink, true);
                }
            if (pos >= this.maxPos && this.nextLink.hasClass(o.activeLinkClass)) {
                o.linkFn.call(this.nextLink, 'hide', this.ui());
				changeState(this.nextLink);
                
            }
            else 
                if (pos < this.maxPos && !this.nextLink.hasClass(o.activeLinkClass)) {
                    o.linkFn.call(this.nextLink, 'show', this.ui());
					changeState(this.nextLink, true);
                }
            if (this.pagination) {
                var oldActive = this.pagination.find('li').filter('.' + o.activePaginationClass).removeClass(o.activePaginationClass), newActive = oldActive.end().eq(this.atomPos).addClass(o.activePaginationClass);
                if ($.isFunction(o.paginationFn)) {
                    o.paginationFn.call(oldActive, 'inactive');
                    o.paginationFn.call(newActive, 'active');
                }
            }
        },
        getNummericPosition: function(ePos){
            var rel = false, num, lastDim = this.dims[this.dims.length - 1];
			
            // handle Atom Step & goTo
            if (ePos.indexOf('goTo') === 0) {
                num = parseInt(/(\d+)$/.exec(ePos)[0], 10) + 2;
                ePos = this.dims[num];
            }
			else if (ePos.indexOf('centerTo') === 0) {
				num = parseInt(/(\d+)$/.exec(ePos)[0], 10) + 2;
				ePos = this.dims[num] - (this.dims[1] / 2) + (this.atomElem.filter(":eq("+num+")")[this.options.direction.outerD]() / 2);
			}
            else 
                if (ePos == '-atom' || ePos == '-atom1') {
                    num = this.atomPos + 3;
                    ePos = (this.dims[num] || this.dims[num] === 0) ? this.dims[num] : lastDim;
                }
                else 
                    if (ePos == '+atom' || ePos == '+atom1') {
                        ePos = (this.atomPos) ? this.dims[this.atomPos + 1] : 0;
                    }
                    else 
                        if (ePos.indexOf('atom') == 1) {
                            num = parseInt(/(\d+)$/.exec(ePos)[0], 10);
                            if (ePos.indexOf('-') === 0) {
                                num += 2;
                                if (this.dims[this.atomPos + num]) {
                                    ePos = this.dims[this.atomPos + num];
                                }
                                else {
                                    ePos = lastDim;
                                }
                            }
                            else {
                                num -= 2;
                                var aLen = this.atomPos - num;
                                if (aLen > 1 && this.dims[this.atomPos - num]) {
                                    ePos = this.dims[this.atomPos - num];
                                }
                                else {
                                    ePos = 0;
                                }
                            }
                        // handle: +/-Number
                        }
                        else 
                            if (ePos.indexOf('+') === 0 || ePos.indexOf('-') === 0) {
                                rel = ePos.slice(0, 1);
                                ePos = parseInt(ePos.slice(1), 10);
                                ePos = (rel == '-') ? this.position + ePos : this.position - ePos;
                            }
                            else {
                                // handle Percentage
                                var per = /(\d+)%$/.exec(ePos);
                                if (per && per[1]) {
                                    ePos = this.maxPos / 100 * parseFloat(ePos);
                                }
                            }
			if(this.options.stickyFirstLast){
				if((ePos - this.maxPos) * -1 < this.atomElem.filter(':last')[this.options.direction.outerD]()){
					ePos = this.maxPos;
				} else if(ePos < this.atomElem[this.options.direction.outerD]()){
					ePos = 0;
				}
			}
            return ePos;
        },
        moveTo: function(pos, anim, animOp){
			pos = (typeof pos === 'string' || isNaN(pos)) ? this.getNummericPosition(pos) : pos;
		    pos = (pos <= 0) ? 0 : (pos >= this.maxPos) ? this.maxPos : pos;
            if (pos === this.position) {
                return false;
            }
            var o = this.options, scroll = o.direction.scroll;
            this.updatePosition_Controls(pos);
            this.propagate('start', this.oldPosition);
            
            anim = (typeof anim == 'undefined') ? o.animate : anim;
            if (anim) {
                //dirty break recursion
                animOp = animOp ||
                {};
                animOp = $.extend({}, o.animateOptions, {
                    slide: this
                }, animOp);
                var animCss = (scroll == 'scrollTop') ? 
					{scrollerTop: pos} : 
					{scrollerLeft: pos}
				;
                this.hidingWrapper.stop().animate(animCss, animOp);
            }
            else {
                this.hidingWrapper.stop()[scroll](pos);
                this.propagate('end');
            }
        },
        ui: function(){
            return {
                instance: this,
                options: this.options,
                pos: this.position,
                percentPos: this.percentage,
                oldIndex: this.oldAtomPos,
                newIndex: this.atomPos,
                size: this.dims.length - 2
            };
        },
        propagate: function(n, pos){
			var args = (pos || pos === 0) ? $.extend({}, this.ui(), {
                'pos': pos,
                percentPos: pos / (this.maxPos / 100)
            }) : this.ui();
			if(n === 'start'){
				this.isSliding = true;
			} else if(n === 'end'){
				this.isSliding = false;
			}
            this.element.triggerHandler("uiscroller" + n, [args]);
			if(this.options[n]){
				this.options[n].call(this.element[0], {type: 'uiscroller' + n}, args);
			}
        }
	});
	$.each({scrollerLeft: 'scrollLeft', scrollerTop: 'scrollTop'}, function(name, prop){
		$.fx.step[name] = function(fx){
            if (fx.now || fx.now === 0) {
                var scroller = fx.options.slide;
                if (scroller) {
					if(!fx.scrollerInit){
						fx.scrollerInit = true;
						fx.start = scroller.hidingWrapper[prop]();
						fx.now = fx.start;
					}
					scroller.hidingWrapper[prop](fx.now);
                   	scroller.propagate('slide', fx.now);
                }
            }
        };
	});
   
})(jQuery);

    /*
 * jQuery UI Slider 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Slider
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function( $, undefined ) {

// number of pages in a slider
// (how many times can you page up/down to go through the whole range)
var numPages = 5;

$.widget( "ui.slider", $.ui.mouse, {

	widgetEventPrefix: "slide",

	options: {
		animate: false,
		distance: 0,
		max: 100,
		min: 0,
		orientation: "horizontal",
		range: false,
		step: 1,
		value: 0,
		values: null
	},

	_create: function() {
		var self = this,
			o = this.options;

		this._keySliding = false;
		this._mouseSliding = false;
		this._animateOff = true;
		this._handleIndex = null;
		this._detectOrientation();
		this._mouseInit();

		this.element
			.addClass( "ui-slider" +
				" ui-slider-" + this.orientation +
				" ui-widget" +
				" ui-widget-content" +
				" ui-corner-all" );
		
		if ( o.disabled ) {
			this.element.addClass( "ui-slider-disabled ui-disabled" );
		}

		this.range = $([]);

		if ( o.range ) {
			if ( o.range === true ) {
				this.range = $( "<div></div>" );
				if ( !o.values ) {
					o.values = [ this._valueMin(), this._valueMin() ];
				}
				if ( o.values.length && o.values.length !== 2 ) {
					o.values = [ o.values[0], o.values[0] ];
				}
			} else {
				this.range = $( "<div></div>" );
			}

			this.range
				.appendTo( this.element )
				.addClass( "ui-slider-range" );

			if ( o.range === "min" || o.range === "max" ) {
				this.range.addClass( "ui-slider-range-" + o.range );
			}

			// note: this isn't the most fittingly semantic framework class for this element,
			// but worked best visually with a variety of themes
			this.range.addClass( "ui-widget-header" );
		}

		if ( $( ".ui-slider-handle", this.element ).length === 0 ) {
			$( "<a href='#'></a>" )
				.appendTo( this.element )
				.addClass( "ui-slider-handle" );
		}

		if ( o.values && o.values.length ) {
			while ( $(".ui-slider-handle", this.element).length < o.values.length ) {
				$( "<a href='#'></a>" )
					.appendTo( this.element )
					.addClass( "ui-slider-handle" );
			}
		}

		this.handles = $( ".ui-slider-handle", this.element )
			.addClass( "ui-state-default" +
				" ui-corner-all" );

		this.handle = this.handles.eq( 0 );

		this.handles.add( this.range ).filter( "a" )
			.click(function( event ) {
				event.preventDefault();
			})
			.hover(function() {
				if ( !o.disabled ) {
					$( this ).addClass( "ui-state-hover" );
				}
			}, function() {
				$( this ).removeClass( "ui-state-hover" );
			})
			.focus(function() {
				if ( !o.disabled ) {
					$( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
					$( this ).addClass( "ui-state-focus" );
				} else {
					$( this ).blur();
				}
			})
			.blur(function() {
				$( this ).removeClass( "ui-state-focus" );
			});

		this.handles.each(function( i ) {
			$( this ).data( "index.ui-slider-handle", i );
		});

		this.handles
			.keydown(function( event ) {
				var ret = true,
					index = $( this ).data( "index.ui-slider-handle" ),
					allowed,
					curVal,
					newVal,
					step;
	
				if ( self.options.disabled ) {
					return;
				}
	
				switch ( event.keyCode ) {
					case $.ui.keyCode.HOME:
					case $.ui.keyCode.END:
					case $.ui.keyCode.PAGE_UP:
					case $.ui.keyCode.PAGE_DOWN:
					case $.ui.keyCode.UP:
					case $.ui.keyCode.RIGHT:
					case $.ui.keyCode.DOWN:
					case $.ui.keyCode.LEFT:
						ret = false;
						if ( !self._keySliding ) {
							self._keySliding = true;
							$( this ).addClass( "ui-state-active" );
							allowed = self._start( event, index );
							if ( allowed === false ) {
								return;
							}
						}
						break;
				}
	
				step = self.options.step;
				if ( self.options.values && self.options.values.length ) {
					curVal = newVal = self.values( index );
				} else {
					curVal = newVal = self.value();
				}
	
				switch ( event.keyCode ) {
					case $.ui.keyCode.HOME:
						newVal = self._valueMin();
						break;
					case $.ui.keyCode.END:
						newVal = self._valueMax();
						break;
					case $.ui.keyCode.PAGE_UP:
						newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
						break;
					case $.ui.keyCode.PAGE_DOWN:
						newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
						break;
					case $.ui.keyCode.UP:
					case $.ui.keyCode.RIGHT:
						if ( curVal === self._valueMax() ) {
							return;
						}
						newVal = self._trimAlignValue( curVal + step );
						break;
					case $.ui.keyCode.DOWN:
					case $.ui.keyCode.LEFT:
						if ( curVal === self._valueMin() ) {
							return;
						}
						newVal = self._trimAlignValue( curVal - step );
						break;
				}
	
				self._slide( event, index, newVal );
	
				return ret;
	
			})
			.keyup(function( event ) {
				var index = $( this ).data( "index.ui-slider-handle" );
	
				if ( self._keySliding ) {
					self._keySliding = false;
					self._stop( event, index );
					self._change( event, index );
					$( this ).removeClass( "ui-state-active" );
				}
	
			});

		this._refreshValue();

		this._animateOff = false;
	},

	destroy: function() {
		this.handles.remove();
		this.range.remove();

		this.element
			.removeClass( "ui-slider" +
				" ui-slider-horizontal" +
				" ui-slider-vertical" +
				" ui-slider-disabled" +
				" ui-widget" +
				" ui-widget-content" +
				" ui-corner-all" )
			.removeData( "slider" )
			.unbind( ".slider" );

		this._mouseDestroy();

		return this;
	},

	_mouseCapture: function( event ) {
		var o = this.options,
			position,
			normValue,
			distance,
			closestHandle,
			self,
			index,
			allowed,
			offset,
			mouseOverHandle;

		if ( o.disabled ) {
			return false;
		}

		this.elementSize = {
			width: this.element.outerWidth(),
			height: this.element.outerHeight()
		};
		this.elementOffset = this.element.offset();

		position = { x: event.pageX, y: event.pageY };
		normValue = this._normValueFromMouse( position );
		distance = this._valueMax() - this._valueMin() + 1;
		self = this;
		this.handles.each(function( i ) {
			var thisDistance = Math.abs( normValue - self.values(i) );
			if ( distance > thisDistance ) {
				distance = thisDistance;
				closestHandle = $( this );
				index = i;
			}
		});

		// workaround for bug #3736 (if both handles of a range are at 0,
		// the first is always used as the one with least distance,
		// and moving it is obviously prevented by preventing negative ranges)
		if( o.range === true && this.values(1) === o.min ) {
			index += 1;
			closestHandle = $( this.handles[index] );
		}

		allowed = this._start( event, index );
		if ( allowed === false ) {
			return false;
		}
		this._mouseSliding = true;

		self._handleIndex = index;

		closestHandle
			.addClass( "ui-state-active" )
			.focus();
		
		offset = closestHandle.offset();
		mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
		this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
			left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
			top: event.pageY - offset.top -
				( closestHandle.height() / 2 ) -
				( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
				( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
				( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
		};

		this._slide( event, index, normValue );
		this._animateOff = true;
		return true;
	},

	_mouseStart: function( event ) {
		return true;
	},

	_mouseDrag: function( event ) {
		var position = { x: event.pageX, y: event.pageY },
			normValue = this._normValueFromMouse( position );
		
		this._slide( event, this._handleIndex, normValue );

		return false;
	},

	_mouseStop: function( event ) {
		this.handles.removeClass( "ui-state-active" );
		this._mouseSliding = false;

		this._stop( event, this._handleIndex );
		this._change( event, this._handleIndex );

		this._handleIndex = null;
		this._clickOffset = null;
		this._animateOff = false;

		return false;
	},
	
	_detectOrientation: function() {
		this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
	},

	_normValueFromMouse: function( position ) {
		var pixelTotal,
			pixelMouse,
			percentMouse,
			valueTotal,
			valueMouse;

		if ( this.orientation === "horizontal" ) {
			pixelTotal = this.elementSize.width;
			pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
		} else {
			pixelTotal = this.elementSize.height;
			pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
		}

		percentMouse = ( pixelMouse / pixelTotal );
		if ( percentMouse > 1 ) {
			percentMouse = 1;
		}
		if ( percentMouse < 0 ) {
			percentMouse = 0;
		}
		if ( this.orientation === "vertical" ) {
			percentMouse = 1 - percentMouse;
		}

		valueTotal = this._valueMax() - this._valueMin();
		valueMouse = this._valueMin() + percentMouse * valueTotal;

		return this._trimAlignValue( valueMouse );
	},

	_start: function( event, index ) {
		var uiHash = {
			handle: this.handles[ index ],
			value: this.value()
		};
		if ( this.options.values && this.options.values.length ) {
			uiHash.value = this.values( index );
			uiHash.values = this.values();
		}
		return this._trigger( "start", event, uiHash );
	},

	_slide: function( event, index, newVal ) {
		var otherVal,
			newValues,
			allowed;

		if ( this.options.values && this.options.values.length ) {
			otherVal = this.values( index ? 0 : 1 );

			if ( ( this.options.values.length === 2 && this.options.range === true ) && 
					( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
				) {
				newVal = otherVal;
			}

			if ( newVal !== this.values( index ) ) {
				newValues = this.values();
				newValues[ index ] = newVal;
				// A slide can be canceled by returning false from the slide callback
				allowed = this._trigger( "slide", event, {
					handle: this.handles[ index ],
					value: newVal,
					values: newValues
				} );
				otherVal = this.values( index ? 0 : 1 );
				if ( allowed !== false ) {
					this.values( index, newVal, true );
				}
			}
		} else {
			if ( newVal !== this.value() ) {
				// A slide can be canceled by returning false from the slide callback
				allowed = this._trigger( "slide", event, {
					handle: this.handles[ index ],
					value: newVal
				} );
				if ( allowed !== false ) {
					this.value( newVal );
				}
			}
		}
	},

	_stop: function( event, index ) {
		var uiHash = {
			handle: this.handles[ index ],
			value: this.value()
		};
		if ( this.options.values && this.options.values.length ) {
			uiHash.value = this.values( index );
			uiHash.values = this.values();
		}

		this._trigger( "stop", event, uiHash );
	},

	_change: function( event, index ) {
		if ( !this._keySliding && !this._mouseSliding ) {
			var uiHash = {
				handle: this.handles[ index ],
				value: this.value()
			};
			if ( this.options.values && this.options.values.length ) {
				uiHash.value = this.values( index );
				uiHash.values = this.values();
			}

			this._trigger( "change", event, uiHash );
		}
	},

	value: function( newValue ) {
		if ( arguments.length ) {
			this.options.value = this._trimAlignValue( newValue );
			this._refreshValue();
			this._change( null, 0 );
		}

		return this._value();
	},

	values: function( index, newValue ) {
		var vals,
			newValues,
			i;

		if ( arguments.length > 1 ) {
			this.options.values[ index ] = this._trimAlignValue( newValue );
			this._refreshValue();
			this._change( null, index );
		}

		if ( arguments.length ) {
			if ( $.isArray( arguments[ 0 ] ) ) {
				vals = this.options.values;
				newValues = arguments[ 0 ];
				for ( i = 0; i < vals.length; i += 1 ) {
					vals[ i ] = this._trimAlignValue( newValues[ i ] );
					this._change( null, i );
				}
				this._refreshValue();
			} else {
				if ( this.options.values && this.options.values.length ) {
					return this._values( index );
				} else {
					return this.value();
				}
			}
		} else {
			return this._values();
		}
	},

	_setOption: function( key, value ) {
		var i,
			valsLength = 0;

		if ( $.isArray( this.options.values ) ) {
			valsLength = this.options.values.length;
		}

		$.Widget.prototype._setOption.apply( this, arguments );

		switch ( key ) {
			case "disabled":
				if ( value ) {
					this.handles.filter( ".ui-state-focus" ).blur();
					this.handles.removeClass( "ui-state-hover" );
					this.handles.attr( "disabled", "disabled" );
					this.element.addClass( "ui-disabled" );
				} else {
					this.handles.removeAttr( "disabled" );
					this.element.removeClass( "ui-disabled" );
				}
				break;
			case "orientation":
				this._detectOrientation();
				this.element
					.removeClass( "ui-slider-horizontal ui-slider-vertical" )
					.addClass( "ui-slider-" + this.orientation );
				this._refreshValue();
				break;
			case "value":
				this._animateOff = true;
				this._refreshValue();
				this._change( null, 0 );
				this._animateOff = false;
				break;
			case "values":
				this._animateOff = true;
				this._refreshValue();
				for ( i = 0; i < valsLength; i += 1 ) {
					this._change( null, i );
				}
				this._animateOff = false;
				break;
		}
	},

	//internal value getter
	// _value() returns value trimmed by min and max, aligned by step
	_value: function() {
		var val = this.options.value;
		val = this._trimAlignValue( val );

		return val;
	},

	//internal values getter
	// _values() returns array of values trimmed by min and max, aligned by step
	// _values( index ) returns single value trimmed by min and max, aligned by step
	_values: function( index ) {
		var val,
			vals,
			i;

		if ( arguments.length ) {
			val = this.options.values[ index ];
			val = this._trimAlignValue( val );

			return val;
		} else {
			// .slice() creates a copy of the array
			// this copy gets trimmed by min and max and then returned
			vals = this.options.values.slice();
			for ( i = 0; i < vals.length; i+= 1) {
				vals[ i ] = this._trimAlignValue( vals[ i ] );
			}

			return vals;
		}
	},
	
	// returns the step-aligned value that val is closest to, between (inclusive) min and max
	_trimAlignValue: function( val ) {
		if ( val < this._valueMin() ) {
			return this._valueMin();
		}
		if ( val > this._valueMax() ) {
			return this._valueMax();
		}
		var step = ( this.options.step > 0 ) ? this.options.step : 1,
			valModStep = val % step,
			alignValue = val - valModStep;

		if ( Math.abs(valModStep) * 2 >= step ) {
			alignValue += ( valModStep > 0 ) ? step : ( -step );
		}

		// Since JavaScript has problems with large floats, round
		// the final value to 5 digits after the decimal point (see #4124)
		return parseFloat( alignValue.toFixed(5) );
	},

	_valueMin: function() {
		return this.options.min;
	},

	_valueMax: function() {
		return this.options.max;
	},
	
	_refreshValue: function() {
		var oRange = this.options.range,
			o = this.options,
			self = this,
			animate = ( !this._animateOff ) ? o.animate : false,
			valPercent,
			_set = {},
			lastValPercent,
			value,
			valueMin,
			valueMax;

		if ( this.options.values && this.options.values.length ) {
			this.handles.each(function( i, j ) {
				valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
				_set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
				$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
				if ( self.options.range === true ) {
					if ( self.orientation === "horizontal" ) {
						if ( i === 0 ) {
							self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
						}
						if ( i === 1 ) {
							self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
						}
					} else {
						if ( i === 0 ) {
							self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
						}
						if ( i === 1 ) {
							self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
						}
					}
				}
				lastValPercent = valPercent;
			});
		} else {
			value = this.value();
			valueMin = this._valueMin();
			valueMax = this._valueMax();
			valPercent = ( valueMax !== valueMin ) ?
					( value - valueMin ) / ( valueMax - valueMin ) * 100 :
					0;
			_set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
			this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );

			if ( oRange === "min" && this.orientation === "horizontal" ) {
				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
			}
			if ( oRange === "max" && this.orientation === "horizontal" ) {
				this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
			}
			if ( oRange === "min" && this.orientation === "vertical" ) {
				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
			}
			if ( oRange === "max" && this.orientation === "vertical" ) {
				this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
			}
		}
	}

});

$.extend( $.ui.slider, {
	version: "1.8.6"
});

}(jQuery));

    /**
 * @author trixta
 */
(function($){
	
	function numsort (a, b) {
	  return a - b;
	}
	var uniqueID = 0;
	$.widget('ui.tabtree', {
		options: {
			buttonSel: 'a',
			panelSel: false,
			focusOnExpand: true,
			focusSel: true,
			createPanelwrapper: false, 
			toggleButton: false,
			multiSelectable: false,
			createPanelTabRelation: false,
			selectEvents: 'ariaclick',
			bindStyle: 'bind',
			bindContext: false,
			defaultSelected: 0,
			slideShow: false,
			restartSlideShow: true,
			activeButtonClass: 'js-selected',
			activePanelClass: 'js-expanded',
			handleDisplay: true, //initial | true | false
			interceptClick: true,
			addAria: true
		},
		_createPanelAPI: function(button, panel){
			var that = this;
			$.data(panel[0], 'tabtreepanel', {
				instance: this,
				button: button,
				expand: function(e){
					that.expand(button, e);
				},
				collapse: function(e){
					that.collapse(button, e);
				}
			});
			$.data(button[0], 'tabtreebutton', {
				instance: this,
				panel: panel,
				expand: function(e){
					that.expand(button, e);
				},
				collapse: function(e){
					that.collapse(button, e);
				}
			});
		},
		_create: function(){
			var that 			= this,
				o 				=  this.options,
				elem 			= this.element,
				isSelectedArray = o.defaultSelected.length,
				isHTMLSelected
			;
			
			this.selectedIndexes = [];			
			this.slideShowtimer = null;
			
			this.buttons = $(o.buttonSel, elem[0]);
			
			this.panels = (o.panelSel) ? 
				$(o.panelSel, this.element[0]).each(function(i){
					var button 	= $(that.buttons[i]),
						panel 	= $(this)
					;
					button.controlsThis(panel);
					if(o.createPanelTabRelation){
						panel.labelWith(button);
					}
					that._createPanelAPI(button, panel);
					
				}) : 
				this.buttons.map(function(){
					var button 	= $(this),
						idRef 	= button.getHrefHash(),
						panel 	= $(idRef)
					;
					
					if(o.createPanelTabRelation){
						panel.labelWith(button);
					}
					
					button.attr({'aria-controls': idRef.replace('#', '')});
					that._createPanelAPI(button, panel);
					return panel[0];
				});
							
			this.panels = $($.unique(this.panels.get()));
						
			if(o.createPanelwrapper){
				this.panels.wrap('<div class="a11y-panelwrapper" />');
			}
			
			//get defaultselected
			isHTMLSelected = !!this.buttons.filter('.'+ o.activeButtonClass)[0];
				
			this.buttons
				.each(function(i){
					var initAction;
					if(isHTMLSelected){
						initAction = ($(this).hasClass(o.activeButtonClass)) ? 'expand' : 'collapse';
					} else if(isSelectedArray){
						initAction = ($.inArray(i, o.defaultSelected) !== -1) ? 'expand' : 'collapse';
					} else {
						initAction = (o.defaultSelected === i) ? 'expand' : 'collapse';
					}
					that[initAction].call(that, this, {type: 'init'});
				})
			;
			
			if(o.addAria){
				this.buttons.attr({role: 'button'});
				if (this.buttons[0] && $.nodeName(this.buttons[0], 'a')) {
					this.buttons.each(function(){
						var jElm = $(this);
						this.setAttribute('data-href', jElm.attr('href'));
						if($.support.waiAria){
							jElm.removeAttr('href');
						}
					});
				}
			}
			
			this.panels.attr({role: 'group'}).addClass('a11y-js-overflow');
			
			uniqueID++;
			if(o.bindStyle === 'live'){
				this.buttons.context = (o.bindContext) ? $(o.bindContext, this.element)[0] : this.element[0];
				this.buttons.selector = '.tabtree-button_'+ uniqueID;
				this.buttons.addClass('tabtree-button_'+ uniqueID);
				if(!this.buttons.context) {
					console.log(o.bindContext +' not found in tab-module');
				}
			}
			
			if(o.selectEvents){
				this.buttons
					[o.bindStyle](o.selectEvents, function(e){
						var action = (o.toggleButton) ?
							'toggle' :
							'expand'
						;
						clearInterval(that.slideShowtimer);
						that[action].call(that, this, e);
						return false;
					})
				;
			}
			
			//focus panels onclick if no click event is added
			if(o.interceptClick && (!o.selectEvents || o.selectEvents.indexOf('click') == -1)){
				this.buttons[o.bindStyle]('click', function(){
					clearInterval(that.slideShowtimer);
					if(o.focusOnExpand){
						that.focusPanel.call(that, $('#'+$(this).attr('aria-controls')), 1);
					}
					return false;
				});
			}
			
			if(o.slideShow && isFinite(o.slideShow)){
				this.slideShowtimer = setInterval(function(){
					that.showPrevNext.call(that, 1);
				}, o.slideShow);
				
				this.element.inOut(
					function(){
						clearInterval(that.slideShowtimer);
					}, function(){
					if(o.restartSlideShow){
						clearInterval(that.slideShowtimer);
						that.slideShowtimer = setInterval(function(){
							that.showPrevNext.call(that, 1);
						}, o.slideShow);
					}
				});
			}
			
			this._trigger('init', {type: 'init'}, this.ui());
		},
		getPrevNext: function(dir){
			var index = this.buttons
				.index(this.buttons.filter('.'+ this.options.activeButtonClass)[0]) + dir
			;
			if(index < 0){
				index = this.buttons.length - 1;
			} else if(index >= this.buttons.length){
				index = 0;
			}
			return {button: this.buttons.get(index), panel: this.panels.get(index)};
		},
		showPrevNext: function(dir){
			var data = this.getPrevNext(dir);
			this.expand(data.button, {type: 'show-'+ dir});
		},
		toggle: function(button, e){
			var action = ($(button).hasClass(this.options.activeButtonClass)) ?
				'collapse' : 'expand';
			this[action](button, e);
		},
		collapse: function(button, e, _panel, _opener){
			e = e || {type: 'collapse'};
			button = $(button);
			
			//if button/panel is already inactive
			if(!button.hasClass(this.options.activeButtonClass) && e.type != 'init'){
				return false;
			}
			
			var panel 		= _panel || this.getPanel(button),
				buttons 	= this.getButtons(panel),
				type 		= (e.type == 'init') ? 
								'collapseinit' :
								'collapse',
				that 		= this,
				o 			= this.options,
				uiObj 		= {
								button: buttons,
								panel: panel
							}
			;
			
			if(!o.multiSelectable){
				uiObj.expandElements = _opener || 
					{
						panel: $([]),
						button: $([])
					}
				;
			}
			
			this.removeIndex(panel);
			if(this._trigger(type, e, $.extend({}, this.ui(), uiObj)) === false){
				this.addIndex(panel);
				return undefined;
			}
			
			this.setState(buttons, uiObj.panel, 'inactive');
			
			if(o.handleDisplay === true || (e.type == 'init' && o.handleDisplay)){
				if(o.hideStyle === 'visibility'){
					uiObj.panel
						.parent()
						.css({overflow: 'hidden', height: 0})
						.end()
						.css({visibility: 'hidden'})
					;
				} else {
					uiObj.panel.hide();
				}
			}
			
			uiObj.button = button;
			
			$.ui.SR.update();
			
			return uiObj;
		},
		addIndex: function(index){
			if(!isFinite(index) && index.jquery){
				index = this.panels.index(index[0]);
			}
			if($.inArray(index, this.selectedIndexes) === -1){
				this.selectedIndexes.push(index);
				this.selectedIndexes.sort(numsort);
			}
		},
		removeIndex: function(index){
			if(!isFinite(index) && index.jquery){
				index = this.panels.index(index[0]);
			}
			this.selectedIndexes = $.grep(this.selectedIndexes, function(num, i){
				return (index !== num);
			});
		},
		expand: function(button, e){
			e = e ||
				{type: 'expand'};
			button = $(button);
			
			//if button/panel is already active
			if(e.type != 'init' && button.hasClass(this.options.activeButtonClass)){
				return false;
			}
			
			var type 			= (e.type == 'init') ? 
								'expandinit' :
								'expand',
				that 			= this,
				o 				= this.options,
				uiObj 			= {},
				panel 			= this.getPanel(button),
				buttons			= this.getButtons(panel),
				collapseButton 	= this.buttons.filter('.'+ o.activeButtonClass),
				posStyle,
				panelWrapper
			;
			
			uiObj.button = buttons;
			uiObj.panel = panel;
			
			if(!o.multiSelectable){
				uiObj.collapseElements = {
							button: collapseButton, 
							panel: this.getPanel(collapseButton)
						};
				
			}
			
			this.addIndex(panel);
			//collapse all other panels, if not multiSelectable
			if(e.type != 'init' && !o.multiSelectable){
				collapseButton.each(function(){
					that.collapse.call(that, this, e, false, {button: buttons, panel: panel});
				});
			}
			this.setState(buttons, panel, 'active');
			
			
						
			if(o.handleDisplay === true || (e.type == 'init' && o.handleDisplay == 'initial')){
				if(o.hideStyle === 'visibility'){
					panel
						.parent()
						.css({overflow: '', height: ''})
						.end()
						.css({visibility: ''})
					;
				} else {
					panel.show();
				}
				
			}
			
			$.ui.SR.update();
			
			if(o.addToHistory && e.type !== 'init' && e.type !== 'hashHistoryChange'){
				$.hashHistory.add('tab-'+ panel.getID());
			}
			
			this._trigger(type, e, $.extend({}, this.ui(), uiObj));
			
			if(/click|hashHistoryChange/.test(e.type) && o.focusOnExpand){
				that.focusPanel(panel);
			}
			return undefined;
		},
		collapseAll: function(e){
			var that = this;
			$.each(this.selectedIndexes, function(i, index){
				that.collapse.call(that, that.buttons[index], e);
			});
		},
		getButtons: function(panel){
			return this.buttons.filter('[aria-controls='+ panel.getID() +']');
		},
		getPanel: function(button){
			return this.panels.filter('#'+ button.attr('aria-controls') );
		},
		setState: function(button, panel, state){
			var o	 	= this.options,
				set 	= (state == 'active') ? 
							{
								c: 'addClass',
								
								index: '-1',
								aria: 'true'
							} :
							{
								c: 'removeClass',
								index: '0',
								aria: 'false'
							}
			;
			if((!o.toggleButton)){
				button.attr({'tabindex': set.index, 'aria-disabled': set.aria})[set.c]('ui-disabled');
			} else {
				button.attr({'tabindex': '0'});
			}
			button[set.c](o.activeButtonClass).attr('aria-expanded', set.aria);
			panel[set.c](o.activePanelClass).attr('aria-expanded', set.aria);
		},
		focusPanel: function(panel){
			var o 			= this.options,
				focusElem 	= (o.focusSel === true || !o.focusSel) ? panel.firstExpOf('focusPoint') : $(o.focusSel, panel)
			;
			focusElem.setFocus({context: (panel[0].parentNode || {}).parentNode});
			return undefined;
		},
		ui: function(){
			return {
				instance: this,
				panels: this.panels,
				buttons: this.buttons,
				selectedIndexes: this.selectedIndexes
			};
		}
	});
	
})(jQuery);
    /**
 * @author alexander.farkas
 */
(function($){
	var uID = new Date().getTime();
	$.fn.embedSWF = function(o){
		
		var ret = [],
			reservedParams = ['width', 'height', 'expressInstall', 'version'];
		o = $.extend(true, {}, $.fn.embedSWF.defaults, o);
		
		function getId(jElem){
			var id = jElem.attr('id');
			if(!id){
				id = 'id-' + String(uID++);
				jElem.attr({id: id});
			}
			return id;
		}
		
		function strToObj(str){
			var obj  = {};
			if(str){
				str = str.replace(/^\?/,'').replace(/&amp;/g, '&').split(/&/);
				$.each(str, function(i, param){
					queryPair = param.split(/\=/);
					obj[decodeURIComponent(queryPair[0])] = (queryPair[1]) ?
						decodeURIComponent(queryPair[1]) :
						'';
				});
			}
			return obj;
		}
		
		this.each(function(){
			
			var jElem = $(this),
				classes = this.className,
				linkSrc = $('a', this).filter('[href*=.swf], [href*=.flv]'),
				id =  getId(jElem),
				src = linkSrc.attr('href').split('?'),
				params = strToObj(src[1]),
				width = params.width ||
					jElem.width(),
				height = params.height ||
					jElem.height(),
				version = params.version || 
					o.version,
				expressInstall,
				flash;
			
			if(params.expressInstall == 'false'){
				expressInstall = false;
			} else if(!params.expressInstall){
				expressInstall = o.expressInstall;
			} else {
				expressInstall = params.expressInstall;
			}
			$.each(reservedParams, function(i, reservedParam){
				delete params[reservedParam];
			});
			
			$.extend({}, o.parameters, params);
			swfobject.embedSWF(src[0], id, width, height, version, expressInstall, false, params);
			flash = document.getElementById(id);
			flash.className = classes;
			
			ret.push(flash);
			
		});
		return this.pushStack(ret);
	};
	
	$.fn.embedSWF.defaults = {
		expressInstall: false,
		version: "9.0.124",
		parameters: {}
	};
})(jQuery);
    /*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
    // Bookmarks
(function($){
    $.socialbookmark={
		findRelElm: function(elm){
			var jelm = $(elm),
			ref = jelm.attr('href'),
			find = ref.indexOf('#');
			ref = ref.substr(find);
			return ref;
		},
		handler: function(){
			if($.socialbookmark.actElm && !$($.socialbookmark.actElm).is(':hidden')){
				$.socialbookmark.hide();
			} else {
				$.socialbookmark.show.call(this);
			}
			return false;
		},
		hideNotinActElm: function(e){
			var jElm = $(e.target);
			if(jElm.is($.socialbookmark.actElm) || jElm.parents($.socialbookmark.actElm).size()){
				return;
			}
			$.socialbookmark.hide();
		},
		show:function(){
			var ref = $.socialbookmark.findRelElm(this);
			$(ref).animate({height: 'show',opacity: 'show'}, {duration: 400});
			$.socialbookmark.actElm = ref;
			$(document).bind('click', $.socialbookmark.hideNotinActElm);
			return false;
		},
		actElm: null,
		hide: function(){
			$($.socialbookmark.actElm).animate({height: "hide", opacity: "hide"});
			$('body').unbind('click', $.socialbookmark.hideNotinActElm);
		},
		init: function(sel){
			var jElm = $(sel);
			if(jElm.size()){
				var ref = $.socialbookmark.findRelElm(jElm[0]);
				$(ref).css({display: 'none'});
				jElm.click($.socialbookmark.handler);
			}
		}
	};
})(jQuery);
    /** 
 * flowplayer.js 3.0.3. The Flowplayer API
 * 
 * Copyright 2008 Flowplayer Oy
 * 
 * This file is part of Flowplayer.
 * 
 * Flowplayer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Flowplayer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Flowplayer.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Version: 3.0.3 - Wed Jan 07 2009 13:22:30 GMT-0000 (GMT+00:00)
 */
(function(){function log(args){console.log("$f.fireEvent",[].slice.call(args));}function clone(obj){if(!obj||typeof obj!='object'){return obj;}var temp=new obj.constructor();for(var key in obj){if(obj.hasOwnProperty(key)){temp[key]=clone(obj[key]);}}return temp;}function each(obj,fn){if(!obj){return;}var name,i=0,length=obj.length;if(length===undefined){for(name in obj){if(fn.call(obj[name],name,obj[name])===false){break;}}}else{for(var value=obj[0];i<length&&fn.call(value,i,value)!==false;value=obj[++i]){}}return obj;}function el(id){return document.getElementById(id);}function extend(to,from,skipFuncs){if(to&&from){each(from,function(name,value){if(!skipFuncs||typeof value!='function'){to[name]=value;}});}}function select(query){var index=query.indexOf(".");if(index!=-1){var tag=query.substring(0,index)||"*";var klass=query.substring(index+1,query.length);var els=[];each(document.getElementsByTagName(tag),function(){if(this.className&&this.className.indexOf(klass)!=-1){els.push(this);}});return els;}}function stopEvent(e){e=e||window.event;if(e.preventDefault){e.stopPropagation();e.preventDefault();}else{e.returnValue=false;e.cancelBubble=true;}return false;}function bind(to,evt,fn){to[evt]=to[evt]||[];to[evt].push(fn);}function makeId(){return"_"+(""+Math.random()).substring(2,10);}var Clip=function(json,index,player){var self=this;var cuepoints={};var listeners={};self.index=index;if(typeof json=='string'){json={url:json};}extend(this,json,true);each(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var evt="on"+this;if(evt.indexOf("*")!=-1){evt=evt.substring(0,evt.length-1);var before="onBefore"+evt.substring(2);self[before]=function(fn){bind(listeners,before,fn);return self;};}self[evt]=function(fn){bind(listeners,evt,fn);return self;};if(index==-1){if(self[before]){player[before]=self[before];}if(self[evt]){player[evt]=self[evt];}}});extend(this,{onCuepoint:function(points,fn){if(arguments.length==1){cuepoints.embedded=[null,points];return self;}if(typeof points=='number'){points=[points];}var fnId=makeId();cuepoints[fnId]=[points,fn];if(player.isLoaded()){player._api().fp_addCuepoints(points,index,fnId);}return self;},update:function(json){extend(self,json);if(player.isLoaded()){player._api().fp_updateClip(json,index);}var conf=player.getConfig();var clip=(index==-1)?conf.clip:conf.playlist[index];extend(clip,json,true);},_fireEvent:function(evt,arg1,arg2,target){if(evt=='onLoad'){each(cuepoints,function(key,val){if(val[0]){player._api().fp_addCuepoints(val[0],index,key);}});return false;}if(index!=-1){target=self;}if(evt=='onCuepoint'){var fn=cuepoints[arg1];if(fn){return fn[1].call(player,target,arg2);}}if(evt=='onStart'||evt=='onUpdate'){extend(target,arg1);if(!target.duration){target.duration=arg1.metaData.duration;}else{target.fullDuration=arg1.metaData.duration;}}var ret=true;each(listeners[evt],function(){ret=this.call(player,target,arg1,arg2);});return ret;}});if(json.onCuepoint){var arg=json.onCuepoint;self.onCuepoint.apply(self,typeof arg=='function'?[arg]:arg);delete json.onCuepoint;}each(json,function(key,val){if(typeof val=='function'){bind(listeners,key,val);delete json[key];}});if(index==-1){player.onCuepoint=this.onCuepoint;}};var Plugin=function(name,json,player,fn){var listeners={};var self=this;var hasMethods=false;if(fn){extend(listeners,fn);}each(json,function(key,val){if(typeof val=='function'){listeners[key]=val;delete json[key];}});extend(this,{animate:function(props,speed,fn){if(!props){return self;}if(typeof speed=='function'){fn=speed;speed=500;}if(typeof props=='string'){var key=props;props={};props[key]=speed;speed=500;}if(fn){var fnId=makeId();listeners[fnId]=fn;}if(speed===undefined){speed=500;}json=player._api().fp_animate(name,props,speed,fnId);return self;},css:function(props,val){if(val!==undefined){var css={};css[props]=val;props=css;}json=player._api().fp_css(name,props);extend(self,json);return self;},show:function(){this.display='block';player._api().fp_showPlugin(name);return self;},hide:function(){this.display='none';player._api().fp_hidePlugin(name);return self;},toggle:function(){this.display=player._api().fp_togglePlugin(name);return self;},fadeTo:function(o,speed,fn){if(typeof speed=='function'){fn=speed;speed=500;}if(fn){var fnId=makeId();listeners[fnId]=fn;}this.display=player._api().fp_fadeTo(name,o,speed,fnId);this.opacity=o;return self;},fadeIn:function(speed,fn){return self.fadeTo(1,speed,fn);},fadeOut:function(speed,fn){return self.fadeTo(0,speed,fn);},getName:function(){return name;},_fireEvent:function(evt,arg){if(evt=='onUpdate'){var json=player._api().fp_getPlugin(name);if(!json){return;}extend(self,json);delete self.methods;if(!hasMethods){each(json.methods,function(){var method=""+this;self[method]=function(){var a=[].slice.call(arguments);var ret=player._api().fp_invoke(name,method,a);return ret=='undefined'?self:ret;};});hasMethods=true;}}var fn=listeners[evt];if(fn){fn.call(self,arg);if(evt.substring(0,1)=="_"){delete listeners[evt];}}}});};function Player(wrapper,params,conf){var
self=this,api=null,html,commonClip,playlist=[],plugins={},listeners={},playerId,apiId,playerIndex,activeIndex,swfHeight,wrapperHeight;extend(self,{id:function(){return playerId;},isLoaded:function(){return(api!==null);},getParent:function(){return wrapper;},hide:function(all){if(all){wrapper.style.height="0px";}if(api){api.style.height="0px";}return self;},show:function(){wrapper.style.height=wrapperHeight+"px";if(api){api.style.height=swfHeight+"px";}return self;},isHidden:function(){return api&&parseInt(api.style.height,10)===0;},load:function(fn){if(!api&&self._fireEvent("onBeforeLoad")!==false){each(players,function(){this.unload();});html=wrapper.innerHTML;flashembed(wrapper,params,{config:conf});if(fn){fn.cached=true;bind(listeners,"onLoad",fn);}}return self;},unload:function(){try{if(api&&api.fp_isFullscreen()){}}catch(error){return;}if(api&&html.replace(/\s/g,'')!==''&&!api.fp_isFullscreen()&&self._fireEvent("onBeforeUnload")!==false){api.fp_close();wrapper.innerHTML=html;self._fireEvent("onUnload");api=null;}return self;},getClip:function(index){if(index===undefined){index=activeIndex;}return playlist[index];},getCommonClip:function(){return commonClip;},getPlaylist:function(){return playlist;},getPlugin:function(name){var plugin=plugins[name];if(!plugin&&self.isLoaded()){var json=self._api().fp_getPlugin(name);if(json){plugin=new Plugin(name,json,self);plugins[name]=plugin;}}return plugin;},getScreen:function(){return self.getPlugin("screen");},getControls:function(){return self.getPlugin("controls");},getConfig:function(copy){return copy?clone(conf):conf;},getFlashParams:function(){return params;},loadPlugin:function(name,url,props,fn){if(typeof props=='function'){fn=props;props={};}var fnId=fn?makeId():"_";self._api().fp_loadPlugin(name,url,props,fnId);var arg={};arg[fnId]=fn;var p=new Plugin(name,null,self,arg);plugins[name]=p;return p;},getState:function(){return api?api.fp_getState():-1;},play:function(clip){function play(){if(clip!==undefined){self._api().fp_play(clip);}else{self._api().fp_play();}}if(api){play();}else{self.load(function(){play();});}return self;},getVersion:function(){var js="flowplayer.js 3.0.3";if(api){var ver=api.fp_getVersion();ver.push(js);return ver;}return js;},_api:function(){if(!api){throw"Flowplayer "+self.id()+" not loaded. Try moving your call to player's onLoad event";}return api;},_dump:function(){console.log(listeners);},setClip:function(clip){self.setPlaylist([clip]);},getIndex:function(){return playerIndex;}});each(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,Fullscreen*,FullscreenExit,Error").split(","),function(){var name="on"+this;if(name.indexOf("*")!=-1){name=name.substring(0,name.length-1);var name2="onBefore"+name.substring(2);self[name2]=function(fn){bind(listeners,name2,fn);return self;};}self[name]=function(fn){bind(listeners,name,fn);return self;};});each(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,reset,close,setPlaylist").split(","),function(){var name=this;self[name]=function(arg){if(!api){return self;}var ret=(arg===undefined)?api["fp_"+name]():api["fp_"+name](arg);return ret=='undefined'?self:ret;};});self._fireEvent=function(evt,arg0,arg1,arg2){if(conf.debug){log(arguments);}if(!api&&evt=='onLoad'&&arg0=='player'){api=api||el(apiId);swfHeight=api.clientHeight;each(playlist,function(){this._fireEvent("onLoad");});each(plugins,function(name,p){p._fireEvent("onUpdate");});commonClip._fireEvent("onLoad");}if(evt=='onLoad'&&arg0!='player'){return;}if(evt=='onError'){if(typeof arg0=='string'||(typeof arg0=='number'&&typeof arg1=='number')){arg0=arg1;arg1=arg2;}}if(evt=='onContextMenu'){each(conf.contextMenu[arg0],function(key,fn){fn.call(self);});return;}if(evt=='onPluginEvent'){var name=arg0.name||arg0;var p=plugins[name];if(p){p._fireEvent("onUpdate",arg0);p._fireEvent(arg1);}return;}if(evt=='onPlaylistReplace'){playlist=[];var index=0;each(arg0,function(){playlist.push(new Clip(this,index++,self));});}var ret=true;if(arg0===0||(arg0&&arg0>=0&&arg0<playlist.length)){activeIndex=arg0;var clip=playlist[arg0];if(clip){ret=clip._fireEvent(evt,arg1,arg2);}if(!clip||ret!==false){ret=commonClip._fireEvent(evt,arg1,arg2,clip);}}var i=0;each(listeners[evt],function(){ret=this.call(self,arg0,arg1);if(this.cached){listeners[evt].splice(i,1);}if(ret===false){return false;}i++;});return ret;};function init(){if($f(wrapper)){$f(wrapper).getParent().innerHTML="";playerIndex=$f(wrapper).getIndex();players[playerIndex]=self;}else{players.push(self);playerIndex=players.length-1;}wrapperHeight=parseInt(wrapper.style.height,10)||wrapper.clientHeight;if(typeof params=='string'){params={src:params};}playerId=wrapper.id||"fp"+makeId();apiId=params.id||playerId+"_api";params.id=apiId;conf.playerId=playerId;if(typeof conf=='string'){conf={clip:{url:conf}};}conf.clip=conf.clip||{};if(wrapper.getAttribute("href",2)&&!conf.clip.url){conf.clip.url=wrapper.getAttribute("href",2);}commonClip=new Clip(conf.clip,-1,self);conf.playlist=conf.playlist||[conf.clip];var index=0;each(conf.playlist,function(){var clip=this;if(typeof clip=='object'&&clip.length){clip=""+clip;}if(!clip.url&&typeof clip=='string'){clip={url:clip};}each(conf.clip,function(key,val){if(clip[key]===undefined&&typeof val!='function'){clip[key]=val;}});conf.playlist[index]=clip;clip=new Clip(clip,index,self);playlist.push(clip);index++;});each(conf,function(key,val){if(typeof val=='function'){bind(listeners,key,val);delete conf[key];}});each(conf.plugins,function(name,val){if(val){plugins[name]=new Plugin(name,val,self);}});if(!conf.plugins||conf.plugins.controls===undefined){plugins.controls=new Plugin("controls",null,self);}params.bgcolor=params.bgcolor||"#000000";params.version=params.version||[9,0];params.expressInstall='http://www.flowplayer.org/swf/expressinstall.swf';function doClick(e){if(!self.isLoaded()&&self._fireEvent("onBeforeClick")!==false){self.load();}return stopEvent(e);}html=wrapper.innerHTML;if(html.replace(/\s/g,'')!==''){if(wrapper.addEventListener){wrapper.addEventListener("click",doClick,false);}else if(wrapper.attachEvent){wrapper.attachEvent("onclick",doClick);}}else{if(wrapper.addEventListener){wrapper.addEventListener("click",stopEvent,false);}self.load();}}if(typeof wrapper=='string'){flashembed.domReady(function(){var node=el(wrapper);if(!node){throw"Flowplayer cannot access element: "+wrapper;}else{wrapper=node;init();}});}else{init();}}var players=[];function Iterator(arr){this.length=arr.length;this.each=function(fn){each(arr,fn);};this.size=function(){return arr.length;};}window.flowplayer=window.$f=function(){var instance=null;var arg=arguments[0];if(!arguments.length){each(players,function(){if(this.isLoaded()){instance=this;return false;}});return instance||players[0];}if(arguments.length==1){if(typeof arg=='number'){return players[arg];}else{if(arg=='*'){return new Iterator(players);}each(players,function(){if(this.id()==arg.id||this.id()==arg||this.getParent()==arg){instance=this;return false;}});return instance;}}if(arguments.length>1){var swf=arguments[1];var conf=(arguments.length==3)?arguments[2]:{};if(typeof arg=='string'){if(arg.indexOf(".")!=-1){var instances=[];each(select(arg),function(){instances.push(new Player(this,clone(swf),clone(conf)));});return new Iterator(instances);}else{var node=el(arg);return new Player(node!==null?node:arg,swf,conf);}}else if(arg){return new Player(arg,swf,conf);}}return null;};extend(window.$f,{fireEvent:function(id,evt,a0,a1,a2){var p=$f(id);return p?p._fireEvent(evt,a0,a1,a2):null;},addPlugin:function(name,fn){Player.prototype[name]=fn;return $f;},each:each,extend:extend});if(document.all){window.onbeforeunload=function(){$f("*").each(function(){if(this.isLoaded()){this.close();}});};}if(typeof jQuery=='function'){jQuery.prototype.flowplayer=function(params,conf){if(!arguments.length||typeof arguments[0]=='number'){var arr=[];this.each(function(){var p=$f(this);if(p){arr.push(p);}});return arguments.length?arr[arguments[0]]:new Iterator(arr);}return this.each(function(){$f(this,clone(params),conf?clone(conf):{});});};}})();(function(){var jQ=typeof jQuery=='function';function isDomReady(){if(domReady.done){return false;}var d=document;if(d&&d.getElementsByTagName&&d.getElementById&&d.body){clearInterval(domReady.timer);domReady.timer=null;for(var i=0;i<domReady.ready.length;i++){domReady.ready[i].call();}domReady.ready=null;domReady.done=true;}}var domReady=jQ?jQuery:function(f){if(domReady.done){return f();}if(domReady.timer){domReady.ready.push(f);}else{domReady.ready=[f];domReady.timer=setInterval(isDomReady,13);}};function extend(to,from){if(from){for(key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}return to;}function concatVars(vars){var out="";for(var key in vars){if(vars[key]){out+=[key]+'='+asString(vars[key])+'&';}}return out.substring(0,out.length-1);}function asString(obj){switch(typeOf(obj)){case'string':obj=obj.replace(new RegExp('(["\\\\])','g'),'\\$1');obj=obj.replace(/^\s?(\d+)%/,"$1pct");return'"'+obj+'"';case'array':return'['+map(obj,function(el){return asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+asString(obj[prop]));}}return'{'+str.join(',')+'}';}return String(obj).replace(/\s/g," ").replace(/\'/g,"\"");}function typeOf(obj){if(obj===null||obj===undefined){return false;}var type=typeof obj;return(type=='object'&&obj.push)?'array':type;}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}return newArr;}function getEmbedCode(p,c){var html='<embed type="application/x-shockwave-flash" ';if(p.id){extend(p,{name:p.id});}for(var key in p){if(p[key]!==null){html+=key+'="'+p[key]+'"\n\t';}}if(c){html+='flashvars=\''+concatVars(c)+'\'';}html+='/>';return html;}function getObjectCode(p,c,embeddable){var html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';html+='width="'+p.width+'" height="'+p.height+'"';if(!p.id&&document.all){p.id="_"+(""+Math.random()).substring(5);}if(p.id){html+=' id="'+p.id+'"';}html+='>';if(document.all){p.src+=((p.src.indexOf("?")!=-1?"&":"?")+Math.random());}html+='\n\t<param name="movie" value="'+p.src+'" />';var e=extend({},p);e.id=e.width=e.height=e.src=null;for(var k in e){if(e[k]!==null){html+='\n\t<param name="'+k+'" value="'+e[k]+'" />';}}if(c){html+='\n\t<param name="flashvars" value=\''+concatVars(c)+'\' />';}if(embeddable){html+=getEmbedCode(p,c);}html+="</object>";return html;}function getFullHTML(p,c){return getObjectCode(p,c,true);}function getHTML(p,c){var isNav=navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length;return(isNav)?getEmbedCode(p,c):getObjectCode(p,c);}window.flashembed=function(root,userParams,flashvars){var params={src:'#',width:'100%',height:'100%',version:null,onFail:null,expressInstall:null,debug:false,allowfullscreen:true,allowscriptaccess:'always',quality:'high',type:'application/x-shockwave-flash',pluginspage:'http://www.adobe.com/go/getflashplayer'};if(typeof userParams=='string'){userParams={src:userParams};}extend(params,userParams);var version=flashembed.getVersion();var required=params.version;var express=params.expressInstall;var debug=params.debug;if(typeof root=='string'){var el=document.getElementById(root);if(el){root=el;}else{domReady(function(){flashembed(root,userParams,flashvars);});return;}}if(!root){return;}if(!required||flashembed.isSupported(required)){params.onFail=params.version=params.expressInstall=params.debug=null;root.innerHTML=getHTML(params,flashvars);return root.firstChild;}else if(params.onFail){var ret=params.onFail.call(params,flashembed.getVersion(),flashvars);if(ret===true){root.innerHTML=ret;}}else if(required&&express&&flashembed.isSupported([6,65])){extend(params,{src:express});flashvars={MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title};root.innerHTML=getHTML(params,flashvars);}else{if(root.innerHTML.replace(/\s/g,'')!==''){}else{root.innerHTML="<h2>Flash version "+required+" or greater is required</h2>"+"<h3>"+(version[0]>0?"Your version is "+version:"You have no flash plugin installed")+"</h3>"+"<p>Download latest version from <a href='"+params.pluginspage+"'>here</a></p>";}}return root;};extend(window.flashembed,{getVersion:function(){var version=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;version=[_m,_r];}}else if(window.ActiveXObject){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version=[6,0];_a.AllowScriptAccess="always";}catch(ee){if(version[0]==6){return;}}try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(eee){}}if(typeof _a=="object"){_d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\S+\s+(.*)$/,"$1").split(",");version=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}return version;},isSupported:function(version){var now=flashembed.getVersion();var ret=(now[0]>version[0])||(now[0]==version[0]&&now[1]>=version[1]);return ret;},domReady:domReady,asString:asString,getHTML:getHTML,getFullHTML:getFullHTML});if(jQ){jQuery.prototype.flashembed=function(params,flashvars){return this.each(function(){flashembed(this,params,flashvars);});};}})();
    /**
 * @author alexander.farkas
 */
/**
* JS-Singelton-Klasse um Objekte (zum Beispiel Bilder) zu skalieren
* @id objScaleModule
* @alias $.objScale
* @alias jQuery.objScale
*/

/**
 * Berechnet die Höhe und Breite von DOM-Objekten
 * 
 * @id getDim
 * @method
 * @alias $.objScale.getDim
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt mit den Eigenschaften width und height.
 * @return {Object} gibt ein Objekt mit höhe und Breite zurück. Beispiel. {height: 200, width: 300}
 */
/**
 * Berechnet eine verhältnismäßige Skalierung eines Objekts.<br>
 * siehe auch: $.objScale.scaleHeightTo und $.objScale.scaleWidthTo
 * 
 * @id scaleTo
 * @method
 * @alias $.objScale.scaleTo
 * @see #scaleHeightTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
 * @param {Number} num num erwartet die neue Grösse, welche das Objekt haben soll (Breite oder Höhe)
 * @param {String} side gibt an welche Seite (Höhe oder Breite) man im 2. Parameter angegeben hat
 * @return {Number} gibt die neue Länge zurück (Wenn man unter num/side 'width' angegeben hat, wird die Höhe zurückgeliefert).
 */
/**
 * Skaliert die Höhe eines Objekts und gibt die verhältnismäßige Breite zurück.<br> 
 * (Shorthand für $.objScale.scaleTo(obj, num, 'height');)
 * 
 * @id scaleHeightTo
 * @method
 * @alias $.objScale.scaleHeightTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
 * @param {Number} num num erwartet die neue Höhe, welche das Objekt haben soll
 * @return {Number} gibt die neue Breite zurück
 */
/**
 * Skaliert die Breite eines Objekts und gibt die verhältnismäßige Höhe zurück.<br> 
 * (Shorthand für $.objScale.scaleTo(obj, num, 'width');)
 * 
 * @id scaleWidthTo
 * @method
 * @alias $.objScale.scaleWidthTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
 * @param {Number} num num erwartet die neue Breite, welche das Objekt haben soll
 * @return {Number} gibt die neue Höhe zurück
 */

/**
 * Skaliert die Breite eines Objekts und gibt die verhältnismäßige Höhe zurück.<br> 
 * (Shorthand für $.objScale.scaleTo(obj, num, 'width');)
 * 
 * @id scaleWidthTo
 * @method
 * @alias $.objScale.scaleWidthTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
 * @param {Number} num num erwartet die neue Breite, welche das Objekt haben soll
 * @return {Number} gibt die neue Höhe zurück
 */
/**
 * Zentriert ein kleineres Objekt in einem Grösseren.<br> 
 * siehe auch: $.objScale.constrainObjTo();
 * 
 * @id centerObjTo
 * @method
 * @alias $.objScale.centerObjTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  welches zentriert werden soll.
 * @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  in welches das andere Objekt zentriert werden soll
 * @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindest nach oben bzw. links geben soll (margin: [10, false]) und, ob vertical und / oder horizontal zentriert werden soll<br><br>
 * Beispiel:<br>
 * $.objScale.centerObjTo(img, container, {margin: [10, 0], horizontal: false};<br>
 * Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen<br><br>
 * $.objScale.centerObjTo(img, container, {margin: [false, 0]};<br>
 * Es soll vertical und horizontal zentriert werden, ausserdem soll der Mindestabstand nach links 0 Einheiten betragen und nach oben existiert keine Mindestbeschränkung (Es können negative Werte auftreten).<br><br>
 * defaults: {margin: [0, 0], vertical: true, horizontal: true}
 * @return {Object} gibt ein Objekt mit top und left Eigenschaften zurück
 */
/**
 * Zentriert ein Objekt in einem anderen Objekt. Ist das zu skalierende Objekt grösser, wird es zusätzlich verkleinert.<br> 
 * siehe auch: $.objScale.centerObjTo(); und $.objScale.scaleObjTo();
 * @id constrainObjTo
 * @method
 * @alias $.objScale.constrainObjTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  welches angepasst und zentriert werden soll.
 * @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  in welches das andere Objekt zentriert werden soll
 * @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindestabstand nach oben bzw. links geben soll (margin: [10, false], padding: [10, 0]) und ob vertical und / oder horizontal zentriert werden soll<br><br>
 * Unterschied zwischen padding und margin: Die margin- und padding-Angaben werden für die evtl. Verkleinerung des Objekts berücksichtigt. Bei einer möglichen Zentrierung wird dagegen ausschließlich der margin-Wert berücksichtigt. Das padding-Array darf daher nur Zahlen enthalten, das margin-Array darf daneben noch den booleschen Wert false enthalten.
 * Beispiel:<br>
 * $.objScale.constrainObjTo(img, container, {margin: [10, 0], horizontal: false};<br>
 * Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen<br><br>
 * defaults: {margin: [0, 0], padding: [0, 0], vertical: true, horizontal: true}
 * @return {Object} gibt ein Objekt mit width, height, top und left Eigenschaften zurück
 */
/**
 * Skaliert ein Objekt, so dass es perfekt in ein anderes Objekt passt und zentriert es. (Ist es kleiner, wird es vergrössert bzw. ist grösser, wird es verkleinert).<br> 
 * siehe auch: $.objScale.centerObjTo(); und $.objScale.constrainObjTo();
 * @id scaleObjTo
 * @method
 * @alias $.objScale.scaleObjTo
 * @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  welches skaliert und zentriert werden soll.
 * @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften,  in welches das andere Objekt zentriert/skaliert werden soll
 * @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindestabstand nach oben bzw. links geben soll (margin: [10, false], padding: [10, 0]), ob vertical und / oder horizontal zentriert werden soll. Die scaleToFit-Eigenschaft gibt an, ob bei unterschiedlichen Seitenverhältnissen das innere Objekt vollständig zu sehen sein soll oder ob es das äußere Objekt vollständig ausfüllen soll<br><br>
 * Unterschied zwischen padding und margin: Die margin- und padding-Angaben werden für die evtl. Skalierung des Objekts berücksichtigt. Bei einer möglichen Zentrierung wird dagegen ausschließlich der margin-Wert berücksichtigt. Das padding-Array darf daher nur Zahlen enthalten, das margin-Array darf daneben noch den booleschen Wert false enthalten.
 * Beispiel:<br>
 * $.objScale.scaleObjTo(img, container, {margin: [10, 0], horizontal: false};<br>
 * Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen<br><br>
 * defaults: {margin: [false, false], padding: [0, 0], scaleToFit: false, vertical: true, horizontal: true}
 * @return {Object} gibt ein Objekt mit width, height, top und left Eigenschaften zurück
 */
(function($){
	/**
	 * @id objScaleModule
	 */
	$.objScale = (function(){
	
	/**
	 * @id getDim
	 */
		function getDim(obj){
			
			//console.log(obj.height())
			var height,
				width,
				ret = (obj.jquery) ?
						{
							height: ($.nodeName(obj[0], 'object')) ? parseInt(obj[0].height, 10) : obj.height(),
							width: ($.nodeName(obj[0], 'object')) ? parseInt(obj[0].width, 10) : obj.width()
						} : 
						(isFinite(obj.width) && isFinite(obj.height)) ?
						{width: obj.width, height: obj.height} :
						getDim($(obj));
			return ret; 
		}
		
		/**
		 * @id scaleTo
		 */
		function scaleTo(obj, num, side){
			var cur = getDim(obj),
				percentage,
				reverseSide = (side == 'height') ?
					'width' :
					'height';
			
			percentage = cur[side] / num;
			return cur[reverseSide] / percentage;
		}
		
		/**
		 * @id scaleHeightTo
		 */
		function scaleHeightTo(obj, height){
			return scaleTo(obj, height, 'height');
		}
		
		/**
		 * @id scaleWidthTo
		 */
		function scaleWidthTo(obj, width){
			return scaleTo(obj, width, 'width');
		}
		
		/**
		 * @id constrainObjTo
		 */
		function constrainObjTo(obj, container, opts){
			opts = $.extend({
				margin: [0, 0],
				padding: [0, 0],
				cleanCSS: true
			}, opts);
			var cur = getDim(obj),
				con = getDim(container),
				maxWidth = con.width - opts.padding[1],
				maxHeight = con.height - opts.padding[0],
				estimatetPer = con.height / con.width,
				curPer = cur.height / cur.width,
				ret = $.extend({},cur);
			
			if(opts.margin[1]){
				maxWidth -=  opts.margin[1] * 2;
			}
			if(opts.margin[0]){
				maxHeight -=  opts.margin[0] * 2;
			}
			if(estimatetPer < curPer && maxHeight < cur.height){
				ret.width = scaleTo(obj, maxHeight, 'height'); 
				ret.height = maxHeight;
			} else if(maxWidth < cur.width){
				ret.width = maxWidth; 
				ret.height = scaleTo(obj, maxWidth, 'width');
			}
			if(!opts.cleanCSS){
				ret.widthSubtraction = ret.width - cur.width;
				ret.heightSubtraction = ret.height - cur.height;
			}
			$.extend(ret, centerObjTo(ret, con, opts));
			return ret;
		}
		
		/**
		 * @id centerObjTo
		 */
		function centerObjTo(obj, container, opts){
			opts = $.extend({
				margin: [0, 0],
				vertical: true,
				horizontal: true
			}, opts);
			var cur = getDim(obj),
				con = getDim(container),
				ret = {};
				
			if(opts.vertical){
				ret.top = (con.height - cur.height) / 2;
				if (isFinite(opts.margin[0])) {
					ret.top = Math.max(ret.top, opts.margin[0]);
				}
			}
			
			if(opts.horizontal){
				ret.left =  (con.width - cur.width) / 2;
				if(isFinite(opts.margin[1])){
					ret.left = Math.max(ret.left, opts.margin[1]);
				}
			}
			return ret;
		}
		
		/**
		 * @id scaleObjTo
		 */
		function scaleObjTo(obj, container, opts){
			opts = $.extend({
				margin: [false, false],
				padding: [0, 0],
				scaleToFit: false
			}, opts);
			
			var cur = getDim(obj),
				con = getDim(container),
				curPer = cur.height / cur.width,
				ret = {};
			
			con.maxHeight = con.height - opts.padding[0];
			con.maxWidth = con.width - opts.padding[1];
			
			if(opts.margin[0]){
				con.maxHeight -= opts.margin[0];
			}
			if(opts.margin[1]){
				con.maxWidth -= opts.margin[1];
			}
			
			var	estimatetPer = con.maxHeight / con.maxWidth;
				
			if(opts.scaleToFit !== estimatetPer > curPer){
				ret.width = con.maxWidth; 
				ret.height = scaleTo(obj, con.maxWidth, 'width');
			} else {
				ret.width = scaleTo(obj, con.maxHeight, 'height'); 
				ret.height = con.maxHeight;
			}
			
			$.extend(ret, centerObjTo(ret, con, opts));
			return ret;
		}
		
		return {
			scaleWidthTo: scaleWidthTo,
			scaleHeightTo: scaleHeightTo,
			scaleSidesIn: scaleObjTo, /* dep */
			scaleObjTo: scaleObjTo,
			constrainObjTo: constrainObjTo,
			getDim: getDim,
			centerObjTo: centerObjTo
		};
	})();
})(jQuery);

    /**
 * @author alexander.farkas
 * 
 * Usage Example:
 * 
 * 

$('#photo-index a').each(function(){
	$.imgPreLoad.add($(this).attr('href'));
});

 */
(function($){
	$.imgPreLoad = (function(){
		var srcList 	= [], 
			ready 		= false, 
			started 	= false,
			loaded 		= false,
			errorDelay 	= 5000,
			errorTimer
		;
		
		function createImg(){
			return (window.Image) ? new Image() : document.createElement('img');
		}
			
		function loadImg(src, callback){
			var img = createImg(),
				fn = function(e){
					var that = this, args = arguments;
					clearTimeout(errorTimer);
					$(this).unbind('load error');
					src[1].apply(that, args);
					callback.apply(that, args);
				};
			
			img.src = src[0];
			if(!img.complete){
				clearTimeout(errorTimer);
				errorTimer = setTimeout(function(){
					fn.call(img, {type: 'timeouterror'});
				}, errorDelay);
				$(img)
					.bind('load error', fn);
			} else {
				fn.call(img, {type: 'cacheLoad'});
			}
		}
		
		function loadNextImg(){
			if(srcList.length && ready){
				started = true;
				var src = srcList.shift();
				loadImg(src, loadNextImg);
			} else {
				started = false;
			}
		}
		
		function pause(){
			started = false;
			ready = false;
		}
		
		function restart(){
			if(loaded) {
				ready = true;
				loadNextImg();
			}
		}
		
		function loadNow(src, callback){
			pause();
			callback = callback || function(){};
			loadImg([src, callback], restart);
		}
		
		return {
			add: function(src, 	fn, priority){
				fn = fn || function(){};
				src = [src, fn];
				if(priority){
					srcList.unshift(src);
				} else {
					srcList.push(src);
				}
				if(ready && !started){
					loadNextImg();
				}
			},
			loadNow: loadNow,
			ready: function(){
				loaded = true;
				ready = true;
				loadNextImg();
			}
		};
	})();
	if($.windowLoaded){
		$.imgPreLoad.ready();
	} else {
		$(window).bind('load', $.imgPreLoad.ready);
	}
})(jQuery);


    /**
 * @author trixta
 */
(function($){
	
	/* Mask */
	
	$.fn.fadeInTo = function(){
		var args = arguments;
		return this.each(function(){
			var jElm = $(this);
			
			if(jElm.css('display') === 'none'){
				jElm.css({opacity: '0', display: 'block'});
			}
			$.fn.fadeTo.apply(jElm, args);
		});
	};
	
	var maskID = new Date().getTime();
	
	$.widget('ui.overlayProto', {
		hideElementsOnShow: function(){
			var o 		= this.options,
				that 	= this
			;
			
			this.hiddenElements = $([]);
			
			if(o.hideWindowedFlash){
				this.hiddenElements = $('object, embed').filter(function(){
						return !(
								((this.getAttribute('classid') || '').toLowerCase() === 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' || this.getAttribute('type') === 'application/x-shockwave-flash') && //isFlash
										(this.getAttribute('transparent') !== 'transparent' &&
										(/<param\s+(?:[^>]*(?:name=["'?]\bwmode["'?][\s\/>]|\bvalue=["'?](?:opaque|transparent)["'?][\s\/>])[^>]*){2}/i.test(this.innerHTML)))
							);
					});
			}
			
			if(o.hideWhileShown){
				this.hiddenElements = this.hiddenElements.add(o.hideWhileShown);
			}
			
			this.hiddenElements = this.hiddenElements
				.filter(function(){
					
					return ($.curCSS(this, 'visibility') !== 'hidden' && !$.contains( that.element[0], this ));
				})
				.filter(o.hideFilter)
				.css({visibility: 'hidden'});
		}
	});
	
    $.widget('ui.mask', $.ui.overlayProto, {
		options: {
			extraClass: false,
			closeOnClick: true,
			closeOnEsc: true,
			hideFilter: function(){return true;},
			handleDisplay: true,
			fadeInTime: 0,
			fadeOutTime: 0,
			opacity: 0.8,
			bgIframe: false,
			cssWidth: true
		},
		_create: function(){
			var o  		= this.options,
				that 	= this,
				css
			;
			maskID++;
			this.id = maskID;
			this.maskedElement = this.element.parent();
			
			if(this.maskedElement.is('body')){
				this.dimensionElement = $(document);
				this.calcMethod = {
					height: 'height',
					width: 'width'
				};
			} else {
				this.dimensionElement = this.maskedElement.css({position: 'relative'});
				this.calcMethod = {
					height: 'innerHeight',
					width: 'innerWidth'
				};
			}
			if(this.maskedElement.is('body') || (parseInt($.browser.version, 10) < 7 && $.browser.msie)){
				css = {
					display: 'none',
					position: 'absolute',
					top: '0',
					left: '0'
				};
				this.calcSize = true;
			} else {
				css = {
					display: 'none',
					position: 'absolute',
					top: 0,
					left: 0,
					right: 0,
					bottom: 0
				};
				
				this.calcSize = false;
			}
			this.element.css(css);
			this.isVisible = false;
			if(o.closeOnClick){
				this.element.click(function(e){
					that.hide.call(that, e, this);
				});
			}
			if(o.extraClass){
				this.element.addClass(o.extraClass);
			}
		},
		ui: function(){
			return {
				instance: this
			};
		},
		hide: function(e, elem){
			
			if(!this.isVisible){return;}
			var result 	= this._trigger('close', e, this.ui()),
				o 		= this.options,
				that 	= this
			;
			if(result === false){return;}
			this.isVisible = false;
			
			if(o.handleDisplay){
				if(o.fadeOutTime){
					this.element.fadeOut(o.fadeOutTime, function(){
						that.unexpose.call(that);
					});
				} else {
					this.element.hide();
					this.unexpose();
				}
			}
			this.element.queue(function(){
				if(that.hiddenElements && that.hiddenElements.css){
					that.hiddenElements.css({visibility: 'visible'});
				}
				that.maskedElement.removeClass('mask-visible');
				that.element.dequeue();
			});
			$(document).unbind('.mask'+ this.id);
			$(window).unbind('.mask'+ this.id);
		},
		resize: function(set){
			var ret = {
				'height': this.dimensionElement[this.calcMethod.height]()
			};
			if(!this.options.cssWidth){
				ret.width = this.dimensionElement[this.calcMethod.width]();
			}
			if(set){
				this.element.css(ret);
			}
			return ret;
		},
		show: function(e, o){
			
			if(this.isVisible){return;}
			o = (o) ? $.extend(true, {}, this.options, o) : this.options;
			var that 	= this,
				resize 	= function(e){
						that.resize.call(that, true);
					}
			;
			if(o.expose){
				this.expose(o.expose);
			}
			
			this._trigger('show', e, $.extend(true, {} , this.ui(), o));
			this.isVisible = true;
			this.maskedElement.addClass('mask-visible');
			this.hideElementsOnShow();
			if(o.handleDisplay){
				if(this.calcSize){
					this.resize(true);
				}
				if(o.fadeInTime){
					this.element.fadeInTo(o.fadeInTime, o.opacity);
				} else {
					this.element.css({opacity: o.opacity, display: 'block'});
				}
			}
			
			if(o.closeOnEsc){
				$(document).bind('keydown.mask'+ this.id, function(e){
					if(e.keyCode === $.ui.keyCode.ESCAPE){
						that.hide.call(that, e, this);
					}
				});
			}
			if (that.calcSize) {
				$(document).bind('resize.mask'+ this.id +' emchange.mask'+ this.id, resize);
				$(window).bind('resize.mask'+ this.id, resize);
			}
		},
		unexpose: function(elem){
			if(!elem && !this.exposed){return;}
			var exposed = elem || this.exposed;
			exposed.each(function(){
				$(this).css({
					position: '',
					zIndex: ''
				});
			});
			if(!elem){
				this.exposed = false;
			}
		},
		expose: function(jElm){
			var zIndex =  parseInt(this.maskedElement.css('z-index'), 10) || 9;
			jElm = this.maskedElement.find(jElm);
			jElm.each(function(){
				var jExpose = $(this);
				if(jExpose.css('position') === 'static'){
					jExpose.css({position: 'relative'});
				}
				zIndex++;
				jExpose.css({
					zIndex: zIndex
				});
			});
			this.exposed = jElm;
		}
	});
		
	/* END: Mask */
	
	/* Content-Overlay */
	
	var currentFocus,
		id 		= new Date().getTime()
	;
		
	$(document).bind('focusin', function(e){
		if(e.target.nodeType == 1){
			currentFocus = e.target;
		}
	});
	
	if(!$.fn.mask){
		$.fn.mask = function(){return this;};
	}
	
	$.widget('ui.cOverlay', $.ui.overlayProto, {
		options: {
			//
			mask: false, //Soll die Seite zusätzlich maskiert werden
			maskOpts: {}, //Optionen für die Maskierung, siehe mask-Plugin im Overlay-Ordner
			hideStyle: 'visibility',
			bgIframe: false, //IE6 bugfix für select-zIndex-Bug
			hideWindowedFlash: 'auto', // Sollen Flashelemente versteckt werden, die kein wmode haben
			hideWhileShown: false, // Selektor von Elementen, DOM-Objekte die während der Anzeige versteckt werden sollen
			hideFilter: function(){return true;}, // funktion zum herausfiltern von Objekten die versteckt werden sollen
			
			extraClass: false, // Zusatzklasse für Overlay-Element
			attrs: {}, //zusätzliche Attribute, für das Overlay-Element
			bodyShowClass: 'overlay-visible', //body-Klasse die gesetzt ist solange das Overlay angezeigt wird (gut für Print-Stylesheets)
			
			positionType: '', // Name der Funktion im Namespace  $.ui.cOverlay.posMethods bzw die Funktion selbst, welche die Position berechnet 
			positionOpts: {}, //optionen der positions-Funktion
			//mögliche weitere Positionierungs-Optionen
			followMouse: false,
			
			restoreFocus: 'auto', // Ob der Focus beim Schliessen auf das Element gesetzt werden soll, welches vor dem öffnen fokusiert war, bei auto ist dies true, sofern focusOnShow gesetzt wurde
			focusOnShow: false, // Ob das Overlay fokusiert werden soll, wenn es geöffnet wird. Wird ein Selektor angegeben, dann wird dieses Element fokusiert
			
			closeOnEsc: true,
			closeBtnSel: 'a.close-button',
			
			animShow: function(jElm, ui){ //Show-Animation (ui.posCSS enthält die berechnete Positionierung und muss gesetzt werden) 
				jElm.css(ui.posCSS).css({visibility: 'visible'});
			},
			animHide: function(jElm, ui){//Hide-Animation 
				jElm.css({visibility: 'hidden'});
			},
			
			addRole: false, // nonfocussyle: tooltip || alert || focusstyle: alertdialog || dialog 
			createA11yWrapper: 'auto',
			labelledbySel: false,
			describedbySel: false,
			
			//Opener
			openerSel: false, // Elemente (Selektor:String, jQuery:Object, DOM:Object), welche das Overlay öffnen
			openerContext: document, // Kontext (DOM:Object, jQuery:Object) in dem nach openerSel gesucht wird
			bindStyle: 'bind', // Art des Event-Bindings (bind|live)
			
			//opencloseEvents werden durch a11ymode erweitert
			openEvent: 'ariaclick', // mouseenter || click
			closeEvent: false,
			openDelay: 0, //Zeit die vergehen soll bis das overlay geöffnet wird
			
			setInitialContent: false
		},
		_create: function(){
			var o 		= this.options,
				that 	= this,
				hideCss = (o.hideStyle === 'display') ? {display: 'none'} : {visibility: 'hidden'},
				close 	= function(e){
					var elem = this;
					
					that.timer.clear('openTimer');
					
					that.timer.setDelay('closeTimer', function(){
						that.hide(e, {closer: elem});
					}, 1);
					return false;
				},
				show 	= function(e){
					var elem = this;
					if(that.closeTimer !== undefined && (!that.currentOpener || that.currentOpener[0] === elem || elem === that.element[0])){
						that.timer.clear('closeTimer');
					}
					that.timer.setDelay('openTimer', function(){
						that.show(e, {opener: elem});
					}, o.openDelay);
					return false;
				},
				isDialog, isSpecial
			;
			this.timer = $.createTimer(this);
			this.mask = $([]);
			
			if(o.mask && o.hideWindowedFlash === 'auto'){
				o.maskOpts = o.maskOpts || {};
				o.hideWindowedFlash = true;
			} else {
				o.hideWindowedFlash = false;
			}
			
			if(o.maskOpts){
				o.maskOpts.hideWindowedFlash = false;
			}
			if(o.extraClass){
				this.element.addClass(o.extraClass);
			}
			
			if(o.mask){
				this.mask = $('<div class="mask" />')
					.insertBefore(this.element)
					.mask(
						$.extend(o.maskOpts, 
							{
								close: function(e, ui){
									that.timer.clear('openTimer');
									return that.hide(e, ui);
								}
							}
						)
					);
			}
			this.element
				.css(hideCss)
				.addClass('a11y-js-overflow')
				.attr(o.attrs)
				.attr({'aria-hidden': 'true'})
			;
			
			
			if(o.createA11yWrapper === true || (o.createA11yWrapper && this.element.parent().is('body'))){
				this.element.wrap('<div class="a11y-wrapper" />');
			}
			
			
			if(o.restoreFocus === 'auto'){
				o.restoreFocus = !!(o.focusOnShow);
			}
			
			if(o.setInitialContent){
				this.fillContent(this.element, o.setInitialContent);
			}
			
			this.clonedOverlay = this.element.clone().attr({role: 'presentation'}).addClass('cloned-overlay');
			
			if(o.bgIframe && $.fn.bgIframe && parseInt($.browser.version, 10) < 7){
				this.element.bgIframe();
			}
			
			id++;
			this.id = 'overlay-'+ id;
			this.isVisible = false;
			this.hiddenElements = $([]);
			this.openers = $([]);
			
			this.closeBtn = $(o.closeBtnSel, this.element)
				.bind('ariaclick', function(e){
					that.timer.clear('openTimer');
					that.hide(e, {closer: this});
					return false;
				})
			;
				
			if(o.openerSel){
				this.openers = $(o.openerSel, o.openercontext);
				if(o.openEvent){
					this.openers[o.bindStyle](o.openEvent, show);
				}
				if(o.closeEvent){
					this.openers[o.bindStyle](o.closeEvent, close);
				}
			}
			if($.support.waiAria){
				if(this.closeBtn[0] && $.nodeName(this.closeBtn[0], 'a')){
					this.closeBtn.removeAttr('href').attr({tabindex: '0', role: 'button'});
				}
				
				if(o.labelledbySel){
					this.element.labelWith($(o.labelledbySel, this.element));
				} 
				
				if(o.describedbySel){
					this.element.describeWith($(o.describedbySel, this.element));
				}
				if(o.addRole){
					this.element.attr('role', o.addRole);
				}
			}
			this._trigger('init', {
				type: 'init'
			}, this.ui());
		},
		fillContent: function(element, content, isClone){
			var o = this.options;
			
			element = element || this.element;
			content = content || this.content || {};
			$.each(content, function(name, html){
				if($.isFunction(html)){
					html(name, element, content, isClone);
				} else {
					$('.'+ name, element).html(html);
				}
			});
			if(o.addRole === 'tooltip' || o.addRole === 'alert'){
				$('*', this.element).attr({role: 'presentation'});
			}
		},
		ui: function(){
			var obj = {
						instance: this,
						isVisible: this.isVisible,
						openers: this.openers,
						id: this.id,
						element: this.element
					},
				arg = arguments
			;
			
			for(var i = 0, len = arg.length; i < len; i++){
				if(arg[i]){
					$.extend(obj, arg[i]);
				}
			}
			return obj;
		},
		show: function(e, extras){
			this.timer.clear('closeTimer');
			this.currentOpener = (extras && extras.opener) ? $(extras.opener) : (e && e.currentTarget) ? $(e.currentTarget) : $(currentFocus);
			extras = extras || {};
			extras.opener = this.currentOpener;
			
			if(this.isVisible || this._trigger('beforeShow', e, this.ui({extras: extras})) === false || this.stopShow){return;}
			this.isVisible = true;
			var o 				= this.options,
				that 			= this,
				posCSS,
				ui
			;
			this.hideElementsOnShow();
			if(o.addRole === 'tooltip' && this.currentOpener){
				this.currentOpener.attr({
					'aria-describedby': this.element.getID()
				});
			}
			
			posCSS = this.setPosition(e, extras);
			
			ui = this.ui({extras: extras, posCSS: posCSS});
			this.mask.mask('show');
			
			o.animShow(this.element.stop(true, true), ui);
			
			this.element.attr({'aria-hidden': 'false'});
			
			$.ui.SR.update();
				
			this.restoreFocus = currentFocus;
			if( o.focusOnShow ){
				if( o.focusOnShow === true ){
					this.element.firstExpOf('focusPoint').setFocus({context: (this.element[0].parentNode || {}).parentNode});
				} else {
					$(o.focusOnShow, this.element).setFocus({context: (this.element[0].parentNode || {}).parentNode});
				}
			}
				
			$('body').addClass(o.bodyShowClass);
			
			if(o.closeOnEsc){
				$(document).bind('keydown.'+ this.id, function(e){
					if(e.keyCode === $.ui.keyCode.ESCAPE){
						that.hide.call(that, e, {closer: this});
					}
				});
			}
						
			this.mask.mask('resize', true);
			$.ui.SR.update();
			this._trigger('show', e, ui);
		},
		hide: function(e, extras){
			if(!this.isVisible){return;}
			var o 		= this.options,
				ui 		= this.ui({extras: extras})
			;
			if(this._trigger('beforeHide', e, ui) === false){return false;}
			
			this.isVisible = false;
			
			if(o.addRole === 'tooltip' && this.currentOpener){
				this.currentOpener.removeAttr('aria-describedby');
			}
			
			
			this.mask.mask('hide');
			
			$(document).unbind('.'+ this.id);
			$(window).unbind('.'+ this.id);
			if (o.restoreFocus && this.restoreFocus) {
				$(this.restoreFocus).setFocus({fast: true});
			}
			
			o.animHide(this.element, ui);
			if(this.removeFlashContent){
				this.removeFlashContent();
			}
			this.element.attr({'aria-hidden': 'true'});
			
			this.hiddenElements.css({visibility: 'visible'});
			this._trigger('hide', e, ui);
			$('body').removeClass(o.bodyShowClass);
			this.restoreFocus = false;
		},
		setPosition: function(e, extras, elem){
			elem = elem || this.element;
			var o 	= this.options,
				pos = {};
			e = (e && e.type) ? e : {type: 'unknown'};
			extras = extras || {};
			if(!extras.opener){
				extras.opener = this.currentOpener;
			}
			
			if(typeof o.positionType === 'string' && $.ui.cOverlay.posMethods[o.positionType]){
				
				pos = $.ui.cOverlay.posMethods[o.positionType](elem, e, extras, this);
			} else if($.isFunction(o.positionType)){
				pos = o.positionType(elem, e, extras, this);
			}
			return pos;
		}
	});
	
	$.ui.cOverlay.posMethods = {};
	$.ui.cOverlay.posMethods.position = function(overlay, e, extra, ui){
		var o 	= ui.options,
			target,
			pos
		;
		if(o.followMouse && e.type.indexOf('mouse') != -1){
			target = e;
			$(document).bind('mousemove.'+ ui.id, function(evt){
				var delta = {
						top: e.pageY - evt.pageY,
						left: e.pageX - evt.pageX
					},
					posDelta = {
						top: pos.top - delta.top,
						left: pos.left - delta.left
					}
				;
				overlay.css({
						top: pos.top - delta.top,
						left: pos.left - delta.left
					});
			});
		} else if(o.positionOpts.posTarget || extra.opener){
			target = o.positionOpts.posTarget || ui.currentOpener || extra.opener;
		}
		overlay.position($.extend({}, o.positionOpts, {
			of: target,
			using: function(tmpPos){pos = tmpPos;}
		}));
		return pos;
	};
	$.ui.cOverlay.posMethods.around = function(overlay, e, extra, ui){
		var o 	= ui.options,
			pos
		;
		
		if(!$.posAround){
			setTimeout(function(){
				throw('please install the posAround plugin');
			},0);
			return {};
		}
		
		if(o.followMouse && e.type.indexOf('mouse') != -1){
			pos = $.posAround(overlay, e, o.positionOpts);
			$(document).bind('mousemove.'+ ui.id, function(evt){
				var delta = {
						top: e.pageY - evt.pageY,
						left: e.pageX - evt.pageX
					},
					posDelta = {
						top: pos.top - delta.top,
						left: pos.left - delta.left
					}
				;
				overlay.css({
						top: pos.top - delta.top,
						left: pos.left - delta.left
					});
			});
		} else if(o.positionOpts.posTarget || extra.opener){
			pos = $.posAround(overlay, o.positionOpts.posTarget || extra.opener, o.positionOpts);
		}
		return pos;
	};
	
	$.ui.cOverlay.posMethods.centerInsideView = function(overlay, e, extra, ui){
		var o 	= ui.options,
			doc = $(document),
			pos
		;
		
		if(!$.objScale){
			setTimeout(function(){
				throw('please install the objScale plugin');
			},0);
			return {};
		}
		
		pos = $.objScale.centerObjTo(overlay, $(window), o.positionOpts);
		pos.top += doc.scrollTop();
		pos.left += doc.scrollLeft();
		return pos;
	};
	
})(jQuery);
    /**
 * @author alexander.farkas
 */
(function($){
	// helper für createUrlIndex
	var controlState = {};
	$.each({disable: ['-1', 'true', 'addClass'], enable: ['0', 'false', 'removeClass']}, function(name, sets){
		controlState[name] = function(){
			var jElm = $(this);
			if(!jElm.is('span, div')){
				jElm.attr({tabindex: sets[0], 'aria-disabled': sets[1]});
			}
			jElm[sets[2]]('ui-disabled');
		};
	});
		
	$.createUrlIndex = function(anchors, obj){
		var o = obj.options;
		o.srcAttribute = o.srcAttribute || 'href';
		obj.uniqueUrls = [];
		obj.uniqueOpeners = [];
		anchors.each(function(){
			var url = $(this).attr(o.srcAttribute);
			
			if($.inArray(url, obj.uniqueUrls) === -1){
				obj.uniqueUrls.push(url);
				obj.uniqueOpeners.push(this);
			}
			
		});
		
		obj.nextBtn = $('.next', obj.element);
		obj.prevBtn = $('.prev', obj.element);
		obj.playPauseBtn = $('.play-pause', obj.element);
		if ($.support.waiAria) {
			obj.nextBtn.add(obj.prevBtn).add(obj.playPauseBtn)
				.each(function(){
					if($.nodeName(this, 'a')){
						$(this)
							.removeAttr('href')
							.attr({tabindex: '0'});
					}
				})
			;
		}
		obj.currentIndexDisplay = $('.current-index', obj.element).html('1');
		obj.lengthDisplay = $('.item-length', obj.element).html(obj.uniqueUrls.length);
		
		obj.play = function(delay, playAgain){
			if(obj.isPlaying){return;}
			obj.isPlaying = true;
			obj.playPauseBtn.addClass('ui-isplaying').html(o.pauseText);
			if(o.pauseTitle){
				obj.playPauseBtn.attr({
					title: o.pauseTitle
				});
			}
			slideShowLoad((delay) ? o.slideshowDelay : 0, (playAgain !== undefined) ? playAgain : true);
		};
		
		obj.pause = function(){
			if(!obj.isPlaying){return;}
			obj.isPlaying = false;
			obj.playPauseBtn.addClass('ui-isplaying').html(o.playText);
			if(o.playTitle){
				obj.playPauseBtn.attr({
					title: o.playTitle
				});
			} 
			clearTimeout(obj.slideshowTimer);
		};
		
		obj.playPauseToggle = function(time, playAgain){
			obj[(obj.isPlaying) ? 'pause' : 'play'](time, playAgain);
			return false;
		};
		
		
		
		obj.isPlaying = false;
		
		if(obj.uniqueUrls.length > 1){
			
			obj.nextBtn.bind('ariaclick', function(e){
				obj.loadNext(e);
				return false;
			});
			
			obj.prevBtn.bind('ariaclick', function(e){
				obj.loadPrev(e);
				return false;
			});
			
			obj.playPauseBtn.bind('ariaclick', function(){
				obj.playPauseToggle(undefined, true);
				return false;
			});
			
			if(o.addKeyNav){
				obj.element.bind('keydown', function(e){
					var prevent; 
					
					switch(e.keyCode) {
						case $.ui.keyCode.LEFT:
							prevent = obj.loadPrev(e);
							break;
						case $.ui.keyCode.RIGHT:
							prevent = obj.loadNext(e);
							break;
						case $.ui.keyCode.SPACE:
							obj.playPauseToggle();
							break;
					}
					return prevent;
				});
			}
			
		} else {
			if(o.controlsWrapper){
				$(o.controlsWrapper, obj.element).hide();
			}
			obj.prevBtn.hide();
			obj.nextBtn.hide();
			obj.playPauseBtn.hide();
		}
		
		function slideShowLoad(time, playAgain){
			clearTimeout(obj.slideshowTimer);
			obj.slideshowTimer = setTimeout(function(){
				if(!obj.loadNext({type: 'slideshow'})){
					if(o.carousel || playAgain){
						obj.loadIndex(0, {type: 'slideshow'});
					} else {
						obj.pause();
					}
				}
			}, time || 0);
		}
		
		
		obj.uniqueOpeners = $(obj.uniqueOpeners);
		
		obj.updateIndex = function(url){
			var extendUI = {
				disable: $([]),
				enabled: $([])
			};
			
			obj.currentUrl = url;
			obj.currentIndex = $.inArray(url, obj.uniqueUrls);
			obj.currentAnchor = obj.uniqueOpeners.filter(':eq('+ obj.currentIndex +')');
			
			obj.currentIndexDisplay.html(String( obj.currentIndex + 1 ));
			
			
			
			if(obj.currentIndex === 0){
				if(!o.carousel){
					extendUI.disable = obj.prevBtn.each(controlState.disable);
				}
				obj._trigger('indexStartEndReachedChange', {type: 'indexStartReached'}, obj.ui(extendUI));
			} else if(obj.prevBtn.hasClass('ui-disabled')){
				extendUI.enable = obj.prevBtn.each(controlState.enable);
				obj._trigger('indexStartEndReachedChange', {type: 'indexStartReachedChanged'}, obj.ui(extendUI));
			}
			if(obj.uniqueUrls.length <= obj.currentIndex + 1){
				if(!o.carousel){
					obj.pause();
					extendUI.disable = obj.nextBtn.each(controlState.disable);
				}
				obj._trigger('indexStartEndReachedChange', {type: 'indexEndReached'}, obj.ui(extendUI));
			} else if(obj.nextBtn.hasClass('ui-disabled')){
				extendUI.enable = obj.nextBtn.each(controlState.enable);
				obj._trigger('indexStartEndReachedChange', {type: 'indexEndReachedChanged'}, obj.ui(extendUI));
			}
		};
		
		obj.loadIndex = function(index, e){
			if(typeof index === 'string' && index * 1 !== index){
				index = $.inArray(index, obj.uniqueUrls);
			}
			if(index === obj.currentIndex || index === -1){return false;}
			var nextAnchor 	= obj.uniqueOpeners.filter(':eq('+ index+ ')'),
				oldAnchor 	= obj.currentAnchor,
				url, urlPart, type
			;
			
			if(nextAnchor[0]){
				url = nextAnchor.attr(o.srcAttribute);
				urlPart = url.split('?')[0];
				type = nextAnchor.attr('type') || '';
				type = [type, type.split('/')];
				e = e || {type: 'loadIndex'};
				obj.updateIndex(url);
				obj.element.addClass('loading');
				if(obj.mask){
					obj.mask.addClass('loading-mask');
				}
				o.hideContentAnim(obj, e, {oldAnchor: oldAnchor, index: index, opener: nextAnchor, content: obj.content});
				
				if(o.addLiveRegion){
					$('div.content-box', obj.element).attr({
						'aria-busy': 'true'
					});
				}
				
				$.each($.createUrlIndex.mmContent.types, function(name, mmHanlder){
					if(mmHanlder.filter(url, nextAnchor, urlPart, type)){
						mmHanlder.load(url, nextAnchor, obj, function(url, width){
							
							var uiEvent = {oldAnchor: oldAnchor, index: index, opener: nextAnchor};
							uiEvent.content = obj.content;
							obj.options.getTextContent(nextAnchor, obj.content, obj);
							o.showContentAnim(obj, obj.content['multimedia-box'], e, uiEvent);
							obj._trigger('indexChange', e, uiEvent);
							obj.element.queue(function(){
								obj.element.removeClass('loading');
								if(obj.mask) {
									obj.mask.removeClass('loading-mask');
								}
								obj.element.dequeue();
							});
							if(obj.isPlaying){
								slideShowLoad(o.slideshowDelay);
							}
							if(o.addLiveRegion){
								$('div.content-box', obj.element).attr({'aria-live': 'polite', 'aria-busy': 'false'});
							}
							$.ui.SR.update();
						});
						return false;
					}
					return undefined;
				});
				return true;
			}
			return false;
		};
		
		obj.loadNext = function(e){
			var retVal = obj.loadIndex(obj.currentIndex + 1, e);
			if(retVal === false && o.carousel){
				retVal = obj.loadIndex(0, e);
			}
			return retVal;
		};
		
		obj.loadPrev = function(e){
			var retVal = obj.loadIndex(obj.currentIndex - 1, e);
			if(retVal === false && o.carousel){
				retVal = obj.loadIndex(obj.uniqueOpeners.length - 1, e);
			}
			return retVal;
		};
	};
	
	$.createUrlIndex.mmContent = {
		types: {},
		add: function(name, obj){
			this.types[name] = obj;
		}
	};
	
	var imgReg = /\.jpg$|\.jpeg$|\.gif$|\.png$/i;
	
	$.createUrlIndex.mmContent.add('img', {
		filter: function(url, opener, urlPart, type){
			if(type[1][0] === 'image' || opener.is('.img, .image, .picture')){
				return true;
			}
			return (imgReg.test(urlPart));
		},
		load: function(url, opener, ui, fn){
			var inst = ui.instance || ui;
			$.imgPreLoad.loadNow(url, 
				function loadImg(e){
					var imgWidth 	= this.width,
						jElm 		= $(this)
					;
					
					if(ui.extras){
						ui.extras.mm = jElm;
					}
					inst.content = {
						'multimedia-box': jElm
					};
					fn(url, imgWidth);
					
				}
			);
		}
	});
})(jQuery);

    /**
 * @author alexander.farkas
 */
(function($){
	$.addOuterDimensions = function(jElm, dim, dir){
		var adds = (dir === 'height') ? ['Top', 'Bottom'] : ['Left', 'Right'];
		$.each(['padding', 'border', 'margin'], function(i, css){
			if(css !== 'border'){
				dim += parseInt( jElm.css(css + adds[0]), 10) || 0;
				dim += parseInt( jElm.css(css + adds[1]), 10) || 0;
			} else {
				dim += parseInt( jElm.css(css + adds[0] +'Width'), 10) || 0;
				dim += parseInt( jElm.css(css + adds[1] +'Width'), 10) || 0;
			}
		});
		return dim;
	};
	
	function addFollowScroll(overlay, ui){
		var o 	= ui.options,
			doc = $(document),
			timer
		;
		if(o.followScroll){
			$(window).bind('scroll.'+ this.id +' resize.'+ this.id, function(e){
				if($(window).height() - 20 > overlay.outerHeight(true) + overlay.offset().top - $.SCROLLROOT.scrollTop()){
					clearTimeout(timer);
					timer = setTimeout(function(){
						overlay.animate({top: doc.scrollTop()});
					}, 400);
				}
			});
		}
	}
		
	$.ui.cOverlay.posMethods.centerHorizontalView = function(overlay, e, extra, ui){
		var o 	= ui.options,
			doc = $(document),
			pos
		;
		
		if(!$.objScale){
			setTimeout(function(){
				throw('please install the objScale plugin');
			},0);
			return {};
		}
		
		pos = $.objScale.centerObjTo(overlay, $(window), o.positionOpts);
		pos.top = doc.scrollTop();
		
		if(isFinite(o.marginTop)){
			pos.top += o.marginTop;
		}
		
		pos.left += doc.scrollLeft();
		addFollowScroll(overlay, ui);
		return pos;
	};
	
	$.ui.cOverlay.posMethods.constrainInsideView = function(overlay, e, extra, ui){
		var o 			= ui.options,
			doc 		= $(document),
			imgDim		= {},
			dim 		= {},
			pos
		;
		
		if(!$.objScale){
			setTimeout(function(){
				throw('please install the objScale plugin');
			},0);
			return {};
		}
		
		pos = $.objScale.constrainObjTo(overlay, $(window), o.positionOpts);
		$.swap(overlay[0], { position: "absolute", visibility: "hidden", display:"block" }, function(){
			imgDim = $.objScale.getDim(extra.mm);
		});
		
		pos.top += doc.scrollTop();
		pos.left += doc.scrollLeft();
		
		dim.width = imgDim.width + pos.widthSubtraction;
		dim.height = imgDim.height + pos.heightSubtraction;
		if(extra.mm.css && extra.mm.attr && extra.mm[0] && !$.nodeName(extra.mm[0], 'object')){
			extra.mm.css(dim).attr(dim);
		}
		delete pos.widthSubtraction;
		delete pos.heightSubtraction;
		addFollowScroll(overlay, ui);
		return pos;
	};
	
	$.ui.cOverlay.posMethods.constrainHorizontalView = function(overlay, e, extra, ui){
		var o 	= ui.options,
			pos = $.ui.cOverlay.posMethods.constrainInsideView(overlay, e, extra, ui)
		;
		pos.top = $(document).scrollTop();
		return pos;
	};
	$.fn.showbox = function(opts){
		opts = $.extend({}, $.fn.showbox.defaults, opts);
		opts.openerSel = this;
		var lightbox = $(opts.structure)
			.appendTo('body')
			.bind('coverlayinit', function(e, ui){
				
				var inst 	= ui.instance,
					o 		= inst.options
				;
				
				$.createUrlIndex(inst.openers, inst);
				
				inst.widthElement = (inst.element.is(o.widthElementSel)) ? inst.element : $(inst.options.widthElementSel, inst.element);
				
				inst.calcWidth = function(img, initialWidth){
					var width 	= initialWidth || img[0].width,
						elem 	= img
					;
					if(width == 'auto'){
						return width;
					}
					if (!width) {
						return false;
					}
					while(!elem.is(o.widthElementSel) && elem[0]){
						width = $.addOuterDimensions(elem, width, 'width');
						elem = elem.parent();
					}
					return width;
				};
				
			})
			.bind('coverlaybeforeshow', function(e, ui){
				if(!ui.extras.mm){
					var inst 	= ui.instance, 
						url 	= ui.extras.opener.attr('href'),
						urlPart = url.split('?')[0],
						type 	= ui.extras.opener.attr('type') || ''
					;
					type = [type, type.split('/')];
					inst.mask.addClass('loading-mask').mask('show');
					
					$.each($.createUrlIndex.mmContent.types, function(name, mmHanlder){
						if(mmHanlder.filter(url, inst.currentOpener, urlPart, type)){
							mmHanlder.load(url, inst.currentOpener, ui, function(url, width){
								
								inst.options.getTextContent(inst.currentOpener, inst.content, inst);
								
								inst.fillContent();
								
								width = inst.calcWidth(ui.extras.mm, width);
								if(width){
									inst.widthElement.css({
										width: width
									});
								}
								
								inst.stopShow = false;
								inst.updateIndex(url);
								
								inst.show(e, ui.extras);
								
								inst._trigger('indexchange', e, {oldAnchor: null, index: inst.currentIndex, opener: inst.currentOpener, content: inst.content});
								inst.mask.removeClass('loading-mask');
							});
							return false;
						}
						return undefined;
					});
					
					inst.stopShow = true;
				}
			})
			.bind('coverlayshow', function(e, ui){
				var inst = ui.instance;
				if(inst.options.slideShowAutostart){
					inst.play(true);
				}
			})
			.bind('coverlayhide', function(e, ui){
				ui.instance.pause();
				$('div.content-box', ui.element).removeAttr('aria-live').removeAttr('aria-busy');
			})
			.cOverlay(opts);
		
		return (opts.returnOverlay) ? lightbox : this;
	};
	
	$.fn.showbox.defaults = {
		returnOverlay: false,
		mask: true,
		maskOpts: {
			fadeInTime: 600
		},
		focusOnShow: 'h1.showbox-title',
		addRole: 'dialog',
		positionType: 'centerHorizontalView',
		followScroll: true,
		widthElementSel: '.content-box',
		structure: '<div class="showbox">' +
						'<div class="showbox-box">'+
							'<div class="showbox-head">'+
								'<h1 class="showbox-title"></h1>'+
								'<span class="showbox-toolbar">'+ 
									'<a role="button" class="prev" href="#" /> <a role="button" class="next" href="#" />'+
									' <a class="play-pause" role="button" href="#" />'+ 
									' <span class="index-pagination"><span class="current-index" /> / <span class="item-length" /></span>'+
								'</span>'+
							'</div>'+
							'<div class="content-box"><div class="multimedia-box"></div><div class="text-content"></div></div>'+
							' <a role="button" class="close-button" href="#"></a>'+
						'</div>'+
					'</div>',
		getTextContent: function(opener, content, ui){
			content['text-content'] = opener.attr('title');
		},
		addKeyNav: true,
		addLiveRegion: true,
		showContentAnim: function(ui, img, e, extras){
			var contentBox 	= $('div.content-box', ui.element);
			
			contentBox
				.queue(function(){
					ui.fillContent();
					
					ui.widthElement.css({width: ui.calcWidth(img)});
					
					contentBox.fadeTo(300, 1);
					contentBox.dequeue();
				});
		},
		hideContentAnim: function(ui){
			var contentBox = $('div.content-box', ui.element);
			contentBox.fadeTo(300, 0);
		},
		controlsWrapper: '.showbox-toolbar', // versteckt toolar wenn nur ein Bild - optionen: false 
		slideShowAutostart: false,
		slideshowDelay: 4000,
		playTitle: '',  // title text play button 
		playText: 'play',
		pauseText: 'pause',
		pauseTitle: '' // title text Pause button 
	};
})(jQuery);
    /**
 * @author alexander.farkas
 */
(function($){
	
	var isLocal = ( (location.protocol.indexOf('file') === 0) || location.href.indexOf('://127.0.0.1') !== -1 || location.href.indexOf('://localhost'));
	
	$.widget('aperto.simpleMenu', {
		options: {
            debug: false,
			inOutOpts: {
				mouseDelay: 100
			},
			
			menuSel: 'div.menu',
			menuItemSel: '> a, > strong', //
			addKeyNav: true,
			visibleClass: 'menu-visible',
			activateDelay: 300,
			
			showHiddenOnFocus: false,
			
			constrainHorizontal: false,
			constrainStyle: 'left',
			positionTop: false,
			
			
			
			closeOnItemLeave: true, // false funktioniert nur bei einfacher verschachtelung
			closeOnMenuLeave: false,
			initialOpenSel: '.ui-menu-visible', // Selector gilt nur für 1. Verschachtelung
			restoreInitialStateOnLeave: false, // true funktioniert nur für 1. Verachtelung
			
			
			nestedMenu: false
		},
		_create: function(){
			
			var o 			= this.options,
				that 		= this,
				firstUL 	= (this.element.is('ul, ol')) ? 
								this.element : 
								$('ul, ol', this.element).filter(':first') 
			;
			
			if( isLocal && !o.nestedMenu && this.element.parents(':aperto-simpleMenu').length ){
				alert('Are you sure you want to create multiple nested megamenus. Check your selector.');
			}
			
			this.timer = $.createTimer(this);
			
			this.mainItems = $('> li', firstUL[0]);
			
			this.menuItems = [];
			this.menus 	= [];
			
			function initItems(){
				var menu = $(o.menuSel, this), jElm;		
				if(menu[0]){
					jElm = $(this);
					jElm = jElm.addClass('has-menu');
					that.menuItems.push(this);
					that.menus.push(menu[0]);
					return menu;
				}
				return false;
			}
			
			function over(e){
				that.show($(this), e);
			}
				
			function out(e){
                if(o.debug){return;}
				if(o.closeOnItemLeave){
					that.hide($(this), e);
				}
			}
			
			this.initialOpenItem = $([]);
			
			this.mainItems.each(function(i){
				var menu 	= initItems.call(this), 
					jElm	= $(this),
					toText 	= '',
					nextLi, 
					fromText, 
					toElem, 
					skipLink
				;
				
				if(menu){
					if(o.initialOpenSel && jElm.is(o.initialOpenSel)){
						that.initialOpenItem = jElm.addClass(o.visibleClass);
					}
					$('li', this).each(initItems);
				}
			});
			
			that.currentOpenItem = that.initialOpenItem;
			firstUL.context = firstUL.parent()[0];
			firstUL.selector = '> ul, > ol';
			
			if(o.restoreInitialStateOnLeave && this.initialOpenItem[0]){
				firstUL.inOut(function(){
					that.timer.clear('openTimer');
				}, function(e){
					that.timer.setDelay('openTimer', function(){
						that.show(that.initialOpenItem, e);
					}, 1);
				}, o.inOutOpts);
			} else if(!o.closeOnItemLeave && o.closeOnMenuLeave){
				firstUL.inOut(function(){
					that.timer.clear('openTimer');
				}, function(e){
					that.timer.setDelay('openTimer', function(){
						if(that.currentOpenItem && that.currentOpenItem[0]){
							that.hide(that.currentOpenItem, e);
						}
					}, 1);
				}, o.inOutOpts);
			}
			
			if(o.addKeyNav){
				this.mainItems.bind('keydown', function(e){
					if($(e.target).is(':input')){return undefined;}
					var ret;
					if($.ui.keyCode.LEFT === e.keyCode){
						ret = that.focusIndex(that.mainItems.index(this) - 1);
					} else if($.ui.keyCode.RIGHT === e.keyCode){
						ret = that.focusIndex(that.mainItems.index(this) + 1);
					}
					
					return ret;
				});
			}
			this.element
				.inOut(
					$.proxy(this, 'activateMenu'),
					$.proxy(this, 'inactivateMenu'),
					{
						mouseDelay: o.activateDelay,
						keyDelay: 0
					}
				)
			;
				
			this.menuItems = $(this.menuItems);
			this.menuItems.context = firstUL[0];
			this.menuItems.selector = '.has-menu';
			this.menuItems.inOut(over, out, o.inOutOpts);
			
			this.menuItems
				[o.inOutOpts.bindStyle || 'bind']('mouseleave mouseenter focusin focusout', function(){
					that.timer.clear('openTimer');
				})
			;
			
			this.menus = $(this.menus);
			this._trigger('init', {}, this.ui());
			
			
		},
		focusIndex: function(index){
			var focusItem = this.mainItems.get(index);
			if(focusItem){
				$(this.options.menuItemSel, focusItem).setFocus();
				return false;
			}
			return undefined;
		},
		ui: function(){
			return {
				instance: this,
				menuItems: this.menuItems,
				menus: this.menus,
				element: this.element
			};
		},
		constrainRight: function(menu){
			var offset = (this.element.offset().left + this.element.width()) - (menu.offset().left + menu.width());
			if(offset < 0){
				menu.css(this.options.constrainStyle, offset);
			}
		},
		activateMenu: function(){
			this.isActivated = true;
			if(this.showOnActivate && this.showOnActivate[0]){
				this.show(this.showOnActivate, {type: 'activated'});
			}
			this.showOnActivate = false;
		},
		inactivateMenu: function(){
			this.isActivated = false;
			this.showOnActivate = false;
		},
		show: function(menuItem, e){
			this.timer.clear('openTimer');
			e = e || {type: 'show'};
			var o 			= this.options,
				menu 		= $(o.menuSel +':first', menuItem)
			;
			if(menuItem.hasClass(o.visibleClass)){return;}
			
			if(!$.aperto.simpleMenu.shouldReactOnFocus(e, menu, o)){
				return false;
			}
			if(!this.isActivated){
				this.showOnActivate = menuItem;
				return;
			}
			if($.inArray(menuItem[0], this.mainItems) > -1){
				if((!o.closeOnItemLeave || o.restoreInitialStateOnLeave) && this.currentOpenItem && this.currentOpenItem[0]){
					this.hide(this.currentOpenItem, e);
				}
				this.currentOpenItem = menuItem;
			}
			
			if( o.positionTop !== false && isFinite(o.positionTop) ){
				menu.css({
					top: menu.offsetParent().outerHeight() + o.positionTop
				});
			}
			
			this._trigger('show', e, $.extend({}, this.ui(), {menuItem: menuItem, menu: menu}));
			menuItem.addClass(o.visibleClass);
			if(o.constrainHorizontal){
				this.constrainRight(menu);
			}
			
			return undefined;
		},
		hide: function(menuItem, e){
			e = e || {type: 'hide'};
			var o 		= this.options,
				that 	=	this,
				menu 	= $(o.menuSel +':first', menuItem)
			;
			
			if(!menuItem.hasClass(o.visibleClass)){
				if(this.showOnActivate && this.showOnActivate[0] === menuItem[0]){
					this.showOnActivate = false;
					return;
				}
				return;
			}
			this._trigger('hide', e, $.extend({}, this.ui(), {menuItem: menuItem, menu: menu}));
			
			menuItem.removeClass(o.visibleClass);
			if($.inArray(menuItem[0], this.mainItems) > -1){
				this.currentOpenItem = $([]);
			}
		},
		hideAll: function(e) {
			var that		= this;
			e = e || {type: 'hideAll'};
			
			this
				.menuItems
				.filter('.'+this.option('visibleClass'))
				.each(function(){
					that.hide($(this), e);
			});
		}
	});
	
	$.aperto.simpleMenu.shouldReactOnFocus = function(e, menu, o){
		return !!(!e || !(!o.showHiddenOnFocus && 
					e.originalEvent && e.originalEvent.type &&
					e.originalEvent.type.indexOf('focus') !== -1 && 
					menu.css('display') === 'none'));
	};
	
})(jQuery);
    
(function($)
{$.fn.qtip=function(options,blanket)
{var i,id,interfaces,opts,obj,command,config,api;if(typeof options=='string')
{if(typeof $(this).data('qtip')!=='object')
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.NO_TOOLTIP_PRESENT,false);if(options=='api')
return $(this).data('qtip').interfaces[$(this).data('qtip').current];else if(options=='interfaces')
return $(this).data('qtip').interfaces;}
else
{if(!options)options={};if(typeof options.content!=='object'||(options.content.jquery&&options.content.length>0))options.content={text:options.content};if(typeof options.content.title!=='object')options.content.title={text:options.content.title};if(typeof options.position!=='object')options.position={corner:options.position};if(typeof options.position.corner!=='object')options.position.corner={target:options.position.corner,tooltip:options.position.corner};if(typeof options.show!=='object')options.show={when:options.show};if(typeof options.show.when!=='object')options.show.when={event:options.show.when};if(typeof options.show.effect!=='object')options.show.effect={type:options.show.effect};if(typeof options.hide!=='object')options.hide={when:options.hide};if(typeof options.hide.when!=='object')options.hide.when={event:options.hide.when};if(typeof options.hide.effect!=='object')options.hide.effect={type:options.hide.effect};if(typeof options.style!=='object')options.style={name:options.style};options.style=sanitizeStyle(options.style);opts=$.extend(true,{},$.fn.qtip.defaults,options);opts.style=buildStyle.call({options:opts},opts.style);opts.user=$.extend(true,{},options);};return $(this).each(function()
{if(typeof options=='string')
{command=options.toLowerCase();interfaces=$(this).qtip('interfaces');if(typeof interfaces=='object')
{if(blanket===true&&command=='destroy')
while(interfaces.length>0)interfaces[interfaces.length-1].destroy();else
{if(blanket!==true)interfaces=[$(this).qtip('api')];for(i=0;i<interfaces.length;i++)
{if(command=='destroy')interfaces[i].destroy();else if(interfaces[i].status.rendered===true)
{if(command=='show')interfaces[i].show();else if(command=='hide')interfaces[i].hide();else if(command=='focus')interfaces[i].focus();else if(command=='disable')interfaces[i].disable(true);else if(command=='enable')interfaces[i].disable(false);};};};};}
else
{config=$.extend(true,{},opts);config.hide.effect.length=opts.hide.effect.length;config.show.effect.length=opts.show.effect.length;if(config.position.container===false)config.position.container=$(document.body);if(config.position.target===false)config.position.target=$(this);if(config.show.when.target===false)config.show.when.target=$(this);if(config.hide.when.target===false)config.hide.when.target=$(this);id=$.fn.qtip.interfaces.length;for(i=0;i<id;i++)
{if(typeof $.fn.qtip.interfaces[i]=='undefined'){id=i;break;};};obj=new qTip($(this),config,id);$.fn.qtip.interfaces[id]=obj;if(typeof $(this).data('qtip')=='object')
{if(typeof $(this).attr('qtip')==='undefined')
$(this).data('qtip').current=$(this).data('qtip').interfaces.length;$(this).data('qtip').interfaces.push(obj);}
else $(this).data('qtip',{current:0,interfaces:[obj]});if(config.content.prerender===false&&config.show.when.event!==false&&config.show.ready!==true)
{config.show.when.target.bind(config.show.when.event+'.qtip-'+id+'-create',{qtip:id},function(event)
{api=$.fn.qtip.interfaces[event.data.qtip];api.options.show.when.target.unbind(api.options.show.when.event+'.qtip-'+event.data.qtip+'-create');api.cache.mouse={x:event.pageX,y:event.pageY};construct.call(api);api.options.show.when.target.trigger(api.options.show.when.event);});}
else
{obj.cache.mouse={x:config.show.when.target.offset().left,y:config.show.when.target.offset().top};construct.call(obj);}};});};function qTip(target,options,id)
{var self=this;self.id=id;self.options=options;self.status={animated:false,rendered:false,disabled:false,focused:false};self.elements={target:target.addClass(self.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};self.cache={mouse:{},position:{},toggle:0};self.timers={};$.extend(self,self.options.api,{show:function(event)
{var returned,solo;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'show');if(self.elements.tooltip.css('display')!=='none')return self;self.elements.tooltip.stop(true,false);returned=self.beforeShow.call(self,event);if(returned===false)return self;function afterShow()
{if(self.options.position.type!=='static')self.focus();self.onShow.call(self,event);if($.browser.msie)self.elements.tooltip.get(0).style.removeAttribute('filter');};self.cache.toggle=1;if(self.options.position.type!=='static')
self.updatePosition(event,(self.options.show.effect.length>0));if(typeof self.options.show.solo=='object')solo=$(self.options.show.solo);else if(self.options.show.solo===true)solo=$('div.qtip').not(self.elements.tooltip);if(solo)solo.each(function(){if($(this).qtip('api').status.rendered===true)$(this).qtip('api').hide();});if(typeof self.options.show.effect.type=='function')
{self.options.show.effect.type.call(self.elements.tooltip,self.options.show.effect.length);self.elements.tooltip.queue(function(){afterShow();$(this).dequeue();});}
else
{switch(self.options.show.effect.type.toLowerCase())
{case'fade':self.elements.tooltip.fadeIn(self.options.show.effect.length,afterShow);break;case'slide':self.elements.tooltip.slideDown(self.options.show.effect.length,function()
{afterShow();if(self.options.position.type!=='static')self.updatePosition(event,true);});break;case'grow':self.elements.tooltip.show(self.options.show.effect.length,afterShow);break;default:self.elements.tooltip.show(null,afterShow);break;};self.elements.tooltip.addClass(self.options.style.classes.active);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_SHOWN,'show');},hide:function(event)
{var returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'hide');else if(self.elements.tooltip.css('display')==='none')return self;clearTimeout(self.timers.show);self.elements.tooltip.stop(true,false);returned=self.beforeHide.call(self,event);if(returned===false)return self;function afterHide(){self.onHide.call(self,event);};self.cache.toggle=0;if(typeof self.options.hide.effect.type=='function')
{self.options.hide.effect.type.call(self.elements.tooltip,self.options.hide.effect.length);self.elements.tooltip.queue(function(){afterHide();$(this).dequeue();});}
else
{switch(self.options.hide.effect.type.toLowerCase())
{case'fade':self.elements.tooltip.fadeOut(self.options.hide.effect.length,afterHide);break;case'slide':self.elements.tooltip.slideUp(self.options.hide.effect.length,afterHide);break;case'grow':self.elements.tooltip.hide(self.options.hide.effect.length,afterHide);break;default:self.elements.tooltip.hide(null,afterHide);break;};self.elements.tooltip.removeClass(self.options.style.classes.active);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_HIDDEN,'hide');},updatePosition:function(event,animate)
{var i,target,tooltip,coords,mapName,imagePos,newPosition,ieAdjust,ie6Adjust,borderAdjust,mouseAdjust,offset,curPosition,returned
if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updatePosition');else if(self.options.position.type=='static')
return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.CANNOT_POSITION_STATIC,'updatePosition');target={position:{left:0,top:0},dimensions:{height:0,width:0},corner:self.options.position.corner.target};tooltip={position:self.getPosition(),dimensions:self.getDimensions(),corner:self.options.position.corner.tooltip};if(self.options.position.target!=='mouse')
{if(self.options.position.target.get(0).nodeName.toLowerCase()=='area')
{coords=self.options.position.target.attr('coords').split(',');for(i=0;i<coords.length;i++)coords[i]=parseInt(coords[i]);mapName=self.options.position.target.parent('map').attr('name');imagePos=$('img[usemap="#'+mapName+'"]:first').offset();target.position={left:Math.floor(imagePos.left+coords[0]),top:Math.floor(imagePos.top+coords[1])};switch(self.options.position.target.attr('shape').toLowerCase())
{case'rect':target.dimensions={width:Math.ceil(Math.abs(coords[2]-coords[0])),height:Math.ceil(Math.abs(coords[3]-coords[1]))};break;case'circle':target.dimensions={width:coords[2]+1,height:coords[2]+1};break;case'poly':target.dimensions={width:coords[0],height:coords[1]};for(i=0;i<coords.length;i++)
{if(i%2==0)
{if(coords[i]>target.dimensions.width)
target.dimensions.width=coords[i];if(coords[i]<coords[0])
target.position.left=Math.floor(imagePos.left+coords[i]);}
else
{if(coords[i]>target.dimensions.height)
target.dimensions.height=coords[i];if(coords[i]<coords[1])
target.position.top=Math.floor(imagePos.top+coords[i]);};};target.dimensions.width=target.dimensions.width-(target.position.left-imagePos.left);target.dimensions.height=target.dimensions.height-(target.position.top-imagePos.top);break;default:return $.fn.qtip.log.error.call(self,4,$.fn.qtip.constants.INVALID_AREA_SHAPE,'updatePosition');break;};target.dimensions.width-=2;target.dimensions.height-=2;}
else if(self.options.position.target.add(document.body).length===1)
{target.position={left:$(document).scrollLeft(),top:$(document).scrollTop()};target.dimensions={height:$(window).height(),width:$(window).width()};}
else
{if(typeof self.options.position.target.attr('qtip')!=='undefined')
target.position=self.options.position.target.qtip('api').cache.position;else
target.position=self.options.position.target.offset();target.dimensions={height:self.options.position.target.outerHeight(),width:self.options.position.target.outerWidth()};};newPosition=$.extend({},target.position);if(target.corner.search(/right/i)!==-1)
newPosition.left+=target.dimensions.width;if(target.corner.search(/bottom/i)!==-1)
newPosition.top+=target.dimensions.height;if(target.corner.search(/((top|bottom)Middle)|center/)!==-1)
newPosition.left+=(target.dimensions.width/2);if(target.corner.search(/((left|right)Middle)|center/)!==-1)
newPosition.top+=(target.dimensions.height/2);}
else
{target.position=newPosition={left:self.cache.mouse.x,top:self.cache.mouse.y};target.dimensions={height:1,width:1};};if(tooltip.corner.search(/right/i)!==-1)
newPosition.left-=tooltip.dimensions.width;if(tooltip.corner.search(/bottom/i)!==-1)
newPosition.top-=tooltip.dimensions.height;if(tooltip.corner.search(/((top|bottom)Middle)|center/)!==-1)
newPosition.left-=(tooltip.dimensions.width/2);if(tooltip.corner.search(/((left|right)Middle)|center/)!==-1)
newPosition.top-=(tooltip.dimensions.height/2);ieAdjust=($.browser.msie)?1:0;ie6Adjust=($.browser.msie&&parseInt($.browser.version.charAt(0))===6)?1:0;if(self.options.style.border.radius>0)
{if(tooltip.corner.search(/Left/)!==-1)
newPosition.left-=self.options.style.border.radius;else if(tooltip.corner.search(/Right/)!==-1)
newPosition.left+=self.options.style.border.radius;if(tooltip.corner.search(/Top/)!==-1)
newPosition.top-=self.options.style.border.radius;else if(tooltip.corner.search(/Bottom/)!==-1)
newPosition.top+=self.options.style.border.radius;};if(ieAdjust)
{if(tooltip.corner.search(/top/)!==-1)
newPosition.top-=ieAdjust
else if(tooltip.corner.search(/bottom/)!==-1)
newPosition.top+=ieAdjust
if(tooltip.corner.search(/left/)!==-1)
newPosition.left-=ieAdjust
else if(tooltip.corner.search(/right/)!==-1)
newPosition.left+=ieAdjust
if(tooltip.corner.search(/leftMiddle|rightMiddle/)!==-1)
newPosition.top-=1};if(self.options.position.adjust.screen===true)
newPosition=screenAdjust.call(self,newPosition,target,tooltip);if(self.options.position.target==='mouse'&&self.options.position.adjust.mouse===true)
{if(self.options.position.adjust.screen===true&&self.elements.tip)
mouseAdjust=self.elements.tip.attr('rel');else
mouseAdjust=self.options.position.corner.tooltip;newPosition.left+=(mouseAdjust.search(/right/i)!==-1)?-6:6;newPosition.top+=(mouseAdjust.search(/bottom/i)!==-1)?-6:6;}
if(!self.elements.bgiframe&&$.browser.msie&&parseInt($.browser.version.charAt(0))==6)
{$('select, object').each(function()
{offset=$(this).offset();offset.bottom=offset.top+$(this).height();offset.right=offset.left+$(this).width();if(newPosition.top+tooltip.dimensions.height>=offset.top&&newPosition.left+tooltip.dimensions.width>=offset.left)
bgiframe.call(self);});};newPosition.left+=self.options.position.adjust.x;newPosition.top+=self.options.position.adjust.y;curPosition=self.getPosition();if(newPosition.left!=curPosition.left||newPosition.top!=curPosition.top)
{returned=self.beforePositionUpdate.call(self,event);if(returned===false)return self;self.cache.position=newPosition;if(animate===true)
{self.status.animated=true;self.elements.tooltip.animate(newPosition,200,'swing',function(){self.status.animated=false});}
else self.elements.tooltip.css(newPosition);self.onPositionUpdate.call(self,event);if(typeof event!=='undefined'&&event.type&&event.type!=='mousemove')
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_POSITION_UPDATED,'updatePosition');};return self;},updateWidth:function(newWidth)
{var hidden;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateWidth');else if(newWidth&&typeof newWidth!=='number')
return $.fn.qtip.log.error.call(self,2,'newWidth must be of type number','updateWidth');hidden=self.elements.contentWrapper.siblings().add(self.elements.tip).add(self.elements.button);if(!newWidth)
{if(typeof self.options.style.width.value=='number')
newWidth=self.options.style.width.value;else
{self.elements.tooltip.css({width:'auto'});hidden.hide();if($.browser.msie)
self.elements.wrapper.add(self.elements.contentWrapper.children()).css({zoom:'normal'});newWidth=self.getDimensions().width+1;if(!self.options.style.width.value)
{if(newWidth>self.options.style.width.max)newWidth=self.options.style.width.max
if(newWidth<self.options.style.width.min)newWidth=self.options.style.width.min};};};if(newWidth%2!==0)newWidth-=1;self.elements.tooltip.width(newWidth);hidden.show();if(self.options.style.border.radius)
{self.elements.tooltip.find('.qtip-betweenCorners').each(function(i)
{$(this).width(newWidth-(self.options.style.border.radius*2));})};if($.browser.msie)
{self.elements.wrapper.add(self.elements.contentWrapper.children()).css({zoom:'1'});self.elements.wrapper.width(newWidth);if(self.elements.bgiframe)self.elements.bgiframe.width(newWidth).height(self.getDimensions.height);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_WIDTH_UPDATED,'updateWidth');},updateStyle:function(name)
{var tip,borders,context,corner,coordinates;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateStyle');else if(typeof name!=='string'||!$.fn.qtip.styles[name])
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.STYLE_NOT_DEFINED,'updateStyle');self.options.style=buildStyle.call(self,$.fn.qtip.styles[name],self.options.user.style);self.elements.content.css(jQueryStyle(self.options.style));if(self.options.content.title.text!==false)
self.elements.title.css(jQueryStyle(self.options.style.title,true));self.elements.contentWrapper.css({borderColor:self.options.style.border.color});if(self.options.style.tip.corner!==false)
{if($('<canvas>').get(0).getContext)
{tip=self.elements.tooltip.find('.qtip-tip canvas:first');context=tip.get(0).getContext('2d');context.clearRect(0,0,300,300);corner=tip.parent('div[rel]:first').attr('rel');coordinates=calculateTip(corner,self.options.style.tip.size.width,self.options.style.tip.size.height);drawTip.call(self,tip,coordinates,self.options.style.tip.color||self.options.style.border.color);}
else if($.browser.msie)
{tip=self.elements.tooltip.find('.qtip-tip [nodeName="shape"]');tip.attr('fillcolor',self.options.style.tip.color||self.options.style.border.color);};};if(self.options.style.border.radius>0)
{self.elements.tooltip.find('.qtip-betweenCorners').css({backgroundColor:self.options.style.border.color});if($('<canvas>').get(0).getContext)
{borders=calculateBorders(self.options.style.border.radius)
self.elements.tooltip.find('.qtip-wrapper canvas').each(function()
{context=$(this).get(0).getContext('2d');context.clearRect(0,0,300,300);corner=$(this).parent('div[rel]:first').attr('rel')
drawBorder.call(self,$(this),borders[corner],self.options.style.border.radius,self.options.style.border.color);});}
else if($.browser.msie)
{self.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function()
{$(this).attr('fillcolor',self.options.style.border.color)});};};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_STYLE_UPDATED,'updateStyle');},updateContent:function(content,reposition)
{var parsedContent,images,loadedImages;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateContent');else if(!content)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateContent');parsedContent=self.beforeContentUpdate.call(self,content);if(typeof parsedContent=='string')content=parsedContent;else if(parsedContent===false)return;if($.browser.msie)self.elements.contentWrapper.children().css({zoom:'normal'});if(content.jquery&&content.length>0)
content.clone(true).appendTo(self.elements.content).show();else self.elements.content.html(content);images=self.elements.content.find('img[complete=false]');if(images.length>0)
{loadedImages=0;images.each(function(i)
{$('<img src="'+$(this).attr('src')+'" />').load(function(){if(++loadedImages==images.length)afterLoad();});});}
else afterLoad();function afterLoad()
{self.updateWidth();if(reposition!==false)
{if(self.options.position.type!=='static')
self.updatePosition(self.elements.tooltip.is(':visible'),true);if(self.options.style.tip.corner!==false)
positionTip.call(self);};};self.onContentUpdate.call(self);return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_CONTENT_UPDATED,'loadContent');},loadContent:function(url,data,method)
{var returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'loadContent');returned=self.beforeContentLoad.call(self);if(returned===false)return self;if(method=='post')
$.post(url,data,setupContent);else
$.get(url,data,setupContent);function setupContent(content)
{self.onContentLoad.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_CONTENT_LOADED,'loadContent');self.updateContent(content);};return self;},updateTitle:function(content)
{if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateTitle');else if(!content)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateTitle');returned=self.beforeTitleUpdate.call(self);if(returned===false)return self;if(self.elements.button)self.elements.button=self.elements.button.clone(true);self.elements.title.html(content)
if(self.elements.button)self.elements.title.prepend(self.elements.button);self.onTitleUpdate.call(self);return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_TITLE_UPDATED,'updateTitle');},focus:function(event)
{var curIndex,newIndex,elemIndex,returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'focus');else if(self.options.position.type=='static')
return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.CANNOT_FOCUS_STATIC,'focus');curIndex=parseInt(self.elements.tooltip.css('z-index'));newIndex=6000+$('div.qtip[qtip]').length-1;if(!self.status.focused&&curIndex!==newIndex)
{returned=self.beforeFocus.call(self,event);if(returned===false)return self;$('div.qtip[qtip]').not(self.elements.tooltip).each(function()
{if($(this).qtip('api').status.rendered===true)
{elemIndex=parseInt($(this).css('z-index'));if(typeof elemIndex=='number'&&elemIndex>-1)
$(this).css({zIndex:parseInt($(this).css('z-index'))-1});$(this).qtip('api').status.focused=false;}})
self.elements.tooltip.css({zIndex:newIndex});self.status.focused=true;self.onFocus.call(self,event);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_FOCUSED,'focus');};return self;},disable:function(state)
{if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'disable');if(state)
{if(!self.status.disabled)
{self.status.disabled=true;$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_DISABLED,'disable');}
else $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,'disable');}
else
{if(self.status.disabled)
{self.status.disabled=false;$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_ENABLED,'disable');}
else $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,'disable');};return self;},destroy:function()
{var i,returned,interfaces;returned=self.beforeDestroy.call(self);if(returned===false)return self;if(self.status.rendered)
{self.options.show.when.target.unbind('mousemove.qtip',self.updatePosition);self.options.show.when.target.unbind('mouseout.qtip',self.hide);self.options.show.when.target.unbind(self.options.show.when.event+'.qtip');self.options.hide.when.target.unbind(self.options.hide.when.event+'.qtip');self.elements.tooltip.unbind(self.options.hide.when.event+'.qtip');self.elements.tooltip.unbind('mouseover.qtip',self.focus);self.elements.tooltip.remove();}
else self.options.show.when.target.unbind(self.options.show.when.event+'.qtip-create');if(typeof self.elements.target.data('qtip')=='object')
{interfaces=self.elements.target.data('qtip').interfaces;if(typeof interfaces=='object'&&interfaces.length>0)
{for(i=0;i<interfaces.length-1;i++)
if(interfaces[i].id==self.id)interfaces.splice(i,1)}}
delete $.fn.qtip.interfaces[self.id];if(typeof interfaces=='object'&&interfaces.length>0)
self.elements.target.data('qtip').current=interfaces.length-1;else
self.elements.target.removeData('qtip');self.onDestroy.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_DESTROYED,'destroy');return self.elements.target},getPosition:function()
{var show,offset;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getPosition');show=(self.elements.tooltip.css('display')!=='none')?false:true;if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();offset=self.elements.tooltip.offset();if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();return offset;},getDimensions:function()
{var show,dimensions;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getDimensions');show=(!self.elements.tooltip.is(':visible'))?true:false;if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();dimensions={height:self.elements.tooltip.outerHeight(),width:self.elements.tooltip.outerWidth()};if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();return dimensions;}});};function construct()
{var self,adjust,content,url,data,method,tempLength;self=this;self.beforeRender.call(self);self.status.rendered=true;self.elements.tooltip='<div qtip="'+self.id+'" '+'class="qtip '+(self.options.style.classes.tooltip||self.options.style)+'"'+'style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;'+'position:'+self.options.position.type+';">'+'  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">'+'    <div class="qtip-contentWrapper" style="overflow:hidden;">'+'       <div class="qtip-content '+self.options.style.classes.content+'"></div>'+'</div></div></div>';self.elements.tooltip=$(self.elements.tooltip);self.elements.tooltip.appendTo(self.options.position.container)
self.elements.tooltip.data('qtip',{current:0,interfaces:[self]});self.elements.wrapper=self.elements.tooltip.children('div:first');self.elements.contentWrapper=self.elements.wrapper.children('div:first').css({background:self.options.style.background});self.elements.content=self.elements.contentWrapper.children('div:first').css(jQueryStyle(self.options.style));if($.browser.msie)self.elements.wrapper.add(self.elements.content).css({zoom:1});if(self.options.hide.when.event=='unfocus')self.elements.tooltip.attr('unfocus',true);if(typeof self.options.style.width.value=='number')self.updateWidth();if($('<canvas>').get(0).getContext||$.browser.msie)
{if(self.options.style.border.radius>0)
createBorder.call(self);else
self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});if(self.options.style.tip.corner!==false)
createTip.call(self);}
else
{self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});self.options.style.border.radius=0;self.options.style.tip.corner=false;$.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,'render');};if((typeof self.options.content.text=='string'&&self.options.content.text.length>0)||(self.options.content.text.jquery&&self.options.content.text.length>0))
content=self.options.content.text;else if(typeof self.elements.target.attr('title')=='string'&&self.elements.target.attr('title').length>0)
{content=self.elements.target.attr('title').replace("\\n",'<br />');self.elements.target.attr('title','');}
else if(typeof self.elements.target.attr('alt')=='string'&&self.elements.target.attr('alt').length>0)
{content=self.elements.target.attr('alt').replace("\\n",'<br />');self.elements.target.attr('alt','');}
else
{content=' ';$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.NO_VALID_CONTENT,'render');};if(self.options.content.title.text!==false)createTitle.call(self);self.updateContent(content);assignEvents.call(self);if(self.options.show.ready===true)self.show();if(self.options.content.url!==false)
{url=self.options.content.url;data=self.options.content.data;method=self.options.content.method||'get';self.loadContent(url,data,method);};self.onRender.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_RENDERED,'render');};function createBorder()
{var self,i,width,radius,color,coordinates,containers,size,betweenWidth,betweenCorners,borderTop,borderBottom,borderCoord,sideWidth,vertWidth;self=this;self.elements.wrapper.find('.qtip-borderBottom, .qtip-borderTop').remove();width=self.options.style.border.width;radius=self.options.style.border.radius;color=self.options.style.border.color||self.options.style.tip.color;coordinates=calculateBorders(radius);containers={};for(i in coordinates)
{containers[i]='<div rel="'+i+'" style="'+((i.search(/Left/)!==-1)?'left':'right')+':0; '+'position:absolute; height:'+radius+'px; width:'+radius+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if($('<canvas>').get(0).getContext)
containers[i]+='<canvas height="'+radius+'" width="'+radius+'" style="vertical-align: top"></canvas>';else if($.browser.msie)
{size=radius*2+3;containers[i]+='<v:arc stroked="false" fillcolor="'+color+'" startangle="'+coordinates[i][0]+'" endangle="'+coordinates[i][1]+'" '+'style="width:'+size+'px; height:'+size+'px; margin-top:'+((i.search(/bottom/)!==-1)?-2:-1)+'px; '+'margin-left:'+((i.search(/Right/)!==-1)?coordinates[i][2]-3.5:-1)+'px; '+'vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>';};containers[i]+='</div>';};betweenWidth=self.getDimensions().width-(Math.max(width,radius)*2);betweenCorners='<div class="qtip-betweenCorners" style="height:'+radius+'px; width:'+betweenWidth+'px; '+'overflow:hidden; background-color:'+color+'; line-height:0.1px; font-size:1px;">';borderTop='<div class="qtip-borderTop" dir="ltr" style="height:'+radius+'px; '+'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">'+
containers['topLeft']+containers['topRight']+betweenCorners;self.elements.wrapper.prepend(borderTop);borderBottom='<div class="qtip-borderBottom" dir="ltr" style="height:'+radius+'px; '+'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">'+
containers['bottomLeft']+containers['bottomRight']+betweenCorners;self.elements.wrapper.append(borderBottom);if($('<canvas>').get(0).getContext)
{self.elements.wrapper.find('canvas').each(function()
{borderCoord=coordinates[$(this).parent('[rel]:first').attr('rel')];drawBorder.call(self,$(this),borderCoord,radius,color);})}
else if($.browser.msie)self.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>');sideWidth=Math.max(radius,(radius+(width-radius)))
vertWidth=Math.max(width-radius,0);self.elements.contentWrapper.css({border:'0px solid '+color,borderWidth:vertWidth+'px '+sideWidth+'px'})};function drawBorder(canvas,coordinates,radius,color)
{var context=canvas.get(0).getContext('2d');context.fillStyle=color;context.beginPath();context.arc(coordinates[0],coordinates[1],radius,0,Math.PI*2,false);context.fill();};function createTip(corner)
{var self,color,coordinates,coordsize,path;self=this;if(self.elements.tip!==null)self.elements.tip.remove();color=self.options.style.tip.color||self.options.style.border.color;if(self.options.style.tip.corner===false)return;else if(!corner)corner=self.options.style.tip.corner;coordinates=calculateTip(corner,self.options.style.tip.size.width,self.options.style.tip.size.height);self.elements.tip='<div class="'+self.options.style.classes.tip+'" dir="ltr" rel="'+corner+'" style="position:absolute; '+'height:'+self.options.style.tip.size.height+'px; width:'+self.options.style.tip.size.width+'px; '+'margin:0 auto; line-height:0.1px; font-size:1px;">';if($('<canvas>').get(0).getContext)
self.elements.tip+='<canvas height="'+self.options.style.tip.size.height+'" width="'+self.options.style.tip.size.width+'"></canvas>';else if($.browser.msie)
{coordsize=self.options.style.tip.size.width+','+self.options.style.tip.size.height;path='m'+coordinates[0][0]+','+coordinates[0][1];path+=' l'+coordinates[1][0]+','+coordinates[1][1];path+=' '+coordinates[2][0]+','+coordinates[2][1];path+=' xe';self.elements.tip+='<v:shape fillcolor="'+color+'" stroked="false" filled="true" path="'+path+'" coordsize="'+coordsize+'" '+'style="width:'+self.options.style.tip.size.width+'px; height:'+self.options.style.tip.size.height+'px; '+'line-height:0.1px; display:inline-block; behavior:url(#default#VML); '+'vertical-align:'+((corner.search(/top/)!==-1)?'bottom':'top')+'"></v:shape>';self.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';self.elements.contentWrapper.css('position','relative');};self.elements.tooltip.prepend(self.elements.tip+'</div>');self.elements.tip=self.elements.tooltip.find('.'+self.options.style.classes.tip).eq(0);if($('<canvas>').get(0).getContext)
drawTip.call(self,self.elements.tip.find('canvas:first'),coordinates,color);if(corner.search(/top/)!==-1&&$.browser.msie&&parseInt($.browser.version.charAt(0))===6)
self.elements.tip.css({marginTop:-4});positionTip.call(self,corner);};function drawTip(canvas,coordinates,color)
{var context=canvas.get(0).getContext('2d');context.fillStyle=color;context.beginPath();context.moveTo(coordinates[0][0],coordinates[0][1]);context.lineTo(coordinates[1][0],coordinates[1][1]);context.lineTo(coordinates[2][0],coordinates[2][1]);context.fill();};function positionTip(corner)
{var self,ieAdjust,paddingCorner,paddingSize,newMargin;self=this;if(self.options.style.tip.corner===false||!self.elements.tip)return;if(!corner)corner=self.elements.tip.attr('rel');ieAdjust=positionAdjust=($.browser.msie)?1:0;self.elements.tip.css(corner.match(/left|right|top|bottom/)[0],0);if(corner.search(/top|bottom/)!==-1)
{if($.browser.msie)
{if(parseInt($.browser.version.charAt(0))===6)
positionAdjust=(corner.search(/top/)!==-1)?-3:1;else
positionAdjust=(corner.search(/top/)!==-1)?1:2;};if(corner.search(/Middle/)!==-1)
self.elements.tip.css({left:'50%',marginLeft:-(self.options.style.tip.size.width/2)});else if(corner.search(/Left/)!==-1)
self.elements.tip.css({left:self.options.style.border.radius-ieAdjust});else if(corner.search(/Right/)!==-1)
self.elements.tip.css({right:self.options.style.border.radius+ieAdjust});if(corner.search(/top/)!==-1)
self.elements.tip.css({top:-positionAdjust});else
self.elements.tip.css({bottom:positionAdjust});}
else if(corner.search(/left|right/)!==-1)
{if($.browser.msie)
positionAdjust=(parseInt($.browser.version.charAt(0))===6)?1:((corner.search(/left/)!==-1)?1:2);if(corner.search(/Middle/)!==-1)
self.elements.tip.css({top:'50%',marginTop:-(self.options.style.tip.size.height/2)});else if(corner.search(/Top/)!==-1)
self.elements.tip.css({top:self.options.style.border.radius-ieAdjust});else if(corner.search(/Bottom/)!==-1)
self.elements.tip.css({bottom:self.options.style.border.radius+ieAdjust});if(corner.search(/left/)!==-1)
self.elements.tip.css({left:-positionAdjust});else
self.elements.tip.css({right:positionAdjust});};paddingCorner='padding-'+corner.match(/left|right|top|bottom/)[0];paddingSize=self.options.style.tip.size[(paddingCorner.search(/left|right/)!==-1)?'width':'height'];self.elements.tooltip.css('padding',0);self.elements.tooltip.css(paddingCorner,paddingSize);if($.browser.msie&&parseInt($.browser.version.charAt(0))==6)
{newMargin=parseInt(self.elements.tip.css('margin-top'))||0;newMargin+=parseInt(self.elements.content.css('margin-top'))||0;self.elements.tip.css({marginTop:newMargin});};};function createTitle()
{var self=this;if(self.elements.title!==null)self.elements.title.remove();self.elements.title=$('<div class="'+self.options.style.classes.title+'">').css(jQueryStyle(self.options.style.title,true)).css({zoom:($.browser.msie)?1:0}).prependTo(self.elements.contentWrapper);if(self.options.content.title.text)self.updateTitle.call(self,self.options.content.title.text);if(self.options.content.title.button!==false&&typeof self.options.content.title.button=='string')
{self.elements.button=$('<a class="'+self.options.style.classes.button+'" style="float:right; position: relative"></a>').css(jQueryStyle(self.options.style.button,true)).html(self.options.content.title.button).prependTo(self.elements.title).click(function(event){if(!self.status.disabled)self.hide(event)});};};function assignEvents()
{var self,showTarget,hideTarget,inactiveEvents;self=this;showTarget=self.options.show.when.target;hideTarget=self.options.hide.when.target;if(self.options.hide.fixed)hideTarget=hideTarget.add(self.elements.tooltip);if(self.options.hide.when.event=='inactive')
{inactiveEvents=['click','dblclick','mousedown','mouseup','mousemove','mouseout','mouseenter','mouseleave','mouseover'];function inactiveMethod(event)
{if(self.status.disabled===true)return;clearTimeout(self.timers.inactive);self.timers.inactive=setTimeout(function()
{$(inactiveEvents).each(function()
{hideTarget.unbind(this+'.qtip-inactive');self.elements.content.unbind(this+'.qtip-inactive');});self.hide(event);},self.options.hide.delay);};}
else if(self.options.hide.fixed===true)
{self.elements.tooltip.bind('mouseover.qtip',function()
{if(self.status.disabled===true)return;clearTimeout(self.timers.hide);});};function showMethod(event)
{if(self.status.disabled===true)return;if(self.options.hide.when.event=='inactive')
{$(inactiveEvents).each(function()
{hideTarget.bind(this+'.qtip-inactive',inactiveMethod);self.elements.content.bind(this+'.qtip-inactive',inactiveMethod);});inactiveMethod();};clearTimeout(self.timers.show);clearTimeout(self.timers.hide);self.timers.show=setTimeout(function(){self.show(event);},self.options.show.delay);};function hideMethod(event)
{if(self.status.disabled===true)return;if(self.options.hide.fixed===true&&self.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&$(event.relatedTarget).parents('div.qtip[qtip]').length>0)
{event.stopPropagation();event.preventDefault();clearTimeout(self.timers.hide);return false;};clearTimeout(self.timers.show);clearTimeout(self.timers.hide);self.elements.tooltip.stop(true,true);self.timers.hide=setTimeout(function(){self.hide(event);},self.options.hide.delay);};if((self.options.show.when.target.add(self.options.hide.when.target).length===1&&self.options.show.when.event==self.options.hide.when.event&&self.options.hide.when.event!=='inactive')||self.options.hide.when.event=='unfocus')
{self.cache.toggle=0;showTarget.bind(self.options.show.when.event+'.qtip',function(event)
{if(self.cache.toggle==0)showMethod(event);else hideMethod(event);});}
else
{showTarget.bind(self.options.show.when.event+'.qtip',showMethod);if(self.options.hide.when.event!=='inactive')
hideTarget.bind(self.options.hide.when.event+'.qtip',hideMethod);};if(self.options.position.type.search(/(fixed|absolute)/)!==-1)
self.elements.tooltip.bind('mouseover.qtip',self.focus);if(self.options.position.target==='mouse'&&self.options.position.type!=='static')
{showTarget.bind('mousemove.qtip',function(event)
{self.cache.mouse={x:event.pageX,y:event.pageY};if(self.status.disabled===false&&self.options.position.adjust.mouse===true&&self.options.position.type!=='static'&&self.elements.tooltip.css('display')!=='none')
self.updatePosition(event);});};};function screenAdjust(position,target,tooltip)
{var self,adjustedPosition,adjust,newCorner,overflow,corner;self=this;if(tooltip.corner=='center')return target.position
adjustedPosition=$.extend({},position);newCorner={x:false,y:false};overflow={left:(adjustedPosition.left<$.fn.qtip.cache.screen.scroll.left),right:(adjustedPosition.left+tooltip.dimensions.width+2>=$.fn.qtip.cache.screen.width+$.fn.qtip.cache.screen.scroll.left),top:(adjustedPosition.top<$.fn.qtip.cache.screen.scroll.top),bottom:(adjustedPosition.top+tooltip.dimensions.height+2>=$.fn.qtip.cache.screen.height+$.fn.qtip.cache.screen.scroll.top)};adjust={left:(overflow.left&&(tooltip.corner.search(/right/i)!=-1||(tooltip.corner.search(/right/i)==-1&&!overflow.right))),right:(overflow.right&&(tooltip.corner.search(/left/i)!=-1||(tooltip.corner.search(/left/i)==-1&&!overflow.left))),top:(overflow.top&&tooltip.corner.search(/top/i)==-1),bottom:(overflow.bottom&&tooltip.corner.search(/bottom/i)==-1)};if(adjust.left)
{if(self.options.position.target!=='mouse')
adjustedPosition.left=target.position.left+target.dimensions.width;else
adjustedPosition.left=self.cache.mouse.x
newCorner.x='Left';}
else if(adjust.right)
{if(self.options.position.target!=='mouse')
adjustedPosition.left=target.position.left-tooltip.dimensions.width;else
adjustedPosition.left=self.cache.mouse.x-tooltip.dimensions.width;newCorner.x='Right';};if(adjust.top)
{if(self.options.position.target!=='mouse')
adjustedPosition.top=target.position.top+target.dimensions.height;else
adjustedPosition.top=self.cache.mouse.y
newCorner.y='top';}
else if(adjust.bottom)
{if(self.options.position.target!=='mouse')
adjustedPosition.top=target.position.top-tooltip.dimensions.height;else
adjustedPosition.top=self.cache.mouse.y-tooltip.dimensions.height;newCorner.y='bottom';};if(adjustedPosition.left<0)
{adjustedPosition.left=position.left;newCorner.x=false;};if(adjustedPosition.top<0)
{adjustedPosition.top=position.top;newCorner.y=false;};if(self.options.style.tip.corner!==false)
{adjustedPosition.corner=new String(tooltip.corner);if(newCorner.x!==false)adjustedPosition.corner=adjustedPosition.corner.replace(/Left|Right|Middle/,newCorner.x);if(newCorner.y!==false)adjustedPosition.corner=adjustedPosition.corner.replace(/top|bottom/,newCorner.y);if(adjustedPosition.corner!==self.elements.tip.attr('rel'))
createTip.call(self,adjustedPosition.corner);};return adjustedPosition;};function jQueryStyle(style,sub)
{var styleObj,i;styleObj=$.extend(true,{},style);for(i in styleObj)
{if(sub===true&&i.search(/(tip|classes)/i)!==-1)
delete styleObj[i];else if(!sub&&i.search(/(width|border|tip|title|classes|user)/i)!==-1)
delete styleObj[i];};return styleObj;};function sanitizeStyle(style)
{if(typeof style.tip!=='object')style.tip={corner:style.tip};if(typeof style.tip.size!=='object')style.tip.size={width:style.tip.size,height:style.tip.size};if(typeof style.border!=='object')style.border={width:style.border};if(typeof style.width!=='object')style.width={value:style.width};if(typeof style.width.max=='string')style.width.max=parseInt(style.width.max.replace(/([0-9]+)/i,"$1"));if(typeof style.width.min=='string')style.width.min=parseInt(style.width.min.replace(/([0-9]+)/i,"$1"));if(typeof style.tip.size.x=='number')
{style.tip.size.width=style.tip.size.x;delete style.tip.size.x;};if(typeof style.tip.size.y=='number')
{style.tip.size.height=style.tip.size.y;delete style.tip.size.y;};return style;};function buildStyle()
{var self,i,styleArray,styleExtend,finalStyle,ieAdjust;self=this;styleArray=[true,{}];for(i=0;i<arguments.length;i++)
styleArray.push(arguments[i]);styleExtend=[$.extend.apply($,styleArray)];while(typeof styleExtend[0].name=='string')
{styleExtend.unshift(sanitizeStyle($.fn.qtip.styles[styleExtend[0].name]));};styleExtend.unshift(true,{classes:{tooltip:'qtip-'+(arguments[0].name||'defaults')}},$.fn.qtip.styles.defaults);finalStyle=$.extend.apply($,styleExtend);ieAdjust=($.browser.msie)?1:0;finalStyle.tip.size.width+=ieAdjust;finalStyle.tip.size.height+=ieAdjust;if(finalStyle.tip.size.width%2>0)finalStyle.tip.size.width+=1;if(finalStyle.tip.size.height%2>0)finalStyle.tip.size.height+=1;if(finalStyle.tip.corner===true)
finalStyle.tip.corner=(self.options.position.corner.tooltip==='center')?false:self.options.position.corner.tooltip;return finalStyle;};function calculateTip(corner,width,height)
{var tips={bottomRight:[[0,0],[width,height],[width,0]],bottomLeft:[[0,0],[width,0],[0,height]],topRight:[[0,height],[width,0],[width,height]],topLeft:[[0,0],[0,height],[width,height]],topMiddle:[[0,height],[width/2,0],[width,height]],bottomMiddle:[[0,0],[width,0],[width/2,height]],rightMiddle:[[0,0],[width,height/2],[0,height]],leftMiddle:[[width,0],[width,height],[0,height/2]]};tips.leftTop=tips.bottomRight;tips.rightTop=tips.bottomLeft;tips.leftBottom=tips.topRight;tips.rightBottom=tips.topLeft;return tips[corner];};function calculateBorders(radius)
{var borders;if($('<canvas>').get(0).getContext)
{borders={topLeft:[radius,radius],topRight:[0,radius],bottomLeft:[radius,0],bottomRight:[0,0]};}
else if($.browser.msie)
{borders={topLeft:[-90,90,0],topRight:[-90,90,-radius],bottomLeft:[90,270,0],bottomRight:[90,270,-radius]};};return borders;};function bgiframe()
{var self,html,dimensions;self=this;dimensions=self.getDimensions();html='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" '+'style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; '+'height:'+dimensions.height+'px; width:'+dimensions.width+'px" />';self.elements.bgiframe=self.elements.wrapper.prepend(html).children('.qtip-bgiframe:first');};$(document).ready(function()
{$.fn.qtip.cache={screen:{scroll:{left:$(window).scrollLeft(),top:$(window).scrollTop()},width:$(window).width(),height:$(window).height()}};var adjustTimer;$(window).bind('resize scroll',function(event)
{clearTimeout(adjustTimer);adjustTimer=setTimeout(function()
{if(event.type==='scroll')
$.fn.qtip.cache.screen.scroll={left:$(window).scrollLeft(),top:$(window).scrollTop()};else
{$.fn.qtip.cache.screen.width=$(window).width();$.fn.qtip.cache.screen.height=$(window).height();};for(i=0;i<$.fn.qtip.interfaces.length;i++)
{var api=$.fn.qtip.interfaces[i];if(api.status.rendered===true&&(api.options.position.type!=='static'||api.options.position.adjust.scroll&&event.type==='scroll'||api.options.position.adjust.resize&&event.type==='resize'))
{api.updatePosition(event,true);}};},100);})
$(document).bind('mousedown.qtip',function(event)
{if($(event.target).parents('div.qtip').length===0)
{$('.qtip[unfocus]').each(function()
{var api=$(this).qtip("api");if($(this).is(':visible')&&!api.status.disabled&&$(event.target).add(api.elements.target).length>1)
api.hide(event);})};})});$.fn.qtip.interfaces=[]
$.fn.qtip.log={error:function(){return this;}};$.fn.qtip.constants={};$.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:'bottomRight',tooltip:'topLeft'},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:'absolute',container:false},show:{when:{target:false,event:'mouseover'},effect:{type:'fade',length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:'mouseout'},effect:{type:'fade',length:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};$.fn.qtip.styles={defaults:{background:'white',color:'#111',overflow:'hidden',textAlign:'left',width:{min:0,max:250},padding:'5px 9px',border:{width:1,radius:0,color:'#d3d3d3'},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:'#e1e1e1',fontWeight:'bold',padding:'7px 12px'},button:{cursor:'pointer'},classes:{target:'',tip:'qtip-tip',title:'qtip-title',button:'qtip-button',content:'qtip-content',active:'qtip-active'}},cream:{border:{width:3,radius:0,color:'#F9E98E'},title:{background:'#F0DE7D',color:'#A27D35'},background:'#FBF7AA',color:'#A27D35',classes:{tooltip:'qtip-cream'}},light:{border:{width:3,radius:0,color:'#E2E2E2'},title:{background:'#f1f1f1',color:'#454545'},background:'white',color:'#454545',classes:{tooltip:'qtip-light'}},dark:{border:{width:3,radius:0,color:'#303030'},title:{background:'#404040',color:'#f3f3f3'},background:'#505050',color:'#f3f3f3',classes:{tooltip:'qtip-dark'}},red:{border:{width:3,radius:0,color:'#CE6F6F'},title:{background:'#f28279',color:'#9C2F2F'},background:'#F79992',color:'#9C2F2F',classes:{tooltip:'qtip-red'}},green:{border:{width:3,radius:0,color:'#A9DB66'},title:{background:'#b9db8c',color:'#58792E'},background:'#CDE6AC',color:'#58792E',classes:{tooltip:'qtip-green'}},blue:{border:{width:3,radius:0,color:'#ADD9ED'},title:{background:'#D0E9F5',color:'#5E99BD'},background:'#E5F6FE',color:'#4D9FBF',classes:{tooltip:'qtip-blue'}}};})(jQuery);
    /**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
    /**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
(function($){$.fn.lightBox=function(settings){settings=jQuery.extend(
  {
    overlayBgColor:'#000',
    overlayOpacity:0.8,
    fixedNavigation:false,
    imageLoading:'/mediaObject/mediaLM/imagenes/lightbox/lightbox-ico-loading/original/lightbox-ico-loading.gif',
    imageBtnPrev:'/mediaObject/mediaLM/imagenes/lightbox/btn-prev-showroom/original/btn-prev-showroom.png',
    imageBtnNext:'/mediaObject/mediaLM/imagenes/lightbox/btn-next-showroom/original/btn-next-showroom.png',
    imageBtnClose:'/mediaObject/mediaLM/imagenes/lightbox/lightbox-btn-close/original/lightbox-btn-close.gif',
    imageBlank:'/mediaObject/mediaLM/imagenes/lightbox/lightbox-blank/original/lightbox-blank.gif',
    containerBorderSize:10,
    containerResizeSpeed:400,
    txtImage:' ',
    txtOf:'de',
    keyToClose:'c',
    keyToPrev:'p',
    keyToNext:'n',
    imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
function _start(objClicked,jQueryMatchedObj){
  urlArray = objClicked.getElementsByTagName("IMG");
  urlLink=urlArray[0].title;$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title'),objClicked.getAttribute('name')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title'),jQueryMatchedObj[i].getAttribute('name')));}}
while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;}
_set_image_to_view();}
function _set_interface(){
  var accesoFicha = '/mediaObject/mediaLM/imagenes/lightbox/boton-acceso-ficha/original/boton-acceso-ficha.jpg';
  $('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><div id="boton-acceso-lightbox"><a href="'+urlLink+'"><img src="'+accesoFicha+'"/></a></div><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();$("#boton-acceso-lightbox a").attr("href",settings.imageArray[settings.activeImage][2]);}
if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 45% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 45% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
_enable_keyboard_navigation();}
function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
function _disable_keyboard_navigation(){$(document).unbind();}
function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);
    /**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */

 var vinetaVideoImagen="";

 (function($){$.fn.lightBoxProduct=function(settings){settings=jQuery.extend(
  {
    overlayBgColor:'#000',
    overlayOpacity:0.8,
    fixedNavigation:false,
    imageLoading:'/mediaObject/mediaLM/imagenes/lightbox/lightbox-ico-loading/original/lightbox-ico-loading.gif',
    imageBtnPrev:'/mediaObject/mediaLM/imagenes/lightbox/btn-prev-showroom/original/btn-prev-showroom.png',
    imageBtnNext:'/mediaObject/mediaLM/imagenes/lightbox/btn-next-showroom/original/btn-next-showroom.png',
    imageBtnClose:'/mediaObject/mediaLM/imagenes/lightbox/lightbox-btn-close/original/lightbox-btn-close.gif',
    imageBlank:'/mediaObject/mediaLM/imagenes/lightbox/lightbox-blank/original/lightbox-blank.gif',
    containerBorderSize:10,
    containerVinetas:100,
    containerResizeSpeed:400,
    txtImage:' ',
    txtOf:'de',
    keyToClose:'c',
    keyToPrev:'p',
    keyToNext:'n',
    accesoFicha:true,
    codCapas:'',
    capaMostrar:'',
    codVinetas:'',
    imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;

    function _initialize(){_start(this,jQueryMatchedObj);return false;}


    function _start(objClicked,jQueryMatchedObj){
      urlArray = objClicked.getElementsByTagName("IMG");
      urlLink=urlArray[0].title;
      codigoAccesoFicha='';
      codigoReproducirVideoImagen='';
      if(settings.accesoFicha){
        codigoAccesoFicha='<div id="boton-acceso-lightbox"><a href="'+urlLink+'"><img src="/mediaObject/mediaLM/imagenes/lightbox/boton-acceso-ficha/original/boton-acceso-ficha.jpg"/></a></div>';
      }
      codigoReproducirVideoImagen='<span id="cambioCodigo">'+settings.codCapas+'</span>'+settings.codVinetas;
      $('embed, object, select').css({'visibility':'hidden'});
      _set_interface();
      settings.imageArray.length=0;
      settings.activeImage=0;
      if(jQueryMatchedObj.length==1){
        settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title'),objClicked.getAttribute('name')));
      }
      else{
        for(var i=0;i<jQueryMatchedObj.length;i++){
          settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title'),jQueryMatchedObj[i].getAttribute('name')));
        }
      }
      while(settings.imageArray[settings.activeImage][1]!=objClicked.getAttribute('title')){
        settings.activeImage++;
      }
      _set_image_to_view();
    }


function _set_interface(){
  $('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav">'+codigoAccesoFicha+'<a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div><div id="lightbox-container-image-box"><div id="lightbox-container-image">'+codigoReproducirVideoImagen+'</div></div></div>');
  $('#vinetasLightbox').hide();
  var arrPageSizes=___getPageSize();
  $('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();
  var arrPageScroll=___getPageScroll();
  $('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();
  $('#jquery-overlay,#jquery-lightbox').click(function(){ _finish();});

  $("#vinetasLightbox").unbind().hover(function(){},function(){}).bind("click", function() {
    $('#capaVinetaA').hide();
    $('#capaVinetaB').hide();
    $('#capaVinetaC').hide();
    $('#capaVinetaD').hide();
    $('#'+vinetaVideoImagen+'').show();
    return false;
  });
  $('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){ _finish();return false;});
  $(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});
}


function _set_image_to_view(){
  if(settings.fixedNavigation){
    $('#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
  }else{
    $('#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
  }
  _resize_container_image_box(500,500);
};

function _resize_container_image_box(intImageWidth,intImageHeight){
  var intCurrentWidth=$('#lightbox-container-image-box').width();
  var intCurrentHeight=$('#lightbox-container-image-box').height();
  var intWidth=(intImageWidth+(settings.containerBorderSize*2));
  if(settings.codVinetas){var intHeight=(intImageHeight+settings.containerVinetas+(settings.containerBorderSize*2));}
  else{var intHeight=(intImageHeight+(settings.containerBorderSize*2));}

  var intDiffW=intCurrentWidth-intWidth;
  var intDiffH=intCurrentHeight-intHeight;

  $('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});
  if((intDiffW==0)&&(intDiffH==0)){
    if($.browser.msie){___pause(250);
  }else{
    ___pause(100);}
  }
  $('#lightbox-container-image-data-box').css({width:intImageWidth, 'overflow': 'hidden'});
  $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});
};

function _show_image(){
  $('#vinetasLightbox').show();
  $('#'+settings.capaMostrar+'').show();
  $('#cambioCodigo').fadeIn(function(){_show_image_data();});
  _preload_neighbor_images();
  //titulo es una variable que llega de la pag individual del producto para colocar en el zoom.
  try {if(eval("titulo")) jQuery('#lightbox-image-details-caption').html(titulo);}catch(e){};

};

function _show_image_data(){
  $('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();$("#boton-acceso-lightbox a").attr("href",settings.imageArray[settings.activeImage][2]);}
  if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}
}



function _set_navigation(){
  $('#lightbox-nav').show();
  $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});
  if(settings.activeImage!=0){
    if(settings.fixedNavigation){
      $('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function()
        {settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});
    }else{
    $('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 45% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});
    }
  }
  if(settings.activeImage!=(settings.imageArray.length-1)){
    if(settings.fixedNavigation){
      $('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});
    }else{
      $('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 45% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});
    }
  }
  _enable_keyboard_navigation();
}


function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}


function _disable_keyboard_navigation(){$(document).unbind();}


function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){ _finish();}
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}


function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}


function _finish(){
  $('#jquery-lightbox').remove();
  $('#jquery-overlay').fadeOut(function(){
    $('#jquery-overlay').remove();
  });
  $('embed, object, select').css({'visibility':'visible'});
}


function ___getPageSize(){
  var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
  var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
  windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
  if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
  if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
  arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;
};

function ___getPageScroll(){
  var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
  arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;
};

function ___pause(ms){
  var date=new Date();curDate=null;do{var curDate=new Date();}
  while(curDate-date<ms);
};

  return this.unbind('click').click(_initialize);};})(jQuery);


function showCapa(capaA,capaB,capaC,capaD,tit)
{
  if(capaA) vinetaVideoImagen="capaVinetaA";
  else if (capaB) vinetaVideoImagen="capaVinetaB";
  else if (capaC) vinetaVideoImagen="capaVinetaC";
  else vinetaVideoImagen="capaVinetaD";
  jQuery('#lightbox-image-details-caption').html(tit);
}
    /*BANNER ROTATORIOS*/
//variables banner
var newsBannerTienda;
var curritemBannerTienda=0;
var clickBannerTienda = -1;
var speedBannerTienda = 6000;//milisegundos
var intBannerTienda;
var iPauseBannerTienda=0;

jQuery(document).ready(function(){
  //activa carrusel del banner
  jQuery("#mini-galeria-selector-tienda .lme_thumbs-galeria-banner-tienda-boton span").each(function(i){
    jQuery(this).bind("click",function(){
      if(i==curritemBannerTienda){return false;}
      clickBannerTienda = i;
      tickBannerTienda();
    });
  });

    var bannerSelectorTienda = "#show-galeria-selector-tienda li";
    newsBannerTienda = jQuery(bannerSelectorTienda).hide().hover(
        function(){
            jQuery(this).addClass("sel");
            iPauseBannerTienda=1;
        },
        function(){
            jQuery(this).removeClass("sel");
            iPauseBannerTienda=0;
        }
    ).filter(":eq(0)").show().add(bannerSelectorTienda).size();
    intBanner = setInterval(bannernewsTienda,speedBannerTienda);
});

function bannernewsTienda() {
  if (iPauseBannerTienda==0){
    jQuery("#show-galeria-selector-tienda li").fadeOut("slow",function(){jQuery(this).hide();});
    curritemBannerTienda = ++curritemBannerTienda%newsBannerTienda;
    jQuery("#mini-galeria-selector-tienda .lme_thumbs-galeria-banner-tienda-boton").each(function(i){
      if(curritemBannerTienda==i) jQuery(this).addClass("sel");
      else jQuery(this).removeClass("sel");
    });
    jQuery("#show-galeria-selector-tienda li:eq("+curritemBannerTienda+")").fadeIn("slow", function(){});
    }
}

function tickBannerTienda() {
  if (iPauseBannerTienda==0) {
    clearInterval(intBannerTienda);
    curritemBannerTienda = clickBannerTienda;
    jQuery("#show-galeria-selector-tienda li").fadeOut("fast",function(){jQuery(this).hide();});
    jQuery("#mini-galeria-selector-tienda .lme_thumbs-galeria-banner-tienda-boton").each(function(i){
      if(clickBannerTienda==i) jQuery(this).addClass("sel");
      else jQuery(this).removeClass("sel");
    });
    jQuery("#show-galeria-selector-tienda li:eq("+clickBannerTienda+")").fadeIn("slow", function(){
      intBannerTienda= "";
      curritemBannerTienda = clickBannerTienda;
      intBannerTienda = setInterval(bannernewsTienda,speedBannerTienda);
    });
    }
}



  /* tiendas Alfresco */

  function pintaEvento(evento,ini,fin,hini,hfin,tit,desc)
        {
        var clase = "";
        var imagen = "";
        if(evento == "Demostracion tienda")
        {
          clase = "demostracion-tienda-tabla";
          imagen = "icono-muestra-demostracion.png";
        }
        else if(evento == "Apertura")
        {
          clase = "apertura-tienda-tabla";
          imagen = "icono-muestra-apertura.png";
        }
        else if(evento == "Cierre")
        {
          clase = "apertura-tienda-tabla";
          imagen = "icono-muestra-cierre.png";
        }
        else if(evento == "Noticia")
        {
          clase = "noticias-tienda-tabla";
          imagen = "icono-muestra-noticias.png";
        }
        else
        {
          clase = "eventos-tienda-tabla";
          imagen = "icono-muestra-eventos.png";
        }

        //Pintar cualquier evento.
        pintoEvento+="<table cellpadding=\"0\" name=\""+evento+"\" cellspacing=\"0\" class=\""+clase+"\"><tr class=\"fecha-evento\"><td colspan=\"3\">Desde "+ini+" hasta "+fin+"</td></tr><tr class=\"odd\">";
        pintoEvento+="<td class=\"icono-celda\"><img src=\"/img/"+imagen+"\" /></td>";
        if (hini != "" & hfin != ""){
          hini = hini.split(":");
          hfin = hfin.split(":");
          pintoEvento+="<td class=\"celda-horario\"><strong>Horario</strong><br />De las "+hini[0]+":"+hini[1]+" h<br />a las "+hfin[0]+":"+hfin[1]+" h</td>";
        }
        pintoEvento+="<td class=\"celda-descripcion\"><strong>"+tit+"</strong><br />"+desc+"</td></tr></table>";
      }


    function Filtrar(columna, elemento){

      //Asignar clase selecci&oacute;n al filtro
      var lista = document.getElementById("listaFiltros").getElementsByTagName("li");
      for (k=0; k<lista.length; k++)
           lista[k].className="";
      elemento.className="sel";

      //Mostrar elementos que corresponden al filtro
      var tablasConFiltro = document.getElementById("ListaEventos");
      tablasConFiltro = tablasConFiltro.firstChild;

      do{
        if(columna == "Todos")
          tablasConFiltro.style.display="inline";
        else{
          if(tablasConFiltro.getAttribute("name") == columna)
            tablasConFiltro.style.display="inline";
          else
            tablasConFiltro.style.display="none";
        }
        tablasConFiltro = tablasConFiltro.nextSibling;
      }while(tablasConFiltro!=null && tablasConFiltro.hasChildNodes())

    }


    function enFecha (finicio, ffin){
        var entra = false;
        //alert("function enFecha\nfinicio "+finicio+"\nffin "+ffin);
        var hoy = new Date();
        hoy = new Date(hoy.getFullYear(),hoy.getMonth(), hoy.getDate());
        finicio = finicio.split("-");
        var fecha = new Date (finicio[0],finicio[1]-1,finicio[2]);
        //alert("\nhoy "+hoy+"\nfecha inicial "+fecha);
        if (hoy>=fecha){
          ffin = ffin.split("-");
          fecha = new Date (ffin[0],ffin[1]-1,ffin[2]);
          //alert("\nhoy "+hoy+"\nfecha final "+fecha);
          if(hoy<=fecha){  entra = true;}
        }
        return entra;
      }


    function datosBannerPrincipalTiendas()
    {
      return "<a href=\"/visor-folletos/tu-casa-a-punto-por-dentro-y-por-fuera.html?idEIPub=1271666931&pagina=34\"><img src=\"/img/imagen-destacada-tienda.jpg\"/></a>";
    }

    function bannerSecundario (tipoimagen, imagen, tipoenlace, enlace, titulo, subtitulo, lugar)
      {
        //alert("function q pinta banner secundario\ntipoimagen "+tipoimagen+"\nimagen "+imagen+"\ntipoenlace "+tipoenlace+"\nenlace "+enlace+"\ntitulo "+titulo+"\nsubtitulo "+subtitulo+"\nlugar "+lugar);
        var ext = (imagen.substring(imagen.lastIndexOf("."))).toLowerCase();
        var banner = "<div class=\"txt-modulo-destacado-tienda\"><h6>"+titulo+"</h6><p>"+subtitulo+"</p></div>";
        var refer = "#";
        if(tipoenlace == "html"){
          enlace = enlace.split("/");
          refer = "./PAGINAS_ESTATICAS/"+enlace[enlace.length - 1];
        }
        else if(tipoenlace == "galeria"){
          enlace = enlace.split("/");
          refer = "./galerias/"+enlace[enlace.length - 1];
        }
        else if(tipoenlace == "issuu")
        {
          enlace = enlace.split("/");
          var tit = "";
          var arc = enlace[enlace.length - 1];
          arc = arc.gsub('html', 'lme');
          jQuery.ajax({
            url: "./folletos/"+arc,
            async: false,
            dataType: "text",
            type: "GET",
            success: function(xml){
              tit = jQuery(xml).find('titulo_folleto').text();
            }
          });
          if(tit != "") refer = "./folletos/"+enlace[enlace.length - 1]+"?title="+tit;
          else refer = "./folletos/"+enlace[enlace.length - 1];
        }
        else if(tipoenlace == "pdf"){
          enlace = enlace.split("/");
          refer = "./FICHEROS/"+enlace[enlace.length - 1];
        }
        else refer = enlace;

        if(ext == ".jpg" || ext == ".gif" || ext == ".jpeg" || ext == ".png")
        {
          banner += "<div>";
          if(refer != "")banner += "<a href=\""+refer+"\">";
          if(tipoimagen == "local"){
            imagen = imagen.split("/");
            banner += "<img height=\"150px\" width=\"280px\" src=\"./IMAGENES/"+imagen[imagen.length - 1]+"\"/>";
          }
          else{
            banner += "<img height=\"150px\" width=\"280px\" src=\""+imagen+"\"/>"
          }
          if(refer != "")banner += "</a>";
          banner += "</div>";
        }

        jQuery("#"+lugar+"").html(banner);

      }


    function elegirBanner(generico, local, lugar)
      {
        //alert("elegirBanner\n\n\ngenerico "+generico.length+"\nlocal "+local.length+"\n\nind          GENERICO                            LOCAL\n0        "+generico[0]+"                 "+local[0]+"\n1             "+generico[1]+"                 "+local[1]+"\n2             "+generico[2]+"                 "+local[2]+"\n3             "+generico[3]+"                                  "+local[3]+"\n4             "+generico[4]+"                                "+local[4]+"\n5             "+generico[5]+"                      "+local[5]+"\n6             "+generico[6]+"                      "+local[6]+"\n7             "+generico[7]);
        if(generico.length!=0)
        {
          if(enFecha(generico[3],generico[4]))
          {
            //alert("el banner entra en fecha"+"\nenlace "+generico[5]+"\nfecha inicio "+generico[3]+"\nfecha fin"+generico[4]);
            bannerSecundario ("generica", generico[2], "url", generico[5], generico[0], generico[1], lugar);
            //jQuery("#"+lugar+"fechas").html("<div style=\"color:#FF0000\">Fecha inicio "+generico[3]+" Fecha fin "+generico[4]);
          }
          else if (local.length!=0)
          {
            if(enFecha(local[3],local[4]))
            {
              //alert("1 el generico esta fuera de fecha. Este entra en fecha"+"\nenlace html "+local[5]+"\nenlace issuu "+local[6]+"\nenlace url "+local[7]+"\nenlace pdf "+local[8]+"\nenlace galeria "+local[9]);
              //jQuery("#"+lugar+"fechas").html("<div style=\"color:#FF0000\">Fecha inicio "+local[3]+" Fecha fin "+local[4]);
              if(local[5] != "" && local[5] != "/DATOS/PAGINAS_ESTATICAS")
                bannerSecundario ("local", local[2], "html", local[5], local[0], local[1], lugar);
              else if(local[6] != "" && local[6] != "/DATOS/folletos")
                bannerSecundario ("local", local[2], "issuu", local[6], local[0], local[1], lugar);
              else if(local[8] != "" && local[8] != "/DATOS/FICHEROS")
                bannerSecundario ("local", local[2], "pdf", local[8], local[0], local[1], lugar);
              else if (local[7] != "" && local[7] != "ninguno")
                bannerSecundario ("local", local[2], "url", local[7], local[0], local[1], lugar);
              else if(local[9] != "" && local[9] != "/DATOS/galerias")
                bannerSecundario ("local", local[2], "galeria", local[9], local[0], local[1], lugar);
              else
                bannerSecundario ("local", local[2], "url", "", local[0], local[1], lugar);
            }
            else
            {
              if(lugar=="izq") bannerSecundario ("generica", "/img/destacado-tienda-01.jpg", "url", "/marcas-de-la-casa", "MARCAS DE LA CASA", "La mejor relaci&oacute;n calidad-precio", "izq");
              else if(lugar=="cen") bannerSecundario ("generica", "/img/destacado-demo.jpg", "url", "/demostraciones", "DEMOSTRACIONES EN VIDEO", "Ya puedes verlas tambi&eacute;n desde casa", "cen");
              else bannerSecundario ("generica", "/img/destacado-tienda-03.jpg", "url", "/eco-opciones", "ECO-OPCIONES", "Alternativas para hogares m&aacute;s sostenibles", "der");
            }
          }
          else
          {
            if(lugar=="izq") bannerSecundario ("generica", "/img/destacado-tienda-01.jpg", "url", "/marcas-de-la-casa", "MARCAS DE LA CASA", "La mejor relaci&oacute;n calidad-precio", "izq");
            else if(lugar=="cen") bannerSecundario ("generica", "/img/destacado-demo.jpg", "url", "/demostraciones", "DEMOSTRACIONES EN VIDEO", "Ya puedes verlas tambi&eacute;n desde casa", "cen");
            else bannerSecundario ("generica", "/img/destacado-tienda-03.jpg", "url", "/eco-opciones", "ECO-OPCIONES", "Alternativas para hogares m&aacute;s sostenibles", "der");
          }
        }
        else if (local.length!=0)
        {
          if(enFecha(local[3],local[4]))
          {
            //alert("2 el generico esta fuera de fecha. Este entra en fecha"+"\nenlace html "+local[5]+"\nenlace issuu "+local[6]+"\nenlace url "+local[7]+"\nenlace pdf "+local[7]);
            //jQuery("#"+lugar+"fechas").html("<div style=\"color:#FF0000\">Fecha inicio "+local[3]+" Fecha fin "+local[4]);
            if(local[5] != "" && local[5] != "/DATOS/PAGINAS_ESTATICAS")
              bannerSecundario ("local", local[2], "html", local[5], local[0], local[1], lugar);
            else if(local[6] != "" && local[6] != "/DATOS/folletos")
              bannerSecundario ("local", local[2], "issuu", local[6], local[0], local[1], lugar);
            else if(local[8] != "" && local[8] != "/DATOS/FICHEROS")
                bannerSecundario ("local", local[2], "pdf", local[8], local[0], local[1], lugar);
            else if (local[7] != "" && local[7] != "ninguno")
              bannerSecundario ("local", local[2], "url", local[7], local[0], local[1], lugar);
            else if(local[9] != "" && local[9] != "/DATOS/galerias")
                bannerSecundario ("local", local[2], "galeria", local[9], local[0], local[1], lugar);
            else
              bannerSecundario ("local", local[2], "url", "", local[0], local[1], lugar);
          }
          else
          {
            if(lugar=="izq") bannerSecundario ("generica", "/img/destacado-tienda-01.jpg", "url", "/marcas-de-la-casa", "MARCAS DE LA CASA", "La mejor relaci&oacute;n calidad-precio", "izq");
            else if(lugar=="cen") bannerSecundario ("generica", "/img/destacado-demo.jpg", "url", "/demostraciones", "DEMOSTRACIONES EN VIDEO", "Ya puedes verlas tambi&eacute;n desde casa", "cen");
            else bannerSecundario ("generica", "/img/destacado-tienda-03.jpg", "url", "/eco-opciones", "ECO-OPCIONES", "Alternativas para hogares m&aacute;s sostenibles", "der");
          }
        }
        else
        {
          if(lugar=="izq") bannerSecundario ("generica", "/img/destacado-tienda-01.jpg", "url", "/marcas-de-la-casa", "MARCAS DE LA CASA", "La mejor relaci&oacute;n calidad-precio", "izq");
          else if(lugar=="cen") bannerSecundario ("generica", "/img/destacado-demo.jpg", "url", "/demostraciones", "DEMOSTRACIONES EN VIDEO", "Ya puedes verlas tambi&eacute;n desde casa", "cen");
          else bannerSecundario ("generica", "/img/destacado-tienda-03.jpg", "url", "/eco-opciones", "ECO-OPCIONES", "Alternativas para hogares m&aacute;s sostenibles", "der");
        }
      }





    function hidebox(szDivID){ // 1 visible, 0 hidden
      //jQuery("#"+szDivID).hide();
      jQuery("#"+szDivID).fadeOut("slow");
    }


    function showbox(szDivID) { // 1 visible, 0 hidden
        //jQuery("#"+szDivID).show();
        jQuery("#"+szDivID).fadeIn("slow");
    }


    function showservice(simg,stit,sdesc) // 1 visible, 0 hidden
    {
      jQuery("#serv_titulo").html(stit);
      jQuery("#serv_descripcion").html(sdesc);
      jQuery("#serv_imagen").html("<img src=\""+simg+"\"/>");
      showbox('listaserviciosLightPopup');
    }


  /* Google map*/

  var directionsDisplay;
  var directionsService;


   function pretty(a,b) {
        return '<table border="0" cellpadding="2" cellspacing="2" width="212" align="center"><tr><td align="center">' + a + '<\/td><\/tr>' + '<tr><td>' + b + '<\/td><\/tr><\/table>';
    }
    var reg;
    function setDirections(fromAddress, toAddress) {
        var geocoder = new google.maps.Geocoder();
        var latlngStr = toAddress.split(",",2);
        var lat = parseFloat(latlngStr[0]);
        var lng = parseFloat(latlngStr[1]);
        var latlng = new google.maps.LatLng(lat, lng);
        var fromCercano = fromAddress;
        var addr =fromAddress+" , "+reg;
        //alert(addr);
        // Delimitar por cercano
        if (geocoder) {
          geocoder.geocode( { 'address':addr }, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
              fromCercano = results[0].geometry.location;
            }
            var request = {
                origin:fromCercano,
                destination:toAddress,
                travelMode: google.maps.DirectionsTravelMode.DRIVING
            };
            directionsService.route(request, function(response, status) {
              if (status == google.maps.DirectionsStatus.OK) {
                /*var arrRutas = response.routes;
                for (var i=0;i<arrRutas.length;i++){
                  alert("start : "+arrRutas[i].legs[0].start_geocode.geometry.location.toString());
                  alert("end : "+arrRutas[i].legs[0].end_geocode.geometry.location.toString());
                  alert("toAddress : "+latlng.toString());
                  arrRutas[i].legs[0].end_geocode.geometry.location=latlng;
                  alert("end2 : "+arrRutas[i].legs[0].end_geocode.geometry.location.toString());
                }*/
                directionsDisplay.setDirections(response);
              }
              else if (status == google.maps.DirectionsStatus.NOT_FOUND)
                 alert("No se ha encontrado una localización para la dirección introducida. Esto puede ser debido a que la direccion es nueva o incorrecta.\nError: " + status);
               else if (status == google.maps.DirectionsStatus.REQUEST_DENIED)
                 alert("La petición no ha podido ser procesada. Fallo inesperado...\n Error: " + status);
               else if (status == google.maps.DirectionsStatus.INVALID_REQUEST)
                 alert("El parametro HTTP q o no existe o no tiene valor. Se ha introducido una direccion vacia como entrada.\n Error: " + status);
               else if (status == google.maps.DirectionsStatus.UNKNOWN_ERROR)
                 alert("La peticion no ha podido ser parseada con exito.\n Error: " + status);
               else alert("Dirección no encontrada");
            });
          });
        }
    }



  // Call this function when the page has been loaded
  function showMapaTienda (nombre,descripcion,direccion,gps1,gps2,tte,telf,hora, icon, iconShadow, imgCierre) {
    // area administrativa punto tienda
    var geocoder = new google.maps.Geocoder();
    var lat = parseFloat(gps1);
    var lng = parseFloat(gps2);
    var latlng = new google.maps.LatLng(lat, lng);
    if (geocoder) {
      geocoder.geocode({'latLng': latlng}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          if (results.length>0) {
            for (var i=0; i<results.length;i++){
              if (results[i].types=="administrative_area_level_1,political") {
                reg=results[i].address_components[0].long_name;
                break;
              }
              /*var res =results[i].address_components;
              for (var j=0; j<res.length;j++){
                alert(results[i].types+" : "+res[j].long_name);
              }*/
            }
          }
        }
      });
    }

    var textolayer="";
    textolayer+="<p class=\"nombre-tienda\">"+nombre+"</p>";
    textolayer+="<p class=\"btn-cierre-popup\"><a href=\"javascript:hidebox('mapaTiendaLightBox')\"><img src=\"" + imgCierre + "\"></a></p>";
    textolayer+="<div class=\"info\"><div class=\"contMapa\"><div id=\"maptienda\" style=\"height:540px\"></div><div id=\"directions\"></div></div><div class=\"txt\"><dl><dt>Nuestra tienda:</dt><dd>";
    textolayer+=descripcion+"</dd><dt>Direcci&oacute;n</dt><dd>"+direccion+"<br/><br/><form action=\"#\" onsubmit=\"setDirections(this.fromAddress.value, this.toAddress.value); return false\" name=\"encuentracaminogooglemaps\" id=\"encuentracaminogooglemaps\" style=\"padding:8px;border-style:dotted; border-width:1px; border-color:#999999;\"><span style=\"font-size:11px;\">Encuentra el camino a tu tienda: </span><input type=\"text\" size=\"20\" id=\"fromAddress\" name=\"fromAddress\" value=\"\" style=\"font-size:11px;border-width:1px;\"/><input type=\"hidden\" id=\"toAddress\" name=\"toAddress\" value=\""+gps1+","+gps2+"\"/> <input name=\"submit\" type=\"submit\" value=\"Ver ruta\" style=\"font-size:11px; border-width:1px;\"/><br/><span style=\"font-size:10px;color:#666666\">(p. ej. Av Diagonal 13, Barcelona)</span></form>";
    textolayer+="</dd><dt>Coordenadas GPS:</dt><dd>Latitud: "+gps1+"</dd><dd>Longitud: "+gps2+"</dd><dt>Transporte P&uacute;blico:</dt><dd>"+tte+"</dd><dt>Contacto</dt><dd>Tel&eacute;fono: "+telf+"<br/></dd><dt>Horario</dt><dd>"+hora+"</dd></dl></div></div>"

    jQuery("#mapaTiendaLightBox").html(textolayer);

    // Map position
    var splatlng = new google.maps.LatLng(gps1,gps2);
    var spOptions = {
      zoom: 13,
      scrollwheel: false,
      center: splatlng,
      mapTypeControl: true,
      navigationControl: true,
      disableDoubleClickZoom : true,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var spmap = new google.maps.Map(document.getElementById("maptienda"), spOptions);

    // Image marker
    var image = new google.maps.MarkerImage(icon,
      new google.maps.Size(20, 34),
      new google.maps.Point(0,0),
      new google.maps.Point(10, 33));
    var shadow = new google.maps.MarkerImage(iconShadow,
      new google.maps.Size(42, 34),
      new google.maps.Point(0,0),
      new google.maps.Point(10, 33));

    // General Mark
    var marker = new google.maps.Marker({
          position: splatlng,
          shadow: shadow,
          icon: image,
          map: spmap
      });

    // Add Calculate route
    directionsDisplay = new google.maps.DirectionsRenderer();
    directionsService = new google.maps.DirectionsService();
    directionsDisplay.setMap(spmap);
    directionsDisplay.setPanel(document.getElementById("directions"));

   showbox('mapaTiendaLightBox');
  }


    function checkSearch(aform) {
      if (aform.question.value == "Buscar" || aform.question.value == "") {
        return false;
      } else {
        return true;
      }
    }


  function startmeup() // 1 visible, 0 hidden
  {
   //hidebox('listaserviciosLightPopup');
   jQuery("#listaserviciosLightPopup").hide();
   //hidebox('mapaTiendaLightBox');
   jQuery("#mapaTiendaLightBox").hide();
  }
    
var newsBannerCatalogo;var curritemBannerCatalogo=0;var clickBannerCatalogo=-1;var speedBannerCatalogo=6000;var intBannerCatalogo;var iPauseBannerCatalogo=0;jQuery(document).ready(function(){jQuery("#paginacionGuias li a").each(function(i){jQuery(this).bind("click",function(){if(i==curritemBannerCatalogo){return false;}
clickBannerCatalogo=i;tickBannerCatalogo();return false;})});var bannerSelectorCatalogo=".interior-modulo-destacado-horizontal .destacado-individual";newsBannerCatalogo=jQuery(bannerSelectorCatalogo).hide().hover(function(){jQuery(this).addClass("sel");iPauseBannerCatalogo=1;},function(){jQuery(this).removeClass("sel");iPauseBannerCatalogo=0;}).filter(":eq(0)").show().add(bannerSelectorCatalogo).size();intBanner=setInterval(bannernewsCatalogo,speedBannerCatalogo);});function bannernewsCatalogo(){if(iPauseBannerCatalogo==0){jQuery(".interior-modulo-destacado-horizontal .destacado-individual").fadeOut("slow",function(){jQuery(this).hide();});curritemBannerCatalogo=++curritemBannerCatalogo%newsBannerCatalogo;jQuery("#paginacionGuias li").each(function(i){if(curritemBannerCatalogo==i){jQuery(this).addClass("sel");}else{jQuery(this).removeClass("sel");}})
jQuery(".interior-modulo-destacado-horizontal .destacado-individual:eq("+curritemBannerCatalogo+")").fadeIn("slow",function(){});}}
function tickBannerCatalogo(){if(iPauseBannerCatalogo==0){curritemBannerCatalogo=clickBannerCatalogo;jQuery(".interior-modulo-destacado-horizontal .destacado-individual").fadeOut("fast",function(){jQuery(this).hide();});jQuery("#paginacionGuias li").each(function(i){if(clickBannerCatalogo==i){jQuery(this).addClass("sel");}else{jQuery(this).removeClass("sel");}})
jQuery(".interior-modulo-destacado-horizontal .destacado-individual:eq("+clickBannerCatalogo+")").fadeIn("slow",function(){clearInterval(intBannerCatalogo);intBannerCatalogo="";curritemBannerCatalogo=clickBannerCatalogo;intBannerCatalogo=setInterval(bannernewsCatalogo,speedBannerCatalogo);});}}
    /* SiteCatalyst code version: H.23.3.
Copyright 1996-2011 Adobe, Inc. All Rights Reserved
More info available at http://www.omniture.com or http://www.web-analytics.es */
/* modificacion bug prop19 y variables campañas */

s_account="a64lmglobal";
var s=s_gi(s_account)
/************************** CONFIG SECTION **************************/
/* You may add or alter any code config here. */
s.charSet="UTF-8"
/* Conversion Config */
s.currencyCode="EUR"
/* Link Tracking Config */
s.trackDownloadLinks=true
s.trackExternalLinks=true
s.trackInlineStats=true
s.linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls"
s.linkInternalFilters="javascript:,leroymerlin.es,leroymerlin.infoempleo.com,abo2.ems6.net"
s.linkLeaveQueryString=false
s.linkTrackVars="None"
s.linkTrackEvents="None"
s.formList="curriculum"
s.trackFormList=true
s.trackPageName=false
s.useConversion=true
s.varUsed="eVar1"
s.eventList="event1,event2,event3"

/* TimeParting Config */
s.dstStart="3/27/2011"; // update to the correct Daylight Savings Time start
s.dstEnd="10/30/2011"; // update to the correct Daylight Savings Time end date
s.currentYear="2011"; // update to the current year (can be done programmaticaly)

/************** doPlugins Script **************/
s.usePlugins=true
function s_doPlugins(s) {


/* External Campaign Tracking */
if(!s.campaign)
  s.campaign=s.getQueryParam('utm_campaign')
  s.campaign=s.getValOnce(s.campaign,'s_campaign',0)

/* Campaign Source */
if(!s.eVar20)
  s.eVar20=s.getQueryParam('utm_source')
  s.eVar20=s.getValOnce(s.eVar20,'s_eVar20',0)

/* Campaign Medium */
if(!s.eVar21)
  s.eVar21=s.getQueryParam('utm_medium')
  s.eVar21=s.getValOnce(s.eVar21,'s_eVar21',0)

/* Campaign Term */
if(!s.eVar22)
  s.eVar22=s.getQueryParam('utm_term')
  s.eVar22=s.getValOnce(s.eVar22,'s_eVar22',0)

/* Campaign Content */
if(!s.eVar23)
  s.eVar23=s.getQueryParam('utm_content')
  s.eVar23=s.getValOnce(s.eVar23,'s_eVar23',0)

/* Internal Campaigns */
if(!s.eVar2)
  s.eVar2=s.getQueryParam('sc_cidint')
  s.eVar2=s.getValOnce(s.eVar2,'s_eVar2',0)

/* Set Page View Event */
s.events=s.events?s.events+',event4':'event4';

/* Props used for TimeParting */

s.prop14=s.getTimeParting('h','+1'); // Set hour 
s.prop15=s.getTimeParting('d','+1'); // Set day 
s.prop16=s.getTimeParting('w','+1'); // Set weekday

/* eVars used for TimeParting */

s.eVar6=s.getTimeParting('h','+1'); // Set hour 
s.eVar7=s.getTimeParting('d','+1'); // Set day 
s.eVar8=s.getTimeParting('w','+1'); // Set weekday


/* Capture previous page and its percent page viewed */

s.prop17=s.getPreviousValue(s.pageName,"s_pv");
if (s.prop17){
    s.prop18=s.getPercentPageViewed();
}

s.setupFormAnalysis();

if(s.channel){s.channel=s.channel.toLowerCase()
s.hier1=s.channel}
if(s.prop1){s.prop1=s.prop1.toLowerCase()
s.hier1=s.hier1+"/"+s.prop1}
if(s.prop2){s.prop2=s.prop2.toLowerCase()
s.hier1=s.hier1+"/"+s.prop2}
if(s.prop3){s.prop3=s.prop3.toLowerCase()
s.hier1=s.hier1+"/"+s.prop3}
if(s.prop4){s.prop4=s.prop4.toLowerCase()
s.hier1=s.hier1+"/"+s.prop4}
if(s.prop5){s.prop5=s.prop5.toLowerCase()
s.hier1=s.hier1+"/"+s.prop5}

/* Copy props into eVars */

if(s.prop9){s.prop9=s.prop9.toLowerCase()
s.eVar4=s.getValOnce(s.prop9,'s_eVar4',0)}

if(s.prop10){s.prop10=s.prop10.toLowerCase()
s.eVar5=s.getValOnce(s.prop10,'s_eVar5',0)}

if(s.prop17){s.prop17=s.prop17.toLowerCase()
s.eVar9=s.getValOnce(s.prop17,'s_eVar9',0)}

if(s.prop18){s.prop18=s.prop18.toLowerCase()
s.eVar10=s.getValOnce(s.prop18,'s_eVar10',0)}

if(s.prop19){s.prop19=s.prop19.toLowerCase()
s.eVar13=s.getValOnce(s.prop19,'s_eVar13',0)}
}

s.doPlugins=s_doPlugins

/* WARNING: Changing any of the below variables will cause drastic
changes to how your visitor data is collected.  Changes should only be
made when instructed to do so by your account manager.*/
s.visitorNamespace="leroymerlin"
s.trackingServer="leroymerlin.112.2o7.net"

/************** Required Plug-ins *************/
/*
 * Plugin: getQueryParam 2.1 - return query string parameter(s)
 */
s.getQueryParam=new Function("p","d","u",""
+"var s=this,v='',i,t;d=d?d:'';u=u?u:(s.pageURL?s.pageURL:s.wd.locati"
+"on);if(u=='f')u=s.gtfs().location;while(p){i=p.indexOf(',');i=i<0?p"
+".length:i;t=s.p_gpv(p.substring(0,i),u+'');if(t)v+=v?d+t:t;p=p.subs"
+"tring(i==p.length?i:i+1)}return v");
s.p_gpv=new Function("k","u",""
+"var s=this,v='',i=u.indexOf('?'),q;if(k&&i>-1){q=u.substring(i+1);v"
+"=s.pt(q,'&','p_gvf',k)}return v");
s.p_gvf=new Function("t","k",""
+"if(t){var s=this,i=t.indexOf('='),p=i<0?t:t.substring(0,i),v=i<0?'T"
+"rue':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return s."
+"epa(v)}return ''");
/*
 * Plugin: getValOnce 0.2 - get a value once per session or number of days
 */
s.getValOnce=new Function("v","c","e",""
+"var s=this,k=s.c_r(c),a=new Date;e=e?e:0;if(v){a.setTime(a.getTime("
+")+e*86400000);s.c_w(c,v,e?a:0);}return v==k?'':v");
/*
 * Plugin Utility: apl v1.1
 */
s.apl=new Function("L","v","d","u",""
+"var s=this,m=0;if(!L)L='';if(u){var i,n,a=s.split(L,d);for(i=0;i<a."
+"length;i++){n=a[i];m=m||(u==1?(n==v):(n.toLowerCase()==v.toLowerCas"
+"e()));}}if(!m)L=L?L+d+v:v;return L");
/*
 * Plugin: getPageName v2.0 - parse URL and return
 */
s.getPageName=new Function("u",""
+"var s=this,v=u?u:''+s.wd.location,x=v.indexOf(':'),y=v.indexOf('/',"
+"x+4),z=v.indexOf('?'),c=s.pathConcatDelim,e=s.pathExcludeDelim,g=s."
+"queryVarsList,d=s.siteID,n=d?d:'',q=z<0?'':v.substring(z+1),p=v.sub"
+"string(y+1,q?z:v.length);z=p.indexOf('#');p=z<0?p:s.fl(p,z);x=e?p.i"
+"ndexOf(e):-1;p=x<0?p:s.fl(p,x);p+=!p||p[p.length-1]=='/'?s.defaultP"
+"age:'';y=c?c:'/';while(p){x=p.indexOf('/');x=x<0?p.length:x;z=s.fl("
+"p,x);if(!s.pt(s.pathExcludeList,',','p_c',z))n+=n?y+z:z;p=p.substri"
+"ng(x+1)}y=c?c:'?';while(g){x=g.indexOf(',');x=x<0?g.length:x;z=s.fl"
+"(g,x);z=s.pt(q,'&','p_c',z);if(z){n+=n?y+z:z;y=c?c:'&'}g=g.substrin"
+"g(x+1)}return n");
/*
 * Plugin: getTimeParting 2.0 - Set timeparting values based on time zone
 */
s.getTimeParting=new Function("t","z",""
+"var s=this,cy;dc=new Date('1/1/2000');"
+"if(dc.getDay()!=6||dc.getMonth()!=0){return'Data Not Available'}"
+"else{;z=parseFloat(z);var dsts=new Date(s.dstStart);"
+"var dste=new Date(s.dstEnd);fl=dste;cd=new Date();if(cd>dsts&&cd<fl)"
+"{z=z+1}else{z=z};utc=cd.getTime()+(cd.getTimezoneOffset()*60000);"
+"tz=new Date(utc + (3600000*z));thisy=tz.getFullYear();"
+"var days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday',"
+"'Saturday'];if(thisy!=s.currentYear){return'Data Not Available'}else{;"
+"thish=tz.getHours();thismin=tz.getMinutes();thisd=tz.getDay();"
+"var dow=days[thisd];var ap='AM';var dt='Weekday';var mint='00';"
+"if(thismin>30){mint='30'}if(thish>=12){ap='PM';thish=thish-12};"
+"if (thish==0){thish=12};if(thisd==6||thisd==0){dt='Weekend'};"
+"var timestring=thish+':'+mint+ap;if(t=='h'){return timestring}"
+"if(t=='d'){return dow};if(t=='w'){return dt}}};");
/*
 * Plugin: getPercentPageViewed v1.2
 */
s.getPercentPageViewed=new Function("",""
+"var s=this;if(typeof(s.linkType)=='undefined'||s.linkType=='e'){var"
+" v=s.c_r('s_ppv');s.c_w('s_ppv',0);return v;}");
s.getPPVCalc=new Function("",""
+"var s=s_c_il["+s._in+"],dh=Math.max(Math.max(s.d.body.scrollHeight,"
+"s.d.documentElement.scrollHeight),Math.max(s.d.body.offsetHeight,s."
+"d.documentElement.offsetHeight),Math.max(s.d.body.clientHeight,s.d."
+"documentElement.clientHeight)),vph=s.wd.innerHeight||(s.d.documentE"
+"lement.clientHeight||s.d.body.clientHeight),st=s.wd.pageYOffset||(s"
+".wd.document.documentElement.scrollTop||s.wd.document.body.scrollTo"
+"p),vh=st+vph,pv=Math.round(vh/dh*100),cp=s.c_r('s_ppv');if(pv>100){"
+"s.c_w('s_ppv','');}else if(pv>cp){s.c_w('s_ppv',pv);}");
s.getPPVSetup=new Function("",""
+"var s=this;if(s.wd.addEventListener){s.wd.addEventListener('load',s"
+".getPPVCalc,false);s.wd.addEventListener('scroll',s.getPPVCalc,fals"
+"e);s.wd.addEventListener('resize',s.getPPVCalc,false);}else if(s.wd"
+".attachEvent){s.wd.attachEvent('onload',s.getPPVCalc);s.wd.attachEv"
+"ent('onscroll',s.getPPVCalc);s.wd.attachEvent('onresize',s.getPPVCa"
+"lc);}");
s.getPPVSetup();
/*
 * Plugin: getPreviousValue_v1.0 - return previous value of designated
 *   variable (requires split utility)
 */
s.getPreviousValue=new Function("v","c","el",""
+"var s=this,t=new Date,i,j,r='';t.setTime(t.getTime()+1800000);if(el"
+"){if(s.events){i=s.split(el,',');j=s.split(s.events,',');for(x in i"
+"){for(y in j){if(i[x]==j[y]){if(s.c_r(c)) r=s.c_r(c);v?s.c_w(c,v,t)"
+":s.c_w(c,'no value',t);return r}}}}}else{if(s.c_r(c)) r=s.c_r(c);v?"
+"s.c_w(c,v,t):s.c_w(c,'no value',t);return r}");
/*
 * Utility Function: split v1.5 - split a string (JS 1.0 compatible)
 */
s.split=new Function("l","d",""
+"var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x"
+"++]=l.substring(0,i);l=l.substring(i+d.length);}return a");
/*
 * FormAnalysis Function
 */
s.setupFormAnalysis=new Function(""
+"var s=this;if(!s.fa){s.fa=new Object;var f=s.fa;f.ol=s.wd.onload;s."
+"wd.onload=s.faol;f.uc=s.useCommerce;f.vu=s.varUsed;f.vl=f.uc?s.even"
+"tList:'';f.tfl=s.trackFormList;f.fl=s.formList;f.va=new Array('',''"
+",'','')}");s.sendFormEvent=new Function("t","pn","fn","en",""
+"var s=this,f=s.fa;t=t=='s'?t:'e';f.va[0]=pn;f.va[1]=fn;f.va[3]=t=='"
+"s'?'Success':en;s.fasl(t);f.va[1]='';f.va[3]='';");s.faol=new Function("e",""
+"var s=s_c_il["+s._in+"],f=s.fa,r=true,fo,fn,i,en,t,tf;if(!e)e=s.wd."
+"event;f.os=new Array;if(f.ol)r=f.ol(e);if(s.d.forms&&s.d.forms.leng"
+"th>0){for(i=s.d.forms.length-1;i>=0;i--){fo=s.d.forms[i];fn=fo.name"
+";tf=f.tfl&&s.pt(f.fl,',','ee',fn)||!f.tfl&&!s.pt(f.fl,',','ee',fn);"
+"if(tf){f.os[fn]=fo.onsubmit;fo.onsubmit=s.faos;f.va[1]=fn;f.va[3]='"
+"No Data Entered';for(en=0;en<fo.elements.length;en++){el=fo.element"
+"s[en];t=el.type;if(t&&t.toUpperCase){t=t.toUpperCase();var md=el.on"
+"mousedown,kd=el.onkeydown,omd=md?md.toString():'',okd=kd?kd.toStrin"
+"g():'';if(omd.indexOf('.fam(')<0&&okd.indexOf('.fam(')<0){el.s_famd"
+"=md;el.s_fakd=kd;el.onmousedown=s.fam;el.onkeydown=s.fam}}}}}f.ul=s"
+".wd.onunload;s.wd.onunload=s.fasl;}return r;");s.faos=new Function("e",""
+"var s=s_c_il["+s._in+"],f=s.fa,su;if(!e)e=s.wd.event;if(f.vu){s[f.v"
+"u]='';f.va[1]='';f.va[3]='';}su=f.os[this.name];return su?su(e):tru"
+"e;");s.fasl=new Function("e",""
+"var s=s_c_il["+s._in+"],f=s.fa,a=f.va,l=s.wd.location,ip=s.trackPag"
+"eName,p=s.pageName;if(a[1]!=''&&a[3]!=''){a[0]=!p&&ip?l.host+l.path"
+"name:a[0]?a[0]:p;if(!f.uc&&a[3]!='No Data Entered'){if(e=='e')a[2]="
+"'Error';else if(e=='s')a[2]='Success';else a[2]='Abandon'}else a[2]"
+"='';var tp=ip?a[0]+':':'',t3=e!='s'?':('+a[3]+')':'',ym=!f.uc&&a[3]"
+"!='No Data Entered'?tp+a[1]+':'+a[2]+t3:tp+a[1]+t3,ltv=s.linkTrackV"
+"ars,lte=s.linkTrackEvents,up=s.usePlugins;if(f.uc){s.linkTrackVars="
+"ltv=='None'?f.vu+',events':ltv+',events,'+f.vu;s.linkTrackEvents=lt"
+"e=='None'?f.vl:lte+','+f.vl;f.cnt=-1;if(e=='e')s.events=s.pt(f.vl,'"
+",','fage',2);else if(e=='s')s.events=s.pt(f.vl,',','fage',1);else s"
+".events=s.pt(f.vl,',','fage',0)}else{s.linkTrackVars=ltv=='None'?f."
+"vu:ltv+','+f.vu}s[f.vu]=ym;s.usePlugins=false;var faLink=new Object"
+"();faLink.href='#';s.tl(faLink,'o','Form Analysis');s[f.vu]='';s.us"
+"ePlugins=up}return f.ul&&e!='e'&&e!='s'?f.ul(e):true;");s.fam=new Function("e",""
+"var s=s_c_il["+s._in+"],f=s.fa;if(!e) e=s.wd.event;var o=s.trackLas"
+"tChanged,et=e.type.toUpperCase(),t=this.type.toUpperCase(),fn=this."
+"form.name,en=this.name,sc=false;if(document.layers){kp=e.which;b=e."
+"which}else{kp=e.keyCode;b=e.button}et=et=='MOUSEDOWN'?1:et=='KEYDOW"
+"N'?2:et;if(f.ce!=en||f.cf!=fn){if(et==1&&b!=2&&'BUTTONSUBMITRESETIM"
+"AGERADIOCHECKBOXSELECT-ONEFILE'.indexOf(t)>-1){f.va[1]=fn;f.va[3]=e"
+"n;sc=true}else if(et==1&&b==2&&'TEXTAREAPASSWORDFILE'.indexOf(t)>-1"
+"){f.va[1]=fn;f.va[3]=en;sc=true}else if(et==2&&kp!=9&&kp!=13){f.va["
+"1]=fn;f.va[3]=en;sc=true}if(sc){nface=en;nfacf=fn}}if(et==1&&this.s"
+"_famd)return this.s_famd(e);if(et==2&&this.s_fakd)return this.s_fak"
+"d(e);");s.ee=new Function("e","n",""
+"return n&&n.toLowerCase?e.toLowerCase()==n.toLowerCase():false;");s.fage=new Function("e","a",""
+"var s=this,f=s.fa,x=f.cnt;x=x?x+1:1;f.cnt=x;return x==a?e:'';");

/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code='',s_objectID;function s_gi(un,pg,ss){var c="s.version='H.23.3';s.an=s_an;s.logDebug=function(m){var s=this,tcf=new Function('var e;try{console.log(\"'+s.rep(s.rep(m,\"\\n\",\"\\\\n\"),\""
+"\\\"\",\"\\\\\\\"\")+'\");}catch(e){}');tcf()};s.cls=function(x,c){var i,y='';if(!c)c=this.an;for(i=0;i<x.length;i++){n=x.substring(i,i+1);if(c.indexOf(n)>=0)y+=n}return y};s.fl=function(x,l){retur"
+"n x?(''+x).substring(0,l):x};s.co=function(o){if(!o)return o;var n=new Object,x;for(x in o)if(x.indexOf('select')<0&&x.indexOf('filter')<0)n[x]=o[x];return n};s.num=function(x){x=''+x;for(var p=0;p"
+"<x.length;p++)if(('0123456789').indexOf(x.substring(p,p+1))<0)return 0;return 1};s.rep=s_rep;s.sp=s_sp;s.jn=s_jn;s.ape=function(x){var s=this,h='0123456789ABCDEF',i,c=s.charSet,n,l,e,y='';c=c?c.toU"
+"pperCase():'';if(x){x=''+x;if(s.em==3)x=encodeURIComponent(x);else if(c=='AUTO'&&('').charCodeAt){for(i=0;i<x.length;i++){c=x.substring(i,i+1);n=x.charCodeAt(i);if(n>127){l=0;e='';while(n||l<4){e=h"
+".substring(n%16,n%16+1)+e;n=(n-n%16)/16;l++}y+='%u'+e}else if(c=='+')y+='%2B';else y+=escape(c)}x=y}else x=escape(''+x);x=s.rep(x,'+','%2B');if(c&&c!='AUTO'&&s.em==1&&x.indexOf('%u')<0&&x.indexOf('"
+"%U')<0){i=x.indexOf('%');while(i>=0){i++;if(h.substring(8).indexOf(x.substring(i,i+1).toUpperCase())>=0)return x.substring(0,i)+'u00'+x.substring(i);i=x.indexOf('%',i)}}}return x};s.epa=function(x)"
+"{var s=this;if(x){x=s.rep(''+x,'+',' ');return s.em==3?decodeURIComponent(x):unescape(x)}return x};s.pt=function(x,d,f,a){var s=this,t=x,z=0,y,r;while(t){y=t.indexOf(d);y=y<0?t.length:y;t=t.substri"
+"ng(0,y);r=s[f](t,a);if(r)return r;z+=y+d.length;t=x.substring(z,x.length);t=z<x.length?t:''}return ''};s.isf=function(t,a){var c=a.indexOf(':');if(c>=0)a=a.substring(0,c);c=a.indexOf('=');if(c>=0)a"
+"=a.substring(0,c);if(t.substring(0,2)=='s_')t=t.substring(2);return (t!=''&&t==a)};s.fsf=function(t,a){var s=this;if(s.pt(a,',','isf',t))s.fsg+=(s.fsg!=''?',':'')+t;return 0};s.fs=function(x,f){var"
+" s=this;s.fsg='';s.pt(x,',','fsf',f);return s.fsg};s.si=function(){var s=this,i,k,v,c=s_gi+'var s=s_gi(\"'+s.oun+'\");s.sa(\"'+s.un+'\");';for(i=0;i<s.va_g.length;i++){k=s.va_g[i];v=s[k];if(v!=unde"
+"fined){if(typeof(v)!='number')c+='s.'+k+'=\"'+s_fe(v)+'\";';else c+='s.'+k+'='+v+';'}}c+=\"s.lnk=s.eo=s.linkName=s.linkType=s.wd.s_objectID=s.ppu=s.pe=s.pev1=s.pev2=s.pev3='';\";return c};s.c_d='';"
+"s.c_gdf=function(t,a){var s=this;if(!s.num(t))return 1;return 0};s.c_gd=function(){var s=this,d=s.wd.location.hostname,n=s.fpCookieDomainPeriods,p;if(!n)n=s.cookieDomainPeriods;if(d&&!s.c_d){n=n?pa"
+"rseInt(n):2;n=n>2?n:2;p=d.lastIndexOf('.');if(p>=0){while(p>=0&&n>1){p=d.lastIndexOf('.',p-1);n--}s.c_d=p>0&&s.pt(d,'.','c_gdf',0)?d.substring(p):d}}return s.c_d};s.c_r=function(k){var s=this;k=s.a"
+"pe(k);var c=' '+s.d.cookie,i=c.indexOf(' '+k+'='),e=i<0?i:c.indexOf(';',i),v=i<0?'':s.epa(c.substring(i+2+k.length,e<0?c.length:e));return v!='[[B]]'?v:''};s.c_w=function(k,v,e){var s=this,d=s.c_gd"
+"(),l=s.cookieLifetime,t;v=''+v;l=l?(''+l).toUpperCase():'';if(e&&l!='SESSION'&&l!='NONE'){t=(v!=''?parseInt(l?l:0):-60);if(t){e=new Date;e.setTime(e.getTime()+(t*1000))}}if(k&&l!='NONE'){s.d.cookie"
+"=k+'='+s.ape(v!=''?v:'[[B]]')+'; path=/;'+(e&&l!='SESSION'?' expires='+e.toGMTString()+';':'')+(d?' domain='+d+';':'');return s.c_r(k)==v}return 0};s.eh=function(o,e,r,f){var s=this,b='s_'+e+'_'+s."
+"_in,n=-1,l,i,x;if(!s.ehl)s.ehl=new Array;l=s.ehl;for(i=0;i<l.length&&n<0;i++){if(l[i].o==o&&l[i].e==e)n=i}if(n<0){n=i;l[n]=new Object}x=l[n];x.o=o;x.e=e;f=r?x.b:f;if(r||f){x.b=r?0:o[e];x.o[e]=f}if("
+"x.b){x.o[b]=x.b;return b}return 0};s.cet=function(f,a,t,o,b){var s=this,r,tcf;if(s.apv>=5&&(!s.isopera||s.apv>=7)){tcf=new Function('s','f','a','t','var e,r;try{r=s[f](a)}catch(e){r=s[t](e)}return "
+"r');r=tcf(s,f,a,t)}else{if(s.ismac&&s.u.indexOf('MSIE 4')>=0)r=s[b](a);else{s.eh(s.wd,'onerror',0,o);r=s[f](a);s.eh(s.wd,'onerror',1)}}return r};s.gtfset=function(e){var s=this;return s.tfs};s.gtfs"
+"oe=new Function('e','var s=s_c_il['+s._in+'],c;s.eh(window,\"onerror\",1);s.etfs=1;c=s.t();if(c)s.d.write(c);s.etfs=0;return true');s.gtfsfb=function(a){return window};s.gtfsf=function(w){var s=thi"
+"s,p=w.parent,l=w.location;s.tfs=w;if(p&&p.location!=l&&p.location.host==l.host){s.tfs=p;return s.gtfsf(s.tfs)}return s.tfs};s.gtfs=function(){var s=this;if(!s.tfs){s.tfs=s.wd;if(!s.etfs)s.tfs=s.cet"
+"('gtfsf',s.tfs,'gtfset',s.gtfsoe,'gtfsfb')}return s.tfs};s.mrq=function(u){var s=this,l=s.rl[u],n,r;s.rl[u]=0;if(l)for(n=0;n<l.length;n++){r=l[n];s.mr(0,0,r.r,r.t,r.u)}};s.flushBufferedRequests=fun"
+"ction(){};s.mr=function(sess,q,rs,ta,u){var s=this,dc=s.dc,t1=s.trackingServer,t2=s.trackingServerSecure,tb=s.trackingServerBase,p='.sc',ns=s.visitorNamespace,un=s.cls(u?u:(ns?ns:s.fun)),r=new Obje"
+"ct,l,imn='s_i_'+(un),im,b,e;if(!rs){if(t1){if(t2&&s.ssl)t1=t2}else{if(!tb)tb='2o7.net';if(dc)dc=(''+dc).toLowerCase();else dc='d1';if(tb=='2o7.net'){if(dc=='d1')dc='112';else if(dc=='d2')dc='122';p"
+"=''}t1=un+'.'+dc+'.'+p+tb}rs='http'+(s.ssl?'s':'')+'://'+t1+'/b/ss/'+s.un+'/'+(s.mobile?'5.1':'1')+'/'+s.version+'/'+sess+'?AQB=1&ndh=1'+(q?q:'')+'&AQE=1';if(s.isie&&!s.ismac)rs=s.fl(rs,2047)}if(s."
+"d.images&&s.apv>=3&&(!s.isopera||s.apv>=7)&&(s.ns6<0||s.apv>=6.1)){if(!s.rc)s.rc=new Object;if(!s.rc[un]){s.rc[un]=1;if(!s.rl)s.rl=new Object;s.rl[un]=new Array;setTimeout('if(window.s_c_il)window."
+"s_c_il['+s._in+'].mrq(\"'+un+'\")',750)}else{l=s.rl[un];if(l){r.t=ta;r.u=un;r.r=rs;l[l.length]=r;return ''}imn+='_'+s.rc[un];s.rc[un]++}im=s.wd[imn];if(!im)im=s.wd[imn]=new Image;im.s_l=0;im.onload"
+"=new Function('e','this.s_l=1;var wd=window,s;if(wd.s_c_il){s=wd.s_c_il['+s._in+'];s.mrq(\"'+un+'\");s.nrs--;if(!s.nrs)s.m_m(\"rr\")}');if(!s.nrs){s.nrs=1;s.m_m('rs')}else s.nrs++;if(s.debugTrackin"
+"g){var d='AppMeasurement Debug: '+rs,dl=s.sp(rs,'&'),dln;for(dln=0;dln<dl.length;dln++)d+=\"\\n\\t\"+s.epa(dl[dln]);s.logDebug(d)}im.src=rs;if((!ta||ta=='_self'||ta=='_top'||(s.wd.name&&ta==s.wd.na"
+"me))&&rs.indexOf('&pe=')>=0){b=e=new Date;while(!im.s_l&&e.getTime()-b.getTime()<500)e=new Date}return ''}return '<im'+'g sr'+'c=\"'+rs+'\" width=1 height=1 border=0 alt=\"\">'};s.gg=function(v){va"
+"r s=this;if(!s.wd['s_'+v])s.wd['s_'+v]='';return s.wd['s_'+v]};s.glf=function(t,a){if(t.substring(0,2)=='s_')t=t.substring(2);var s=this,v=s.gg(t);if(v)s[t]=v};s.gl=function(v){var s=this;if(s.pg)s"
+".pt(v,',','glf',0)};s.rf=function(x){var s=this,y,i,j,h,p,l=0,q,a,b='',c='',t;if(x&&x.length>255){y=''+x;i=y.indexOf('?');if(i>0){q=y.substring(i+1);y=y.substring(0,i);h=y.toLowerCase();j=0;if(h.su"
+"bstring(0,7)=='http://')j+=7;else if(h.substring(0,8)=='https://')j+=8;i=h.indexOf(\"/\",j);if(i>0){h=h.substring(j,i);p=y.substring(i);y=y.substring(0,i);if(h.indexOf('google')>=0)l=',q,ie,start,s"
+"earch_key,word,kw,cd,';else if(h.indexOf('yahoo.co')>=0)l=',p,ei,';if(l&&q){a=s.sp(q,'&');if(a&&a.length>1){for(j=0;j<a.length;j++){t=a[j];i=t.indexOf('=');if(i>0&&l.indexOf(','+t.substring(0,i)+',"
+"')>=0)b+=(b?'&':'')+t;else c+=(c?'&':'')+t}if(b&&c)q=b+'&'+c;else c=''}i=253-(q.length-c.length)-y.length;x=y+(i>0?p.substring(0,i):'')+'?'+q}}}}return x};s.s2q=function(k,v,vf,vfp,f){var s=this,qs"
+"='',sk,sv,sp,ss,nke,nk,nf,nfl=0,nfn,nfm;if(k==\"contextData\")k=\"c\";if(v){for(sk in v) {if((!f||sk.substring(0,f.length)==f)&&v[sk]&&(!vf||vf.indexOf(','+(vfp?vfp+'.':'')+sk+',')>=0)){nfm=0;if(nf"
+"l)for(nfn=0;nfn<nfl.length;nfn++)if(sk.substring(0,nfl[nfn].length)==nfl[nfn])nfm=1;if(!nfm){if(qs=='')qs+='&'+k+'.';sv=v[sk];if(f)sk=sk.substring(f.length);if(sk.length>0){nke=sk.indexOf('.');if(n"
+"ke>0){nk=sk.substring(0,nke);nf=(f?f:'')+nk+'.';if(!nfl)nfl=new Array;nfl[nfl.length]=nf;qs+=s.s2q(nk,v,vf,vfp,nf)}else{if(typeof(sv)=='boolean'){if(sv)sv='true';else sv='false'}if(sv){if(vfp=='ret"
+"rieveLightData'&&f.indexOf('.contextData.')<0){sp=sk.substring(0,4);ss=sk.substring(4);if(sk=='transactionID')sk='xact';else if(sk=='channel')sk='ch';else if(sk=='campaign')sk='v0';else if(s.num(ss"
+")){if(sp=='prop')sk='c'+ss;else if(sp=='eVar')sk='v'+ss;else if(sp=='list')sk='l'+ss;else if(sp=='hier'){sk='h'+ss;sv=sv.substring(0,255)}}}qs+='&'+s.ape(sk)+'='+s.ape(sv)}}}}}}if(qs!='')qs+='&.'+k"
+"}return qs};s.hav=function(){var s=this,qs='',l,fv='',fe='',mn,i,e;if(s.lightProfileID){l=s.va_m;fv=s.lightTrackVars;if(fv)fv=','+fv+','+s.vl_mr+','}else{l=s.va_t;if(s.pe||s.linkType){fv=s.linkTrac"
+"kVars;fe=s.linkTrackEvents;if(s.pe){mn=s.pe.substring(0,1).toUpperCase()+s.pe.substring(1);if(s[mn]){fv=s[mn].trackVars;fe=s[mn].trackEvents}}}if(fv)fv=','+fv+','+s.vl_l+','+s.vl_l2;if(fe){fe=','+f"
+"e+',';if(fv)fv+=',events,'}if (s.events2)e=(e?',':'')+s.events2}for(i=0;i<l.length;i++){var k=l[i],v=s[k],b=k.substring(0,4),x=k.substring(4),n=parseInt(x),q=k;if(!v)if(k=='events'&&e){v=e;e=''}if("
+"v&&(!fv||fv.indexOf(k)>=0)&&k!='linkName'&&k!='linkType'){if(k=='timestamp')q='ts';else if(k=='dynamicVariablePrefix')q='D';else if(k=='visitorID')q='vid';else if(k=='pageURL'){q='g';v=s.fl(v,255)}"
+"else if(k=='referrer'){q='r';v=s.fl(s.rf(v),255)}else if(k=='vmk'||k=='visitorMigrationKey')q='vmt';else if(k=='visitorMigrationServer'){q='vmf';if(s.ssl&&s.visitorMigrationServerSecure)v=''}else i"
+"f(k=='visitorMigrationServerSecure'){q='vmf';if(!s.ssl&&s.visitorMigrationServer)v=''}else if(k=='charSet'){q='ce';if(v.toUpperCase()=='AUTO')v='ISO8859-1';else if(s.em==2||s.em==3)v='UTF-8'}else i"
+"f(k=='visitorNamespace')q='ns';else if(k=='cookieDomainPeriods')q='cdp';else if(k=='cookieLifetime')q='cl';else if(k=='variableProvider')q='vvp';else if(k=='currencyCode')q='cc';else if(k=='channel"
+"')q='ch';else if(k=='transactionID')q='xact';else if(k=='campaign')q='v0';else if(k=='resolution')q='s';else if(k=='colorDepth')q='c';else if(k=='javascriptVersion')q='j';else if(k=='javaEnabled')q"
+"='v';else if(k=='cookiesEnabled')q='k';else if(k=='browserWidth')q='bw';else if(k=='browserHeight')q='bh';else if(k=='connectionType')q='ct';else if(k=='homepage')q='hp';else if(k=='plugins')q='p';"
+"else if(k=='events'){if(e)v+=(v?',':'')+e;if(fe)v=s.fs(v,fe)}else if(k=='events2')v='';else if(k=='contextData'){qs+=s.s2q('c',s[k],fv,k,0);v=''}else if(k=='lightProfileID')q='mtp';else if(k=='ligh"
+"tStoreForSeconds'){q='mtss';if(!s.lightProfileID)v=''}else if(k=='lightIncrementBy'){q='mti';if(!s.lightProfileID)v=''}else if(k=='retrieveLightProfiles')q='mtsr';else if(k=='deleteLightProfiles')q"
+"='mtsd';else if(k=='retrieveLightData'){if(s.retrieveLightProfiles)qs+=s.s2q('mts',s[k],fv,k,0);v=''}else if(s.num(x)){if(b=='prop')q='c'+n;else if(b=='eVar')q='v'+n;else if(b=='list')q='l'+n;else "
+"if(b=='hier'){q='h'+n;v=s.fl(v,255)}}if(v)qs+='&'+s.ape(q)+'='+(k.substring(0,3)!='pev'?s.ape(v):v)}}return qs};s.ltdf=function(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';var qi=h.indexOf('"
+"?');h=qi>=0?h.substring(0,qi):h;if(t&&h.substring(h.length-(t.length+1))=='.'+t)return 1;return 0};s.ltef=function(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';if(t&&h.indexOf(t)>=0)return 1;"
+"return 0};s.lt=function(h){var s=this,lft=s.linkDownloadFileTypes,lef=s.linkExternalFilters,lif=s.linkInternalFilters;lif=lif?lif:s.wd.location.hostname;h=h.toLowerCase();if(s.trackDownloadLinks&&l"
+"ft&&s.pt(lft,',','ltdf',h))return 'd';if(s.trackExternalLinks&&h.substring(0,1)!='#'&&(lef||lif)&&(!lef||s.pt(lef,',','ltef',h))&&(!lif||!s.pt(lif,',','ltef',h)))return 'e';return ''};s.lc=new Func"
+"tion('e','var s=s_c_il['+s._in+'],b=s.eh(this,\"onclick\");s.lnk=s.co(this);s.t();s.lnk=0;if(b)return this[b](e);return true');s.bc=new Function('e','var s=s_c_il['+s._in+'],f,tcf;if(s.d&&s.d.all&&"
+"s.d.all.cppXYctnr)return;s.eo=e.srcElement?e.srcElement:e.target;tcf=new Function(\"s\",\"var e;try{if(s.eo&&(s.eo.tagName||s.eo.parentElement||s.eo.parentNode))s.t()}catch(e){}\");tcf(s);s.eo=0');"
+"s.oh=function(o){var s=this,l=s.wd.location,h=o.href?o.href:'',i,j,k,p;i=h.indexOf(':');j=h.indexOf('?');k=h.indexOf('/');if(h&&(i<0||(j>=0&&i>j)||(k>=0&&i>k))){p=o.protocol&&o.protocol.length>1?o."
+"protocol:(l.protocol?l.protocol:'');i=l.pathname.lastIndexOf('/');h=(p?p+'//':'')+(o.host?o.host:(l.host?l.host:''))+(h.substring(0,1)!='/'?l.pathname.substring(0,i<0?0:i)+'/':'')+h}return h};s.ot="
+"function(o){var t=o.tagName;if(o.tagUrn||(o.scopeName&&o.scopeName.toUpperCase()!='HTML'))return '';t=t&&t.toUpperCase?t.toUpperCase():'';if(t=='SHAPE')t='';if(t){if((t=='INPUT'||t=='BUTTON')&&o.ty"
+"pe&&o.type.toUpperCase)t=o.type.toUpperCase();else if(!t&&o.href)t='A';}return t};s.oid=function(o){var s=this,t=s.ot(o),p,c,n='',x=0;if(t&&!o.s_oid){p=o.protocol;c=o.onclick;if(o.href&&(t=='A'||t="
+"='AREA')&&(!c||!p||p.toLowerCase().indexOf('javascript')<0))n=s.oh(o);else if(c){n=s.rep(s.rep(s.rep(s.rep(''+c,\"\\r\",''),\"\\n\",''),\"\\t\",''),' ','');x=2}else if(t=='INPUT'||t=='SUBMIT'){if(o"
+".value)n=o.value;else if(o.innerText)n=o.innerText;else if(o.textContent)n=o.textContent;x=3}else if(o.src&&t=='IMAGE')n=o.src;if(n){o.s_oid=s.fl(n,100);o.s_oidt=x}}return o.s_oid};s.rqf=function(t"
+",un){var s=this,e=t.indexOf('='),u=e>=0?t.substring(0,e):'',q=e>=0?s.epa(t.substring(e+1)):'';if(u&&q&&(','+u+',').indexOf(','+un+',')>=0){if(u!=s.un&&s.un.indexOf(',')>=0)q='&u='+u+q+'&u=0';return"
+" q}return ''};s.rq=function(un){if(!un)un=this.un;var s=this,c=un.indexOf(','),v=s.c_r('s_sq'),q='';if(c<0)return s.pt(v,'&','rqf',un);return s.pt(un,',','rq',0)};s.sqp=function(t,a){var s=this,e=t"
+".indexOf('='),q=e<0?'':s.epa(t.substring(e+1));s.sqq[q]='';if(e>=0)s.pt(t.substring(0,e),',','sqs',q);return 0};s.sqs=function(un,q){var s=this;s.squ[un]=q;return 0};s.sq=function(q){var s=this,k='"
+"s_sq',v=s.c_r(k),x,c=0;s.sqq=new Object;s.squ=new Object;s.sqq[q]='';s.pt(v,'&','sqp',0);s.pt(s.un,',','sqs',q);v='';for(x in s.squ)if(x&&(!Object||!Object.prototype||!Object.prototype[x]))s.sqq[s."
+"squ[x]]+=(s.sqq[s.squ[x]]?',':'')+x;for(x in s.sqq)if(x&&(!Object||!Object.prototype||!Object.prototype[x])&&s.sqq[x]&&(x==q||c<2)){v+=(v?'&':'')+s.sqq[x]+'='+s.ape(x);c++}return s.c_w(k,v,0)};s.wd"
+"l=new Function('e','var s=s_c_il['+s._in+'],r=true,b=s.eh(s.wd,\"onload\"),i,o,oc;if(b)r=this[b](e);for(i=0;i<s.d.links.length;i++){o=s.d.links[i];oc=o.onclick?\"\"+o.onclick:\"\";if((oc.indexOf(\""
+"s_gs(\")<0||oc.indexOf(\".s_oc(\")>=0)&&oc.indexOf(\".tl(\")<0)s.eh(o,\"onclick\",0,s.lc);}return r');s.wds=function(){var s=this;if(s.apv>3&&(!s.isie||!s.ismac||s.apv>=5)){if(s.b&&s.b.attachEvent)"
+"s.b.attachEvent('onclick',s.bc);else if(s.b&&s.b.addEventListener)s.b.addEventListener('click',s.bc,false);else s.eh(s.wd,'onload',0,s.wdl)}};s.vs=function(x){var s=this,v=s.visitorSampling,g=s.vis"
+"itorSamplingGroup,k='s_vsn_'+s.un+(g?'_'+g:''),n=s.c_r(k),e=new Date,y=e.getYear();e.setYear(y+10+(y<1900?1900:0));if(v){v*=100;if(!n){if(!s.c_w(k,x,e))return 0;n=x}if(n%10000>v)return 0}return 1};"
+"s.dyasmf=function(t,m){if(t&&m&&m.indexOf(t)>=0)return 1;return 0};s.dyasf=function(t,m){var s=this,i=t?t.indexOf('='):-1,n,x;if(i>=0&&m){var n=t.substring(0,i),x=t.substring(i+1);if(s.pt(x,',','dy"
+"asmf',m))return n}return 0};s.uns=function(){var s=this,x=s.dynamicAccountSelection,l=s.dynamicAccountList,m=s.dynamicAccountMatch,n,i;s.un=s.un.toLowerCase();if(x&&l){if(!m)m=s.wd.location.host;if"
+"(!m.toLowerCase)m=''+m;l=l.toLowerCase();m=m.toLowerCase();n=s.pt(l,';','dyasf',m);if(n)s.un=n}i=s.un.indexOf(',');s.fun=i<0?s.un:s.un.substring(0,i)};s.sa=function(un){var s=this;s.un=un;if(!s.oun"
+")s.oun=un;else if((','+s.oun+',').indexOf(','+un+',')<0)s.oun+=','+un;s.uns()};s.m_i=function(n,a){var s=this,m,f=n.substring(0,1),r,l,i;if(!s.m_l)s.m_l=new Object;if(!s.m_nl)s.m_nl=new Array;m=s.m"
+"_l[n];if(!a&&m&&m._e&&!m._i)s.m_a(n);if(!m){m=new Object,m._c='s_m';m._in=s.wd.s_c_in;m._il=s._il;m._il[m._in]=m;s.wd.s_c_in++;m.s=s;m._n=n;m._l=new Array('_c','_in','_il','_i','_e','_d','_dl','s',"
+"'n','_r','_g','_g1','_t','_t1','_x','_x1','_rs','_rr','_l');s.m_l[n]=m;s.m_nl[s.m_nl.length]=n}else if(m._r&&!m._m){r=m._r;r._m=m;l=m._l;for(i=0;i<l.length;i++)if(m[l[i]])r[l[i]]=m[l[i]];r._il[r._i"
+"n]=r;m=s.m_l[n]=r}if(f==f.toUpperCase())s[n]=m;return m};s.m_a=new Function('n','g','e','if(!g)g=\"m_\"+n;var s=s_c_il['+s._in+'],c=s[g+\"_c\"],m,x,f=0;if(!c)c=s.wd[\"s_\"+g+\"_c\"];if(c&&s_d)s[g]="
+"new Function(\"s\",s_ft(s_d(c)));x=s[g];if(!x)x=s.wd[\\'s_\\'+g];if(!x)x=s.wd[g];m=s.m_i(n,1);if(x&&(!m._i||g!=\"m_\"+n)){m._i=f=1;if((\"\"+x).indexOf(\"function\")>=0)x(s);else s.m_m(\"x\",n,x,e)}"
+"m=s.m_i(n,1);if(m._dl)m._dl=m._d=0;s.dlt();return f');s.m_m=function(t,n,d,e){t='_'+t;var s=this,i,x,m,f='_'+t,r=0,u;if(s.m_l&&s.m_nl)for(i=0;i<s.m_nl.length;i++){x=s.m_nl[i];if(!n||x==n){m=s.m_i(x"
+");u=m[t];if(u){if((''+u).indexOf('function')>=0){if(d&&e)u=m[t](d,e);else if(d)u=m[t](d);else u=m[t]()}}if(u)r=1;u=m[t+1];if(u&&!m[f]){if((''+u).indexOf('function')>=0){if(d&&e)u=m[t+1](d,e);else i"
+"f(d)u=m[t+1](d);else u=m[t+1]()}}m[f]=1;if(u)r=1}}return r};s.m_ll=function(){var s=this,g=s.m_dl,i,o;if(g)for(i=0;i<g.length;i++){o=g[i];if(o)s.loadModule(o.n,o.u,o.d,o.l,o.e,1);g[i]=0}};s.loadMod"
+"ule=function(n,u,d,l,e,ln){var s=this,m=0,i,g,o=0,f1,f2,c=s.h?s.h:s.b,b,tcf;if(n){i=n.indexOf(':');if(i>=0){g=n.substring(i+1);n=n.substring(0,i)}else g=\"m_\"+n;m=s.m_i(n)}if((l||(n&&!s.m_a(n,g)))"
+"&&u&&s.d&&c&&s.d.createElement){if(d){m._d=1;m._dl=1}if(ln){if(s.ssl)u=s.rep(u,'http:','https:');i='s_s:'+s._in+':'+n+':'+g;b='var s=s_c_il['+s._in+'],o=s.d.getElementById(\"'+i+'\");if(s&&o){if(!o"
+".l&&s.wd.'+g+'){o.l=1;if(o.i)clearTimeout(o.i);o.i=0;s.m_a(\"'+n+'\",\"'+g+'\"'+(e?',\"'+e+'\"':'')+')}';f2=b+'o.c++;if(!s.maxDelay)s.maxDelay=250;if(!o.l&&o.c<(s.maxDelay*2)/100)o.i=setTimeout(o.f"
+"2,100)}';f1=new Function('e',b+'}');tcf=new Function('s','c','i','u','f1','f2','var e,o=0;try{o=s.d.createElement(\"script\");if(o){o.type=\"text/javascript\";'+(n?'o.id=i;o.defer=true;o.onload=o.o"
+"nreadystatechange=f1;o.f2=f2;o.l=0;':'')+'o.src=u;c.appendChild(o);'+(n?'o.c=0;o.i=setTimeout(f2,100)':'')+'}}catch(e){o=0}return o');o=tcf(s,c,i,u,f1,f2)}else{o=new Object;o.n=n+':'+g;o.u=u;o.d=d;"
+"o.l=l;o.e=e;g=s.m_dl;if(!g)g=s.m_dl=new Array;i=0;while(i<g.length&&g[i])i++;g[i]=o}}else if(n){m=s.m_i(n);m._e=1}return m};s.voa=function(vo,r){var s=this,l=s.va_g,i,k,v,x;for(i=0;i<l.length;i++){"
+"k=l[i];v=vo[k];if(v||vo['!'+k]){if(!r&&(k==\"contextData\"||k==\"retrieveLightData\")&&s[k])for(x in s[k])if(!v[x])v[x]=s[k][x];s[k]=v}}};s.vob=function(vo){var s=this,l=s.va_g,i,k;for(i=0;i<l.leng"
+"th;i++){k=l[i];vo[k]=s[k];if(!vo[k])vo['!'+k]=1}};s.dlt=new Function('var s=s_c_il['+s._in+'],d=new Date,i,vo,f=0;if(s.dll)for(i=0;i<s.dll.length;i++){vo=s.dll[i];if(vo){if(!s.m_m(\"d\")||d.getTime"
+"()-vo._t>=s.maxDelay){s.dll[i]=0;s.t(vo)}else f=1}}if(s.dli)clearTimeout(s.dli);s.dli=0;if(f){if(!s.dli)s.dli=setTimeout(s.dlt,s.maxDelay)}else s.dll=0');s.dl=function(vo){var s=this,d=new Date;if("
+"!vo)vo=new Object;s.vob(vo);vo._t=d.getTime();if(!s.dll)s.dll=new Array;s.dll[s.dll.length]=vo;if(!s.maxDelay)s.maxDelay=250;s.dlt()};s.track=s.t=function(vo){var s=this,trk=1,tm=new Date,sed=Math&"
+"&Math.random?Math.floor(Math.random()*10000000000000):tm.getTime(),sess='s'+Math.floor(tm.getTime()/10800000)%10+sed,y=tm.getYear(),vt=tm.getDate()+'/'+tm.getMonth()+'/'+(y<1900?y+1900:y)+' '+tm.ge"
+"tHours()+':'+tm.getMinutes()+':'+tm.getSeconds()+' '+tm.getDay()+' '+tm.getTimezoneOffset(),tcf,tfs=s.gtfs(),ta=-1,q='',qs='',code='',vb=new Object;s.gl(s.vl_g);s.uns();s.m_ll();if(!s.td){var tl=tf"
+"s.location,a,o,i,x='',c='',v='',p='',bw='',bh='',j='1.0',k=s.c_w('s_cc','true',0)?'Y':'N',hp='',ct='',pn=0,ps;if(String&&String.prototype){j='1.1';if(j.match){j='1.2';if(tm.setUTCDate){j='1.3';if(s"
+".isie&&s.ismac&&s.apv>=5)j='1.4';if(pn.toPrecision){j='1.5';a=new Array;if(a.forEach){j='1.6';i=0;o=new Object;tcf=new Function('o','var e,i=0;try{i=new Iterator(o)}catch(e){}return i');i=tcf(o);if"
+"(i&&i.next)j='1.7'}}}}}if(s.apv>=4)x=screen.width+'x'+screen.height;if(s.isns||s.isopera){if(s.apv>=3){v=s.n.javaEnabled()?'Y':'N';if(s.apv>=4){c=screen.pixelDepth;bw=s.wd.innerWidth;bh=s.wd.innerH"
+"eight}}s.pl=s.n.plugins}else if(s.isie){if(s.apv>=4){v=s.n.javaEnabled()?'Y':'N';c=screen.colorDepth;if(s.apv>=5){bw=s.d.documentElement.offsetWidth;bh=s.d.documentElement.offsetHeight;if(!s.ismac&"
+"&s.b){tcf=new Function('s','tl','var e,hp=0;try{s.b.addBehavior(\"#default#homePage\");hp=s.b.isHomePage(tl)?\"Y\":\"N\"}catch(e){}return hp');hp=tcf(s,tl);tcf=new Function('s','var e,ct=0;try{s.b."
+"addBehavior(\"#default#clientCaps\");ct=s.b.connectionType}catch(e){}return ct');ct=tcf(s)}}}else r=''}if(s.pl)while(pn<s.pl.length&&pn<30){ps=s.fl(s.pl[pn].name,100)+';';if(p.indexOf(ps)<0)p+=ps;p"
+"n++}s.resolution=x;s.colorDepth=c;s.javascriptVersion=j;s.javaEnabled=v;s.cookiesEnabled=k;s.browserWidth=bw;s.browserHeight=bh;s.connectionType=ct;s.homepage=hp;s.plugins=p;s.td=1}if(vo){s.vob(vb)"
+";s.voa(vo)}if((vo&&vo._t)||!s.m_m('d')){if(s.usePlugins)s.doPlugins(s);var l=s.wd.location,r=tfs.document.referrer;if(!s.pageURL)s.pageURL=l.href?l.href:l;if(!s.referrer&&!s._1_referrer){s.referrer"
+"=r;s._1_referrer=1}s.m_m('g');if(s.lnk||s.eo){var o=s.eo?s.eo:s.lnk;if(!o)return '';var p=s.pageName,w=1,t=s.ot(o),n=s.oid(o),x=o.s_oidt,h,l,i,oc;if(s.eo&&o==s.eo){while(o&&!n&&t!='BODY'){o=o.paren"
+"tElement?o.parentElement:o.parentNode;if(!o)return '';t=s.ot(o);n=s.oid(o);x=o.s_oidt}oc=o.onclick?''+o.onclick:'';if((oc.indexOf(\"s_gs(\")>=0&&oc.indexOf(\".s_oc(\")<0)||oc.indexOf(\".tl(\")>=0)r"
+"eturn ''}if(n)ta=o.target;h=s.oh(o);i=h.indexOf('?');h=s.linkLeaveQueryString||i<0?h:h.substring(0,i);l=s.linkName;t=s.linkType?s.linkType.toLowerCase():s.lt(h);if(t&&(h||l))q+='&pe=lnk_'+(t=='d'||"
+"t=='e'?s.ape(t):'o')+(h?'&pev1='+s.ape(h):'')+(l?'&pev2='+s.ape(l):'');else trk=0;if(s.trackInlineStats){if(!p){p=s.pageURL;w=0}t=s.ot(o);i=o.sourceIndex;if(s.gg('objectID')){n=s.gg('objectID');x=1"
+";i=1}if(p&&n&&t)qs='&pid='+s.ape(s.fl(p,255))+(w?'&pidt='+w:'')+'&oid='+s.ape(s.fl(n,100))+(x?'&oidt='+x:'')+'&ot='+s.ape(t)+(i?'&oi='+i:'')}}if(!trk&&!qs)return '';s.sampled=s.vs(sed);if(trk){if(s"
+".sampled)code=s.mr(sess,(vt?'&t='+s.ape(vt):'')+s.hav()+q+(qs?qs:s.rq()),0,ta);qs='';s.m_m('t');if(s.p_r)s.p_r();s.referrer=s.lightProfileID=s.retrieveLightProfiles=s.deleteLightProfiles=''}s.sq(qs"
+");}else{s.dl(vo);}if(vo)s.voa(vb,1);s.lnk=s.eo=s.linkName=s.linkType=s.wd.s_objectID=s.ppu=s.pe=s.pev1=s.pev2=s.pev3='';if(s.pg)s.wd.s_lnk=s.wd.s_eo=s.wd.s_linkName=s.wd.s_linkType='';return code};"
+"s.trackLink=s.tl=function(o,t,n,vo){var s=this;s.lnk=s.co(o);s.linkType=t;s.linkName=n;s.t(vo)};s.trackLight=function(p,ss,i,vo){var s=this;s.lightProfileID=p;s.lightStoreForSeconds=ss;s.lightIncre"
+"mentBy=i;s.t(vo)};s.jsLoaded=function(){var s=this,x;if(s.lmq)for(i=0;i<s.lmq.length;i++){x=s.lmq[i];s.loadModule(x.n,x.u,x.d)}if(s.onLoad)s.onLoad(s);if(s.tq)for(i=0;i<s.tq.length;i++)s.t(s.tq[i])"
+"};s.wd=window;s.ssl=(s.wd.location.protocol.toLowerCase().indexOf('https')>=0);s.d=document;s.b=s.d.body;if(s.d.getElementsByTagName){s.h=s.d.getElementsByTagName('HEAD');if(s.h)s.h=s.h[0]}s.n=navi"
+"gator;s.u=s.n.userAgent;s.ns6=s.u.indexOf('Netscape6/');var apn=s.n.appName,v=s.n.appVersion,ie=v.indexOf('MSIE '),o=s.u.indexOf('Opera '),i;if(v.indexOf('Opera')>=0||o>0)apn='Opera';s.isie=(apn=='"
+"Microsoft Internet Explorer');s.isns=(apn=='Netscape');s.isopera=(apn=='Opera');s.ismac=(s.u.indexOf('Mac')>=0);if(o>0)s.apv=parseFloat(s.u.substring(o+6));else if(ie>0){s.apv=parseInt(i=v.substrin"
+"g(ie+5));if(s.apv>3)s.apv=parseFloat(i)}else if(s.ns6>0)s.apv=parseFloat(s.u.substring(s.ns6+10));else s.apv=parseFloat(v);s.em=0;if(s.em.toPrecision)s.em=3;else if(String.fromCharCode){i=escape(St"
+"ring.fromCharCode(256)).toUpperCase();s.em=(i=='%C4%80'?2:(i=='%U0100'?1:0))}if(s.oun)s.sa(s.oun);s.sa(un);s.vl_l='dynamicVariablePrefix,visitorID,vmk,visitorMigrationKey,visitorMigrationServer,vis"
+"itorMigrationServerSecure,ppu,charSet,visitorNamespace,cookieDomainPeriods,cookieLifetime,pageName,pageURL,referrer,currencyCode';s.va_l=s.sp(s.vl_l,',');s.vl_mr=s.vl_m='charSet,visitorNamespace,co"
+"okieDomainPeriods,cookieLifetime,contextData,lightProfileID,lightStoreForSeconds,lightIncrementBy';s.vl_t=s.vl_l+',variableProvider,channel,server,pageType,transactionID,purchaseID,campaign,state,z"
+"ip,events,events2,products,linkName,linkType,contextData,lightProfileID,lightStoreForSeconds,lightIncrementBy,retrieveLightProfiles,deleteLightProfiles,retrieveLightData';var n;for(n=1;n<=75;n++){s"
+".vl_t+=',prop'+n+',eVar'+n;s.vl_m+=',prop'+n+',eVar'+n}for(n=1;n<=5;n++)s.vl_t+=',hier'+n;for(n=1;n<=3;n++)s.vl_t+=',list'+n;s.va_m=s.sp(s.vl_m,',');s.vl_l2=',tnt,pe,pev1,pev2,pev3,resolution,color"
+"Depth,javascriptVersion,javaEnabled,cookiesEnabled,browserWidth,browserHeight,connectionType,homepage,plugins';s.vl_t+=s.vl_l2;s.va_t=s.sp(s.vl_t,',');s.vl_g=s.vl_t+',trackingServer,trackingServerS"
+"ecure,trackingServerBase,fpCookieDomainPeriods,disableBufferedRequests,mobile,visitorSampling,visitorSamplingGroup,dynamicAccountSelection,dynamicAccountList,dynamicAccountMatch,trackDownloadLinks,"
+"trackExternalLinks,trackInlineStats,linkLeaveQueryString,linkDownloadFileTypes,linkExternalFilters,linkInternalFilters,linkTrackVars,linkTrackEvents,linkNames,lnk,eo,lightTrackVars,_1_referrer,un';"
+"s.va_g=s.sp(s.vl_g,',');s.pg=pg;s.gl(s.vl_g);s.contextData=new Object;s.retrieveLightData=new Object;if(!ss)s.wds();if(pg){s.wd.s_co=function(o){s_gi(\"_\",1,1).co(o)};s.wd.s_gs=function(un){s_gi(u"
+"n,1,1).t()};s.wd.s_dc=function(un){s_gi(un,1).t()}}",
w=window,l=w.s_c_il,n=navigator,u=n.userAgent,v=n.appVersion,e=v.indexOf('MSIE '),m=u.indexOf('Netscape6/'),a,i,x,s;if(un){un=un.toLowerCase();if(l)for(i=0;i<l.length;i++){s=l[i];x=s._c;if((!x||x=='s_c'||x=='s_l')&&(s.oun==un||(s.fs&&s.sa&&s.fs(s.oun,un)))){if(s.sa)s.sa(un);if(x=='s_c')return s}else s=0}}w.s_an='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
w.s_sp=new Function("x","d","var a=new Array,i=0,j;if(x){if(x.split)a=x.split(d);else if(!d)for(i=0;i<x.length;i++)a[a.length]=x.substring(i,i+1);else while(i>=0){j=x.indexOf(d,i);a[a.length]=x.subst"
+"ring(i,j<0?x.length:j);i=j;if(i>=0)i+=d.length}}return a");
w.s_jn=new Function("a","d","var x='',i,j=a.length;if(a&&j>0){x=a[0];if(j>1){if(a.join)x=a.join(d);else for(i=1;i<j;i++)x+=d+a[i]}}return x");
w.s_rep=new Function("x","o","n","return s_jn(s_sp(x,o),n)");
w.s_d=new Function("x","var t='`^@$#',l=s_an,l2=new Object,x2,d,b=0,k,i=x.lastIndexOf('~~'),j,v,w;if(i>0){d=x.substring(0,i);x=x.substring(i+2);l=s_sp(l,'');for(i=0;i<62;i++)l2[l[i]]=i;t=s_sp(t,'');d"
+"=s_sp(d,'~');i=0;while(i<5){v=0;if(x.indexOf(t[i])>=0) {x2=s_sp(x,t[i]);for(j=1;j<x2.length;j++){k=x2[j].substring(0,1);w=t[i]+k;if(k!=' '){v=1;w=d[b+l2[k]]}x2[j]=w+x2[j].substring(1)}}if(v)x=s_jn("
+"x2,'');else{w=t[i]+' ';if(x.indexOf(w)>=0)x=s_rep(x,w,t[i]);i++;b+=62}}}return x");
w.s_fe=new Function("c","return s_rep(s_rep(s_rep(c,'\\\\','\\\\\\\\'),'\"','\\\\\"'),\"\\n\",\"\\\\n\")");
w.s_fa=new Function("f","var s=f.indexOf('(')+1,e=f.indexOf(')'),a='',c;while(s>=0&&s<e){c=f.substring(s,s+1);if(c==',')a+='\",\"';else if((\"\\n\\r\\t \").indexOf(c)<0)a+=c;s++}return a?'\"'+a+'\"':"
+"a");
w.s_ft=new Function("c","c+='';var s,e,o,a,d,q,f,h,x;s=c.indexOf('=function(');while(s>=0){s++;d=1;q='';x=0;f=c.substring(s);a=s_fa(f);e=o=c.indexOf('{',s);e++;while(d>0){h=c.substring(e,e+1);if(q){i"
+"f(h==q&&!x)q='';if(h=='\\\\')x=x?0:1;else x=0}else{if(h=='\"'||h==\"'\")q=h;if(h=='{')d++;if(h=='}')d--}if(d>0)e++}c=c.substring(0,s)+'new Function('+(a?a+',':'')+'\"'+s_fe(c.substring(o+1,e))+'\")"
+"'+c.substring(e+1);s=c.indexOf('=function(')}return c;");
c=s_d(c);if(e>0){a=parseInt(i=v.substring(e+5));if(a>3)a=parseFloat(i)}else if(m>0)a=parseFloat(u.substring(m+10));else a=parseFloat(v);if(a<5||v.indexOf('Opera')>=0||u.indexOf('Opera')>=0)c=s_ft(c);if(!s){s=new Object;if(!w.s_c_in){w.s_c_il=new Array;w.s_c_in=0}s._il=w.s_c_il;s._in=w.s_c_in;s._il[s._in]=s;w.s_c_in++;}s._c='s_c';(new Function("s","un","pg","ss",c))(s,un,pg,ss);return s}

    //[#assign tiendas = mgnl.getContent("data", "/tienda")]
// js con funciones generales

function cerrar(capa) {
  jQuery("#"+capa).hide();
}

function StringBuffer() {
  this.buffer = [];
}

StringBuffer.prototype.append = function append(string) {
  this.buffer.push(string);
  return this;
}

StringBuffer.prototype.toString = function toString() {
  return this.buffer.join("");
}

///////HASHMAP en JavaScript/////////////
function Map() {
  // members
  this.keyArray = new Array(); // Keys
  this.valArray = new Array(); // Values
  // methods
  this.put = put;
  this.get = get;
  this.size = size;
  this.clear = clear;
  this.keySet = keySet;
  this.valSet = valSet;
  this.findIt = findIt;
  this.remove = remove;
}

function put( key, val ) {
  var elementIndex = this.findIt( key );
  if ( elementIndex == (-1) ) {
    this.keyArray.push( key );
    this.valArray.push( val );
  } else {
    this.valArray[ elementIndex ] = val;
  }
}

function get( key ) {
  var result = null;
  var elementIndex = this.findIt( key );
  if( elementIndex != (-1) ) {
    result = this.valArray[ elementIndex ];
  }
  return result;
}

function remove( key ) {
  var result = null;
  var elementIndex = this.findIt( key );
  if( elementIndex != (-1) ) {
    this.keyArray = this.keyArray.removeAt(elementIndex);
    this.valArray = this.valArray.removeAt(elementIndex);
  }
  return ;
}

function size() {
  return (this.keyArray.length);
}

function clear() {
  while (this.keyArray.length > 0) {
    this.keyArray.pop();
    this.valArray.pop();
  }
}

function keySet() {
  return (this.keyArray);
}

function valSet() {
  return (this.valArray);
}

function findIt( key ) {
  var result = (-1);

  for( var i = 0; i < this.keyArray.length; i++) {
    if( this.keyArray[ i ] == key ) {
      result = i;
      break;
    }
  }

  return result;
}

function removeAt( index ) {
  var part1 = this.slice( 0, index);
  var part2 = this.slice( index+1 );

  return( part1.concat( part2 ) );
}
Array.prototype.removeAt = removeAt

Array.prototype.inArray=function(el){
  for(var i=0;i<this.length;i++)
    if(this[i]==el) return true;
  return false;
}

Array.prototype.removeElement=function(el){
  var arrayName = this;
  for(var i=0;i<arrayName.length;i++)
    if(arrayName[i]==el) this.splice(i,1);
}

String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
    return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
    return this.replace(/\s+$/,"");
}

//Funcion que saca de la url el valor del parametro pasado
 function gup(name) {
  var regexS="[\\?&]"+name+"=([^&#]*)";
  var regex=new RegExp(regexS);
  var tmpURL=window.location.href;
  var results=regex.exec(tmpURL);
  if(results==null) return"";
  else return results[1];
}

 function abrirEmergente(dir) {
  direccion = dir + location.href;
  window.open(direccion,'sharer','toolbar=0,status=0,width=800,height=600');
  return false;
}

function trim(str, chars) {
  return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
  chars = chars || "\\s";
  return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
  chars = chars || "\\s";
  return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function queesesto() {
  alert("Utiliza estos iconos para compartir en otras webs (facebook, meneame.net, etc.) los contenidos de Leroy Merlin. Comparte ofertas interesantes o consejos útiles al resto de la comunidad online.");
}

//Funciones de sesion
var alnumber=0;
function getAlNumber(){
  if (alnumber<=0)
    alnumber = Math.round(Math.random()*9999);
  return alnumber;
}
function getSesionLM(){
  return jQuery.cookie("se");
}
function setSesionLM(datos){
  jQuery.cookie("se", datos, { path: '/', expires: 10000 });
}
function finSesionLM(){
  jQuery.cookie("se", null, { path: '/', expires: 10000 });
}

function sortTiendaPorProvincia(a, b){
  //Compare "a" and "b" in some fashion, and return -1, 0, or 1
  if (a.provincia!=b.provincia)
    return Acentos(a.provincia)>Acentos(b.provincia) ? 1 : Acentos(a.provincia)<Acentos(b.provincia) ? -1 :0;
  else
    return Acentos(a.nombre)>Acentos(b.nombre) ? 1 : Acentos(a.nombre)<Acentos(b.nombre) ? -1:0;
}

/**
 * Función que quita los acentos para comparar cadenas
 */
function Acentos(texto){
  var cadena="";
  for (var j = 0; j < texto.length; j++) {
    var letra=texto.charCodeAt(j);
    switch(letra) {
      case 225: cadena+="a"; break;
      case 233: cadena+="e"; break;
      case 237: cadena+="i"; break;
      case 243: cadena+="o"; break;
      case 250: cadena+="u"; break;
      case 193: cadena+="A"; break;
      case 201: cadena+="E"; break;
      case 205: cadena+="I"; break;
      case 211: cadena+="O"; break;
      case 218: cadena+="U"; break;
      case 241: cadena+="n"; break;
      case 209: cadena+="n"; break;
      default: cadena+=texto.charAt(j); break;
    }
  }
  return cadena;
}

/**
 * Función que codifica los acentos en html
 */
function codificaAcentos(texto){
  var cadena="";
  for (var j = 0; j < texto.length; j++) {
    var letra=texto.charCodeAt(j);
    switch(letra) {
      case 225: cadena+="&aacute;"; break;
      case 233: cadena+="&eacute;"; break;
      case 237: cadena+="&iacute;"; break;
      case 243: cadena+="&oacute;"; break;
      case 250: cadena+="&uacute;"; break;
      case 193: cadena+="&Aacute;"; break;
      case 201: cadena+="&Eacute;"; break;
      case 205: cadena+="&Iacute;"; break;
      case 211: cadena+="&Oacute;"; break;
      case 218: cadena+="&Uacute;"; break;
      case 241: cadena+="&ntilde;"; break;
      case 209: cadena+="&Ntilde;"; break;
      default: cadena+=texto.charAt(j); break;
    }
  }
  return cadena;
}

function paintPrecio(precio,unidad) {
  var pos = precio.indexOf(".");
  var pEntera = "";
  var pDecimal = "";
  if (pos == -1) {
    pEntera = precio;
    pDecimal = String(0);
  } else {
    pEntera = precio.split(".")[0];
    pDecimal = precio.split(".")[1];
  }
  pEntera = pEntera.toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g,'$1.');
  pEntera = pEntera.split('').reverse().join('').replace(/^[\.]/,'');
  return (pEntera+',<sup>'+pDecimal+' '+unidad+'</sup>');
}

function dosDecimales(amount) {
  var val = parseFloat(amount);
  if (isNaN(val)) { return "0.00"; }
  if (val <= 0) { return "0.00"; }
  val = (Math.round(val*100)/100)+'';
  val = (val == Math.floor(val)) ? val + '.00' : ((val*10 ==
  Math.floor(val*10)) ? val + '0' : val);
  return val;
}

function toggleFiltros() {
  jQuery("#filtros").toggle("normal");
  jQuery("#pliega").toggle();
  jQuery("#despliega").toggle();
}

function cargaTiendas(which) {
  if (which.value.length>0) {
    var tiendas = cargaTiendasCentro(which.value);
    //var tiendas = listTienda.value;
    jQuery("select[name='input_text_centro']").each(function(){
      jQuery(this).empty().append(tiendas);
/*
      if (jQuery(this).val() == jQuery.cookie("lmprovincia")) {
        jQuery(this).attr("value",jQuery.cookie("lmtiendacod"));
      }
*/
    });
  } else jQuery("select[name='input_text_centro']").empty();
}

//Carga de la capa "No hay tienda seleccionada"
function showNoTiendaPopup() {
  showOverlay();

  var lmprovincia = jQuery.cookie("lmprovincia");
  if (lmprovincia!=undefined && lmprovincia!=null && lmprovincia!='') {
    jQuery("#selectorTiendasProvincia option[value='"+lmprovincia+"']").attr("selected","selected");
    jQuery("#selectorTiendasCentro").empty().append(cargaTiendasCentro(jQuery("#selectorTiendasProvincia").val()));
    var codtienda = jQuery.cookie("lmtiendacod");
    jQuery("#selectorTiendasCentro option[value='"+codtienda+"']").attr("selected","selected");
  } else {
    jQuery("#selectorTiendasProvincia option[value='']").attr("selected","selected");
    jQuery("#selectorTiendasCentro").html('<option value="">Centro Leroy Merlin</option>');
  }

  jQuery("#listaNoTiendapopup").show();
  jQuery("#listaNoTiendapopup select").css("visibility","visible");
}

function filterNum(str) {
    re = /\xC1|\xC9|\xCD|\xD1|\xD3|\xDA|\xDC|\xE1|\xE9|\xED|\xF1|\xF3|\xFA|\xFC|\+/g;
    // reemplazar tildes y eñes por wildcard "_"
    return str.replace(re, "_");
}

function replaceAll(label, from, to){
  return label.replace(new RegExp(from, 'g'),to);
}

/*
 * Pone en formato numerico el mes
 */
function cambiaMes (txt)
{
  if(txt=="ene") return 0;
  else if(txt=="feb") return 1;
  else if(txt=="mar") return 2;
  else if(txt=="abr") return 3;
  else if(txt=="may") return 4;
  else if(txt=="jun") return 5;
  else if(txt=="jul") return 6;
  else if(txt=="ago") return 7;
  else if(txt=="sep") return 8;
  else if(txt=="jun") return 9;
  else if(txt=="nov") return 10;
  else if(txt=="dic") return 11;
  else return 12;
}

/*
 * Pasa la fecha de formato string a date.
 */
function getDateFromString(fecha)
{
  if(fecha.indexOf("/") > -1) {
    var tokens = fecha.split("/");
    var year = (tokens[2].length==2)?(20+tokens[2]):tokens[2];
    var dFecha = new Date(year,tokens[1]-1,tokens[0]);
  } else {
    var tokens = fecha.split("-");
    var day = tokens[0];
    var mon = cambiaMes(tokens[1]);
    var year = tokens[2].substring(0, 4);
    var dFecha = new Date(year, mon, day);
  }
  return dFecha;
}

/*
 * Tiene que recibir el cif sin espacios ni guiones
 */
function validateCIF(cif)
{
  //Quitamos el primer caracter y el ultimo digito
  var valueCif=cif.substr(1,cif.length-2);

  var suma=0;

  //Sumamos las cifras pares de la cadena
  for(i=1;i<valueCif.length;i=i+2) {
    suma = suma + parseInt(valueCif.substr(i,1));
  }

  var suma2=0;

  //Sumamos las cifras impares de la cadena
  for(i=0;i<valueCif.length;i=i+2) {
    result=parseInt(valueCif.substr(i,1))*2;
    if(String(result).length==1) {
      // Un solo caracter
      suma2=suma2+parseInt(result);
    } else {
      // Dos caracteres. Los sumamos...
      suma2 = suma2 + parseInt(String(result).substr(0,1)) + parseInt(String(result).substr(1,1));
    }
  }

  // Sumamos las dos sumas que hemos realizado
  suma = suma + suma2;

  var unidad = String(suma).substr(1,1)
  unidad = 10 -parseInt(unidad);

  var primerCaracter = cif.substr(0,1).toUpperCase();

  if(primerCaracter.match(/^[FJKNPQRSUVW]$/)) {
    //Empieza por .... Comparamos la ultima letra
    if(String.fromCharCode(64+unidad).toUpperCase()==cif.substr(cif.length-1,1).toUpperCase()) return true;
  } else if(primerCaracter.match(/^[XYZ]$/)) {
    //Se valida como un dni
    var newcif;
    if(primerCaracter=="X") newcif = cif.substr(1);
    else if(primerCaracter=="Y") newcif = "1" + cif.substr(1);
    else if(primerCaracter=="Z") newcif = "2" + cif.substr(1);
    return validateDNI(newcif);
  } else if(primerCaracter.match(/^[ABCDEFGHLM]$/)) {
    //Se revisa que el ultimo valor coincida con el calculo
    if(unidad==10) unidad = 0;
    if(cif.substr(cif.length-1,1)==String(unidad)) return true;
  } else {
    //Se valida como un dni
    return validateDNI(cif);
  }
  return false;
}

/*
 * Tiene que recibir el dni sin espacios ni guiones
 */
function validateDNI(dni)
{
  var lockup = 'TRWAGMYFPDXBNJZSQVHLCKE';
  var valueDni = dni.substr(0,dni.length-1);
  var letra = dni.substr(dni.length-1,1).toUpperCase();

  if(lockup.charAt(valueDni % 23)==letra) return true;
  return false;
}
    //variables necesarias para cambiar ambos breadcrum
var changeBreadCrum = false;
var nombre = "";
var enlace = "";
var quitaUltimo = false;

// Funcionalidad de disponibilidad
var topaje = "";
var cantidad = "";
var indices = [];
var idsModelo = [];

//localizacion de un articulo en tienda
var seccionTienda = "";

//variables banner rotatorio
var newsBanner;
var curritemBanner=0;
var clickBanner = -1;
var speedBanner = 4000;//milisegundos
var intBanner;
var iPauseBanner=0;

//variables bannerServicios
var newsBannerServicios;
var curritemBannerServicios=0;
var clickBannerServicios = -1;
var speedBannerServicios = 4000;//milisegundos
var intBannerServicios;
var iPauseBannerServicios=0;

//variables necesarias para asociar mail a pedido
var pedido = "";
var apellidos = "";

var ieVer=/*@cc_on function(){ switch(@_jscript_version){case 1.0:return 3;case 3.0:return 4;case 5.0:return 5;case 5.1:return 5;case 5.5:return 5.5;case 5.6:return 6;case 5.7:return 7;case 5.8:return 8; }}()|| @*/0;

// objetos de tiendas
function tienda(nombre, urlname, cercania, codigo, ccaa, provincia, emailempleo, latitud, longitud, imagen) {
  this.nombre = nombre;
  this.urlname = urlname;
  this.cercania = cercania;
  this.codigo = codigo;
  this.ccaa = ccaa;
  this.provincia = provincia;
  this.emailempleo = emailempleo;
  this.latitud = latitud;
  this.longitud = longitud;
  this.imagen = imagen;
}
var arr_tiendas = new Array();
var nomtien="";
var provinc="";
jQuery(document).ready(function(){
  // 20100921
  if (jQuery.cookie("lmtiendatext")!=null && jQuery.cookie("lmtiendatext").trim()=='Palma-Ciudad (Baleares)') {
    jQuery.cookie("lmtiendatext", null, { path: '/', expires: 10000 });
    jQuery.cookie("lmtiendatext", "Palma ciudad (Baleares)", { path: '/', expires: 10000 });
  }
  // 20100521
  if (jQuery.cookie("lmtiendatext")!=null && jQuery.cookie("lmtiendatext").trim()=='Puerto Real (Cádiz)') {
    jQuery.cookie("lmtiendatext", null, { path: '/', expires: 10000 });
    jQuery.cookie("lmtiendatext", "Bahía de Cádiz (Cádiz)", { path: '/', expires: 10000 });
  } else if (jQuery.cookie("lmtiendatext")!=null){
    nomtienda = jQuery.cookie("lmtiendatext");
    provinc = jQuery.cookie("lmprovincia");
  }

  // Datos de dónde estamos para cambiar el css de la imagen de cabecera
  // los datos los recogemos del div rastro-migas, del segundo <li> (el primero es el de inicio)
  // <a href="/mpng2-front/pre?zone=general&idLSPub=1235653286" title="Consejos e ideas" >Consejos e ideas</a>
  var tagBreadCrum = jQuery("#rastro-migas ul li:eq(1)").html();
  if(tagBreadCrum != null) {
    var titleBreadCrum = jQuery(tagBreadCrum).attr("title").toUpperCase();
    // Buscamos dentro del div nav para buscar en el menu de arriba
    jQuery("#nav ul li").each(function(i){
      if ((jQuery("#nav ul li:eq("+i+")").html().toUpperCase()).indexOf(titleBreadCrum)>-1)
        jQuery(this).addClass("sel");
    });
  }

  // Ponemos los class a los elementos de la navegación secundaria
  jQuery("#nav-secundario ul li:last").addClass("last");
  jQuery("#nav-secundario ul li:first").addClass("first");

  // Vemos si tiene tienda
  var lmtienda = jQuery.cookie("lmtiendatext");
  if (lmtienda!=undefined) {
    jQuery("#tienda-seleccionada-text").html(lmtienda);
//    jQuery(".boton-producto").show();
    if (jQuery("div.lme_disponibilidad").length) {
      jQuery("div.boton-producto").hide();
      jQuery("div.lme_disponibilidad").show();
    }
  } else {
    jQuery("#tienda-seleccionada-text").html("Sin tienda seleccionada");
//    jQuery(".boton-producto").hide();
    if (jQuery("div.lme_disponibilidad").length) {
      jQuery("div.boton-producto").show();
      jQuery("div.lme_disponibilidad").hide();
    }
  }

  //ocultamos la capa de búsqueda
  jQuery("#searchFace").hide();

  jQuery("div.lme_modulo-envio-amigo p.boton-cerrar a").click(function(){ jQuery("div.lme_modulo-envio-amigo").hide(); hideOverlay(); return false;});
  jQuery(".lme_modulo-envio-mail .boton-cerrar a").click(function(){jQuery(".lme_modulo-envio-mail").hide(); hideOverlay(); return false;});
  jQuery(".lme_alerta_leroy .cierre-ligthbox").click(function(){jQuery(".lme_alerta_leroy").hide(); hideOverlay(); return false;});
  jQuery(".modulo-disponibilidad .boton-cerrar a").click(function(){jQuery(".modulo-disponibilidad").hide(); hideOverlay(); return false;});

  jQuery(".link-mapa").click(function(){
    alert("La aparicion del lightbox del como llegar esta simulado ya que aparece en el HTML. Debería crearse dinamicamente");
    showOverlay();
    jQuery("#mapaTiendaLightBox").css("display","block");
    return false;
  });

   // By suppling no content attribute, the library uses each elements title attribute by default
   jQuery('#link-example-mylm').qtip({
    content: '<img src="../../mediaObject/mediaLM/imagenes/registro/jardines_tooltip2/original/jardines_tooltip2.png" alt="Ejemplo" />',
    position: {  corner: {  tooltip: "leftMiddle"  }  },
    style: {
      tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
      border: { width: 0, radius: 1  },
      padding:2,
      name: 'light', // Use the default light style
      width: 300,// Set the tooltip width
      height: 669// Set the tooltip height
    }
  });

  jQuery('#link-example-pedido').qtip({
    content: '<img src="../../mediaObject/mediaLM/imagenes/Varios/ejemplo-ayuda-pedido/original/ejemplo-ayuda-pedido.jpg" alt="Ejemplo" />',
    position: {  corner: {  tooltip: "leftMiddle"  }  },
    style: {
      tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
      border: { width: 0, radius: 1 },
      padding:2,
      name: 'light', // Use the default light style
      width: 555,// Set the tooltip width
      height: 654// Set the tooltip height
    }
  });

  jQuery(".acordeon-basico .elemento-acordeon-basico h6").bind("click",function(){
    aa = jQuery(this).parent().parent().children().each(function(){
        jQuery(this).removeClass("sel-elemento");
      });
    jQuery(this).parent().addClass("sel-elemento");
  });

  // boolean para comprobar si está borrado el buscar
  jQuery("#search #search_input").bind("click",function(){ jQuery("#positionSearch").hide(); showCombosFix();});
/*
  if (ieVer!=0) {
   var valorLeft = jQuery("#positionSearch").css("left").substring(0,jQuery("#positionSearch").css("left").length-2);
   if (!new RegExp("^(?:\\+|-)?\\d+$").test(valorLeft)) valorLeft = 38;
   jQuery("#positionSearch").css("left", eval(valorLeft)+eval(eval(screen.availWidth-1024)/2));
  }
*/

//
//  jQuery("#view-shop").bind("click",function(){
//    var codtienda = jQuery.cookie("lmtiendacod");
//    if (codtienda==null) {
//      jQuery("#select-shop").click();
//      return false;
//    }
//    document.location.href = this.pathname.substring(0, this.pathname.indexOf('leroyMerlinWebsite')) + "leroyMerlinWebsite/tiendas/" + codtienda;
//    return false;
//  });

 /* // eventos del selector
  jQuery("#selectorTiendasProvincia").change(function(e){
    jQuery("#selectorTiendasCentro").empty().append(cargaTiendasCentro(this.value));
    cargaTiendasCentro(jQuery("#selectorTiendasProvincia").val());
    ocultarBoton();
  });
*/
  jQuery("#input_text_shop").change(function(e){
//    jQuery("#input_text_centro").empty().append(cargaTiendasCentro(this.value));
    var tiendas = cargaTiendasCentro(this.value);
    jQuery("select[name='input_text_centro']").each(function(){
      jQuery(this).empty().append(tiendas);
    });
//    cargaTiendasCentro(jQuery("#input_text_shop").val());
//    ocultarBoton();
  });

  jQuery("#select-shop").bind("click",function(){
    var windowY=jQuery(document).height();
    var windowX=(document.all)?jQuery(window).width():jQuery(document).width();
    showOverlay();
    jQuery("#shopFinder").fadeIn("fast");
    showCombosFix();

    var lmprovincia = jQuery.cookie("lmprovincia");
    if (lmprovincia!=undefined && lmprovincia!=null && lmprovincia!='') {
      jQuery("#input_text_shop option[value='"+lmprovincia+"']").attr("selected","selected");
      var tiendas = cargaTiendasCentro(lmprovincia);
      jQuery("select[name='input_text_centro']").each(function(){
        jQuery(this).empty().append(tiendas);
      });
//      jQuery("#input_text_centro").empty().append(cargaTiendasCentro(lmprovincia));
/*
      jQuery("#selectorTiendasProvincia option[value='"+lmprovincia+"']").attr("selected","selected");
      jQuery("#selectorTiendasCentro").empty().append(cargaTiendasCentro(jQuery("#selectorTiendasProvincia").val()));
*/
      var codtienda = jQuery.cookie("lmtiendacod");
//      jQuery("#input_text_centro option[value='"+codtienda+"']").attr("selected","selected");
      jQuery("#selectorTiendasCentro option[value='"+codtienda+"']").attr("selected","selected");
    } else {
      jQuery("#input_text_shop option[value='']").attr("selected","selected");
      jQuery("#input_text_centro").html('<option value="">Centro Leroy Merlin</option>');
    }

    jQuery("#shopFinder input.btnCenter").bind("click",function(){
      // Texto de la tienda a mostrar
      if (this.value=="Aceptar"){
        if (jQuery("#shopFinder select[name='input_text_shop'] option:selected").val()==''){
          alert("Seleccione una provincia");
          return false;
        } else if (jQuery("#shopFinder select[name='input_text_shop'] option:selected").val()=='ninguna') {
          borrarCookie();
              jQuery("#tienda-seleccionada-text").html("Sin tienda seleccionada");
              jQuery("div.lme_disponibilidad").show();
              jQuery("#shopFinder").fadeOut("fast");
          hideOverlay();
/*
          if (jQuery("div.lme_disponibilidad").length) {
               jQuery("div.boton-producto").show();
               jQuery("div.lme_disponibilidad").hide();
          }
*/
          if (jQuery("#listadoProductos li[name='producto']").length) {
            //Recarga información disponibilidad y precios en listado de productos
            cargaPrecios("#listadoProductos li[name='producto']");
            cargaDisponibilidades();
          } else if (jQuery("#listadoProductos tr[name='producto']").length) {
            //Recarga información precios en listado de variantes y bodegones
            cargaPrecios("#listadoProductos tr[name='producto']");
          } else if (jQuery("#elementosBodegon .componente-bodegon").length) {
            //Recarga información disponibilidad y precios en página de variantes y bodegones
            cargaPrecios("#elementosBodegon .componente-bodegon");
            cargaDisponibilidades();
          } else if (jQuery("#precios").length) {
            //Recarga información disponibilidad y precios en página de producto
            cargaPreciosProducto();
            showDisponProducto();
          } else if (jQuery("#resultado-buscador-productos").length) {
            cargaPrecios("#resultado-buscador-productos li[name='producto']");
          } else if (jQuery("#contenedorSaldos").length) {
            window.location = "./todas.html";
          }
          actualizaFormularioOpinion();
          if (jQuery('#lista-demos').length) cambiaEnlaceBannerVideos();
          showCargando();
          return false;
        }
        var lmTiendaTextoMostrar = jQuery("#shopFinder select[name='input_text_centro'] option:selected").text()+" ("+jQuery("#shopFinder select[name='input_text_shop'] option:selected").text()+")";
        jQuery("#tienda-seleccionada-text").html(lmTiendaTextoMostrar);
        jQuery("div.boton-producto").show();

          var listcercania = jQuery("#shopFinder select[name='input_text_centro'] option:selected").val().split("=");
          var codtienda = listcercania[1];
          var provincia = jQuery("#shopFinder select[name='input_text_shop'] option:selected").val();

          setCookieData(lmTiendaTextoMostrar,codtienda,provincia);
        //Recarga informacion disponibilidad en pagina de listado de productos
        if (jQuery("div.lme_disponibilidad").length) {
          jQuery("div.boton-producto").hide();
          jQuery("div.lme_disponibilidad").show();
        }
        if (jQuery("#listadoProductos li[name='producto']").length) {
          //Recarga información disponibilidad y precios en listado de productos
          cargaPrecios("#listadoProductos li[name='producto']");
          cargaDisponibilidades();
        } else if (jQuery("#listadoProductos tr[name='producto']").length) {
          //Recarga información precios en listado de variantes y bodegones
          cargaPrecios("#listadoProductos tr[name='producto']");
        } else if (jQuery("#elementosBodegon .componente-bodegon").length) {
          //Recarga información disponibilidad y precios en página de variantes y bodegones
          cargaPrecios("#elementosBodegon .componente-bodegon");
          cargaDisponibilidades();
        } else if (jQuery("#precios").length) {
          //Recarga información disponibilidad y precios en página de producto
          cargaPreciosProducto();
          showDisponProducto();
        } else if (jQuery("#resultado-buscador-productos").length) {
          cargaPrecios("#resultado-buscador-productos li[name='producto']");
        } else if (jQuery("#contenedorSaldos").length) {
          reloadListado("tienda="+codtienda);
        }
        actualizaFormularioOpinion();
        if (jQuery('#lista-demos').length) cambiaEnlaceBannerVideos();
        showCargando();
      }
      jQuery("#shopFinder").fadeOut("fast");
      hideOverlay();
      return false;
    });
  });

  // Comprobamos si se debe modificar el breadcrum y, si es así, lo hacemos
  if (changeBreadCrum) modifyBreadCrum(nombre, enlace, quitaUltimo);

  // Ponemos el último elemento del breadcrum con class sel
  jQuery("#rastro-migas ul li:last").addClass("last");
  jQuery("#footer-accesos #rastro-migas ul li:last").addClass("last");

  //activa carrusel del banner
  jQuery(".thumbs-ofertas-destacadas img").each(
    function(i){
      jQuery(this).bind("click",function(){
        if(i==curritemBanner) return false;
        clickBanner = i;
        tickBanner();
      })
    }
  );
  var bannerSelector = "#show-ofertas-destacadas li:lt(3)";
  newsBanner = jQuery(bannerSelector).hide().hover(
    function(){
      jQuery(this).addClass("sel");
      iPauseBanner=1;
    },
    function(){
      jQuery(this).removeClass("sel");
      iPauseBanner=0;
    }
  ).filter(":eq(0)").show().add(bannerSelector).size();
  intBanner = setInterval(bannernews,speedBanner);

  //banner rotatorio home servicios
  var bannerSelectorServicios = "div.destacado-home-servicios li";
  newsBannerServicios = jQuery(bannerSelectorServicios).hide().hover(
    function(){
      jQuery(this).addClass("sel");
      iPauseBannerServicios=1;
    },
    function(){
      jQuery(this).removeClass("sel");
      iPauseBannerServicios=0;
    }
  ).filter(":eq(0)").show().add(bannerSelectorServicios).size();
  intBannerServicios = setInterval(bannernewsServicios,speedBannerServicios);

  /*movimiento en home servicios*/
  function bannernewsServicios() {
    if (iPauseBannerServicios==0){
      jQuery("div.destacado-home-servicios li").fadeOut("slow",function(){jQuery(this).hide();});
      curritemBannerServicios = ++curritemBannerServicios%newsBannerServicios;
      jQuery("div.destacado-home-servicios li:eq("+curritemBannerServicios+")").fadeIn("slow", function(){});
    }
  }

  //Cambio de lista "destacados comunes"
  jQuery(".cab-modulo-destacados-comunes ul li").bind("click",function(){
    jQuery(".cab-modulo-destacados-comunes ul li").each(function(i){
      jQuery(this).removeClass("sel");
    });
    jQuery(this).addClass("sel");
    jQuery(".modulo-ofertas-comunes span[serie]").each(function(i){
      jQuery(this).hide();
    });
    jQuery("span[serie='"+jQuery(this).attr("serie")+"']").show();
  });
  jQuery('.cab-modulo-destacados-comunes ul li:first').click();

  // Activamos el formulario de enviar a un amigo
  jQuery("#envioamigo").click(function(e){
    // comprobar que vienen todos los campos
    var emailto = jQuery("#emailto");
    if (!isEmail(emailto.val()) || isEmpty(emailto.val())){
      alert("E-mail de tu amigo incorrecto");
      emailto.focus();
      return false;
    }
    var nombreto = jQuery("#nombreto");
    if (isEmpty(nombreto.val())){
      alert("Nombre de tu amigo vacío");
      nombreto.focus();
      return false;
    }
    var emailfrom = jQuery("#emailfrom");
    if (!isEmail(emailfrom.val()) || isEmpty(emailfrom.val())){
      alert("Tu e-mail incorrecto");
      emailfrom.focus();
      return false;
    }
    var nombrefrom = jQuery("#nombrefrom");
    if (isEmpty(nombrefrom.val())){
      alert("Tu nombre vacío");
      nombrefrom.focus();
      return false;
    }
    // envío del formulario
    var urlEnvio = "/lmeiapps/mailAnon.lm?";
    urlEnvio = urlEnvio +"emailto="+emailto.val();
    urlEnvio = urlEnvio +"&nombreto="+nombreto.val();
    urlEnvio = urlEnvio +"&emailfrom="+emailfrom.val();
    urlEnvio = urlEnvio +"&nombrefrom="+nombrefrom.val();
    urlEnvio = urlEnvio +"&url="+escape(document.location.href);
    jQuery.get(urlEnvio, function(data){ });
    eventoSC('','ENVIO AMIGO','event9');
    alert("Página enviada a "+nombreto.val()+" ("+emailto.val()+")" );
    // quitamos la capa
    jQuery("div.lme_modulo-envio-amigo").css("display","none");
    hideOverlay();
  });

  // Activamos el formulario de enviar el email
  jQuery("#enviomail").click(function(e) {
    // comprobar que viene el campo "email"
    var email = jQuery("#email");
    if (!isEmail(email.val()) || isEmpty(email.val())) {
      alert("E-mail incorrecto");
      email.focus();
      return false;
    }
    // envío del formulario
    jQuery.get("/mpng2-front/pre", {zone:"zoneajax",idLSPub:"1265275362",nPedido:pedido,apellidos:apellidos,correo:email.val()}, function(data) {
      if (data=="true") alert("Datos insertados correctamente");
      else alert("Ha habido error: " + data);
    });
    // quitamos la capa
    jQuery(".lme_modulo-envio-mail").css("display","none");
    hideOverlay();
  });
});

function isEmail(string) {
  if (string==null) return false;
  var iChars = "*|,\":<>[]{}`\';()&$#%";
  if (string.indexOf('@') < 0) return false;
  for (var i = 0; i < string.length; i++) {
    if (iChars.indexOf(string.charAt(i)) != -1) return false;
  }
  return true;
}

function isEmpty(s) {
  return ((s == null) || (s.length == 0));
}

function showOverlay(){
  var windowY=jQuery(document).height();
  var windowX=(document.all)?jQuery(window).width():jQuery(document).width();
  hideCombosFix();
  jQuery("#overlay").css("width",windowX+"px").css("height",windowY+"px").show();
}

function hideOverlay(){
  jQuery("#overlay").hide();
  showCombosFix();
}

//oculta los combos cuando se pone encima un layer- bug de IE
function hideCombosFix(){
  jQuery("#page select").css("visibility","hidden");
}

//muestra los combos cuando se pone encima un layer- bug de IE
function showCombosFix(){
  jQuery("#page select").css("visibility","visible");
}

function addToolTip(){
  jQuery(function() {
    jQuery.extend(jQuery.fn.Tooltip.defaults, { track: true, delay: 0, showURL: false, showBody: " - "});
    jQuery('.tooltip-title').Tooltip();
  });
}

/**
 * Actualiza el breadcrum
 */
function modifyBreadCrum(nom, enl, quita){
  if (quita) {
    jQuery("#rastro-migas ul li:last").html("<a href=\""+enl+"\" title=\""+nom+"\" >"+nom+"<\/a>");
    jQuery("#footer-accesos #rastro-migas ul li:last").html("<a href=\""+enl+"\" title=\""+nom+"\" >"+nom+"<\/a>");
  } else {
    jQuery("#rastro-migas ul li:last").after("<li><a href=\""+enl+"\" title=\""+nom+"\" >"+nom+"<\/a><\/li>");
    jQuery("#footer-accesos #rastro-migas ul li:last").after("<li><a href=\""+enl+"\" title=\""+nom+"\" >"+nom+"<\/a><\/li>");
  }
}

/**
 * Muestra/oculta un paso
 */
function togglePaso(paso){
  jQuery(paso).parents('.lme_cabecera-paso').next().toggle("normal");
  if (jQuery(paso).html() == "Ocultar") {
    jQuery(paso).html("Mostrar").parents('.lme_paso').removeClass("lme_paso-desplegado");
  } else {
    jQuery(paso).html("Ocultar").parents('.lme_paso').addClass("lme_paso-desplegado");
  }
}

/**
 * Funcionalidad para los banner rotativos
 */
function bannernews() {
  if (iPauseBanner==0){
    jQuery("#show-ofertas-destacadas li").fadeOut("slow",function(){jQuery(this).hide();});
    curritemBanner = ++curritemBanner%newsBanner;
    jQuery(".thumbs-ofertas-destacadas .modulo-thumbs-ofertas-destacada").each(function(i){
      if(curritemBanner==i) jQuery(this).addClass("sel");
      else jQuery(this).removeClass("sel");
    });
    jQuery("#show-ofertas-destacadas li:eq("+curritemBanner+")").fadeIn("slow", function(){});
  }
}

function tickBanner() {
  if (iPauseBanner==0){
    clearInterval(intBanner);
    curritemBanner = clickBanner;
    jQuery("#show-ofertas-destacadas li").fadeOut("fast",function(){jQuery(this).hide();});
    jQuery(".thumbs-ofertas-destacadas .modulo-thumbs-ofertas-destacada").each(function(i){
      if(clickBanner==i) jQuery(this).addClass("sel");
      else jQuery(this).removeClass("sel");
    });
    jQuery("#show-ofertas-destacadas li:eq("+clickBanner+")").fadeIn("slow", function(){
      intBanner= "";
      curritemBanner = clickBanner;
      intBanner = setInterval(bannernews,speedBanner);
    });
  }
}

function pintaEcoopcion() {
  var ecoopcion = json_getEcoopcion();
  if (ecoopcion != '') {
    if (ecoopcion == 'ECO-AHORRO-DE-AGUA')
      ecoopcion = '<img src="/img/AhorroAgua_149x15.jpg" />';
    else if (ecoopcion == 'ECO-HOGAR-SANO')
      ecoopcion = '<img src="/img/HogarSano_149x15.jpg" />';
    else if (ecoopcion == 'ECO-BOSQUE-SOSTENIBLE')
      ecoopcion = '<img src="/img/BosqueSostenible_149x15.jpg" />';
    else if (ecoopcion == 'ECO-ENERGIA-EFICIENTE')
      ecoopcion = '<img src="/img/EnergiaEficiente_149x15.jpg" />';
    else ecoopcion = '<img src="/img/EnergiaRenovable_149x15.jpg" />';
    jQuery(".ecoopcion a").html(ecoopcion);
    jQuery("#descEcoopciones").show();
  }
}

function pintaDescripcionProducto() {
  var designacion2 = (json_getDesignacion2()==''||json_getDesignacion2().endsWith("."))?json_getDesignacion2():json_getDesignacion2()+'.';
  var plusproducto = (json_getPlusproducto()==''||json_getPlusproducto().endsWith("."))?json_getPlusproducto():json_getPlusproducto()+'.';
  var plusproducto2 = (json_getPlusproducto2()==''||json_getPlusproducto2().endsWith("."))?json_getPlusproducto2():json_getPlusproducto2()+'.';
  var plusproducto3 = (json_getPlusproducto3()==''||json_getPlusproducto3().endsWith("."))?json_getPlusproducto3():json_getPlusproducto3()+'.';
  var pluses = new StringBuffer();
  pluses.append(designacion2);
  if (plusproducto != '' || plusproducto2 != '' || plusproducto3 != '') pluses.append(' <strong>');
  pluses.append(plusproducto);
  if (plusproducto != '' && plusproducto2 != '') pluses.append(' ');
  pluses.append(plusproducto2);
  if ((plusproducto != '' || plusproducto2 != '') && plusproducto3 != '') pluses.append(' ');
  pluses.append(plusproducto3);
  if (plusproducto != '' || plusproducto2 != '' || plusproducto3 != '') pluses.append('</strong>');
  jQuery(".descripcion").html(pluses.toString());
}

function pintaBloquePrecio() {
  var bloqueprecio = new StringBuffer();
  bloqueprecio.append('<div id="precios"></div>');
  var triprecio = json_getTriprecio();
  if (triprecio != '') {
    bloqueprecio.append('<span class="precio-marcador-icono">');
    if (triprecio == 'TRI-PRECIO-MAS-BAJO')
      bloqueprecio.append('<img src="/img/marcador-precio-bajo.jpg"/>Precio m&aacute;s bajo');
    else if (triprecio == 'TRI-MEJOR-RELACION-CALIDAD-PRECIO')
      bloqueprecio.append('<img src="/img/marcador-relacion-calidad-precio.jpg"/>Mejor relaci&oacute;n calidad/precio');
    else if (triprecio == 'TRI-MEJOR-PRECIO-GAMA-ALTA')
      bloqueprecio.append('<img src="/img/marcador-alta-mejor-precio.jpg"/>Gama alta al mejor precio');
    bloqueprecio.append('</span>');
  }
  var novedad = json_getNovedad();
  if (novedad != '' && novedad == 'SI') {
    var finnov = json_getFinNovedad();
    if (finnov != '') {
      var fn = new Date(finnov.substring(0,4),finnov.substring(5,7)-1,finnov.substring(8,10));
      fn.setDate(fn.getDate()+1);
      if (sysDate < fn)
        bloqueprecio.append('<span class="lme_precio-marcador-icono"><img src="/img/marcador-novedad.jpg"/>Novedad</span>');
    } else
      bloqueprecio.append('<span class="lme_precio-marcador-icono"><img src="/img/marcador-novedad.jpg"/>Novedad</span>');
  }
  jQuery(".lme_bloque-precio").html(bloqueprecio.toString());
  cargaPreciosProducto();
}

function buscaBannerOferta() {
  var oferta = json_getOferta();
  if (oferta != '') {
    getBannerOferta(oferta);
    var imagen = getAtributoPorNombreObj(json_banner_oferta, "imagen");
    if (imagen != "") {
      var bannerPeque = new StringBuffer();
      bannerPeque.append('<a href="#').append(json_getIdObj(json_banner_oferta))
        .append('"><img src="')
        .append(json_getElementObject(json_banner_oferta, imagen.id)).append('" /></a>');
        jQuery("#banner-garantia").html(bannerPeque.toString());
    }
    var bannerGrande = new StringBuffer();
    bannerGrande.append('<div id="').append(json_getIdObj(json_banner_oferta))
      .append('" class="wide-module"><div class="wrap-module"><div class="lme_fondo"><h3 class="cabecera-seccion-oferta-especial">');
    if (json_getTitleObj(json_banner_oferta) != "") bannerGrande.append(json_getTitleObj(json_banner_oferta));
    else bannerGrande.append('Oferta especial');
    bannerGrande.append('</h3><div class="oferta-especial" id="oferta-especial">');
    var enlace = json_getLinkObj(json_banner_oferta);
    var imagenGrande = getAtributoPorNombreObj(json_banner_oferta, "imagenGrande");
    if (imagenGrande != "") {
      bannerGrande.append('<div class="imagen-oferta-especial">');
      if (enlace != "") bannerGrande.append('<a href="').append(enlace).append('">');
      bannerGrande.append('<img src="')
      .append(json_getElementObject(json_banner_oferta, imagenGrande.id)).append('" />');
      if (enlace != "") bannerGrande.append('</a>');
      bannerGrande.append('</div>');
    }
    var designacion = getAtributoPorNombreObj(json_banner_oferta, "extdesignacion");
    if (designacion != "") {
      bannerGrande.append('<h6><strong>')
        .append(json_getElementObject(json_banner_oferta, designacion.id))
        .append('</strong></h6>');
    }
    var descripcion = getAtributoPorNombreObj(json_banner_oferta, "descripcion");
    if (descripcion != "") {
      bannerGrande.append('<p>')
        .append(json_getElementObject(json_banner_oferta, descripcion.id)).append('</p>');
    }
    bannerGrande.append('</div></div></div></div>');
    if (jQuery("#"+json_getIdObj(json_banner_oferta)).size() == 0)
      jQuery("#oferta-grande").append(bannerGrande.toString());
  }
}

function cambiaCheckboxesOcultos(idDiv) {
  var options = jQuery(idDiv).find('option');
  jQuery.each(options, function(){
    var selected = jQuery(this).attr('selected');
    var value = jQuery(this).attr('value');
    if (selected && !jQuery(idDiv + ' input[value=' + value + ']').attr('checked'))
      jQuery(idDiv + ' input[value=' + value + ']').attr('checked','checked');
    if (!selected && jQuery(idDiv + ' input[value=' + value + ']').attr('checked'))
      jQuery(idDiv + ' input[value=' + value + ']').removeAttr('checked');
  });
}

function setCookieData(lmTiendaTextoMostrar,codtienda,provincia){
  // Ponemos el texto a mostrar en una cookie
  // nombreCookie, valor, expiracion (dias))
  // Nombre a mostrar
  jQuery.cookie("lmtiendatext", null, { path: '/', expires: 10000 });
  jQuery.cookie("lmtiendatext", lmTiendaTextoMostrar, { path: '/', expires: 10000 });
  // Codigo de la tienda
  jQuery.cookie("lmtiendacod", null, { path: '/', expires: 10000 });
  jQuery.cookie("lmtiendacod", codtienda, { path: '/', expires: 10000 });
  // Provincia de la tienda
  jQuery.cookie("lmprovincia", null, { path: '/', expires: 10000 });
  jQuery.cookie("lmprovincia", provincia, { path: '/', expires: 10000 });
}

function borrarCookie(){
  // Borramos la cookie
  jQuery.cookie("lmtiendatext", null, { path: '/', expires: 10000 });
  jQuery.cookie("lmtiendacod", null, { path: '/', expires: 10000 });
  jQuery.cookie("lmprovincia", null, { path: '/', expires: 10000 });
}

function gotoMiEspacio() {
 document.location.href="/mi-leroy-merlin/acceso.html";
}
function gotoMiEspacio(atributo) {
 document.location.href="/mi-leroy-merlin/acceso.html?apuntar="+atributo;
}

function sendFriend(){
  showOverlay();
  var aa = jQuery("a.send-amigo").offset();
  var xAux = aa.left-560;
  var yAux = aa.top-40;
  jQuery("div.lme_modulo-envio-amigo").css("top",yAux).css("left",xAux).css("display","block");
  return false;
};

function sendFriend(x,y){
  showOverlay();
  var aa = jQuery("a.send-amigo").offset();
  var xAux = aa.left+x;
  var yAux = aa.top+y;
  jQuery("div.lme_modulo-envio-amigo").css("top",yAux).css("left",xAux).css("display","block");
  return false;
};

function sendFriend(x,y, elemento){
  showOverlay();
  var aa = jQuery(elemento).offset();
  var xAux = aa.left+x;
  var yAux = aa.top+y;
  jQuery("div.lme_modulo-envio-amigo").css("top",yAux).css("left",xAux).css("display","block");
  return false;
};

function sendMail(x,y){
  showOverlay();
  var aa = jQuery(".send-mail").offset();
  var xAux = aa.left+x;
  var yAux = aa.top+y;
  jQuery(".lme_modulo-envio-mail").css("top",yAux).css("left",xAux).css("display","block");
  return false;
};

//Poner la primera en mayúsculas y el resto en minúsculas
function upperFirst(cadena) {
  return cadena.substr(0,1).toUpperCase()+cadena.substr(1, cadena.length).toLowerCase();
}

//Recargar la informacion general de disponibilidad en variantes y bodegones con SOLR
function hayDisponGeneralSOLR() {
  var codigo = jQuery.cookie("lmtiendacod");
  jQuery("#disponibilidad").hide();
  if (codigo!=undefined && codigo!='null' && codigo!='') {
    jQuery("#sinTienda").hide();
    if (jQuery("#variantes").find(".paso-ok").length > 0 || jQuery("#elementosBodegon").find(".paso-ok").length > 0) {
      jQuery("#noDisponible").hide();
      jQuery("#textTienda").html(jQuery.cookie("lmtiendatext"));
      var buf = new StringBuffer();
      buf.append(json_getSecciontienda()).append('<br/><a href="#" onclick=\'window.open("/tiendas/planos/')
        .append(codigo).append('.pdf")\' class="link">Ver plano de la tienda</a>');
      jQuery('#dondeencontrarlo').html(buf.toString());
      jQuery("#disponible").show();
    } else {
      jQuery("#textTiendaNo").html(jQuery.cookie("lmtiendatext"));
      jQuery("#noDisponible").show();
      jQuery("#disponible").hide();
    }
  } else {
    jQuery("#sinTienda").show();
    jQuery("#noDisponible").hide();
    jQuery("#disponible").hide();
  }
}

function showCargando() {
  jQuery("#capa-cargando").show().delay(1250).fadeOut("fast");
}

function showAlertasLeroy(alert){
  showOverlay();
  jQuery(".lme_alerta_leroy").css("display","inline");
  jQuery("#alerta").val(alert);
}

function rellenarLinkPredictivo(linkURL) {
  if (linkURL.charAt(0)!="/")
    linkURL="/"+linkURL;
  document.location.href=linkURL+"&from=predictivo&question="+jQuery("#search_input").val();
}

function buscarProvincia(){
  var provincias = new Map();
  var contador = 0;
  for(var i=0;i<arr_tiendas.length;i++){
    if (provincias.findIt(arr_tiendas[i].provincia)==-1)
      provincias.put(arr_tiendas[i].provincia,"tda");
  }
  return provincias.keySet().sort(sortProvincia);
}

function buscarTiendaPorProvincia(provincia){
  var retorno = new Array();
  var contador = 0;
  for(var i=0;i<arr_tiendas.length;i++){
    if (arr_tiendas[i].provincia.toLowerCase()==provincia.toLowerCase())
      retorno[contador++]=arr_tiendas[i];
  }
  return retorno.sort(sortTiendaPorProvincia);
}

function getTiendaPorCodigo(codigo){
  for(var i=0;i<arr_tiendas.length;i++){
    if (arr_tiendas[i].codigo==codigo)
      return arr_tiendas[i];
  }
  return;
}

function buscarTiendaPorCodigo(codigo){
  var retorno = new Array();
  for(var i=0;i<arr_tiendas.length;i++){
    if (arr_tiendas[i].codigo==codigo)
      return arr_tiendas[i].extdesignacion;
  }
  return;
}

function buscarURLTiendaPorCodigo(codigo) {
  for(var i=0;i<arr_tiendas.length;i++) {
    if (arr_tiendas[i].codigo==codigo) return arr_tiendas[i].urlname;
  }
  return "";
}

function buscarCercaniaTiendaPorCodigo(codigo) {
  for(var i=0;i<arr_tiendas.length;i++) {
    if (arr_tiendas[i].codigo==codigo) return arr_tiendas[i].cercania;
  }
  return "";
}

function buscarObjetoTiendaPorCodigo(codigo){
  var retorno = new Array();
  for(var i=0;i<arr_tiendas.length;i++){
    if (arr_tiendas[i].codigo==codigo)
      return arr_tiendas[i];
  }
  return;
}

function buscarTiendaPorCCAA(ccaa){
  var retorno = new Array();
  var contador = 0;
  for(var i=0;i<arr_tiendas.length;i++){
    if (arr_tiendas[i].ccaa.toLowerCase()==ccaa.toLowerCase())
      retorno[contador++]=arr_tiendas[i];
  }
  return retorno.sort(sortTiendaPorProvincia);
}

function buscarTiendasPorCercania(tiendasCerca) {
  var arr_cerca = tiendasCerca.split(",");
  return arr_tiendas.findAll(function(tienda) {
    return arr_cerca.indexOf(tienda.codigo) > -1;
  }).sort(sortTiendaPorProvincia);
}

function getTiendasOrdenadas() {
  return arr_tiendas.sort(sortTienda);
}

function sortProvincia(a, b){
  return Acentos(a)>Acentos(b) ? 1 : Acentos(a)<Acentos(b) ? -1:0;
}

function sortTienda(a, b){
  //Compare "a" and "b" in some fashion, and return -1, 0, or 1
  return Acentos(a.extdesignacion)>Acentos(b.extdesignacion) ? 1 : Acentos(a.extdesignacion)<Acentos(b.extdesignacion) ? -1:0;
}

function createOptionsProvincias(){
  var arr_Provincias = buscarProvincia();
  var retorno = new StringBuffer();
  retorno.append("<option value=\"\">Provincia</option>");
  for (var i=0; i<arr_Provincias.length;i++){
    retorno.append("<option value=\""+arr_Provincias[i]+"\">"+arr_Provincias[i]+"</option>");
  }
  retorno.append("<option value=\"ninguna\">-- Ninguna --</option>");
  return retorno.toString();
}
//Para el combo de contacto
function createOptionsProvinciasSinNinguna(){
  var arr_Provincias = buscarProvincia();
  var retorno = new StringBuffer();
  retorno.append("<option value=\"\">Provincia</option>");
  for (var i=0; i<arr_Provincias.length;i++){
    retorno.append("<option value=\""+arr_Provincias[i]+"\">"+arr_Provincias[i]+"</option>");
  }
  return retorno.toString();
}
function createOptionsTiendas(provincia){
  var retorno = new StringBuffer();
  var arr_temp = new Array();
  if (provincia != undefined) arr_temp = buscarTiendaPorProvincia(provincia);
  else arr_temp = getTiendasOrdenadas();
  for (var i=0; i<arr_temp.length;i++){
    retorno.append("<option value=\""+arr_temp[i].codigo+"#"+arr_temp[i].cercania+"\">"+arr_temp[i].extdesignacion+"</option>");
  }
  return retorno.toString();
}

//Funciones de lupa en producto
function muestraZoom(){
  jQuery('#imgLupa').show();
}
function ocultaZoom(){
  jQuery('#imgLupa').hide();
}

function actualizaFormularioOpinion() {
  if (jQuery('#contacto-dire1').length) {
    if (jQuery.cookie("lmprovincia") != null)
      jQuery('#provincia').attr("value",jQuery.cookie("lmprovincia"));
    else jQuery('#provincia').attr("value","");
    jQuery('#provincia').trigger('change');
     jQuery("#contacto-oficina-al").empty();
    if (jQuery.cookie("lmtiendacod") != null)
//      jQuery('#store').attr("value",jQuery.cookie("lmtiendacod")+"#"+jQuery.cookie("lmtiendascercanas"));
      jQuery('#store').attr("value",jQuery.cookie("lmtiendacod"));
    else jQuery('#store').attr("value","");
  }
}

// Add properties to site Catalyst
var propiedadesSiteCatalyst = new Map();
function addPropiedadSC(clave, valor){
  propiedadesSiteCatalyst.put(clave, valor);
}
function getPropiedadSC(clave){
  return propiedadesSiteCatalyst.get(clave);
}
//Add events to site Catalyst
function eventoSC(evento, texto, nomEvento){
  var s=s_gi('a64lmglobal');
  s.linkTrackVars='events,prop9,prop10,products,eVar14';//variables y eventos
  s.linkTrackEvents=nomEvento;// eventos ? 'None'
  s.events=nomEvento;//definir eventos
  s.products=lme_productInfo; //nombre del producto en caso de visualizarse una ficha producto, con su reflm
//  s.prop9 = get_cookie("lmtiendatext"); //Tienda
//  s.prop10 = get_cookie("lmprovincia"); //Provincia
  s.prop9 = jQuery.cookie("lmtiendatext")!=null?Acentos(jQuery.cookie("lmtiendatext")):""; //Tienda
  s.prop10 = jQuery.cookie("lmtiendatext")!=null?Acentos(jQuery.cookie("lmprovincia")):""; //Provincia
  if (nomEvento == 'event11') {
    s.eVar14 = texto;
    texto = 'compartido ' + texto;
  }
  s.tl(evento,'o',texto+' en '+document.title);
  return true;
}

// Ajuste de lineas a un div
function ajustarALineas(idclassElemento, lineas){
  jQuery(idclassElemento).each( function(){
    var txt='<span>'+jQuery(this).html().split('').join('</span><span>')+'</span>';
    jQuery(this).html(txt);
    var t='';
    var cuenta=[];
    for(var i=0, l=jQuery(this).find("span"),ll=l.length;i<ll;i++){
      if(!cuenta.inArray(l[i].offsetTop)) cuenta.push(l[i].offsetTop);

      if(cuenta.length<=lineas) t+=l[i].innerHTML;
      else {
        t=t.substring(0,t.length-3);
        t+='...';
        break;
      }
    }
    jQuery(this).html(t);
    // ajustar el strong
    var textobr='';
    jQuery(this).parent().find("strong").each( function(elemento,valor){
      var porBRs = jQuery(valor).html().split('<BR>');
      if (porBRs.length==1) porBRs = jQuery(valor).html().split('<br>');
      for (i=0;i<porBRs.length;i++) {
        if (i<=lineas){
          if (i>0) textobr+='<br/>'+porBRs[i];
          else textobr+=porBRs[i];
        } else {
          textobr+='...';
          break;
        }
      }
      jQuery(valor).html(textobr);
    });

  });
}

function StringBuffer() {
  this.buffer = [];
}

StringBuffer.prototype.append = function append(string) {
  this.buffer.push(string);
  return this;
}

StringBuffer.prototype.toString = function toString() {
  return this.buffer.join("");
}

///////HASHMAP en JavaScript/////////////
function Map() {
  // members
  this.keyArray = new Array(); // Keys
  this.valArray = new Array(); // Values
  // methods
  this.put = put;
  this.get = get;
  this.size = size;
  this.clear = clear;
  this.keySet = keySet;
  this.valSet = valSet;
  this.findIt = findIt;
  this.remove = remove;
}

function put( key, val ) {
  var elementIndex = this.findIt( key );
  if( elementIndex == (-1) ) {
    this.keyArray.push( key );
    this.valArray.push( val );
  } else {
    this.valArray[ elementIndex ] = val;
  }
}

function get( key ) {
  var result = null;
  var elementIndex = this.findIt( key );
  if( elementIndex != (-1) ) {
    result = this.valArray[ elementIndex ];
  }
  return result;
}

function remove( key ) {
  var result = null;
  var elementIndex = this.findIt( key );
  if( elementIndex != (-1) ) {
    this.keyArray = this.keyArray.removeAt(elementIndex);
    this.valArray = this.valArray.removeAt(elementIndex);
  }
  return ;
}

function size() {
  return (this.keyArray.length);
}

function clear() {
  while (this.keyArray.length > 0) {
    this.keyArray.pop();
    this.valArray.pop();
  }
}

function keySet() {
  return (this.keyArray);
}

function valSet() {
  return (this.valArray);
}

function findIt( key ) {
  var result = (-1);

  for( var i = 0; i < this.keyArray.length; i++) {
    if( this.keyArray[ i ] == key ) {
      result = i;
      break;
    }
  }

  return result;
}

function removeAt( index ) {
  var part1 = this.slice( 0, index);
  var part2 = this.slice( index+1 );

  return( part1.concat( part2 ) );
}
Array.prototype.removeAt = removeAt

Array.prototype.inArray=function(el){
  for(var i=0;i<this.length;i++)
    if(this[i]==el) return true;
  return false;
}

Array.prototype.removeElement=function(el){
  var arrayName = this;
  for(var i=0;i<arrayName.length;i++)
    if(arrayName[i]==el) this.splice(i,1);
}

String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
    return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
    return this.replace(/\s+$/,"");
}

