// jQuery JavaScript Library v1.3.2
// http://jquery.com/
// 
// Copyright (c) 2009 John Resig
// Dual licensed under the MIT and GPL licenses.
// http://docs.jquery.com/License
// 
// Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
// Revision: 6246
(function(){

var 
	// Will speed up references to window, and allows munging its name.
	window = this,
	// Will speed up references to undefined, and allows munging its name.
	undefined,
	// Map over jQuery in case of overwrite
	_jQuery = window.jQuery,
	// Map over the $ in case of overwrite
	_$ = window.$,

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

	// A simple way to check for HTML strings or ID strings
	// (both of which we optimize for)
	quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
	// Is it a simple selector
	isSimple = /^.[^:#\[\.,]*$/;

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

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

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

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

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

					// Handle the case where IE and Opera return items
					// by name instead of ID
					if ( elem && elem.id != match[3] )
						return jQuery().find( selector );

					// Otherwise, we inject the element directly into the jQuery object
					var ret = jQuery( elem || [] );
					ret.context = document;
					ret.selector = selector;
					return ret;
				}

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

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

		// Make sure that old selector state is passed along
		if ( selector.selector && selector.context ) {
			this.selector = selector.selector;
			this.context = selector.context;
		}

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

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

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

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

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

			// Return a 'clean' array
			Array.prototype.slice.call( this ) :

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

	// Take an array of elements and push it onto the stack
	// (returning the new matched element set)
	pushStack: function( elems, name, selector ) {
		// Build a new jQuery matched element set
		var ret = jQuery( 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;
	},

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

		return this;
	},

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

	// Determine the position of an element within
	// the matched set of elements
	index: function( elem ) {
		// Locate the position of the desired element
		return jQuery.inArray(
			// If it receives a jQuery object, the first element is used
			elem && elem.jquery ? elem[0] : elem
		, this );
	},

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

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

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

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

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

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

		var ret = "";

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

		return ret;
	},

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

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

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

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

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

		return this;
	},

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

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

	append: function() {
		return this.domManip(arguments, true, 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() {
		return this.domManip(arguments, false, function(elem){
			this.parentNode.insertBefore( elem, this );
		});
	},

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

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

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

	find: function( selector ) {
		if ( this.length === 1 ) {
			var ret = this.pushStack( [], "find", selector );
			ret.length = 0;
			jQuery.find( selector, this[0], ret );
			return ret;
		} else {
			return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
				return jQuery.find( selector, elem );
			})), "find", selector );
		}
	},

	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;
				if ( !html ) {
					var div = this.ownerDocument.createElement("div");
					div.appendChild( this.cloneNode(true) );
					html = div.innerHTML;
				}

				return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
			} else
				return this.cloneNode(true);
		});

		// Copy the events from the original to the clone
		if ( events === true ) {
			var orig = this.find("*").andSelf(), i = 0;

			ret.find("*").andSelf().each(function(){
				if ( this.nodeName !== orig[i].nodeName )
					return;

				var events = jQuery.data( orig[i], "events" );

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

				i++;
			});
		}

		// Return the cloned set
		return ret;
	},

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

			jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
				return elem.nodeType === 1;
			}) ), "filter", selector );
	},

	closest: function( selector ) {
		var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
			closer = 0;

		return this.map(function(){
			var cur = this;
			while ( cur && cur.ownerDocument ) {
				if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
					jQuery.data(cur, "closest", closer);
					return cur;
				}
				cur = cur.parentNode;
				closer++;
			}
		});
	},

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

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

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

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

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

	val: function( value ) {
		if ( value === undefined ) {			
			var elem = this[0];

			if ( elem ) {
				if( jQuery.nodeName( elem, 'option' ) )
					return (elem.attributes.value || {}).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 ];

						if ( option.selected ) {
							// Get the specifc 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;				
				}

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

			}

			return undefined;
		}

		if ( typeof value === "number" )
			value += '';

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

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

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

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

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

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

	html: function( value ) {
		return value === undefined ?
			(this[0] ?
				this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
				null) :
			this.empty().append( value );
	},

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

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

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

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

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

	domManip: function( args, table, callback ) {
		if ( this[0] ) {
			var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
				scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
				first = fragment.firstChild;

			if ( first )
				for ( var i = 0, l = this.length; i < l; i++ )
					callback.call( root(this[i], first), this.length > 1 || i > 0 ?
							fragment.cloneNode(true) : fragment );
		
			if ( scripts )
				jQuery.each( scripts, evalScript );
		}

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

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

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

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

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

function now(){
	return +new Date;
}

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

	// Handle a deep copy situation
	if ( 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 ( var name in options ) {
				var src = target[ name ], copy = options[ name ];

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

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

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

			}

	// Return the modified object
	return target;
};

// exclude the following css properties to add px
var	exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
	// cache defaultView
	defaultView = document.defaultView || {},
	toString = Object.prototype.toString;

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

		if ( deep )
			window.jQuery = _jQuery;

		return jQuery;
	},

	// 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 toString.call(obj) === "[object Function]";
	},

	isArray: function( obj ) {
		return toString.call(obj) === "[object Array]";
	},

	// check if an element is in a (or is an) XML document
	isXMLDoc: function( elem ) {
		return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
			!!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
	},

	// Evalulates a script in a global context
	globalEval: function( data ) {
		if ( data && /\S/.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;

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

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

		return object;
	},

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

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

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

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

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

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

		callback.call( elem );

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

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

			function getWH() {
				val = name == "width" ? elem.offsetWidth : elem.offsetHeight;

				if ( extra === "border" )
					return;

				jQuery.each( which, function() {
					if ( !extra )
						val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
					if ( extra === "margin" )
						val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
					else
						val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
				});
			}

			if ( elem.offsetWidth !== 0 )
				getWH();
			else
				jQuery.swap( elem, props, getWH );

			return Math.max(0, Math.round(val));
		}

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

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

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

			return ret == "" ?
				"1" :
				ret;
		}

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

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

		else if ( defaultView.getComputedStyle ) {

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

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

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

			if ( computedStyle )
				ret = computedStyle.getPropertyValue( name );

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

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

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

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

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

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

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

		return ret;
	},

	clean: function( elems, context, fragment ) {
		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;

		// If a single string is passed in and it's a single tag
		// just do a createElement and skip the rest
		if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
			var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
			if ( match )
				return [ context.createElement( match[1] ) ];
		}

		var ret = [], scripts = [], div = context.createElement("div");

		jQuery.each(elems, function(i, elem){
			if ( typeof elem === "number" )
				elem += '';

			if ( !elem )
				return;

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

				// Trim whitespace, otherwise indexOf won't work as expected
				var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();

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

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

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

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

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

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

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

					[ 0, "", "" ];

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

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

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

					// String was a <table>, *may* have spurious <tbody>
					var hasBody = /<tbody/i.test(elem),
						tbody = !tags.indexOf("<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 && /^\s/.test( elem ) )
					div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
				
				elem = jQuery.makeArray( div.childNodes );
			}

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

		});

		if ( fragment ) {
			for ( var i = 0; ret[i]; i++ ) {
				if ( 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 scripts;
		}

		return ret;
	},

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

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

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

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

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

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

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

					elem[ name ] = value;
				}

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

				// 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
						: elem.nodeName.match(/(button|input|object|select|textarea)/i)
							? 0
							: elem.nodeName.match(/^(a|area)$/i) && elem.href
								? 0
								: undefined;
				}

				return elem[ name ];
			}

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

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

			var attr = !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;
		}

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

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

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

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

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

		if ( set )
			elem[ name ] = value;

		return elem[ name ];
	},

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

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

		if( array != null ){
			var i = array.length;
			// The window, strings (and functions) also have 'length'
			if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
				ret[0] = array;
			else
				while( i )
					ret[--i] = array[i];
		}

		return ret;
	},

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

		return -1;
	},

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

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

		return first;
	},

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

		try {

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

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

		} catch( e ) {
			ret = array;
		}

		return ret;
	},

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

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

		return ret;
	},

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

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

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

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

// Use of jQuery.browser is deprecated.
// It's included for backwards compatibility and plugins,
// although they should work to migrate away.

var userAgent = navigator.userAgent.toLowerCase();

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

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

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

		return this.pushStack( jQuery.unique( ret ), name, selector );
	};
});

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 );

		for ( var i = 0, l = insert.length; i < l; i++ ) {
			var elems = (i > 0 ? this.clone(true) : this).get();
			jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
			ret = ret.concat( elems );
		}

		return this.pushStack( ret, name, selector );
	};
});

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

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

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

	toggleClass: function( classNames, state ) {
		if( typeof state !== "boolean" )
			state = !jQuery.className.has( this, classNames );
		jQuery.className[ state ? "add" : "remove" ]( this, classNames );
	},

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

	empty: function() {
		// Remove element nodes and prevent memory leaks
		jQuery(this).children().remove();

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

// Helper function used by the dimensions and offset modules
function num(elem, prop) {
	return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
}
var expando = "jQuery" + now(), uuid = 0, windowData = {};

jQuery.extend({
	cache: {},

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

		var id = elem[ expando ];

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

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

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

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

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

		var id = elem[ expando ];

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

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

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

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

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

			// Completely remove the data cache
			delete jQuery.cache[ id ];
		}
	},
	queue: function( elem, type, data ) {
		if ( elem ){
	
			type = (type || "fx") + "queue";
	
			var q = jQuery.data( elem, type );
	
			if ( !q || jQuery.isArray(data) )
				q = jQuery.data( elem, type, jQuery.makeArray(data) );
			else if( data )
				q.push( data );
	
		}
		return q;
	},

	dequeue: function( elem, type ){
		var queue = jQuery.queue( elem, type ),
			fn = queue.shift();
		
		if( !type || type === "fx" )
			fn = queue[0];
			
		if( fn !== undefined )
			fn.call(elem);
	}
});

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

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

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

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

	removeData: function( key ){
		return this.each(function(){
			jQuery.removeData( this, key );
		});
	},
	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(){
			var queue = jQuery.queue( this, type, data );
			
			 if( type == "fx" && queue.length == 1 )
				queue[0].call(this);
		});
	},
	dequeue: function(type){
		return this.each(function(){
			jQuery.dequeue( this, type );
		});
	}
});
	// Sizzle CSS Selector Engine - v0.9.3
	// Copyright 2009, The Dojo Foundation
	// Released under the MIT, BSD, and GPL Licenses.
	// More information: http://sizzlejs.com/
(function(){

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

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

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

	var parts = [], m, set, checkSet, check, mode, extra, prune = true;
	
	// Reset the position of the chunker regexp (start from head)
	chunker.lastIndex = 0;
	
	while ( (m = chunker.exec(selector)) !== null ) {
		parts.push( m[1] );
		
		if ( m[2] ) {
			extra = RegExp.rightContext;
			break;
		}
	}

	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 {
		var ret = seed ?
			{ expr: parts.pop(), set: makeArray(seed) } :
			Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
		set = Sizzle.filter( ret.expr, ret.set );

		if ( parts.length > 0 ) {
			checkSet = makeArray(set);
		} else {
			prune = false;
		}

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

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

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

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

	if ( !checkSet ) {
		checkSet = set;
	}

	if ( !checkSet ) {
		throw "Syntax error, unrecognized expression: " + (cur || selector);
	}

	if ( toString.call(checkSet) === "[object Array]" ) {
		if ( !prune ) {
			results.push.apply( results, checkSet );
		} else if ( context.nodeType === 1 ) {
			for ( var i = 0; checkSet[i] != null; i++ ) {
				if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
					results.push( set[i] );
				}
			}
		} else {
			for ( var 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, context, results, seed );

		if ( sortOrder ) {
			hasDuplicate = false;
			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.find = function(expr, context, isXML){
	var set, match;

	if ( !expr ) {
		return [];
	}

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

			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 old = expr, result = [], curLoop = set, match, anyFound,
		isXMLFilter = set && set[0] && isXML(set[0]);

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

				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 ) {
				throw "Syntax error, unrecognized expression: " + expr;
			} else {
				break;
			}
		}

		old = expr;
	}

	return curLoop;
};

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\(\)]*)+)\2\))?/
	},
	attrMap: {
		"class": "className",
		"for": "htmlFor"
	},
	attrHandle: {
		href: function(elem){
			return elem.getAttribute("href");
		}
	},
	relative: {
		"+": function(checkSet, part, isXML){
			var isPartStr = typeof part === "string",
				isTag = isPartStr && !/\W/.test(part),
				isPartStrNotTag = isPartStr && !isTag;

			if ( isTag && !isXML ) {
				part = part.toUpperCase();
			}

			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 === part ?
						elem || false :
						elem === part;
				}
			}

			if ( isPartStrNotTag ) {
				Sizzle.filter( part, checkSet, true );
			}
		},
		">": function(checkSet, part, isXML){
			var isPartStr = typeof part === "string";

			if ( isPartStr && !/\W/.test(part) ) {
				part = isXML ? part : part.toUpperCase();

				for ( var i = 0, l = checkSet.length; i < l; i++ ) {
					var elem = checkSet[i];
					if ( elem ) {
						var parent = elem.parentNode;
						checkSet[i] = parent.nodeName === part ? parent : false;
					}
				}
			} else {
				for ( var i = 0, l = checkSet.length; i < l; i++ ) {
					var 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 doneName = done++, checkFn = dirCheck;

			if ( !part.match(/\W/) ) {
				var nodeCheck = part = isXML ? part : part.toUpperCase();
				checkFn = dirNodeCheck;
			}

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

			if ( typeof part === "string" && !part.match(/\W/) ) {
				var nodeCheck = part = isXML ? part : part.toUpperCase();
				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]);
				return m ? [m] : [];
			}
		},
		NAME: function(match, context, isXML){
			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 + " ").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){
			for ( var i = 0; curLoop[i] === false; i++ ){}
			return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
		},
		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 ( match[3].match(chunker).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.toUpperCase() === "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 || "").indexOf(match[3]) >= 0;
			} else if ( name === "not" ) {
				var not = match[3];

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

				return true;
			}
		},
		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 === 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;

for ( var type in Expr.match ) {
	Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
}

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

	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.
try {
	Array.prototype.slice.call( document.documentElement.childNodes );

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

		if ( toString.call(array) === "[object Array]" ) {
			Array.prototype.push.apply( ret, array );
		} else {
			if ( typeof array.length === "number" ) {
				for ( var i = 0, l = array.length; i < l; i++ ) {
					ret.push( array[i] );
				}
			} else {
				for ( var i = 0; array[i]; i++ ) {
					ret.push( array[i] );
				}
			}
		}

		return ret;
	};
}

var sortOrder;

if ( document.documentElement.compareDocumentPosition ) {
	sortOrder = function( a, b ) {
		var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
		if ( ret === 0 ) {
			hasDuplicate = true;
		}
		return ret;
	};
} else if ( "sourceIndex" in document.documentElement ) {
	sortOrder = function( a, b ) {
		var ret = a.sourceIndex - b.sourceIndex;
		if ( ret === 0 ) {
			hasDuplicate = true;
		}
		return ret;
	};
} else if ( document.createRange ) {
	sortOrder = function( a, b ) {
		var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
		aRange.selectNode(a);
		aRange.collapse(true);
		bRange.selectNode(b);
		bRange.collapse(true);
		var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
		if ( ret === 0 ) {
			hasDuplicate = true;
		}
		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("form"),
		id = "script" + (new Date).getTime();
	form.innerHTML = "<input name='" + id + "'/>";

	// Inject it into the root element, check its status, and remove it quickly
	var root = document.documentElement;
	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 );
})();

(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);
		};
	}
})();

if ( document.querySelectorAll ) (function(){
	var oldSizzle = Sizzle, div = document.createElement("div");
	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;

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

	Sizzle.find = oldSizzle.find;
	Sizzle.filter = oldSizzle.filter;
	Sizzle.selectors = oldSizzle.selectors;
	Sizzle.matches = oldSizzle.matches;
})();

if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (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)
	if ( 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]);
		}
	};
})();

function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
	var sibDir = dir == "previousSibling" && !isXML;
	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
		var elem = checkSet[i];
		if ( elem ) {
			if ( sibDir && elem.nodeType === 1 ){
				elem.sizcache = doneName;
				elem.sizset = i;
			}
			elem = elem[dir];
			var match = false;

			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 === cur ) {
					match = elem;
					break;
				}

				elem = elem[dir];
			}

			checkSet[i] = match;
		}
	}
}

function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
	var sibDir = dir == "previousSibling" && !isXML;
	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
		var elem = checkSet[i];
		if ( elem ) {
			if ( sibDir && elem.nodeType === 1 ) {
				elem.sizcache = doneName;
				elem.sizset = i;
			}
			elem = elem[dir];
			var match = false;

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

var contains = document.compareDocumentPosition ?  function(a, b){
	return a.compareDocumentPosition(b) & 16;
} : function(a, b){
	return a !== b && (a.contains ? a.contains(b) : true);
};

var isXML = function(elem){
	return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
		!!elem.ownerDocument && isXML( elem.ownerDocument );
};

var posProcess = function(selector, context){
	var tmpSet = [], later = "", match,
		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.filter = Sizzle.filter;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;

Sizzle.selectors.filters.hidden = function(elem){
	return elem.offsetWidth === 0 || elem.offsetHeight === 0;
};

Sizzle.selectors.filters.visible = function(elem){
	return elem.offsetWidth > 0 || elem.offsetHeight > 0;
};

Sizzle.selectors.filters.animated = function(elem){
	return jQuery.grep(jQuery.timers, function(fn){
		return elem === fn.elem;
	}).length;
};

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

	return Sizzle.matches(expr, elems);
};

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

jQuery.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;
};

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

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

	return r;
};

return;

window.Sizzle = Sizzle;

})();

// 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 ( elem.setInterval && elem != window )
			elem = window;

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

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

			// Create unique handler function, wrapped around original handler
			handler = this.proxy( fn );

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

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

		// Handle multiple events separated by a space
		// jQuery(...).bind("mouseover mouseout", fn);
		jQuery.each(types.split(/\s+/), function(index, type) {
			// Namespaced event handlers
			var namespaces = type.split(".");
			type = namespaces.shift();
			handler.type = namespaces.slice().sort().join(".");

			// Get the current list of functions bound to this event
			var handlers = events[type];
			
			if ( jQuery.event.specialAll[type] )
				jQuery.event.specialAll[type].setup.call(elem, data, namespaces);

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

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

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

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

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

	guid: 1,
	global: {},

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

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

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

				// Handle multiple events seperated by a space
				// jQuery(...).unbind("mouseover mouseout", fn);
				jQuery.each(types.split(/\s+/), function(index, type){
					// Namespaced event handlers
					var namespaces = type.split(".");
					type = namespaces.shift();
					var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");

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

						// remove all handlers for the given type
						else
							for ( var handle in events[type] )
								// Handle the removal of namespaced events
								if ( namespace.test(events[type][handle].type) )
									delete events[type][handle];
									
						if ( jQuery.event.specialAll[type] )
							jQuery.event.specialAll[type].teardown.call(elem, namespaces);

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

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

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

		if( !bubbling ){
			event = typeof event === "object" ?
				// jQuery.Event object
				event[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 ( this.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 = jQuery.data(elem, "handle");
		if ( handle )
			handle.apply( elem, data );

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

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

		this.triggered = false;

		if ( !event.isPropagationStopped() ) {
			var parent = elem.parentNode || elem.ownerDocument;
			if ( parent )
				jQuery.event.trigger(event, data, parent, true);
		}
	},

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

		event = arguments[0] = jQuery.event.fix( event || window.event );
		event.currentTarget = this;
		
		// Namespaced event handlers
		var namespaces = event.type.split(".");
		event.type = namespaces.shift();

		// Cache this now, all = true means, any handler
		all = !namespaces.length && !event.exclusive;
		
		var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");

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

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

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

				var ret = handler.apply(this, arguments);

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

				if( event.isImmediatePropagationStopped() )
					break;

			}
		}
	},

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

	fix: function(event) {
		if ( event[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 )
			event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either

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

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

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

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

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

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

		return event;
	},

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

	special: {
		ready: {
			// Make sure the ready event is setup
			setup: bindReady,
			teardown: function() {}
		}
	},
	
	specialAll: {
		live: {
			setup: function( selector, namespaces ){
				jQuery.event.add( this, namespaces[0], liveHandler );
			},
			teardown:  function( namespaces ){
				if ( namespaces.length ) {
					var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
					
					jQuery.each( (jQuery.data(this, "events").live || {}), function(){
						if ( name.test(this.type) )
							remove++;
					});
					
					if ( remove < 1 )
						jQuery.event.remove( this, namespaces[0], liveHandler );
				}
			}
		}
	}
};

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 = now();
	
	// Mark it as fixed
	this[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)
		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;
	// Traverse up the tree
	while ( parent && parent != this )
		try { parent = parent.parentNode; }
		catch(e) { parent = this; }
	
	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 );
	}
};
	
jQuery.each({ 
	mouseover: 'mouseenter', 
	mouseout: 'mouseleave'
}, function( orig, fix ){
	jQuery.event.special[ fix ] = {
		setup: function(){
			jQuery.event.add( this, orig, withinElement, fix );
		},
		teardown: function(){
			jQuery.event.remove( this, orig, withinElement );
		}
	};			   
});

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

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

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

	trigger: function( type, data ) {
		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.event.proxy( fn, args[i++] );

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

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

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

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

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

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

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

		return this;
	},
	
	live: function( type, fn ){
		var proxy = jQuery.event.proxy( fn );
		proxy.guid += this.selector + type;

		jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );

		return this;
	},
	
	die: function( type, fn ){
		jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
		return this;
	}
});

function liveHandler( event ){
	var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
		stop = true,
		elems = [];

	jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
		if ( check.test(fn.type) ) {
			var elem = jQuery(event.target).closest(fn.data)[0];
			if ( elem )
				elems.push({ elem: elem, fn: fn });
		}
	});

	elems.sort(function(a,b) {
		return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
	});
	
	jQuery.each(elems, function(){
		if ( this.fn.call(this.elem, event, this.fn.data) === false )
			return (stop = false);
	});

	return stop;
}

function liveConvert(type, selector){
	return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
}

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

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

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

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

var readyBound = false;

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

	// Mozilla, Opera and webkit nightlies currently support this event
	if ( document.addEventListener ) {
		// Use the handy event callback
		document.addEventListener( "DOMContentLoaded", function(){
			document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
			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", function(){
			if ( document.readyState === "complete" ) {
				document.detachEvent( "onreadystatechange", arguments.callee );
				jQuery.ready();
			}
		});

		// If IE and not an iframe
		// continually check to see if the document is ready
		if ( document.documentElement.doScroll && window == window.top ) (function(){
			if ( jQuery.isReady ) return;

			try {
				// If IE is used, use the trick by Diego Perini
				// http://javascript.nwbox.com/IEContentLoaded/
				document.documentElement.doScroll("left");
			} catch( error ) {
				setTimeout( arguments.callee, 0 );
				return;
			}

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

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

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

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

// Prevent memory leaks in IE
// And prevent errors on refresh with events like mouseover in other browsers
// Window isn't included so as not to unbind existing unload events
jQuery( window ).bind( 'unload', function(){ 
	for ( var id in jQuery.cache )
		// Skip the window
		if ( id != 1 && jQuery.cache[ id ].handle )
			jQuery.event.remove( jQuery.cache[ id ].handle.elem );
}); 
(function(){

	jQuery.support = {};

	var root = document.documentElement,
		script = document.createElement("script"),
		div = document.createElement("div"),
		id = "script" + (new Date).getTime();

	div.style.display = "none";
	div.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';

	var all = div.getElementsByTagName("*"),
		a = div.getElementsByTagName("a")[0];

	// 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 you can get all elements in an <object> element
		// IE 7 always returns no results
		objectAll: !!div.getElementsByTagName("object")[0]
			.getElementsByTagName("*").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)
		opacity: a.style.opacity === "0.5",
		
		// Verify style float existence
		// (IE uses styleFloat instead of cssFloat)
		cssFloat: !!a.style.cssFloat,

		// Will be defined later
		scriptEval: false,
		noCloneEvent: true,
		boxModel: null
	};
	
	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 ];
	}

	root.removeChild( script );

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

	// 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;
		document.body.removeChild( div ).style.display = 'none';
	});
})();

var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";

jQuery.props = {
	"for": "htmlFor",
	"class": "className",
	"float": styleFloat,
	cssFloat: styleFloat,
	styleFloat: styleFloat,
	readonly: "readOnly",
	maxlength: "maxLength",
	cellspacing: "cellSpacing",
	rowspan: "rowSpan",
	tabindex: "tabIndex"
};
jQuery.fn.extend({
	// Keep a copy of the old load
	_load: jQuery.fn.load,

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

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

		// 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 );
				type = "POST";
			}

		var self = this;

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

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

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

				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 || /select|textarea/i.test(this.nodeName) ||
					/text|hidden|password|search/i.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);
	};
});

var jsc = now();

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

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

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

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

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

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

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

	ajaxSettings: {
		url: location.href,
		global: true,
		type: "GET",
		contentType: "application/x-www-form-urlencoded",
		processData: true,
		async: true,
		// Create the request object; Microsoft failed to properly
		// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
		// This function can be overriden by calling jQuery.ajaxSetup
		xhr:function(){
			return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
		},
		accepts: {
			xml: "application/xml, text/xml",
			html: "text/html",
			script: "text/javascript, application/javascript",
			json: "application/json, text/javascript",
			text: "text/plain",
			_default: "*/*"
		}
	},

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		// If we're requesting a remote document
		// and trying to load JSON or Script with a GET
		if ( s.dataType == "script" && type == "GET" && parts
			&& ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){

			var head = document.getElementsByTagName("head")[0];
			var script = document.createElement("script");
			script.src = s.url;
			if (s.scriptCharset)
				script.charset = s.scriptCharset;

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

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

						// Handle memory leak in IE
						script.onload = script.onreadystatechange = null;
						// head.removeChild( script );
						// above line replaced with below in recent bugfix - http://dev.jquery.com/changeset/6480
						if ( head && script.parentNode ) { 
							head.removeChild( script ); 
						}
					}
				};
			}

			head.appendChild(script);

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

		var requestDone = false;

		// Create the request object
		var xhr = s.xhr();

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

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

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

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

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

		// Allow custom headers/mimetypes and early abort
		if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
			// Handle the global AJAX counter
			if ( s.global && ! --jQuery.active )
				jQuery.event.trigger( "ajaxStop" );
			// close opended socket
			xhr.abort();
			return false;
		}

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

		// Wait for a response to come back
		var onreadystatechange = function(isTimeout){
			// The request was aborted, clear the interval and decrement jQuery.active
			if (xhr.readyState == 0) {
				if (ival) {
					// clear poll interval
					clearInterval(ival);
					ival = null;
					// Handle the global AJAX counter
					if ( s.global && ! --jQuery.active )
						jQuery.event.trigger( "ajaxStop" );
				}
			// 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;

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

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

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

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

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

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

				// Fire the complete handlers
				complete();

				if ( isTimeout )
					xhr.abort();

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

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

			// Timeout checker
			if ( s.timeout > 0 )
				setTimeout(function(){
					// Check to see if the request is still happening
					if ( xhr && !requestDone )
						onreadystatechange( "timeout" );
				}, s.timeout);
		}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		if ( xml && data.documentElement.tagName == "parsererror" )
			throw "parsererror";
			
		// Allow a pre-filtering function to sanitize the response
		// s != null 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" ){

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

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

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

		function add( key, value ){
			s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
		};

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

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

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

});
var elemdisplay = {},
	timerId,
	fxAttrs = [
		// height animations
		[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
		// width animations
		[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
		// opacity animations
		[ "opacity" ]
	];

function genFx( type, num ){
	var obj = {};
	jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
		obj[ this ] = type;
	});
	return obj;
}

jQuery.fn.extend({
	show: function(speed,callback){
		if ( speed ) {
			return this.animate( genFx("show", 3), speed, callback);
		} else {
			for ( var i = 0, l = this.length; i < l; i++ ){
				var old = jQuery.data(this[i], "olddisplay");
				
				this[i].style.display = old || "";
				
				if ( jQuery.css(this[i], "display") === "none" ) {
					var tagName = this[i].tagName, display;
					
					if ( elemdisplay[ tagName ] ) {
						display = elemdisplay[ tagName ];
					} else {
						var elem = jQuery("<" + tagName + " />").appendTo("body");
						
						display = elem.css("display");
						if ( display === "none" )
							display = "block";
						
						elem.remove();
						
						elemdisplay[ tagName ] = display;
					}
					
					jQuery.data(this[i], "olddisplay", display);
				}
			}

			// Set the display of the elements in a second loop
			// to avoid the constant reflow
			for ( var i = 0, l = this.length; i < l; i++ ){
				this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
			}
			
			return this;
		}
	},

	hide: function(speed,callback){
		if ( speed ) {
			return this.animate( genFx("hide", 3), speed, callback);
		} else {
			for ( var i = 0, l = this.length; i < l; i++ ){
				var old = jQuery.data(this[i], "olddisplay");
				if ( !old && old !== "none" )
					jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
			}

			// Set the display of the elements in a second loop
			// to avoid the constant reflow
			for ( var i = 0, l = this.length; i < l; i++ ){
				this[i].style.display = "none";
			}

			return this;
		}
	},

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

	toggle: function( fn, fn2 ){
		var bool = typeof fn === "boolean";

		return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
			this._toggle.apply( this, arguments ) :
			fn == null || bool ?
				this.each(function(){
					var state = bool ? fn : jQuery(this).is(":hidden");
					jQuery(this)[ state ? "show" : "hide" ]();
				}) :
				this.animate(genFx("toggle", 3), fn, fn2);
	},

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

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

		return this[ optall.queue === false ? "each" : "queue" ](function(){
		
			var opt = jQuery.extend({}, optall), p,
				hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
				self = this;
	
			for ( p in prop ) {
				if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
					return opt.complete.call(this);

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

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

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

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

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

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

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

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

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

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

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

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

});

// 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" }
}, function( name, props ){
	jQuery.fn[ name ] = function( speed, callback ){
		return this.animate( props, speed, callback );
	};
});

jQuery.extend({

	speed: function(speed, easing, fn) {
		var opt = typeof speed === "object" ? 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 :
			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 );

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

	// Get the current size
	cur: function(force){
		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, force));
		return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
	},

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

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

		t.elem = this.elem;

		if ( t() && jQuery.timers.push(t) && !timerId ) {
			timerId = setInterval(function(){
				var timers = jQuery.timers;

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

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

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

		// Begin the animation
		// 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.attr( this.elem.style, this.prop );
		this.options.hide = true;

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

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

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

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

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

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

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

				// Hide the element if the "hide" operation was done
				if ( this.options.hide )
					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.attr(this.elem.style, 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
			this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
			this.now = this.start + ((this.end - this.start) * this.pos);

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

		return true;
	}

};

jQuery.extend( jQuery.fx, {
	speeds:{
		slow: 600,
 		fast: 200,
 		// Default speed
 		_default: 400
	},
	step: {

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

		_default: function(fx){
			if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
				fx.elem.style[ fx.prop ] = fx.now + fx.unit;
			else
				fx.elem[ fx.prop ] = fx.now;
		}
	}
});
if ( document.documentElement["getBoundingClientRect"] )
	jQuery.fn.offset = function() {
		if ( !this[0] ) return { top: 0, left: 0 };
		if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
		var box  = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
			clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
			top  = box.top  + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop  || body.scrollTop ) - clientTop,
			left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
		return { top: top, left: left };
	};
else 
	jQuery.fn.offset = function() {
		if ( !this[0] ) return { top: 0, left: 0 };
		if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
		jQuery.offset.initialized || jQuery.offset.initialize();

		var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
			doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
			body = doc.body, defaultView = doc.defaultView,
			prevComputedStyle = defaultView.getComputedStyle(elem, null),
			top = elem.offsetTop, left = elem.offsetLeft;

		while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
			computedStyle = defaultView.getComputedStyle(elem, null);
			top -= elem.scrollTop, left -= elem.scrollLeft;
			if ( elem === offsetParent ) {
				top += elem.offsetTop, left += elem.offsetLeft;
				if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
					top  += parseInt( computedStyle.borderTopWidth,  10) || 0,
					left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
				prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
			}
			if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
				top  += parseInt( computedStyle.borderTopWidth,  10) || 0,
				left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
			prevComputedStyle = computedStyle;
		}

		if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
			top  += body.offsetTop,
			left += body.offsetLeft;

		if ( 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() {
		if ( this.initialized ) return;
		var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
			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>';

		rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
		for ( prop in rules ) container.style[prop] = rules[prop];

		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);

		innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
		this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);

		body.style.marginTop = '1px';
		this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
		body.style.marginTop = bodyMarginTop;

		body.removeChild(container);
		this.initialized = true;
	},

	bodyOffset: function(body) {
		jQuery.offset.initialized || jQuery.offset.initialize();
		var top = body.offsetTop, left = body.offsetLeft;
		if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
			top  += parseInt( jQuery.curCSS(body, 'marginTop',  true), 10 ) || 0,
			left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
		return { top: top, left: left };
	}
};


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

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

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

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

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

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

		return results;
	},

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


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

		return val !== undefined ?

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

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

	var tl = i ? "Left"  : "Top",  // top or left
		br = i ? "Right" : "Bottom", // bottom or right
		lower = name.toLowerCase();

	// innerHeight and innerWidth
	jQuery.fn["inner" + name] = function(){
		return this[0] ?
			jQuery.css( this[0], lower, false, "padding" ) :
			null;
	};

	// outerHeight and outerWidth
	jQuery.fn["outer" + name] = function(margin) {
		return this[0] ?
			jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
			null;
	};
	
	var type = name.toLowerCase();

	jQuery.fn[ type ] = function( size ) {
		// Get window width or height
		return this[0] == window ?
			// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
			document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
			document.body[ "client" + name ] :

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

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

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

});
})();
/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 *  http://www.opensource.org/licenses/mit-license.php
 *  http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

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

        var sf = $.fn.superfish,
        c = sf.c,
        $arrow = $(['<span class="', c.arrowClass, '"> &#187;</span>'].join('')),
        over = function() {
            var $$ = $(this),
            menu = getMenu($$);
            clearTimeout(menu.sfTimer);
            $$.showSuperfishUl().siblings().hideSuperfishUl();
        },
        out = function() {
            var $$ = $(this),
            menu = getMenu($$),
            o = sf.op;
            clearTimeout(menu.sfTimer);
            menu.sfTimer = setTimeout(function() {
                o.retainPath = ($.inArray($$[0], o.$path) > -1);
                $$.hideSuperfishUl();
                if (o.$path.length && $$.parents(['li.', o.hoverClass].join('')).length < 1) {
                    over.call(o.$path);
                }
            },
            o.delay);
        },
        getMenu = function($menu) {
            var menu = $menu.parents(['ul.', c.menuClass, ':first'].join(''))[0];
            sf.op = sf.o[menu.serial];
            return menu;
        },
        addArrow = function($a) {
            $a.addClass(c.anchorClass).append($arrow.clone());
        };

        return this.each(function() {
            var s = this.serial = sf.o.length;
            var o = $.extend({},
            sf.defaults, op);
            o.$path = $('li.' + o.pathClass, this).slice(0, o.pathLevels).each(function() {
                $(this).addClass([o.hoverClass, c.bcClass].join(' '))
                .filter('li:has(ul)').removeClass(o.pathClass);
            });
            sf.o[s] = sf.op = o;

            $('li:has(ul)', this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent': 'hover'](over, out).each(function() {
                if (o.autoArrows) addArrow($('>a:first-child', this));
            })
            .not('.' + c.bcClass)
            .hideSuperfishUl();

            var $a = $('a', this);
            $a.each(function(i) {
                var $li = $a.eq(i).parents('li');
                $a.eq(i).focus(function() {
                    over.call($li);
                }).blur(function() {
                    out.call($li);
                });
            });
            o.onInit.call(this);

        }).each(function() {
            var menuClasses = [c.menuClass];
            if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
            $(this).addClass(menuClasses.join(' '));
        });
    };

    var sf = $.fn.superfish;
    sf.o = [];
    sf.op = {};
    sf.IE7fix = function() {
        var o = sf.op;
        if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined)
        this.toggleClass(sf.c.shadowClass + '-off');
    };
    sf.c = {
        bcClass: 'sf-breadcrumb',
        menuClass: 'sf-js-enabled',
        anchorClass: 'sf-with-ul',
        arrowClass: 'sf-sub-indicator',
        shadowClass: 'sf-shadow'
    };
    sf.defaults = {
        hoverClass: 'sfHover',
        pathClass: 'overideThisToUse',
        pathLevels: 1,
        delay: 800,
        animation: {
            opacity: 'show'
        },
        speed: 'normal',
        autoArrows: true,
        dropShadows: true,
        disableHI: false,
        // true disables hoverIntent detection
        onInit: function() {},
        // callback functions
        onBeforeShow: function() {},
        onShow: function() {},
        onHide: function() {}
    };
    $.fn.extend({
        hideSuperfishUl: function() {
            var o = sf.op,
            not = (o.retainPath === true) ? o.$path: '';
            o.retainPath = false;
            var $ul = $(['li.', o.hoverClass].join(''), this).add(this).not(not).removeClass(o.hoverClass)
            .find('>ul').hide().css('visibility', 'hidden');
            o.onHide.call($ul);
            return this;
        },
        showSuperfishUl: function() {
            var o = sf.op,
            sh = sf.c.shadowClass + '-off',
            $ul = this.addClass(o.hoverClass)
            .find('>ul:hidden').css('visibility', 'visible');
            sf.IE7fix.call($ul);
            o.onBeforeShow.call($ul);
            $ul.animate(o.animation, o.speed,
            function() {
                sf.IE7fix.call($ul);
                o.onShow.call($ul);
            });
            return this;
        }
    });

})(jQuery);/*
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
*	interval: 100,   // number = milliseconds of polling interval
*	over: showNav,  // function = onMouseOver callback (required)
*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
*	out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne
*/
(function($) {
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};
})(jQuery);/*
 * jQuery UI Effects 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/
 */
;jQuery.effects || (function($) {

$.effects = {
	version: "1.7.2",

	// Saves a set of properties in a data storage
	save: function(element, set) {
		for(var i=0; i < set.length; i++) {
			if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
		}
	},

	// Restores a set of previously saved properties from a data storage
	restore: function(element, set) {
		for(var i=0; i < set.length; i++) {
			if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
		}
	},

	setMode: function(el, mode) {
		if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
		return mode;
	},

	getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
		// this should be a little more flexible in the future to handle a string & hash
		var y, x;
		switch (origin[0]) {
			case 'top': y = 0; break;
			case 'middle': y = 0.5; break;
			case 'bottom': y = 1; break;
			default: y = origin[0] / original.height;
		};
		switch (origin[1]) {
			case 'left': x = 0; break;
			case 'center': x = 0.5; break;
			case 'right': x = 1; break;
			default: x = origin[1] / original.width;
		};
		return {x: x, y: y};
	},

	// Wraps the element around a wrapper that copies position properties
	createWrapper: function(element) {

		//if the element is already wrapped, return it
		if (element.parent().is('.ui-effects-wrapper'))
			return element.parent();

		//Cache width,height and float properties of the element, and create a wrapper around it
		var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') };
		element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
		var wrapper = element.parent();

		//Transfer the positioning of the element to the wrapper
		if (element.css('position') == 'static') {
			wrapper.css({ position: 'relative' });
			element.css({ position: 'relative'} );
		} else {
			var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto';
			var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto';
			wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show();
			element.css({position: 'relative', top: 0, left: 0 });
		}

		wrapper.css(props);
		return wrapper;
	},

	removeWrapper: function(element) {
		if (element.parent().is('.ui-effects-wrapper'))
			return element.parent().replaceWith(element);
		return element;
	},

	setTransition: function(element, list, factor, value) {
		value = value || {};
		$.each(list, function(i, x){
			unit = element.cssUnit(x);
			if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
		});
		return value;
	},

	//Base function to animate from one class to another in a seamless transition
	animateClass: function(value, duration, easing, callback) {

		var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
		var ea = (typeof easing == "string" ? easing : null);

		return this.each(function() {

			var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
			if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
			if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }

			//Let's get a style offset
			var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
			if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
			var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
			if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);

			// The main function to form the object for animation
			for(var n in newStyle) {
				if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
				&& n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
				&& newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
				&& (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
				&& (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
				) offset[n] = newStyle[n];
			}

			that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
				// Change style attribute back to original. For stupid IE, we need to clear the damn object.
				if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
				if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
				if(cb) cb.apply(this, arguments);
			});

		});
	}
};


function _normalizeArguments(a, m) {

	var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m;
	var speed = a[1] && a[1].constructor != Object ? a[1] : (o.duration ? o.duration : a[2]); //either comes from options.duration or the secon/third argument
		speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
	var callback = o.callback || ( $.isFunction(a[1]) && a[1] ) || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] );

	return [a[0], o, speed, callback];
	
}

//Extend the methods of jQuery
$.fn.extend({

	//Save old methods
	_show: $.fn.show,
	_hide: $.fn.hide,
	__toggle: $.fn.toggle,
	_addClass: $.fn.addClass,
	_removeClass: $.fn.removeClass,
	_toggleClass: $.fn.toggleClass,

	// New effect methods
	effect: function(fx, options, speed, callback) {
		return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null;
	},

	show: function() {
		if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
			return this._show.apply(this, arguments);
		else {
			return this.effect.apply(this, _normalizeArguments(arguments, 'show'));
		}
	},

	hide: function() {
		if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
			return this._hide.apply(this, arguments);
		else {
			return this.effect.apply(this, _normalizeArguments(arguments, 'hide'));
		}
	},

	toggle: function(){
		if(!arguments[0] ||
			(arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) ||
			($.isFunction(arguments[0]) || typeof arguments[0] == 'boolean')) {
			return this.__toggle.apply(this, arguments);
		} else {
			return this.effect.apply(this, _normalizeArguments(arguments, 'toggle'));
		}
	},

	addClass: function(classNames, speed, easing, callback) {
		return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
	},
	removeClass: function(classNames,speed,easing,callback) {
		return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
	},
	toggleClass: function(classNames,speed,easing,callback) {
		return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed);
	},
	morph: function(remove,add,speed,easing,callback) {
		return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
	},
	switchClass: function() {
		return this.morph.apply(this, arguments);
	},

	// helper functions
	cssUnit: function(key) {
		var style = this.css(key), val = [];
		$.each( ['em','px','%','pt'], function(i, unit){
			if(style.indexOf(unit) > 0)
				val = [parseFloat(style), unit];
		});
		return val;
	}
});

/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

// We override the animation for all of these color styles
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		$.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],10), 255), 0),
						Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0),
						Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 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],10), parseInt(result[2],10), parseInt(result[3],10)];

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

		// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
		if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
				return colors['transparent'];

		// Otherwise, we're most likely dealing with a named color
		return colors[$.trim(color).toLowerCase()];
}

function getColor(elem, attr) {
		var color;

		do {
				color = $.curCSS(elem, attr);

				// Keep going until we find an element that has color, or we hit the body
				if ( color != '' && color != 'transparent' || $.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],
	transparent: [255,255,255]
};

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 *
 * Open source under the BSD License.
 *
 * Copyright 2008 George McGinley Smith
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 *
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
$.easing.jswing = $.easing.swing;

$.extend($.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert($.easing.default);
		return $.easing[$.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 *
 * Open source under the BSD License.
 *
 * Copyright 2001 Robert Penner
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 *
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

})(jQuery);
/*
 * jQuery UI Effects Slide 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Slide
 *
 * Depends:
 *	effects.core.js
 */
(function($) {

$.effects.slide = function(o) {

	return this.queue(function() {

		// Create element
		var el = $(this), props = ['position','top','left'];

		// Set options
		var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
		var direction = o.options.direction || 'left'; // Default Direction

		// Adjust
		$.effects.save(el, props); el.show(); // Save & Show
		$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
		if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift

		// Animation
		var animation = {};
		animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;

		// Animate
		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
			if(mode == 'hide') el.hide(); // Hide
			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
			if(o.callback) o.callback.apply(this, arguments); // Callback
			el.dequeue();
		}});

	});

};

})(jQuery);
		/*
		 * jCarousel - Riding carousels with jQuery
		 *   http://sorgalla.com/jcarousel/
		 *
		 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
		 * Dual licensed under the MIT (MIT-LICENSE.txt)
		 * and GPL (GPL-LICENSE.txt) licenses.
		 *
		 * Built on top of the jQuery library
		 *   http://jquery.com
		 *
		 * Inspired by the "Carousel Component" by Bill Scott
		 *   http://billwscott.com/carousel/
		 */

		(function($) {
		    /*
		     * Creates a carousel for all matched elements.
		     *
		     * @example $("#mycarousel").jcarousel();
		     * @before <ul id="mycarousel" class="jcarousel-skin-name"><li>First item</li><li>Second item</li></ul>
		     * @result
		     *
		     * <div class="jcarousel-skin-name">
		     *   <div class="jcarousel-container">
		     *     <div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div>
		     *     <div class="jcarousel-next"></div>
		     *     <div class="jcarousel-clip">
		     *       <ul class="jcarousel-list">
		     *         <li class="jcarousel-item-1">First item</li>
		     *         <li class="jcarousel-item-2">Second item</li>
		     *       </ul>
		     *     </div>
		     *   </div>
		     * </div>
		     *
		     * @name jcarousel
		     * @type jQuery
		     * @param Hash o A set of key/value pairs to set as configuration properties.
		     * @cat Plugins/jCarousel
		     */
		    $.fn.jcarousel = function(o) {
		        return this.each(function() {
		            new $jc(this, o);
		        });
		    };

		    // Default configuration properties.
		    var defaults = {
		        vertical: false,
		        start: 1,
		        offset: 1,
		        size: null,
		        scroll: 3,
		        visible: null,
		        animation: 'normal',
		        easing: 'swing',
		        auto: 0,
		        wrap: null,
		        initCallback: null,
		        reloadCallback: null,
		        itemLoadCallback: null,
		        itemFirstInCallback: null,
		        itemFirstOutCallback: null,
		        itemLastInCallback: null,
		        itemLastOutCallback: null,
		        itemVisibleInCallback: null,
		        itemVisibleOutCallback: null,
		        buttonNextHTML: '<div></div>',
		        buttonPrevHTML: '<div></div>',
		        buttonNextEvent: 'click',
		        buttonPrevEvent: 'click',
		        buttonNextCallback: null,
		        buttonPrevCallback: null
		    };

		    /*
		     * The jCarousel object.
		     *
		     * @constructor
		     * @name $.jcarousel
		     * @param Object e The element to create the carousel for.
		     * @param Hash o A set of key/value pairs to set as configuration properties.
		     * @cat Plugins/jCarousel
		     */
		    $.jcarousel = function(e, o) {
		        this.options    = $.extend({}, defaults, o || {});

		        this.locked     = false;

		        this.container  = null;
		        this.clip       = null;
		        this.list       = null;
		        this.buttonNext = null;
		        this.buttonPrev = null;

		        this.wh = !this.options.vertical ? 'width' : 'height';
		        this.lt = !this.options.vertical ? 'left' : 'top';

		        // Extract skin class
		        var skin = '', split = e.className.split(' ');

		        for (var i = 0; i < split.length; i++) {
		            if (split[i].indexOf('jcarousel-skin') != -1) {
		                $(e).removeClass(split[i]);
		                var skin = split[i];
		                break;
		            }
		        }

		        if (e.nodeName == 'UL' || e.nodeName == 'OL') {
		            this.list = $(e);
		            this.container = this.list.parent();

		            if (this.container.hasClass('jcarousel-clip')) {
		                if (!this.container.parent().hasClass('jcarousel-container'))
		                    this.container = this.container.wrap('<div></div>');

		                this.container = this.container.parent();
		            } else if (!this.container.hasClass('jcarousel-container'))
		                this.container = this.list.wrap('<div></div>').parent();
		        } else {
		            this.container = $(e);
		            this.list = $(e).find('>ul,>ol,div>ul,div>ol');
		        }

		        if (skin != '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1)
		        	this.container.wrap('<div class=" '+ skin + '"></div>');

		        this.clip = this.list.parent();

		        if (!this.clip.length || !this.clip.hasClass('jcarousel-clip'))
		            this.clip = this.list.wrap('<div></div>').parent();

		        this.buttonPrev = $('.jcarousel-prev', this.container);

		        if (this.buttonPrev.size() == 0 && this.options.buttonPrevHTML != null)
		            this.buttonPrev = this.clip.before(this.options.buttonPrevHTML).prev();

		        this.buttonPrev.addClass(this.className('jcarousel-prev'));

		        this.buttonNext = $('.jcarousel-next', this.container);

		        if (this.buttonNext.size() == 0 && this.options.buttonNextHTML != null)
		            this.buttonNext = this.clip.before(this.options.buttonNextHTML).prev();

		        this.buttonNext.addClass(this.className('jcarousel-next'));

		        this.clip.addClass(this.className('jcarousel-clip'));
		        this.list.addClass(this.className('jcarousel-list'));
		        this.container.addClass(this.className('jcarousel-container'));

		        var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
		        var li = this.list.children('li');

		        var self = this;

		        if (li.size() > 0) {
		            var wh = 0, i = this.options.offset;
		            li.each(function() {
		                self.format(this, i++);
		                wh += self.dimension(this, di);
		            });

		            this.list.css(this.wh, wh + 'px');

		            // Only set if not explicitly passed as option
		            if (!o || o.size === undefined)
		                this.options.size = li.size();
		        }

		        // For whatever reason, .show() does not work in Safari...
		        this.container.css('display', 'block');
		        this.buttonNext.css('display', 'block');
		        this.buttonPrev.css('display', 'block');

		        this.funcNext   = function() { self.next(); };
		        this.funcPrev   = function() { self.prev(); };
		        this.funcResize = function() { self.reload(); };

		        if (this.options.initCallback != null)
		            this.options.initCallback(this, 'init');

		        if ($.browser.safari) {
		            this.buttons(false, false);
		            $(window).bind('load', function() { self.setup(); });
		        } else
		            this.setup();
		    };

		    // Create shortcut for internal use
		    var $jc = $.jcarousel;

		    $jc.fn = $jc.prototype = {
		        jcarousel: '0.2.3'
		    };

		    $jc.fn.extend = $jc.extend = $.extend;

		    $jc.fn.extend({
		        /*
		         * Setups the carousel.
		         *
		         * @name setup
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        setup: function() {
		            this.first     = null;
		            this.last      = null;
		            this.prevFirst = null;
		            this.prevLast  = null;
		            this.animating = false;
		            this.timer     = null;
		            this.tail      = null;
		            this.inTail    = false;

		            if (this.locked)
		                return;

		            this.list.css(this.lt, this.pos(this.options.offset) + 'px');
		            var p = this.pos(this.options.start);
		            this.prevFirst = this.prevLast = null;
		            this.animate(p, false);

		            //$(window).unbind('resize', this.funcResize).bind('resize', this.funcResize);
		        },

		        /*
		         * Clears the list and resets the carousel.
		         *
		         * @name reset
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        reset: function() {
		            this.list.empty();

		            this.list.css(this.lt, '0px');
		            this.list.css(this.wh, '10px');

		            if (this.options.initCallback != null)
		                this.options.initCallback(this, 'reset');

		            this.setup();
		        },

		        /*
		         * Reloads the carousel and adjusts positions.
		         *
		         * @name reload
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        reload: function() {
		            if (this.tail != null && this.inTail)
		                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);

		            this.tail   = null;
		            this.inTail = false;

		            if (this.options.reloadCallback != null)
		                this.options.reloadCallback(this);

		            if (this.options.visible != null) {
		                var self = this;
		                var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
		                $('li', this.list).each(function(i) {
		                    wh += self.dimension(this, di);
		                    if (i + 1 < self.first)
		                        lt = wh;
		                });

		                this.list.css(this.wh, wh + 'px');
		                this.list.css(this.lt, -lt + 'px');
		            }

		            this.scroll(this.first, false);
		        },

		        /*
		         * Locks the carousel.
		         *
		         * @name lock
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        lock: function() {
		            this.locked = true;
		            this.buttons();
		        },

		        /*
		         * Unlocks the carousel.
		         *
		         * @name unlock
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        unlock: function() {
		            this.locked = false;
		            this.buttons();
		        },

		        /*
		         * Sets the size of the carousel.
		         *
		         * @name size
		         * @type undefined
		         * @param Number s The size of the carousel.
		         * @cat Plugins/jCarousel
		         */
		        size: function(s) {
		            if (s != undefined) {
		                this.options.size = s;
		                if (!this.locked)
		                    this.buttons();
		            }

		            return this.options.size;
		        },

		        /*
		         * Checks whether a list element exists for the given index (or index range).
		         *
		         * @name get
		         * @type bool
		         * @param Number i The index of the (first) element.
		         * @param Number i2 The index of the last element.
		         * @cat Plugins/jCarousel
		         */
		        has: function(i, i2) {
		            if (i2 == undefined || !i2)
		                i2 = i;

		            if (this.options.size !== null && i2 > this.options.size)
		            	i2 = this.options.size;

		            for (var j = i; j <= i2; j++) {
		                var e = this.get(j);
		                if (!e.length || e.hasClass('jcarousel-item-placeholder'))
		                    return false;
		            }

		            return true;
		        },

		        /*
		         * Returns a jQuery object with list element for the given index.
		         *
		         * @name get
		         * @type jQuery
		         * @param Number i The index of the element.
		         * @cat Plugins/jCarousel
		         */
		        get: function(i) {
		            return $('.jcarousel-item-' + i, this.list);
		        },

		        /*
		         * Adds an element for the given index to the list.
		         * If the element already exists, it updates the inner html.
		         * Returns the created element as jQuery object.
		         *
		         * @name add
		         * @type jQuery
		         * @param Number i The index of the element.
		         * @param String s The innerHTML of the element.
		         * @cat Plugins/jCarousel
		         */
		        add: function(i, s) {
		            var e = this.get(i), old = 0, add = 0;

		            if (e.length == 0) {
		                var c, e = this.create(i), j = $jc.intval(i);
		                while (c = this.get(--j)) {
		                    if (j <= 0 || c.length) {
		                        j <= 0 ? this.list.prepend(e) : c.after(e);
		                        break;
		                    }
		                }
		            } else
		                old = this.dimension(e);

		            e.removeClass(this.className('jcarousel-item-placeholder'));
		            typeof s == 'string' ? e.html(s) : e.empty().append(s);

		            var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
		            var wh = this.dimension(e, di) - old;

		            if (i > 0 && i < this.first)
		                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px');

		            this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');

		            return e;
		        },

		        /*
		         * Removes an element for the given index from the list.
		         *
		         * @name remove
		         * @type undefined
		         * @param Number i The index of the element.
		         * @cat Plugins/jCarousel
		         */
		        remove: function(i) {
		            var e = this.get(i);

		            // Check if item exists and is not currently visible
		            if (!e.length || (i >= this.first && i <= this.last))
		                return;

		            var d = this.dimension(e);

		            if (i < this.first)
		                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');

		            e.remove();

		            this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
		        },

		        /*
		         * Moves the carousel forwards.
		         *
		         * @name next
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        next: function() {
		            this.stopAuto();

		            if (this.tail != null && !this.inTail)
		                this.scrollTail(false);
		            else
		                this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size != null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
		        },

		        /*
		         * Moves the carousel backwards.
		         *
		         * @name prev
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        prev: function() {
		            this.stopAuto();

		            if (this.tail != null && this.inTail)
		                this.scrollTail(true);
		            else
		                this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size != null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
		        },

		        /*
		         * Scrolls the tail of the carousel.
		         *
		         * @name scrollTail
		         * @type undefined
		         * @param Bool b Whether scroll the tail back or forward.
		         * @cat Plugins/jCarousel
		         */
		        scrollTail: function(b) {
		            if (this.locked || this.animating || !this.tail)
		                return;

		            var pos  = $jc.intval(this.list.css(this.lt));

		            !b ? pos -= this.tail : pos += this.tail;
		            this.inTail = !b;

		            // Save for callbacks
		            this.prevFirst = this.first;
		            this.prevLast  = this.last;

		            this.animate(pos);
		        },

		        /*
		         * Scrolls the carousel to a certain position.
		         *
		         * @name scroll
		         * @type undefined
		         * @param Number i The index of the element to scoll to.
		         * @param Bool a Flag indicating whether to perform animation.
		         * @cat Plugins/jCarousel
		         */
		        scroll: function(i, a) {
		            if (this.locked || this.animating)
		                return;

		            this.animate(this.pos(i), a);
		        },

		        /*
		         * Prepares the carousel and return the position for a certian index.
		         *
		         * @name pos
		         * @type Number
		         * @param Number i The index of the element to scoll to.
		         * @cat Plugins/jCarousel
		         */
		        pos: function(i) {
		            if (this.locked || this.animating)
		                return;

		            i = $jc.intval(i);
		            if (this.options.wrap != 'circular')
		                i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);

		            var back = this.first > i;
		            var pos  = $jc.intval(this.list.css(this.lt));

		            // Create placeholders, new list width/height
		            // and new list position
		            var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
		            var c = back ? this.get(f) : this.get(this.last);
		            var j = back ? f : f - 1;
		            var e = null, l = 0, p = false, d = 0;

		            while (back ? --j >= i : ++j < i) {
		                e = this.get(j);
		                p = !e.length;
		                if (e.length == 0) {
		                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
		                    c[back ? 'before' : 'after' ](e);
		                }

		                c = e;
		                d = this.dimension(e);

		                if (p)
		                    l += d;

		                if (this.first != null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size == null || j <= this.options.size))))
		                    pos = back ? pos + d : pos - d;
		            }

		            // Calculate visible items
		            var clipping = this.clipping();
		            var cache = [];
		            var visible = 0, j = i, v = 0;
		            var c = this.get(i - 1);

		            while (++visible) {
		                e = this.get(j);
		                p = !e.length;
		                if (e.length == 0) {
		                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
		                    // This should only happen on a next scroll
		                    c.length == 0 ? this.list.prepend(e) : c[back ? 'before' : 'after' ](e);
		                }

		                c = e;
		                var d = this.dimension(e);
		                if (d == 0) {
		                    //alert('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
		                    return 0;
		                }

		                if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size)
		                    cache.push(e);
		                else if (p)
		                    l += d;

		                v += d;

		                if (v >= clipping)
		                    break;

		                j++;
		            }

		             // Remove out-of-range placeholders
		            for (var x = 0; x < cache.length; x++)
		                cache[x].remove();

		            // Resize list
		            if (l > 0) {
		                this.list.css(this.wh, this.dimension(this.list) + l + 'px');

		                if (back) {
		                    pos -= l;
		                    this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
		                }
		            }

		            // Calculate first and last item
		            var last = i + visible - 1;
		            if (this.options.wrap != 'circular' && this.options.size && last > this.options.size)
		                last = this.options.size;

		            if (j > last) {
		                visible = 0, j = last, v = 0;
		                while (++visible) {
		                    var e = this.get(j--);
		                    if (!e.length)
		                        break;
		                    v += this.dimension(e);
		                    if (v >= clipping)
		                        break;
		                }
		            }

		            var first = last - visible + 1;
		            if (this.options.wrap != 'circular' && first < 1)
		                first = 1;

		            if (this.inTail && back) {
		                pos += this.tail;
		                this.inTail = false;
		            }

		            this.tail = null;
		            if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
		                var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
		                if ((v - m) > clipping)
		                    this.tail = v - clipping - m;
		            }

		            // Adjust position
		            while (i-- > first)
		                pos += this.dimension(this.get(i));

		            // Save visible item range
		            this.prevFirst = this.first;
		            this.prevLast  = this.last;
		            this.first     = first;
		            this.last      = last;

		            return pos;
		        },

		        /*
		         * Animates the carousel to a certain position.
		         *
		         * @name animate
		         * @type undefined
		         * @param mixed p Position to scroll to.
		         * @param Bool a Flag indicating whether to perform animation.
		         * @cat Plugins/jCarousel
		         */
		        animate: function(p, a) {
		            if (this.locked || this.animating)
		                return;

		            this.animating = true;

		            var self = this;
		            var scrolled = function() {
		                self.animating = false;

		                if (p == 0)
		                    self.list.css(self.lt,  0);

		                if (self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size == null || self.last < self.options.size)
		                    self.startAuto();

		                self.buttons();
		                self.notify('onAfterAnimation');
		            };

		            this.notify('onBeforeAnimation');

		            // Animate
		            if (!this.options.animation || a == false) {
		                this.list.css(this.lt, p + 'px');
		                scrolled();
		            } else {
		                var o = !this.options.vertical ? {'left': p} : {'top': p};
		                this.list.animate(o, this.options.animation, this.options.easing, scrolled);
		            }
		        },

		        /*
		         * Starts autoscrolling.
		         *
		         * @name auto
		         * @type undefined
		         * @param Number s Seconds to periodically autoscroll the content.
		         * @cat Plugins/jCarousel
		         */
		        startAuto: function(s) {
		            if (s != undefined)
		                this.options.auto = s;

		            if (this.options.auto == 0)
		                return this.stopAuto();

		            if (this.timer != null)
		                return;

		            var self = this;
		            this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
		        },

		        /*
		         * Stops autoscrolling.
		         *
		         * @name stopAuto
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        stopAuto: function() {
		            if (this.timer == null)
		                return;

		            clearTimeout(this.timer);
		            this.timer = null;
		        },

		        /*
		         * Sets the states of the prev/next buttons.
		         *
		         * @name buttons
		         * @type undefined
		         * @cat Plugins/jCarousel
		         */
		        buttons: function(n, p) {
		            if (n == undefined || n == null) {
		                var n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size == null || this.last < this.options.size);
		                if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size != null && this.last >= this.options.size)
		                    n = this.tail != null && !this.inTail;
		            }

		            if (p == undefined || p == null) {
		                var p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
		                if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size != null && this.first == 1)
		                    p = this.tail != null && this.inTail;
		            }

		            var self = this;

		            this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent, this.funcNext)[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
		            this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent, this.funcPrev)[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);

		            if (this.buttonNext.length > 0 && (this.buttonNext[0].jcarouselstate == undefined || this.buttonNext[0].jcarouselstate != n) && this.options.buttonNextCallback != null) {
		                this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); });
		                this.buttonNext[0].jcarouselstate = n;
		            }

		            if (this.buttonPrev.length > 0 && (this.buttonPrev[0].jcarouselstate == undefined || this.buttonPrev[0].jcarouselstate != p) && this.options.buttonPrevCallback != null) {
		                this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); });
		                this.buttonPrev[0].jcarouselstate = p;
		            }
		        },

		        notify: function(evt) {
		            var state = this.prevFirst == null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');

		            // Load items
		            this.callback('itemLoadCallback', evt, state);

		            if (this.prevFirst !== this.first) {
		                this.callback('itemFirstInCallback', evt, state, this.first);
		                this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
		            }

		            if (this.prevLast !== this.last) {
		                this.callback('itemLastInCallback', evt, state, this.last);
		                this.callback('itemLastOutCallback', evt, state, this.prevLast);
		            }

		            this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
		            this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
		        },

		        callback: function(cb, evt, state, i1, i2, i3, i4) {
		            if (this.options[cb] == undefined || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation'))
		                return;

		            var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];

		            if (!$.isFunction(callback))
		                return;

		            var self = this;

		            if (i1 === undefined)
		                callback(self, state, evt);
		            else if (i2 === undefined)
		                this.get(i1).each(function() { callback(self, this, i1, state, evt); });
		            else {
		                for (var i = i1; i <= i2; i++)
		                    if (i !== null && !(i >= i3 && i <= i4))
		                        this.get(i).each(function() { callback(self, this, i, state, evt); });
		            }
		        },

		        create: function(i) {
		            return this.format('<li></li>', i);
		        },

		        format: function(e, i) {
		            var $e = $(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i));
		            $e.attr('jcarouselindex', i);
		            return $e;
		        },

		        className: function(c) {
		            return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
		        },

		        dimension: function(e, d) {
		            var el = e.jquery != undefined ? e[0] : e;

		            var old = !this.options.vertical ?
		                el.offsetWidth + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
		                el.offsetHeight + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');

		            if (d == undefined || old == d)
		                return old;

		            var w = !this.options.vertical ?
		                d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
		                d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');

		            $(el).css(this.wh, w + 'px');

		            return this.dimension(el);
		        },

		        clipping: function() {
		            return !this.options.vertical ?
		                this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
		                this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
		        },

		        index: function(i, s) {
		            if (s == undefined)
		                s = this.options.size;

		            return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
		        }
		    });

		    $jc.extend({
		        /*
		         * Gets/Sets the global default configuration properties.
		         *
		         * @name defaults
		         * @descr Gets/Sets the global default configuration properties.
		         * @type Hash
		         * @param Hash d A set of key/value pairs to set as configuration properties.
		         * @cat Plugins/jCarousel
		         */
		        defaults: function(d) {
		            return $.extend(defaults, d || {});
		        },

		        margin: function(e, p) {
		            if (!e)
		                return 0;

		            var el = e.jquery != undefined ? e[0] : e;

		            if (p == 'marginRight' && $.browser.safari) {
		                var old = {'display': 'block', 'float': 'none', 'width': 'auto'}, oWidth, oWidth2;

		                $.swap(el, old, function() { oWidth = el.offsetWidth; });

		                old['marginRight'] = 0;
		                $.swap(el, old, function() { oWidth2 = el.offsetWidth; });

		                return oWidth2 - oWidth;
		            }

		            return $jc.intval($.css(el, p));
		        },

		        intval: function(v) {
		            v = parseInt(v);
		            return isNaN(v) ? 0 : v;
		        }
		    });

		})(jQuery);
// jQuery Cycle Plugin (withOUT Transition Definitions)
// Examples and documentation at: http://jquery.malsup.com/cycle/
// Copyright (c) 2007-2009 M. Alsup
// Version: 2.72 (09-SEP-2009)
// Dual licensed under the MIT and GPL licenses:
// http://www.opensource.org/licenses/mit-license.php
// http://www.gnu.org/licenses/gpl.html
// Requires: jQuery v1.2.6 or later
// 
// Originally based on the work of:
//  1) Matt Oakes
//  2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/)
//  3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/)

;(function($) {

var ver = '2.72';

// if $.support is not defined (pre jQuery 1.3) add what I need
if ($.support == undefined) {
	$.support = {
		opacity: !($.browser.msie)
	};
}

function debug(s) {
	if ($.fn.cycle.debug)
		log(s);
}		
function log() {
	if (window.console && window.console.log)
		window.console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
	//$('body').append('<div>'+Array.prototype.join.call(arguments,' ')+'</div>');
};

// the options arg can be...
//   a number  - indicates an immediate transition should occur to the given slide index
//   a string  - 'stop', 'pause', 'resume', or the name of a transition effect (ie, 'fade', 'zoom', etc)
//   an object - properties to control the slideshow
//
// the arg2 arg can be...
//   the name of an fx (only used in conjunction with a numeric value for 'options')
//   the value true (only used in conjunction with a options == 'resume') and indicates
//     that the resume should occur immediately (not wait for next timeout)

$.fn.cycle = function(options, arg2) {
	var o = { s: this.selector, c: this.context };

    // in 1.3+ we can fix mistakes with the ready state
	if (this.length === 0 && options != 'stop') {
        if (!$.isReady && o.s) {
            log('DOM not ready, queuing slideshow');
            $(function() {
                $(o.s,o.c).cycle(options,arg2);
            });
            return this;
        }
		// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
		log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
		return this;
	}

    // iterate the matched nodeset
	return this.each(function() {
        var opts = handleArguments(this, options, arg2);
        if (opts === false)
            return;

		// stop existing slideshow for this container (if there is one)
		if (this.cycleTimeout)
            clearTimeout(this.cycleTimeout);
		this.cycleTimeout = this.cyclePause = 0;

		var $cont = $(this);
		var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
		var els = $slides.get();
		if (els.length < 2) {
			log('terminating; too few slides: ' + els.length);
			return;
		}

        var opts2 = buildOptions($cont, $slides, els, opts, o);
        if (opts2 === false)
            return;

		var startTime = opts2.continuous ? 10 : getTimeout(opts2.currSlide, opts2.nextSlide, opts2, !opts2.rev);

        // if it's an auto slideshow, kick it off
		if (startTime) {
			startTime += (opts2.delay || 0);
			if (startTime < 10)
				startTime = 10;
			debug('first timeout: ' + startTime);
			this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts2.rev)}, startTime);
		}
	});
};

// process the args that were passed to the plugin fn
function handleArguments(cont, options, arg2) {
	if (cont.cycleStop == undefined)
		cont.cycleStop = 0;
	if (options === undefined || options === null)
		options = {};
	if (options.constructor == String) {
		switch(options) {
		case 'stop':
			cont.cycleStop++; // callbacks look for change
			if (cont.cycleTimeout)
                clearTimeout(cont.cycleTimeout);
			cont.cycleTimeout = 0;
			$(cont).removeData('cycle.opts');
			return false;
		case 'pause':
			cont.cyclePause = 1;
			return false;
		case 'resume':
			cont.cyclePause = 0;
			if (arg2 === true) { // resume now!
				options = $(cont).data('cycle.opts');
				if (!options) {
					log('options not found, can not resume');
					return false;
				}
				if (cont.cycleTimeout) {
					clearTimeout(cont.cycleTimeout);
					cont.cycleTimeout = 0;
				}
				go(options.elements, options, 1, 1);
			}
			return false;
		case 'prev':
		case 'next':
			var opts = $(cont).data('cycle.opts');
			if (!opts) {
				log('options not found, "prev/next" ignored');
				return false;
			}
			$.fn.cycle[options](opts);
			return false;
		default:
			options = { fx: options };
		};
		return options;
	}
	else if (options.constructor == Number) {
		// go to the requested slide
		var num = options;
		options = $(cont).data('cycle.opts');
		if (!options) {
			log('options not found, can not advance slide');
			return false;
		}
		if (num < 0 || num >= options.elements.length) {
			log('invalid slide index: ' + num);
			return false;
		}
		options.nextSlide = num;
		if (cont.cycleTimeout) {
			clearTimeout(cont.cycleTimeout);
			cont.cycleTimeout = 0;
		}
        if (typeof arg2 == 'string')
            options.oneTimeFx = arg2;
		go(options.elements, options, 1, num >= options.currSlide);
		return false;
	}
    return options;
};

function removeFilter(el, opts) {
	if (!$.support.opacity && opts.cleartype && el.style.filter) {
		try { el.style.removeAttribute('filter'); }
		catch(smother) {} // handle old opera versions
	}
};

// one-time initialization
function buildOptions($cont, $slides, els, options, o) {
	// support metadata plugin (v1.0 and v2.0)
	var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
	if (opts.autostop)
		opts.countdown = opts.autostopCount || els.length;

    var cont = $cont[0];
	$cont.data('cycle.opts', opts);
	opts.$cont = $cont;
	opts.stopCount = cont.cycleStop;
	opts.elements = els;
	opts.before = opts.before ? [opts.before] : [];
	opts.after = opts.after ? [opts.after] : [];
	opts.after.unshift(function(){ opts.busy=0; });

    // push some after callbacks
	if (!$.support.opacity && opts.cleartype)
		opts.after.push(function() { removeFilter(this, opts); });
	if (opts.continuous)
		opts.after.push(function() { go(els,opts,0,!opts.rev); });

    saveOriginalOpts(opts);

	// clearType corrections
	if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
		clearTypeFix($slides);

    // container requires non-static position so that slides can be position within
	if ($cont.css('position') == 'static')
		$cont.css('position', 'relative');
	if (opts.width)
		$cont.width(opts.width);
	if (opts.height && opts.height != 'auto')
		$cont.height(opts.height);

	if (opts.startingSlide)
        opts.startingSlide = parseInt(opts.startingSlide);

    // if random, mix up the slide array
	if (opts.random) {
		// do nothing. random not supported
	}
	else if (opts.startingSlide >= els.length)
		opts.startingSlide = 0; // catch bogus input
	opts.currSlide = opts.startingSlide = opts.startingSlide || 0;
	var first = opts.startingSlide;

    // set position and zIndex on all the slides
	$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
		var z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
		$(this).css('z-index', z)
	});

    // make sure first slide is visible
	$(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
	removeFilter(els[first], opts);

    // stretch slides
	if (opts.fit && opts.width)
		$slides.width(opts.width);
	if (opts.fit && opts.height && opts.height != 'auto')
		$slides.height(opts.height);

    // stretch container
	var reshape = opts.containerResize && !$cont.innerHeight();
	if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
		var maxw = 0, maxh = 0;
		for(var j=0; j < els.length; j++) {
			var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
            if (!w) w = e.offsetWidth;
            if (!h) h = e.offsetHeight;
			maxw = w > maxw ? w : maxw;
			maxh = h > maxh ? h : maxh;
		}
        if (maxw > 0 && maxh > 0)
		    $cont.css({width:maxw+'px',height:maxh+'px'});
	}

	if (opts.pause)
		$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});

    if (supportMultiTransitions(opts) === false)
		return false;

	// apparently a lot of people use image slideshows without height/width attributes on the images.
	// Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
	var requeue = false;
	options.requeueAttempts = options.requeueAttempts || 0;
	$slides.each(function() {
        // try to get height/width of each slide
		var $el = $(this);
	    this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
		this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();

		if ( $el.is('img') ) {
			// sigh..  sniffing, hacking, shrugging...  this crappy hack tries to account for what browsers do when
			// an image is being downloaded and the markup did not include sizing info (height/width attributes);
			// there seems to be some "default" sizes used in this situation
			var loadingIE    = ($.browser.msie  && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
			var loadingFF    = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
			var loadingOp    = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
			var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
			// don't requeue for images that are still loading but have a valid size
			if (loadingIE || loadingFF || loadingOp || loadingOther) {
				if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
					log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
					setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
					requeue = true;
					return false; // break each loop
				}
				else {
					log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
				}
			}
		}
		return true;
	});

	if (requeue)
		return false;

	opts.cssBefore = opts.cssBefore || {};
	opts.animIn = opts.animIn || {};
	opts.animOut = opts.animOut || {};

	$slides.not(':eq('+first+')').css(opts.cssBefore);
	if (opts.cssFirst)
		$($slides[first]).css(opts.cssFirst);

	if (opts.timeout) {
		opts.timeout = parseInt(opts.timeout);
		// ensure that timeout and speed settings are sane
		if (opts.speed.constructor == String)
			opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed);
		if (!opts.sync)
			opts.speed = opts.speed / 2;
		while((opts.timeout - opts.speed) < 250) // sanitize timeout
			opts.timeout += opts.speed;
	}
	if (opts.easing)
		opts.easeIn = opts.easeOut = opts.easing;
	if (!opts.speedIn)
		opts.speedIn = opts.speed;
	if (!opts.speedOut)
		opts.speedOut = opts.speed;

	opts.slideCount = els.length;
	opts.currSlide = opts.lastSlide = first;
	if (opts.random) {
		opts.nextSlide = opts.currSlide;
		if (++opts.randomIndex == els.length)
			opts.randomIndex = 0;
		opts.nextSlide = opts.randomMap[opts.randomIndex];
	}
	else
		opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;

	// run transition init fn
	if (!opts.multiFx) {
		var init = $.fn.cycle.transitions[opts.fx];
		if ($.isFunction(init))
			init($cont, $slides, opts);
		else if (opts.fx != 'custom' && !opts.multiFx) {
			log('unknown transition: ' + opts.fx,'; slideshow terminating');
			return false;
		}
	}

	// fire artificial events
	var e0 = $slides[first];
	if (opts.before.length)
		opts.before[0].apply(e0, [e0, e0, opts, true]);
	if (opts.after.length > 1)
		opts.after[1].apply(e0, [e0, e0, opts, true]);

	if (opts.next)
		$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1)});
	if (opts.prev)
		$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1)});
	if (opts.pager)
		buildPager(els,opts);

    exposeAddSlide(opts, els);

    return opts;
};

// save off original opts so we can restore after clearing state
function saveOriginalOpts(opts) {
    opts.original = { before: [], after: [] };
    opts.original.cssBefore = $.extend({}, opts.cssBefore);
    opts.original.cssAfter  = $.extend({}, opts.cssAfter);
    opts.original.animIn    = $.extend({}, opts.animIn);
    opts.original.animOut   = $.extend({}, opts.animOut);
	$.each(opts.before, function() { opts.original.before.push(this); });
	$.each(opts.after,  function() { opts.original.after.push(this); });
};

function supportMultiTransitions(opts) {
    var i, tx, txs = $.fn.cycle.transitions;
	// look for multiple effects
	if (opts.fx.indexOf(',') > 0) {
		opts.multiFx = true;
		opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
		// discard any bogus effect names
		for (i=0; i < opts.fxs.length; i++) {
			var fx = opts.fxs[i];
			tx = txs[fx];
			if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
				log('discarding unknown transition: ',fx);
				opts.fxs.splice(i,1);
				i--;
			}
		}
		// if we have an empty list then we threw everything away!
		if (!opts.fxs.length) {
			log('No valid transitions named; slideshow terminating.');
			return false;
		}
	}
	else if (opts.fx == 'all') {  // auto-gen the list of transitions
		opts.multiFx = true;
		opts.fxs = [];
		for (p in txs) {
			tx = txs[p];
			if (txs.hasOwnProperty(p) && $.isFunction(tx))
				opts.fxs.push(p);
		}
	}
	
	// random effects not supported with multiple transitions

	return true;
};

// provide a mechanism for adding slides after the slideshow has started
function exposeAddSlide(opts, els) {
	opts.addSlide = function(newSlide, prepend) {
		var $s = $(newSlide), s = $s[0];
		if (!opts.autostopCount)
			opts.countdown++;
		els[prepend?'unshift':'push'](s);
		if (opts.els)
			opts.els[prepend?'unshift':'push'](s); // shuffle needs this
		opts.slideCount = els.length;

		$s.css('position','absolute');
		$s[prepend?'prependTo':'appendTo'](opts.$cont);

		if (prepend) {
			opts.currSlide++;
			opts.nextSlide++;
		}

		if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
			clearTypeFix($s);

		if (opts.fit && opts.width)
			$s.width(opts.width);
		if (opts.fit && opts.height && opts.height != 'auto')
			$slides.height(opts.height);
		s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
		s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();

		$s.css(opts.cssBefore);

		if (opts.pager)
			$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);

		if ($.isFunction(opts.onAddSlide))
			opts.onAddSlide($s);
		else
			$s.hide(); // default behavior
	};
}

// reset internal state; we do this on every pass in order to support multiple effects
$.fn.cycle.resetState = function(opts, fx) {
    fx = fx || opts.fx;
	opts.before = []; opts.after = [];
	opts.cssBefore = $.extend({}, opts.original.cssBefore);
	opts.cssAfter  = $.extend({}, opts.original.cssAfter);
	opts.animIn    = $.extend({}, opts.original.animIn);
	opts.animOut   = $.extend({}, opts.original.animOut);
	opts.fxFn = null;
	$.each(opts.original.before, function() { opts.before.push(this); });
	$.each(opts.original.after,  function() { opts.after.push(this); });

	// re-init
	var init = $.fn.cycle.transitions[fx];
	if ($.isFunction(init))
		init(opts.$cont, $(opts.elements), opts);
};

// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
function go(els, opts, manual, fwd) {
    // opts.busy is true if we're in the middle of an animation
	if (manual && opts.busy && opts.manualTrump) {
        // let manual transitions requests trump active ones
		$(els).stop(true,true);
		opts.busy = false;
	}
    // don't begin another timeout-based transition if there is one active
	if (opts.busy)
        return;

	var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];

    // stop cycling if we have an outstanding stop request
	if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
		return;

    // check to see if we should stop cycling based on autostop options
	if (!manual && !p.cyclePause &&
		((opts.autostop && (--opts.countdown <= 0)) ||
		(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
		if (opts.end)
			opts.end(opts);
		return;
	}

    // if slideshow is paused, only transition on a manual trigger
	if (manual || !p.cyclePause) {
        var fx = opts.fx;
		// keep trying to get the slide size if we don't have it yet
		curr.cycleH = curr.cycleH || $(curr).height();
		curr.cycleW = curr.cycleW || $(curr).width();
		next.cycleH = next.cycleH || $(next).height();
		next.cycleW = next.cycleW || $(next).width();

		// support multiple transition types
		if (opts.multiFx) {
			if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length)
				opts.lastFx = 0;
			fx = opts.fxs[opts.lastFx];
			opts.currFx = fx;
		}

        // one-time fx overrides apply to:  $('div').cycle(3,'zoom');
        if (opts.oneTimeFx) {
            fx = opts.oneTimeFx;
            opts.oneTimeFx = null;
        }

        $.fn.cycle.resetState(opts, fx);

        // run the before callbacks
		if (opts.before.length)
			$.each(opts.before, function(i,o) {
				if (p.cycleStop != opts.stopCount) return;
				o.apply(next, [curr, next, opts, fwd]);
			});

        // stage the after callacks
		var after = function() {
			$.each(opts.after, function(i,o) {
				if (p.cycleStop != opts.stopCount) return;
				o.apply(next, [curr, next, opts, fwd]);
			});
		};

		if (opts.nextSlide != opts.currSlide) {
            // get ready to perform the transition
			opts.busy = 1;
			if (opts.fxFn) // fx function provided?
				opts.fxFn(curr, next, opts, after, fwd);
			else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
				$.fn.cycle[opts.fx](curr, next, opts, after);
			else
				$.fn.cycle.custom(curr, next, opts, after, manual && opts.fastOnEvent);
		}

        // calculate the next slide
		opts.lastSlide = opts.currSlide;
		if (opts.random) {
			opts.currSlide = opts.nextSlide;
			if (++opts.randomIndex == els.length)
				opts.randomIndex = 0;
			opts.nextSlide = opts.randomMap[opts.randomIndex];
		}
		else { // sequence
			var roll = (opts.nextSlide + 1) == els.length;
			opts.nextSlide = roll ? 0 : opts.nextSlide+1;
			opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
		}

		if (opts.pager)
			$.fn.cycle.updateActivePagerLink(opts.pager, opts.currSlide);
	}

    // stage the next transtion
    var ms = 0;
	if (opts.timeout && !opts.continuous)
        ms = getTimeout(curr, next, opts, fwd);
    else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
        ms = 10;
    if (ms > 0)
        p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.rev) }, ms);
};

// invoked after transition
$.fn.cycle.updateActivePagerLink = function(pager, currSlide) {
	$(pager).find('a').removeClass('activeSlide').filter('a:eq('+currSlide+')').addClass('activeSlide');
};

// calculate timeout value for current transition
function getTimeout(curr, next, opts, fwd) {
	if (opts.timeoutFn) {
        // call user provided calc fn
		var t = opts.timeoutFn(curr,next,opts,fwd);
		while ((t - opts.speed) < 250) // sanitize timeout
			t += opts.speed;
		debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
		if (t !== false)
			return t;
	}
	return opts.timeout;
};

// expose next/prev function, caller must pass in state
$.fn.cycle.next = function(opts) { advance(opts, opts.rev?-1:1); };
$.fn.cycle.prev = function(opts) { advance(opts, opts.rev?1:-1);};

// advance slide forward or back
function advance(opts, val) {
    var els = opts.elements;
	var p = opts.$cont[0], timeout = p.cycleTimeout;
	if (timeout) {
		clearTimeout(timeout);
		p.cycleTimeout = 0;
	}
	if (opts.random && val < 0) {
		// move back to the previously display slide
		opts.randomIndex--;
		if (--opts.randomIndex == -2)
			opts.randomIndex = els.length-2;
		else if (opts.randomIndex == -1)
			opts.randomIndex = els.length-1;
		opts.nextSlide = opts.randomMap[opts.randomIndex];
	}
	else if (opts.random) {
		if (++opts.randomIndex == els.length)
			opts.randomIndex = 0;
		opts.nextSlide = opts.randomMap[opts.randomIndex];
	}
	else {
		opts.nextSlide = opts.currSlide + val;
		if (opts.nextSlide < 0) {
			if (opts.nowrap) return false;
			opts.nextSlide = els.length - 1;
		}
		else if (opts.nextSlide >= els.length) {
			if (opts.nowrap) return false;
			opts.nextSlide = 0;
		}
	}

	if ($.isFunction(opts.prevNextClick))
		opts.prevNextClick(val > 0, opts.nextSlide, els[opts.nextSlide]);
	go(els, opts, 1, val>=0);
	return false;
};

function buildPager(els, opts) {
	var $p = $(opts.pager);
	$.each(els, function(i,o) {
		$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
	});
   $.fn.cycle.updateActivePagerLink(opts.pager, opts.startingSlide);
};

$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
	var a;
	if ($.isFunction(opts.pagerAnchorBuilder))
		a = opts.pagerAnchorBuilder(i,el);
	else
		a = '<a href="#">'+(i+1)+'</a>';
		
	if (!a)
		return;
	var $a = $(a);
	// don't reparent if anchor is in the dom
	if ($a.parents('body').length === 0) {
		var arr = [];
		if ($p.length > 1) {
			$p.each(function() {
				var $clone = $a.clone(true);
				$(this).append($clone);
				arr.push($clone);
			});
			$a = $(arr);
		}
		else {
			$a.appendTo($p);
		}
	}

	$a.bind(opts.pagerEvent, function(e) {
		e.preventDefault();
		opts.nextSlide = i;
		var p = opts.$cont[0], timeout = p.cycleTimeout;
		if (timeout) {
			clearTimeout(timeout);
			p.cycleTimeout = 0;
		}
		if ($.isFunction(opts.pagerClick))
			opts.pagerClick(opts.nextSlide, els[opts.nextSlide]);
		go(els,opts,1,opts.currSlide < i); // trigger the trans
		return false;
	});
	
	if (opts.pagerEvent != 'click')
		$a.click(function(){return false;}); // supress click
	
	if (opts.pauseOnPagerHover)
		$a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; } );
};

// helper fn to calculate the number of slides between the current and the next
$.fn.cycle.hopsFromLast = function(opts, fwd) {
	var hops, l = opts.lastSlide, c = opts.currSlide;
	if (fwd)
		hops = c > l ? c - l : opts.slideCount - l;
	else
		hops = c < l ? l - c : l + opts.slideCount - c;
	return hops;
};

// fix clearType problems in ie6 by setting an explicit bg color
// (otherwise text slides look horrible during a fade transition)
function clearTypeFix($slides) {
	function hex(s) {
		s = parseInt(s).toString(16);
		return s.length < 2 ? '0'+s : s;
	};
	function getBg(e) {
		for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
			var v = $.css(e,'background-color');
			if (v.indexOf('rgb') >= 0 ) {
				var rgb = v.match(/\d+/g);
				return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
			}
			if (v && v != 'transparent')
				return v;
		}
		return '#ffffff';
	};
	$slides.each(function() { $(this).css('background-color', getBg(this)); });
};

// reset common props before the next transition
$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
	$(opts.elements).not(curr).hide();
	opts.cssBefore.opacity = 1;
	opts.cssBefore.display = 'block';
	if (w !== false && next.cycleW > 0)
		opts.cssBefore.width = next.cycleW;
	if (h !== false && next.cycleH > 0)
		opts.cssBefore.height = next.cycleH;
	opts.cssAfter = opts.cssAfter || {};
	opts.cssAfter.display = 'none';
	$(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
	$(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
};

// the actual fn for effecting a transition
$.fn.cycle.custom = function(curr, next, opts, cb, speedOverride) {
	var $l = $(curr), $n = $(next);
	var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
	$n.css(opts.cssBefore);
	if (speedOverride) {
		if (typeof speedOverride == 'number')
			speedIn = speedOut = speedOverride;
		else
			speedIn = speedOut = 1;
		easeIn = easeOut = null;
	}
	var fn = function() {$n.animate(opts.animIn, speedIn, easeIn, cb)};
	$l.animate(opts.animOut, speedOut, easeOut, function() {
		if (opts.cssAfter) $l.css(opts.cssAfter);
		if (!opts.sync) fn();
	});
	if (opts.sync) fn();
};

// transition definitions - only fade is defined here, transition pack defines the rest
$.fn.cycle.transitions = {
	fade: function($cont, $slides, opts) {
		$slides.not(':eq('+opts.currSlide+')').css('opacity',0);
		opts.before.push(function(curr,next,opts) {
			$.fn.cycle.commonReset(curr,next,opts);
			opts.cssBefore.opacity = 0;
		});
		opts.animIn	   = { opacity: 1 };
		opts.animOut   = { opacity: 0 };
		opts.cssBefore = { top: 0, left: 0 };
	}
};

$.fn.cycle.ver = function() { return ver; };

// override these globally if you like (they are all optional)
$.fn.cycle.defaults = {
	fx:			  'fade', // name of transition effect (or comma separated names, ex: fade,scrollUp,shuffle)
	timeout:	   4000,  // milliseconds between slide transitions (0 to disable auto advance)
	timeoutFn:     null,  // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
	continuous:	   0,	  // true to start next transition immediately after current one completes
	speed:		   1000,  // speed of the transition (any valid fx speed value)
	speedIn:	   null,  // speed of the 'in' transition
	speedOut:	   null,  // speed of the 'out' transition
	next:		   null,  // selector for element to use as click trigger for next slide
	prev:		   null,  // selector for element to use as click trigger for previous slide
	prevNextClick: null,  // callback fn for prev/next clicks:	function(isNext, zeroBasedSlideIndex, slideElement)
	prevNextEvent:'click',// event which drives the manual transition to the previous or next slide
	pager:		   null,  // selector for element to use as pager container
	pagerClick:	   null,  // callback fn for pager clicks:	function(zeroBasedSlideIndex, slideElement)
	pagerEvent:	  'click', // name of event which drives the pager navigation
	pagerAnchorBuilder: null, // callback fn for building anchor links:  function(index, DOMelement)
	before:		   null,  // transition callback (scope set to element to be shown):     function(currSlideElement, nextSlideElement, options, forwardFlag)
	after:		   null,  // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
	end:		   null,  // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
	easing:		   null,  // easing method for both in and out transitions
	easeIn:		   null,  // easing for "in" transition
	easeOut:	   null,  // easing for "out" transition
	shuffle:	   null,  // coords for shuffle animation, ex: { top:15, left: 200 }
	animIn:		   null,  // properties that define how the slide animates in
	animOut:	   null,  // properties that define how the slide animates out
	cssBefore:	   null,  // properties that define the initial state of the slide before transitioning in
	cssAfter:	   null,  // properties that defined the state of the slide after transitioning out
	fxFn:		   null,  // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
	height:		  'auto', // container height
	startingSlide: 0,	  // zero-based index of the first slide to be displayed
	sync:		   1,	  // true if in/out transitions should occur simultaneously
	random:		   0,	  // true for random, false for sequence (not applicable to shuffle fx)
	fit:		   0,	  // force slides to fit container
	containerResize: 1,	  // resize container to fit largest slide
	pause:		   0,	  // true to enable "pause on hover"
	pauseOnPagerHover: 0, // true to pause when hovering over pager link
	autostop:	   0,	  // true to end slideshow after X transitions (where X == slide count)
	autostopCount: 0,	  // number of transitions (optionally used with autostop to define X)
	delay:		   0,	  // additional delay (in ms) for first transition (hint: can be negative)
	slideExpr:	   null,  // expression for selecting slides (if something other than all children is required)
	cleartype:	   !$.support.opacity,  // true if clearType corrections should be applied (for IE)
	cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
	nowrap:		   0,	  // true to prevent slideshow from wrapping
	fastOnEvent:   0,	  // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
	randomizeEffects: 1,  // valid when multiple effects are used; true to make the effect sequence random
	rev:           0,     // causes animations to transition in reverse
	manualTrump:   true,  // causes manual transition to stop an active transition instead of being ignored
	requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
	requeueTimeout: 250   // ms delay for requeue
};

})(jQuery);
		var tempArray = location.search.substr(1).split("&");
		var searchArray = new Array();
		for (i=0;i < tempArray.length;i++) {
		    //splits the string before and after the '=' and assigns 'bcpid' and 'bctid' teir corresponding numbers
		    var tempSplit = tempArray[i].split("=");
		    searchArray[tempSplit[0]] = tempSplit[1];
		}
		if(!searchArray['search'])
		{
			searchArray['search'] = "";
		}
		var pop = searchArray['search'];
		pop = decodeURIComponent(pop.replace(/\+/g, ' '));
		

		$(document).ready(function(){
			$("#dropDownNav").superfish({
				delay:       300,                           // milliseconds delay on mouseout 
		        animation:   {height:'show'},               // fade-in and slide-down animation 
		        speed:       'fast',                        // animation speed 
		        autoArrows:  false,                         // generation of arrow mark-up
		        disableHI:   true,                          // disable hoverIntent detection
		        dropShadows: false                          // drop shadows
		    });



			//document.searchForm.search.value = pop;

			if(!active)
			{
				var active = 1;
			}

			// Popup Tabs on the Live Search
	    	$("#liveSearch").hoverIntent({    
	    	     sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
	    	     interval: 0, // number = milliseconds for onMouseOver polling interval    
	    	     over: 
	    			function(){
	    				$("#liveSearchTabs").show("slide",{direction: "down"},500);
	    			}, // function = onMouseOver callback (REQUIRED)    
	    	     timeout: 500, // number = milliseconds delay before onMouseOut    
	    	     out: 
	    			function(){
	    				$("#liveSearchTabs").hide("slide",{direction: "down"},500);
	    			} // function = onMouseOut callback (REQUIRED)    
	    	});
	    	function resetColor()
			{
				if(active != 1)
				{
	    	    	$("#liveSearchTabs1").css({ color: "#fff" });
				} else {
					$("#liveSearchTabs1").css({ color: "#111" });
				}
				if(active != 2)
				{
	    			$("#liveSearchTabs2").css({ color: "#fff" });
				} else {
						$("#liveSearchTabs2").css({ color: "#9AA47f" });
					}
				if(active != 3)
				{
	    			$("#liveSearchTabs3").css({ color: "#fff" });
				} else {
						$("#liveSearchTabs3").css({ color: "#e7bd18" });
					}
				if(active != 4)
				{
	    			$("#liveSearchTabs4").css({ color: "#fff" });
				} else {
						$("#liveSearchTabs4").css({ color: "#2db8e0" });
					}
	    	}
			function barColor(bg,text,image,a,tab,search)
			{
				$("#liveSearch").css({ background: bg});
	    		$("#liveSearchLeft").css({ background: image});
				active = a;
	    		resetColor();
				$(tab).css({ color: text });
				document.getElementById("searchForm").action = search;
			}
	    	// Change Tab BG on hover
			resetColor();
	    	$("#liveSearchTabs1").hoverIntent({
			    sensitivity: 1,  
	    	    interval: 0,
	    	    over:
			        function(){
						resetColor();
						$("#liveSearchTabs1").css({ color: "#111" });
					},
			    timeout: 0, 
	            out:
	                function(){
			            resetColor();
	            	}
			});
			$("#liveSearchTabs2").hoverIntent({
			    sensitivity: 1,  
	    	    interval: 0,
	    	    over:
			        function(){
						resetColor();
						$("#liveSearchTabs2").css({ color: "#9AA45f" });
					},
			    timeout: 0, 
	            out:
	                function(){
			            resetColor();
	            	}
			});
			$("#liveSearchTabs3").hoverIntent({
			    sensitivity: 1,  
	    	    interval: 0,
			    over:
			        function(){
						resetColor();
						$("#liveSearchTabs3").css({ color: "#e7bd18" });
				    },
				timeout: 0,
				out:
			        function(){
			            resetColor();
				    }
			});
			$("#liveSearchTabs4").hoverIntent({
			    sensitivity: 1,  
	    	    interval: 0,
			    over:
			        function(){
						resetColor();
	        			$("#liveSearchTabs4").css({ color: "#2db8e0" });
	        		},
	    		timeout: 0,
	    		out:
			        function(){
			            resetColor();
				    }
			});
			if(active == 1)
			{
				barColor("#525252","#111","url('http://usarmy.vo.llnwd.net/e2/rv5_images/main/live_search_left.gif') no-repeat",1,"#liveSearchTabs1","http://www.army.mil/search/index.php");
			}
			if(active == 2)
			{
				barColor("#78823f","#9AA45f","url('http://usarmy.vo.llnwd.net/e2/rv5_images/main/live_search_left_green.gif') no-repeat",2,"#liveSearchTabs2","http://www.army.mil/search/articles/index.php");
			}
			if(active == 3)
			{
				barColor("#e7bd18","#e7bd18","url('http://usarmy.vo.llnwd.net/e2/rv5_images/main/live_search_left_yellow.gif') no-repeat",3,"#liveSearchTabs3","http://www.army.mil/search/images/index.php");
			}
			if(active == 4)
			{
				barColor("#2db8e0","#2db8e0","url('http://usarmy.vo.llnwd.net/e2/rv5_images/main/live_search_left_blue.gif') no-repeat",4,"#liveSearchTabs4","http://www.army.mil/search/videos/index.php");
			}
	    	// Alter search type and search bar color
	    	$("#liveSearchTabs1").click(function(){
				barColor("#525252","#111","url('http://usarmy.vo.llnwd.net/e2/rv5_images/main/live_search_left.gif') no-repeat",1,"#liveSearchTabs1","http://www.army.mil/search/index.php");
				document.getElementById("search").focus();
	    	});
	    	$("#liveSearchTabs2").click(function(){
				barColor("#78823f","#9AA47f","url('http://usarmy.vo.llnwd.net/e2/rv5_images/main/live_search_left_green.gif') no-repeat",2,"#liveSearchTabs2","http://www.army.mil/search/articles/index.php");
				document.getElementById("search").focus();
	    	});
	    	$("#liveSearchTabs3").click(function(){
				barColor("#e7bd18","#e7bd18","url('http://usarmy.vo.llnwd.net/e2/rv5_images/main/live_search_left_yellow.gif') no-repeat",3,"#liveSearchTabs3","http://www.army.mil/search/images/index.php");
				document.getElementById("search").focus();
	    	});
	    	$("#liveSearchTabs4").click(function(){
				barColor("#2db8e0","#2db8e0","url('http://usarmy.vo.llnwd.net/e2/rv5_images/main/live_search_left_blue.gif') no-repeat",4,"#liveSearchTabs4","http://www.army.mil/search/videos/index.php");
				document.getElementById("search").focus();
	    	});


			// if ie6, cache background images, don't keep redownloading them from server!
			if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 6) {
			  	try {
			    	document.execCommand("BackgroundImageCache", false, true);
			  	} catch(err) { }
			}
				
			/* hotTopics */

			function onAfter(curr, next, opts){
    			var index = opts.currSlide;
    			var myindex = index +1;
				$("#counterIndex").html(myindex);
				
				if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 6){

				}
				else {
					//$('#hotTopics .prev')[index == 0 ? 'addClass' : 'removeClass']("disabled");
					//$('#hotTopics .next')[index == opts.slideCount - 1 ? 'addClass' : 'removeClass']("disabled");
				}
			}
			$("#hotTopics ul").cycle({
				cleartype:  1,
				cleartypeNoBg: 1,
				prev: 		'#hotTopics .prev',
				next: 		'#hotTopics .next',
				fx:     	'fade', 
				speed:   	200,
				timeout: 	5000,
				after:   onAfter
			});
			
			/* Widget Menu - jcarousel */
			var widgetCarousel = null;
			function lockWidgetCarousel() {
				//widgetCarousel.lock();
			};
			function resetWidgetCarousel() {
			    //widgetCarousel.unlock();
			};
			function widgetMenu_initCallback(carousel) {
			    //widgetCarousel = carousel;
			};
			function widgetMenu_itemLastInCallback(carousel, item, idx, state) {
				//alert(idx);
				$(".jcarousel-item-"+idx+" ul.checklist").css({"border-right":"none"});
			};
			function widgetMenu_itemLastOutCallback(carousel, item, idx, state) {
				$(".jcarousel-item-"+idx+" ul.checklist").css({"border-right":"1px solid #6d6d6d"});
			};

		    $(".main:not(ul.checklist)").jcarousel({
		        animation: 600,
				scroll: 1,
				start: 1,
				offset: 1,
				visible: 3,
				initCallback: widgetMenu_initCallback,
				itemLastOutCallback: widgetMenu_itemLastOutCallback,
				itemLastInCallback: {
					onAfterAnimation:  widgetMenu_itemLastInCallback
				}
		    });
			$(".jcarousel-item-3 ul.checklist").css({"border-right":"none"});
			
			$("#widgetNav li a").click(function(){
				$(this).parent("li").siblings("li").removeClass("current");
				$(this).parent("li").addClass("current");
				var href = $(this).attr("href");
				if (href=="#allWidgets"){
					$("#sectionsClone").empty();
					$("#allWidgets").show();
					$("#allWidgets li.category").show();
					//resetWidgetCarousel();
				}
				else {
					$("#allWidgets").hide();
					$("#allWidgets li.category").hide();
					
					$("#sectionsClone").empty().appendTo("#widgetOptions .jcarousel-clip");
					$(href).clone().appendTo("#sectionsClone").show().find(".checklist:last-child").css({"border-right":"none"});
				}
				return false;
			});
			
			$(window).resize(function(){
				$("#widgetOptions .main .checklist li").removeAttr("style");
			});
			
			/* myArmy top config buttons */
			$("#loginOptions a").click(function(){
				return false;
			});
			$("#myArmyInfo #addWidgets").click(function(){
				$("#widgetOptions .jcarousel-list").css({"width":"9900px"});
				$("#widgetOptions").slideDown(600);
				return false;
			});
			$("#closeWidgetOptions").click(function(){
				$("#widgetOptions").slideUp(600);
				return false;
			});
			$("#cancelWidgetOptions").click(function(){
				$("#widgetOptions").slideUp(600);
				return false;
			});
			
			$("#saveWidgetOptions").click(function(){
				var ids = "";
				$("#widgetsAdded li a").each(function(){
					ids += $(this).attr("id");
				});
				$("#widgetOptions").slideUp(600,function(){
					$.ajax({
						type: "GET",
						url: "/welcome/add_widgets/",
						data: "ids="+ids,
						success: function(msg){
							location.reload(true);
						}
					});
				});
				return false;
			});
			
			$("#widgetsAdded li a").live("delete", function(event, myName){
				$(this).parent().remove();
			});
			
			$("#widgetOptions .selectBox").live("mouseover", function(){
				$(this).parent().addClass("selected");
			});
			$("#widgetOptions .selectBox").live("mouseout", function(){
				$(this).parent().removeClass("selected");
			});
			
			$("#widgetOptions .selectBox").live("click", function(){
				var name = $(this).html();
				var id = $(this).attr("value");
				$("#widgetsAdded ul").append('<li>+' + name + '<a id="' + id + '" href="" class="hide">Delete</a></li>');
				return false;
			});
				
			
			$("#widgetsAdded li").live("mouseover", function(){
				$(this).addClass("hover");
			});
			$("#widgetsAdded li").live("mouseout", function(){
				$(this).removeClass("hover");
			});
			$("#widgetsAdded li.hover").live("click", function(){
				$(this).remove();
			});

			$("#resetPage").click(function(){
				var where_to = confirm("This will return the page to its default state, reverting all customizations you have made. Are you sure you want to reset?");
				if (where_to == true)
				{
					$.ajax({
						type: "GET",
						url: "/welcome/destroy_my_work/",
						success: function(msg){
							//alert(msg);
							location.reload(true);
						}
					 });
				}
				return false;
			});
			
			if(getParameterByName("af"))
			{
				//shake(0,1);
			}
		});
		
		function getParameterByName(name)
		{
		  name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
		  var regexS = "[\\?&]" + name + "=([^&#]*)";
		  var regex = new RegExp(regexS);
		  var results = regex.exec(window.location.href);
		  if(results == null)
		    return "";
		  else
		    return decodeURIComponent(results[1].replace(/\+/g, " "));
		}
		
		function shake(rotate, direction)
		{
			var rotateCSS = 'rotate(' + rotate + 'deg)';

			$("#wrapper").css({
				'position': 'relative',
				'-moz-transform': rotateCSS,
				'-webkit-transform': rotateCSS,
				'-ms-transform': rotateCSS,
				'transform': rotateCSS,
				'left': rotate*20
			});
			
			if(direction)
			{
				rotate++;
				if(rotate >= 5)
				{
					direction = 0;
				}
			} else {
				rotate--;
				if(rotate <= -5)
				{
					direction = 1;
				}
			}
			setTimeout('shake('+rotate+','+direction+')',5);
		}
		

			    
	        if (brightcove == undefined) {
                var brightcove = {};
                brightcove.getExperience = function () {
                    alert("Please import APIModules_all.js in order to use the API.");
                };
            }
            if (brightcove.experiences == undefined) {
                brightcove.servicesURL = 'http://c.brightcove.com/services';
                brightcove.cdnURL = 'http://admin.brightcove.com/';
                brightcove.secureServicesURL = 'https://secure.brightcove.com/services';
                brightcove.pubHost = 'c.$pubcode$.$zoneprefix$$zone$';
                brightcove.pubSecureHost = 'secure.$pubcode$.$zoneprefix$$zone$';
                brightcove.pubSubdomain = 'ariessaucetown.local';
                brightcove.experiences = {};
                brightcove.experienceNum = 0;
                brightcove.majorVersion = 9;
                brightcove.majorRevision = 0;
                brightcove.minorRevision = 28;
                var brightcoveJS = brightcove;
                brightcove.createExperiences = function (pEvent, pElementID) {
                    var pDefaultParam = {};
                    pDefaultParam.width = '100%';
                    pDefaultParam.height = '100%';
                    var pDefaultFParam = {};
                    pDefaultFParam.allowScriptAccess = 'always';
                    pDefaultFParam.allowFullScreen = 'true';
                    pDefaultFParam.seamlessTabbing = false;
                    pDefaultFParam.swliveconnect = true;
                    pDefaultFParam.wmode = 'window';
                    pDefaultFParam.quality = 'high';
                    pDefaultFParam.bgcolor = '#999999';
                    var isIE = (window.ActiveXObject != undefined);
                    var pMajorVersion = 0;
                    var pMinorRevision = 0;
                    var pVersions;
                    var pNoFlash = false;
                    if (typeof navigator.plugins != 'undefined' && navigator.plugins.length > 0) {
                        if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
                            var pSWFVersion = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
                            var pDescription = navigator.plugins["Shockwave Flash" + pSWFVersion].description;
                            pVersions = pDescription.split(" ");
                            pMajorVersion = pVersions[2].split(".")[0];
                            pMinorRevision = pVersions[3];
                            if (pMinorRevision == "") {
                                pMinorRevision = pVersions[4];
                            }
                            if (pMinorRevision[0] == "d") {
                                pMinorRevision = pMinorRevision.substring(1);
                            } else if (pMinorRevision[0] == "r") {
                                pMinorRevision = pMinorRevision.substring(1);
                                if (pMinorRevision.indexOf("d") > 0) {
                                    pMinorRevision = pMinorRevision.substring(0, pMinorRevision.indexOf("d"));
                                }
                            }
                        }
                    } else if (isIE) {
                        try {
                            var pFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
                            pVersions = / ([0-9]+),[0-9],([0-9]+),/.exec(pFlash.GetVariable('$version'));
                            pMajorVersion = pVersions[1];
                            pMinorRevision = pVersions[2];
                        } catch(e) {
                            pNoFlash = true;
                        }
                    } else {
                        pNoFlash = true;
                    }
                    var pExperiences = [];
                    if (pElementID != null) {
                        pExperiences.push(document.getElementById(pElementID));
                    } else {
                        var pAllObjects = document.getElementsByTagName('object');
                        var pNumObjects = pAllObjects.length;
                        for (var i = 0; i < pNumObjects; i++) {
                            if (/\bBrightcoveExperience\b/.test(pAllObjects[i].className)) {
                                if (pAllObjects[i].type != 'application/x-shockwave-flash') {
                                    pExperiences.push(pAllObjects[i]);
                                }
                            }
                        }
                    }
                    if (isIE) {
                        var pParams = document.getElementsByTagName('param');
                    }
                    var pExperience;
                    var pPlayerID = brightcove.getParameter("bcpid");
                    var pTitleID = brightcove.getParameter("bctid");
                    var pLineupID = brightcove.getParameter("bclid");
                    var pAutoStart = brightcove.getParameter("autoStart");
                    var pNumExperiences = pExperiences.length;
                    var pRequestedMinorRevision;
                    var pRequestedMajorVersion;
                    for (var i = 0; i < pNumExperiences; i++) {
                        pExperience = pExperiences[i];
                        if (!pExperience.params) pExperience.params = {};
                        if (!pExperience.fParams) pExperience.fParams = {};
                        for (var j in pDefaultParam) {
                            pExperience.params[j] = pDefaultParam[j];
                        }
                        for (var j in pDefaultFParam) {
                            pExperience.fParams[j] = pDefaultFParam[j];
                        }
                        if (pExperience.id.length > 0) {
                            pExperience.params.flashID = pExperience.id;
                        } else {
                            pExperience.id = pExperience.params.flashID = 'bcExperienceObj' + (brightcove.experienceNum++);
                        }
                        if (!isIE) {
                            var pParams = pExperience.getElementsByTagName('param');
                        }
                        var pNumParams = pParams.length;
                        var pParam;
                        for (var j = 0; j < pNumParams; j++) {
                            pParam = pParams[j];
                            if (isIE && pParam.parentNode.id != pExperience.id) {
                                continue;
                            }
                            pExperience.params[pParam.name] = pParam.value;
                        }
                        var pSetMajorVersion = false;
                        if (pExperience.params.majorVersion != undefined) {
                            pRequestedMajorVersion = parseInt(pExperience.params.majorVersion);
                            pSetMajorVersion = true;
                        } else {
                            pRequestedMajorVersion = brightcove.majorVersion;
                        }
                        if (pExperience.params.minorRevision != undefined) {
                            pRequestedMinorRevision = parseInt(pExperience.params.minorRevision);
                        } else {
                            if (pSetMajorVersion) {
                                pRequestedMinorRevision = 0;
                            } else {
                                pRequestedMinorRevision = brightcove.minorRevision;
                            }
                        }
                        var pUseInstaller = false;
                        if (pMajorVersion < pRequestedMajorVersion || (pMajorVersion == pRequestedMajorVersion && pMinorRevision < pRequestedMinorRevision)) {
                            pUseInstaller = true;
                        }
                        if (pExperience.params.bgcolor != undefined) pExperience.fParams.bgcolor = pExperience.params.bgcolor;
                        if (pExperience.params.wmode != undefined) pExperience.fParams.wmode = pExperience.params.wmode;
                        if (pExperience.params.autoStart == undefined && pAutoStart != undefined) {
                            pExperience.params.autoStart = pAutoStart;
                        }
                        if (pPlayerID.length < 1 || (pPlayerID == pExperience.params.playerID)) {
                            if (pPlayerID != pExperience.params.playerID && pPlayerID.length > 0) {
                                pExperience.params.playerID = pPlayerID;
                            }
                            if (pTitleID.length > 0) {
                                pExperience.params.videoID = pTitleID;
                                pExperience.params.autoStart = (pExperience.params.autoStart != "false" && pAutoStart != "false");
                            }
                            if (pLineupID.length > 0) {
                                pExperience.params.lineupID = pLineupID;
                            }
                        }
                        var pFile;
                        if (pUseInstaller) {
                            pFile = brightcove.cdnURL + "/viewer/playerProductInstall.swf";
                            var MMPlayerType = isIE ? "ActiveX" : "PlugIn";
                            document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                            var MMdoctitle = document.title;
                            pFile += "?&MMredirectURL=" + window.location + '&MMplayerType=' + MMPlayerType + '&MMdoctitle=' + MMdoctitle;
                        } else {
                            if (pExperience.params.secureConnections == "true") {
                                pFile = brightcove.getPubURL(brightcove.secureServicesURL, brightcove.pubSecureHost, pExperience.params.pubCode);
                            } else {
                                pFile = brightcove.getPubURL(brightcove.servicesURL, brightcove.pubHost, pExperience.params.pubCode);
                            }
                            pFile += ('/viewer/federated_f9?' + brightcove.getOverrides());
                            for (var pConfig in pExperience.params) {
                                pFile += '&' + encodeURIComponent(pConfig) + '=' + encodeURIComponent(pExperience.params[pConfig]);
                            }
                        }
                        var pExperienceElement;
                        var pContainerID = '_container' + pExperience.id;
                        if (pNoFlash) {
                            var pContainer = document.createElement('span');
                            if (pExperience.params.height.charAt(pExperience.params.height.length - 1) == "%") {
                                pContainer.style.display = 'block';
                            } else {
                                pContainer.style.display = 'inline-block';
                            }
                            pContainer.id = pContainerID;
                            var pLinkHTML = "<a href='http://www.adobe.com/go/getflash/' target='_blank'><img src='" + brightcove.cdnURL + "/viewer/upgrade_flash_player2.gif' alt='Get Flash Player' width='314' height='200' border='0'></a>";
                            pExperience.parentNode.replaceChild(pContainer, pExperience);
                            document.getElementById(pContainerID).innerHTML = pLinkHTML;
                        } else {
                            if (isIE) {
                                var pContainer = document.createElement('span');
                                if (pExperience.params.height.charAt(pExperience.params.height.length - 1) == "%") {
                                    pContainer.style.display = 'block';
                                } else {
                                    pContainer.style.display = 'inline-block';
                                }
                                pContainer.id = pContainerID;
                                pExperience.fParams.movie = pFile;
                                var pOptions = '';
                                for (var pOption in pExperience.fParams) {
                                    pOptions += '<param name="' + pOption + '" value="' + pExperience.fParams[pOption] + '" />';
                                }
                                var pProtocol = (pExperience.params.secureConnections == "true") ? "https" : "http";
                                var pExperienceHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + ' codebase="' + pProtocol + '://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + brightcove.majorVersion + ',' + brightcove.majorRevision + ',' + brightcove.minorRevision + ',0"' + ' id="' + pExperience.id + '"' + ' width="' + pExperience.params.width + '"' + ' height="' + pExperience.params.height + '"' + ' type="application/x-shockwave-flash"' + ' class="BrightcoveExperience">' + pOptions + '</object>';
                                pExperience.parentNode.replaceChild(pContainer, pExperience);
                                document.getElementById(pContainerID).innerHTML = pExperienceHTML;
                                pExperience.experience = document.getElementById(pExperience.id);
                                brightcove.experiences[pExperience.id] = pContainer;
                            } else {
                                var pExperienceElement = document.createElementNS('http://www.w3.org/1999/xhtml', 'object');
                                pExperienceElement.type = 'application/x-shockwave-flash';
                                pExperienceElement.data = pFile;
                                pExperienceElement.id = pExperience.params.flashID;
                                pExperienceElement.width = pExperience.params.width;
                                pExperienceElement.height = pExperience.params.height;
                                pExperienceElement.className = pExperience.className;
                                var pTempParam;
                                for (var pConfig in pExperience.fParams) {
                                    pTempParam = document.createElementNS('http://www.w3.org/1999/xhtml', 'param');
                                    pTempParam.name = pConfig;
                                    pTempParam.value = pExperience.fParams[pConfig];
                                    pExperienceElement.appendChild(pTempParam);
                                }
                                pExperience.parentNode.replaceChild(pExperienceElement, pExperience);
                                brightcove.experiences[pExperience.id] = pExperienceElement;
                            }
                        }
                    }
                };
                brightcove.createExperience = function (pElement, pParentOrSibling, pAppend) {
                    if (!pElement.id || pElement.id.length < 1) {
                        pElement.id = 'bcExperienceObj' + (brightcove.experienceNum++);
                    }
                    if (pAppend) {
                        pParentOrSibling.appendChild(pElement);
                    } else {
                        pParentOrSibling.parentNode.insertBefore(pElement, pParentOrSibling);
                    }
                    brightcove.createExperiences(null, pElement.id);
                };
                brightcove.removeExperience = function (pID) {
                    if (brightcove.experiences[pID] != null) {
                        brightcove.experiences[pID].parentNode.removeChild(brightcove.experiences[pID]);
                    }
                };
                brightcove.getURL = function () {
                    var pURL;
                    if (typeof window.location.search != 'undefined') {
                        pURL = window.location.search;
                    } else {
                        pURL = /(\?.*)$/.exec(document.location.href);
                    }
                    return pURL;
                };
                brightcove.getOverrides = function () {
                    var pURL = brightcove.getURL();
                    var pQuery = new RegExp('@[\\w\\.]+=[^&]+', 'g');
                    var pValue = pQuery.exec(pURL);
                    var pOverrides = "";
                    while (pValue != null) {
                        pOverrides += "&" + pValue;
                        pValue = pQuery.exec(pURL);
                    }
                    return pOverrides;
                };
                brightcove.getParameter = function (pName, pDefaultValue) {
                    if (pDefaultValue == null) pDefaultValue = "";
                    var pURL = brightcove.getURL();
                    var pQuery = new RegExp(pName + '=([^&]*)');
                    var pValue = pQuery.exec(pURL);
                    if (pValue != null) {
                        return pValue[1];
                    } else {
                        return pDefaultValue;
                    }
                };
                brightcove.createElement = function (el) {
                    if (document.createElementNS) {
                        return document.createElementNS('http://www.w3.org/1999/xhtml', el);
                    } else {
                        return document.createElement(el);
                    }
                };
                brightcove.i18n = {
                    'BROWSER_TOO_OLD': 'The browser you are using is too old. Please upgrade to the latest version of your browser.'
                };
                brightcove.removeListeners = function () {
                    if (/KHTML/i.test(navigator.userAgent)) {
                        clearInterval(checkLoad);
                        document.removeEventListener('load', brightcove.createExperiences, false);
                    }
                    if (typeof document.addEventListener != 'undefined') {
                        document.removeEventListener('DOMContentLoaded', brightcove.createExperiences, false);
                        document.removeEventListener('load', brightcove.createExperiences, false);
                    } else if (typeof window.attachEvent != 'undefined') {
                        window.detachEvent('onload', brightcove.createExperiences);
                    }
                };
                brightcove.getPubURL = function (source, host, pubCode) {
                    if (!pubCode || pubCode == "") return source;
                    var re = /^([htps]{4,5}\:\/\/)([^\/\:]+)/i;
                    host = host.replace("$pubcode$", pubCode).replace("$zoneprefix$$zone$", brightcove.pubSubdomain);
                    return source.replace(re, "$1" + host);
                };
                brightcove.createExperiencesPostLoad = function () {
                    brightcove.removeListeners();
                    brightcove.createExperiences();
                };
                brightcove.onTemplateLoaded = function (id, handler) {
                    var player = brightcove.getExperience(id);
                    if (player) {
                        player.getModule("experience").addEventListener("templateReady", eval(handler));
                    }
                };
                if (/KHTML/i.test(navigator.userAgent)) {
                    var checkLoad = setInterval(function () {
                        if (/loaded|complete/.test(document.readyState)) {
                            clearInterval(checkLoad);
                            brightcove.createExperiencesPostLoad();
                        }
                    },
                    70);
                    document.addEventListener('load', brightcove.createExperiencesPostLoad, false);
                }
                if (typeof document.addEventListener != 'undefined') {
                    document.addEventListener('DOMContentLoaded', brightcove.createExperiencesPostLoad, false);
                    document.addEventListener('load', brightcove.createExperiencesPostLoad, false);
                } else if (typeof window.attachEvent != 'undefined') {
                    window.attachEvent('onload', brightcove.createExperiencesPostLoad);
                } else {
                    alert(brightcove.i18n.BROWSER_TOO_OLD);
                }
            }

			//API MODULE ALL
			var APIModules = {};
			APIModules.EXPERIENCE = "experience";
			APIModules.CONTENT = "content";
			APIModules.VIDEO_PLAYER = "videoPlayer";
			APIModules.SOCIAL = "social";
			APIModules.SEARCH = "search";
			APIModules.CUE_POINTS = "cuePoints";
			APIModules.ADVERTISING = "advertising";
			APIModules.MENU = "menu";
			APIModules.EFFECTS = "effects";
			APIModules.CONVIVA = "conviva";
			APIModules.CAPTIONS = "captions";
			if (brightcove == undefined) {
			    var brightcove = {
			        playerType: {
			            FLASH: "flash",
			            HTML: "html",
			            INSTALLER: "installer",
			            NO_SUPPORT: "nosupport"
			        }
			    };
			}
			brightcove.instances = {};
			brightcove.modules = {};
			brightcove.ID_DELIM = "|||";
			var bcPlayer = brightcove;
			brightcove.getExperience = function (pExperience) {
			    if (this.instances[pExperience] == null) {
			        alert("Experience '" + pExperience + "' not found. Please ensure the name is correct and the API for the player is enabled.");
			    }
			    return this.instances[pExperience];
			};
			brightcove.getPlayer = brightcove.getExperience;

			function setAPICallback(pID, pCallback, pURL) {
			    brightcove.instances[pID] = new BrightcoveExperience(pCallback, pID, pURL);
			}

			function BrightcoveExperience(pCallback, pID, pURL) {
			    if (pCallback == null) {
			        this.type = brightcove.playerType.HTML;
			        this.playerURL = pURL;
			        this.callback = brightcove.experiences[pID].contentWindow;
			    } else {
			        this.type =  "flash";  // this use to equal 'brightcove.playerType.FLASH;' however, we needed to change it to 'flash' because the playerType wasn't being properly recognized.
			        this.callback = pCallback;
			    }
			    this.modules = {};
			}
			BrightcoveExperience.prototype.getModule = function (pModule) {
			    if (this.modules[pModule] == null) {
			        var module = new brightcove.modules[pModule](this);
			        module.playerURL = this.playerURL;
			        if (module.isPlayerDefined != null) {
			            if (!module.isPlayerDefined()) {
			                return null;
			            }
			        }
			        this.modules[pModule] = module;
			    }
			    return this.modules[pModule];
			};

			function APIModule() {
			    this.handlers = [];
			}
			APIModule.handlerCount = 0;
			APIModule.getHandler = function () {
			    return "bc_handler" + (APIModule.handlerCount++);
			};
			APIModule.callFlash = function (pCallback, pParams) {
			    var pCallbackArray = pCallback.split(brightcove.ID_DELIM);
			    if (pCallbackArray.length < 2) return;
			    if (pCallbackArray[0].length < 1) return;
			    var pFlashId = pCallbackArray[0];
			    var pCallback = pCallbackArray[1];
			    var pExperience = document.getElementById(pFlashId);
			    if (pExperience[pCallback] != null) {
			        return pExperience[pCallback](BCXML.convertToXML(pParams, "js2flash"));
			    }
			};
			APIModule.prototype.name = "APIModule";
			APIModule.prototype.addEventListener = function (pEvent, pHandler) {
			    var pNewHandler = APIModule.getHandler();
			    this.handlers.push({
			        handler: pHandler,
			        bcHandler: pNewHandler,
			        event: pEvent
			    });
			    window[pNewHandler] = pHandler;
			    return this.callMethod("addEventListener", [pEvent, pNewHandler]);
			};
			APIModule.prototype.removeEventListener = function (pEvent, pHandler) {
			    var pNum = this.handlers.length;
			    for (var i = 0; i < pNum; i++) {
			        if (this.handlers[i].event == pEvent && this.handlers[i].handler == pHandler) {
			            var pBCHandler = this.handlers[i].bcHandler;
			            this.handlers.splice(i, 1);
			            break;
			        }
			    }
			    if (pBCHandler == undefined) return;
			    return this.callMethod("removeEventListener", [pEvent, pBCHandler]);
			};
			APIModule.prototype.callPlayer = function (pCallback, pParams) {
			    if (this.playerURL != undefined) {
			        return this.callHTML5(pParams);
			    } else {
			        return APIModule.callFlash(pCallback, pParams);
			    }
			};
			APIModule.prototype.callMethod = function (pMethod, pArguments) {
			    var pArgs = [];
			    for (var i = 0; i < pArguments.length; i++) pArgs.push(pArguments[i]);
			    return this.callPlayer(this.callback, {
			        module: this.name,
			        method: pMethod,
			        params: pArgs
			    });
			};
			APIModule.prototype.callHTML5 = function (pParams) {
			    if (window.JSON && this.callback.postMessage) {
			        var json = window.JSON.stringify(pParams);
			        this.callback.postMessage(json, this.playerURL);
			    }
			    return null;
			};
			var BCXML = {};
			BCXML.convertToXML = function (pObj, pNodeName) {
			    if (pObj instanceof Function) return "";
			    var pType = BCXML.getType(pObj);
			    var pXML = "<" + pType.name + pNodeName + ">";
			    if (pType.name == "obj") {
			        for (var i in pObj) {
			            pXML += BCXML.convertToXML(pObj[i], i);
			        }
			    } else if (pType.name == "arr") {
			        for (var j = 0; j < pObj.length; j++) {
			            pXML += BCXML.convertToXML(pObj[j], j);
			        }
			    } else if (pType.name == "str") {
			        pObj = BCXML.replaceEntities(pObj);
			        pXML += pObj;
			    } else {
			        pXML += pObj;
			    }
			    pXML += "</" + pType.name + pNodeName + ">";
			    return pXML;
			};
			BCXML.replaceEntities = function (pObj) {
			    pObj = pObj.replace(new RegExp("&", "g"), "&amp;");
			    pObj = pObj.replace(new RegExp("<", "g"), "&lt;");
			    pObj = pObj.replace(new RegExp(">", "g"), "&gt;");
			    return pObj;
			};
			BCXML.getType = function (pObj) {
			    switch (typeof(pObj)) {
			    case "boolean":
			        return {
			            name: "boo",
			            type: Boolean
			        };
			    case "string":
			        return {
			            name: "str",
			            type: String
			        };
			    case "number":
			        return {
			            name: "num",
			            type: Number
			        };
			    default:
			        if (pObj instanceof Array) {
			            return {
			                name: "arr",
			                type: Array
			            };
			        } else {
			            return {
			                name: "obj",
			                type: Object
			            };
			        }
			    }
			};
			BCAdvertisingEvent = {}
			BCAdvertisingEvent.AD_COMPLETE = "adComplete";
			BCAdvertisingEvent.AD_POSTROLLS_COMPLETE = "adPostRollsComplete";
			BCAdvertisingEvent.AD_PAUSE = "adPause";
			BCAdvertisingEvent.AD_PROGRESS = "adProgress";
			BCAdvertisingEvent.AD_RESUME = "adResume";
			BCAdvertisingEvent.AD_RECEIVED = "adReceived";
			BCAdvertisingEvent.AD_START = "adStart";
			BCAdvertisingEvent.AD_CLICK = "adClick";
			BCAdvertisingEvent.EXTERNAL_AD = "externalAd";
			BCAdvertisingEvent.AD_RULES_READY = "adRulesReady";
			brightcove.modules[APIModules.ADVERTISING] = AdvertisingAPI;

			function AdvertisingAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.ADVERTISING;
			}
			var pttp = AdvertisingAPI.prototype = new APIModule();
			pttp.showAd = function () {
			    return this.callMethod("showAd", arguments);
			};
			pttp.resumeAfterExternalAd = function () {
			    return this.callMethod("resumeAfterExternalAd", arguments);
			};
			pttp.getEnabledAdFormats = function () {
			    return this.callMethod("getEnabledAdFormats", arguments);
			};
			pttp.enableAdFormats = function () {
			    return this.callMethod("enableAdFormats", arguments);
			};
			pttp.enableExternalAds = function () {
			    return this.callMethod("enableExternalAds", arguments);
			};
			pttp.enableOverrideAds = function () {
			    return this.callMethod("enableOverrideAds", arguments);
			};
			pttp.getExternalAdsEnabled = function () {
			    return this.callMethod("getExternalAdsEnabled", arguments);
			};
			pttp.getOverrideAdsEnabled = function () {
			    return this.callMethod("getOverrideAdsEnabled", arguments);
			};
			pttp.disableForExternalAd = function () {
			    return this.callMethod("disableForExternalAd", arguments);
			};
			pttp.getCurrentAdProperties = function () {
			    return this.callMethod("getCurrentAdProperties", arguments);
			};
			pttp.showSponsorMessage = function () {
			    return this.callMethod("showSponsorMessage", arguments);
			};
			pttp.getShowSponsorMessage = function () {
			    return this.callMethod("getShowSponsorMessage", arguments);
			};
			pttp.allowThirdPartyControl = function () {
			    return this.callMethod("allowThirdPartyControl", arguments);
			};
			pttp.setThirdPartyTime = function () {
			    return this.callMethod("setThirdPartyTime", arguments);
			};
			pttp.getThirdPartyTime = function () {
			    return this.callMethod("getThirdPartyTime", arguments);
			};
			pttp.getAdPolicy = function () {
			    return this.callMethod("getAdPolicy", arguments);
			};
			pttp.setAdPolicy = function () {
			    return this.callMethod("setAdPolicy", arguments);
			};
			pttp.requestAd = function () {
			    return this.callMethod("requestAd", arguments);
			};
			pttp.getStayInFullScreen = function () {
			    return this.callMethod("getStayInFullScreen", arguments);
			};
			pttp.setStayInFullScreen = function () {
			    return this.callMethod("setStayInFullScreen", arguments);
			};
			BCCaptionsEvent = {}
			BCCaptionsEvent.DFXP_LOAD_SUCCESS = "dfxpLoadSuccess";
			BCCaptionsEvent.DFXP_LOAD_ERROR = "dfxpLoadError";
			brightcove.modules[APIModules.CAPTIONS] = CaptionsAPI;

			function CaptionsAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.CAPTIONS;
			}
			var pttp = CaptionsAPI.prototype = new APIModule();
			pttp.loadDFXP = function () {
			    return this.callMethod("loadDFXP", arguments);
			};
			pttp.setLanguage = function () {
			    return this.callMethod("setLanguage", arguments);
			};
			pttp.getLanguages = function () {
			    return this.callMethod("getLanguages", arguments);
			};
			BCContentEvent = {}
			BCContentEvent.VIDEO_LOAD = "videoLoad";
			BCContentEvent.PLAYLIST_LOAD = "playlistLoad";
			BCContentEvent.MEDIA_LOAD = "mediaLoad";
			BCContentEvent.MEDIA_COLLECTION_LOAD = "mediaCollectionLoad";
			brightcove.modules[APIModules.CONTENT] = ContentAPI;

			function ContentAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.CONTENT;
			}
			var pttp = ContentAPI.prototype = new APIModule();
			pttp.getAllMediaCollections = function () {
			    return this.callMethod("getAllMediaCollections", arguments);
			};
			pttp.getAllMediaCollectionIDs = function () {
			    return this.callMethod("getAllMediaCollectionIDs", arguments);
			};
			pttp.getAllPlaylists = function () {
			    return this.callMethod("getAllPlaylists", arguments);
			};
			pttp.getAllPlaylistIDs = function () {
			    return this.callMethod("getAllPlaylistIDs", arguments);
			};
			pttp.getMediaCollection = function () {
			    return this.callMethod("getMediaCollection", arguments);
			};
			pttp.getMediaCollectionAsynch = function () {
			    return this.callMethod("getMediaCollectionAsynch", arguments);
			};
			pttp.getPlaylist = function () {
			    return this.callMethod("getPlaylist", arguments);
			};
			pttp.getPlaylistAsynch = function () {
			    return this.callMethod("getPlaylistAsynch", arguments);
			};
			pttp.getMedia = function () {
			    return this.callMethod("getMedia", arguments);
			};
			pttp.getMediaAsynch = function () {
			    return this.callMethod("getMediaAsynch", arguments);
			};
			pttp.getVideo = function () {
			    return this.callMethod("getVideo", arguments);
			};
			pttp.getVideoAsynch = function () {
			    return this.callMethod("getVideoAsynch", arguments);
			};
			pttp.purgeAllContent = function () {
			    return this.callMethod("purgeAllContent", arguments);
			};
			pttp.purgeMediaCollections = function () {
			    return this.callMethod("purgeMediaCollections", arguments);
			};
			pttp.purgeMedia = function () {
			    return this.callMethod("purgeMedia", arguments);
			};
			pttp.purgePlaylist = function () {
			    return this.callMethod("purgePlaylist", arguments);
			};
			pttp.purgePlaylists = function () {
			    return this.callMethod("purgePlaylists", arguments);
			};
			pttp.purgeVideo = function () {
			    return this.callMethod("purgeVideo", arguments);
			};
			pttp.purgeVideos = function () {
			    return this.callMethod("purgeVideos", arguments);
			};
			pttp.getMediaInGroupAsynch = function () {
			    return this.callMethod("getMediaInGroupAsynch", arguments);
			};
			pttp.createRuntimeMediaCollection = function () {
			    return this.callMethod("createRuntimeMediaCollection", arguments);
			};
			pttp.updateMedia = function () {
			    return this.callMethod("updateMedia", arguments);
			};
			pttp.appendArgsToMediaRequest = function () {
			    return this.callMethod("appendArgsToMediaRequest", arguments);
			};
			brightcove.modules[APIModules.CONVIVA] = ConvivaAPI;

			function ConvivaAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.CONVIVA;
			}
			var pttp = ConvivaAPI.prototype = new APIModule();
			pttp.sendEvent = function () {
			    return this.callMethod("sendEvent", arguments);
			};
			BCCuePointEvent = {}
			BCCuePointEvent.CUE = "cuePoint";
			brightcove.modules[APIModules.CUE_POINTS] = CuePointsAPI;

			function CuePointsAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.CUE_POINTS;
			}
			var pttp = CuePointsAPI.prototype = new APIModule();
			pttp.addCuePoints = function () {
			    return this.callMethod("addCuePoints", arguments);
			};
			pttp.clearCodeCuePoints = function () {
			    return this.callMethod("clearCodeCuePoints", arguments);
			};
			pttp.removeCodeCuePointsAtTime = function () {
			    return this.callMethod("removeCodeCuePointsAtTime", arguments);
			};
			pttp.getCuePoints = function () {
			    return this.callMethod("getCuePoints", arguments);
			};
			pttp.clearAdCuePoints = function () {
			    return this.callMethod("clearAdCuePoints", arguments);
			};
			pttp.removeAdCuePointsAtTime = function () {
			    return this.callMethod("removeAdCuePointsAtTime", arguments);
			};
			BCEffectsEvent = {};
			BCEffectsEvent.BEGIN = "animationBegin";
			BCEffectsEvent.COMPLETE = "animationComplete";
			BCEffectsEvent.CHANGE = "animationChange";
			brightcove.modules[APIModules.EFFECTS] = EffectsAPI;

			function EffectsAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.EFFECTS;
			}
			EffectsAPI.animations = {};
			var pttp = EffectsAPI.prototype = new APIModule();
			pttp.createAnimation = function () {
			    var pID = this.callMethod("createAnimationJS", arguments);
			    return this.getAnimation(pID);
			};
			pttp.getAnimation = function () {
			    var pID = this.callMethod("getAnimationJS", arguments);
			    if (pID) {
			        return this.getAnimationWrapper(pID);
			    }
			    return null;
			};
			pttp.getAnimationWrapper = function (pID) {
			    var pAnimation = EffectsAPI.animations[pID];
			    if (pAnimation == undefined) {
			        pAnimation = new EffectsAPIAnimation(pID, this.callback);
			        EffectsAPI.animations[pID] = pAnimation;
			    }
			    return pAnimation;
			};

			function EffectsAPIAnimation(pID, pCallback) {
			    this.id = pID;
			    this.name = APIModules.EFFECTS;
			    this.callback = pCallback;
			}
			pttp = EffectsAPIAnimation.prototype = new APIModule();
			pttp.id = -1;
			pttp.callMethod = function (pMethod, pArguments) {
			    if (pArguments == undefined) pArguments = [];
			    var pArgs = [this.id];
			    for (var i = 0; i < pArguments.length; i++) pArgs.push(pArguments[i]);
			    return APIModule.callFlash(this.callback, {
			        module: this.name,
			        method: pMethod,
			        params: pArgs
			    });
			};
			pttp.start = function () {
			    return this.callMethod("startJS", arguments);
			};
			pttp.stop = function () {
			    return this.callMethod("stopJS", arguments);
			};
			pttp.apply = function (target) {
			    var targetID = target.getID();
			    if (targetID) {
			        return this.callMethod("applyJS", [targetID]);
			    }
			};
			pttp.addEventListener = function (pEvent, pHandler) {
			    var pNewHandler = APIModule.getHandler();
			    this.handlers.push({
			        handler: pHandler,
			        bcHandler: pNewHandler,
			        event: pEvent
			    });
			    window[pNewHandler] = pHandler;
			    return this.callMethod("addEventListenerJS", [pEvent, pNewHandler]);
			};
			pttp.removeEventListener = function (pEvent, pHandler) {
			    var pNum = this.handlers.length;
			    for (var i = 0; i < pNum; i++) {
			        if (this.handlers[i].event == pEvent && this.handlers[i].handler == pHandler) {
			            var pBCHandler = this.handlers[i].bcHandler;
			            this.handlers.splice(i, 1);
			            break;
			        }
			    }
			    if (pBCHandler == undefined) return;
			    return this.callMethod("removeEventListenerJS", [pEvent, pBCHandler]);
			};
			BCExperienceEvent = {}
			BCExperienceEvent.CONTENT_LOAD = "contentLoad";
			BCExperienceEvent.USER_MESSAGE = "userMessage";
			BCExperienceEvent.TEMPLATE_READY = "templateReady";
			BCExperienceEvent.ENTER_FULLSCREEN = "enterFullScreen";
			BCExperienceEvent.EXIT_FULLSCREEN = "exitFullScreen";
			brightcove.modules[APIModules.EXPERIENCE] = ExperienceAPI;
			BCComponentModules = {};

			function ExperienceAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.EXPERIENCE;
			}
			var pttp = ExperienceAPI.prototype = new APIModule();
			pttp.setSize = function () {
			    return this.callMethod("setSize", arguments);
			};
			pttp.getPlayerName = function () {
			    return this.callMethod("getPlayerName", arguments);
			};
			pttp.getReady = function () {
			    return this.callMethod("getReady", arguments);
			};
			pttp.getWidth = function () {
			    return this.callMethod("getWidth", arguments);
			};
			pttp.getHeight = function () {
			    return this.callMethod("getHeight", arguments);
			};
			pttp.getAdEnabled = function () {
			    return this.callMethod("getAdEnabled", arguments);
			};
			pttp.getEnabled = function () {
			    return this.callMethod("getEnabled", arguments);
			};
			pttp.setEnabled = function () {
			    return this.callMethod("setEnabled", arguments);
			};
			pttp.loadExperience = function () {
			    return this.callMethod("loadExperience", arguments);
			};
			pttp.getLayout = function () {
			    return this.callMethod("getLayout", arguments);
			};
			pttp.getAffiliateID = function () {
			    return this.callMethod("getAffiliateID", arguments);
			};
			pttp.getExperienceID = function () {
			    return this.callMethod("getExperienceID", arguments);
			};
			pttp.getPublisherID = function () {
			    return this.callMethod("getPublisherID", arguments);
			};
			pttp.getExperienceURL = function () {
			    return this.callMethod("getExperienceURL", arguments);
			};
			pttp.getReferrerURL = function () {
			    return this.callMethod("getReferrerURL", arguments);
			};
			pttp.getConfiguredPropertiesForID = function () {
			    return this.callMethod("getConfiguredPropertiesForID", arguments);
			};
			pttp.getPlayerParameter = function () {
			    return this.callMethod("getPlayerParameter", arguments);
			};
			pttp.getLayoutRoot = function () {
			    var pObj = this.callMethod("getLayoutRootJS", arguments);
			    if (pObj != null) {
			        if (BCComponentModules[pObj.elementName] != null) {
			            return new BCComponentModules[pObj.elementName](this.experience, this.callback, pObj.elementID);
			        }
			    }
			    return null;
			};
			pttp.getElementByID = function () {
			    var pNodeName = this.callMethod("getJSElementByID", arguments);
			    if (pNodeName != null) {
			        if (pNodeName == "VideoPlayer" || pNodeName == "VideoDisplay") {
			            var pPlayerAPI = this.experience.getModule(APIModules.VIDEO_PLAYER);
			            if (pPlayerAPI) {
			                pPlayerAPI.initializeComponentAPI();
			                return pPlayerAPI;
			            }
			        } else if (BCComponentModules[pNodeName] != null) {
			            return new BCComponentModules[pNodeName](this.experience, this.callback, arguments[0]);
			        }
			    }
			    return null;
			};
			pttp.getElementsByType = function () {
			    var pIDs = this.callMethod("getJSElementsByType", arguments);
			    var pElements = [];
			    var pElement;
			    for (var i in pIDs) {
			        if (typeof(pIDs[i]) != "function") {
			            pElement = this.getElementByID(pIDs[i]);
			            if (pElement) pElements.push(pElement);
			        }
			    }
			    return pElements;
			};
			pttp.getModules = function () {
			    return this.callMethod("getModules", arguments);
			};
			pttp.unload = function () {
			    return this.callMethod("unload", arguments);
			};
			pttp.debug = function () {
			    return this.callMethod("debug", arguments);
			};
			pttp.getUserCountry = function () {
			    return this.callMethod("getUserCountry", arguments);
			};
			pttp.getTranslation = function () {
			    return this.callMethod("getTranslation", arguments);
			};
			BCMenuEvent = {}
			BCMenuPage = {}
			BCMenuAdditionalMedia = {}
			BCMenuEvent.MENU_PAGE_OPEN = "menuPageOpen";
			BCMenuEvent.MENU_PAGE_CLOSE = "menuPageClose";
			BCMenuEvent.OVERLAY_MENU_OPEN = "overlayMenuOpen";
			BCMenuEvent.OVERLAY_MENU_CLOSE = "overlayMenuClose";
			BCMenuEvent.OVERLAY_MENU_PLAY_CLICK = "overlayMenuPlayClick";
			BCMenuEvent.ICON_MENU_OPEN = "iconMenuOpen";
			BCMenuEvent.ICON_MENU_CLOSE = "iconMenuClose";
			BCMenuEvent.SEND_EMAIL_CLICK = "sendEmailClick";
			BCMenuEvent.BLOG_POST_CLICK = "blogPostClick";
			BCMenuEvent.COPY_LINK = "copyLink";
			BCMenuEvent.COPY_CODE = "copyCode";
			BCMenuEvent.VIDEO_REQUEST = "videoRequest";
			BCMenuPage.EMAIL = "Email";
			BCMenuPage.SHARE = "Share";
			BCMenuPage.LINK = "Link";
			BCMenuPage.CODE = "Embed";
			BCMenuPage.INFO = "Info";
			BCMenuAdditionalMedia.RELATED_VIDEOS = "related videos";
			BCMenuAdditionalMedia.NEWEST_VIDEOS = "newest videos";
			BCMenuAdditionalMedia.MOST_VIEWED_VIDEOS = "most viewed videos";
			brightcove.modules[APIModules.MENU] = MenuAPI;

			function MenuAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.MENU;
			}
			var pttp = MenuAPI.prototype = new APIModule();
			pttp.showIconMenu = function () {
			    return this.callMethod("showIconMenu", arguments);
			};
			pttp.isIconMenuShowing = function () {
			    return this.callMethod("isIconMenuShowing", arguments);
			};
			pttp.showMenuPage = function () {
			    return this.callMethod("showMenuPage", arguments);
			};
			pttp.closeMenuPage = function () {
			    return this.callMethod("closeMenuPage", arguments);
			};
			pttp.isMenuPageShowing = function () {
			    return this.callMethod("isMenuPageShowing", arguments);
			};
			pttp.isOverlayMenuShowing = function () {
			    return this.callMethod("isOverlayMenuShowing", arguments);
			};
			pttp.removeOverlayMenu = function () {
			    return this.callMethod("removeOverlayMenu", arguments);
			};
			pttp.getCurrentMenuPage = function () {
			    return this.callMethod("getCurrentMenuPage", arguments);
			};
			pttp.setOverlayMenuVisible = function () {
			    return this.callMethod("setOverlayMenuVisible", arguments);
			};
			pttp.getOverlayMenuVisible = function () {
			    return this.callMethod("getOverlayMenuVisible", arguments);
			};
			pttp.setAdditionalMediaForType = function () {
			    return this.callMethod("setAdditionalMediaForType", arguments);
			};
			pttp.getAdditionalMediaForType = function () {
			    return this.callMethod("getAdditionalMediaForType", arguments);
			};
			var bcAdditionalMediaCallback;
			pttp.setAdditionalMediaCallback = function (pCallback, pTypes) {
			    bcAdditionalMediaCallback = pCallback;
			    return this.callMethod("setAdditionalMediaCallbackJS", ["bcCallAdditionalMediaCallback", pTypes]);
			};

			function bcCallAdditionalMediaCallback(pType, pMedia) {
			    return bcAdditionalMediaCallback(pType, pMedia);
			};
			BCSearchEvent = {};
			BCSearchEvent.RESULT = "searchResult";
			BCSearchEvent.ERROR = "searchError";
			brightcove.modules[APIModules.SEARCH] = SearchAPI;
			SortOrderType = {
			    ASC: "ASC",
			    DESC: "DESC"
			};
			SortByType = {
			    PUBLISH_DATE: "PUBLISH_DATE",
			    CREATION_DATE: "CREATION_DATE",
			    MODIFIED_DATE: "MODIFIED_DATE",
			    PLAYS_TOTAL: "PLAYS_TOTAL",
			    PLAYS_TRAILING_WEEK: "PLAYS_TRAILING_WEEK"
			};

			function SearchAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.SEARCH;
			}
			SearchAPI.searches = {};
			var pttp = SearchAPI.prototype = new APIModule();
			pttp.findRelatedVideos = function () {
			    var pID = this.callMethod("findRelatedVideosJS", arguments);
			    return this.getVideoSearch(pID);
			};
			pttp.findVideosByText = function () {
			    var pID = this.callMethod("findVideosByTextJS", arguments);
			    return this.getVideoSearch(pID);
			};
			pttp.findVideosByTags = function () {
			    var pID = this.callMethod("findVideosByTagsJS", arguments);
			    return this.getVideoSearch(pID);
			};
			pttp.findAllVideos = function () {
			    var pID = this.callMethod("findAllVideosJS", arguments);
			    return this.getVideoSearch(pID);
			};
			pttp.getVideoSearch = function (pID) {
			    var pSearch = SearchAPI.searches[pID];
			    if (pSearch == undefined) {
			        pSearch = new VideoSearch(pID, this.callback);
			        SearchAPI.searches[pID] = pSearch;
			    }
			    return pSearch;
			};
			pttp.getMaxItemsInMemory = function () {
			    return this.callMethod("getMaxItemsInMemory", arguments);
			};
			pttp.setMaxItemsInMemory = function () {
			    return this.callMethod("setMaxItemsInMemory", arguments);
			};

			function VideoSearch(pID, pCallback) {
			    this.id = pID;
			    this.name = APIModules.SEARCH;
			    this.callback = pCallback;
			}
			pttp = VideoSearch.prototype = new APIModule();
			pttp.id = -1;
			pttp.callMethod = function (pMethod, pArguments) {
			    if (pArguments == undefined) pArguments = [];
			    var pArgs = [this.id];
			    for (var i = 0; i < pArguments.length; i++) pArgs.push(pArguments[i]);
			    return APIModule.callFlash(this.callback, {
			        module: this.name,
			        method: pMethod,
			        params: pArgs
			    });
			};
			pttp.getItems = function () {
			    return this.callMethod("getItems", arguments);
			};
			pttp.getPage = function () {
			    return this.callMethod("getPage", arguments);
			};
			pttp.getPageAsynch = function () {
			    this.pageNumber = this.callMethod("getPageNumber");
			    return this.callMethod("getPageAsynch", arguments);
			};
			pttp.getNextPage = function () {
			    return this.callMethod("getNextPage", arguments);
			};
			pttp.getNextPageAsynch = function () {
			    return this.callMethod("getNextPageAsynch", arguments);
			};
			pttp.getPreviousPage = function () {
			    return this.callMethod("getPreviousPage", arguments);
			};
			pttp.getPreviousPageAsynch = function () {
			    return this.callMethod("getPreviousPageAsynch", arguments);
			};
			pttp.getRow = function () {
			    return this.callMethod("getRow", arguments);
			};
			pttp.getRowOnPage = function () {
			    return this.callMethod("getRowOnPage", arguments);
			};
			pttp.purgeAll = function () {
			    return this.callMethod("purgeAll", arguments);
			};
			pttp.purgePage = function () {
			    return this.callMethod("purgePage", arguments);
			};
			pttp.getTotalRows = function () {
			    return this.callMethod("getTotalRows", arguments);
			};
			pttp.getTotalPages = function () {
			    return this.callMethod("getTotalPages", arguments);
			};
			pttp.getPageNumber = function () {
			    return this.callMethod("getPageNumber", arguments);
			};
			pttp.getPageSize = function () {
			    return this.callMethod("getPageSize", arguments);
			};
			pttp.getMaxPagesInMemory = function () {
			    return this.callMethod("getMaxPagesInMemory", arguments);
			};
			pttp.setMaxPagesInMemory = function () {
			    return this.callMethod("setMaxPagesInMemory", arguments);
			};
			BCSocialEvent = {}
			BCSocialEvent.EMBED_CODE_RETRIEVED = "embedCodeRetrieved";
			BCSocialEvent.LINK_GENERATED = "linkGenerated";
			brightcove.modules[APIModules.SOCIAL] = SocialAPI;

			function SocialAPI(pExperience) {
			    this.experience = pExperience;
			    this.callback = pExperience.callback;
			    this.name = APIModules.SOCIAL;
			}
			var pttp = SocialAPI.prototype = new APIModule();
			pttp.shareVideoViaEmail = function () {
			    return this.callMethod("shareVideoViaEmail", arguments);
			};
			pttp.getEmbedCode = function () {
			    return this.callMethod("getEmbedCode", arguments);
			};
			pttp.setEmbedCode = function () {
			    return this.callMethod("setEmbedCode", arguments);
			};
			pttp.setLink = function () {
			    return this.callMethod("setLink", arguments);
			};
			pttp.getLink = function () {
			    return this.callMethod("getLink", arguments);
			};
			pttp.isURLShortenedForMedia = function () {
			    return this.callMethod("isURLShortenedForMedia", arguments);
			};
			pttp.getRSS = function () {
			    return this.callMethod("getRSS", arguments);
			};
			pttp.enableBlogging = function () {
			    return this.callMethod("enableBlogging", arguments);
			};
			if (BCMediaEvent == undefined) {
			    var BCMediaEvent = {}
			    BCMediaEvent.BEGIN = "mediaBegin";
			    BCMediaEvent.BUFFER_BEGIN = "mediaBufferBegin";
			    BCMediaEvent.BUFFER_COMPLETE = "mediaBufferComplete";
			    BCMediaEvent.CHANGE = "mediaChange";
			    BCMediaEvent.COMPLETE = "mediaComplete";
			    BCMediaEvent.ERROR = "mediaError";
			    BCMediaEvent.MUTE_CHANGE = "mediaMuteChange";
			    BCMediaEvent.PLAY = "mediaPlay";
			    BCMediaEvent.PROGRESS = "mediaProgress";
			    BCMediaEvent.SEEK = "mediaSeek";
			    BCMediaEvent.STOP = "mediaStop";
			    BCMediaEvent.VOLUME_CHANGE = "mediaVolumeChange";
			}
			var BCVideoEvent = {}
			BCVideoEvent.END_BUFFER = "endBuffering";
			BCVideoEvent.RENDITION_CHANGE = "renditionChange";
			BCVideoEvent.VIDEO_CHANGE = "videoChange";
			BCVideoEvent.VIDEO_COMPLETE = "videoComplete";
			BCVideoEvent.VIDEO_CONNECT = "videoConnect";
			BCVideoEvent.VIDEO_LOAD = "videoLoad";
			BCVideoEvent.VIDEO_PROGRESS = "videoProgress";
			BCVideoEvent.VIDEO_START = "videoStart";
			BCVideoEvent.VIDEO_STOP = "videoStop";
			BCVideoEvent.VIDEO_MUTE = "ui_mute";
			BCVideoEvent.VIDEO_SEEK = "seek";
			BCVideoEvent.START_BUFFER = "startBuffering";
			BCVideoEvent.STREAM_START = "streamStart";
			BCVideoEvent.VOLUME_CHANGE = "volumeChange";
			brightcove.modules[APIModules.VIDEO_PLAYER] = VideoPlayerAPI;

			function VideoPlayerAPI(pExperience) {
			    this.experience = pExperience;
			    if (pExperience) {
			        this.callback = pExperience.callback;
			    }
			    this.name = APIModules.VIDEO_PLAYER;
			}
			var pttp = VideoPlayerAPI.prototype = new APIModule();
			pttp.initializeComponentAPI = function () {
			    return this.callMethod("initializeComponentAPI", arguments);
			};
			pttp.getComponentAPI = function (pElementName, pElementID) {
			    if (pElementName != null) {
			        if (pElementName == "VideoPlayer" || pElementName == "VideoDisplay") {
			            var pPlayerAPI = this.experience.getModule(APIModules.VIDEO_PLAYER);
			            pPlayerAPI.initializeComponentAPI();
			            return pPlayerAPI;
			        } else if (BCComponentModules[pElementName] != null) {
			            return new BCComponentModules[pElementName](this.experience, this.callback, pElementID);
			        }
			    }
			    return null;
			};
			pttp.isPlayerDefined = function () {
			    return this.callMethod("isPlayerDefined", arguments);
			};
			pttp.setVideoFilter = function () {
			    return this.callMethod("setVideoFilter", arguments);
			};
			pttp.getCurrentVideo = function () {
			    return this.callMethod("getCurrentVideo", arguments);
			};
			pttp.getCurrentRendition = function () {
			    return this.callMethod("getCurrentRendition", arguments);
			};
			pttp.loadVideo = function () {
			    return this.callMethod("loadVideo", arguments);
			};
			pttp.cueVideo = function () {
			    return this.callMethod("cueVideo", arguments);
			};
			pttp.play = function () {
			    return this.callMethod("play", arguments);
			};
			pttp.stop = function () {
			    return this.callMethod("stop", arguments);
			};
			pttp.pause = function () {
			    return this.callMethod("pause", arguments);
			};
			pttp.seek = function () {
			    return this.callMethod("seek", arguments);
			};
			pttp.mute = function () {
			    return this.callMethod("mute", arguments);
			};
			pttp.setVolume = function () {
			    return this.callMethod("setVolume", arguments);
			};
			pttp.getVolume = function () {
			    return this.callMethod("getVolume", arguments);
			};
			pttp.showVolumeControls = function () {
			    return this.callMethod("showVolumeControls", arguments);
			};
			pttp.getVideoPosition = function () {
			    return this.callMethod("getVideoPosition", arguments);
			};
			pttp.getVideoDuration = function () {
			    return this.callMethod("getVideoDuration", arguments);
			};
			pttp.getVideoBytesLoaded = function () {
			    return this.callMethod("getVideoBytesLoaded", arguments);
			};
			pttp.getVideoBytesTotal = function () {
			    return this.callMethod("getVideoBytesTotal", arguments);
			};
			pttp.isPlaying = function () {
			    return this.callMethod("isPlaying", arguments);
			};
			pttp.isMuted = function () {
			    return this.callMethod("isMuted", arguments);
			};
			pttp.getContentTypeDisplayed = function () {
			    return this.callMethod("getContentTypeDisplayed", arguments);
			};
			pttp.setSize = function () {
			    return this.callMethod("setSize", arguments);
			};
			pttp.move = function () {
			    return this.callMethod("move", arguments);
			};
			pttp.getX = function () {
			    return this.callMethod("getX", arguments);
			};
			pttp.getY = function () {
			    return this.callMethod("getY", arguments);
			};
			pttp.getDefinition = function () {
			    return this.callMethod("getDefinition", arguments);
			};
			pttp.getID = function () {
			    return this.callMethod("getID", arguments);
			};
			pttp.getWidth = function () {
			    return this.callMethod("getWidth", arguments);
			};
			pttp.getHeight = function () {
			    return this.callMethod("getHeight", arguments);
			};
			pttp.getDisplayWidth = function () {
			    return this.callMethod("getDisplayWidth", arguments);
			};
			pttp.getDisplayHeight = function () {
			    return this.callMethod("getDisplayHeight", arguments);
			};
			pttp.getEnabled = function () {
			    return this.callMethod("getEnabled", arguments);
			};
			pttp.setStyles = function () {
			    return this.callMethod("setStyles", arguments);
			};
			pttp.setEnabled = function () {
			    return this.callMethod("setEnabled", arguments);
			};
			pttp.getVisible = function () {
			    return this.callMethod("getVisible", arguments);
			};
			pttp.setVisible = function () {
			    return this.callMethod("setVisible", arguments);
			};
			pttp.getAlpha = function () {
			    return this.callMethod("getAlpha", arguments);
			};
			pttp.setAlpha = function () {
			    return this.callMethod("setAlpha", arguments);
			};
			pttp.getBlendMode = function () {
			    return this.callMethod("getBlendMode", arguments);
			};
			pttp.setBlendMode = function () {
			    return this.callMethod("setBlendMode", arguments);
			};
			pttp.getRotation = function () {
			    return this.callMethod("getRotation", arguments);
			};
			pttp.setRotation = function () {
			    return this.callMethod("setRotation", arguments);
			};
			pttp.getIndex = function () {
			    return this.callMethod("getIndex", arguments);
			};
			pttp.toggleVolumeControls = function () {
			    return this.callMethod("toggleVolumeControls", arguments);
			};
			pttp.toggleMenuPage = function () {
			    return this.callMethod("toggleMenuPage", arguments);
			};
			pttp.getContainer = function () {
			    var pObj = this.callMethod("getContainerJS", arguments);
			    if (pObj) {
			        return this.getComponentAPI(pObj.elementName, pObj.elementID);
			    }
			    return null;
			};
			pttp.getNextSibling = function () {
			    var pObj = this.callMethod("getNextSiblingJS", arguments);
			    if (pObj) {
			        return this.getComponentAPI(pObj.elementName, pObj.elementID);
			    }
			    return null;
			};
			pttp.getPreviousSibling = function () {
			    var pObj = this.callMethod("getPreviousSiblingJS", arguments);
			    if (pObj) {
			        return this.getComponentAPI(pObj.elementName, pObj.elementID);
			    }
			    return null;
			};
			pttp.getCSS = function () {
			    return this.callMethod("getCSS", arguments);
			};
			pttp.mediaIsLive = function () {
			    return this.callMethod("mediaIsLive", arguments);
			};
			pttp.setDynamicDeliveryParameters = function () {
			    return this.callMethod("setDynamicDeliveryParameters", arguments);
			};
			pttp.removeUserMessage = function () {
			    return this.callMethod("removeUserMessage", arguments);
			};
			pttp.enableInitialBandwidthDetection = function () {
			    return this.callMethod("enableInitialBandwidthDetection", arguments);
			};
			pttp.getInitialBandwidthDetectionEnabled = function () {
			    return this.callMethod("getInitialBandwidthDetectionEnabled", arguments);
			};
			pttp.setDefaultBufferTime = function () {
			    return this.callMethod("setDefaultBufferTime", arguments);
			};
			pttp.getDefaultBufferTime = function () {
			    return this.callMethod("getDefaultBufferTime", arguments);
			};
			pttp.setConnectOnLoad = function () {
			    return this.callMethod("setConnectOnLoad", arguments);
			};
			var bcRenditionSelectionCallback;
			pttp.setRenditionSelectionCallback = function (pSelector) {
			    bcRenditionSelectionCallback = pSelector;
			    return this.callMethod("setRenditionSelectionCallbackJS", ["bcCallRenditionSelectionCallback"]);
			};

			function bcCallRenditionSelectionCallback(pContext) {
			    return bcRenditionSelectionCallback(pContext);
			};

			function ComponentAPI() {
			    this.name = APIModules.EXPERIENCE;
			}
			var pttp = ComponentAPI.prototype = new APIModule();
			pttp.callMethod = function (pMethod, pArguments) {
			    var pArgs = [];
			    for (var i = 0; i < pArguments.length; i++) pArgs.push(pArguments[i]);
			    return APIModule.callFlash(this.callback, {
			        module: this.name,
			        element: this.elementID,
			        method: "getComponentAPI",
			        componentMethod: pMethod,
			        params: pArgs
			    });
			};
			pttp.getComponentAPI = function (pElementName, pElementID) {
			    if (pElementName != null) {
			        if (pElementName == "VideoPlayer" || pElementName == "VideoDisplay") {
			            var pPlayerAPI = this.experience.getModule(APIModules.VIDEO_PLAYER);
			            pPlayerAPI.initializeComponentAPI();
			            return pPlayerAPI;
			        } else if (BCComponentModules[pElementName] != null) {
			            return new BCComponentModules[pElementName](this.experience, this.callback, pElementID);
			        }
			    }
			    return null;
			};
			pttp.setSize = function () {
			    return this.callMethod("setSize", arguments);
			};
			pttp.move = function () {
			    return this.callMethod("move", arguments);
			};
			pttp.getX = function () {
			    return this.callMethod("getX", arguments);
			};
			pttp.getY = function () {
			    return this.callMethod("getY", arguments);
			};
			pttp.getVisible = function () {
			    return this.callMethod("getVisible", arguments);
			};
			pttp.setVisible = function () {
			    return this.callMethod("setVisible", arguments);
			};
			pttp.getIncludeInLayout = function () {
			    return this.callMethod("getIncludeInLayout", arguments);
			};
			pttp.setIncludeInLayout = function () {
			    return this.callMethod("setIncludeInLayout", arguments);
			};
			pttp.getAlpha = function () {
			    return this.callMethod("getAlpha", arguments);
			};
			pttp.setAlpha = function () {
			    return this.callMethod("setAlpha", arguments);
			};
			pttp.getDefinition = function () {
			    return this.callMethod("getDefinition", arguments);
			};
			pttp.getID = function () {
			    return this.callMethod("getID", arguments);
			};
			pttp.getWidth = function () {
			    return this.callMethod("getWidth", arguments);
			};
			pttp.getHeight = function () {
			    return this.callMethod("getHeight", arguments);
			};
			pttp.getIndex = function () {
			    return this.callMethod("getIndex", arguments);
			};
			pttp.getContainer = function () {
			    var pObj = this.callMethod("getContainerJS", arguments);
			    if (pObj) {
			        return this.getComponentAPI(pObj.elementName, pObj.elementID);
			    }
			    return null;
			};
			pttp.getNextSibling = function () {
			    var pObj = this.callMethod("getNextSiblingJS", arguments);
			    if (pObj) {
			        return this.getComponentAPI(pObj.elementName, pObj.elementID);
			    }
			    return null;
			};
			pttp.getPreviousSibling = function () {
			    var pObj = this.callMethod("getPreviousSiblingJS", arguments);
			    if (pObj) {
			        return this.getComponentAPI(pObj.elementName, pObj.elementID);
			    }
			    return null;
			};

			function UIObjectAPI(pCallback, pElementID) {
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = UIObjectAPI.prototype = new ComponentAPI();
			pttp.getEnabled = function () {
			    return this.callMethod("getEnabled", arguments);
			};
			pttp.setEnabled = function () {
			    return this.callMethod("setEnabled", arguments);
			};
			pttp.getBlendMode = function () {
			    return this.callMethod("getBlendMode", arguments);
			};
			pttp.setBlendMode = function () {
			    return this.callMethod("setBlendMode", arguments);
			};
			pttp.getRotation = function () {
			    return this.callMethod("getRotation", arguments);
			};
			pttp.setRotation = function () {
			    return this.callMethod("setRotation", arguments);
			};
			pttp.setStyles = function () {
			    return this.callMethod("setStyles", arguments);
			};
			pttp.getCSS = function () {
			    return this.callMethod("getCSS", arguments);
			};
			if (BCMediaEvent == undefined) {
			    var BCMediaEvent = {}
			    BCMediaEvent.BEGIN = "mediaBegin";
			    BCMediaEvent.BUFFER_BEGIN = "mediaBufferBegin";
			    BCMediaEvent.BUFFER_COMPLETE = "mediaBufferComplete";
			    BCMediaEvent.CHANGE = "mediaChange";
			    BCMediaEvent.COMPLETE = "mediaComplete";
			    BCMediaEvent.ERROR = "mediaError";
			    BCMediaEvent.MUTE_CHANGE = "mediaMuteChange";
			    BCMediaEvent.PLAY = "mediaPlay";
			    BCMediaEvent.PROGRESS = "mediaProgress";
			    BCMediaEvent.SEEK = "mediaSeek";
			    BCMediaEvent.STOP = "mediaStop";
			    BCMediaEvent.VOLUME_CHANGE = "mediaVolumeChange";
			}
			BCComponentModules["AudioPlayer"] = AudioPlayerAPI;

			function AudioPlayerAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = AudioPlayerAPI.prototype = new ComponentAPI();
			pttp.play = function () {
			    return this.callMethod("play", arguments);
			};
			pttp.pause = function () {
			    return this.callMethod("pause", arguments);
			};
			pttp.stop = function () {
			    return this.callMethod("stop", arguments);
			};
			pttp.seek = function () {
			    return this.callMethod("seek", arguments);
			};
			pttp.mute = function () {
			    return this.callMethod("mute", arguments);
			};
			pttp.setVolume = function () {
			    return this.callMethod("setVolume", arguments);
			};
			pttp.getVolume = function () {
			    return this.callMethod("getVolume", arguments);
			};
			pttp.isPlaying = function () {
			    return this.callMethod("isPlaying", arguments);
			};
			pttp.isMuted = function () {
			    return this.callMethod("isMuted", arguments);
			};
			pttp.getMediaBytesLoaded = function () {
			    return this.callMethod("getMediaBytesLoaded", arguments);
			};
			pttp.getMediaBytesTotal = function () {
			    return this.callMethod("getMediaBytesTotal", arguments);
			};
			pttp.getMediaDuration = function () {
			    return this.callMethod("getMediaDuration", arguments);
			};
			pttp.getMediaPosition = function () {
			    return this.callMethod("getMediaPosition", arguments);
			};
			pttp.getCurrentMedia = function () {
			    return this.callMethod("getCurrentMedia", arguments);
			};
			pttp.cueMedia = function () {
			    return this.callMethod("cueMedia", arguments);
			};
			pttp.loadMedia = function () {
			    return this.callMethod("loadMedia", arguments);
			};
			BCComponentModules["Banner"] = BannerAPI;

			function BannerAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = BannerAPI.prototype = new UIObjectAPI();
			BCComponentModules["Button"] = ButtonAPI;

			function ButtonAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = ButtonAPI.prototype = new UIObjectAPI();
			pttp.getLabel = function () {
			    return this.callMethod("getLabel", arguments);
			};
			pttp.setLabel = function () {
			    return this.callMethod("setLabel", arguments);
			};
			pttp.setFont = function () {
			    return this.callMethod("setFont", arguments);
			};
			pttp.getFont = function () {
			    return this.callMethod("getFont", arguments);
			};
			pttp.setLabelSize = function () {
			    return this.callMethod("setLabelSize", arguments);
			};
			pttp.getLabelSize = function () {
			    return this.callMethod("getLabelSize", arguments);
			};
			pttp.getAutoSize = function () {
			    return this.callMethod("getAutoSize", arguments);
			};
			pttp.setAutoSize = function () {
			    return this.callMethod("setAutoSize", arguments);
			};
			pttp.getTruncateLabel = function () {
			    return this.callMethod("getTruncateLabel", arguments);
			};
			pttp.setTruncateLabel = function () {
			    return this.callMethod("setTruncateLabel", arguments);
			};
			pttp.getMultiline = function () {
			    return this.callMethod("getMultiline", arguments);
			};
			pttp.setMultiline = function () {
			    return this.callMethod("setMultiline", arguments);
			};
			pttp.getIsTruncated = function () {
			    return this.callMethod("getIsTruncated", arguments);
			};
			pttp.getLabelWidth = function () {
			    return this.callMethod("getLabelWidth", arguments);
			};
			pttp.getShowBack = function () {
			    return this.callMethod("getShowBack", arguments);
			};
			pttp.setShowBack = function () {
			    return this.callMethod("setShowBack", arguments);
			};
			pttp.getTooltip = function () {
			    return this.callMethod("getTooltip", arguments);
			};
			pttp.setTooltip = function () {
			    return this.callMethod("setTooltip", arguments);
			};
			pttp.getIconScale = function () {
			    return this.callMethod("getIconScale", arguments);
			};
			pttp.setIconScale = function () {
			    return this.callMethod("setIconScale", arguments);
			};
			pttp.getIconOffsetX = function () {
			    return this.callMethod("getIconOffsetX", arguments);
			};
			pttp.setIconOffsetX = function () {
			    return this.callMethod("setIconOffsetX", arguments);
			};
			pttp.getIconOffsetY = function () {
			    return this.callMethod("getIconOffsetY", arguments);
			};
			pttp.setIconOffsetY = function () {
			    return this.callMethod("setIconOffsetY", arguments);
			};
			pttp.getLabelOffsetX = function () {
			    return this.callMethod("getLabelOffsetX", arguments);
			};
			pttp.setLabelOffsetX = function () {
			    return this.callMethod("setLabelOffsetX", arguments);
			};
			pttp.getLabelOffsetY = function () {
			    return this.callMethod("getLabelOffsetY", arguments);
			};
			pttp.setLabelOffsetY = function () {
			    return this.callMethod("setLabelOffsetY", arguments);
			};
			pttp.getLabelBuffer = function () {
			    return this.callMethod("getLabelBuffer", arguments);
			};
			pttp.setLabelBuffer = function () {
			    return this.callMethod("setLabelBuffer", arguments);
			};
			pttp.getIconAlignmentH = function () {
			    return this.callMethod("getIconAlignmentH", arguments);
			};
			pttp.setIconAlignmentH = function () {
			    return this.callMethod("setIconAlignmentH", arguments);
			};
			pttp.getIconAlignmentV = function () {
			    return this.callMethod("getIconAlignmentV", arguments);
			};
			pttp.setIconAlignmentV = function () {
			    return this.callMethod("setIconAlignmentV", arguments);
			};
			pttp.getLabelAlignmentH = function () {
			    return this.callMethod("getLabelAlignmentH", arguments);
			};
			pttp.setLabelAlignmentH = function () {
			    return this.callMethod("setLabelAlignmentH", arguments);
			};
			pttp.getLabelAlignmentV = function () {
			    return this.callMethod("getLabelAlignmentV", arguments);
			};
			pttp.setLabelAlignmentV = function () {
			    return this.callMethod("setLabelAlignmentV", arguments);
			};
			pttp.getIconName = function () {
			    return this.callMethod("getIconName", arguments);
			};
			pttp.setIconName = function () {
			    return this.callMethod("setIconName", arguments);
			};
			BCComponentModules["ChromelessVideoPlayer"] = ChromelessVideoPlayerAPI;

			function ChromelessVideoPlayerAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			    this.initializeComponentAPI();
			}
			var pttp = ChromelessVideoPlayerAPI.prototype = new VideoPlayerAPI();
			pttp.callChromelessComponentMethod = function (pMethod, pArguments) {
			    var args = [];
			    for (var i = 0; i < pArguments.length; i++) args.push(pArguments[i]);
			    return APIModule.callFlash(this.callback, {
			        module: APIModules.EXPERIENCE,
			        element: this.elementID,
			        method: "getComponentAPI",
			        componentMethod: pMethod,
			        params: args
			    });
			};
			pttp.getControls = function () {
			    var controls = this.callChromelessComponentMethod("getControlsJS", arguments);
			    if (controls) {
			        return this.getComponentAPI(controls.elementName, controls.elementID);
			    }
			    return null;
			};
			pttp.showControls = function () {
			    return this.callChromelessComponentMethod("showControls", arguments);
			};
			pttp.getControlsVisible = function () {
			    return this.callChromelessComponentMethod("getControlsVisible", arguments);
			};
			pttp.getIncludeInLayout = function () {
			    return this.callChromelessComponentMethod("getIncludeInLayout", arguments);
			};
			pttp.setIncludeInLayout = function () {
			    return this.callChromelessComponentMethod("setIncludeInLayout", arguments);
			};
			BCComponentModules["ComboBox"] = ComboBoxAPI;

			function ComboBoxAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = ComboBoxAPI.prototype = new UIObjectAPI();
			pttp.setSelectedIndex = function () {
			    return this.callMethod("setSelectedIndex", arguments);
			};
			pttp.getSelectedIndex = function () {
			    return this.callMethod("getSelectedIndex", arguments);
			};
			pttp.getSelectedData = function () {
			    return this.callMethod("getSelectedData", arguments);
			};
			pttp.getDataAtIndex = function () {
			    return this.callMethod("getDataAtIndex", arguments);
			};
			pttp.getData = function () {
			    return this.callMethod("getData", arguments);
			};
			pttp.setData = function () {
			    return this.callMethod("setData", arguments);
			};
			pttp.getNumItems = function () {
			    return this.callMethod("getNumItems", arguments);
			};
			pttp.getScrollerWidth = function () {
			    return this.callMethod("getScrollerWidth", arguments);
			};
			pttp.setScrollerWidth = function () {
			    return this.callMethod("setScrollerWidth", arguments);
			};
			pttp.getScrollerInset = function () {
			    return this.callMethod("getScrollerInset", arguments);
			};
			pttp.setScrollerInset = function () {
			    return this.callMethod("setScrollerInset", arguments);
			};
			pttp.getItemLeading = function () {
			    return this.callMethod("getItemLeading", arguments);
			};
			pttp.setItemLeading = function () {
			    return this.callMethod("setItemLeading", arguments);
			};
			pttp.getItemInsetH = function () {
			    return this.callMethod("getItemInsetH", arguments);
			};
			pttp.setItemInsetH = function () {
			    return this.callMethod("setItemInsetH", arguments);
			};
			pttp.getItemInsetV = function () {
			    return this.callMethod("getItemInsetV", arguments);
			};
			pttp.setItemInsetV = function () {
			    return this.callMethod("setItemInsetV", arguments);
			};
			pttp.getRowHeight = function () {
			    return this.callMethod("getRowHeight", arguments);
			};
			pttp.setRowHeight = function () {
			    return this.callMethod("setRowHeight", arguments);
			};
			pttp.getLabelBufferLeft = function () {
			    return this.callMethod("getLabelBufferLeft", arguments);
			};
			pttp.setLabelBufferLeft = function () {
			    return this.callMethod("setLabelBufferLeft", arguments);
			};
			pttp.getLabelBufferRight = function () {
			    return this.callMethod("getLabelBufferRight", arguments);
			};
			pttp.setLabelBufferRight = function () {
			    return this.callMethod("setLabelBufferRight", arguments);
			};
			pttp.getLabelBufferTop = function () {
			    return this.callMethod("getLabelBufferTop", arguments);
			};
			pttp.setLabelBufferTop = function () {
			    return this.callMethod("setLabelBufferTop", arguments);
			};
			pttp.getAnimated = function () {
			    return this.callMethod("getAnimated", arguments);
			};
			pttp.setAnimated = function () {
			    return this.callMethod("setAnimated", arguments);
			};
			pttp.getLabelField = function () {
			    return this.callMethod("getLabelField", arguments);
			};
			pttp.setLabelField = function () {
			    return this.callMethod("setLabelField", arguments);
			};
			pttp.getLabel = function () {
			    return this.callMethod("getLabel", arguments);
			};
			pttp.setLabel = function () {
			    return this.callMethod("setLabel", arguments);
			};

			function ContainerAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = ContainerAPI.prototype = new UIObjectAPI();
			pttp.getHAlign = function () {
			    return this.callMethod("getHAlign", arguments);
			};
			pttp.setHAlign = function () {
			    return this.callMethod("setHAlign", arguments);
			};
			pttp.getVAlign = function () {
			    return this.callMethod("getVAlign", arguments);
			};
			pttp.setVAlign = function () {
			    return this.callMethod("setVAlign", arguments);
			};
			pttp.getBackgroundColor = function () {
			    return this.callMethod("getBackgroundColor", arguments);
			};
			pttp.setBackgroundColor = function () {
			    return this.callMethod("setBackgroundColor", arguments);
			};
			pttp.getBackgroundImage = function () {
			    return this.callMethod("getBackgroundImage", arguments);
			};
			pttp.setBackgroundImage = function () {
			    return this.callMethod("setBackgroundImage", arguments);
			};
			pttp.getGutter = function () {
			    return this.callMethod("getGutter", arguments);
			};
			pttp.setGutter = function () {
			    return this.callMethod("setGutter", arguments);
			};
			pttp.getPadding = function () {
			    return this.callMethod("getPadding", arguments);
			};
			pttp.setPadding = function () {
			    return this.callMethod("setPadding", arguments);
			};
			pttp.appendChild = function () {
			    return this.callMethod("appendChild", arguments);
			};
			pttp.insertChildAt = function () {
			    return this.callMethod("insertChildAt", arguments);
			};
			pttp.removeChildByID = function () {
			    return this.callMethod("removeChildByID", arguments);
			};
			pttp.getNumChildren = function () {
			    return this.callMethod("getNumChildren", arguments);
			};
			pttp.removeChildAt = function () {
			    return this.callMethod("removeChildAt", arguments);
			};
			pttp.getChildAt = function () {
			    var pObj = this.callMethod("getChildAtJS", arguments);
			    if (pObj) {
			        return this.getComponentAPI(pObj.elementName, pObj.elementID);
			    }
			    return null;
			};
			BCComponentModules["ExpandingBanner"] = ExpandingBannerAPI;

			function ExpandingBannerAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = ExpandingBannerAPI.prototype = new UIObjectAPI();
			pttp.expand = function () {
			    return this.callMethod("expand", arguments);
			};
			pttp.contract = function () {
			    return this.callMethod("contract", arguments);
			};
			pttp.getExpanded = function () {
			    return this.callMethod("getExpanded", arguments);
			};
			pttp.synchBannerWithExternal = function () {
			    return this.callMethod("synchBannerWithExternal", arguments);
			};
			BCComponentModules["GraphicBlock"] = GraphicBlockAPI;

			function GraphicBlockAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = GraphicBlockAPI.prototype = new UIObjectAPI();
			BCComponentModules["Image"] = ImageAPI;

			function ImageAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = ImageAPI.prototype = new UIObjectAPI();
			pttp.setSource = function () {
			    return this.callMethod("setSource", arguments);
			};
			pttp.getSource = function () {
			    return this.callMethod("getSource", arguments);
			};
			pttp.getScaleMode = function () {
			    return this.callMethod("getScaleMode", arguments);
			};
			pttp.setScaleMode = function () {
			    return this.callMethod("setScaleMode", arguments);
			};
			pttp.getHAlign = function () {
			    return this.callMethod("getHAlign", arguments);
			};
			pttp.setHAlign = function () {
			    return this.callMethod("setHAlign", arguments);
			};
			pttp.getVAlign = function () {
			    return this.callMethod("getVAlign", arguments);
			};
			pttp.setVAlign = function () {
			    return this.callMethod("setVAlign", arguments);
			};
			pttp.getURL = function () {
			    return this.callMethod("getURL", arguments);
			};
			pttp.setURL = function () {
			    return this.callMethod("setURL", arguments);
			};
			pttp.getTooltip = function () {
			    return this.callMethod("getTooltip", arguments);
			};
			pttp.setTooltip = function () {
			    return this.callMethod("setTooltip", arguments);
			};
			pttp.getInset = function () {
			    return this.callMethod("getInset", arguments);
			};
			pttp.setInset = function () {
			    return this.callMethod("setInset", arguments);
			};
			pttp.getContentWidth = function () {
			    return this.callMethod("getContentWidth", arguments);
			};
			pttp.getContentHeight = function () {
			    return this.callMethod("getContentHeight", arguments);
			};
			BCComponentModules["Label"] = LabelAPI;

			function LabelAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = LabelAPI.prototype = new UIObjectAPI();
			pttp.setText = function () {
			    return this.callMethod("setText", arguments);
			};
			pttp.getText = function () {
			    return this.callMethod("getText", arguments);
			};
			pttp.setType = function () {
			    return this.callMethod("setType", arguments);
			};
			pttp.getType = function () {
			    return this.callMethod("getType", arguments);
			};
			pttp.setFont = function () {
			    return this.callMethod("setFont", arguments);
			};
			pttp.getFont = function () {
			    return this.callMethod("getFont", arguments);
			};
			pttp.setColor = function () {
			    return this.callMethod("setColor", arguments);
			};
			pttp.getColor = function () {
			    return this.callMethod("getColor", arguments);
			};
			pttp.setTextSize = function () {
			    return this.callMethod("setTextSize", arguments);
			};
			pttp.getTextSize = function () {
			    return this.callMethod("getTextSize", arguments);
			};
			pttp.getHAlign = function () {
			    return this.callMethod("getHAlign", arguments);
			};
			pttp.setHAlign = function () {
			    return this.callMethod("setHAlign", arguments);
			};
			pttp.getVAlign = function () {
			    return this.callMethod("getVAlign", arguments);
			};
			pttp.setVAlign = function () {
			    return this.callMethod("setVAlign", arguments);
			};
			pttp.setUnderline = function () {
			    return this.callMethod("setUnderline", arguments);
			};
			pttp.getUnderline = function () {
			    return this.callMethod("getUnderline", arguments);
			};
			pttp.setHTMLEnabled = function () {
			    return this.callMethod("setHTMLEnabled", arguments);
			};
			pttp.getHTMLEnabled = function () {
			    return this.callMethod("getHTMLEnabled", arguments);
			};
			pttp.setAutoSize = function () {
			    return this.callMethod("setAutoSize", arguments);
			};
			pttp.getAutoSize = function () {
			    return this.callMethod("getAutoSize", arguments);
			};
			pttp.setTruncate = function () {
			    return this.callMethod("setTruncate", arguments);
			};
			pttp.getTruncate = function () {
			    return this.callMethod("getTruncate", arguments);
			};
			pttp.setMultiline = function () {
			    return this.callMethod("setMultiline", arguments);
			};
			pttp.getMultiline = function () {
			    return this.callMethod("getMultiline", arguments);
			};
			pttp.getIsTruncated = function () {
			    return this.callMethod("getIsTruncated", arguments);
			};
			pttp.getTextWidth = function () {
			    return this.callMethod("getTextWidth", arguments);
			};
			pttp.getTextHeight = function () {
			    return this.callMethod("getTextHeight", arguments);
			};
			BCComponentModules["LayoutBox"] = LayoutBoxAPI;

			function LayoutBoxAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = LayoutBoxAPI.prototype = new ComponentAPI();
			pttp.getHAlign = function () {
			    return this.callMethod("getHAlign", arguments);
			};
			pttp.setHAlign = function () {
			    return this.callMethod("setHAlign", arguments);
			};
			pttp.getVAlign = function () {
			    return this.callMethod("getVAlign", arguments);
			};
			pttp.setVAlign = function () {
			    return this.callMethod("setVAlign", arguments);
			};
			pttp.getBackgroundColor = function () {
			    return this.callMethod("getBackgroundColor", arguments);
			};
			pttp.setBackgroundColor = function () {
			    return this.callMethod("setBackgroundColor", arguments);
			};
			pttp.getBackgroundImage = function () {
			    return this.callMethod("getBackgroundImage", arguments);
			};
			pttp.setBackgroundImage = function () {
			    return this.callMethod("setBackgroundImage", arguments);
			};
			pttp.getGutter = function () {
			    return this.callMethod("getGutter", arguments);
			};
			pttp.setGutter = function () {
			    return this.callMethod("setGutter", arguments);
			};
			pttp.getPadding = function () {
			    return this.callMethod("getPadding", arguments);
			};
			pttp.setPadding = function () {
			    return this.callMethod("setPadding", arguments);
			};
			pttp.appendChild = function () {
			    return this.callMethod("appendChild", arguments);
			};
			pttp.insertChildAt = function () {
			    return this.callMethod("insertChildAt", arguments);
			};
			pttp.removeChildByID = function () {
			    return this.callMethod("removeChildByID", arguments);
			};
			pttp.getNumChildren = function () {
			    return this.callMethod("getNumChildren", arguments);
			};
			pttp.removeChildAt = function () {
			    return this.callMethod("removeChildAt", arguments);
			};
			pttp.getChildAt = function () {
			    var pObj = this.callMethod("getChildAtJS", arguments);
			    if (pObj) {
			        return this.getComponentAPI(pObj.elementName, pObj.elementID);
			    }
			    return null;
			};
			BCComponentModules["Link"] = LinkAPI;

			function LinkAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = LinkAPI.prototype = new UIObjectAPI();
			pttp.setText = function () {
			    return this.callMethod("setText", arguments);
			};
			pttp.getText = function () {
			    return this.callMethod("getText", arguments);
			};
			pttp.setAutoSize = function () {
			    return this.callMethod("setAutoSize", arguments);
			};
			pttp.getAutoSize = function () {
			    return this.callMethod("getAutoSize", arguments);
			};
			pttp.setFont = function () {
			    return this.callMethod("setFont", arguments);
			};
			pttp.getFont = function () {
			    return this.callMethod("getFont", arguments);
			};
			pttp.setTextSize = function () {
			    return this.callMethod("setTextSize", arguments);
			};
			pttp.getTextSize = function () {
			    return this.callMethod("getTextSize", arguments);
			};
			pttp.getHAlign = function () {
			    return this.callMethod("getHAlign", arguments);
			};
			pttp.setHAlign = function () {
			    return this.callMethod("setHAlign", arguments);
			};
			pttp.getVAlign = function () {
			    return this.callMethod("getVAlign", arguments);
			};
			pttp.setVAlign = function () {
			    return this.callMethod("setVAlign", arguments);
			};
			pttp.setMultiline = function () {
			    return this.callMethod("setMultiline", arguments);
			};
			pttp.getMultiline = function () {
			    return this.callMethod("getMultiline", arguments);
			};
			pttp.getURL = function () {
			    return this.callMethod("getURL", arguments);
			};
			pttp.setURL = function () {
			    return this.callMethod("setURL", arguments);
			};
			pttp.getTooltip = function () {
			    return this.callMethod("getTooltip", arguments);
			};
			pttp.setTooltip = function () {
			    return this.callMethod("setTooltip", arguments);
			};
			BCComponentModules["List"] = ListAPI;

			function ListAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = ListAPI.prototype = new UIObjectAPI();
			pttp.setSelectedIndex = function () {
			    return this.callMethod("setSelectedIndex", arguments);
			};
			pttp.getSelectedIndex = function () {
			    return this.callMethod("getSelectedIndex", arguments);
			};
			pttp.previous = function () {
			    return this.callMethod("previous", arguments);
			};
			pttp.next = function () {
			    return this.callMethod("next", arguments);
			};
			pttp.scrollTo = function () {
			    return this.callMethod("scrollTo", arguments);
			};
			pttp.getSelectedData = function () {
			    return this.callMethod("getSelectedData", arguments);
			};
			pttp.getDataAtIndex = function () {
			    return this.callMethod("getDataAtIndex", arguments);
			};
			pttp.getData = function () {
			    return this.callMethod("getData", arguments);
			};
			pttp.setData = function () {
			    return this.callMethod("setData", arguments);
			};
			pttp.showPlaylist = function () {
			    return this.callMethod("showPlaylist", arguments);
			};
			pttp.getNumItems = function () {
			    return this.callMethod("getNumItems", arguments);
			};
			pttp.getAutomaticAdvance = function () {
			    return this.callMethod("getAutomaticAdvance", arguments);
			};
			pttp.setAutomaticAdvance = function () {
			    return this.callMethod("setAutomaticAdvance", arguments);
			};
			pttp.getScrollerWidth = function () {
			    return this.callMethod("getScrollerWidth", arguments);
			};
			pttp.setScrollerWidth = function () {
			    return this.callMethod("setScrollerWidth", arguments);
			};
			pttp.getScrollerInset = function () {
			    return this.callMethod("getScrollerInset", arguments);
			};
			pttp.setScrollerInset = function () {
			    return this.callMethod("setScrollerInset", arguments);
			};
			pttp.getItemLeading = function () {
			    return this.callMethod("getItemLeading", arguments);
			};
			pttp.setItemLeading = function () {
			    return this.callMethod("setItemLeading", arguments);
			};
			pttp.getItemInsetH = function () {
			    return this.callMethod("getItemInsetH", arguments);
			};
			pttp.setItemInsetH = function () {
			    return this.callMethod("setItemInsetH", arguments);
			};
			pttp.getItemInsetV = function () {
			    return this.callMethod("getItemInsetV", arguments);
			};
			pttp.setItemInsetV = function () {
			    return this.callMethod("setItemInsetV", arguments);
			};
			pttp.getRowHeight = function () {
			    return this.callMethod("getRowHeight", arguments);
			};
			pttp.setRowHeight = function () {
			    return this.callMethod("setRowHeight", arguments);
			};
			BCComponentModules["Mask"] = MaskAPI;

			function MaskAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = MaskAPI.prototype = new UIObjectAPI();
			BCComponentModules["MediaControls"] = MediaControlsAPI;

			function MediaControlsAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = MediaControlsAPI.prototype = new ContainerAPI();
			BCComponentModules["Playhead"] = PlayheadAPI;

			function PlayheadAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = PlayheadAPI.prototype = new UIObjectAPI();
			pttp.getSliderWidth = function () {
			    return this.callMethod("getSliderWidth", arguments);
			};
			pttp.setSliderWidth = function () {
			    return this.callMethod("setSliderWidth", arguments);
			};
			pttp.getAutohideSlider = function () {
			    return this.callMethod("getAutohideSlider", arguments);
			};
			pttp.setAutohideSlider = function () {
			    return this.callMethod("setAutohideSlider", arguments);
			};
			if (BCLoaderEvent == undefined) {
			    var BCLoaderEvent = {};
			    BCLoaderEvent.PROGRESS = "loaderProgress";
			    BCLoaderEvent.INIT = "loaderInit";
			    BCLoaderEvent.COMPLETE = "loaderComplete";
			    BCLoaderEvent.ERROR = "loaderError";
			}
			if (BCLoaderState == undefined) {
			    var BCLoaderState = {};
			    BCLoaderState.DEFAULT = "default";
			    BCLoaderState.LOADING = "loading";
			    BCLoaderState.LOADED = "loaded";
			    BCLoaderState.ERROR = "error";
			}
			BCComponentModules["SWFLoader"] = SWFLoaderAPI;

			function SWFLoaderAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = SWFLoaderAPI.prototype = new UIObjectAPI();
			pttp.getState = function () {
			    return this.callMethod("getState", arguments);
			}
			pttp.setSource = function () {
			    return this.callMethod("setSource", arguments);
			};
			pttp.getSource = function () {
			    return this.callMethod("getSource", arguments);
			};
			pttp.callSWFMethod = function () {
			    return this.callMethod("callSWFMethod", arguments);
			};
			BCComponentModules["TabBar"] = TabBarAPI;

			function TabBarAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = TabBarAPI.prototype = new UIObjectAPI();
			pttp.setSelectedIndex = function () {
			    return this.callMethod("setSelectedIndex", arguments);
			};
			pttp.getSelectedIndex = function () {
			    return this.callMethod("getSelectedIndex", arguments);
			};
			pttp.getSelectedData = function () {
			    return this.callMethod("getSelectedData", arguments);
			};
			pttp.getDataAtIndex = function () {
			    return this.callMethod("getDataAtIndex", arguments);
			};
			pttp.getData = function () {
			    return this.callMethod("getData", arguments);
			};
			pttp.setData = function () {
			    return this.callMethod("setData", arguments);
			};
			pttp.getNumItems = function () {
			    return this.callMethod("getNumItems", arguments);
			};
			pttp.getAutoSizeTabs = function () {
			    return this.callMethod("getAutoSizeTabs", arguments);
			};
			pttp.setAutoSizeTabs = function () {
			    return this.callMethod("setAutoSizeTabs", arguments);
			};
			pttp.getTabWidth = function () {
			    return this.callMethod("getTabWidth", arguments);
			};
			pttp.setTabWidth = function () {
			    return this.callMethod("setTabWidth", arguments);
			};
			pttp.getLabelBuffer = function () {
			    return this.callMethod("getLabelBuffer", arguments);
			};
			pttp.setLabelBuffer = function () {
			    return this.callMethod("setLabelBuffer", arguments);
			};
			pttp.getLabelField = function () {
			    return this.callMethod("getLabelField", arguments);
			};
			pttp.setLabelField = function () {
			    return this.callMethod("setLabelField", arguments);
			};
			pttp.getTabPadding = function () {
			    return this.callMethod("getTabPadding", arguments);
			};
			pttp.setTabPadding = function () {
			    return this.callMethod("setTabPadding", arguments);
			};
			pttp.getTabAlign = function () {
			    return this.callMethod("getTabAlign", arguments);
			};
			pttp.setTabAlign = function () {
			    return this.callMethod("setTabAlign", arguments);
			};
			pttp.getIncludeMenu = function () {
			    return this.callMethod("getIncludeMenu", arguments);
			};
			pttp.setIncludeMenu = function () {
			    return this.callMethod("setIncludeMenu", arguments);
			};
			pttp.getMenuWidth = function () {
			    return this.callMethod("getMenuWidth", arguments);
			};
			pttp.setMenuWidth = function () {
			    return this.callMethod("setMenuWidth", arguments);
			};
			pttp.getMenuRowHeight = function () {
			    return this.callMethod("getMenuRowHeight", arguments);
			};
			pttp.setMenuRowHeight = function () {
			    return this.callMethod("setMenuRowHeight", arguments);
			};
			pttp.getMenuItemInset = function () {
			    return this.callMethod("getMenuItemInset", arguments);
			};
			pttp.setMenuItemInset = function () {
			    return this.callMethod("setMenuItemInset", arguments);
			};
			pttp.getMaxMenuRows = function () {
			    return this.callMethod("getMaxMenuRows", arguments);
			};
			pttp.setMaxMenuRows = function () {
			    return this.callMethod("setMaxMenuRows", arguments);
			};
			pttp.getHideSingleTab = function () {
			    return this.callMethod("getHideSingleTab", arguments);
			};
			pttp.setHideSingleTab = function () {
			    return this.callMethod("setHideSingleTab", arguments);
			};
			pttp.appendTab = function () {
			    return this.callMethod("appendTab", arguments);
			};
			pttp.insertTabAt = function () {
			    return this.callMethod("insertTabAt", arguments);
			};
			pttp.replaceTabAt = function () {
			    return this.callMethod("replaceTabAt", arguments);
			};
			pttp.removeTabAt = function () {
			    return this.callMethod("removeTabAt", arguments);
			};
			BCComponentModules["TextRegion"] = TextRegionAPI;

			function TextRegionAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = TextRegionAPI.prototype = new ContainerAPI();
			BCComponentModules["TileList"] = TileListAPI;

			function TileListAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = TileListAPI.prototype = new UIObjectAPI();
			pttp.setSelectedIndex = function () {
			    return this.callMethod("setSelectedIndex", arguments);
			};
			pttp.getSelectedIndex = function () {
			    return this.callMethod("getSelectedIndex", arguments);
			};
			pttp.getSelectedData = function () {
			    return this.callMethod("getSelectedData", arguments);
			};
			pttp.getDataAtIndex = function () {
			    return this.callMethod("getDataAtIndex", arguments);
			};
			pttp.getData = function () {
			    return this.callMethod("getData", arguments);
			};
			pttp.setData = function () {
			    return this.callMethod("setData", arguments);
			};
			pttp.showPlaylist = function () {
			    return this.callMethod("showPlaylist", arguments);
			};
			pttp.previous = function () {
			    return this.callMethod("previous", arguments);
			};
			pttp.next = function () {
			    return this.callMethod("next", arguments);
			};
			pttp.getNumItems = function () {
			    return this.callMethod("getNumItems", arguments);
			};
			pttp.getAutomaticAdvance = function () {
			    return this.callMethod("getAutomaticAdvance", arguments);
			};
			pttp.setAutomaticAdvance = function () {
			    return this.callMethod("setAutomaticAdvance", arguments);
			};
			pttp.getButtonOffsetX = function () {
			    return this.callMethod("getButtonOffsetX", arguments);
			};
			pttp.setButtonOffsetX = function () {
			    return this.callMethod("setButtonOffsetX", arguments);
			};
			pttp.getButtonOffsetY = function () {
			    return this.callMethod("getButtonOffsetY", arguments);
			};
			pttp.setButtonOffsetY = function () {
			    return this.callMethod("setButtonOffsetY", arguments);
			};
			pttp.getButtonSize = function () {
			    return this.callMethod("getButtonSize", arguments);
			};
			pttp.setButtonSize = function () {
			    return this.callMethod("setButtonSize", arguments);
			};
			pttp.getNumRows = function () {
			    return this.callMethod("getNumRows", arguments);
			};
			pttp.setNumRows = function () {
			    return this.callMethod("setNumRows", arguments);
			};
			pttp.getNumColumns = function () {
			    return this.callMethod("getNumColumns", arguments);
			};
			pttp.setNumColumns = function () {
			    return this.callMethod("setNumColumns", arguments);
			};
			pttp.getRowHeight = function () {
			    return this.callMethod("getRowHeight", arguments);
			};
			pttp.setRowHeight = function () {
			    return this.callMethod("setRowHeight", arguments);
			};
			pttp.getColumnWidth = function () {
			    return this.callMethod("getColumnWidth", arguments);
			};
			pttp.setColumnWidth = function () {
			    return this.callMethod("setColumnWidth", arguments);
			};
			pttp.getColumnGutter = function () {
			    return this.callMethod("getColumnGutter", arguments);
			};
			pttp.setColumnGutter = function () {
			    return this.callMethod("setColumnGutter", arguments);
			};
			pttp.getRowGutter = function () {
			    return this.callMethod("getRowGutter", arguments);
			};
			pttp.setRowGutter = function () {
			    return this.callMethod("setRowGutter", arguments);
			};
			pttp.getContentInsetV = function () {
			    return this.callMethod("getContentInsetV", arguments);
			};
			pttp.setContentInsetV = function () {
			    return this.callMethod("setContentInsetV", arguments);
			};
			pttp.getContentInsetH = function () {
			    return this.callMethod("getContentInsetH", arguments);
			};
			pttp.setContentInsetH = function () {
			    return this.callMethod("setContentInsetH", arguments);
			};
			pttp.setScrollDirection = function () {
			    return this.callMethod("setScrollDirection", arguments);
			};
			pttp.getScrollDirection = function () {
			    return this.callMethod("getScrollDirection", arguments);
			};
			pttp.getAnimationType = function () {
			    return this.callMethod("getAnimationType", arguments);
			};
			pttp.setAnimationType = function () {
			    return this.callMethod("setAnimationType", arguments);
			};
			pttp.getUseBlur = function () {
			    return this.callMethod("getUseBlur", arguments);
			};
			pttp.setUseBlur = function () {
			    return this.callMethod("setUseBlur", arguments);
			};
			pttp.showPage = function () {
			    return this.callMethod("showPage", arguments);
			};
			pttp.showNextPage = function () {
			    return this.callMethod("showNextPage", arguments);
			};
			pttp.showPreviousPage = function () {
			    return this.callMethod("showPreviousPage", arguments);
			};
			pttp.getPageIndex = function () {
			    return this.callMethod("getPageIndex", arguments);
			};
			pttp.getNumPages = function () {
			    return this.callMethod("getNumPages", arguments);
			};
			pttp.getCenterContent = function () {
			    return this.callMethod("getCenterContent", arguments);
			};
			pttp.setCenterContent = function () {
			    return this.callMethod("setCenterContent", arguments);
			};
			pttp.getColumnCount = function () {
			    return this.callMethod("getColumnCount", arguments);
			};
			pttp.getRowCount = function () {
			    return this.callMethod("getRowCount", arguments);
			};
			BCComponentModules["TitleLabel"] = TitleLabelAPI;

			function TitleLabelAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = TitleLabelAPI.prototype = new UIObjectAPI();
			pttp.setText = function () {
			    return this.callMethod("setText", arguments);
			};
			pttp.getText = function () {
			    return this.callMethod("getText", arguments);
			};
			pttp.setFont = function () {
			    return this.callMethod("setFont", arguments);
			};
			pttp.getFont = function () {
			    return this.callMethod("getFont", arguments);
			};
			pttp.setTextSize = function () {
			    return this.callMethod("setTextSize", arguments);
			};
			pttp.getTextSize = function () {
			    return this.callMethod("getTextSize", arguments);
			};
			pttp.getHAlign = function () {
			    return this.callMethod("getHAlign", arguments);
			};
			pttp.setHAlign = function () {
			    return this.callMethod("setHAlign", arguments);
			};
			pttp.getVAlign = function () {
			    return this.callMethod("getVAlign", arguments);
			};
			pttp.setVAlign = function () {
			    return this.callMethod("setVAlign", arguments);
			};
			pttp.setAutoSize = function () {
			    return this.callMethod("setAutoSize", arguments);
			};
			pttp.getAutoSize = function () {
			    return this.callMethod("getAutoSize", arguments);
			};
			pttp.setTruncate = function () {
			    return this.callMethod("setTruncate", arguments);
			};
			pttp.getTruncate = function () {
			    return this.callMethod("getTruncate", arguments);
			};
			pttp.setMultiline = function () {
			    return this.callMethod("setMultiline", arguments);
			};
			pttp.getMultiline = function () {
			    return this.callMethod("getMultiline", arguments);
			};
			pttp.getIsTruncated = function () {
			    return this.callMethod("getIsTruncated", arguments);
			};
			pttp.getTextWidth = function () {
			    return this.callMethod("getTextWidth", arguments);
			};
			pttp.getSelected = function () {
			    return this.callMethod("getSelected", arguments);
			};
			pttp.setSelected = function () {
			    return this.callMethod("setSelected", arguments);
			};
			BCComponentModules["ToggleButton"] = ToggleButtonAPI;

			function ToggleButtonAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = ToggleButtonAPI.prototype = new ButtonAPI();
			pttp.getToggledLabel = function () {
			    return this.callMethod("getToggledLabel", arguments);
			};
			pttp.setToggledLabel = function () {
			    return this.callMethod("setToggledLabel", arguments);
			};
			pttp.getToggledTooltip = function () {
			    return this.callMethod("getToggledTooltip", arguments);
			};
			pttp.setToggledTooltip = function () {
			    return this.callMethod("setToggledTooltip", arguments);
			};
			pttp.getToggledIconName = function () {
			    return this.callMethod("getToggledIconName", arguments);
			};
			pttp.setToggledIconName = function () {
			    return this.callMethod("setToggledIconName", arguments);
			};
			pttp.getIsToggled = function () {
			    return this.callMethod("getIsToggled", arguments);
			};
			pttp.setIsToggled = function () {
			    return this.callMethod("setIsToggled", arguments);
			};
			BCComponentModules["ViewStack"] = ViewStackAPI;

			function ViewStackAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = ViewStackAPI.prototype = new LayoutBoxAPI();
			pttp.getSelectedIndex = function () {
			    return this.callMethod("getSelectedIndex", arguments);
			};
			pttp.setSelectedIndex = function () {
			    return this.callMethod("setSelectedIndex", arguments);
			};
			pttp.getSelectedItemID = function () {
			    return this.callMethod("getSelectedItemID", arguments);
			};
			pttp.setSelectedItemID = function () {
			    return this.callMethod("setSelectedItemID", arguments);
			};
			BCComponentModules["VolumeControl"] = VolumeControlAPI;

			function VolumeControlAPI(pExperience, pCallback, pElementID) {
			    this.experience = pExperience;
			    this.callback = pCallback;
			    this.elementID = pElementID;
			}
			var pttp = VolumeControlAPI.prototype = new UIObjectAPI();
			pttp.getShowBack = function () {
			    return this.callMethod("getShowBack", arguments);
			};
			pttp.setShowBack = function () {
			    return this.callMethod("setShowBack", arguments);
			};
			pttp.getTooltip = function () {
			    return this.callMethod("getTooltip", arguments);
			};
			pttp.setTooltip = function () {
			    return this.callMethod("setTooltip", arguments);
			};
			pttp.getIconScale = function () {
			    return this.callMethod("getIconScale", arguments);
			};
			pttp.setIconScale = function () {
			    return this.callMethod("setIconScale", arguments);
			};
			pttp.getIconOffsetX = function () {
			    return this.callMethod("getIconOffsetX", arguments);
			};
			pttp.setIconOffsetX = function () {
			    return this.callMethod("setIconOffsetX", arguments);
			};
			pttp.getIconOffsetY = function () {
			    return this.callMethod("getIconOffsetY", arguments);
			};
			pttp.setIconOffsetY = function () {
			    return this.callMethod("setIconOffsetY", arguments);
			};
			pttp.getIconAlignmentH = function () {
			    return this.callMethod("getIconAlignmentH", arguments);
			};
			pttp.setIconAlignmentH = function () {
			    return this.callMethod("setIconAlignmentH", arguments);
			};
			pttp.getIconAlignmentV = function () {
			    return this.callMethod("getIconAlignmentV", arguments);
			};
			pttp.setIconAlignmentV = function () {
			    return this.callMethod("setIconAlignmentV", arguments);
			};
			pttp.getIconName = function () {
			    return this.callMethod("getIconName", arguments);
			};
			pttp.setIconName = function () {
			    return this.callMethod("setIconName", arguments);
			};
			pttp.getMutedTooltip = function () {
			    return this.callMethod("getMutedTooltip", arguments);
			};
			pttp.setMutedTooltip = function () {
			    return this.callMethod("setMutedTooltip", arguments);
			};
			pttp.getMutedIconName = function () {
			    return this.callMethod("getMutedIconName", arguments);
			};
			pttp.setMutedIconName = function () {
			    return this.callMethod("setMutedIconName", arguments);
			};
			pttp.getIsToggled = function () {
			    return this.callMethod("getIsToggled", arguments);
			};
			pttp.setIsToggled = function () {
			    return this.callMethod("setIsToggled", arguments);
			};
			pttp.getSliderHeight = function () {
			    return this.callMethod("getSliderHeight", arguments);
			};
			pttp.setSliderHeight = function () {
			    return this.callMethod("setSliderHeight", arguments);
			};
			pttp.getPopupHeight = function () {
			    return this.callMethod("getPopupHeight", arguments);
			};
			pttp.setPopupHeight = function () {
			    return this.callMethod("setPopupHeight", arguments);
			};
			pttp.getHorizontalPadding = function () {
			    return this.callMethod("getHorizontalPadding", arguments);
			};
			pttp.setHorizontalPadding = function () {
			    return this.callMethod("setHorizontalPadding", arguments);
			};
			pttp.getVerticalPadding = function () {
			    return this.callMethod("getVerticalPadding", arguments);
			};
			pttp.setVerticalPadding = function () {
			    return this.callMethod("setVerticalPadding", arguments);
			};
			pttp.getDirection = function () {
			    return this.callMethod("getDirection", arguments);
			};
			pttp.setDirection = function () {
			    return this.callMethod("setDirection", arguments);
			};
			pttp.getAnimated = function () {
			    return this.callMethod("getAnimated", arguments);
			};
			pttp.setAnimated = function () {
			    return this.callMethod("setAnimated", arguments);
			};
		
		
		$(document).ready(function(){
		    $(".captionToggle").live("click", function(){
		        $(".captionsContain").slideToggle("slow", function () {
		            return false;
	              });
	            $(".captionToggle").toggleClass("triangleOpen");
			});

		});
        var bcExp;
    	var modVP;
    	var modExp;
    	var modCP;
    	var username = 'usarmy';

    	 // called when template loads, this function stores a reference to the player and modules.
    	 function onTemplateLoaded(experienceID) {
    	      	bcExp = brightcove.getExperience(experienceID);
    	      	modVP = bcExp.getModule(APIModules.VIDEO_PLAYER);
    		modExp = bcExp.getModule(APIModules.EXPERIENCE);
    		modCP = bcExp.getModule(APIModules.CUE_POINTS);
    		//this is thrown when the first video is initally loaded
    		modExp.addEventListener(BCExperienceEvent.CONTENT_LOAD, onVideoLoaded);
    		//NOTE this is NOT thrown on the initial video load
    		modVP.addEventListener(BCVideoEvent.VIDEO_LOAD, onVideoLoaded);
    		modCP.addEventListener(BCCuePointEvent.CUE,onCuePoint);
    	}
    	function onVideoLoaded(evt) {
    		loadSubtitles(username, modVP.getCurrentVideo().id);
    	}
    	function onCuePoint(evt){
    		$('.captions').html(evt.cuePoint.metadata);
    	}
    	function loadSubtitles(username, brightCoveId) {
    		var url = "http://dotsub.com/media/u/" + username + "/" + brightCoveId + "/c/eng/js?callback=processCaptions";
            		// see: http://stackoverflow.com/questions/610995/jquery-cant-append-script-element
            		var script = document.createElement( 'script' );
            		script.type = 'text/javascript';
            		script.src = url;
            		$(".homePlayerContainer").append(script);
    	}
    	function processCaptions(captions) {
    		if(captions.errorCode != null) {
            			$('.captions').html("Closed captioning not available for this video");
            			//handle this as you wish error code will be 404 for not found 500 if there is a server error (which is very rare)
            		}
            		else {
            			var cuePoints = new Array();
            			var i = 0;

            			$.each(captions, function(i, c){
	

						var captions = c.content.replace("<", "").replace("%3C", "").replace("%3E", "").replace(">", "").replace("&lt;", "").replace("&gt;", "").replace("&#60;", "").replace("&#62;", "");
						
							cuePoints.push({type: 1, name:""+ c.startTime, time:  c.startTime/1000, metadata: captions});
            				//look ahead and add the 'blank time' if there is any space between subs
            				if(captions[i+1] != null) {
            					var end = c.startTime + c.duration;
            					var nextStart = captions[i+1].startTime;
            					if(end != nextStart) {
            						cuePoints.push({type: 1, name:""+ end, time: end/1000, metadata: ""});
            					}
            				}
            				i++;
            			});
            			currVid = modVP.getCurrentVideo();
            			modCP.addCuePoints(currVid.id,cuePoints);
            		}
        }
				$(document).ready(function() {
			$(".asmarine").hide();
			$(".asnavy").hide();
			$(".asairforce").hide();
			$(".ascoastguard").hide();
			$(".asmarinefooter").hide()
			$(".asnavyfooter").hide()
			$(".asairforcefooter").hide()
			$(".ascoastguardfooter").hide()
			$(".dodicon").click(function(){
				var pdiv = $(this).parent().parent().children(".aswidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");
				pdiv.children(".asdod").show()
				pdiv.parent().children(".asdodfooter").show()
				pdiv.children(".asmarine").hide();
				pdiv.parent().children(".asmarinefooter").hide()
				pdiv.children(".asnavy").hide();
				pdiv.parent().children(".asnavyfooter").hide()
				pdiv.children(".asairforce").hide();
				pdiv.parent().children(".asairforcefooter").hide()
				pdiv.children(".ascoastguard").hide();
				pdiv.parent().children(".ascoastguardfooter").hide()
			});
			$(".marineicon").click(function(){
				var pdiv = $(this).parent().parent().children(".aswidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");
				pdiv.children(".asdod").hide()
				pdiv.parent().children(".asdodfooter").hide()
				pdiv.children(".asmarine").show();
				pdiv.parent().children(".asmarinefooter").show()
				pdiv.children(".asnavy").hide();
				pdiv.parent().children(".asnavyfooter").hide()
				pdiv.children(".asairforce").hide();
				pdiv.parent().children(".asairforcefooter").hide()
				pdiv.children(".ascoastguard").hide();
				pdiv.parent().children(".ascoastguardfooter").hide()
			});
			$(".navyicon").click(function(){
				var pdiv = $(this).parent().parent().children(".aswidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");
				pdiv.children(".asdod").hide()
				pdiv.parent().children(".asdodfooter").hide()
				pdiv.children(".asmarine").hide();
				pdiv.parent().children(".asmarinefooter").hide()
				pdiv.children(".asnavy").show();
				pdiv.parent().children(".asnavyfooter").show()
				pdiv.children(".asairforce").hide();
				pdiv.parent().children(".asairforcefooter").hide()
				pdiv.children(".ascoastguard").hide();
				pdiv.parent().children(".ascoastguardfooter").hide()
			});
			$(".airforceicon").click(function(){
				var pdiv = $(this).parent().parent().children(".aswidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");
				pdiv.children(".asdod").hide()
				pdiv.parent().children(".asdodfooter").hide()
				pdiv.children(".asmarine").hide();
				pdiv.parent().children(".asmarinefooter").hide()
				pdiv.children(".asnavy").hide();
				pdiv.parent().children(".asnavyfooter").hide()
				pdiv.children(".asairforce").show();
				pdiv.parent().children(".asairforcefooter").show()
				pdiv.children(".ascoastguard").hide();
				pdiv.parent().children(".ascoastguardfooter").hide()
			});
			$(".coastguardicon").click(function(){
				var pdiv = $(this).parent().parent().children(".aswidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");
				pdiv.children(".asdod").hide()
				pdiv.parent().children(".asdodfooter").hide()
				pdiv.children(".asmarine").hide();
				pdiv.parent().children(".asmarinefooter").hide()
				pdiv.children(".asnavy").hide();
				pdiv.parent().children(".asnavyfooter").hide()
				pdiv.children(".asairforce").hide();
				pdiv.parent().children(".asairforcefooter").hide()
				pdiv.children(".ascoastguard").show();
				pdiv.parent().children(".ascoastguardfooter").show()
			});
		});
		
				/*
		 * jQuery.ScrollTo
		 * Copyright (c) 2007-2009 Ariel Flesler - | http://flesler.blogspot.com
		 * Dual licensed under MIT and GPL.
		 * Date: 5/25/2009
		 *
		 * @projectDescription Easy element scrolling using jQuery.
		 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
		 * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
		 *
		 * @author Ariel Flesler
		 * @version 1.4.2
		 */
		;(function( $ ){

			var $scrollTo = $.scrollTo = function( target, duration, settings ){
				$(window).scrollTo( target, duration, settings );
			};

			$scrollTo.defaults = {
				axis:'xy',
				duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
			};

			// Returns the element that needs to be animated to scroll the window.
			// Kept for backwards compatibility (specially for localScroll & serialScroll)
			$scrollTo.window = function( scope ){
				return $(window)._scrollable();
			};

			// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
			$.fn._scrollable = function(){
				return this.map(function(){
					var elem = this,
						isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;

						if( !isWin )
							return elem;

					var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;

					return $.browser.safari || doc.compatMode == 'BackCompat' ?
						doc.body : 
						doc.documentElement;
				});
			};

			$.fn.scrollTo = function( target, duration, settings ){
				if( typeof duration == 'object' ){
					settings = duration;
					duration = 0;
				}
				if( typeof settings == 'function' )
					settings = { onAfter:settings };

				if( target == 'max' )
					target = 9e9;

				settings = $.extend( {}, $scrollTo.defaults, settings );
				// Speed is still recognized for backwards compatibility
				duration = duration || settings.speed || settings.duration;
				// Make sure the settings are given right
				settings.queue = settings.queue && settings.axis.length > 1;

				if( settings.queue )
					// Let's keep the overall duration
					duration /= 2;
				settings.offset = both( settings.offset );
				settings.over = both( settings.over );

				return this._scrollable().each(function(){
					var elem = this,
						$elem = $(elem),
						targ = target, toff, attr = {},
						win = $elem.is('html,body');

					switch( typeof targ ){
						// A number will pass the regex
						case 'number':
						case 'string':
							if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
								targ = both( targ );
								// We are done
								break;
							}
							// Relative selector, no break!
							targ = $(targ,this);
						case 'object':
							// DOMElement / jQuery
							if( targ.is || targ.style )
								// Get the real position of the target 
								toff = (targ = $(targ)).offset();
					}
					$.each( settings.axis.split(''), function( i, axis ){
						var Pos	= axis == 'x' ? 'Left' : 'Top',
							pos = Pos.toLowerCase(),
							key = 'scroll' + Pos,
							old = elem[key],
							max = $scrollTo.max(elem, axis);

						if( toff ){// jQuery / DOMElement
							attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );

							// If it's a dom element, reduce the margin
							if( settings.margin ){
								attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
								attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
							}

							attr[key] += settings.offset[pos] || 0;

							if( settings.over[pos] )
								// Scroll to a fraction of its width/height
								attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
						}else{ 
							var val = targ[pos];
							// Handle percentage values
							attr[key] = val.slice && val.slice(-1) == '%' ? 
								parseFloat(val) / 100 * max
								: val;
						}

						// Number or 'number'
						if( /^\d+$/.test(attr[key]) )
							// Check the limits
							attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );

						// Queueing axes
						if( !i && settings.queue ){
							// Don't waste time animating, if there's no need.
							if( old != attr[key] )
								// Intermediate animation
								animate( settings.onAfterFirst );
							// Don't animate this axis again in the next iteration.
							delete attr[key];
						}
					});

					animate( settings.onAfter );			

					function animate( callback ){
						$elem.animate( attr, duration, settings.easing, callback && function(){
							callback.call(this, target, settings);
						});
					};

				}).end();
			};

			// Max scrolling position, works on quirks mode
			// It only fails (not too badly) on IE, quirks mode.
			$scrollTo.max = function( elem, axis ){
				var Dim = axis == 'x' ? 'Width' : 'Height',
					scroll = 'scroll'+Dim;

				if( !$(elem).is('html,body') )
					return elem[scroll] - $(elem)[Dim.toLowerCase()]();

				var size = 'client' + Dim,
					html = elem.ownerDocument.documentElement,
					body = elem.ownerDocument.body;

				return Math.max( html[scroll], body[scroll] ) 
					 - Math.min( html[size]  , body[size]   );

			};

			function both( val ){
				return typeof val == 'object' ? val : { top:val, left:val };
			};

		})( jQuery );

		/*!
		 * jQuery.SerialScroll
		 * Copyright (c) 2007-2008 Ariel Flesler - | http://flesler.blogspot.com
		 * Dual licensed under MIT and GPL.
		 * Date: 06/14/2009
		 *
		 * @projectDescription Animated scrolling of series.
		 * @author Ariel Flesler
		 * @version 1.2.2
		 */
		;(function( $ ){

			var $serialScroll = $.serialScroll = function( settings ){
				return $(window).serialScroll( settings );
			};

			// Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option.
			// @link {http://demos.flesler.com/jquery/scrollTo/ ScrollTo's Demo}
			$serialScroll.defaults = {// the defaults are public and can be overriden.
				duration:1000, // how long to animate.
				axis:'x', // which of top and left should be scrolled
				event:'click', // on which event to react.
				start:0, // first element (zero-based index)
				step:1, // how many elements to scroll on each action
				lock:true,// ignore events if already animating
				cycle:true, // cycle endlessly ( constant velocity )
				constant:true // use contant speed ?
			};

			$.fn.serialScroll = function( options ){

				return this.each(function(){
					var 
						settings = $.extend( {}, $serialScroll.defaults, options ),
						event = settings.event, // this one is just to get shorter code when compressed
						step = settings.step, // ditto
						lazy = settings.lazy, // ditto
						context = settings.target ? this : document, // if a target is specified, then everything's relative to 'this'.
						$pane = $(settings.target || this, context),// the element to be scrolled (will carry all the events)
						pane = $pane[0], // will be reused, save it into a variable
						items = settings.items, // will hold a lazy list of elements
						active = settings.start, // active index
						auto = settings.interval, // boolean, do auto or not
						nav = settings.navigation, // save it now to make the code shorter
						timer; // holds the interval id

					if( !lazy )// if not lazy, save the items now
						items = getItems();

					if( settings.force )
						jump( {}, active );// generate an initial call

					// Button binding, optional
					$(settings.prev||[], context).bind( event, -step, move );
					$(settings.next||[], context).bind( event, step, move );

					// Custom events bound to the container
					if( !pane.ssbound )// don't bind more than once
						$pane
							.bind('prev.serialScroll', -step, move ) // you can trigger with just 'prev'
							.bind('next.serialScroll', step, move ) // f.e: $(container).trigger('next');
							.bind('goto.serialScroll', jump ); // f.e: $(container).trigger('goto', 4 );

					if( auto )
						$pane
							.bind('start.serialScroll', function(e){
								if( !auto ){
									clear();
									auto = true;
									next();
								}
							 })
							.bind('stop.serialScroll', function(){// stop a current animation
								clear();
								auto = false;
							});

					$pane.bind('notify.serialScroll', function(e, elem){// let serialScroll know that the index changed externally
						var i = index(elem);
						if( i > -1 )
							active = i;
					});

					pane.ssbound = true;// avoid many bindings

					if( settings.jump )// can't use jump if using lazy items and a non-bubbling event
						(lazy ? $pane : getItems()).bind( event, function( e ){
							jump( e, index(e.target) );
						});

					if( nav )
						nav = $(nav, context).bind(event, function( e ){
							e.data = Math.round(getItems().length / nav.length) * nav.index(this);
							jump( e, this );
						});

					function move( e ){
						e.data += active;
						jump( e, this );
					};
					function jump( e, button ){
						if( !isNaN(button) ){// initial or special call from the outside $(container).trigger('goto',[index]);
							e.data = button;
							button = pane;
						}

						var
							pos = e.data, n,
							real = e.type, // is a real event triggering ?
							$items = settings.exclude ? getItems().slice(0,-settings.exclude) : getItems(),// handle a possible exclude
							limit = $items.length,
							elem = $items[pos],
							duration = settings.duration;

						if( real )// real event object
							e.preventDefault();

						if( auto ){
							clear();// clear any possible automatic scrolling.
							timer = setTimeout( next, settings.interval ); 
						}

						if( !elem ){ // exceeded the limits
							n = pos < 0 ? 0 : limit - 1;
							if( active != n )// we exceeded for the first time
								pos = n;
							else if( !settings.cycle )// this is a bad case
								return;
							else
								pos = limit - n - 1;// invert, go to the other side
							elem = $items[pos];
						}

						if( !elem || settings.lock && $pane.is(':animated') || // no animations while busy
							real && settings.onBefore &&
							settings.onBefore(e, elem, $pane, getItems(), pos) === false ) return;

						if( settings.stop )
							$pane.queue('fx',[]).stop();// remove all its animations

						if( settings.constant )
							duration = Math.abs(duration/step * (active - pos ));// keep constant velocity

						$pane
							.scrollTo( elem, duration, settings )// do scroll
							.trigger('notify.serialScroll',[pos]);// in case serialScroll was called on this elem more than once.
					};

					function next(){// I'll use the namespace to avoid conflicts
						$pane.trigger('next.serialScroll');
					};

					function clear(){
						clearTimeout(timer);
					};

					function getItems(){
						return $( items, pane );
					};

					function index( elem ){
						if( !isNaN(elem) ) return elem;// number
						var $items = getItems(), i;
						while(( i = $items.index(elem)) == -1 && elem != pane )// see if it matches or one of its ancestors
							elem = elem.parentNode;
						return i;
					};
				});
			};

		})( jQuery );
		
		
		$(document).ready(function() {
			$('.asmpics').serialScroll({
				items:'li',
				prev:'.asmpicsWrapper .prev',
				next:'.asmpicsWrapper .next',
				duration:400,
				force:false,
				stop:true,
				lock:false,
				step:1,
				exclude:1,
				cycle:false
			});
			
			$(".asmpicsWrapper .prev, .asmpicsWrapper .next").hover(function(){
				if ($(this).hasClass("prev")){
					$(this).css({"background-position":"0px -160px"});
				}
				else {
					$(this).css({"background-position":"-23px -160px"});
				}
			}, function(){
				if ($(this).hasClass("prev")){
					$(this).css({"background-position":"0px -40px"});
				}
				else {
					$(this).css({"background-position":"-23px -40px"});
				}
			});
			
			$(".asmtweets").hide();
			//$(".asmfbook").hide();
			$(".asmytube").hide();
			$(".asmpicsWrapper").hide();
			$(".asmtweetsfooter").hide();
			//$(".asmfbookfooter").hide();
			$(".asmpicsfooter").hide();
			$(".asmytubefooter").hide();
			$(".flickricon").click(function(){
				var pdiv = $(this).parent().parent().children(".asmwidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");	
				pdiv.children(".asmpicsWrapper").show();
				pdiv.parent().children(".asmpicsfooter").show();
				pdiv.children(".asmtweets").hide();
				pdiv.parent().children(".asmtweetsfooter").hide();
				pdiv.children(".asmfbook").hide();
				pdiv.parent().children(".asmfbookfooter").hide();
				pdiv.children(".asmytube").hide();
				pdiv.parent().children(".asmytubefooter").hide();
				pdiv.children(".asmsliderback").show();
			});
			$(".twittericon").click(function(){
				var pdiv = $(this).parent().parent().children(".asmwidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");
				pdiv.children(".asmpicsWrapper").hide();
				pdiv.parent().children(".asmpicsfooter").hide();
				pdiv.children(".asmtweets").show();
				pdiv.parent().children(".asmtweetsfooter").show();
				pdiv.children(".asmfbook").hide();
				pdiv.parent().children(".asmfbookfooter").hide();
				pdiv.children(".asmytube").hide();
				pdiv.parent().children(".asmytubefooter").hide();
				pdiv.children(".asmsliderback").hide();
			});
			$(".facebookicon").click(function(){
				var pdiv = $(this).parent().parent().children(".asmwidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");
				pdiv.children(".asmpicsWrapper").hide();
				pdiv.parent().children(".asmpicsfooter").hide();
				pdiv.children(".asmtweets").hide();
				pdiv.parent().children(".asmtweetsfooter").hide();
				pdiv.children(".asmfbook").show();
				pdiv.parent().children(".asmfbookfooter").show();
				pdiv.children(".asmytube").hide();
				pdiv.parent().children(".asmytubefooter").hide();
				pdiv.children(".asmsliderback").hide();
				pdiv.children(".asmfbook").show();
			});
			$(".youtubeicon").click(function(){
				var pdiv = $(this).parent().parent().children(".asmwidget");
				pdiv.parent().find("a").removeClass("current");
				$(this).addClass("current");
				pdiv.children(".asmpicsWrapper").hide();
				pdiv.parent().children(".asmpicsfooter").hide();
				pdiv.children(".asmtweets").hide();
				pdiv.parent().children(".asmtweetsfooter").hide();
				pdiv.children(".asmfbook").hide();
				pdiv.parent().children(".asmfbookfooter").hide();
				pdiv.children(".asmytube").show();
				pdiv.parent().children(".asmytubefooter").show();
				pdiv.children(".asmsliderback").hide();
				pdiv.children(".asmytube").html('<object><param name="movie" value="http://www.youtube.com/cp/vjVQa1PpcFOhLYpQM_5R41EXjOHLtH_biCSESeeMek0="></param><embed src="http://www.youtube.com/cp/vjVQa1PpcFOhLYpQM_5R41EXjOHLtH_biCSESeeMek0=" type="application/x-shockwave-flash" width="100%" height="' + (pdiv.children(".asmytube").width()*0.863) + '"></embed></object>');
			});
		});
		
				$(document).ready(function() {
			$(".spotlight").cycle({
				cleartype:  1,
				cleartypeNoBg: 1,
				prev: 		'.fnewsfooter .prev',
				next: 		'.fnewsfooter .next',
				fx:     	'fade',
				speed:   	400,
				timeout: 	9000
			});
			$(".fnewsfooter a").hover(function(){
				if ($(this).hasClass("prev")){
					$(".fnewsfooterleft").css({"background-position":"-206px -252px"});
				}
				else {
					$(".fnewsfooterright").css({"background-position":"-252px -252px"});
				}
			}, function(){
				if ($(this).hasClass("prev")){
					$(".fnewsfooterleft").css({"background-position":"-136px -252px"});
				}
				else {
					$(".fnewsfooterright").css({"background-position":"-182px -252px"});
				}
			});
		});
		
				$(document).ready(function(){			
			$(".armyBox").live("click", function(){
				/* helper stuff */
				function parseQuery ( query ) {
				   var Params = {};
				   if ( ! query ) {return Params;}// return empty object
				   var Pairs = query.split(/[;&]/);
				   for ( var i = 0; i < Pairs.length; i++ ) {
				      var KeyVal = Pairs[i].split('=');
				      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
				      var key = unescape( KeyVal[0] );
				      var val = unescape( KeyVal[1] );
				      val = val.replace(/\+/g, ' ');
				      Params[key] = val;
				   }
				   return Params;
				}
				function position() {
					popup.css({marginLeft: '-' + parseInt((popupW / 2),10) + 'px', width: popupW + 'px'});
					if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
						popup.css({marginTop: '-' + parseInt((popupH / 2),10) + 'px'});
					}
				}

				/* the nitty gritty. append overlay and popup divs, position them, and load them with content */
				if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
					$("body","html").css({height: "100%", width: "100%"});
					$("html").css("overflow","hidden");
					$("select").hide();
				}
				if(document.getElementById("overlay") === null){
					$("body").append("<div id='overlay'></div><div id='popup'></div>");
				}

				var overlay = $("#overlay");
				var popup = $("#popup");
				var url;
				url = $(this).attr("href");
				if (typeof(url) === "undefined"){
					url = $(this).attr("value");
				}
				var queryString = url.replace(/^[^\?]+\??/,'');
				var params = parseQuery(queryString);
				var popupW = (params['width']*1) || 668; //defaults to 668 if no paramaters were added to URL
				var popupH = (params['height']*1) || 600; //defaults to 600
				var current = (params['curr']) || 999; //defaults to 999

				position();

				if(document.getElementById("ajaxContent") != null){ // if popup already defined, just load new content
					$.ajax({
					  	url: url,
						cache: false,
						success: function(html){
							$("#ajaxContent").html(html);
							popup.fadeIn(300);
							if (window.init){ // if init() is defined, call it. use init() for any script that needs to run after the popup loads
								init();
							}
						}
					});
				}
				else {
					popup.append("<a href='' id='closeWindowButton'><span class='hide'>close</span></a><div id='ajaxContent' style='width:"+popupW+"px;height:"+popupH+"px'></div>");
					$("#closeWindowButton").css({
						"position":"relative",
						"left":popupW-30
					});
					$.ajax({
					  	url: url,
						cache: false,
						success: function(html){
							$("#ajaxContent").html(html);
							popup.fadeIn(300);
							if (window.init && current != 999){	// if curr is set, we're editing media detail, so call init() on the review media popup
								init(current);
							}
						}
					});
				}
				return false;
			}); // end armyBox click function

			$("#closeWindowButton").live("click", function(){
				var overlay = $("#overlay");
				var popup = $("#popup");
				popup.fadeOut(300, function(){
					popup.unbind().remove();
					overlay.unbind().remove();
				});
				if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
					$("body","html").css({height: "auto", width: "auto"});
					$("html").css("overflow","");
					$("select").show();
				}
				return false;
			});

		});
		
		$(document).ready(function(){
			$("body").append('<div id="overlays"><div id="overlayAll"></div></div>');
			var overlays = $("#overlays");
			var borderWidth = 6;
			var counter = 0;
			
			function setOverlays(){
				var container = $("#pageManagementCol #container");
				var cPos = container.offset();
				var cHeight = container.height();
				var cWidth = container.width();
				$("#overlayAll").css({
					"position":"absolute",
					"top":cPos.top,
					"left":cPos.left,
					"height":cHeight,
					"width":cWidth,
					"z-index":1200
				});
				
				$(".widgetBox").each(function(){
					var pos = $(this).offset();
					var height = $(this).height();
					var width = $(this).width();
					var sectionID = $(this).attr('value');
					if (counter == 0){
						overlays.append('<div id="overlay_' + sectionID + '"><a class="armyBox" href="/webpages/manage_page/?asset='+$(this).attr('name')+'&aid='+sectionID+'"></a><span class="overlayFill"></span><span class="overlayEffects"></span><span class="widgetEditIcon"></span></div>');
					}
					$("#overlay_" + sectionID + ", #overlay_" + sectionID + " a, #overlay_" + sectionID + " .overlayFill, #overlay_" + sectionID + " .overlayEffects").css({
						"position":"absolute",
						"height":height - borderWidth,
						"width":width - borderWidth
					});
					$("#overlay_" + sectionID).css({
						"top":pos.top,
						"left":pos.left,
						"z-index":1201
					}).addClass("overlay");
					$("#overlay_" + sectionID + " a").css({
						"top":0,
						"left":0,
						"z-index":1299
					});
					$("#overlay_" + sectionID + " .overlayFill").css({
						"top":0,
						"left":0,
						"z-index":1202
					});
					$("#overlay_" + sectionID + " .overlayEffects").css({
						"top":0,
						"left":0,
						"z-index":1203
					});
				});
				counter = 1;
			}
			
			$(window).resize(function(){
				setOverlays();
			});
			$(window).load(function(){
				setOverlays();
			});

			$(".overlay a").live("mouseover", function(){
				$(this).parent().addClass("hover");
			});
			$(".overlay a").live("mouseout", function(){
				$(this).parent().removeClass("hover");
			});

		});	
				/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
		 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
		 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
		 *
		 * Version: 1.0.3
		 * Requires jQuery 1.1.3+
		 * Docs: http://docs.jquery.com/Plugins/livequery
		 */

		(function($) {

		$.extend($.fn, {
			livequery: function(type, fn, fn2) {
				var self = this, q;

				// Handle different call patterns
				if ($.isFunction(type))
					fn2 = fn, fn = type, type = undefined;

				// See if Live Query already exists
				$.each( $.livequery.queries, function(i, query) {
					if ( self.selector == query.selector && self.context == query.context &&
						type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
							// Found the query, exit the each loop
							return (q = query) && false;
				});

				// Create new Live Query if it wasn't found
				q = q || new $.livequery(this.selector, this.context, type, fn, fn2);

				// Make sure it is running
				q.stopped = false;

				// Run it immediately for the first time
				q.run();

				// Contnue the chain
				return this;
			},

			expire: function(type, fn, fn2) {
				var self = this;

				// Handle different call patterns
				if ($.isFunction(type))
					fn2 = fn, fn = type, type = undefined;

				// Find the Live Query based on arguments and stop it
				$.each( $.livequery.queries, function(i, query) {
					if ( self.selector == query.selector && self.context == query.context && 
						(!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
							$.livequery.stop(query.id);
				});

				// Continue the chain
				return this;
			}
		});

		$.livequery = function(selector, context, type, fn, fn2) {
			this.selector = selector;
			this.context  = context || document;
			this.type     = type;
			this.fn       = fn;
			this.fn2      = fn2;
			this.elements = [];
			this.stopped  = false;

			// The id is the index of the Live Query in $.livequery.queries
			this.id = $.livequery.queries.push(this)-1;

			// Mark the functions for matching later on
			fn.$lqguid = fn.$lqguid || $.livequery.guid++;
			if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;

			// Return the Live Query
			return this;
		};

		$.livequery.prototype = {
			stop: function() {
				var query = this;

				if ( this.type )
					// Unbind all bound events
					this.elements.unbind(this.type, this.fn);
				else if (this.fn2)
					// Call the second function for all matched elements
					this.elements.each(function(i, el) {
						query.fn2.apply(el);
					});

				// Clear out matched elements
				this.elements = [];

				// Stop the Live Query from running until restarted
				this.stopped = true;
			},

			run: function() {
				// Short-circuit if stopped
				if ( this.stopped ) return;
				var query = this;

				var oEls = this.elements,
					els  = $(this.selector, this.context),
					nEls = els.not(oEls);

				// Set elements to the latest set of matched elements
				this.elements = els;

				if (this.type) {
					// Bind events to newly matched elements
					nEls.bind(this.type, this.fn);

					// Unbind events to elements no longer matched
					if (oEls.length > 0)
						$.each(oEls, function(i, el) {
							if ( $.inArray(el, els) < 0 )
								$.event.remove(el, query.type, query.fn);
						});
				}
				else {
					// Call the first function for newly matched elements
					nEls.each(function() {
						query.fn.apply(this);
					});

					// Call the second function for elements no longer matched
					if ( this.fn2 && oEls.length > 0 )
						$.each(oEls, function(i, el) {
							if ( $.inArray(el, els) < 0 )
								query.fn2.apply(el);
						});
				}
			}
		};

		$.extend($.livequery, {
			guid: 0,
			queries: [],
			queue: [],
			running: false,
			timeout: null,

			checkQueue: function() {
				if ( $.livequery.running && $.livequery.queue.length ) {
					var length = $.livequery.queue.length;
					// Run each Live Query currently in the queue
					while ( length-- )
						$.livequery.queries[ $.livequery.queue.shift() ].run();
				}
			},

			pause: function() {
				// Don't run anymore Live Queries until restarted
				$.livequery.running = false;
			},

			play: function() {
				// Restart Live Queries
				$.livequery.running = true;
				// Request a run of the Live Queries
				$.livequery.run();
			},

			registerPlugin: function() {
				$.each( arguments, function(i,n) {
					// Short-circuit if the method doesn't exist
					if (!$.fn[n]) return;

					// Save a reference to the original method
					var old = $.fn[n];

					// Create a new method
					$.fn[n] = function() {
						// Call the original method
						var r = old.apply(this, arguments);

						// Request a run of the Live Queries
						$.livequery.run();

						// Return the original methods result
						return r;
					}
				});
			},

			run: function(id) {
				if (id != undefined) {
					// Put the particular Live Query in the queue if it doesn't already exist
					if ( $.inArray(id, $.livequery.queue) < 0 )
						$.livequery.queue.push( id );
				}
				else
					// Put each Live Query in the queue if it doesn't already exist
					$.each( $.livequery.queries, function(id) {
						if ( $.inArray(id, $.livequery.queue) < 0 )
							$.livequery.queue.push( id );
					});

				// Clear timeout if it already exists
				if ($.livequery.timeout) clearTimeout($.livequery.timeout);
				// Create a timeout to check the queue and actually run the Live Queries
				$.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
			},

			stop: function(id) {
				if (id != undefined)
					// Stop are particular Live Query
					$.livequery.queries[ id ].stop();
				else
					// Stop all Live Queries
					$.each( $.livequery.queries, function(id) {
						$.livequery.queries[ id ].stop();
					});
			}
		});

		// Register core DOM manipulation methods
		$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');

		// Run Live Queries when the Document is ready
		$(function() { $.livequery.play(); });


		// Save a reference to the original init method
		var init = $.prototype.init;

		// Create a new init method that exposes two new properties: selector and context
		$.prototype.init = function(a,c) {
			// Call the original init and save the result
			var r = init.apply(this, arguments);

			// Copy over properties if they exist already
			if (a && a.selector)
				r.context = a.context, r.selector = a.selector;

			// Set properties
			if ( typeof a == 'string' )
				r.context = c || document, r.selector = a;

			// Return the result
			return r;
		};

		// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
		$.prototype.init.prototype = $.prototype;

		})(jQuery);
				$(document).ready(function(){
			var focusCount = 0;
			$("#librarySearchField").livequery("focus", function(){
				if (focusCount == 0){
					$(this).val("");
					$(this).css({"color":"#3d3d3d"});
					focusCount = 1;
				}
			});
			
			$(".deleteItem").live("click", function(){
				var li = $(this).parents("li");
				var value = li.attr("value");
				var filler = '\n';
				filler += '<li class="filler" value="'+value+'">\n';
				filler += '	<div class="itemOverlay"></div>\n';
				filler += '	<div class="boxLeft"></div>\n';
				filler += ' <div class="boxContent">\n';
				filler += '	<img src="http://www.army.mil/images/icon_star_100.png" height = "38px" width = "58px" alt="">\n';
				filler += '	<div class="boxText">\n';
				filler += '		<h5>Filler Content</h5>\n';
						
				filler += '		<h6><span class="author"></span></h6>\n';
				filler += '	</div>\n';
				filler += '	<a class="deleteItem" href=""><span class="hide">Delete Item</span></a>\n';
				filler += ' </div>\n';
				filler += '	<div class="boxRight"></div>\n';
				filler += '</li>\n';
				li.replaceWith(filler);
				runsortable();
				rundroppable();
				return false;
			});
			
			$("#librarySearch #searchIcon").live("click", function(){
				$("#librarySearch").submit();
			});
			
			function updateFeed(id){
				$.ajax({
				   type: "GET",
				   url: "/webpages/load_feed_items/"+id+"/1/1/",
				   success: function(msg){
				     $("#availableItems").empty().append(msg);
				   },
				   complete: function(){
					rundraggable();
					rundroppable();
				   }
				 });
				 $.ajax({
				   type: "GET",
				   url: "/webpages/load_feed_list/"+id+"/",
				   success: function(msg){
				    $("#pickFeedAndSectionSelection").replaceWith(msg);
				   }
				 });
			}
			function updateFeedAndSection(id, s_id, p){
				$.ajax({
				   type: "GET",
				   url: "/webpages/load_feed_items/"+s_id+"/"+id+"/"+p+"/",
				   success: function(msg){
				    $("#availableItems").empty().append(msg);
				   },
				   complete: function(){
					rundraggable();
					rundroppable();
				   }
				});
			}
			
			function updateLibrary(p){
				$.ajax({
				   type: "GET",
				   url: "/webpages/load_feed_library/"+p+"/",
				   success: function(msg){
				    $("#libraryPag").empty().append(msg);
				   },
				   complete: function(){}
				});
			}
			
			// ie doesn't pick up option.click, so use select.change (works with keyboard too)

			$('#pickFeedSectionSelection').livequery("change", function(){
				var id = $(this).children("option:selected").attr("value");
				//alert(id);
				updateFeed(id);
				updateLibrary(1);
			});
			$('#pickFeedAndSectionSelection').livequery("change", function(){
				var s_id = $("#pickFeedSectionSelection").attr("value");
				var id = $(this).children("option:selected").attr("value");
				//alert(s_id + "---" + id);
				updateFeedAndSection(id, s_id, 1);
				updateLibrary(1);
			});
			$('#libraryNext.active').live("click", function(){
				var s_id = $("#pickFeedSectionSelection").attr("value");
				var id = $("#pickFeedAndSectionSelection").children("option:selected").attr("value");
				var p = $(this).attr("value");
				//alert(s_id + "---" + id + "---" + p);
				updateFeedAndSection(id, s_id, p);
				updateLibrary(p);
				return false;
			});
			$('#libraryPrev.active').live("click", function(){
				var s_id = $("#pickFeedSectionSelection").attr("value");
				var id = $("#pickFeedAndSectionSelection").children("option:selected").attr("value");
				var p = $(this).attr("value");
				//alert(s_id + "---" + id);
				updateFeedAndSection(id, s_id, p);
				updateLibrary(p);
				return false;
			});
			
		});
				var _gaq = _gaq || [];
		 _gaq.push(['_setAccount', 'UA-27189539-1']);
		 _gaq.push(['_trackPageview']);

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