


//
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
//











		
		
		/*
		 *************************************************************************************************
		 MOVED TO:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js 
		 
		 - DELETE & TEST
		 *************************************************************************************************
		 */
		
					//prototype a beginsWith function
					String.prototype.startsWith = function(t, i) {
						if (i == false) {
							return (t == this.substring(0, t.length));
						} else {
							return (t.toLowerCase() == this.substring(0, t.length).toLowerCase());
						}
					}

					//prototype an endsWith function
					String.prototype.endsWith = function(t, i) {
						if (i == false) {
							return (t == this.substring(this.length - t.length));
						} else {
							return (t.toLowerCase() == this.substring(this.length - t.length).toLowerCase());
						}
					}

		
		/*
		 *************************************************************************************************
		 USED BY:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\Range.js
		 
		 SHOULD BE USING:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js ::: [ mergeDataListsIntoUniqueList(); ] 
		 *************************************************************************************************
		 */
			
				//function used to return a unique list of vals from two lists, reads in two delimited lists
				//and returns a single delimited list 
				function GetUniqueLists(valA, valB, separator) {
					//split the two lists into arrays
					var listA = valA.split(separator);
					var listB = valB.split(separator);
					var returnString = '';

					//cycle the first list and add the values to the return string if they aren't already present
					for (var i = 0; i < listA.length - 1; i++) {
						if (returnString.indexOf(separator + listA[i] + separator) == -1 && listA[i] != '') {
							returnString += listA[i] + separator;
						}
					}

					//now cycle the second list and if any values aren't present then add them to the return list
					for (var j = 0; j <= listB.length - 1; j++) {
						if (returnString.indexOf(separator + listB[j] + separator) == -1 && listB[j] != '') {
							returnString += listB[j] + separator;
						}
					}

					//trim any leading and trailing separators
					if (returnString.startsWith(separator, true) == true) {
						returnString = returnString.substring(1);
					}

					//return the finished value list
					return returnString;
				}
				
				
		/*
		 *************************************************************************************************
		 USED BY:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\Range.js
		 
		 SHOULD BE USING:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js ::: [ removeValuesFromDataList(); ] 
		 *************************************************************************************************
		 */
				//function used to remove a series of values from a list of delimited values
				function RemoveValuesFromList(list, values, separator) {
					//split both lists into arrays
					var listArray = list.split(separator);
					var valuesArray = values.split(separator);

					//the string of values to be returned   
					var returnString = '';

					//cycle the main list of values
					for (var i = 0; i < listArray.length; i++) {
						var listItem = listArray[i];
						//check we have a valid listItem to be processed
						if (listItem != '') {
							var add = true;
							//cycle the values array to see if this item should be added
							for (var j = 0; j < valuesArray.length; j++) {
								if (listItem == valuesArray[j]) {
									add = false;
								}
							}

							//if add is still set to true then we can add it
							if (add) {
								returnString += listItem + separator;
							}
						}
					}

					//return the list of accepted values
					if (returnString.endsWith(separator, true) == true) {
						returnString = returnString.substring(0, returnString.length - 1);
					}

					return returnString;
				}


		/*
		 *************************************************************************************************
		 USED BY:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\Range.js
		 
		 SHOULD BE USING:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js ::: [ getQSParameter(); ] 
		 *************************************************************************************************
		 */

				//function used to give easy access to querystring parameters
				function getQSParameter(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 results[1]; 
				}



		/*
		 *************************************************************************************************
		 USED BY:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\display\AjaxConditionalLinkManager.js(481)
		 
		 SHOULD BE USING:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js ::: [ removeValuesFromDataList(); ] 
		 *************************************************************************************************
		 */
				//function used to unescape the .NET encoding for an Ajax callback
				function UnEncodeResponse(response) {
					response = unescape(response);
					response = response.replace(/Â/g, '');
					response = response.replace(/\+/g, ' ');
					return response;
				}

/*!
 * 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,
		/*
		timeout: 0,
		data: null,
		username: null,
		password: null,
		*/
		// 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 );
					}
				};
			}

			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" );
	};

});
})();


/*
 * jQuery UI 1.7
 *
 * 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
 */
;jQuery.ui || (function($) {

var _remove = $.fn.remove,
	isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);

//Helper functions and ui object
$.ui = {
	version: "1.7",

	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
	plugin: {
		add: function(module, option, set) {
			var proto = $.ui[module].prototype;
			for(var i in set) {
				proto.plugins[i] = proto.plugins[i] || [];
				proto.plugins[i].push([option, set[i]]);
			}
		},
		call: function(instance, name, args) {
			var set = instance.plugins[name];
			if(!set || !instance.element[0].parentNode) { return; }

			for (var i = 0; i < set.length; i++) {
				if (instance.options[set[i][0]]) {
					set[i][1].apply(instance.element, args);
				}
			}
		}
	},

	contains: function(a, b) {
		return document.compareDocumentPosition
			? a.compareDocumentPosition(b) & 16
			: a !== b && a.contains(b);
	},

	hasScroll: function(el, a) {

		//If overflow is hidden, the element might have extra content, but the user wants to hide it
		if ($(el).css('overflow') == 'hidden') { return false; }

		var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
			has = false;

		if (el[scroll] > 0) { return true; }

		// TODO: determine which cases actually cause this to happen
		// if the element doesn't have the scroll set, see if it's possible to
		// set the scroll
		el[scroll] = 1;
		has = (el[scroll] > 0);
		el[scroll] = 0;
		return has;
	},

	isOverAxis: function(x, reference, size) {
		//Determines when x coordinate is over "b" element axis
		return (x > reference) && (x < (reference + size));
	},

	isOver: function(y, x, top, left, height, width) {
		//Determines when x, y coordinates is over "b" element
		return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
	},

	keyCode: {
		BACKSPACE: 8,
		CAPS_LOCK: 20,
		COMMA: 188,
		CONTROL: 17,
		DELETE: 46,
		DOWN: 40,
		END: 35,
		ENTER: 13,
		ESCAPE: 27,
		HOME: 36,
		INSERT: 45,
		LEFT: 37,
		NUMPAD_ADD: 107,
		NUMPAD_DECIMAL: 110,
		NUMPAD_DIVIDE: 111,
		NUMPAD_ENTER: 108,
		NUMPAD_MULTIPLY: 106,
		NUMPAD_SUBTRACT: 109,
		PAGE_DOWN: 34,
		PAGE_UP: 33,
		PERIOD: 190,
		RIGHT: 39,
		SHIFT: 16,
		SPACE: 32,
		TAB: 9,
		UP: 38
	}
};

// WAI-ARIA normalization
if (isFF2) {
	var attr = $.attr,
		removeAttr = $.fn.removeAttr,
		ariaNS = "http://www.w3.org/2005/07/aaa",
		ariaState = /^aria-/,
		ariaRole = /^wairole:/;

	$.attr = function(elem, name, value) {
		var set = value !== undefined;

		return (name == 'role'
			? (set
				? attr.call(this, elem, name, "wairole:" + value)
				: (attr.apply(this, arguments) || "").replace(ariaRole, ""))
			: (ariaState.test(name)
				? (set
					? elem.setAttributeNS(ariaNS,
						name.replace(ariaState, "aaa:"), value)
					: attr.call(this, elem, name.replace(ariaState, "aaa:")))
				: attr.apply(this, arguments)));
	};

	$.fn.removeAttr = function(name) {
		return (ariaState.test(name)
			? this.each(function() {
				this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
			}) : removeAttr.call(this, name));
	};
}

//jQuery plugins
$.fn.extend({
	remove: function() {
		// Safari has a native remove event which actually removes DOM elements,
		// so we have to use triggerHandler instead of trigger (#3037).
		$("*", this).add(this).each(function() {
			$(this).triggerHandler("remove");
		});
		return _remove.apply(this, arguments );
	},

	enableSelection: function() {
		return this
			.attr('unselectable', 'off')
			.css('MozUserSelect', '')
			.unbind('selectstart.ui');
	},

	disableSelection: function() {
		return this
			.attr('unselectable', 'on')
			.css('MozUserSelect', 'none')
			.bind('selectstart.ui', function() { return false; });
	},

	scrollParent: function() {
		var scrollParent;
		if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
			scrollParent = this.parents().filter(function() {
				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		} else {
			scrollParent = this.parents().filter(function() {
				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		}

		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
	}
});


//Additional selectors
$.extend($.expr[':'], {
	data: function(elem, i, match) {
		return !!$.data(elem, match[3]);
	},

	focusable: function(element) {
		var nodeName = element.nodeName.toLowerCase(),
			tabIndex = $.attr(element, 'tabindex');
		return (/input|select|textarea|button|object/.test(nodeName)
			? !element.disabled
			: 'a' == nodeName || 'area' == nodeName
				? element.href || !isNaN(tabIndex)
				: !isNaN(tabIndex))
			// the element and all of its ancestors must be visible
			// the browser may report that the area is hidden
			&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
	},

	tabbable: function(element) {
		var tabIndex = $.attr(element, 'tabindex');
		return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
	}
});


// $.widget is a factory to create jQuery plugins
// taking some boilerplate code out of the plugin code
function getter(namespace, plugin, method, args) {
	function getMethods(type) {
		var methods = $[namespace][plugin][type] || [];
		return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
	}

	var methods = getMethods('getter');
	if (args.length == 1 && typeof args[0] == 'string') {
		methods = methods.concat(getMethods('getterSetter'));
	}
	return ($.inArray(method, methods) != -1);
}

$.widget = function(name, prototype) {
	var namespace = name.split(".")[0];
	name = name.split(".")[1];

	// create plugin method
	$.fn[name] = function(options) {
		var isMethodCall = (typeof options == 'string'),
			args = Array.prototype.slice.call(arguments, 1);

		// prevent calls to internal methods
		if (isMethodCall && options.substring(0, 1) == '_') {
			return this;
		}

		// handle getter methods
		if (isMethodCall && getter(namespace, name, options, args)) {
			var instance = $.data(this[0], name);
			return (instance ? instance[options].apply(instance, args)
				: undefined);
		}

		// handle initialization and non-getter methods
		return this.each(function() {
			var instance = $.data(this, name);

			// constructor
			(!instance && !isMethodCall &&
				$.data(this, name, new $[namespace][name](this, options))._init());

			// method call
			(instance && isMethodCall && $.isFunction(instance[options]) &&
				instance[options].apply(instance, args));
		});
	};

	// create widget constructor
	$[namespace] = $[namespace] || {};
	$[namespace][name] = function(element, options) {
		var self = this;

		this.namespace = namespace;
		this.widgetName = name;
		this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
		this.widgetBaseClass = namespace + '-' + name;

		this.options = $.extend({},
			$.widget.defaults,
			$[namespace][name].defaults,
			$.metadata && $.metadata.get(element)[name],
			options);

		this.element = $(element)
			.bind('setData.' + name, function(event, key, value) {
				if (event.target == element) {
					return self._setData(key, value);
				}
			})
			.bind('getData.' + name, function(event, key) {
				if (event.target == element) {
					return self._getData(key);
				}
			})
			.bind('remove', function() {
				return self.destroy();
			});
	};

	// add widget prototype
	$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);

	// TODO: merge getter and getterSetter properties from widget prototype
	// and plugin prototype
	$[namespace][name].getterSetter = 'option';
};

$.widget.prototype = {
	_init: function() {},
	destroy: function() {
		this.element.removeData(this.widgetName)
			.removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
			.removeAttr('aria-disabled');
	},

	option: function(key, value) {
		var options = key,
			self = this;

		if (typeof key == "string") {
			if (value === undefined) {
				return this._getData(key);
			}
			options = {};
			options[key] = value;
		}

		$.each(options, function(key, value) {
			self._setData(key, value);
		});
	},
	_getData: function(key) {
		return this.options[key];
	},
	_setData: function(key, value) {
		this.options[key] = value;

		if (key == 'disabled') {
			this.element
				[value ? 'addClass' : 'removeClass'](
					this.widgetBaseClass + '-disabled' + ' ' +
					this.namespace + '-state-disabled')
				.attr("aria-disabled", value);
		}
	},

	enable: function() {
		this._setData('disabled', false);
	},
	disable: function() {
		this._setData('disabled', true);
	},

	_trigger: function(type, event, data) {
		var callback = this.options[type],
			eventName = (type == this.widgetEventPrefix
				? type : this.widgetEventPrefix + type);

		event = $.Event(event);
		event.type = eventName;

		// copy original event properties over to the new event
		// this would happen if we could call $.event.fix instead of $.Event
		// but we don't have a way to force an event to be fixed multiple times
		if (event.originalEvent) {
			for (var i = $.event.props.length, prop; i;) {
				prop = $.event.props[--i];
				event[prop] = event.originalEvent[prop];
			}
		}

		this.element.trigger(event, data);

		return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
			|| event.isDefaultPrevented());
	}
};

$.widget.defaults = {
	disabled: false
};


/** Mouse Interaction Plugin **/

$.ui.mouse = {
	_mouseInit: function() {
		var self = this;

		this.element
			.bind('mousedown.'+this.widgetName, function(event) {
				return self._mouseDown(event);
			})
			.bind('click.'+this.widgetName, function(event) {
				if(self._preventClickEvent) {
					self._preventClickEvent = false;
					event.stopImmediatePropagation();
					return false;
				}
			});

		// Prevent text selection in IE
		if ($.browser.msie) {
			this._mouseUnselectable = this.element.attr('unselectable');
			this.element.attr('unselectable', 'on');
		}

		this.started = false;
	},

	// TODO: make sure destroying one instance of mouse doesn't mess with
	// other instances of mouse
	_mouseDestroy: function() {
		this.element.unbind('.'+this.widgetName);

		// Restore text selection in IE
		($.browser.msie
			&& this.element.attr('unselectable', this._mouseUnselectable));
	},

	_mouseDown: function(event) {
		// don't let more than one widget handle mouseStart
		// TODO: figure out why we have to use originalEvent
		event.originalEvent = event.originalEvent || {};
		if (event.originalEvent.mouseHandled) { return; }

		// we may have missed mouseup (out of window)
		(this._mouseStarted && this._mouseUp(event));

		this._mouseDownEvent = event;

		var self = this,
			btnIsLeft = (event.which == 1),
			elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
			return true;
		}

		this.mouseDelayMet = !this.options.delay;
		if (!this.mouseDelayMet) {
			this._mouseDelayTimer = setTimeout(function() {
				self.mouseDelayMet = true;
			}, this.options.delay);
		}

		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
			this._mouseStarted = (this._mouseStart(event) !== false);
			if (!this._mouseStarted) {
				event.preventDefault();
				return true;
			}
		}

		// these delegates are required to keep context
		this._mouseMoveDelegate = function(event) {
			return self._mouseMove(event);
		};
		this._mouseUpDelegate = function(event) {
			return self._mouseUp(event);
		};
		$(document)
			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);

		// preventDefault() is used to prevent the selection of text here -
		// however, in Safari, this causes select boxes not to be selectable
		// anymore, so this fix is needed
		($.browser.safari || event.preventDefault());

		event.originalEvent.mouseHandled = true;
		return true;
	},

	_mouseMove: function(event) {
		// IE mouseup check - mouseup happened when mouse was out of window
		if ($.browser.msie && !event.button) {
			return this._mouseUp(event);
		}

		if (this._mouseStarted) {
			this._mouseDrag(event);
			return event.preventDefault();
		}

		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
			this._mouseStarted =
				(this._mouseStart(this._mouseDownEvent, event) !== false);
			(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
		}

		return !this._mouseStarted;
	},

	_mouseUp: function(event) {
		$(document)
			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);

		if (this._mouseStarted) {
			this._mouseStarted = false;
			this._preventClickEvent = (event.target == this._mouseDownEvent.target);
			this._mouseStop(event);
		}

		return false;
	},

	_mouseDistanceMet: function(event) {
		return (Math.max(
				Math.abs(this._mouseDownEvent.pageX - event.pageX),
				Math.abs(this._mouseDownEvent.pageY - event.pageY)
			) >= this.options.distance
		);
	},

	_mouseDelayMet: function(event) {
		return this.mouseDelayMet;
	},

	// These are placeholder methods, to be overriden by extending plugin
	_mouseStart: function(event) {},
	_mouseDrag: function(event) {},
	_mouseStop: function(event) {},
	_mouseCapture: function(event) { return true; }
};

$.ui.mouse.defaults = {
	cancel: null,
	distance: 1,
	delay: 0
};

})(jQuery);


/*
 * jQuery UI Slider 1.7
 *
 * 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/Slider
 *
 * Depends:
 *	ui.core.js
 */

(function($) {

$.widget("ui.slider", $.extend({}, $.ui.mouse, {

	_init: function() {

		var self = this, o = this.options;
		this._keySliding = false;
		this._handleIndex = null;
		this._detectOrientation();
		this._mouseInit();

		this.element
			.addClass("ui-slider"
				+ " ui-slider-" + this.orientation
				+ " ui-widget"
				+ " ui-widget-content"
				+ " ui-corner-all");

		if (o.range) {

			if (o.range === true) {
				this.range = $('<div></div>');
				if (!o.values) o.values = [this._valueMin(), this._valueMin()];
				if (o.values.length && o.values.length != 2) {
					o.values = [o.values[0], o.values[0]];
				}
			} else {
				this.range = $('<div></div>');
			}

			this.range
				.appendTo(this.element)
				.addClass("ui-slider-range")
				.html(o.rangeHtml);				//added to allow for html to be inserted into the range div
				
			if (o.range == "min" || o.range == "max") {
				this.range.addClass("ui-slider-range-" + o.range);
			}

			// note: this isn't the most fittingly semantic framework class for this element,
			// but worked best visually with a variety of themes
			this.range.addClass("ui-widget-header");

		}

		if ($(".ui-slider-handle", this.element).length == 0)
			$('<a href="#"></a>')
				.appendTo(this.element)
				.addClass("ui-slider-handle").addClass("png");

		if (o.values && o.values.length) {
			while ($(".ui-slider-handle", this.element).length < o.values.length)
				$('<a href="#"></a>')
					.appendTo(this.element)
					.addClass("ui-slider-handle").addClass("png");
		}

		this.handles = $(".ui-slider-handle", this.element)
			.addClass("ui-state-default"
				+ " ui-corner-all");

		this.handle = this.handles.eq(0);

		this.handles.add(this.range).filter("a")
			.click(function(event) { event.preventDefault(); })
			.hover(function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); })
			.focus(function() { $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus'); })
			.blur(function() { $(this).removeClass('ui-state-focus'); });

		this.handles.each(function(i) {
			$(this).data("index.ui-slider-handle", i);
		});

		this.handles.keydown(function(event) {

			var ret = true;

			var index = $(this).data("index.ui-slider-handle");

			if (self.options.disabled)
				return;

			switch (event.keyCode) {
				case $.ui.keyCode.HOME:
				case $.ui.keyCode.END:
				case $.ui.keyCode.UP:
				case $.ui.keyCode.RIGHT:
				case $.ui.keyCode.DOWN:
				case $.ui.keyCode.LEFT:
					ret = false;
					if (!self._keySliding) {
						self._keySliding = true;
						$(this).addClass("ui-state-active");
						self._start(event, index);
					}
					break;
			}

			var curVal, newVal, step = self._step();
			if (self.options.values && self.options.values.length) {
				curVal = newVal = self.values(index);
			} else {
				curVal = newVal = self.value();
			}

			switch (event.keyCode) {
				case $.ui.keyCode.HOME:
					newVal = self._valueMin();
					break;
				case $.ui.keyCode.END:
					newVal = self._valueMax();
					break;
				case $.ui.keyCode.UP:
				case $.ui.keyCode.RIGHT:
					if(curVal == self._valueMax()) return;
					newVal = curVal + step;
					break;
				case $.ui.keyCode.DOWN:
				case $.ui.keyCode.LEFT:
					if(curVal == self._valueMin()) return;
					newVal = curVal - step;
					break;
			}

			self._slide(event, index, newVal);

			return ret;

		}).keyup(function(event) {

			var index = $(this).data("index.ui-slider-handle");

			if (self._keySliding) {
				self._stop(event, index);
				self._change(event, index);
				self._keySliding = false;
				$(this).removeClass("ui-state-active");
			}

		});

		this._refreshValue();

	},

	destroy: function() {

		this.handles.remove();

		this.element
			.removeClass("ui-slider"
				+ " ui-slider-horizontal"
				+ " ui-slider-vertical"
				+ " ui-slider-disabled"
				+ " ui-widget"
				+ " ui-widget-content"
				+ " ui-corner-all")
			.removeData("slider")
			.unbind(".slider");

		this._mouseDestroy();

	},

	_mouseCapture: function(event) {

		var o = this.options;

		if (o.disabled)
			return false;

		this.elementSize = {
			width: this.element.outerWidth(),
			height: this.element.outerHeight()
		};
		this.elementOffset = this.element.offset();

		var position = { x: event.pageX, y: event.pageY };
		var normValue = this._normValueFromMouse(position);

		var distance = this._valueMax() + 1, closestHandle;
		var self = this, index;
		this.handles.each(function(i) {
			var thisDistance = Math.abs(normValue - self.values(i));
			if (distance > thisDistance) {
				distance = thisDistance;
				closestHandle = $(this);
				index = i;
			}
		});

		// workaround for bug #3736 (if both handles of a range are at 0,
		// the first is always used as the one with least distance,
		// and moving it is obviously prevented by preventing negative ranges)
		if(o.range == true && this.values(1) == o.min) {
			closestHandle = $(this.handles[++index]);
		}

		this._start(event, index);

		self._handleIndex = index;

		closestHandle
			.addClass("ui-state-active")
			.focus();
		
		var offset = closestHandle.offset();
		var mouseOverHandle = !$(event.target).parents().andSelf().is('.ui-slider-handle');
		this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
			left: event.pageX - offset.left - (closestHandle.width() / 2),
			top: event.pageY - offset.top
				- (closestHandle.height() / 2)
				- (parseInt(closestHandle.css('borderTopWidth'),10) || 0)
				- (parseInt(closestHandle.css('borderBottomWidth'),10) || 0)
				+ (parseInt(closestHandle.css('marginTop'),10) || 0)
		};

		normValue = this._normValueFromMouse(position);
		this._slide(event, index, normValue);
		return true;

	},

	_mouseStart: function(event) {
		return true;
	},

	_mouseDrag: function(event) {

		var position = { x: event.pageX, y: event.pageY };
		var normValue = this._normValueFromMouse(position);
		
		this._slide(event, this._handleIndex, normValue);

		return false;

	},

	_mouseStop: function(event) {

		this.handles.removeClass("ui-state-active");
		this._stop(event, this._handleIndex);
		this._change(event, this._handleIndex);
		this._handleIndex = null;
		this._clickOffset = null;

		return false;

	},
	
	_detectOrientation: function() {
		this.orientation = this.options.orientation == 'vertical' ? 'vertical' : 'horizontal';
	},

	_normValueFromMouse: function(position) {

		var pixelTotal, pixelMouse;
		if ('horizontal' == this.orientation) {
			pixelTotal = this.elementSize.width;
			pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
		} else {
			pixelTotal = this.elementSize.height;
			pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
		}

		var percentMouse = (pixelMouse / pixelTotal);
		if (percentMouse > 1) percentMouse = 1;
		if (percentMouse < 0) percentMouse = 0;
		if ('vertical' == this.orientation)
			percentMouse = 1 - percentMouse;

		var valueTotal = this._valueMax() - this._valueMin(),
			valueMouse = percentMouse * valueTotal,
			valueMouseModStep = valueMouse % this.options.step,
			normValue = this._valueMin() + valueMouse - valueMouseModStep;

		if (valueMouseModStep > (this.options.step / 2))
			normValue += this.options.step;

		// Since JavaScript has problems with large floats, round
		// the final value to 5 digits after the decimal point (see #4124)
		return parseFloat(normValue.toFixed(5));

	},

	_start: function(event, index) {
		this._trigger("start", event, this._uiHash(index));
	},

	_slide: function(event, index, newVal) {

		var handle = this.handles[index];

		if (this.options.values && this.options.values.length) {

			var otherVal = this.values(index ? 0 : 1);

			if ((index == 0 && newVal >= otherVal) || (index == 1 && newVal <= otherVal))
				newVal = otherVal;

			if (newVal != this.values(index)) {
				var newValues = this.values();
				newValues[index] = newVal;
				// A slide can be canceled by returning false from the slide callback
				var allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
				var otherVal = this.values(index ? 0 : 1);
				if (allowed !== false) {
					this.values(index, newVal, ( event.type == 'mousedown' && this.options.animate ), true);
				}
			}

		} else {

			if (newVal != this.value()) {
				// A slide can be canceled by returning false from the slide callback
				var allowed = this._trigger("slide", event, this._uiHash(index, newVal));
				if (allowed !== false) {
					this._setData('value', newVal, ( event.type == 'mousedown' && this.options.animate ));
				}
					
			}

		}

	},

	_stop: function(event, index) {
		this._trigger("stop", event, this._uiHash(index));
	},

	_change: function(event, index) {
		this._trigger("change", event, this._uiHash(index));
	},

	value: function(newValue) {

		if (arguments.length) {
			this._setData("value", newValue);
			this._change(null, 0);
		}

		return this._value();

	},

	values: function(index, newValue, animated, noPropagation) {

		if (arguments.length > 1) {
			this.options.values[index] = newValue;
			this._refreshValue(animated);
			if(!noPropagation) this._change(null, index);
		}

		if (arguments.length) {
			if (this.options.values && this.options.values.length) {
				return this._values(index);
			} else {
				return this.value();
			}
		} else {
			return this._values();
		}

	},

	_setData: function(key, value, animated) {

		$.widget.prototype._setData.apply(this, arguments);

		switch (key) {
			case 'orientation':

				this._detectOrientation();
				
				this.element
					.removeClass("ui-slider-horizontal ui-slider-vertical")
					.addClass("ui-slider-" + this.orientation);
				this._refreshValue(animated);
				break;
			case 'value':
				this._refreshValue(animated);
				break;
		}

	},

	_step: function() {
		var step = this.options.step;
		return step;
	},

	_value: function() {

		var val = this.options.value;
		if (val < this._valueMin()) val = this._valueMin();
		if (val > this._valueMax()) val = this._valueMax();

		return val;

	},

	_values: function(index) {

		if (arguments.length) {
			var val = this.options.values[index];
			if (val < this._valueMin()) val = this._valueMin();
			if (val > this._valueMax()) val = this._valueMax();

			return val;
		} else {
			return this.options.values;
		}

	},

	_valueMin: function() {
		var valueMin = this.options.min;
		return valueMin;
	},

	_valueMax: function() {
		var valueMax = this.options.max;
		return valueMax;
	},

	_refreshValue: function(animate) {

		var oRange = this.options.range, o = this.options, self = this;

		if (this.options.values && this.options.values.length) {
			var vp0, vp1;
			this.handles.each(function(i, j) {
				var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100;
				var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
				$(this).stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
				if (self.options.range === true) {
					if (self.orientation == 'horizontal') {
						(i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ left: valPercent + '%' }, o.animate);
						(i == 1) && self.range[animate ? 'animate' : 'css']({ width: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
					} else {
						(i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ bottom: (valPercent) + '%' }, o.animate);
						(i == 1) && self.range[animate ? 'animate' : 'css']({ height: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
					}
				}
				lastValPercent = valPercent;
			});
		} else {
			var value = this.value(),
				valueMin = this._valueMin(),
				valueMax = this._valueMax(),
				valPercent = valueMax != valueMin
					? (value - valueMin) / (valueMax - valueMin) * 100
					: 0;
			var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
			this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);

			(oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate);
			(oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
			(oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate);
			(oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
		}

	},
	
	_uiHash: function(index, value, values) {
		
		var multiple = this.options.values && this.options.values.length;
		return {
			handle: this.handles[index],
			value: value || (multiple ? this.values(index) : this.value()),
			values: values || (multiple && this.values())
		};

	}

}));

$.extend($.ui.slider, {
	getter: "value values",
	version: "1.7",
	eventPrefix: "slide",
	defaults: {
		animate: false,
		delay: 0,
		distance: 0,
		max: 100,
		min: 0,
		orientation: 'horizontal',
		range: false,
		step: 1,
		value: 0,
		values: null
	}
});

})(jQuery);


/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};




///////// CLASSES ARE CREATED 'INSIDE' NAMESPACES

///////// THEREFORE : To create class : 
										// a. createNamespace / check for existance 
										// b. Create class definition within namespace





/**
 *
 * CORE LIBRARY FUCTIONALITY
 *
 */

	/**
	 * CLASS EXTENSION FUNCTIONALITY
	 *	
	 * Self initialising utility that extends the javascript 'Object' class with the addition of a 
	 * new CLASS LEVEL method '.subClass()' that facilitates creating OOP orientated class structures
	 *
	 * The first level class of ANY HEIRACHY should extend Object:
	 *
	 ****************************************************************************************************
	 EXAMPLE :
	 
			CLASS DEFINITIONS:
			
			var a = Object.subClass(
				{
					init	: function () {}, //// This is the class constructor method
					method1 : function (a) {}, //// Class prototype methods
					method2 : function () {}
				}
			);
			
			var b = a.subClass(
				{
					init		: function () {},
					method1		: function (a,b) { this._super(a) }, //// Override method calling superclasses version of same method
					newMethod1	: function () {}
				}
			);
			
			
			CLASS USAGE:
			
			var instance_a = new a();
			var instance_b = new b();
			
		
			CLASS METHODS: 
			Class methods can be added either after creation or during constructor method

	 ****************************************************************************************************
	 * 
	 * NOTE : This does NOT affect Object.prototype therefore shouldn't cause the associated problems of doing so
	 *
	 *
	 *	- See :	http://ejohn.org/blog/simple-javascript-inheritance/
	 *			http://jsninja.com/Function_Prototypes
	 *
	 */
	 
		(function(){
			
			var initializing = false;

			// Determine if functions can be serialized
			var fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
			
			// Create a new Class that inherits from this class
			Object.subClass = function(prop) 
			{
				var _super = this.prototype;
				
				// Instantiate a base class (but only create the instance and don't run the init constructor)
				initializing	= true;
				var proto		= new this();
				initializing	= false;
				
				// Copy the properties over onto the new prototype
				for (var name in prop) {
					// Check if we're overwriting an existing function
					proto[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn)
					{
						return function() 
						{
							var tmp = this._super;
							
							// Add a new ._super() method that is the same method but on the super-class
							this._super = _super[name];
							
							// The method only need to be bound temporarily, so we remove it when we're done executing
							var ret		= fn.apply(this, arguments);
							this._super = tmp;
							
							return ret;
						};
					})(name, prop[name]) : prop[name];
				}
				
				// Dummy class constructor
				function Class() {
					// All construction is actually done in the init method
					if ( !initializing && this.init ) this.init.apply(this, arguments);
				}
				
				// Populate our constructed prototype object
				Class.prototype = proto;
				
				// Enforce the constructor
				Class.constructor = Class;
				
				// And make this class extendable
				Class.subClass = arguments.callee;
				
				return Class;
			};
		})();
  
 

 
 
 
	/**
	 * GLOBAL UTILITY CLASS instance creation
	 *
	 * Self initialising GLOBAL UTILITY CLASS instance
	 *
	 * - Creates base global namespace object 'manheim' into which all other namespaces and classes are created
	 *
	 * - Provides a global utilities object (accessed via global object 'manheim.global') that provides a series generic core utility methods:
	 *		- createNamespace(name)
	 *		- isNamespaceDefined(name)
	 *		- checkNamespaceVersion(name)
	 */
		
		(function (globalNamespace){
			
			var _global = globalNamespace;
			
			if (_global.manheim && (typeof _global.manheim != "object" || _global.manheim.NAME)) throw new Error("GlobalNamespace 'manheim' already exists in an incompatible format and will be overridden");
			
			
			/* Create base namespace object */
			_global.manheim = {};
			
			_global.manheim.NAME = "manheim";
			_global.manheim.VERSION = "1.0";
			
			
			/**
			 *********************************
			 * DEFINE 'Global' class 
			 * 
			 * Transient declaration : declare, use and destroy as currently only require single instance
			 *
			 * NOTE:	If in future wish to add CLASS LEVEL METHODS:
			 			Define in class in global scope via :
			 
						_global.manheim.Global = Object.subClass(
					
						IN PLACE OF
					
						var Global = Object.subClass(
			 *
			 *********************************
			 */
			
			var GlobalUtilities = Object.subClass(
				{
					init : function () 
					{
						this._className		= "manheim.GlobalUtilities";
						this._namespaces	= { "manheim" : "1.0" };
						//this._classes		= { this.className : "1.0"};
						
						//Page loaded status
						this._pageLoaded	= false;
						
						
						//Set page loaded status on document .ready()
						$(document).ready(function() {
							manheim.global.setPageLoadedStatus(true);
						});
						
					},
					
					/*
					className : "manheim.Global",
					
					namespaces : { "manheim" : "1.0" },
					
					classes : { this.className : true },
					*/
					
					createNamespace : function (name, version)
					{
						// Check name exists 
						if (!name) throw new Error("manheim.Global.createNamespace(): name required");
						
						// Check name doesn't begin or end with a period or contain two periods in a row
						if (name.charAt(0) == '.' || name.charAt(name.length-1) == '.' || name.indexOf("..") != -1) throw new Error("manheim.Global.createNamespace((): illegal name: " + name);
					
						// Break the name at periods and create an array of levels (the object hierarchy)
						var levels = name.split('.');

						// For each namespace component, either create an object or ensure that an object by that name already exists.
						var container = _global.manheim;
						
						for(var i = 0; i < levels.length; i++) 
						{
							var level = levels[i];
							
							//If namespace fully resolved ie manheim.a.b... instead of a.b... skip first level
							if (level != "manheim")
							{
								// If there is no property of container with this name, create an empty object.
								if (!container[level]) container[level] = {};
								
								// Else if there is already a property, make sure it is an object
								else if (typeof container[level] != "object") 
								{
									var n = levels.slice(0,i).join('.');
									throw new Error("manheim.Global.createNamespace() : " + n + " already exists and is not an object");
								}
								container = container[level];
							}
						}

						// The last container traversed above is the namespace created.
						var namespace = container;

						// It is an error to define a namespace twice. It is okay if the namespace object already exists, but it must not already have a NAME property defined.
						if (namespace.NAME) throw new Error("manheim.Global.createNamespace() : " + name  + " is already defined");

						// Initialize name and version fields of the namespace
						namespace.NAME		= name;
						namespace.VERSION	= (version) ? version : "0.0";

						// Register this namespace and version number
						this._namespaces[name] = namespace.VERSION;
						//this._namespaces[name] = namespace;

						// Return the namespace object to the caller
						return namespace;
					},
					
					
					isNamespaceDefined : function (name)
					{
						if (!name) throw new Error("manheim.Global.isNamespaceDefined() : you must supply a name");
						return name in this._namespaces;
					},
					
					
					/**
					 * Method for checking if either a 'class definition' OR a 'class instance' has been created
					 *
					 * @param	name [String]	period (".") delimited class path
					 * @return	[Boolean]
					 */
					isClassDefined : function (name)
					{
						if (!name) throw new Error("manheim.Global.isClassDefined() : you must supply a name");
						// Check name doesn't begin or end with a period or contain two periods in a row and contains a namespace : ie. contains AT LEAST one instance of (".") e.g. ("a.B" = valid) whereas ("B" = invalid)
						if (name.charAt(0) == '.' || name.charAt(name.length-1) == '.' || name.indexOf("..") != -1 || name.indexOf(".") == -1) throw new Error("manheim.Global.isClassDefined((): illegal name: " + name);
						
						// Extract namespace and Class
						var lastindex = name.lastIndexOf(".");
						
						var ns	= name.slice(0, lastindex);
						var c	= name.slice(lastindex + 1, name.length);
						//alert("ns = " + ns + " // c = " + c);
						
						//Check if namespace has been defined
						if (!this.isNamespaceDefined(ns))
						{
							return false;
						}
						else 
						{
							// Resolve namespace and test
							nsObj = this.resolveStringToNamespaceObject(ns);
							return c in nsObj;
						}
					},
					
					
					
					/**
					 * Method for resolving a period (".") delimited Namespace string to an object reference
					 *
					 * @param	namespaceString [String]	period (".") delimited class path : THIS MUST BE A VALID NAMESPACE STRING - use this.isNamespaceDefined() to test
					 * @return	[Object]					reference to namespace object
					 */
					resolveStringToNamespaceObject : function (name)
					{
						// Check name doesn't begin or end with a period or contain two periods in a row
						if (name.charAt(0) == '.' || name.charAt(name.length-1) == '.' || name.indexOf("..") != -1 || name.indexOf(".") == -1) throw new Error("manheim.Global.resolveStringToNamespaceObject((): illegal name: " + name);
						
						var s = name;
						if (!this.isNamespaceDefined(s)) return false;
						
						var a	= s.split(".");
						var objRef = _global;
						
						for (var i = 0; i < a.length; i++)
						{
							var c	= a[i];
							objRef	= objRef[c]; 
						}
						
						return objRef;
					},
					
					
					
					/**
					 * Method for resolving a period (".") delimited Namespace string to an object reference
					 *
					 * @param	namespaceString [String]	period (".") delimited class path : THIS MUST BE A VALID NAMESPACE STRING - use this.isNamespaceDefined() to test
					 * @return	[Object]					reference to namespace object
					 */
					resolveStringToClassInstanceObject : function (name)
					{
						// Check name doesn't begin or end with a period or contain two periods in a row
						if (name.charAt(0) == '.' || name.charAt(name.length-1) == '.' || name.indexOf("..") != -1 || name.indexOf(".") == -1) throw new Error("manheim.Global.resolveStringToNamespaceObject((): illegal name: " + name);
						
						// Extract namespace and Class
						var lastindex = name.lastIndexOf(".");
						
						var ns	= name.slice(0, lastindex);
						var c	= name.slice(lastindex + 1, name.length);
						
						//Check if namespace has been defined
						if (!this.isNamespaceDefined(ns)) return false;
						
						else 
						{
							// Resolve namespace and test
							nsObj = this.resolveStringToNamespaceObject(ns);
							
							if (c in nsObj) return nsObj[c];
							else 
							{
								alert("ouch : c = " + c + " // " + nsObj[c]);
								return false;
							}
						}
						
					},
					
					
					checkNamespaceVersion : function (name)
					{
						if (typeof name != "string") throw new Error("manheim.Global.checkNamespaceVersion() name '" + name + "' is not a string");
						if (!this.isNamespaceDefined(name)) throw new Error("manheim.Global.checkNamespaceVersion() : The namespace '" + name + "' is not defined");
						
						return this._namespaces[name];
					},
					
					
					isPageLoaded : function ()
					{
						return this._pageLoaded;
					},
					
					
					setPageLoadedStatus : function (b)
					{
						this._pageLoaded = b;
					}
					
				}
				
			);
			
			//Create instance of 'GlobalUtilities' class
			//Create 'manheim.portfolio' Namespace
			//_global.manheim.global = new Global();
			//_global.manheim.global.createNamespace("manheim.portfolio");
			
			try {
				_global.manheim.global = new GlobalUtilities();
				_global.manheim.global.createNamespace("manheim.portfolio", "1.0");
			}
			catch (e)
			{
				alert("!! WARNING !! \n" + e.message);
			}
			
			
		})(this);
	
	
	//alert("1: " + manheim.portfolio);
	
	
	
	//alert(this.manheim.global.namespaces["manheim.portfolio"]);
	//alert(this.manheim.global.isNamespaceDefined("manheim.portfolio"));
	//alert(this.manheim.global.checkNamespaceVersion("manheim.portfolio"));
	//alert("this should be false (isNamespaceDefined) : " + this.manheim.global.isNamespaceDefined("aaa"));
	





/// <reference path="../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />


/**
 * MANHEIM PORTFOLIO GLOBAL UTILITIES CLASS
 *
 * Self initialising UTILITY CLASS instance - as such no instance instantiation required
 * 
 * 1. Configures any core class prototype extensions
 * 2. Provides generic utility methods
 * 
 * USAGE:
 *		INITIATED		: Prior to jQuery document load therefore ready for all classes to use
 * 		METHOD ACCESS	: Methods accessed via global object : 'manheim.portfolio.global' : e.g.'manheim.portfolio.global.exampleMethod()'
 *
 *
 * - Sets up the following prototype methods:
 *
 *		- String
 *		  - String.prototype.startsWith()
 *		  - String.prototype.endsWith()
 *
 *
 * - Provides following global methods:
 *		
 *		- GENERAL
 *		  - getQueryStringParameter()
 *		  - unencodeAjaxResponse()
 *		
 *		- COMMON DISPLAY CONTROL
 *		  - switchElementClass()
 *		  - toggleElementClass()
 *		
 *		- DATA MANIPULATION 
 *		  - mergeDataListsIntoUniqueList
 *		  - removeValuesFromDataList()
 */
	 
	
	(function (){
		
		
		var Utilities = Object.subClass(
			{
				/*
				 =============================
				 CONSTANTS
				 =============================
				 */
					EVENT_PROPERTY_TYPE		: "type",
					EVENT_PROPERTY_TARGET	: "target",
					EVENT_PROPERTY_DATA		: "data",
					CONST_POSTCODE_REGEX    :  /^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$/g,				
				
				/*
				 =============================
				 CONFIGURATION PROPERTIES (instance configuration)
				 =============================
				 */
				
				
				
				/*
				 =============================
				 CONSTRUCTOR
				 =============================
				 */
					init : function ()
					{
						this._configureStringPrototypeMethods();
					},
				
				
				
				/*
				 =============================
				 INTERNAL RUN-TIME PROPERTIES
				 =============================
				 */
					_configureStringPrototypeMethods : function ()
					{
						/**
						 * String.prototype.startsWith()
						 *
						 * @runtimeScope = string object
						 *
						 * @param	string [String]				test string
						 * @param	caseSensitive [Boolean]		
						 * @return	[boolean]		
						 */
						String.prototype.startsWith = function(string, caseSensitive)
						{
							if (caseSensitive) return (string == this.substring(0, string.length));
							else return (string.toLowerCase() == this.substring(0, string.length).toLowerCase());
						}

						/**
						 * String.prototype.endsWith()
						 *
						 * @runtimeScope = string object
						 *
						 * @param	string [String]				test string
						 * @param	caseSensitive [Boolean]		
						 * @return	[boolean]	
						 */
						String.prototype.endsWith = function(string, caseSensitive)
						{
							if (caseSensitive) return (string == this.substring(this.length - string.length));
							else return (string.toLowerCase() == this.substring(this.length - string.length).toLowerCase());
						}
						
					},
				
				
				
				/*
				 =============================
				 PUBLIC METHODS
				 =============================
				 */
					/*
					 =============================
					 GENERAL
					 =============================
					*/
						/**
						 * Access to querystring parameters
						 *
						 * @param	name [String]	name of required query string parameter
						 * @return	[String]		queryString param defined by 'name'
						 */
							getQueryStringParameter : function (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 results[1]; 
							},



						/**
						 * Unescape the .NET encoding for an Ajax callback
						 *
						 * @param	response [?String]	Escaped Ajax callback response string
						 * @return	[?String]			Unescaped string
						 */
							unencodeAjaxResponse : function (response)
							{
								response = unescape(response);
								response = response.replace(/Â/g, '');
								response = response.replace(/\+/g, ' ');
								return response;
							},
					
					
					
					/*
					 =============================
					 EVENT GENERATION
					 =============================
					*/
						/**
						 * Generate event object with standardised format
						 *
						 * @param	name [String]		Event name
						 * @param	data [Object]		Event data object
						 * @param	target [Object]		Class instance object : this is a reference to the object reference to the class instance 
						 * @return	[Object]			event object
						 */
							generateEventObject : function (type, data, target)
							{
								var e = {};
								e[this.EVENT_PROPERTY_TYPE] = type;
								e[this.EVENT_PROPERTY_DATA] = data;
								e[this.EVENT_PROPERTY_TARGET] = target;
								
								return e;
							},
						
					
					
					/*
					 =============================
					 COMMON DISPLAY CONTROL
					 =============================
					*/
						/*
						 * Switch supplied classes on a given element 
						 * 
						 * - Toggle a single class on a given element an element
						 * - If element has 'class1' it is replaced with 'class2' else vice-versa
						 *
						 * @param	element [resolved jQueryObject]	target jQuery element
						 * @param	class1	[String]
						 * @param	class2	[String]
						 */
							switchElementClass : function (element, class1, class2) 
							{
								if (element.hasClass(class1)) element.removeClass(class1).addClass(class2); 
								else element.removeClass(class2).addClass(class1);
							},



						/*
						 * Toggle element class 
						 * 
						 * - Toggle a single class on a given element an element
						 */
							toggleElementClass : function (element, className) 
							{
								if (element.hasClass(className)) element.removeClass(className);
								else element.addClass(className);
							},


					/*
					=============================
					Validation Methods
					=============================
					*/
					
						validatePostcode : function(postcode)
						{				
							//the postcode needs a space
							if (postcode.indexOf(' ') == -1 && postcode != '') {
								postcode = postcode.substr(0, postcode.length - 3) + ' ' + postcode.substr(postcode.length - 3, 3);
							}
					        
							var re = new RegExp(this.CONST_POSTCODE_REGEX);
							return postcode.match(re);					
						},
					
					
					/*
					 =============================
					 DATA MANIPULATION
					 =============================
					*/
						/*
						 * mergeDataIntoUniqueList ..... [previously know as 'GetUniqueLists']
						 *
						 * Merge 2 delimited (common delimiter) data lists into one, removing data duplications
						 * 
						 * @param	dataListA	[String]	String of delimited data values
						 * @param	dataListB	[String]	String of delimited data values
						 * @param	delimiter	[String]	String representing data separater used in listA and listB
						 */
							mergeDataListsIntoUniqueList : function (dataListA, dataListB, delimiter) 
							{
								//split the two lists into arrays
								var a = dataListA.split(delimiter);
								var b = dataListB.split(delimiter);
								
								// Add initial delimiter for existance checking (cleaned and removed at end);
								var returnString = delimiter;

								//cycle the first list and add the values to the return string if they aren't already present
								for (var i = 0; i < a.length; i++) {
									if (returnString.indexOf(delimiter + a[i] + delimiter) == -1 && a[i] != '') {
										returnString += a[i] + delimiter;
									}
								}

								//now cycle the second list and if any values aren't present then add them to the return list
								for (var j = 0; j < b.length; j++) {
									if (returnString.indexOf(delimiter + b[j] + delimiter) == -1 && b[j] != '') {
										returnString += b[j] + delimiter;
									}
								}

								//trim any leading and trailing separators
								if (returnString.startsWith(delimiter, true)) returnString = returnString.substring(1);
								if (returnString.endsWith(delimiter, true)) returnString = returnString.substring(0, returnString.length-1);
								
								//return the finished value list
								return returnString;
							},


						/*
						 * removeValuesFromDataList ..... [previously know as 'removeValuesFromList']
						 *
						 * Remove a series of data values from a defined list of delimited data
						 * 
						 * @param	dataList	[String]	String of delimited data values from which to remove 'valuesList' data
						 * @param	valuesList	[String]	String of delimited data values to remove from 'dataList'
						 * @param	delimiter	[String]	String representing data separater used in listA and listB
						 */
							removeValuesFromDataList : function (dataList, valuesList, delimiter) 
							{
								//split both lists into arrays
								var data	= dataList.split(delimiter);
								var values	= valuesList.split(delimiter);

								//the string of values to be returned   
								var returnString = '';

								//cycle the main list of values
								for (var i = 0; i < data.length; i++) 
								{
									var item = data[i];
									//check we have a valid listItem to be processed
									if (item != '') 
									{
										var add = true;
										//cycle the values array to see if this item should be added
										for (var j = 0; j < values.length; j++) 
										{
											if (item == values[j]) add = false;
										}

										//if add is still set to true then we can add it
										if (add) returnString += item + delimiter;
									}
								}

								//trim any leading and trailing separators
								if (returnString.endsWith(delimiter, true)) returnString = returnString.substring(0, returnString.length-1);

								//return the finished value list
								return returnString;
							},
				
				/*
				=============================
				UVL Module Methods
				=============================
				*/
					DEBUG					: false,
					ARGUMENT_WORKFLOW		: "wflw",
					
					getScopedWorkflowKey: function(element, workflowAction)
					{
						// form.action e.g. /results.aspx?wflw=se_de_se
						
						// get url
						var submitUrl = ($(element).attr("action"))? $(element).attr("action") : $(element).attr("href");
						
						return this.getScopedWorkflowKeyFromUrl(submitUrl,workflowAction);
					},
					
					
					getScopedWorkflowKeyFromUrl: function(url,workflowAction)
					{
						var submitUrl = url;
						
						// get indexes
						var startIndex = submitUrl.indexOf(this.ARGUMENT_WORKFLOW) + this.ARGUMENT_WORKFLOW.length + 1; // start after wflw=
						var endIndex = submitUrl.indexOf("&",startIndex);
						
						// get full workflow
						var wflw
						if (endIndex != -1)
						{
							wflw = submitUrl.substring(startIndex,endIndex);
						}
						else
						{
							wflw = submitUrl.substring(startIndex);
						}
						
						if (workflowAction != null)
						{
							// now we have the scoped workflow trim off the action + "_" and add the relavant search action
							wflw = wflw.substring(0, wflw.length -3) + workflowAction;
						}
						
						this._debugtrace("Resolved workflow of " + wflw + "to fire.");
						
						return wflw;
					},
				
				
				
				/*
				 =============================
				 INTERNAL METHODS
				 =============================
				 */
					/*
					 =============================
					 UTILITIES
					 =============================
					 */
					 
					_debugtrace: function(message)
					{
						if (this.DEBUG)
						{
							alert(message);
						}
					}
					 
					/*
					 =============================
					 SETUP
					 =============================
					 */
					/*
					 =============================
					 DISPLAY CREATION
					 =============================
					 */
					/*
					 =============================
					 DISPLAY CONTROL
					 =============================
					 */
					/*
					 =============================
					 INTERNAL EVENT HANDLERS
					 =============================
					 */
			}	
		);
		
		
		
		try {
			// Check that namespace into which the Class definition will be creates has been defined & if not then create
			if (!manheim.global.isNamespaceDefined("manheim.portfolio.global")) manheim.global.createNamespace("manheim.portfolio.global", "1.0");
			
			// Create instance
			manheim.portfolio.global.Utilites = new Utilities();
		}
		catch (e)
		{
			alert("!! WARNING !! \n" + e.message);
		}
		
		
		
		
	})();
	
	
	// Method testing:
	// alert("manheim.portfolio.global.Utilites >> mergeDataListsIntoUniqueList = " + manheim.portfolio.global.Utilites.mergeDataListsIntoUniqueList("a,b,c,d,e,f,g,h,i,j", "a,c,e,f,j,k,l,m,n,o,p,q,r", ","));
	// alert("manheim.portfolio.global.Utilites >> removeValuesFromDataList = " + manheim.portfolio.global.Utilites.removeValuesFromDataList("a,b,c,d,e,f,g,h,i,j", "a,f,k,l", ","));
	
	
	//alert("manheim.portfolio.global.Utilites ::  Class definition successful");

/*=:project
  scalable Inman Flash Replacement (sIFR) version 3, revision 419

  =:file
    Copyright: 2006 Mark Wubben.
    Author: Mark Wubben, <http://novemberborn.net/>

  =:history
    * IFR: Shaun Inman
    * sIFR 1: Mike Davidson, Shaun Inman and Tomas Jogin
    * sIFR 2: Mike Davidson, Shaun Inman, Tomas Jogin and Mark Wubben

  =:license
    This software is licensed and provided under the CC-GNU LGPL.
    See <http://creativecommons.org/licenses/LGPL/2.1/>    
*/

var parseSelector = $;

var sIFR=new function(){var O=this;var E={ACTIVE:"sIFR-active",REPLACED:"sIFR-replaced",IGNORE:"sIFR-ignore",ALTERNATE:"sIFR-alternate",CLASS:"sIFR-class",LAYOUT:"sIFR-layout",FLASH:"sIFR-flash",FIX_FOCUS:"sIFR-fixfocus",DUMMY:"sIFR-dummy"};E.IGNORE_CLASSES=[E.REPLACED,E.IGNORE,E.ALTERNATE];this.MIN_FONT_SIZE=6;this.MAX_FONT_SIZE=126;this.FLASH_PADDING_BOTTOM=5;this.VERSION="436";this.isActive=false;this.isEnabled=true;this.fixHover=true;this.autoInitialize=true;this.setPrefetchCookie=true;this.cookiePath="/";this.domains=[];this.forceWidth=true;this.fitExactly=false;this.forceTextTransform=true;this.useDomLoaded=true;this.useStyleCheck=false;this.hasFlashClassSet=false;this.repaintOnResize=true;this.replacements=[];var L=0;var R=false;function Y(){}function D(c){function d(e){return e.toLocaleUpperCase()}this.normalize=function(e){return e.replace(/\n|\r|\xA0/g,D.SINGLE_WHITESPACE).replace(/\s+/g,D.SINGLE_WHITESPACE)};this.textTransform=function(e,f){switch(e){case"uppercase":return f.toLocaleUpperCase();case"lowercase":return f.toLocaleLowerCase();case"capitalize":return f.replace(/^\w|\s\w/g,d)}return f};this.toHexString=function(e){if(e.charAt(0)!="#"||e.length!=4&&e.length!=7){return e}e=e.substring(1);return"0x"+(e.length==3?e.replace(/(.)(.)(.)/,"$1$1$2$2$3$3"):e)};this.toJson=function(g,f){var e="";switch(typeof(g)){case"string":e='"'+f(g)+'"';break;case"number":case"boolean":e=g.toString();break;case"object":e=[];for(var h in g){if(g[h]==Object.prototype[h]){continue}e.push('"'+h+'":'+this.toJson(g[h]))}e="{"+e.join(",")+"}";break}return e};this.convertCssArg=function(e){if(!e){return{}}if(typeof(e)=="object"){if(e.constructor==Array){e=e.join("")}else{return e}}var l={};var m=e.split("}");for(var h=0;h<m.length;h++){var k=m[h].match(/([^\s{]+)\s*\{(.+)\s*;?\s*/);if(!k||k.length!=3){continue}if(!l[k[1]]){l[k[1]]={}}var g=k[2].split(";");for(var f=0;f<g.length;f++){var n=g[f].match(/\s*([^:\s]+)\s*\:\s*([^;]+)/);if(!n||n.length!=3){continue}l[k[1]][n[1]]=n[2].replace(/\s+$/,"")}}return l};this.extractFromCss=function(g,f,i,e){var h=null;if(g&&g[f]&&g[f][i]){h=g[f][i];/* LP UPDATE :::::::::: if(e){delete g[f][i]} */}return h};this.cssToString=function(f){var g=[];for(var e in f){var j=f[e];if(j==Object.prototype[e]){continue}g.push(e,"{");for(var i in j){if(j[i]==Object.prototype[i]){continue}var h=j[i];if(D.UNIT_REMOVAL_PROPERTIES[i]){h=parseInt(h,10)}g.push(i,":",h,";")}g.push("}")}return g.join("")};this.escape=function(e){return escape(e).replace(/\+/g,"%2B")};this.encodeVars=function(e){return e.join("&").replace(/%/g,"%25")};this.copyProperties=function(g,f){for(var e in g){/*start::::::::::::::LP-UPDATE*/if(f[e]==undefined||f[e]==null){/*end::::::::::::::LP-UPDATE*/f[e]=g[e]}}return f};this.domain=function(){var f="";try{f=document.domain}catch(g){}return f};this.domainMatches=function(h,g){if(g=="*"||g==h){return true}var f=g.lastIndexOf("*");if(f>-1){g=g.substr(f+1);var e=h.lastIndexOf(g);if(e>-1&&(e+g.length)==h.length){return true}}return false};this.uriEncode=function(e){return encodeURI(decodeURIComponent(e))};this.delay=function(f,h,g){var e=Array.prototype.slice.call(arguments,3);setTimeout(function(){h.apply(g,e)},f)}}D.UNIT_REMOVAL_PROPERTIES={leading:true,"margin-left":true,"margin-right":true,"text-indent":true};D.SINGLE_WHITESPACE=" ";function U(e){var d=this;function c(g,j,h){var k=d.getStyleAsInt(g,j,e.ua.ie);if(k==0){k=g[h];for(var f=3;f<arguments.length;f++){k-=d.getStyleAsInt(g,arguments[f],true)}}return k}this.getBody=function(){return document.getElementsByTagName("body")[0]||null};this.querySelectorAll=function(f){return window.parseSelector(f)};this.addClass=function(f,g){if(g){g.className=((g.className||"")==""?"":g.className+" ")+f}};this.removeClass=function(f,g){if(g){g.className=g.className.replace(new RegExp("(^|\\s)"+f+"(\\s|$)"),"").replace(/^\s+|(\s)\s+/g,"$1")}};this.hasClass=function(f,g){return new RegExp("(^|\\s)"+f+"(\\s|$)").test(g.className)};this.hasOneOfClassses=function(h,g){for(var f=0;f<h.length;f++){if(this.hasClass(h[f],g)){return true}}return false};this.ancestorHasClass=function(g,f){g=g.parentNode;while(g&&g.nodeType==1){if(this.hasClass(f,g)){return true}g=g.parentNode}return false};this.create=function(f,g){var h=document.createElementNS?document.createElementNS(U.XHTML_NS,f):document.createElement(f);if(g){h.className=g}return h};this.getComputedStyle=function(h,i){var f;if(document.defaultView&&document.defaultView.getComputedStyle){var g=document.defaultView.getComputedStyle(h,null);f=g?g[i]:null}else{if(h.currentStyle){f=h.currentStyle[i]}}return f||""};this.getStyleAsInt=function(g,i,f){var h=this.getComputedStyle(g,i);if(f&&!/px$/.test(h)){return 0}return parseInt(h)||0};this.getWidthFromStyle=function(f){return c(f,"width","offsetWidth","paddingRight","paddingLeft","borderRightWidth","borderLeftWidth")};this.getHeightFromStyle=function(f){return c(f,"height","offsetHeight","paddingTop","paddingBottom","borderTopWidth","borderBottomWidth")};this.getDimensions=function(j){var h=j.offsetWidth;var f=j.offsetHeight;if(h==0||f==0){for(var g=0;g<j.childNodes.length;g++){var k=j.childNodes[g];if(k.nodeType!=1){continue}h=Math.max(h,k.offsetWidth);f=Math.max(f,k.offsetHeight)}}return{width:h,height:f}};this.getViewport=function(){return{width:window.innerWidth||document.documentElement.clientWidth||this.getBody().clientWidth,height:window.innerHeight||document.documentElement.clientHeight||this.getBody().clientHeight}};this.blurElement=function(g){try{g.blur();return}catch(h){}var f=this.create("input");f.style.width="0px";f.style.height="0px";g.parentNode.appendChild(f);f.focus();f.blur();f.parentNode.removeChild(f)}}U.XHTML_NS="http://www.w3.org/1999/xhtml";function H(r){var g=navigator.userAgent.toLowerCase();var q=(navigator.product||"").toLowerCase();var h=navigator.platform.toLowerCase();this.parseVersion=H.parseVersion;this.macintosh=/^mac/.test(h);this.windows=/^win/.test(h);this.linux=/^linux/.test(h);this.quicktime=false;this.opera=/opera/.test(g);this.konqueror=/konqueror/.test(g);this.ie=false/*@cc_on||true@*/;this.ieSupported=this.ie&&!/ppc|smartphone|iemobile|msie\s5\.5/.test(g)/*@cc_on&&@_jscript_version>=5.5@*/;this.ieWin=this.ie&&this.windows/*@cc_on&&@_jscript_version>=5.1@*/;this.windows=this.windows&&(!this.ie||this.ieWin);this.ieMac=this.ie&&this.macintosh/*@cc_on&&@_jscript_version<5.1@*/;this.macintosh=this.macintosh&&(!this.ie||this.ieMac);this.safari=/safari/.test(g);this.webkit=!this.konqueror&&/applewebkit/.test(g);this.khtml=this.webkit||this.konqueror;this.gecko=!this.khtml&&q=="gecko";this.ieVersion=this.ie&&/.*msie\s(\d\.\d)/.exec(g)?this.parseVersion(RegExp.$1):"0";this.operaVersion=this.opera&&/.*opera(\s|\/)(\d+\.\d+)/.exec(g)?this.parseVersion(RegExp.$2):"0";this.webkitVersion=this.webkit&&/.*applewebkit\/(\d+).*/.exec(g)?this.parseVersion(RegExp.$1):"0";this.geckoVersion=this.gecko&&/.*rv:\s*([^\)]+)\)\s+gecko/.exec(g)?this.parseVersion(RegExp.$1):"0";this.konquerorVersion=this.konqueror&&/.*konqueror\/([\d\.]+).*/.exec(g)?this.parseVersion(RegExp.$1):"0";this.flashVersion=0;if(this.ieWin){var l;var o=false;try{l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(m){try{l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");this.flashVersion=this.parseVersion("6");l.AllowScriptAccess="always"}catch(m){o=this.flashVersion==this.parseVersion("6")}if(!o){try{l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(m){}}}if(!o&&l){this.flashVersion=this.parseVersion((l.GetVariable("$version")||"").replace(/^\D+(\d+)\D+(\d+)\D+(\d+).*/g,"$1.$2.$3"))}}else{if(navigator.plugins&&navigator.plugins["Shockwave Flash"]){var n=navigator.plugins["Shockwave Flash"].description.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var p=n.replace(/^\D*(\d+\.\d+).*$/,"$1");if(/r/.test(n)){p+=n.replace(/^.*r(\d*).*$/,".$1")}else{if(/d/.test(n)){p+=".0"}}this.flashVersion=this.parseVersion(p);var j=false;for(var k=0,c=this.flashVersion>=H.MIN_FLASH_VERSION;c&&k<navigator.mimeTypes.length;k++){var f=navigator.mimeTypes[k];if(f.type!="application/x-shockwave-flash"){continue}if(f.enabledPlugin){j=true;if(f.enabledPlugin.description.toLowerCase().indexOf("quicktime")>-1){c=false;this.quicktime=true}}}if(this.quicktime||!j){this.flashVersion=this.parseVersion("0")}}}this.flash=this.flashVersion>=H.MIN_FLASH_VERSION;this.transparencySupport=this.macintosh||this.windows||this.linux&&(this.flashVersion>=this.parseVersion("10")&&(this.gecko&&this.geckoVersion>=this.parseVersion("1.9")||this.opera));this.computedStyleSupport=this.ie||!!document.defaultView.getComputedStyle;this.fixFocus=this.gecko&&this.windows;this.nativeDomLoaded=this.gecko||this.webkit&&this.webkitVersion>=this.parseVersion("525")||this.konqueror&&this.konquerorMajor>this.parseVersion("03")||this.opera;this.mustCheckStyle=this.khtml||this.opera;this.forcePageLoad=this.webkit&&this.webkitVersion<this.parseVersion("523");this.properDocument=typeof(document.location)=="object";this.supported=this.flash&&this.properDocument&&(!this.ie||this.ieSupported)&&this.computedStyleSupport&&(!this.opera||this.operaVersion>=this.parseVersion("9.61"))&&(!this.webkit||this.webkitVersion>=this.parseVersion("412"))&&(!this.gecko||this.geckoVersion>=this.parseVersion("1.8.0.12"))&&(!this.konqueror)}H.parseVersion=function(c){return c.replace(/(^|\D)(\d+)(?=\D|$)/g,function(f,e,g){f=e;for(var d=4-g.length;d>=0;d--){f+="0"}return f+g})};H.MIN_FLASH_VERSION=H.parseVersion("8");function F(c){this.fix=c.ua.ieWin&&window.location.hash!="";var d;this.cache=function(){d=document.title};function e(){document.title=d}this.restore=function(){if(this.fix){setTimeout(e,0)}}}function S(l){var e=null;function c(){try{if(l.ua.ie||document.readyState!="loaded"&&document.readyState!="complete"){document.documentElement.doScroll("left")}}catch(n){return setTimeout(c,10)}i()}function i(){if(l.useStyleCheck){h()}else{if(!l.ua.mustCheckStyle){d(null,true)}}}function h(){e=l.dom.create("div",E.DUMMY);l.dom.getBody().appendChild(e);m()}function m(){if(l.dom.getComputedStyle(e,"marginLeft")=="42px"){g()}else{setTimeout(m,10)}}function g(){if(e&&e.parentNode){e.parentNode.removeChild(e)}e=null;d(null,true)}function d(n,o){l.initialize(o);if(n&&n.type=="load"){if(document.removeEventListener){document.removeEventListener("DOMContentLoaded",d,false)}if(window.removeEventListener){window.removeEventListener("load",d,false)}}}function j(){l.prepareClearReferences();if(document.readyState=="interactive"){document.attachEvent("onstop",f);setTimeout(function(){document.detachEvent("onstop",f)},0)}}function f(){document.detachEvent("onstop",f);k()}function k(){l.clearReferences()}this.attach=function(){if(window.addEventListener){window.addEventListener("load",d,false)}else{window.attachEvent("onload",d)}if(!l.useDomLoaded||l.ua.forcePageLoad||l.ua.ie&&window.top!=window){return}if(l.ua.nativeDomLoaded){document.addEventListener("DOMContentLoaded",i,false)}else{if(l.ua.ie||l.ua.khtml){c()}}};this.attachUnload=function(){if(!l.ua.ie){return}window.attachEvent("onbeforeunload",j);window.attachEvent("onunload",k)}}var Q="sifrFetch";function N(c){var e=false;this.fetchMovies=function(f){if(c.setPrefetchCookie&&new RegExp(";?"+Q+"=true;?").test(document.cookie)){return}try{e=true;d(f)}catch(g){}if(c.setPrefetchCookie){document.cookie=Q+"=true;path="+c.cookiePath}};this.clear=function(){if(!e){return}try{var f=document.getElementsByTagName("script");for(var g=f.length-1;g>=0;g--){var h=f[g];if(h.type=="sifr/prefetch"){h.parentNode.removeChild(h)}}}catch(j){}};function d(f){for(var g=0;g<f.length;g++){document.write('<script defer type="sifr/prefetch" src="'+f[g].src+'"><\/script>')}}}function b(e){var g=e.ua.ie;var f=g&&e.ua.flashVersion<e.ua.parseVersion("9.0.115");var d={};var c={};this.fixFlash=f;this.register=function(h){if(!g){return}var i=h.getAttribute("id");this.cleanup(i,false);c[i]=h;delete d[i];if(f){window[i]=h}};this.reset=function(){if(!g){return false}for(var j=0;j<e.replacements.length;j++){var h=e.replacements[j];var k=c[h.id];if(!d[h.id]&&(!k.parentNode||k.parentNode.nodeType==11)){h.resetMovie();d[h.id]=true}}return true};this.cleanup=function(l,h){var i=c[l];if(!i){return}for(var k in i){if(typeof(i[k])=="function"){i[k]=null}}c[l]=null;if(f){window[l]=null}if(i.parentNode){if(h&&i.parentNode.nodeType==1){var j=document.createElement("div");j.style.width=i.offsetWidth+"px";j.style.height=i.offsetHeight+"px";i.parentNode.replaceChild(j,i)}else{i.parentNode.removeChild(i)}}};this.prepareClearReferences=function(){if(!f){return}__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}};this.clearReferences=function(){if(f){var j=document.getElementsByTagName("object");for(var h=j.length-1;h>=0;h--){c[j[h].getAttribute("id")]=j[h]}}for(var k in c){if(Object.prototype[k]!=c[k]){this.cleanup(k,true)}}}}function K(d,g,f,c,e){this.sIFR=d;this.id=g;this.vars=f;this.movie=null;this.__forceWidth=c;this.__events=e;this.__resizing=0}K.prototype={getFlashElement:function(){return document.getElementById(this.id)},getAlternate:function(){return document.getElementById(this.id+"_alternate")},getAncestor:function(){var c=this.getFlashElement().parentNode;return !this.sIFR.dom.hasClass(E.FIX_FOCUS,c)?c:c.parentNode},available:function(){var c=this.getFlashElement();return c&&c.parentNode},call:function(c){var d=this.getFlashElement();if(!d[c]){return false}return Function.prototype.apply.call(d[c],d,Array.prototype.slice.call(arguments,1))},attempt:function(){if(!this.available()){return false}try{this.call.apply(this,arguments)}catch(c){if(this.sIFR.debug){throw c}return false}return true},updateVars:function(c,e){for(var d=0;d<this.vars.length;d++){if(this.vars[d].split("=")[0]==c){this.vars[d]=c+"="+e;break}}var f=this.sIFR.util.encodeVars(this.vars);this.movie.injectVars(this.getFlashElement(),f);this.movie.injectVars(this.movie.html,f)},storeSize:function(c,d){this.movie.setSize(c,d);this.updateVars(c,d)},fireEvent:function(c){if(this.available()&&this.__events[c]){this.sIFR.util.delay(0,this.__events[c],this,this)}},resizeFlashElement:function(c,d,e){if(!this.available()){return}this.__resizing++;var f=this.getFlashElement();f.setAttribute("height",c);this.getAncestor().style.minHeight="";this.updateVars("renderheight",c);this.storeSize("height",c);if(d!==null){f.setAttribute("width",d);this.movie.setSize("width",d)}if(this.__events.onReplacement){this.sIFR.util.delay(0,this.__events.onReplacement,this,this);delete this.__events.onReplacement}if(e){this.sIFR.util.delay(0,function(){this.attempt("scaleMovie");this.__resizing--},this)}else{this.__resizing--}},blurFlashElement:function(){if(this.available()){this.sIFR.dom.blurElement(this.getFlashElement())}},resetMovie:function(){this.sIFR.util.delay(0,this.movie.reset,this.movie,this.getFlashElement(),this.getAlternate())},resizeAfterScale:function(){if(this.available()&&this.__resizing==0){this.sIFR.util.delay(0,this.resize,this)}},resize:function(){if(!this.available()){return}this.__resizing++;var g=this.getFlashElement();var f=g.offsetWidth;if(f==0){return}var e=g.getAttribute("width");var l=g.getAttribute("height");var m=this.getAncestor();var o=this.sIFR.dom.getHeightFromStyle(m);g.style.width="1px";g.style.height="1px";m.style.minHeight=o+"px";var c=this.getAlternate().childNodes;var n=[];for(var k=0;k<c.length;k++){var h=c[k].cloneNode(true);n.push(h);m.appendChild(h)}var d=this.sIFR.dom.getWidthFromStyle(m);for(var k=0;k<n.length;k++){m.removeChild(n[k])}g.style.width=g.style.height=m.style.minHeight="";g.setAttribute("width",this.__forceWidth?d:e);g.setAttribute("height",l);if(sIFR.ua.ie){g.style.display="none";var j=g.offsetHeight;g.style.display=""}if(d!=f){if(this.__forceWidth){this.storeSize("width",d)}this.attempt("resize",d)}this.__resizing--},replaceText:function(g,j){var d=this.sIFR.util.escape(g);if(!this.attempt("replaceText",d)){return false}this.updateVars("content",d);var f=this.getAlternate();if(j){while(f.firstChild){f.removeChild(f.firstChild)}for(var c=0;c<j.length;c++){f.appendChild(j[c])}}else{try{f.innerHTML=g}catch(h){}}return true},changeCSS:function(c){c=this.sIFR.util.escape(this.sIFR.util.cssToString(this.sIFR.util.convertCssArg(c)));this.updateVars("css",c);return this.attempt("changeCSS",c)},remove:function(){if(this.movie&&this.available()){this.movie.remove(this.getFlashElement(),this.id)}}};var X=new function(){this.create=function(p,n,j,i,f,e,g,o,l,h,m){var k=p.ua.ie?d:c;return new k(p,n,j,i,f,e,g,o,["flashvars",l,"wmode",h,"bgcolor",m,"allowScriptAccess","always","quality","best"])};function c(s,q,l,h,f,e,g,r,n){var m=s.dom.create("object",E.FLASH);var p=["type","application/x-shockwave-flash","id",f,"name",f,"data",e,"width",g,"height",r];for(var o=0;o<p.length;o+=2){m.setAttribute(p[o],p[o+1])}var j=m;if(h){j=W.create("div",E.FIX_FOCUS);j.appendChild(m)}for(var o=0;o<n.length;o+=2){if(n[o]=="name"){continue}var k=W.create("param");k.setAttribute("name",n[o]);k.setAttribute("value",n[o+1]);m.appendChild(k)}l.style.minHeight=r+"px";while(l.firstChild){l.removeChild(l.firstChild)}l.appendChild(j);this.html=j.cloneNode(true)}c.prototype={reset:function(e,f){e.parentNode.replaceChild(this.html.cloneNode(true),e)},remove:function(e,f){e.parentNode.removeChild(e)},setSize:function(e,f){this.html.setAttribute(e,f)},injectVars:function(e,g){var h=e.getElementsByTagName("param");for(var f=0;f<h.length;f++){if(h[f].getAttribute("name")=="flashvars"){h[f].setAttribute("value",g);break}}}};function d(p,n,j,h,f,e,g,o,k){this.dom=p.dom;this.broken=n;this.html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+f+'" width="'+g+'" height="'+o+'" class="'+E.FLASH+'"><param name="movie" value="'+e+'"></param></object>';var m="";for(var l=0;l<k.length;l+=2){m+='<param name="'+k[l]+'" value="'+k[l+1]+'"></param>'}this.html=this.html.replace(/(<\/object>)/,m+"$1");j.style.minHeight=o+"px";j.innerHTML=this.html;this.broken.register(j.firstChild)}d.prototype={reset:function(f,g){g=g.cloneNode(true);var e=f.parentNode;e.innerHTML=this.html;this.broken.register(e.firstChild);e.appendChild(g)},remove:function(e,f){this.broken.cleanup(f)},setSize:function(e,f){this.html=this.html.replace(e=="height"?/(height)="\d+"/:/(width)="\d+"/,'$1="'+f+'"')},injectVars:function(e,f){if(e!=this.html){return}this.html=this.html.replace(/(flashvars(=|\"\svalue=)\")[^\"]+/,"$1"+f)}}};this.errors=new Y(O);var A=this.util=new D(O);var W=this.dom=new U(O);var T=this.ua=new H(O);var G={fragmentIdentifier:new F(O),pageLoad:new S(O),prefetch:new N(O),brokenFlashIE:new b(O)};this.__resetBrokenMovies=G.brokenFlashIE.reset;var J={kwargs:[],replaceAll:function(d){for(var c=0;c<this.kwargs.length;c++){O.replace(this.kwargs[c])}if(!d){this.kwargs=[]}}};this.activate=function(){if(!T.supported||!this.isEnabled||this.isActive||!C()||a()){return}G.prefetch.fetchMovies(arguments);this.isActive=true;this.setFlashClass();G.fragmentIdentifier.cache();G.pageLoad.attachUnload();if(!this.autoInitialize){return}G.pageLoad.attach()};this.setFlashClass=function(){if(this.hasFlashClassSet){return}W.addClass(E.ACTIVE,W.getBody()||document.documentElement);this.hasFlashClassSet=true};this.removeFlashClass=function(){if(!this.hasFlashClassSet){return}W.removeClass(E.ACTIVE,W.getBody());W.removeClass(E.ACTIVE,document.documentElement);this.hasFlashClassSet=false};this.initialize=function(c){if(!this.isActive||!this.isEnabled){return}if(R){if(!c){J.replaceAll(false)}return}R=true;J.replaceAll(c);if(O.repaintOnResize){if(window.addEventListener){window.addEventListener("resize",Z,false)}else{window.attachEvent("onresize",Z)}}G.prefetch.clear()};this.replace=function(x,u){if(!T.supported){return}if(u){x=A.copyProperties(x,u)}if(!R){return J.kwargs.push(x)}if(this.onReplacementStart){this.onReplacementStart(x)}var AM=x.elements||W.querySelectorAll(x.selector);if(AM.length==0){return}var w=M(x.src);var AR=A.convertCssArg(x.css);var v=B(x.filters);var AN=x.forceSingleLine===true;var AS=x.preventWrap===true&&!AN;var q=AN||(x.fitExactly==null?this.fitExactly:x.fitExactly)===true;var AD=q||(x.forceWidth==null?this.forceWidth:x.forceWidth)===true;var s=x.ratios||[];var AE=x.pixelFont===true;var r=parseInt(x.tuneHeight)||0;var z=!!x.onRelease||!!x.onRollOver||!!x.onRollOut;if(q){A.extractFromCss(AR,".sIFR-root","text-align",true)}var t=A.extractFromCss(AR,".sIFR-root","font-size",true)||"0";var e=A.extractFromCss(AR,".sIFR-root","background-color",true)||"#FFFFFF";var o=A.extractFromCss(AR,".sIFR-root","kerning",true)||"";var AW=A.extractFromCss(AR,".sIFR-root","opacity",true)||"100";var k=A.extractFromCss(AR,".sIFR-root","cursor",true)||"default";var AP=parseInt(A.extractFromCss(AR,".sIFR-root","leading"))||0;var AJ=x.gridFitType||(A.extractFromCss(AR,".sIFR-root","text-align")=="right")?"subpixel":"pixel";var h=this.forceTextTransform===false?"none":A.extractFromCss(AR,".sIFR-root","text-transform",true)||"none";t=/^\d+(px)?$/.test(t)?parseInt(t):0;AW=parseFloat(AW)<1?100*parseFloat(AW):AW;var AC=x.modifyCss?"":A.cssToString(AR);var AG=x.wmode||"";if(!AG){if(x.transparent){AG="transparent"}else{if(x.opaque){AG="opaque"}}}if(AG=="transparent"){if(!T.transparencySupport){AG="opaque"}else{e="transparent"}}else{if(e=="transparent"){e="#FFFFFF"}}for(var AV=0;AV<AM.length;AV++){var AF=AM[AV];if(W.hasOneOfClassses(E.IGNORE_CLASSES,AF)||W.ancestorHasClass(AF,E.ALTERNATE)){continue}var AO=W.getDimensions(AF);var f=AO.height;var c=AO.width;var AA=W.getComputedStyle(AF,"display");if(!f||!c||!AA||AA=="none"){continue}c=W.getWidthFromStyle(AF);var n,AH;if(!t){var AL=I(AF);n=Math.min(this.MAX_FONT_SIZE,Math.max(this.MIN_FONT_SIZE,AL.fontSize));if(AE){n=Math.max(8,8*Math.round(n/8))}AH=AL.lines}else{n=t;AH=1}var d=W.create("span",E.ALTERNATE);var AX=AF.cloneNode(true);AF.parentNode.appendChild(AX);for(var AU=0,AT=AX.childNodes.length;AU<AT;AU++){var m=AX.childNodes[AU];if(!/^(style|script)$/i.test(m.nodeName)){d.appendChild(m.cloneNode(true))}}if(x.modifyContent){x.modifyContent(AX,x.selector)}if(x.modifyCss){AC=x.modifyCss(AR,AX,x.selector)}var p=P(AX,h,x.uriEncode);AX.parentNode.removeChild(AX);if(x.modifyContentString){p.text=x.modifyContentString(p.text,x.selector)}if(p.text==""){continue}var AK=Math.round(AH*V(n,s)*n)+this.FLASH_PADDING_BOTTOM+r;if(AH>1&&AP){AK+=Math.round((AH-1)*AP)}var AB=AD?c:"100%";var AI="sIFR_replacement_"+L++;var AQ=["id="+AI,"content="+A.escape(p.text),"width="+c,"renderheight="+AK,"link="+A.escape(p.primaryLink.href||""),"target="+A.escape(p.primaryLink.target||""),"size="+n,"css="+A.escape(AC),"cursor="+k,"tunewidth="+(x.tuneWidth||0),"tuneheight="+r,"offsetleft="+(x.offsetLeft||""),"offsettop="+(x.offsetTop||""),"fitexactly="+q,"preventwrap="+AS,"forcesingleline="+AN,"antialiastype="+(x.antiAliasType||""),"thickness="+(x.thickness||""),"sharpness="+(x.sharpness||""),"kerning="+o,"gridfittype="+AJ,"flashfilters="+v,"opacity="+AW,"blendmode="+(x.blendMode||""),"selectable="+(x.selectable==null||AG!=""&&!sIFR.ua.macintosh&&sIFR.ua.gecko&&sIFR.ua.geckoVersion>=sIFR.ua.parseVersion("1.9")?"true":x.selectable===true),"fixhover="+(this.fixHover===true),"events="+z,"delayrun="+G.brokenFlashIE.fixFlash,"version="+this.VERSION];var y=A.encodeVars(AQ);var g=new K(O,AI,AQ,AD,{onReplacement:x.onReplacement,onRollOver:x.onRollOver,onRollOut:x.onRollOut,onRelease:x.onRelease});g.movie=X.create(sIFR,G.brokenFlashIE,AF,T.fixFocus&&x.fixFocus,AI,w,AB,AK,y,AG,e);this.replacements.push(g);this.replacements[AI]=g;if(x.selector){if(!this.replacements[x.selector]){this.replacements[x.selector]=[g]}else{this.replacements[x.selector].push(g)}}d.setAttribute("id",AI+"_alternate");AF.appendChild(d);W.addClass(E.REPLACED,AF)}G.fragmentIdentifier.restore()};this.getReplacementByFlashElement=function(d){for(var c=0;c<O.replacements.length;c++){if(O.replacements[c].id==d.getAttribute("id")){return O.replacements[c]}}};this.redraw=function(){for(var c=0;c<O.replacements.length;c++){O.replacements[c].resetMovie()}};this.prepareClearReferences=function(){G.brokenFlashIE.prepareClearReferences()};this.clearReferences=function(){G.brokenFlashIE.clearReferences();G=null;J=null;delete O.replacements};function C(){if(O.domains.length==0){return true}var d=A.domain();for(var c=0;c<O.domains.length;c++){if(A.domainMatches(d,O.domains[c])){return true}}return false}function a(){if(document.location.protocol=="file:"){if(O.debug){O.errors.fire("isFile")}return true}return false}function M(c){if(T.ie&&c.charAt(0)=="/"){c=window.location.toString().replace(/([^:]+)(:\/?\/?)([^\/]+).*/,"$1$2$3")+c}return c}function V(d,e){for(var c=0;c<e.length;c+=2){if(d<=e[c]){return e[c+1]}}return e[e.length-1]||1}function B(g){var e=[];for(var d in g){if(g[d]==Object.prototype[d]){continue}var c=g[d];d=[d.replace(/filter/i,"")+"Filter"];for(var f in c){if(c[f]==Object.prototype[f]){continue}d.push(f+":"+A.escape(A.toJson(c[f],A.toHexString)))}e.push(d.join(","))}return A.escape(e.join(";"))}function Z(d){var e=Z.viewport;var c=W.getViewport();if(e&&c.width==e.width&&c.height==e.height){return}Z.viewport=c;if(O.replacements.length==0){return}if(Z.timer){clearTimeout(Z.timer)}Z.timer=setTimeout(function(){delete Z.timer;for(var f=0;f<O.replacements.length;f++){O.replacements[f].resize()}},200)}function I(f){var g=W.getComputedStyle(f,"fontSize");var d=g.indexOf("px")==-1;var e=f.innerHTML;if(d){f.innerHTML="X"}f.style.paddingTop=f.style.paddingBottom=f.style.borderTopWidth=f.style.borderBottomWidth="0px";f.style.lineHeight="2em";f.style.display="block";g=d?f.offsetHeight/2:parseInt(g,10);if(d){f.innerHTML=e}var c=Math.round(f.offsetHeight/(2*g));f.style.paddingTop=f.style.paddingBottom=f.style.borderTopWidth=f.style.borderBottomWidth=f.style.lineHeight=f.style.display="";if(isNaN(c)||!isFinite(c)||c==0){c=1}return{fontSize:g,lines:c}}function P(c,g,s){s=s||A.uriEncode;var q=[],m=[];var k=null;var e=c.childNodes;var o=false,p=false;var j=0;while(j<e.length){var f=e[j];if(f.nodeType==3){var t=A.textTransform(g,A.normalize(f.nodeValue)).replace(/</g,"&lt;");if(o&&p){t=t.replace(/^\s+/,"")}m.push(t);o=/\s$/.test(t);p=false}if(f.nodeType==1&&!/^(style|script)$/i.test(f.nodeName)){var h=[];var r=f.nodeName.toLowerCase();var n=f.className||"";if(/\s+/.test(n)){if(n.indexOf(E.CLASS)>-1){n=n.match("(\\s|^)"+E.CLASS+"-([^\\s$]*)(\\s|$)")[2]}else{n=n.match(/^([^\s]+)/)[1]}}if(n!=""){h.push('class="'+n+'"')}if(r=="a"){var d=s(f.getAttribute("href")||"");var l=f.getAttribute("target")||"";h.push('href="'+d+'"','target="'+l+'"');if(!k){k={href:d,target:l}}}m.push("<"+r+(h.length>0?" ":"")+h.join(" ")+">");p=true;if(f.hasChildNodes()){q.push(j);j=0;e=f.childNodes;continue}else{if(!/^(br|img)$/i.test(f.nodeName)){m.push("</",f.nodeName.toLowerCase(),">")}}}if(q.length>0&&!f.nextSibling){do{j=q.pop();e=f.parentNode.parentNode.childNodes;f=e[j];if(f){m.push("</",f.nodeName.toLowerCase(),">")}}while(j==e.length-1&&q.length>0)}j++}return{text:m.join("").replace(/^\s+|\s+$|\s*(<br>)\s*/g,"$1"),primaryLink:k||{}}}};


/// <reference path="../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />

/*
 ***********************************
 ***********************************
 * IMPORTANT
 ***********************************
 ***********************************
	 
	sIFR.styles object MUST be declared AS FIRST STEP
		
	This file MUST be loaded *****AFTER***** :
		1. 'sifr-jQuery.js' [ or 'sifr.js' ]
		
	USEFUL LINKS:
		http://wiki.novemberborn.net/sifr3/DetectingCSSLoad>
		http://wiki.novemberborn.net/sifr3/JavaScript+Configuration
		http://wiki.novemberborn.net/sifr3/Styling
 */



/*
***********************************
* GLOBAL SIFR STYLES OBJECT
***********************************
*/
	sIFR.styles = {}




/*
 ***********************************
 * STYLE CONFIGURATIONS
 ***********************************
 */
	 
	/*
	 ========================
	 * FONTS
	 ========================
	 */
		sIFR.styles.font_1	= "/assets/fonts/nobel_regular.swf";
		//sIFR.styles.font_2	= "/assets/fonts/nobel_book.swf";
		sIFR.styles.font_3	= "/assets/fonts/nobel_light.swf";
		
		
	/*
	 ========================
	 * STYLE OBJECTS - see 'http://wiki.novemberborn.net/sifr3/Styling'
	 ========================
	 */
		
		
		/*
		 ---------
		 * PANEL HEADERS
		 ---------
		 */
		
			sIFR.styles.PANEL_STYLE_1_HEADER = 
			{
				src			: sIFR.styles.font_1,
				forceWidth	: true,
				forceHeight : true,
				wmode		: "transparent",
				offsetTop	: 0,
				offsetLeft  : 0,
				thickness	: 0,
				sharpness	: 0,
				selectable	: false,
				
				css: {
						'.sIFR-root': {
							"color"			 : "#000000",
							"font-size"		 : "13px",
							"letter-spacing" : "0",
							"text-align"	 : "left",
							"text-transform" : "uppercase"
						}
				}
			}
		
			sIFR.styles.PANEL_STYLE_2_HEADER = 
			{
				src			: sIFR.styles.font_1,
				forceWidth	: true,
				forceHeight : true,
				wmode		: "transparent",
				offsetTop	: 0,
				offsetLeft  : 0,
				thickness	: 0,
				sharpness	: 100,
				selectable	: false,
				
				css: {
						'.sIFR-root': {
							"color"			 : "#ffffff",
							"font-size"		 : "13px",
							"letter-spacing" : "0",
							"text-align"	 : "left",
							"text-transform" : "uppercase"
						}
				}
			}
		
		
		/*
		 ---------
		 * GENERAL ELEMENT STYLES
		 ---------
		 */
			sIFR.styles.H1 = 
			{
				src			: sIFR.styles.font_3,
				forceWidth	: true,
				forceHeight : true,
				wmode		: "transparent",
				offsetTop	: 0,
				offsetLeft  : 0,
				thickness	: 0,
				sharpness	: 0,
				selectable	: true,
				
				css: {
						'.sIFR-root': {
							"color"			 : "#000000",
							"font-size"		 : "28px",
							"letter-spacing" : "0",
							"text-align"	 : "left",
							"text-transform" : "uppercase"
						}
				}
			}

			sIFR.styles.H1_MIXED_CASE = 
			{
				src			: sIFR.styles.font_3,
				forceWidth	: true,
				forceHeight : true,
				wmode		: "transparent",
				offsetTop	: 0,
				offsetLeft  : 0,
				thickness	: 0,
				sharpness	: 0,
				selectable	: true,
				
				css: {
						'.sIFR-root': {
							"color"			 : "#000000",
							"font-size"		 : "28px",
							"letter-spacing" : "0",
							"text-align"	 : "left"
						}
				}
			}
					 
			sIFR.styles.H2 = 
			{
				src			: sIFR.styles.font_3,
				forceWidth	: true,
				forceHeight : true,
				wmode		: "opaque",//transparent
				offsetTop	: 0,
				offsetLeft  : 0,
				thickness	: 30,
				sharpness	: 0,
				selectable	: true,
				
				css: {
						'.sIFR-root': {
							"color"			 : "#000000",
							"font-size"		 : "14px",
							"letter-spacing" : "0",
							"text-align"	 : "left",
							"text-transform" : "uppercase",
							"background-color" : "#FFFFFF"
						}
				}
			}
		 
			sIFR.styles.H2_MIXED_CASE = 
			{
				src			: sIFR.styles.font_3,
				forceWidth	: true,
				forceHeight : true,
				wmode		: "opaque",//transparent
				offsetTop	: 0,
				offsetLeft  : 0,
				thickness	: 30,
				sharpness	: 0,
				selectable	: true,
				
				css: {
						'.sIFR-root': {
							"color"			 : "#000000",
							"font-size"		 : "14px",
							"letter-spacing" : "0",
							"text-align"	 : "left",
							"background-color" : "#FFFFFF"
						}
				}
			}

			/*
			 ---------
			 * GENERIC STYLES
			 ---------
			 */
			 
				/*
				 ---------
				 * NOBEL REGULAR
				 ---------
				 */
 			
				sIFR.styles.FONT_1_STYLE_1 = 
				{
					src			: sIFR.styles.font_1,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#000000", //"#748AB2", //"#748AB2", //"#0089C7",//"#828B7C",
								"font-size"		 : "11px",
								"letter-spacing" : "0",
								"text-align"	 : "left",
								"text-transform" : "uppercase"
							}
					}
				}
				
				sIFR.styles.FONT_1_STYLE_3 = 
				{
					src			: sIFR.styles.font_1,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#000000",
								"font-size"		 : "16px",
								"letter-spacing" : "0",
								"text-align"	 : "left",
								"text-transform" : "uppercase"
							}
					}
				}
				
				sIFR.styles.FONT_1_STYLE_4 = 
				{
					src			: sIFR.styles.font_1,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#607499", //"#748AB2", //"#748AB2", //"#0089C7",//"#828B7C",
								"font-size"		 : "13px",
								"letter-spacing" : "0",
								"text-align"	 : "left",
								"text-transform" : "uppercase"
							}
					}
				}
				
				
				
				sIFR.styles.FONT_1_STYLE_5 = 
				{
					src			: sIFR.styles.font_1,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#607499",
								"font-size"		 : "13px",
								"letter-spacing" : "0",
								"text-align"	 : "left",
								"text-transform" : "uppercase"
							}
					}
				}				
				
				
				sIFR.styles.FONT_1_STYLE_6 = 
				{
					src			: sIFR.styles.font_1,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 1,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#000000",
								"font-size"		 : "18px",
								"letter-spacing" : "0",
								"text-align"	 : "center",
								"text-transform" : "uppercase"
							}
					}
				}
				
				
				sIFR.styles.FONT_1_STYLE_8 = 
				{
					src			: sIFR.styles.font_1,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#000000",
								"font-size"		 : "12px",
								"letter-spacing" : "0",
								"text-align"	 : "left",
								"text-transform" : "uppercase"
							}
					}
				}
				
				
				
				sIFR.styles.FONT_1_STYLE_9 = 
				{
					src			: sIFR.styles.font_1,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#000000",//"#607499",
								"font-size"		 : "14px",
								"letter-spacing" : "0",
								"text-align"	 : "left"
							}
					}
				}
				
	
				/*
				 ---------
				 * NOBEL LIGHT
				 ---------
				 */
				sIFR.styles.FONT_3_STYLE_1 = 
				{
					src			: sIFR.styles.font_3,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#000000",
								"font-size"		 : "18px",
								"letter-spacing" : "0",
								"text-align"	 : "left",
								"text-transform" : "uppercase"
							}
					}
				}
				
				
				sIFR.styles.FONT_3_STYLE_4 = 
				{
					src			: sIFR.styles.font_3,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 40,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#000000",
								"font-size"		 : "22px",
								"letter-spacing" : "0",
								"text-align"	 : "left",
								"text-transform" : "uppercase"
							}
					}
				}
				
				
				sIFR.styles.FONT_3_STYLE_5 = 
				{
					src			: sIFR.styles.font_3,
					forceWidth	: true,
					forceHeight : true,
					wmode		: "transparent",
					offsetTop	: 0,
					offsetLeft  : 0,
					thickness	: 0,
					sharpness	: 0,
					selectable	: false,
					
					css: {
							'.sIFR-root': {
								"color"			 : "#FFFFFF",
								"font-size"		 : "18px",
								"letter-spacing" : "0",
								"text-align"	 : "right",
								"text-transform" : "uppercase"
							}
					}
				}
		



		
	/*
	 ***********************************
	 * CORE CONFIGURATION
	 ***********************************
	 */
		
		sIFR.useDomLoaded	= true;	
			
			
			
	/*
	 ***********************************
	 * UTILITIES
	 ***********************************
	 */
		/*
		 ----------
		 CONSTANTS
		 ----------
		 */
		 if (sIFR.styles)
		 {
			sIFR.styles.STYLE_COMPARE					= "STYLE-COMPARE";
			sIFR.styles.STYLE_ADVANCED_SEARCH			= "STYLE-ADVANCED-SEARCH";
			sIFR.styles.STYLE_BUTTONS_STANDARD			= "STYLE_BUTTONS_STANDARD";
			
			
			sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING					= "div.button-style-1 > div.but-body > p, div.button-style-2 > div.but-body > p, div.button-style-3 > div.but-body > p";
			sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH	= "div.but-body > p"
		}
		
		
		
		/*
		 ----------
		 STYLING UTILITY METHODS
		 ----------
		 */
			 /*
			 ----------
			 ELEMENT STYLING METHODS
			 ----------
			 */
				sIFR.runDelayedStyling = function (type)
				{
					switch (type)
					{
						case sIFR.styles.STYLE_COMPARE :
							sIFR.styleCompareElements();
							break;
							
						case sIFR.styles.STYLE_ADVANCED_SEARCH :
							sIFR.styleAdvancedSettingsPanel();
							break;
							
						default :
							break;
					}
				}
				
				
				
				sIFR.styleCompareElements = function() 
				{
					// Escape if style not defined
					if (!sIFR.styles || !sIFR.styles.OFFSET_FONT_1_STYLE_1) return;
					
//					sIFR.replace(sIFR.styles.OFFSET_FONT_1_STYLE_1, 
//					{
//						selector: "div.compare-display-container div.compare-container-content table h5"
//					});
				}
				
				
				
				sIFR.styleAdvancedSettingsPanel = function ()
				{
					// Escape if style not defined
					if (!sIFR.styles || !sIFR.styles.PANEL_STYLE_2_HEADER) return;
					
					sIFR.replace(sIFR.styles.PANEL_STYLE_2_HEADER, 
					{
						selector: "div.uvl-container > div.search-criteria-container > form > div.search-criteria-panels > div.panel-advanced-settings > div.panel-body-container > div.panel-body > div.panel-body-header > h2"
					});
				}
				
				
				
				sIFR.styleResultsListResultsCount = function ()
				{
					// Escape if style not defined
					if (!sIFR.styles || !sIFR.styles.FONT_1_STYLE_4) return;
					
					sIFR.replace(sIFR.styles.FONT_1_STYLE_4, 
					{
						selector : "div.main-container div.uvl-container div.vehicle-list-container h3:not(div.user-container div.vehicle-list-container h3)"
					});
				}
				
		
				
				sIFR.runDelayedLightBoxHeaderStyling = function (jQueryTargetString)
				{
					// Escape if style not defined
					if (!sIFR.styles) return;
					
					if (jQueryTargetString)
					{
						// Replace h2
						if (sIFR.styles.FONT_3_STYLE_4)
						{
							sIFR.replace(sIFR.styles.FONT_3_STYLE_4, 
							{
								selector: (jQueryTargetString + " h2")
							});
						}
						
						// Replace h3
						if (sIFR.styles.FONT_1_STYLE_8)
						{
							sIFR.replace(sIFR.styles.FONT_1_STYLE_8,
							{
								selector: (jQueryTargetString + " h3")
							});
						}
						
						
						// Replace 'in-content' h4 section headers
						if (sIFR.styles.FONT_1_STYLE_5)
						{
							sIFR.replace(sIFR.styles.FONT_1_STYLE_5,
							{
								selector: (jQueryTargetString + " h4.section-header")
							});
						}
						
						
					}
				}
			
			
			
			
			
			
			/*
			 -------------------------------------------------------------------------------------------------------------
			 * GENERIC SIFR REPLACED ELEMENT TEXT UPDATE 
			 *
			 * @argument : uniqueJQSelector :: unique jquery formatted selector;
			 * @argument : text :: Update text (html formatted e.g: "update <span class='span'>text</span>" )
			 * @argument : isUpperCase :: Boolean indicating when text should be reformatted to uppercase of left untouched
			 *
			 * IMPORTANT :: this technique assumes that there is ONLY 1 object tag within the replaced element and that it is the FIRST CHILD
			 *
			 * EXAMPLE :: << sIFR_Utilities.replaceSifrText($("div.column2 > div.panel-compare > div.header > h2"), "i've been updated <span class='span'>mofo</span>", true); >>
			 -------------------------------------------------------------------------------------------------------------
			 */
				sIFR.replaceSifrText = function (uniqueJQueryTargetString, text, isUpperCase)
				{
					var targetContainer = $(uniqueJQueryTargetString + ":first");
					var target			= sIFR.getReplacementByFlashElement(targetContainer.children()[0]);
					target.replaceText((isUpperCase) ? text.toUpperCase() : text);
				}

	
	/*
	 ========================
	 * ACTIVATE STYLE OBJETS
	 ========================
	 * 
	 * !!!IMPORTANT!!! :: There MUST be only ONE CALL to activate  
	 *
	 */
		
		sIFR.activate
		(	
			sIFR.styles.H1, 
			sIFR.styles.H2,
			sIFR.styles.PANEL_STYLE_1_HEADER,
			sIFR.styles.PANEL_STYLE_2_HEADER,
			sIFR.styles.FONT_1_STYLE_1,			
			sIFR.styles.FONT_1_STYLE_3,
			sIFR.styles.FONT_1_STYLE_4,
			sIFR.styles.FONT_1_STYLE_5,
			sIFR.styles.FONT_1_STYLE_6,
			sIFR.styles.FONT_1_STYLE_8,
			sIFR.styles.FONT_1_STYLE_9,
			sIFR.styles.FONT_3_STYLE_1,
			sIFR.styles.FONT_3_STYLE_4,
			sIFR.styles.FONT_3_STYLE_5
		);
	

	
	/*
	 ========================
	 * REPLACEMENT CONTROL METHODS
	 ========================
	 */
		
		/*
		 ***************************************
		 * CORE ASSETS
		 ***************************************
		 */
		
			sIFR.replaceCoreAssets = function() 
			{
				/*
				 --------------------
				 GENERIC [Every page]
				 --------------------
				 */
					/* h1 */
					sIFR.replace(sIFR.styles.H1, 
					{
						selector: "div.main-container > div.uvl-container > h1.default:not(div.main-container > div.vehiclelist-container > h1.default, div.main-container > div.vehicle-container > h1.default), div.main-container > div.vehicle-container > h2.vehicle-details-h1-override"
					});

					/* h2 */
					sIFR.replace(sIFR.styles.H2, 
					{
						selector: "div.main-container > div.uvl-container > h2.default:not(div.main-container > div.vehiclelist-container > h2.default)"
					});
				
				/*
				 --------------------
				 SPECIFIC FEATURES
				 --------------------
				 */
					//
					// PANEL STYLE 1 : ADVANCED SEARCH
					//
						var advancedSearchPanelsStyle1 = $("div.main-container > div.uvl-container > div.search-criteria-container > form div.panel-style-1 > div.panel-body-container > div.panel-body > div.panel-body-header h2")
						if (advancedSearchPanelsStyle1.length > 0)
						{
							/* PANEL HEADERS */
							sIFR.replace(sIFR.styles.PANEL_STYLE_1_HEADER, 
							{	
								selector:	"div.main-container > div.uvl-container > div.search-criteria-container > form div.panel-style-1 > div.panel-body-container > div.panel-body > div.panel-body-header h2"
							});
						}
			}
			
			

//function used to create all of the sliders
function RenderSliders() {
	$("div.slider-container").each(function()
		{
			if($(this).css('display') != 'none') {
				RenderSlider(this);
			}
		});
}
		

//function used to create sliders in supplied container
function RenderChildSliders(container) {
	var sliders = container.find("div.slider-container");
	sliders.each(function()
		{
			RenderSlider(this);
		});
}

//function used to create a slider
function RenderSlider(sliderElement) {
	//Get our slider container vars.
	var sliderContainer = $(sliderElement);
	var uiSliderContainer = sliderContainer.children("div.ui-slider-container");	//the main slider container
	var sliderTrack = uiSliderContainer.children("div.ui-slider-track");			//the actual area the handles move along
	var sliderHandles = sliderTrack.children("div.ui-slider-handle");				//handle(s) used to alter the selected values on the slider
	var sliderRange = sliderTrack.children("div.ui-slider-range");					//range is the highlighted area showing the area covered by the slider				
	var sliderSummary = uiSliderContainer.children('label.ui-slider-summary');		//label showing the value currently selected by the slider
	var sliderLowerLabel = uiSliderContainer.children('label.limit-low');			//label showing the lower bound of the slider
	var sliderUpperLabel = uiSliderContainer.children('label.limit-high');			//label showing the upper bound of the slider
	var sliderLabels = uiSliderContainer.children('label.ui-slider-limit');			//labels for showing limit values
	
	var handleCount = sliderHandles.length;											//indicates whether this is a single or dual slider
	var dataContainer = sliderContainer.children("select");							//select list(s) used to create this slider
	var upperRangeLimit = sliderContainer.find('input#UPPER_RANGE_LIMIT').val();		//the left param of the slider, used by the summary control to see if the upper handle has been moved or not
	var summaryDefaultText = sliderContainer.find('input#DUAL_SLIDER_SUMMARY_DEFAULT_TEXT').val();	//the text used by a dual slider's summary if neither handle has been moved
	var summaryPrefix = sliderContainer.find('input#DUAL_SLIDER_SUMMARY_PREFIX').val();			//the text used by a dual slider's summary if only the upper handle has been moved e.g. 'Up to £10,000'
	var summarySuffix = sliderContainer.find('input#DUAL_SLIDER_SUMMARY_SUFFIX').val();			//the text used by a dual slider's summary if only the lower handle has been moved e.g. '£10,000 and above'
	var summarySeparator = sliderContainer.find('input#DUAL_SLIDER_SUMMARY_SEPARATOR').val();		//the text used by a dual slider's summary if both handles have been moved e.g. '£10,000 to £20,000'
	var useRange = sliderContainer.find('input#USE_RANGE').val();		//value used to signify if the dual slider should use the range param
	var rangeHtml = sliderContainer.find('input#RANGE_HTML').val();		//the html to be inserted into the range div
	var intervalContainer = sliderContainer.find('div.ui-slider-track-intervals-container');   //the div that contains each of the interval markers
	var intervalCollection = intervalContainer.find('div.ui-slider-track-interval');				   //collection of the interval markers
	var trackWidth = sliderTrack.css('width').substring(0,sliderTrack.css('width').length-2);			//the width of the track minus the unit e.g 75px = 75
	var intervalItems = [];												//array of interval distances
	var dataItems = [];  													//values as an array of jquery objects.
	var selectedDataItem = 0;
	
	// parse true boolean for use range settings
	if (useRange.toLowerCase() === "true")
	{
		useRange = true;
	}
	else if (useRange.toLowerCase() === "false")
	{
		useRange = false;
	}
	
	//Loop though each of our available data items in our data container.
	$(dataContainer[0]).children().each(function(iDataItem)
	{		
		//Create a string key of this option.
		var dataItemKey = this.value + ":" + this.text;
		
		//get the selected
		if(this.selected == true)
		{
			selectedDataItem = iDataItem;
		}
		
		//we dont want a 0 value as this is covered by the 'any' option
		if(sliderContainer.value != '0') {					
			dataItems.push({key: dataItemKey, item: this, ordinal: [iDataItem,null]});	
		}
	});
					
	//The number of steps is equal to the data length - 1. (if we don't -1 then the slider is too big by one on the end)
	var dataLength = (dataItems.length-1);
	//Hide our select element.
	dataContainer.hide();

	//setup the inital state of the slider summary label
	sliderSummary.html(dataItems[selectedDataItem].item.text);

	//now we need to setup the widths for each of the interval markers
	CalculateIntervalWidths();
	
	
	
	// work out what our selected handle values are
	var handleValues = [];
	if (useRange === true)
	{
		handleValues[0] = selectedDataItem;			// min
		handleValues[1] = dataItems.length - 1;		// max
	}	
	else
	{
		handleValues[0] = selectedDataItem;
	}
	
	//Enable and show our slider bar.
	
	// add muliple handle values to slider if nessary
	if (useRange === true)
	{
		sliderTrack.slider(
		{
			//Set the number of steps to equal the options in the select element.
			step: 1,
			min: 0,
			max: dataLength,
			animate: true,
			range: useRange,
			rangeHtml: rangeHtml,
			values : handleValues,
			slide: function(event, ui) {
				//on the slide we need to update the summary label
				//sliderSummary.html(dataItems[ui.value].item.text);
				//RefreshSummaryText(event,ui);
			},
			change: function(event, ui) {
				//update the dataContainer
				RefreshSummaryText(event,ui);
				//sliderSummary.html(dataItems[ui.value].item.text);
				dataContainer.eq(0)[0].selectedIndex = dataItems[ui.value].ordinal[0];
				dataContainer.eq(0).trigger("change");
			}				
		});
	}
	else
	{
		sliderTrack.slider(
		{
			//Set the number of steps to equal the options in the select element.
			step: 1,
			min: 0,
			max: dataLength,
			animate: true,
			range: useRange,
			rangeHtml: rangeHtml,
			value: handleValues[0],
			slide: function(event, ui) {
				//on the slide we need to update the summary label
				//sliderSummary.html(dataItems[ui.value].item.text);
				//RefreshSummaryText(event,ui);
			},
			change: function(event, ui) {
				//update the dataContainer
				RefreshSummaryText(event,ui);
				//sliderSummary.html(dataItems[ui.value].item.text);
				dataContainer.eq(0)[0].selectedIndex = dataItems[ui.value].ordinal[0];
				dataContainer.eq(0).trigger("change");
			}				
		});
	}
	
	// now show
	sliderTrack.slider().show();
	
	function RefreshSummaryText(event, ui)
	{
		/*
		var summaryDefaultText = sliderContainer.find('input#DUAL_SLIDER_SUMMARY_DEFAULT_TEXT').val();	//the text used by a dual slider's summary if neither handle has been moved
		var summaryPrefix = sliderContainer.find('input#DUAL_SLIDER_SUMMARY_PREFIX').val();			//the text used by a dual slider's summary if only the upper handle has been moved e.g. 'Up to £10,000'
		var summarySuffix = sliderContainer.find('input#DUAL_SLIDER_SUMMARY_SUFFIX').val();			//the text used by a dual slider's summary if only the lower handle has been moved e.g. '£10,000 and above'
		var summarySeparator = sliderContainer.find('input#DUAL_SLIDER_SUMMARY_SEPARATOR').val();		//the text used by a dual slider's summary if both handles have been moved e.g. '£10,000 to £20,000'
		var sliderLabels = uiSliderContainer.children('label.ui-slider-limit');			//labels for showing limit values
		*/
		
		if (ui.values == null)
		{
			ui.values = [ui.value];
		}
		
		// set slider labels
		if (ui.values && ui.values.length > 0)
		{
			// loop through all selected handle values
			for (var i = 0; i < ui.values.length; i++)
			{
				// do we have a label to update
				if (i < sliderLabels.length)
				{
					// get value for label
					var dataValue, formattedValue;
					dataValue = dataItems[ui.values[i]].item.text;
					
					if (i === 0)
					{
						// add prefix
						formattedValue = ((summaryPrefix) ? summaryPrefix : '') + dataValue;
					}
					else if (i === 1)
					{
						// add sufix
						formattedValue = dataValue + summarySuffix;
					}
					else
					{
						// normal
						formattedValue = dataValue;
					}
					
					$(sliderLabels[i]).html(formattedValue);
				}
			}
		}
		
		// set summary text
		var summaryText;
		if (ui.values && ui.values.length > 1)
		{
			for (var i = 0; i < ui.values.length; i++)
			{
				if (i == 0)
				{
					summaryText = dataItems[ui.values[i]].item.text;
				}
				else
				{
					summaryText += summarySeparator + dataItems[ui.values[i]].item.text;
				}
			}
		}
		else
		{
			summaryText = dataItems[ui.values[0]].item.text;
		}
		
		sliderSummary.html(summaryText);
	}
	
	
	//internal function used to calculate the widths required for the interval markers
	function CalculateIntervalWidths() {
		//get the standard widths and any excess that might be left	
		var standardWidth = Math.floor(trackWidth / (dataLength));
		var excessWidth = trackWidth % standardWidth;
		var excessStart = 0;
		var excessEnd = 0;
		
		//if theres any excess left, then split it between the beginning and end
		if(excessWidth > 0) {
			var isExcessEven = (excessWidth % 2 == 0);
			if(isExcessEven) {
				excessStart = excessWidth / 2;
				excessEnd = excessWidth / 2;
			}
			else {
				var evenSplit = (excessWidth -1) / 2;
				excessStart = evenSplit + 1;
				excessEnd = evenSplit;
			}
			//alert("trackWidth = " + trackWidth + " // dataLength =  " + dataLength + " // excessWidth = " + excessWidth + " // excessStart = " + excessStart + " // excessEnd = " + excessEnd);
		}
		else {
			excessStart = 0;
			excessEnd	= 0;	
		}
		
		//insert the middle standard values
		var indexCounter = 0;
		var widthCounter = 0;
		intervalCollection.each(function() {
			$(this).css('left',widthCounter);
		
			//increment the indexCounter
			//indexCounter = indexCounter+1;
			indexCounter++;
					
			//now increment the widthCounter, depending on the position
			if(indexCounter == 1) {
				widthCounter = widthCounter + standardWidth + excessStart;	
			}
			else if (indexCounter == dataLength) {
				widthCounter = widthCounter + standardWidth + excessEnd;
			}
			else {
				widthCounter = widthCounter + standardWidth;
			}
		});
	}

	//internal function used to return the index of a value within the array passed in
	function containsKey(key, array)
	{
		for(var i = 0 ; i < array.length ; i++)
		{
			if(array[i].key == key) return i;
		}
		return -1;
	}
	
	
	
	// Broadcast SliderRenderComplete event
	
	var sliderCompleteEvent = 
	{
		target : sliderContainer
		
	}
	
	var sliderCompleteEvent = jQuery.Event("SLIDER-RENDER-COMPLETE");
	sliderCompleteEvent.targetSliderContainer = sliderContainer;

	$(document).trigger(sliderCompleteEvent); 
	
}


//function used to destroy all sliders!
function DestroySliders() {
	$("div.slider").each(
		function() {
			var sliderContainer = $(this);
			var uiSliderContainer = sliderContainer.children("div.ui-slider-container");
			var sliderTrack = uiSliderContainer.children("div.ui-slider-track");
			sliderTrack.slider('destroy');
		}
	);
}

//function used to destroy all sliders that are child of the container!
function DestroyChildSliders(container) {
	var sliders = container.find("div.slider");
	sliders.each(
		function() {
			var sliderContainer = $(this);
			var uiSliderContainer = sliderContainer.children("div.ui-slider-container");
			var sliderTrack = uiSliderContainer.children("div.ui-slider-track");
			sliderTrack.slider('destroy');
		}
	);
}

//fucntion used to reset all sliders
function ResetSliders() {
	$("div.slider").each(
		function() {
			ResetSlider($(this));	
		}
	);
}

//function used to reset a slider
function ResetSlider(container) {
	var sliderTrack = container.find("div.ui-slider-track");
	var steps = container.find('option').length;
	
	//we need to handle dual and single sliders differently
	var handleCount = sliderTrack.find("div.ui-slider-handle").length;
	if(handleCount == 1) {
		sliderTrack.slider('moveTo',steps,0);
	}
	else {
		sliderTrack.slider('moveTo',steps-1,1);
		sliderTrack.slider('moveTo',0,0);
	}
}


/*
 **************
 * Bind slider png fix trigger to SliderRenderComplete event
 **************
 */

	$(document).bind("SLIDER-RENDER-COMPLETE", function (e)
	{
		if ($.browser.msie && $.browser.version < 7)
		{
			var sliderContainer = e.targetSliderContainer;
			
			var pngs = sliderContainer.find(".png");
			for (var i = 0; i < pngs.length; i++) 
			{
				fix_PNG(pngs[i]);
			}
		}
	});


/// <reference path="jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />

/*
 *****************************
 *	PAGE INIT
 *****************************
 */
	
$(document).ready(function () 
{
    // this is a fix for the timeout issue
    window.onload = function()
    {
        if(self.location.href.toLowerCase().indexOf('timeout') > 0 && top != self)
        {
	        top.location = self.location.href;
        }
    };
    
	// if cookie plugin enable then get and store the flash version
	if ($.cookie)
	{
		var playerVersion = swfobject.getFlashPlayerVersion();
		var fv = playerVersion.major + "." + playerVersion.minor + "." + playerVersion.release;
		var cfv = $.cookie("fv");
		if (cfv !== fv)
		{
			$.cookie("fv", fv, { expires: 7, path: "/" });
		}
		//alert("Major = " + playerVersion.major + "\nMinor = " + playerVersion.minor + "\n" + playerVersion.release + "\nfv = " + fv + "\nCookie = " + $.cookie("fv"));
	}
	
	var safari = $.browser.safari;
	
	if (safari)
	{
		// Get body tag 
		var body = $("body");
		body.addClass("safari");
	}
	
	// Trigger page setup event into which ALL class instance declarations are added
	$(document).trigger("js-class-setup");
	
	
	// Run core sIFR replacement
	sIFR.replaceCoreAssets();
	
	// Run page specific sIFR replacements
	if (sIFR.replacePageAssets) sIFR.replacePageAssets();
	
	// Run dealer page specific sIFR replacements
	if (sIFR.replaceDealerPageAssets) sIFR.replaceDealerPageAssets();
	
	
	// Render custom slider controls
	if (window.RenderSliders)
	{
		RenderSliders();
	}
});


//create the args global method
jQuery(function($) {
	$.args = {
		names: [],
		
		values: [],
		
		//function to add a value to the array
		add: function(name,value) {
			this.names.push(name);
			this.values.push(value);
		},
		
		//function to clear the array
		clear: function() {
			this.names = [];
			this.values = [];
		},
		
		//function to get a value by its name
		getValue: function(name) {
			//cycle the names array till we find the correct index for the value
			for(var i=0;i<this.names.length;i++) {
				if(this.names[i] == name) {
					return this.values[i];
				}
			}
		},
		
		//function to get a value by its name
		setValue: function(name,value) {
			//cycle the names array till we find the correct index for the value
			for(var i=0;i<this.names.length;i++) {
				if(this.names[i] == name) {
					this.values[i] = value;
				}
			}
		},
		
		//function return the array as a delimited string
		getString: function(delimiter) {
			//ok if we have no delimiter assume its & for the QS
			if(!delimiter)
				delimiter = '&';
			
			var retval = '';
			
			//cycle the names array and build the string
			for(var i=0;i<this.names.length;i++) {
				retval += this.names[i] + '=' + this.values[i] + delimiter;
			}
			
			//no trim the trailing delimiter from the args string
			retval = retval.substr(0,retval.length-1);
			
			//return the build string
			return retval + '';
		}
	}
});

//create the ajaxManager global method
jQuery(function($) {
	//global settings used by this class
	var ajaxSettings = { };
	
	//initialize the ajaxManager
	$.ajaxManager = {
	    initialise : function(options) {
			$.extend(ajaxSettings, $.ajaxManager.defaults, options);
			if(ajaxSettings.debug) {
				alert('init');
			}
		},
		
		ajaxSettings: ajaxSettings,
		
		makeRequest: function() {
		    makeAjaxRequest();
		},
		updateUrl: function(urlData) {
			updateUrl(urlData);
		},
		clearArguments: function() {
			clearArguments();
		},
		onBeforeSend : on_BeforeSend,
		onSuccess : on_Success,
		onError: on_Error,
		onComplete : on_Complete
    };
	
	//available response types
	$.ajaxManager.dataType = {	
	    JSONP : 'jsonp',
	    JSON : 'json',
		HTML : 'html'};

	//available request methods
    $.ajaxManager.requestType = {	
        POST : 'POST',
		GET : 'GET'};										

	//default values
	$.ajaxManager.defaults = { 
        dataType : $.ajaxManager.dataType.JSON,
        requestType : $.ajaxManager.requestType.POST,
        requestUrl : null,
        requestArgs : null,
		    debug: false,
		    arguments: $.args
        };	

	//function used to make the ajax request
	function makeAjaxRequest() {
		if(ajaxSettings.debug) {
			alert('Beging Request');
		}
		
		//make the ajax call
//		alert(
//			"Test call parameters :"
//			"\t type = " + ajaxSettings.requestType +
//			"\n\t url = " + (ajaxSettings.requestUrl + ((ajaxSettings.requestArgs !== null) ? ("?" + ajaxSettings.requestArgs) : "" )) +
//			"\n\t url length = " + (ajaxSettings.requestUrl + ((ajaxSettings.requestArgs !== null) ? ("?" + ajaxSettings.requestArgs) : "" )).length +
//			"\n\t dataType = " + ajaxSettings.dataType
//		);
		
		$.ajax({
			type: ajaxSettings.requestType,
			url: ajaxSettings.requestUrl,
			data: ajaxSettings.requestArgs,
			dataType: ajaxSettings.dataType,
			beforeSend: function() {
                $.ajaxManager.onBeforeSend();
            },
            success: function(p_response) {
                $.ajaxManager.onSuccess(p_response);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                $.ajaxManager.onError(XMLHttpRequest, textStatus, errorThrown);
            },
			complete: function(XMLHttpRequest, textStatus) {
                $.ajaxManager.onComplete(XMLHttpRequest, textStatus);
            }
		});
		//alert("Ajax call made");
	}
	
	//function used to get all of the arguments from the querystring
	function updateUrl(urlData) {
		//if we dont have any urlData then we wont have any arguments
		if(!urlData) {
		  return;
		}
		
		// three update types
		//	-- full url + args
		//	-- just args (url comes from base setup)
		//	-- just url
		
		var queryStringIndex = urlData.indexOf("?");
		var firstArgIndex = urlData.indexOf("&");
		var firstEqualIndex = urlData.indexOf("=");
		
		var url = null;
		var args = null;
		
		if(queryStringIndex == 0 && (firstArgIndex > -1 || firstEqualIndex > -1))
		{
			// we have only been sent args but with a ?
			args = urlData.substring(1); // set args minus first char of ?
		}
		else if(queryStringIndex < 0 && (firstArgIndex > -1 || firstEqualIndex > -1))
		{
			// we have only been sent args
			args = urlData;
		}
		else if (queryStringIndex == -1 && (firstArgIndex < 0 && firstEqualIndex < 0))
		{
			// we only have a url
			url = urlData; // set url
		}
		else if (queryStringIndex > -1 && (firstArgIndex > -1 || firstEqualIndex > -1))
		{
			// we have both url and args
			url = urlData.substring(0,queryStringIndex); // set url without char of ?
			args = urlData.substring(queryStringIndex+1); // set args without char of ?
		}
		
		if (url != null)
			ajaxSettings.requestUrl = url;
			
		if (args != null)
			ajaxSettings.requestArgs = args;
		
		if(ajaxSettings.debug) {
			alert("url = " + ajaxSettings.requestUrl + ",\nargs = " + ajaxSettings.requestArgs + ".");
		}
	}	

	//funtion used to clear all existing arguments
	function clearArguments() {
		
		// if we have arguments then clear them		
		if(ajaxSettings && ajaxSettings.arguments && ajaxSettings.arguments.clear)
		{
			ajaxSettings.arguments.clear();
		}
		
		if(ajaxSettings.debug) {
			alert('arguments cleared successfully');
		}
	}
	
	//function to be overridden for the BeforSend event
	function on_BeforeSend() {
		if(ajaxSettings.debug) {
			alert('firing on_BeforeSend');
		}
	}
	
	//function to be ovewrridden for the onSuccess event
	function on_Success() {
		if(ajaxSettings.debug) {
			alert('firing on_Success');
		}
	}
	
	//function to be overridden for the OnError event
	function on_Error(XMLHttpRequest, textStatus, errorThrown) {
		if(ajaxSettings.debug) {
			alert('firing on_Error');
			
			alert(errorThrown);
			alert(textStatus);
			alert(XMLHttpRequest);
		}
	}
	
	//function to be overridden for the OnComplete event
	function on_Complete() {
		if(ajaxSettings.debug) {
			alert('firing on_Complete');
		}
	}
});

//declare the global AJAX constants
var HANDLER_URL = '/Handlers/cta.ashx';
var DEBUG = false;

//when the document is ready we need to initialize our global ajaxManager object
$(document).ready(function() {
    
    // only do this if we haven't already init the ajaxManager
    if (!$.ajaxManager.ajaxSettings.arguments)
    {
		//initialize the ajaxManager
		$.ajaxManager.initialise({
			responseType: $.ajaxManager.dataType.JSON,
			requestType: $.ajaxManager.requestType.POST,
			requestUrl: HANDLER_URL,
			debug: DEBUG
		});
	}
    
    $.ajaxManager.onError = function(XMLHttpRequest, textStatus, errorThrown)
    {
		if(this.debug)
		{
			alert('firing on_Error');
			
			alert(errorThrown);
			alert(textStatus);
			alert(XMLHttpRequest);
		}
		
		// check if error is a timeout, if so redirect to timeout page
		var contentType = XMLHttpRequest.getResponseHeader('Content-Type');
		if (contentType.indexOf('text/html') >= 0 && manheim.portfolio.global.Utilites.getScopedWorkflowKeyFromUrl)
		{
			var currentUrl = this.ajaxSettings.requestArgs;
			var redirectUrl;
			var searchWkflow;
			var wkflow = manheim.portfolio.global.Utilites.getScopedWorkflowKeyFromUrl(currentUrl,null);
			
			// strip the wkflow back to the scoped search manager
			var wkflowCodes = wkflow.split("_");
			if (wkflowCodes.length >= 2)
			{
				searchWkflow = wkflowCodes[0] + "_" + wkflowCodes[1];
			}
			
			if (searchWkflow == "se_na")
			{
				redirectUrl = "/timeout.aspx?wkflw=" + searchWkflow + "_ti_vi";
			}
			else
			{
				redirectUrl = "/results.aspx?wkflw=" + searchWkflow + "_re_vi";
			}
			
			if(this.debug)
			{
				alert("searchWkflow = " + searchWkflow + ".\nredirectUrl = " + redirectUrl + ".");
			}
			
			// goto redirect page
			document.location = redirectUrl;
		}
    };
    
});




/// <reference path="../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />


/**
*****************************************************************
* CLASS TEMPLATE
*****************************************************************
*
* Class description : Handles Ajax Work Flow Link call backs
*
* Author : Rob E
*/


//Check that namespace into which the Class definition will be creates has been defined & if not then create
if (!manheim.global.isNamespaceDefined("manheim.portfolio.common.display"))
{
	manheim.global.createNamespace("manheim.portfolio.common.display", "1.0");
}


manheim.portfolio.common.display.AjaxConditionalLinkManager = Object.subClass(
		{
			/*
			=============================
			CONSTANTS
			=============================
			*/
			REQUEST_ARGUMENT_CORE_ID				: "vhl",
			RESPONSE_ARGUMENT_RETURN_CORE_ID		: "rvhl",
			DEBUG									: false,

			
			/*
			=============================
			CONSTRUCTOR
			=============================
			*/
			init: function (instanceReferenceString) 
			{
				var _this = this;
				var container = $(document);
				
				this.instanceString = instanceReferenceString;
				
				_this.bindAllAjaxConditionalLinks(container);
			},



			/*
			 =============================
			 CONFIGURATION PROPERTIES (instance configuration)
			 =============================
			 */
				instanceString : undefined,
				
				

			/*
			=============================
			INTERNAL METHODS
			=============================
			*/
			
			//function used to bind all conditional click events
			bindAllAjaxConditionalLinks : function (container) {			
				var _this = this;
				
				//bind any ajax links that aren't compare link
				container.find(".ajax-conditional-workflow-link:not(.ajax-conditional-workflow-link-compare)").each(function () {
					_this._bindNonCompareConditionalLink($(this));
				});

				//bind the compare links 
				container.find(".ajax-conditional-workflow-link-compare").each(function () {
					_this._bindCompareConditionalLink($(this));
				});
			},
			
			/* this is what the refracture of this class should look like */
			handleConditionalLinkClick : function (e)
			{
				var _this = this;
				var jqLink = $(e.target);
				
				// this
					// limit check
					// process ajax request
				
				// process ajax request
					// update ajax url
					// handle ajax onBeforeSend
					// handle ajax onSuccess
					// handle ajax onError
					// ajax make request
				
				// onBeforeSent
					// set loading state
					
				// onError
					// set error state
					
				// onSucess
					// get state
					// process state
					// process return arguments state
					// update counter
			},
			
			//function used to bind all of the noncompare conditional click events
			_bindNonCompareConditionalLink : function (link, scopedClass)
			{
				var _this = (scopedClass) ? scopedClass : this;
				
				if (link.attr('href').indexOf('.ashx') > -1) {
					link.click(function (event) {
						//stop the default click through from happening
						event.preventDefault();
						var hdnFavouriteCount = $('input#hdnFavouriteCount');
						var spnFavouriteCount = $('span.user-toolbar-favourite-count');
						var FavouriteCountInt = parseInt(hdnFavouriteCount.val());

						var id = link.attr('id');

						//now display the loading state
						var loading = eval(id + '.loading');

						//get the href to use for the ajax call
						var href = link.attr('href');

						//display the loading state and then
						var loadingElement = $(loading);

						//$(this).after(loadingElement).remove(); 
						$(this).replaceWith(loadingElement);

						//make the ajax call
						$.ajaxManager.updateUrl(href);
						$.ajaxManager.onSuccess = function (p_response) {
							_this._processAjaxRequest(p_response, id, loadingElement, "input#hdnFavouriteCount");
						};
						$.ajaxManager.makeRequest();
						//hdnFavouriteCount.val(FavouriteCountInt + 1);
						//spnFavouriteCount.html(FavouriteCountInt + 1);
						//spnFavouriteCount.parent().css({ 'display': 'block' });
					});
				}
			},
					
			//function used to bind the compare conditional links, this adds in the jqModal functionality once the limit is reached
			_bindCompareConditionalLink : function (link, scopedClass) {
				var _this = (scopedClass) ? scopedClass : this;

				if (link.attr('href').indexOf('.ashx') > -1) {
					link.click(function (event) 
					{
						event.preventDefault();
						
						var containerTargetString = '.ui-lightbox-container div#dvCompareLimitWarning';
						
						var hdnCompareCount = $('input#hdnCompareCount');
						var spnCompareCount = $('span.user-toolbar-compare-count');
						var compareCountInt = parseInt(hdnCompareCount.val());

						//if we have hit our compare limit then display the modal dialog to warn the user
						if (compareCountInt > 2) {

							//get the params needed to hack this into the lightbox
							var rawParams = '#?go=go&width=400&height=160&target=divUvlContainer&source=dvCompareLimitWarning&displayPosition=viewableCentre';
							var parameters = uiBox_GetQueryString(rawParams);

							//show the lightbox
							uiBox_Show(parameters, rawParams);
							
							//now bind the cancel and continue buttons
							var dialogContainer = $(containerTargetString);
							
							var continueButton	= dialogContainer.find("div.button-continue");
							var cancelButton	= dialogContainer.find("div.button-cancel");
							
							
							_this._linkReference = link;
							
							
							// Attanch standard click functionality to links
							
							continueButton.click(
								function (e)
								{
									_this._handleDialogueButtonClick(true);
								}
							);
							
							cancelButton.click(
								function (e)
								{
									uiBox_Hide();
								}
							);
							
							
							// If ie then add href attribute to each buttons internal <a> tag
//							if ($.browser.msie)
//							{
//								var continueLink	= continueButton.find("a");
//								var cancelLink		= cancelButton.find("a");
//								
//								continueLink.attr("href", "javascript:" + _this.instanceString + "._handleDialogueButtonClick(true);");
//								cancelLink.attr("href", "javascript:" + _this.instanceString + "._handleDialogueButtonClick(false);");
//							}
//							
//							
//							// Style buttons
//							sIFR.runDelayedButtonStyling(containerTargetString + " " + "div.button-style-1" + " " + sIFR_settings.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH);
							
						}
						else 
						{
							_this._sendCompareRequest(link);
							//hdnCompareCount.val(compareCountInt + 1);
							//spnCompareCount.html(compareCountInt + 1);
							//spnCompareCount.parent().css({'display':'block'});
						}
					});
				}
			},
			
			
			_linkReference : undefined,
			
			
			_handleDialogueButtonClick : function (sendRequest)
			{
				if (sendRequest)
				{
					this._sendCompareRequest(this._linkReference);
				}
				uiBox_Hide();
			},
			
			
			
			//function used to send the compare request
			_sendCompareRequest : function (link) {
				var _this = this;
				var id = link.attr('id');

				//now display the loading state
				var loading = eval(id + '.loading');

				//get the href to use for the ajax call
				var href = link.attr('href');

				//display the loading state and then
				var loadingElement = $(loading);

				//$(this).after(loadingElement).remove();
				link.replaceWith(loadingElement);

				//make the ajax call
				$.ajaxManager.updateUrl(href);
				$.ajaxManager.onSuccess = function (p_response) {
					_this._processCompareAjaxRequest(p_response, id, loadingElement);
				};
				$.ajaxManager.makeRequest();
			},
			
			
			//function used to process the results from the ajax requests
			_processCompareAjaxRequest : function (response, id, loadingElement) {
				var _this = this;
				
				// get link condition data
				var linkConditionsData	= eval(id);
				
				// get the next link condition result
				var result = $(eval(id + "." + response.status));
				
				// get the core id of the link conditions
				var coreId = linkConditionsData.arguments[this.REQUEST_ARGUMENT_CORE_ID];
				
				// if we have a removal argument they we update any link conditions to the new state
				if (response.arguments[this.RESPONSE_ARGUMENT_RETURN_CORE_ID])
				{
					this._processAnyMatchingLinkConditions('.' + response.arguments[this.RESPONSE_ARGUMENT_RETURN_CORE_ID] + ' a.a-icon-compare', "off", _this._bindCompareConditionalLink);
				}
				
				// update any link conditions to the new state (this covers any other link conditions that are not the current)
				this._processAnyMatchingLinkConditions('.' + coreId + ' a.a-icon-compare', response.status, _this._bindCompareConditionalLink);
				
				// swap out the current link condition state
				loadingElement.replaceWith(result);
				
				// rebind the result control
				this._reBindControl(result);
				
				// process any additional controls
				var responseResult = eval(response);
				this._processResultControls(responseResult);

				// set hidden compare counter
				if (responseResult.arguments && responseResult.arguments["count"])
				{
					$('input#hdnCompareCount').val(responseResult.arguments["count"]);
				}

				//if the result element is a callback element then drop its click handler
				if (!result.attr('href').indexOf('.ashx') == -1) {
					result.unbind('click');
				}
				else {
					_this._bindCompareConditionalLink(result);
				}
			},
			
			//function used to process the results from the ajax requests
			_processAjaxRequest : function (response, id, loadingElement, counterSelector) {
				var _this = this;
				
				// get link condition data
				var linkConditionsData	= eval(id);
				
				// get the next link condition result
				var result = $(eval(id + "." + response.status));
				
				// get the core id of the link conditions
				var coreId = linkConditionsData.arguments[this.REQUEST_ARGUMENT_CORE_ID];

				// update any link conditions to the new state (this covers any other link conditions that are not the current)
				this._processAnyMatchingLinkConditions('.' + coreId + ' a.a-icon-favourites, .' + coreId + ' a.a-icon-favourites-icon-only', response.status, _this._bindNonCompareConditionalLink);
				
				//loadingElement.after(result).remove();
				loadingElement.replaceWith(result);
				
				// rebind the result control
				this._reBindControl(result);
				
				// process any additional controls
				var responseResult = eval(response);
				this._processResultControls(responseResult);
				
				// set hidden counter if nessary
				if (counterSelector && responseResult.arguments && responseResult.arguments["count"])
				{
					$(counterSelector).val(responseResult.arguments["count"]);
				}
				
				//if the result element is a callback element then drop its click handler
				if (!result.attr('href').indexOf('.ashx') == -1) {
					result.unbind('click');
				}
				else {
					_this._bindNonCompareConditionalLink(result);
				}
			},
			
			/* Ensure that any other ajax link conditions on the page have their state updated */
			_processAnyMatchingLinkConditions : function (selector, state, binder)
			{
				var _this = this;
				var conditionalLinks = $(document).find(selector).filter("a[href]");
				
				conditionalLinks.each(function ()
				{
					//for each time the link has been found we need to amend the state globally of its
					var ___this = $(this);
					
					var replacementId = ___this.attr('id');
					var replacementElement = $(eval(replacementId + '.' + state));
					___this.replaceWith(replacementElement);
					
					_this._reBindControl(replacementElement);
					
					replacementElement.unbind('click');
					binder(replacementElement, _this);
				});	
			},
			
			// function used to loop through a result object's controls and process them to the page if nessary
			/* Normal Result controls Response
			{
				controls :
					[
						{
							controlName		: "",
							targetDomId		: "",
							content			: "",
							placementType	: ""
						},
					]
			}
			*/
			
			// add re-bind controls when inserted
			/* TODO:
					Need to add in config what control replacements should run what reinit's, add the reinit processors to an array
					and then pick out the reinit's and run them over the jqContainer that we are inserting.
					
					This needs moving into a CallBackUtilityFunction as the callbacks are now a standard format
			*/
			_reBindControl : function (jqContainer)
			{
				if (window.fix_PNGs)
				{
					if (jqContainer.find(".png").length > 0)
					{
						fix_PNGs(jqContainer);
					}
					else
					{
						fix_PNG(jqContainer);
					}
				}
				
				if (window.manheim_portfolio_tooltip)
				{
					manheim_portfolio_tooltip.BindToolTips(jqContainer);
				}
			},
			
			// TODO this needs moving into a CallBackUtilityFunction as the callbacks are now a standard format
			_findDataControl : function (result, controlName)
			{
				if (result == null || result.controls == null)
				{
					return null;
				}
				
				for (var i = 0; i < result.controls.length; i++)
				{
					if (result.controls[i].controlName == controlName)
					{
						return result.controls[i];
					}
				}
				
				return null;
			},
			
			// TODO this needs moving into a CallBackUtilityFunction as the callbacks are now a standard format
			/* Normal Content Response
			{
				controls :
					[
						{
							controlName		: "",
							targetDomId		: "",
							content			: "",
							placementType	: ""
						},
					]
			}
			*/
			_processResultControls : function (result, rebindControls)
			{
				this._debugMessage("Started: Processing ajax control results");
				
				rebindControls = (rebindControls != undefined) ? rebindControls : true;
				
				if (result == null || result.controls == null)
				{
					return;
				}
				
				for (var i = 0; i < result.controls.length; i++)
				{
					this._debugMessage("Start: Get next control reference.");
					var controlReference = result.controls[i];
					this._debugMessage("End: Get next control reference.");
					
					this._debugMessage("Start: Use JQuery to find DOM element to replace (" + "#" + result.controls[i].targetDomId + ").");
					var target = $("#" + result.controls[i].targetDomId); // TODO we should change to a normal selector not id based that way we can
					this._debugMessage("End: Use JQuery to find DOM element to replace (" + "#" + result.controls[i].targetDomId + ").");
					
					if (target.length > 0)
					{
						//var content = UnEncodeResponse(result.controls[i].content); // don't need to encode any more as the server formats json correctly now
						//var content = $(result.controls[i].content);
						
						this._debugMessage("Processing " + controlReference.controlName + " control using '" + controlReference.placementType + "' rendering method.");
						
						if (controlReference.placementType == "Replace")
						{
							target.replaceWith(result.controls[i].content);
							this._debugMessage("Replaced content for " + controlReference.controlName + " control.");
						}
						else if (controlReference.placementType == "InsertAdd")
						{
							target.append(result.controls[i].content);
							this._debugMessage("Appended content for " + controlReference.controlName + " control.");
						}
						else
						{
							// InsertReplace
							target.html(result.controls[i].content);
							this._debugMessage("Replaced inner html for " + controlReference.controlName + " control.");
						}
						
						// run reinit control
						if (rebindControls)
						{
							this._reBindControl($("#" + result.controls[i].targetDomId));
						}
						
						this._debugMessage("Finished re bind for " + controlReference.controlName + " control.");
					}
				}
				
				this._debugMessage("Finished: Processing ajax control results");
			},
			
			_debugMessage : function (message)
		     {
				if (this.DEBUG)
				{
					alert(message);
				}
		     }
		}
	);


/*
 **************
 * IMPORTANT :: All runtime instance declarations MUST be bound to document 'js-class-setup' event
 **************
 */

	$(document).bind("js-class-setup", function ()
	{
		// Setup runtime namespace if doesn't exist
		if (!manheim.global.isNamespaceDefined("manheim.portfolio.runtime.display")) manheim.global.createNamespace("manheim.portfolio.runtime.display", "1.0");
		
		// Create instance
		manheim.portfolio.common.display.ajaxConditionalLinkManager = new manheim.portfolio.common.display.AjaxConditionalLinkManager("manheim.portfolio.common.display.ajaxConditionalLinkManager");
		//manheim.portfolio.common.display.ajaxConditionalLinkManager = true;
	});	



/*
 * CUSTOMISED TO INCLUDE A LINEAR (NO EASING) EQUATION
 *
 * This way can explicitly run an animation without easing
 */



/*
 * 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
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.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 - jQuery.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 jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	},
	easeLinear: function (x, t, b, c, d) {
		return c*t/d + 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. 
 *
 */

/*! SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/

var swfobject = function() {
	
	var UNDEF = "undefined",
		OBJECT = "object",
		SHOCKWAVE_FLASH = "Shockwave Flash",
		SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
		FLASH_MIME_TYPE = "application/x-shockwave-flash",
		EXPRESS_INSTALL_ID = "SWFObjectExprInst",
		
		win = window,
		doc = document,
		nav = navigator,
		
		domLoadFnArr = [],
		regObjArr = [],
		objIdArr = [],
		listenersArr = [],
		script,
		timer = null,
		storedAltContent = null,
		storedAltContentId = null,
		isDomLoaded = false,
		isExpressInstallActive = false;
	
	/* Centralized function for browser feature detection
		- Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
		- User agent string detection is only used when no alternative is possible
		- Is executed directly for optimal performance
	*/	
	var ua = function() {
		var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
			playerVersion = [0,0,0],
			d = null;
		if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
			d = nav.plugins[SHOCKWAVE_FLASH].description;
			if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
				d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
				playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
				playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			}
		}
		else if (typeof win.ActiveXObject != UNDEF) {
			var a = null, fp6Crash = false;
			try {
				a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
			}
			catch(e) {
				try { 
					a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
					playerVersion = [6,0,21];
					a.AllowScriptAccess = "always";	 // Introduced in fp6.0.47
				}
				catch(e) {
					if (playerVersion[0] == 6) {
						fp6Crash = true;
					}
				}
				if (!fp6Crash) {
					try {
						a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
					}
					catch(e) {}
				}
			}
			if (!fp6Crash && a) { // a will return null when ActiveX is disabled
				try {
					d = a.GetVariable("$version");	// Will crash fp6.0.21/23/29
					if (d) {
						d = d.split(" ")[1].split(",");
						playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
					}
				}
				catch(e) {}
			}
		}
		var u = nav.userAgent.toLowerCase(),
			p = nav.platform.toLowerCase(),
			webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
			ie = false,
			windows = p ? /win/.test(p) : /win/.test(u),
			mac = p ? /mac/.test(p) : /mac/.test(u);
		/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/
		return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
	}();

	/* Cross-browser onDomLoad
		- Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
		- Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
	*/ 
	var onDomLoad = function() {
		if (!ua.w3cdom) {
			return;
		}
		addDomLoadEvent(main);
		if (ua.ie && ua.win) {
			try {	 // Avoid a possible Operation Aborted error
				doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors 
				script = getElementById("__ie_ondomload");
				if (script) {
					addListener(script, "onreadystatechange", checkReadyState);
				}
			}
			catch(e) {}
		}
		if (ua.webkit && typeof doc.readyState != UNDEF) {
			timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
		}
		if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
		}
		addLoadEvent(callDomLoadFunctions);
	}();
	
	function checkReadyState() {
		if (script.readyState == "complete") {
			script.parentNode.removeChild(script);
			callDomLoadFunctions();
		}
	}
	
	function callDomLoadFunctions() {
		if (isDomLoaded) {
			return;
		}
		if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
			var s = createElement("span");
			try { // Avoid a possible Operation Aborted error
				var t = doc.getElementsByTagName("body")[0].appendChild(s);
				t.parentNode.removeChild(t);
			}
			catch (e) {
				return;
			}
		}
		isDomLoaded = true;
		if (timer) {
			clearInterval(timer);
			timer = null;
		}
		var dl = domLoadFnArr.length;
		for (var i = 0; i < dl; i++) {
			domLoadFnArr[i]();
		}
	}
	
	function addDomLoadEvent(fn) {
		if (isDomLoaded) {
			fn();
		}
		else { 
			domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
		}
	}
	
	/* Cross-browser onload
		- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
		- Will fire an event as soon as a web page including all of its assets are loaded 
	 */
	function addLoadEvent(fn) {
		if (typeof win.addEventListener != UNDEF) {
			win.addEventListener("load", fn, false);
		}
		else if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("load", fn, false);
		}
		else if (typeof win.attachEvent != UNDEF) {
			addListener(win, "onload", fn);
		}
		else if (typeof win.onload == "function") {
			var fnOld = win.onload;
			win.onload = function() {
				fnOld();
				fn();
			};
		}
		else {
			win.onload = fn;
		}
	}
	
	/* Main function
		- Will preferably execute onDomLoad, otherwise onload (as a fallback)
	*/
	function main() { // Static publishing only
		var rl = regObjArr.length;
		for (var i = 0; i < rl; i++) { // For each registered object element
			var id = regObjArr[i].id;
			if (ua.pv[0] > 0) {
				var obj = getElementById(id);
				if (obj) {
					regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
					regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
					if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
						if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
							fixParams(obj);
						}
						setVisibility(id, true);
					}
					else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
						showExpressInstall(regObjArr[i]);
					}
					else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
						displayAltContent(obj);
					}
				}
			}
			else {	// If no fp is installed, we let the object element do its job (show alternative content)
				setVisibility(id, true);
			}
		}
	}
	
	/* Fix nested param elements, which are ignored by older webkit engines
		- This includes Safari up to and including version 1.2.2 on Mac OS 10.3
		- Fall back to the proprietary embed element
	*/
	function fixParams(obj) {
		var nestedObj = obj.getElementsByTagName(OBJECT)[0];
		if (nestedObj) {
			var e = createElement("embed"), a = nestedObj.attributes;
			if (a) {
				var al = a.length;
				for (var i = 0; i < al; i++) {
					if (a[i].nodeName == "DATA") {
						e.setAttribute("src", a[i].nodeValue);
					}
					else {
						e.setAttribute(a[i].nodeName, a[i].nodeValue);
					}
				}
			}
			var c = nestedObj.childNodes;
			if (c) {
				var cl = c.length;
				for (var j = 0; j < cl; j++) {
					if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") {
						e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
					}
				}
			}
			obj.parentNode.replaceChild(e, obj);
		}
	}
	
	/* Show the Adobe Express Install dialog
		- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
	*/
	function showExpressInstall(regObj) {
		isExpressInstallActive = true;
		var obj = getElementById(regObj.id);
		if (obj) {
			if (regObj.altContentId) {
				var ac = getElementById(regObj.altContentId);
				if (ac) {
					storedAltContent = ac;
					storedAltContentId = regObj.altContentId;
				}
			}
			else {
				storedAltContent = abstractAltContent(obj);
			}
			if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
				regObj.width = "310";
			}
			if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
				regObj.height = "137";
			}
			doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
			var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
				dt = doc.title,
				fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
				replaceId = regObj.id;
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			if (ua.ie && ua.win && obj.readyState != 4) {
				var newObj = createElement("div");
				replaceId += "SWFObjectNew";
				newObj.setAttribute("id", replaceId);
				obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
				obj.style.display = "none";
				var fn = function() {
					obj.parentNode.removeChild(obj);
				};
				addListener(win, "onload", fn);
			}
			createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
		}
	}
	
	/* Functions to abstract and display alternative content
	*/
	function displayAltContent(obj) {
		if (ua.ie && ua.win && obj.readyState != 4) {
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			var el = createElement("div");
			obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
			el.parentNode.replaceChild(abstractAltContent(obj), el);
			obj.style.display = "none";
			var fn = function() {
				obj.parentNode.removeChild(obj);
			};
			addListener(win, "onload", fn);
		}
		else {
			obj.parentNode.replaceChild(abstractAltContent(obj), obj);
		}
	} 

	function abstractAltContent(obj) {
		var ac = createElement("div");
		if (ua.win && ua.ie) {
			ac.innerHTML = obj.innerHTML;
		}
		else {
			var nestedObj = obj.getElementsByTagName(OBJECT)[0];
			if (nestedObj) {
				var c = nestedObj.childNodes;
				if (c) {
					var cl = c.length;
					for (var i = 0; i < cl; i++) {
						if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
							ac.appendChild(c[i].cloneNode(true));
						}
					}
				}
			}
		}
		return ac;
	}
	
	/* Cross-browser dynamic SWF creation
	*/
	function createSWF(attObj, parObj, id) {
		var r, el = getElementById(id);
		if (el) {
			if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
				attObj.id = id;
			}
			if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
				var att = "";
				for (var i in attObj) {
					if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
						if (i.toLowerCase() == "data") {
							parObj.movie = attObj[i];
						}
						else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							att += ' class="' + attObj[i] + '"';
						}
						else if (i.toLowerCase() != "classid") {
							att += ' ' + i + '="' + attObj[i] + '"';
						}
					}
				}
				var par = "";
				for (var j in parObj) {
					if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
						par += '<param name="' + j + '" value="' + parObj[j] + '" />';
					}
				}
				el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
				objIdArr[objIdArr.length] = attObj.id; // Stored to fix object 'leaks' on unload (dynamic publishing only)
				r = getElementById(attObj.id);	
			}
			else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
				var e = createElement("embed");
				e.setAttribute("type", FLASH_MIME_TYPE);
				for (var k in attObj) {
					if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
						if (k.toLowerCase() == "data") {
							e.setAttribute("src", attObj[k]);
						}
						else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							e.setAttribute("class", attObj[k]);
						}
						else if (k.toLowerCase() != "classid") { // Filter out IE specific attribute
							e.setAttribute(k, attObj[k]);
						}
					}
				}
				for (var l in parObj) {
					if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
						if (l.toLowerCase() != "movie") { // Filter out IE specific param element
							e.setAttribute(l, parObj[l]);
						}
					}
				}
				el.parentNode.replaceChild(e, el);
				r = e;
			}
			else { // Well-behaving browsers
				var o = createElement(OBJECT);
				o.setAttribute("type", FLASH_MIME_TYPE);
				for (var m in attObj) {
					if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
						if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							o.setAttribute("class", attObj[m]);
						}
						else if (m.toLowerCase() != "classid") { // Filter out IE specific attribute
							o.setAttribute(m, attObj[m]);
						}
					}
				}
				for (var n in parObj) {
					if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
						createObjParam(o, n, parObj[n]);
					}
				}
				el.parentNode.replaceChild(o, el);
				r = o;
			}
		}
		return r;
	}
	
	function createObjParam(el, pName, pValue) {
		var p = createElement("param");
		p.setAttribute("name", pName);	
		p.setAttribute("value", pValue);
		el.appendChild(p);
	}
	
	/* Cross-browser SWF removal
		- Especially needed to safely and completely remove a SWF in Internet Explorer
	*/
	function removeSWF(id) {
		var obj = getElementById(id);
		if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) {
			if (ua.ie && ua.win) {
				if (obj.readyState == 4) {
					removeObjectInIE(id);
				}
				else {
					win.attachEvent("onload", function() {
						removeObjectInIE(id);
					});
				}
			}
			else {
				obj.parentNode.removeChild(obj);
			}
		}
	}
	
	function removeObjectInIE(id) {
		var obj = getElementById(id);
		if (obj) {
			for (var i in obj) {
				if (typeof obj[i] == "function") {
					obj[i] = null;
				}
			}
			obj.parentNode.removeChild(obj);
		}
	}
	
	/* Functions to optimize JavaScript compression
	*/
	function getElementById(id) {
		var el = null;
		try {
			el = doc.getElementById(id);
		}
		catch (e) {}
		return el;
	}
	
	function createElement(el) {
		return doc.createElement(el);
	}
	
	/* Updated attachEvent function for Internet Explorer
		- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
	*/	
	function addListener(target, eventType, fn) {
		target.attachEvent(eventType, fn);
		listenersArr[listenersArr.length] = [target, eventType, fn];
	}
	
	/* Flash Player and SWF content version matching
	*/
	function hasPlayerVersion(rv) {
		var pv = ua.pv, v = rv.split(".");
		v[0] = parseInt(v[0], 10);
		v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
		v[2] = parseInt(v[2], 10) || 0;
		return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
	}
	
	/* Cross-browser dynamic CSS creation
		- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
	*/	
	function createCSS(sel, decl) {
		if (ua.ie && ua.mac) {
			return;
		}
		var h = doc.getElementsByTagName("head")[0], s = createElement("style");
		s.setAttribute("type", "text/css");
		s.setAttribute("media", "screen");
		if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
			s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
		}
		h.appendChild(s);
		if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
			var ls = doc.styleSheets[doc.styleSheets.length - 1];
			if (typeof ls.addRule == OBJECT) {
				ls.addRule(sel, decl);
			}
		}
	}
	
	function setVisibility(id, isVisible) {
		var v = isVisible ? "visible" : "hidden";
		if (isDomLoaded && getElementById(id)) {
			getElementById(id).style.visibility = v;
		}
		else {
			createCSS("#" + id, "visibility:" + v);
		}
	}

	/* Filter to avoid XSS attacks 
	*/
	function urlEncodeIfNecessary(s) {
		var regex = /[\\\"<>\.;]/;
		var hasBadChars = regex.exec(s) != null;
		return hasBadChars ? encodeURIComponent(s) : s;
	}
	
	/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
	*/
	var cleanup = function() {
		if (ua.ie && ua.win) {
			window.attachEvent("onunload", function() {
				// remove listeners to avoid memory leaks
				var ll = listenersArr.length;
				for (var i = 0; i < ll; i++) {
					listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
				}
				// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
				var il = objIdArr.length;
				for (var j = 0; j < il; j++) {
					removeSWF(objIdArr[j]);
				}
				// cleanup library's main closures to avoid memory leaks
				for (var k in ua) {
					ua[k] = null;
				}
				ua = null;
				for (var l in swfobject) {
					swfobject[l] = null;
				}
				swfobject = null;
			});
		}
	}();
	
	
	return {
		/* Public API
			- Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
		*/ 
		registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
			if (!ua.w3cdom || !objectIdStr || !swfVersionStr) {
				return;
			}
			var regObj = {};
			regObj.id = objectIdStr;
			regObj.swfVersion = swfVersionStr;
			regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false;
			regObjArr[regObjArr.length] = regObj;
			setVisibility(objectIdStr, false);
		},
		
		getObjectById: function(objectIdStr) {
			var r = null;
			if (ua.w3cdom) {
				var o = getElementById(objectIdStr);
				if (o) {
					var n = o.getElementsByTagName(OBJECT)[0];
					if (!n || (n && typeof o.SetVariable != UNDEF)) {
							r = o;
					}
					else if (typeof n.SetVariable != UNDEF) {
						r = n;
					}
				}
			}
			return r;
		},
		
		embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
			if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
				return;
			}
			widthStr += ""; // Auto-convert to string
			heightStr += "";
			if (hasPlayerVersion(swfVersionStr)) {
				setVisibility(replaceElemIdStr, false);
				var att = {};
				if (attObj && typeof attObj === OBJECT) {
					for (var i in attObj) {
						if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
							att[i] = attObj[i];
						}
					}
				}
				att.data = swfUrlStr;
				att.width = widthStr;
				att.height = heightStr;
				var par = {}; 
				if (parObj && typeof parObj === OBJECT) {
					for (var j in parObj) {
						if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
							par[j] = parObj[j];
						}
					}
				}
				if (flashvarsObj && typeof flashvarsObj === OBJECT) {
					for (var k in flashvarsObj) {
						if (flashvarsObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
							if (typeof par.flashvars != UNDEF) {
								par.flashvars += "&" + k + "=" + flashvarsObj[k];
							}
							else {
								par.flashvars = k + "=" + flashvarsObj[k];
							}
						}
					}
				}
				addDomLoadEvent(function() {
					createSWF(att, par, replaceElemIdStr);
					if (att.id == replaceElemIdStr) {
						setVisibility(replaceElemIdStr, true);
					}
				});
			}
			else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
				isExpressInstallActive = true; // deferred execution
				setVisibility(replaceElemIdStr, false);
				addDomLoadEvent(function() {
					var regObj = {};
					regObj.id = regObj.altContentId = replaceElemIdStr;
					regObj.width = widthStr;
					regObj.height = heightStr;
					regObj.expressInstall = xiSwfUrlStr;
					showExpressInstall(regObj);
				});
			}
		},
		
		getFlashPlayerVersion: function() {
			return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
		},
		
		hasFlashPlayerVersion: hasPlayerVersion,
		
		createSWF: function(attObj, parObj, replaceElemIdStr) {
			if (ua.w3cdom) {
				return createSWF(attObj, parObj, replaceElemIdStr);
			}
			else {
				return undefined;
			}
		},
		
		removeSWF: function(objElemIdStr) {
			if (ua.w3cdom) {
				removeSWF(objElemIdStr);
			}
		},
		
		createCSS: function(sel, decl) {
			if (ua.w3cdom) {
				createCSS(sel, decl);
			}
		},
		
		addDomLoadEvent: addDomLoadEvent,
		
		addLoadEvent: addLoadEvent,
		
		getQueryParamValue: function(param) {
			var q = doc.location.search || doc.location.hash;
			if (param == null) {
				return urlEncodeIfNecessary(q);
			}
			if (q) {
				var pairs = q.substring(1).split("&");
				for (var i = 0; i < pairs.length; i++) {
					if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
						return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
					}
				}
			}
			return "";
		},
		
		// For internal usage only
		expressInstallCallback: function() {
			if (isExpressInstallActive && storedAltContent) {
				var obj = getElementById(EXPRESS_INSTALL_ID);
				if (obj) {
					obj.parentNode.replaceChild(storedAltContent, obj);
					if (storedAltContentId) {
						setVisibility(storedAltContentId, true);
						if (ua.ie && ua.win) {
							storedAltContent.style.display = "block";
						}
					}
					storedAltContent = null;
					storedAltContentId = null;
					isExpressInstallActive = false;
				}
			} 
		}
	};
}();


// PLEASE DO NOT EDIT THIS FILE
// THIS FIX RUNS AUTOMATICALLY ON DOCUMENT LOAD
// AN ALTERNATIVE VERSION IS AVAILABLE FOR MANUAL RUNNING [ see .....(not yet added)..... ]

//******************************
// ADD page onload event
//******************************

$(document).ready(function() 
{
	
	if($.browser.msie && $.browser.version < 7 ) 
	{
		fix_PNGs($(this).find("body"));
	}
	
});
	
//******************************
// IE 6 PNG TRANSPARENCY FIX WORKER METHODS
//******************************
function fix_PNGs(containerJQueryObject) 
{
	if($.browser.msie && $.browser.version < 7) 
	{
		var containerJQObject = (containerJQueryObject) ? containerJQueryObject : $(this).find("body");
		var pngs = containerJQObject.find(".png");
		for (var i = 0; i < pngs.length; i++) 
		{
			fix_PNG(pngs[i]);
		}
	}
}

function fix_PNG(imageObj) 
{
	//
	//'runtimeStyle' property is an IE ONLY property therefore return of !IE
	//
	if(!$.browser.msie) // && $.browser.version < 7
	{
		return;
	}
	
	if (imageObj.nodeName=="IMG" || imageObj.nodeName=="INPUT") 
	{
		var pngURL = imageObj.src;
		
		//Check our image is actually a png and bail if not.
		if(!isImagePng(pngURL)) return;
		
		imageObj.runtimeStyle.backgroundImage = "none";
		imageObj.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + pngURL + "', sizingMethod='image')";
		imageObj.src = "/common/assets/images/_blank.gif";
		imageObj.style.visibility="visible";	
	} 
	else 
	{
		var pngURL = (imageObj.currentStyle) ? returnBgImage(imageObj.currentStyle.backgroundImage) : '';
		
		//Check our image is actually a png and bail if not.
		if(!isImagePng(pngURL)) return;
		
		if (pngURL != 'ne')
		{
			switch (imageObj.currentStyle.backgroundRepeat)
			{
				case "no-repeat" :
					
					switch (imageObj.currentStyle.overflow)
					{
						case "hidden" : //"visible"
							imageObj.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + pngURL + "',sizingMethod='crop')";
							break;
						
						default :
							imageObj.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + pngURL + "',sizingMethod='image')";
							break;
					}
					break;
				
				default :
					imageObj.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + pngURL + "',sizingMethod='scale')";
					break;
			}
			imageObj.style.backgroundImage="none";
			imageObj.style.visibility="visible";
		}
	}
}

function returnBgImage(obj)
{
	return obj.substring(5, obj.length - 2); //[ "none" returned as "ne" ]
}

function isImagePng(pngURL)
{
	return (pngURL.substring(pngURL.length - 3, pngURL.length) == "png");
}




/// <reference path="../jQuery/1.3.1/jquery-1.3.1-vsdoc.js" />


/*
 * Parse the QueryString parameters from the passed in url to a name value pair.
 */
	function getQS(url)
	{ 
		var args = new Object(); 
		if (url.indexOf("?") == 0) return args;
		var query = url.substring(url.indexOf("?") + 1);
		var pairs = query.split("&"); 
		for(var i = 0; i < pairs.length; i++)
		{ 
			var pos = pairs[i].indexOf("="); 
			if (pos == -1) continue; 
			var argname = pairs[i].substring(0,pos); 
			var value = pairs[i].substring(pos+1); 
			args[argname] = unescape(value); 
		} 
		return args; 
	}


/*
 * Formats the postcode to add in a space if the user hasn't entered one
 */
	function formatPostcode(postcode) {
		//postcode.val(trimString(postcode.val()));
		postcode.val(postcode.val().replace(/ /g,''));
		if(postcode.val().indexOf(' ') == -1) {
			newPostcode = postcode.val().substr(0,postcode.val().length-3) + ' ' + postcode.val().substr(postcode.val().length-3,3);
			postcode.val(newPostcode);
		}
	}

/*
 * Function used to check if the user has entered a valid UK postal code
 */
	function isValidPostcode(val) {
		var regex = '^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$';
		return val.match(regex);
	}

/*
 * Returns all of the data after the last instance of a certain character
 */
	function stringAfterLast(data, character)
	{
		return (data.lastIndexOf(character) > 0) ? data.substring(data.lastIndexOf(character) + 1, data.length) : data;
	}



/// <reference path="../jQuery/1.3.1/jquery-1.3.1-vsdoc.js" />


/*
 *****************************
 *	RUN ON <DOCUMENT READY>
 *****************************
 */
	$(document).ready(function() 
	{
		setupHoverBehaviour();
		
		setupNewWindowLinks();
		
		disableLinks();
	});



/*
 *****************************
 *	CORE HOVER FUNCTIONALITY
 *****************************
 */
	
	function setupHoverBehaviour()
	{
		
		$(".a-auto-hover").each
		(
			function(i)
			{
				//Generate unique hover class name
				var uniqueHoverClassName = generateHoverClassName($(this));
				
				$(this).hover
				(
					function()
					{
						//ADD CLASS
						var _this = $(this);
						if (!_this.hasClass(uniqueHoverClassName)) _this.addClass(uniqueHoverClassName);
					},
					function()
					{
						//REMOVE CLASS
						var _this = $(this);
						if (_this.hasClass(uniqueHoverClassName)) _this.removeClass(uniqueHoverClassName);
					}
				);
				
				$(this).click
				(
					function ()
					{
						//REMOVE CLASS
						var _this = $(this);
						if (_this.hasClass(uniqueHoverClassName)) _this.removeClass(uniqueHoverClassName);
					}
				);
				
				
			}
		)
		
		
		// Automatically add a hover functionality to all SIFR object tags nested within 'a-auto-hover' items to enable ancestor roll-over fuctionality.
		// i.e. add auto generated class to parent
		
		/*
		 * NOT SURE THAT THIS IS NEEDED !!!
		 *
		$(".a-auto-hover object").each
		(
			function(i)
			{
				//Generate unique hover class name
				
				var _parent = $(this).parent("a-auto-hover");
				
				var uniqueHoverClassName = generateHoverClassName(_parent);
				
				$(this).hover
				(
					function()
					{
						//ADD CLASS TO PARENT
						var _parent = $(this).parent("a-auto-hover");
						if (!_parent.hasClass(uniqueHoverClassName)) _parent.addClass(uniqueHoverClassName);
					},
					function()
					{
						//REMOVE CLASS
						var _parent = $(this).parent("a-auto-hover");
						if (_parent.hasClass(uniqueHoverClassName)) _parent.removeClass(uniqueHoverClassName);
					}
				);
				
			}
		)
		
		*/
	}
	
	
	
	var AUTO_HOVER_CLASS_STUB			= "-hover"
	var AUTO_HOVER_CLASS_TARGET_NAME	= "a-auto-hover"
	var DEFAULT_HOVER_CLASS				= "hover"
	
	
	function generateHoverClassName (jQueryObjRef)
	{
		var classNames = jQueryObjRef.attr("class");
		
		//Get index of 'AUTO_HOVER_CLASS_TARGET_NAME'
		//Add 1 to account for space
		//Get next class name
			//:: Find index of next space (nextSpaceIndex)
			//:: Extract class name string :: BETWEEN (indexOf(AUTO_HOVER_CLASS_TARGET_NAME) + AUTO_HOVER_CLASS_TARGET_NAME.length + 1) &&&&&& indexOf(nextSpaceIndex)
		//Append 'HOVER_CLASS_STUB' to extracted class name and return
		
		var tgtClassIndex			= classNames.indexOf(AUTO_HOVER_CLASS_TARGET_NAME);
		var baseClassIndexStart		= tgtClassIndex + AUTO_HOVER_CLASS_TARGET_NAME.length + 1;
		var baseClassIndexEnd		= 0;
		
		var baseClassName			= "";
		var hoverClassName			= "";
		
		//alert("tgtClassIndex = " + tgtClassIndex + "\nbaseClassIndexStart = " + baseClassIndexStart + "\nbaseClassIndexEnd = " + baseClassIndexEnd);
		
		// Only generate class name if there is a class following the 'AUTO_HOVER_CLASS_TARGET_NAME' class
		if (baseClassIndexStart < classNames.length && baseClassIndexStart < classNames.length)
		{
			baseClassIndexEnd		= classNames.indexOf(" ", baseClassIndexStart)
			baseClassName			= (baseClassIndexEnd == -1) ? classNames.slice(baseClassIndexStart) : classNames.slice(baseClassIndexStart, baseClassIndexEnd);
			hoverClassName			= baseClassName + AUTO_HOVER_CLASS_STUB;
		}
		else
		{
			hoverClassName = DEFAULT_HOVER_CLASS;
		}
		//alert("tgtClassIndex = " + tgtClassIndex + "\n" + "baseClassIndexStart = " + baseClassIndexStart + "\n" + "baseClassIndexEnd = " + baseClassIndexEnd + "\n" + "baseClassName = " + baseClassName + "\n" + "hoverClassName = " + hoverClassName);
		
		return hoverClassName;
	}
	
	
	

/*
 *****************************
 *	UTILITY METHOD OPEN LINKS MARKED AS EXTERNAL IN A NEW WINDOW
 *****************************
 */

	function setupNewWindowLinks()
	{
		/*
		 * Utility function that opens any new window commands. Add a w=NUM and h=NUM to the QS to force a custom size on open.
		 */
		
		/*
		 * UPDATE	:: 17-02-2009
		 *			:: Liam Prescott 
		 *			:: Upgraded to be compatiable with jQuery v1.3.1
		 *			:: Change log:
		 *			::	> a[@rel = 'external'] changed to a[rel = 'external']
		 */
			 
		$("a[rel = 'external']").click(
			function() {
				var link = $(this);
				var qs = getQS(link.attr("href"));
				if (!qs.w) qs.w = 800;
				if (!qs.h) qs.h = 600;
				window.open(link.attr("href"), link.attr("id"), "width=" + qs.w + ",height=" + qs.h + ",menubar=yes,location=yes,resizable=yes,status=yes,toolbar=yes,scrollbars=yes");
				return false;
			}
		);
	}



/*
 *****************************
 *	ANY LINKS MARKED AS DISABLED HAVE THE HREF ATTRIBUTE REMOVED
 *****************************
 */

	function disableLinks()
	{
		/*
		 * Utility function that removes the href from any disabled links.
		 */
		$("a.disabled").each(
			function() {
				$(this).removeAttr("href");
			}
		);
	}
	
	
	

//create the args object!
//(function($) {
function NameValueCollection() {
	//create the nvc arrays
	this.names = [];
	this.values = [];
};

//extend the jquery object to prototype a jscript args object
$.extend(NameValueCollection.prototype, {
	
	remove: function(name) {
		//cycle the names array till we find the correct index for the value
		for(var i=0;i<this.names.length;i++) {
			if(this.names[i] == name) {
				this.values.pop(values[i]);
				this.names.pop(names[i]);
			}
		}	
	},
	
	//function to add a value to the array
	add: function(name,value) {
		this.names.push(name);
		this.values.push(value);
	},
	
	//function to get a value by its name
	getValue: function(name) {
		//cycle the names array till we find the correct index for the value
		for(var i=0;i<this.names.length;i++) {
			if(this.names[i] == name) {
				return this.values[i];
			}
		}
	},
	
	//function used to init the array
	init: function() {
		//init the nvc arrays
		this.names = [];
		this.values = [];
	},
	
	//function return the array as a delimited string
	getString: function(delimiter) {
		//ok if we have no delimiter assume its & for the QS
		if(!delimiter)
			delimiter = '&';
		
		var retval = '';
		
		//cycle the names array and build the string
		for(var i=0;i<this.names.length;i++) {
			retval += this.names[i] + '=' + this.values[i] + delimiter;
		}
		
		//no trim the trailing delimiter from the args string
		retval = retval.substr(0,retval.length-1);
		
		//return the build string
		return retval + '';
	}
});

/****************************************/
/* HtmlList.js							*/
/*										*/
/* Provides the JS functionality for	*/
/* for the custom htmllist control		*/
/****************************************/
(function($) {

	$.widget("ui.htmllist", $.extend({}, $.ui.mouse, {
		_init : function() {
			//get the various htmlElements
			var _this = this;
			var _options = this.options;
			this._uiContainer = this.element;
			this._container = this.element.parents("div.htmllist-container");
			this._summaryContainer = this.element.find("div.ui-htmllist-summary");
			this._summaryHeader = this.element.find("div.ui-htmllist-summary h6");
			this._listContainer = this.element.find("div.ui-htmllist-list");
			this._dataContainer = this._container.find("select");
			this.dataItems = new Array();
			this.selectedIndex = 0;
			this.selectedValue = '';
			this.selectedText = '';
			this.timeoutPointer;
			this.totalItems = _this._dataContainer.find("option").length;			
									
			//build the dataItems collection
			_this._dataContainer.find("option").each(function(i) {
				_this.dataItems.push({index: i, value: $(this).attr('value'), text: $(this).html(), totalItems: _this.totalItems});
				if($(this).selected) {
					_this.selectedIndex = i;
					_this.selectedValue = $(this).attr('value');
					_this.selectedText = $(this).html();
				}		
			});
			
			//hide the dataContainer
			this._dataContainer.hide();

			//bind the events
			this._summaryContainer.click(function() {
				_this.summaryClick();
			}).mouseout(function() {
				_this._menuMouseOut();
			}).mouseover(function() {
				_this._menuMouseOver();
			});
			this._listContainer.find("li").click(function(event) {
				_this._itemClick(_this._listContainer.find("li").index(this));
			}).mouseout(function() {
				_this._menuMouseOut();
			}).mouseover(function() {
				_this._menuMouseOver();
			});
		},
		
		//function fired when a user clicks the top summary to display the menu items
		summaryClick : function () {
			if(this._uiContainer.hasClass("ui-htmllist-container-open")) {
				this._closeMenu();
			}
			else {
				this._openMenu();
			}
		},
		
		//function fired when a user clicks one of the menu items
		_itemClick : function (index) {
			this._summaryHeader.html(this.dataItems[index].text);
			this._selectDataContainerItem(index);
			this._closeMenu();	
			
			this._trigger("onChange", null,this.dataItems[index]);
		},
		
		//function used to change the selected index of the underlying select element
		_selectDataContainerItem : function(index) {
			this.selectedIndex = index;
			this.selectedValue = this.dataItems[index].value;
			this.selectedText = this.dataItems[index].text;
			this._dataContainer.find("option").eq(index).attr("selected", true);
		},
		
		//function used to close the menu
		_openMenu : function () {
			//open the menu then after the delay is up then close it again			
			this._uiContainer.addClass("ui-htmllist-container-open");
		},
		
		//function used to fire a timeout to close the menu on mouseout
		_menuMouseOut : function() {
			var _this = this;
			this.timeoutPointer = setTimeout(function () { _this._closeMenu(); }, this.options.delay);
		},
		
		//function used to clear a timeout to keep the menu open if the user re-mouses over it
		_menuMouseOver : function() {
			clearTimeout(this.timeoutPointer);
		},
		
		//function used to close the current menu
		_closeMenu : function () {
			this._uiContainer.removeClass("ui-htmllist-container-open");
			clearTimeout(this.timeoutPointer);
		}
	}));

	$.extend($.ui.htmllist, {
		defaults: {
			delay : 0
		}
	});

})(jQuery);

//function used to attach the ajax handlers to the external link items
$(document).ready(function() {
	var document = $(this);
	
	// only do this if we haven't already init the ajaxManager
	if (!$.ajaxManager.ajaxSettings.arguments)
	{
		$.ajaxManager.initialise({
			responseType: $.ajaxManager.dataType.JSON,
			requestType: $.ajaxManager.requestType.POST
		});
    }
	
	document.find('.mp-ajax-external-link').click(function(event) {
		event.preventDefault();
		
		var link = $(this);
		var id = link.attr('id');
		var href = link.attr('href');

		//make the ajax call
		$.ajaxManager.updateUrl(href);
		$.ajaxManager.onSuccess = function(p_response) {
			processAjaxResponse(p_response);
		};
		$.ajaxManager.makeRequest();
		
	});
	
	//internal method used to wire up the link
	var processAjaxResponse = function(response) {
		var url = response.arguments.lnk;
		open(url,'myWin');
	}
});




//
//
//
//
// PLEASE NOTE ::
//
// This does NOT currently function correctly when lightbox targeted at 'body' (or no target defined)
//
//
//
//











var UI_TARGET			= "target";
var UI_CONTAINER		= "container";
var UI_LOADING			= "loading";
var UI_CONTENT			= "content";
var UI_CLOSE			= "close";

var CONST_UIBOX_WIDTH	= "WIDTH";
var CONST_UIBOX_HEIGHT	= "HEIGHT";

	
$(document).ready(function()
{	
	$("a.ui-lightbox-link, area.ui-lightbox-link, input.ui-lightbox-link").click(function()
	{		
		var url = this.href || this.alt;
		var parameters = uiBox_GetQueryString(url);
			
		uiBox_Show(parameters, url);
		this.blur();
		return false;
	});	
});

//This function looks at the calling url and creates our overlay as required.
function uiBox_Show(parameters, url)
{
	//Extract our Qs Parameters to a name value collection.
	var uiLightBoxOverlay;
	var ui = uiBox_GetUiComponents(parameters.target);
	
	//In IE6 we have add a iframe fix to hide the overlayed content.
	if (	($.browser.msie) &&
			($.browser.version < 7) &&
			(ui[UI_TARGET].find("iframe.ui-lightbox-iframe-fix").length == 0))
	{
		ui[UI_TARGET].append("<iframe class=\"ui-lightbox-iframe-fix\"></iframe>");
	}
	
	//Set-up our overlay element to block out overlay element content.
	if(ui[UI_TARGET].find(".ui-lightbox-overlay").length == 0)
	{
		ui[UI_TARGET].append("<div class=\"ui-lightbox-overlay\"></div>");
		uiLightBoxOverlay = ui[UI_TARGET].find("div.ui-lightbox-overlay");
		//If we are not forcing modal functionality where the user is forced to close only from the lightbox itself.
		if(!parameters.modal) uiLightBoxOverlay.click(uiBox_Hide);
		if(uiBox_IsUserAgent("firefox", null, "mac")) uiLightBoxOverlay.addClass("ui-lightbox-overlay-png");
	}
	
	//Wire up our close button if we have one.
	if(ui[UI_CLOSE].length > 0) ui[UI_CLOSE].click(uiBox_Hide);	
	
	//Get the target position values
    var pos = ui[UI_TARGET].position();
    var targetTop = ui[UI_TARGET].position().top;
	var targetLeft = ui[UI_TARGET].position().left;
	//var targetWidth = ui[UI_TARGET].width();
	//var targetHeight = ui[UI_TARGET].height();
	var targetWidth		= uiBox_GetDimensionAbsolute(ui[UI_TARGET], CONST_UIBOX_WIDTH);
	var targetHeight	= uiBox_GetDimensionAbsolute(ui[UI_TARGET], CONST_UIBOX_HEIGHT);
	
	// Size overlay and i-frame-fix if ie.6 as has problems with css 100% height / width in certain situations
	if ($.browser.msie && $.browser.version < 7)
	{
		var iframe	= ui[UI_TARGET].find(".ui-lightbox-iframe-fix");
		var overlay = ui[UI_TARGET].find(".ui-lightbox-overlay");
		
		iframe.css("width", String(targetWidth));
		iframe.css("height", String(targetHeight));
		
		overlay.css("width", String(targetWidth));
		overlay.css("height", String(targetHeight));
	}
	
    if (uiLightBoxOverlay) uiLightBoxOverlay.show();
    		
	//Set the co-ordinate properties of our lightbox container.
	var containerWidth = (parameters.width * 1) || 630; //defaults to 630 if no paramaters were added to URL
	var containerHeight = (parameters.height * 1) || 440; //defaults to 440 if no paramaters were added to URL	
	
	//we need to switch this to check if this to be displayed centred in the window, or centered in the viewable portion
	var containerTop = 0;
	var containerLeft = 0;
	
	//if the viewableCentre displayPosition parameter is passed in, then add the scrollTop param to centre within the viewpane not the container
	if(parameters.displayPosition == 'viewableCentre') {
		containerTop = (parameters.top * 1) || (($(window).height() - containerHeight) / 2) + $(window).scrollTop();
	}
	else {
		containerTop = (parameters.top * 1) || ((targetHeight - containerHeight) / 2);
	}
	containerLeft = (parameters.left * 1) || ((targetWidth - containerWidth) / 2);
	
	
	//Show our pre-loader while we set up other content elements.
	uiBox_ToggleLoader(parameters);
	
	ui[UI_TARGET].append(ui[UI_CONTAINER]); 
	
	//Check if we should load content from the current page or the url in an i-frame.
	if(!parameters.source)
	{
		uiLightBoxContent.append("<iframe frameborder=\"0\" src=\"" + url + "\" id=\"ui-lightbox-iframe\" name=\"ui-lightbox-iframe\" onload=\"uiBox_ToggleLoader()\"> </iframe>");
	}
	else
	{	
		//$("#" + parameters.source).clone().appendTo(uiLightBoxContent);		
		// ui[UI_CONTAINER].clone().appendTo(ui[UI_TARGET]); 
				
	    var containerCloned = ui[UI_TARGET].find(".ui-lightbox-container");
	    var containerContentCloned = containerCloned.find(".ui-lightbox-content");
		
	    $("#" + parameters.source).clone().appendTo(containerContentCloned).show(); 
	    
	    //If our cloned source fragment contains a target iframe with a class of "ui-lightbox-iframe-destination" descendent load the url to this frame.
		uiIFrameTarget = containerContentCloned.find("iframe.ui-lightbox-iframe-destination");
		if(uiIFrameTarget.length > 0)
		{
			uiIFrameTarget.attr("src", url);
		}
		
        containerCloned.css({	left	: containerLeft  + "px",
								top		: containerTop + "px",
								height	: containerHeight + "px",
								width	: containerWidth + "px"});
		/*
		containerCloned.css({left	: targetLeft + 'px'});
		containerCloned.css({height : containerHeight + 'px'});
	    containerCloned.css({width	: containerWidth + 'px'});
		*/
        containerCloned.show();	       
   
		uiBox_ToggleLoader(null);
		
		/* Fire a load event on the light box window to run any custom events. */
		containerCloned.trigger("load");
		
	}
	
	/* Fire a document level overlay loaded event */
	var lightboxLoadedEvent					= jQuery.Event("LIGHTBOX-LOAD-COMPLETE");
	lightboxLoadedEvent.targetContainerId	= parameters.target;
	$(document).trigger(lightboxLoadedEvent);
}

//Get a friendly collection of ui components for the overlay.
function uiBox_GetDimensionAbsolute(targetJQueryObject, axis)
{
	var t = targetJQueryObject;
	if (axis == CONST_UIBOX_WIDTH) return t.width() + parseInt(t.css("paddingLeft")) + parseInt(t.css("paddingRight")) + parseInt(t.css("borderLeftWidth")) + parseInt(t.css("borderRightWidth"));
	else if (axis == CONST_UIBOX_HEIGHT) return t.height() + parseInt(t.css("paddingTop")) + parseInt(t.css("paddingBottom")) + parseInt(t.css("borderTopWidth")) + parseInt(t.css("borderBottomWidth"));
}



//Method used to hide the lightbox overlay.
function uiBox_Hide()
{
	var ui = uiBox_GetUiComponents(null);    
    
    ui[UI_CONTAINER].hide();
    ui[UI_CONTENT].empty();
    $("body").append(ui[UI_CONTAINER]);
	if(ui[UI_CLOSE].length > 0) ui[UI_CLOSE].unbind().hide();
	$("iframe.ui-lightbox-iframe-fix, div.ui-lightbox-overlay").remove();
	return false;
}

//Get a friendly collection of ui components for the overlay.
function uiBox_GetUiComponents(targetElement)
{
	var ui = new Object();
	ui[UI_CONTAINER]		= $(".ui-lightbox-container");
	ui[UI_CONTENT]			= ui[UI_CONTAINER].find(".ui-lightbox-content");
	ui[UI_LOADING]			= ui[UI_CONTAINER].find(".ui-lightbox-loading");
	ui[UI_CLOSE]			= ui[UI_CONTAINER].find(".ui-lightbox-close");
	ui[UI_TARGET]			= $((targetElement != null) ? ("#" + targetElement) : "body");	
	return ui;
}

//Parse the QueryString parameters from the passed in url to a name value pair.
function uiBox_GetQueryString(url)
{ 
	var args = new Object(); 
	var query = url.substring(url.indexOf("?") + 1);
	var pairs = query.split("&"); 
	for(var i = 0; i < pairs.length; i++)
	{ 
		var pos = pairs[i].indexOf("="); 
		if (pos == -1) continue; 
		var argname = pairs[i].substring(0,pos); 
		var value = pairs[i].substring(pos+1); 
		args[argname] = unescape(value); 
	} 
	return args; 
}

//Detect the browser, version and os of the user agent.
function uiBox_IsUserAgent(browser, version, os)
{
  var userAgent = navigator.userAgent.toLowerCase();
  var isUserAgent = false;
  if(browser != null) isUserAgent = (userAgent.indexOf(browser) != -1);
  if(version != null) isUserAgent = (userAgent.indexOf(version) != -1);
  if(os != null) isUserAgent = (userAgent.indexOf(os) != -1);
  return isUserAgent;
}

//Utility function to show and hide our preloader and content.
function uiBox_ToggleLoader(parameters)
{
    if(parameters)
	var ui = uiBox_GetUiComponents(parameters.target);
	else
	var ui = uiBox_GetUiComponents();
	
	if (ui[UI_LOADING].is(":hidden"))
	{
		ui[UI_CONTENT].hide();
		if(ui[UI_CLOSE].length > 0) ui[UI_CLOSE].hide();
		ui[UI_LOADING].show();
	}
	else
	{
		ui[UI_LOADING].hide();
		ui[UI_CONTENT].show();
		if(ui[UI_CLOSE].length > 0) ui[UI_CLOSE].show();
	}
}


function uiBox_Trigger(url)
{
	var parameters = uiBox_GetQueryString(url);
	
	uiBox_Show(parameters,url);
}



/// <reference path="../../../../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />


/**
 *****************************************************************
 * CoreAssetConfiguration
 *****************************************************************
 *
 * General display asset configuration
 *
 * Encapsulated assets configuration and post-page-load STYLING (common and page specific)
 *
 * Author : Liam Prescott
 */


	//Check that namespace into which the Class definition will be creates has been defined & if not then create
	if (!manheim.global.isNamespaceDefined("manheim.portfolio.lexus.display")) manheim.global.createNamespace("manheim.portfolio.lexus.display", "1.0");
	
	
	manheim.portfolio.lexus.display.CoreAssetConfiguration = Object.subClass(
		{
			/*
			 =============================
			 CONSTANTS
			 =============================
			 */
				CLASS_AUTO_CONFIGURATION_BUTTONS : "auto-configured-sifr-button",
				CLASS_AUTO_CONFIGURATION_BUTTONS_LIGHTBOX : "auto-configured-sifr-button-lightbox",
				
				JQ_CLASS_PATH_UI_LIGHTBOX_CONTENT : "div.ui-lightbox-container > div.ui-lightbox-body > div.ui-lightbox-content",
				
			
			/*
			 =============================
			 CONFIGURATION PROPERTIES (instance configuration)
			 =============================
			 */
				instanceString : undefined,
			
			
			
			/*
			 =============================
			 CONSTRUCTOR
			 =============================
			 */
				init : function (instanceReferenceString)
				{
					this.instanceString = instanceReferenceString;
					
					var __this = this;
					
					
					// CONFIGURE BUTTON FUNCTIONALITY
//
// [ sIFR buttons ]
//					this.autoActivateSifrButtons();
//					this.autoActivateSifrLightboxButtons();
					this.autoActivateButtons();
					this.autoActivateLightboxButtons();
										
					// STYLE BUTTONS
					//sIFR.runDelayedStyling(sIFR.styles.STYLE_BUTTONS_STANDARD);
				
				
					//
					//
					// TODO ::
					//
					// NEED TO MAKE THESE TEST IF PAGE VALID BEFORE ATTEMPTING TO RUN
					//
					//
					
					
					// STYLE ADVANCED SEARCH PANEL
					if (sIFR.runDelayedStyling) sIFR.runDelayedStyling(sIFR.styles.STYLE_ADVANCED_SEARCH);
				
					
					// STYLE SEARCH RESULTS
					//if (sIFR.runDelayedStyling) sIFR.runDelayedStyling(sIFR.styles.STYLE_SEARCH_RESULTS_LIST_MODE);
					
					
					
					// BIND LIGHTBOX LOAD COMPLETE EVENT HANDLER : To style internal assets
					$(document).bind("LIGHTBOX-LOAD-COMPLETE", function (e)
					{
						__this.handleLightBoxOpen(e);
					});
					
					
					
					
				},
				
					
			
						
			
			/*
			 =============================
			 INTERNAL METHODS
			 =============================
			 */
				/*
				 =============================
				 SETUP
				 =============================
				 */
					/*
					 =============================
					 SIFR BUTTON ACTIVATION METHODS
					 =============================
					 */
//						
// [ sIFR button ] activation
//						autoActivateSifrButtons : function ()
						autoActivateButtons : function ()
						{
							var __this = this;
												
							var buttons = $("div." + this.CLASS_AUTO_CONFIGURATION_BUTTONS);
							
							buttons.each
							(
								function (i) 
								{
									var ___this = $(this);
									var link	= ___this.find(sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH + " a");
									
									var href = link.attr("href");

									link.removeAttr("href"); // [ UPDATE : non sIFR buttons ]
//
// [ sIFR button ] activation
//									
//									// Remove href attribute if !ie
//									if (!$.browser.msie)
//									{
//										link.attr("href", "");
//									}
									
									// Attach click event to button
									___this.click
									(
										function (e) {
											__this.loadNewUrl(href);
										}
									);
								}
							)
							
//
// [ sIFR button ] styling
//							// Style buttons
//							if (buttons.length > 0)
//								sIFR.runDelayedButtonStyling("div." + this.CLASS_AUTO_CONFIGURATION_BUTTONS + " " + sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH);
						},
						

//						
// [ sIFR button ] activation
//						autoActivateSifrLightboxButtons : function ()
						autoActivateLightboxButtons : function ()
						{
							var __this = this;
							
							var buttons = $("div." + this.CLASS_AUTO_CONFIGURATION_BUTTONS_LIGHTBOX);
							
							//var hrefFragment = "javascript:" + this.instanceString + ".launchLightBox("
							
							buttons.each
							(
								function (i) 
								{
									var ___this = $(this);
									
									var link = ___this.find(sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH + " a");
									
									var href = link.attr("href");
									
									link.removeAttr("href"); // [ UPDATE : non sIFR buttons ]
									
//
// [ sIFR button ] activation
//
//									// Remove href attribute if !ie
//									if (!$.browser.msie)
//									{
//										link.attr("href", "");
//									}
//									else
//									{
//										var newHref = hrefFragment + "'" + String(href) + "');";
//										
//										link.attr("href", newHref);
//									}
									
									// Attach click event to button
									___this.click
									(
										function (e) {
											__this.launchLightBox(href);
										}
									);
								}
							)
		
//
// [ sIFR button ] styling
//							// Style buttons
//							if (buttons.length > 0)
//								sIFR.runDelayedButtonStyling("div." + this.CLASS_AUTO_CONFIGURATION_BUTTONS_LIGHTBOX + " " + sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH);
							
						},
					
					
					
						loadNewUrl : function (url)
						{
							if (url)
								window.location.href = url;
						},
						
						
						
						launchLightBox : function (url)
						{
							if (url)
								uiBox_Trigger(url);
						},
				
				
				/*
				 =============================
				 INTERNAL EVENT HANDLERS
				 =============================
				 */
					 /*
					 =============================
					 LIGHTBOX
					 =============================
					 */
						handleLightBoxOpen : function (e)
						{
							var styleTarget = (e.targetContainerId != undefined) ? ("#" + e.targetContainerId + " " + this.JQ_CLASS_PATH_UI_LIGHTBOX_CONTENT) : ("body " + this.JQ_CLASS_PATH_UI_LIGHTBOX_CONTENT);
							
							sIFR.runDelayedLightBoxHeaderStyling(styleTarget);
							
							
							// Png fix header images if required
							if ($.browser.msie && $.browser.version < 7)
							{
								var h2 = $(styleTarget).find("h2:first")[0];
								if (h2) fix_PNG(h2);
							}
							
							//alert(e.targetContainerId + " // " + styleTarget);
						}
			
				
				
				/*
				 =============================
				 UTILITIES
				 =============================
				 */
			
			
		}
	);




/// <reference path="../../../../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />


/**
 *****************************************************************
 * CoreDisplayControls
 *****************************************************************
 *
 * General display controls and logic for various pages 
 *
 * Encapsulated basic functionality (common and page specific)
 *
 * Author : Liam Prescott
 */

	//Check that namespace into which the Class definition will be creates has been defined & if not then create
	
	if (!manheim.global.isNamespaceDefined("manheim.portfolio.lexus.display")) manheim.global.createNamespace("manheim.portfolio.lexus.display", "1.0");
	
	manheim.portfolio.lexus.display.CoreDisplayControls = Object.subClass(
		{
			/*
			 =============================
			 CONSTANTS
			 =============================
			 */
				CLASS_MAIN_CONTAINER		: "main-container",
				CLASS_PAGE_RANGE_DETAILS	: "range-container",
			
				
				// Display state switching classes (common)
				CLASS_DISPLAY_STATE_MENU		: "display-state-menu",
				CLASS_DISPLAY_STATE_CONTAINER	: "display-state-menu",
				
				CLASS_FRAGMENT_DISPLAY_STATE	: "display-state-",
				
				
				// 
				CLASS_RANGE_DETAIL_ITEM_OPTIONS_OPEN : "item-options-open",
				
				
				
			/*
			 =============================
			 CONFIGURATION PROPERTIES (instance configuration)
			 =============================
			 */
			
			
			
			/*
			 =============================
			 CONSTRUCTOR
			 =============================
			 */
				init : function ()
				{
					//if ($("div." + this.CLASS_MAIN_CONTAINER + " div." + this.CLASS_PAGE_RANGE_DETAILS).length > 0)
					
					// Setup range details page features
					if ($("div." + this.CLASS_PAGE_RANGE_DETAILS).length > 0) this._setupRangeDetails();
					
					
				},
			
			
			
			/*
			 =============================
			 INTERNAL RUN-TIME PROPERTIES
			 =============================
			 */
			
			
			
			/*
			 =============================
			 PUBLIC METHODS
			 =============================
			 */
			
			
			
			/*
			 =============================
			 INTERNAL METHODS
			 =============================
			 */
				/*
				 =============================
				 UTILITIES
				 =============================
				 */
			
			
			
				/*
				 =============================
				 SETUP
				 =============================
				 */
					_setupRangeDetails : function ()
					{
						// Data Driven graph display switching
						var tgtStringExploreRangeContainer = "div." + this.CLASS_PAGE_RANGE_DETAILS + " div.explore-range-container"
						
						this._configureDisplayStateMenu(tgtStringExploreRangeContainer);
						
						// Range item options open / close and z-index
						var tgtStringModelsItemsContainer = "div." + this.CLASS_PAGE_RANGE_DETAILS + " div.available-models-container div.model-items-container"
						
						this._configureModelZOrder(tgtStringModelsItemsContainer);
						this._configureModelOptionsDisplay(tgtStringModelsItemsContainer);
					},
					
					
					
					/*
					 =============================
					 RANGE DETAIL PAGE SPECIFIC
					 =============================
					 */
					 
						_configureDisplayStateMenu : function (target)
						{
							var __this				= this;
							var displayContainer	= $(target);
							var links				= $(target + " div." + this.CLASS_DISPLAY_STATE_MENU + " a");
							var linkCount			= links.length;
							
							//Assignment utilising a function closure to avoid closure referencing of value i (otherwise always resolves to last definition of i)
							for (var i = 0; i < linkCount ; i++) (
								function (id) 
								{
									// Get item
									var link = $(links[id]);
								
									// Add item hover
									link.click(function ()
									{
										__this._setDisplayState(displayContainer, (id + 1), linkCount);
									});
								}
							)(i);
						},
						
						
						_configureModelZOrder : function (target)
						{
							var itemOptions	= $(target + " div.model-item");
							var totalItems  = itemOptions.length;
							
							for (var i = 0; i < totalItems; i++)
							{
								var item	= $(itemOptions[i]);
								var zIndex	= (totalItems - i).toString();
								
								item.css("z-index", zIndex);
							}
						},
						
						
						_configureModelOptionsDisplay : function (target)
						{
							var __this		= this;
							var container	= $(target);
							var itemOptions	= container.find("div.model-item > div.item-options");
							
							itemOptions.hover
							(
								function ()
								{
									var $this = $(this);
									if(!$this.hasClass(__this.CLASS_RANGE_DETAIL_ITEM_OPTIONS_OPEN)) $this.addClass(__this.CLASS_RANGE_DETAIL_ITEM_OPTIONS_OPEN);
								},
								function ()
								{
									var $this = $(this);
									if($this.hasClass(__this.CLASS_RANGE_DETAIL_ITEM_OPTIONS_OPEN)) $this.removeClass(__this.CLASS_RANGE_DETAIL_ITEM_OPTIONS_OPEN);
								}
							);
						},
					
					
					
					/*
					 =============================
					 AAAA
					 =============================
					 */
					
					
						
					
				/*
				 =============================
				 DISPLAY CREATION
				 =============================
				 */
			
			
			
				/*
				 =============================
				 GENERIC DISPLAY CONTROL
				 =============================
				 */
					_setDisplayState : function (targetJQueryObject, targetState, totalStates)
					{
						var target = targetJQueryObject;
						
						for (var i = 1; i <= totalStates; i++)
						{
							var c = this.CLASS_FRAGMENT_DISPLAY_STATE + i;
							
							if (i != targetState) { if (target.hasClass(c)) target.removeClass(c); }
							else if (i == targetState) { if(!target.hasClass(c)) target.addClass(c); }
						}
					}
			
			
			
				/*
				 =============================
				 INTERNAL EVENT HANDLERS
				 =============================
				 */
		}
	);
	



/*
 **************
 * IMPORTANT :: All runtime instance declarations MUST be bound to document 'js-class-setup' event
 **************
 */

	$(document).bind("js-class-setup", function ()
	{
		// Setup runtime namespace if doesn't exist
		if (!manheim.global.isNamespaceDefined("manheim.portfolio.runtime.display")) manheim.global.createNamespace("manheim.portfolio.runtime.display", "1.0");
		
		// Create instance
		manheim.portfolio.runtime.display.coreAssetConfiguration = new manheim.portfolio.lexus.display.CoreAssetConfiguration("manheim.portfolio.runtime.display.coreAssetConfiguration");
	});
	



/*
 **************
 * IMPORTANT :: All runtime instance declarations MUST be bound to document 'js-class-setup' event
 **************
 */

	$(document).bind("js-class-setup", function ()
	{
		// Setup runtime namespace if doesn't exist
		if (!manheim.global.isNamespaceDefined("manheim.portfolio.runtime.display")) manheim.global.createNamespace("manheim.portfolio.runtime.display", "1.0");
		
		// Create instance
		manheim.portfolio.runtime.display.coreDisplayControls = new manheim.portfolio.lexus.display.CoreDisplayControls();
	});
	



/// <reference path="../../../../../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />


/**
*****************************************************************
* LightboxExtender
*****************************************************************
*
* Extends the lightbox implementation to give custom Lexus functionality
*
* Author : Rob Earlam
*/

//Check that namespace into which the Class definition will be creates has been defined & if not then create
if (!manheim.global.isNamespaceDefined("manheim.portfolio.lexus.display.controls")) manheim.global.createNamespace("manheim.portfolio.lexus.display.controls", "1.0");

    manheim.portfolio.lexus.display.controls.LightboxExtender = Object.subClass(
		{
		    /*
			 =============================
			 CONSTRUCTOR
			 =============================
			 */
			init : function (instanceReferenceString, targetContainer)
			{
				//approved benefits constats
			    this._approvedBenefitsClass = "approved-benefits";
			    this._approvedBenefitsLinkClass = "approved-benefits-link";
			    this._approvedBenefitsWarrentyLinkClass = "approved-benefits-warranty-link";
			    this._approvedBenefitsPreparationAndValetingLinkClass = "approved-benefits-preparation-and-valeting-link";
			    this._approvedBenefitsHistoryCheckLinkClass = "approved-benefits-history-check-link";
			    this._approvedBenefitsServiceHistoryLinkClass = "approved-benefits-service-history-link";
			    this._approvedBenefitsExchangeLinkClass = "approved-benefits-exchange-link";
			    this._approvedBenefitsRoadsideAssistanceLinkClass = "approved-benefits-roadside-assistance-link";
			    this._approvedBenefitsWarrentyContainerClass = "summary-warranty";
			    this._approvedBenefitsPreparationAndValetingContainerClass = "summary-preparation";
			    this._approvedBenefitsHistoryCheckContainerClass = "summary-history-mileage";
			    this._approvedBenefitsServiceHistoryContainerClass = "summary-service-history";
			    this._approvedBenefitsExchangeContainerClass = "summary-exchange";
			    this._approvedBenefitsRoadsideAssistanceContainerClass = "summary-rac";
			    this._lightBoxContainer = $(document).find('.ui-lightbox-container');
			    			    
			    //vehicle view constants
			    this._vehicleEquipmentIframe = $(document).find('iframe.lightbox-extender-vehicle-equipment');
			    this._vehicleContainer = $(document).find('.vehicle-display-container');

			    //select the setup function to run depending on what html elements are present on the page
			    var _this = this;
			    if($("." + _this._approvedBenefitsClass).length > 0) {
			        _this._configureApprovedBenefitsExtensions();
			    }
			    
//			    if(_this._vehicleContainer.length > 0) {
//			    	_this._configureVehicleViewExtensions();
//			    }
			},


			/*
			=============================
			INTERNAL / PRIVATE METHODS
			=============================
			*/
			    /*
			    =============================
			    SETUP
			    =============================
			    */
			    
//			    _configureVehicleViewExtensions : function () 
//			    {
//					var _this = this;
//					_this._vehicleContainer.find('a.vehicle-equipment-more-info-link').unbind('click').click(function(event) {
//						
//						event.preventDefault();
//						_this._vehicleEquipmentIframe.attr('src', "/Glossary.aspx?glk=" + $(this).attr('rel'));


//						var url = this.href || this.alt;
//						var parameters = uiBox_GetQueryString(url);

//						uiBox_Show(parameters, url);
//					});
//			    },
			    
	
			    
			    _configureApprovedBenefitsExtensions : function() 
			    {
			        var _this = this;
			        _this._bindEventsOnLightboxLoad();
			    },
			    
	
			    
			    _bindEventsOnLightboxLoad : function () 
			    {
			        var _this = this;

			        //when the base lightbox broadcasts its load function, hook into the newly created content
			        _this._lightBoxContainer.bind("load", function() {

			            _this._bindApprovedBenefitsEvents();

			            if ($('div.ui-lightbox-content div#divBenefit01').length > 0) {
			            	$('.ui-lightbox-content-footer a.previous').hide();
			            }
			            else {
			            	$('.ui-lightbox-content-footer a.previous').show();
			            }

			            if ($('div.ui-lightbox-content div#divBenefit06').length > 0) {
			            	$('.ui-lightbox-content-footer a.next').hide();
			            }
			            else {
			            	$('.ui-lightbox-content-footer a.next').show();
			            }
			            
			        });
			    },
			    
		
			    
			    _bindApprovedBenefitsEvents : function() 
			    {
			        var _this = this;

			        _this._lightBoxContainer.find("a." + _this._approvedBenefitsLinkClass).click(function(event) {
                        event.preventDefault();

                        //find the currently displayed panel
                        var _currentPanel = _this._lightBoxContainer.find('.ui-lightbox-content .ui-lightbox-content-container');
                        
                        if($(this).hasClass("." + _this._approvedBenefitsWarrentyLinkClass)) {
                            _this._switchApprovedBenefitsPanel(_currentPanel, _this._approvedBenefitsWarrentyContainerClass,'01');
                            _this.switchPrevNextButtons(true);

		                }
		                else if ($(this).hasClass("." + _this._approvedBenefitsPreparationAndValetingLinkClass)) {
		                    _this._switchApprovedBenefitsPanel(_currentPanel, _this._approvedBenefitsPreparationAndValetingContainerClass,'02');
							$('.ui-lightbox-content-footer a.previous').show();
		                }
		                else if ($(this).hasClass("." + _this._approvedBenefitsHistoryCheckLinkClass)) {
		                    _this._switchApprovedBenefitsPanel(_currentPanel, _this._approvedBenefitsHistoryCheckContainerClass,'03');
		                }
		                else if ($(this).hasClass("." + _this._approvedBenefitsServiceHistoryLinkClass)) {
		                    _this._switchApprovedBenefitsPanel(_currentPanel, _this._approvedBenefitsServiceHistoryContainerClass,'04');
		                }
		                else if ($(this).hasClass("." + _this._approvedBenefitsExchangeLinkClass)) {
		                    _this._switchApprovedBenefitsPanel(_currentPanel, _this._approvedBenefitsExchangeContainerClass,'05');
		                }
		                else if ($(this).hasClass("." + _this._approvedBenefitsRoadsideAssistanceLinkClass)) {
		                    _this._switchApprovedBenefitsPanel(_currentPanel, _this._approvedBenefitsRoadsideAssistanceContainerClass,'06');
		                    _this.switchPrevNextButtons(false);
		                }		            
		            });			            			            
			    },
			    
		
			    
			    _switchApprovedBenefitsPanel : function(panel,newPanelClass,id) 
			    {
			        var _this = this;
			        panel.html('');
			        panel.html($(document).find("." + newPanelClass + " .benefit-details").html());
			        panel.attr('id','divBenefit' + id);
			        _this._bindApprovedBenefitsEvents();
			        
			        
			        /*
					var previouslink = $('.ui-lightbox-content-footer a.previous');
			        var nextlink = $('.ui-lightbox-content-footer a.next');
			        
			        var classDisabledPrevious	= "a-button-round-arrow-left-disabled";
			        var classDisabledNext		= "a-button-round-arrow-right-disabled";
			        
			       
			        //show or hide the previous and next buttons if we're in the first or last state
			        if(id == '01') {
						//$('.ui-lightbox-content-footer a.previous').hide();
						if (!previouslink.hasClass(classDisabledPrevious)) link.addClass(classDisabledPrevious);
			        }
			        else {
			        	//$('.ui-lightbox-content-footer a.previous').show();
			        	if (previouslink.hasClass(classDisabledPrevious)) link.removeClass(classDisabledPrevious);
			        }
			        
			        
			        if(id == '06') {
			        	//$('.ui-lightbox-content-footer a.next').hide();
			        	if (!nextlink.hasClass(classDisabledNext)) nextlink.addClass(classDisabledNext);
			        }
			        else {
			        	//$('.ui-lightbox-content-footer a.next').show();
			        	if (nextlink.hasClass(classDisabledNext)) nextlink.removeClass(classDisabledNext);
			        }
			        */
			        
			        /* Fire a document level overlay loaded event */
					var lightboxLoadedEvent	= jQuery.Event("LIGHTBOX-LOAD-COMPLETE");
					$(document).trigger(lightboxLoadedEvent);
			    },
			    
			    _switchPrevNextButtons : function(isFirstScreen)
			    {
					if(isFirstScreen)
					{
						$('.ui-lightbox-content-footer a.next').show();
		                $('.ui-lightbox-content-footer a.previous').hide();
					}
					else
					{
						$('.ui-lightbox-content-footer a.next').hide();
		                $('.ui-lightbox-content-footer a.previous').show();
					}
			    }				
		}
    )


/*
**************
* IMPORTANT :: All runtime instance declarations MUST be bound to document 'js-class-setup' event
**************
*/

$(document).bind("js-class-setup", function() {
    // Setup runtime namespace if doesn't exist
    if (!manheim.global.isNamespaceDefined("manheim.portfolio.runtime.display.controls")) manheim.global.createNamespace("manheim.portfolio.runtime.display.controls", "1.0");

    // Create instance
    // use window. to check the variable otherwsise the JS will error when it is undefined
    if ($('.lightbox-extender').length > 0) {
        manheim.portfolio.lexus.display.controls.lightboxExtender = new manheim.portfolio.lexus.display.controls.LightboxExtender();
    }
});




/// <reference path="../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />


/**
 *****************************************************************
 * CLASS TEMPLATE
 *****************************************************************
 *
 * Class description :
 *
 * Author : 
 */


	//Check that namespace into which the Class definition will be creates has been defined & if not then create
	if (!manheim.global.isNamespaceDefined("manheim.portfolio.lexus.utilities")) manheim.global.createNamespace("manheim.portfolio.lexus.utilities", "1.0");
	
	
	manheim.portfolio.lexus.utilities.LoadEnhancer = Object.subClass(
		{
			/*
			 =============================
			 CONSTANTS
			 =============================
			 */
				URL_LOADING_SWF : "/assets/flash/DataLoadingDisplay.swf",
				
				LOADING_SWF_W : "100px",
				LOADING_SWF_H : "100px",
				
				LOADING_SWF_ID_FRAGMENT : "loadingSwf_",
				
				FLASH_PLUGINS_PAGE	: "http://www.macromedia.com/go/getflashplayer",
				FLASH_BASE_URL		: "../../",
				
				
				CLASS_LOADING_DISPLAY : "AUTO-DISABLE-DISPLAY",
				
				LOADING_HTML_FRAGMENT_1 :	"<div class='AUTO-DISABLE-DISPLAY'>" +
												"<div class='AUTO-DISABLE-DISPLAY-LOADING-ICON'>" +
													"<div id='",
				LOADING_HTML_FRAGMENT_2 :			"'></div>" +
												"</div>" +
											"</div>",
			
			
			
			/*
			 =============================
			 CONFIGURATION PROPERTIES (instance configuration)
			 =============================
			 */
			
			
			
			/*
			 =============================
			 CONSTRUCTOR
			 =============================
			 */
				init : function ()
				{
					// Attributes / parameters
					var attr			= this._loadingSwfAttributes = {};
					attr.data			= this.URL_LOADING_SWF;
					attr.width			= this.LOADING_SWF_W;
					attr.height			= this.LOADING_SWF_H;
					attr.pluginspage	= this.FLASH_PLUGINS_PAGE;
					
					var params					= this._loadingSwfParameters = {};
					params.align				= "top";
					params.allowfullscreen		= true;
					params.allowscriptaccess	= "sameDomain";
					params.base					= this.FLASH_BASE_URL;
					params.bgcolor				= "#0000ff";
					params.devicefont			= false;
					params.loop					= false;
					params.menu					= true;
					params.play					= true;
					params.quality				= "best";
					params.salign				= "tl";
					params.scale				= "noscale";
					params.wmode				= "transparent";
					
				},
			
			
			
			/*
			 =============================
			 INTERNAL RUN-TIME PROPERTIES
			 =============================
			 */
				_loadingSwfAttributes		: undefined,
				_loadingSwfParameters		: undefined,
			
			
			/*
			 =============================
			 PUBLIC METHODS
			 =============================
			 */
			
				createLoadingState : function (jQueryObject)
				{
					var target = jQueryObject;
					
					// Unique instance props
					var id		= this.LOADING_SWF_ID_FRAGMENT + Math.round(Math.random() * 1000);
					
					var attr	= this._loadingSwfAttributes;
					attr.id		= id;
					attr.name	= id;
					
					// Create html content
					var htmlContentString = this.LOADING_HTML_FRAGMENT_1 + id + this.LOADING_HTML_FRAGMENT_2;
					
					// Add html content to the page
					jQueryObject.append(htmlContentString);
					
					// Add flash content to page
					swfobject.createSWF(attr, this._loadingSwfParameters, id);
				},
				
				
				
				removeLoadingState : function (jQueryObject)
				{
					var target = jQueryObject;
					
					// Find loading container
					var loadingDisplay = target.find("div." + this.CLASS_LOADING_DISPLAY);
					
					if (loadingDisplay.length > 0)
					{
						// Find flash object
						var flObj = loadingDisplay.find("object");
						
						// Get flash object's id
						var id = flObj.attr("id");
						
						// Remove flash object
						swfobject.removeSWF(id);
					}
					
					// Remove loading container
					loadingDisplay.remove();
				}
				
			
			/*
			 =============================
			 INTERNAL METHODS
			 =============================
			 */
				/*
				 =============================
				 UTILITIES
				 =============================
				 */
			
			
			
				/*
				 =============================
				 SETUP
				 =============================
				 */
			
			
			
				/*
				 =============================
				 DISPLAY CREATION
				 =============================
				 */
			
			
			
				/*
				 =============================
				 DISPLAY CONTROL
				 =============================
				 */
			
			
			
				/*
				 =============================
				 INTERNAL EVENT HANDLERS
				 =============================
				 */
		}
	);


/*
 **************
 * IMPORTANT :: All runtime instance declarations MUST be bound to document 'js-class-setup' event
 **************
 */

	$(document).bind("js-class-setup", function ()
	{
		// Setup runtime namespace if doesn't exist
		if (!manheim.global.isNamespaceDefined("manheim.portfolio.lexus.runtime.utilities")) manheim.global.createNamespace("manheim.portfolio.lexus.runtime.utilities", "1.0");
		
		// Create instance
		manheim.portfolio.lexus.runtime.utilities.LoadEnhancer = new manheim.portfolio.lexus.utilities.LoadEnhancer();
	});



/// <reference path="../../../../../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />


/**
 *****************************************************************
 * FormControls
 *****************************************************************
 *
 * Provides core form submit functionality for styled, sifr'd, form submit buttons - through standard activation and architecture
 *
 * Provides customised functionality for specific forms
 *
 * Author : Liam Prescott
 */


	//Check that namespace into which the Class definition will be creates has been defined & if not then create
	
	if (!manheim.global.isNamespaceDefined("manheim.portfolio.lexus.display.controls")) manheim.global.createNamespace("manheim.portfolio.lexus.display.controls", "1.0");
	
	manheim.portfolio.lexus.display.controls.FormControls = Object.subClass(
		{
		
			/*
			 =============================
			 CONSTANTS
			 =============================
			 */
				/*
				 =============================
				 COMMON
				 =============================
				 */
					DEFAULT_FORM_CONTAINER_TARGET			: "body",
					
					CLASS_FORM_SUBMIT_BUTTONS				: "button-form-submit",
					CLASS_FORM_CANCEL_BUTTONS				: "button-form-cancel",
					
					SELECTOR_FORM_SUBMIT_BUTTONS			: "div.button-form-submit",
					
					FORM_ERROR_CLASS_FORM_HIDE_ERROR_FIELDS : "hideErrorFields",
					
					FORM_ERROR_CLASS_ERROR_HIDDEN			: "fieldError-hidden",
					FORM_ERROR_CLASS_ERROR					: "fieldError",
					
					SELECTOR_FORM_CLIENT_SIDE_VALIDATION	: "form.frm-validation",
					CLASS_FORM_CLIENT_SIDE_VALIDATION		: "frm-validation",
					CLASS_CLIENT_SIDE_FORM_ERROR_STATE		: "formError",
				
				
				/*
				 =============================
				 FINANCE QUOTE FORM
				 =============================
				 */
					FINANCE_FORM_PAGE_ID_JQ_TARGET			: "div.IssFinance",
					
					FINANCE_FORM_TYPE_QUOTE_MONTHLY			: "TYPE_QUOTE_MONTHLY",
					FINANCE_FORM_TYPE_QUOTE_DEPOSIT			: "TYPE_QUOTE_DEPOSIT",

					FINANCE_FORM_DISABLED_OVERLAY_HTML			: "<div class=\"disabled-overlay png\"/>",
					FINANCE_FORM_JQ_TARGET_DISABLED_OVERLAY		: "div.disabled-overlay",
					FINANCE_FORM_JQ_TARGET_DISABLED_ITEM_CLASS	: "DISABLED_ITEM_FINANCE_FORM",
				
					FINANCE_FORM_JQ_TARGET_RADIO_BUTTON		: "div.IssFinance div.form-container form div.item.quotetype input:radio",
					
				
				
				/*
				/*
				 =============================
				 SERVICE YOUR LEXUS
				 =============================
                */		
					SERVICE_YOUR_LEXUS_PAGE_ID_JQ_TARGET			    : "div.ServiceYourVehicle",
					
					SERVICE_YOUR_LEXUS_JQ_TARGET_STATE_CONTAINER	    : "div.service-your-lexus",
					
                    SERVICE_YOUR_LEXUS_JQ_ATTRIBUTE_NAME	            : "start",					
					
					SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_1	: "service-your-lexus-state-1",
					SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_2	: "service-your-lexus-state-2",
					SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_3	: "service-your-lexus-state-3",
					SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_4	: "service-your-lexus-state-4",
					SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_5	: "service-your-lexus-state-5",
					SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_6	: "service-your-lexus-state-6",
					SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_7	: "service-your-lexus-state-7",
					
				/*				
				 =============================
				 SELL YOUR LEXUS
				 =============================
				 */
					SELL_YOUR_LEXUS_PAGE_ID_JQ_TARGET			: "div.SellYourLexus",
					
					SELL_YOUR_LEXUS_JQ_TARGET_STATE_CONTAINER	: "div.sell-your-lexus",
					
					SELL_YOUR_LEXUS_JQ_TARGET_CONTINUE_BUTTON	: "div.sell-your-lexus > div.display-state-1 > div.continue-button",
					
					SELL_YOUR_LEXUS_JQ_TARGET_BACK_TO_INSTRUCTIONS_BUTTON : "div.sell-your-lexus div.display-state-2 a.back-to-instructions",
					
					
					SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_1	: "sell-your-lexus-state-1",
					SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_2	: "sell-your-lexus-state-2",
				
			
			
			/*
			 =============================
			 CONFIGURATION PROPERTIES (instance configuration)
			 =============================
			 */
			
			
			
			/*
			 =============================
			 CONSTRUCTOR
			 =============================
			 */
				init : function (instanceReferenceString)
				{
					this.instanceString = instanceReferenceString;
					
					// var referrer =  document.referrer;

                    // alert( document.referrer );
					// alert( document.URL );
												
					// Configure form submit buttons
					//
					// PLEASE NOTE : This ONLY configures buttons that are ON-SCREEN (jQuery will not return buttons hidden vis css styles) - these need to be styled when displayed
					//
					this.configureFormButtons("body form");

					// If 'Service Your Lexus' form : configure functionality
					if (this._isServiceYourLexusPage()) this._configureServiceYourLexus(); 
										
					// If 'Sell Your Lexus' form : configure functionality
					if (this._isSellYourLexusPage()) this._configureSellYourLexus(); 
					
					// If 'Finance quote' form : configure functionality
					if (this._isFinanceQuotePage()) this._configureFinanceQuote();
					
					// If form has errored then configure error display functionality
					if (this._formHasErrored())
						this.configureFormErrorMessages();
				},
			
			
			
			/*
			 =============================
			 INTERNAL RUN-TIME PROPERTIES
			 =============================
			 */
				instanceString : undefined,
			
			
			
			/*
			 =============================
			 PUBLIC METHODS
			 =============================
			 */
			
			
			
			/*
			 =============================
			 INTERNAL METHODS
			 =============================
			 */
				/*
				 =============================
				 UTILITIES
				 =============================
				 */
				 
                    __isServiceYourLexusPage : undefined,
					
					_isServiceYourLexusPage : function ()
					{
						if (!this.__isServiceYourLexusPage)
						{
							this.__isServiceYourLexusPage = ($(this.SERVICE_YOUR_LEXUS_PAGE_ID_JQ_TARGET).length > 0) ? true : false; 
						}
						return this.__isServiceYourLexusPage;
					},

					
					__isSellYourLexusPage : undefined,
					
					_isSellYourLexusPage : function ()
					{
						if (!this.__isSellYourLexusPage)
						{
							this.__isSellYourLexusPage = ($(this.SELL_YOUR_LEXUS_PAGE_ID_JQ_TARGET).length > 0) ? true : false; 
						}
						return this.__isSellYourLexusPage;
					},

					
					__isFinanceQuotePage : undefined,
					
					_isFinanceQuotePage : function ()
					{
						if (!this.__isFinanceQuotePage)
						{
							this.__isFinanceQuotePage = ($(this.FINANCE_FORM_PAGE_ID_JQ_TARGET).length > 0) ? true : false; 
						}
						return this.__isFinanceQuotePage;
					},
					
					
					__formHasErrored : undefined,
					
					_formHasErrored : function ()
					{
					
						if (!this._anyFormHasClientSideValidation())
						{
							if (!this.__formHasErrored)
								this.__formHasErrored = ($("." + this.FORM_ERROR_CLASS_ERROR + ":first").length > 0) ? true : false;
							return this.__formHasErrored;
						}
						else
						{
							return $(this.SELECTOR_FORM_CLIENT_SIDE_VALIDATION + ":first").hasClass(this.CLASS_CLIENT_SIDE_FORM_ERROR_STATE);
						}
					},
					
					
					__anyFormHasClientSideValidation : undefined,
					
					_anyFormHasClientSideValidation : function ()
					{
						if (!this.__anyFormHasClientSideValidation)
						{
							this.__anyFormHasClientSideValidation = ($(this.SELECTOR_FORM_CLIENT_SIDE_VALIDATION + ":first").length > 0) ? true : false;
						}
						return this.__anyFormHasClientSideValidation;
					},
					
					
					_formHasClientSideValidation : function (jQueryTargetForm)
					{
						return (jQueryTargetForm.hasClass(this.CLASS_FORM_CLIENT_SIDE_VALIDATION)) ? true : false;
					},
					
			
				/*
				 =============================
				 SETUP
				 =============================
				 */
					/*
					 * STANDARD, STYLED, FORM SUBMIT BUTTONS
					 */
						configureFormButtons : function(containerTargetString)
						{
							this._configureFormSubmitButtons(containerTargetString);
							this._configureFormCancelButtons(containerTargetString);
						},
						
						_configureFormSubmitButtons : function (containerTargetString)
						{
							var __this = this;
							
							// Store container target string
							var containerTargetString	= (containerTargetString != undefined) ? containerTargetString : this.DEFAULT_FORM_CONTAINER_TARGET;
							
							// Resolve container
							var containerJQObj = $(containerTargetString);
							
							// Find buttons within container
							var buttons	= containerJQObj.find("div." + this.CLASS_FORM_SUBMIT_BUTTONS);
							
							// bind up the buttons and sIFR them, adds inline javascript to msie browsers and remove href of all others
							if (buttons.length > 0)
							{
								this._bindFormButtons(containerTargetString, "div." + this.CLASS_FORM_SUBMIT_BUTTONS, buttons, "_handleSifrFormSubmitLinkInternalClick");
								// bind standard click functionality to buttons
								buttons.bind("click", null, function(e) {__this._handleFormSubmit(e); });
							}
						},
						
						_configureFormCancelButtons : function (containerTargetString)
						{
							var __this = this;
							
							// Store container target string
							var containerTargetString	= (containerTargetString != undefined) ? containerTargetString : this.DEFAULT_FORM_CONTAINER_TARGET;
							
							// Resolve container
							var containerJQObj = $(containerTargetString);
							
							// Find buttons within container
							var buttons	= containerJQObj.find("div." + this.CLASS_FORM_CANCEL_BUTTONS);
							
							if (buttons.length > 0)
							{
								// bind up the buttons and sIFR them, adds inline javascript to msie browsers and remove href of all others
								this._bindFormButtons(containerTargetString, "div." + this.CLASS_FORM_CANCEL_BUTTONS, buttons, "_handleSifrFormCancelLinkInternalClick");
								// bind standard click functionality to buttons
								buttons.bind("click", null, function(e) {__this._handleFormCancel(e); });
							}
						},
						
						
						// bind up the buttons and sIFR them, adds inline javascript to msie browsers and remove href of all others
//
// [ sIFR button ] activation
//						_bindSIFRFormButtons : function(containerTargetString, selectorButtons, jqButtons, clickHandlerName)
						_bindFormButtons : function(containerTargetString, selectorButtons, jqButtons, clickHandlerName)
						{
							var __this = this;
							
							// Store container target string
							var containerTargetString = (containerTargetString != undefined) ? containerTargetString : this.DEFAULT_FORM_CONTAINER_TARGET;

//
// [ sIFR button ] activation
//							
//							// If ie then add href attribute to each buttons internal <a> tag
//							if ($.browser.msie)
//							{
//								// Create form reference storage array
//								if(!this.jQueryFormObjects) this.jQueryFormObjects = [];
//								
//								// Format link string fragment
//								var linkStringFragment = "javascript:" + this.instanceString + "." + clickHandlerName + "(";
//								
//								var startId = this.jQueryFormObjects.length;
//								//alert("Start id = " + startId);
//								
//								// Process buttons
//								jqButtons.each 
//								(
//									function (i)
//									{
//										var ___this = $(this);
//										
//										// Find child link
//										var link	= ___this.find("a");
//										
//										// Find parent form
//										var parentForm = ___this.parents("form:first");
//										
//										// Store parent form in reference array
//										__this.jQueryFormObjects.push(parentForm);
//										
//										// Attach href
//										var jsHref = linkStringFragment + (startId + i) + ");";
//										//alert("href = " + jsHref);
//										link.attr("href", ""); // clean href
//										link.attr("href", jsHref);
//									}
//								)
//							}
//							else
//							{
								// Ensure no href attribute on <a>
								jqButtons.each 
								(
									function (i)
									{
										var ___this = $(this);
										
										// Find child link
										var link	= ___this.find("a");
										
										// Clear href
										link.removeAttr("href"); //link.attr("href", "");
									}
								)
//							}
//							
//
// [ sIFR button ] styling
//							// Style buttons
//							sIFR.runDelayedButtonStyling(containerTargetString + " " + selectorButtons + " " + sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH);
						},
						
						
						
//						/*
//						=============================
//						IE 6 : Sifr'd link click handling method
//						=============================
//						*/
//							jQueryFormObjects : undefined,
//							
//							
//							_handleSifrFormSubmitLinkInternalClick : function (id)
//							{
//								var form = this.jQueryFormObjects[id];
//								
//								// Escape if no form
//								if (!form) return;
//								
//								// Create event object
//								var e		= new jQuery.Event("click"); 
//								e.target	= e.currentTarget = form[0];
//								
//								// Run method
//								this._handleFormSubmit(e);
//							},
//							
//							_handleSifrFormCancelLinkInternalClick : function (id)
//							{
//								var form = this.jQueryFormObjects[id];
//								
//								// Escape if no form
//								if (!form) return;
//								
//								// Create event object
//								var e		= new jQuery.Event("cancel");
//								e.target	= e.currentTarget = form[0];
//								
//								// Run method
//								this._handleFormCancel(e);
//							},
			
			
			
					/*
					 * CONFIGURE FORM ERROR MESSAGES
					 */
						configureFormErrorMessages : function ()
						{
							// If a form has errored the error spans will (should) be overlaying ontop of the input fields
							// As such need to add following functionality :
							//		- error span	: when clicked disappears
							//		- input fields	: when clicked error span disappear
							//		- cursor left focused in correct input
							//		- (?) add error class to PARENT 'div.item'
							
							// Get all spans
							// For each span
								// Get sibling input
								// Attach click event handler to each
							
							var __this = this;
							
							var errorSpans = $("form span." + this.FORM_ERROR_CLASS_ERROR);
							
							errorSpans.each(
								function (i)
								{
									//alert(i);
									
									var ___this = $(this);
									
									var parentForm	= ___this.closest("form");
									var parent		= ___this.closest("div.item");
									var input		= parent.find("input");
									
									// If no input search for textarea
									if (input.length == 0) input = parent.find("textarea");
							
									// Bind click handler methods to span and input
									___this.bind("click", null, function (e) { __this._handleHideFormErrorMessage(e); });
									//input.bind("click", null, function (e) { __this._handleHideFormErrorMessage(e); });
									input.bind("focus", null, function (e) { __this._handleHideFormErrorMessage(e); });
									
									//
									//
									// Add error class to parent if !client-side validating form
									//
									//
									if (!__this._formHasClientSideValidation(parentForm))
										if (!parent.hasClass(__this.FORM_ERROR_CLASS_ERROR)) parent.addClass(__this.FORM_ERROR_CLASS_ERROR);
								}
							);
							
							
							
							/*
							 * Run ie.6 fix 
							 * - Necessary to trigger correct rendering in ie.6 - without which ie.6 doesn't render error spans -> adding an additional class forces the browser to re-render elements and draw correctly!!!
							 */
								
								if ($.browser.msie && $.browser.version < 7)
								{
									errorSpans.each(function ()
									{
										$(this).addClass("fieldError-ie6Fix");
									});
								}
								
						},
						
						
						
						
						_handleHideFormErrorMessage : function (e)
						{
							var parent	= $(e.target).closest("div.item");
							var span	= parent.find("span." + this.FORM_ERROR_CLASS_ERROR);
							var input	= parent.find("input");
							
							// If no input search for textarea
							if (input.length == 0) input = parent.find("textarea");
							
							// Add hidden class
							if (!span.hasClass(this.FORM_ERROR_CLASS_ERROR_HIDDEN)) span.addClass(this.FORM_ERROR_CLASS_ERROR_HIDDEN);
							
							// Remove click handlers as now hidden, otherwise we end up in looped js chain
							span.unbind("click");
							//input.unbind("click");
							input.unbind("focus");
							
							// Focus into input 
							input.focus();
							input.select();
							
							// after focus re-bind span
							var __this = this;
							span.bind("click", null, function (e) { __this._handleHideFormErrorMessage(e); });
							//input.bind("click", null, function (e) { __this._handleHideFormErrorMessage(e); });
							input.bind("focus", null, function (e) { __this._handleHideFormErrorMessage(e); });
						},
						
						
						_hideAllFormErrorMessages : function (jQueryObjectTargetForm)
						{
							var errorSpans = jQueryObjectTargetForm.find("span." + this.FORM_ERROR_CLASS_ERROR);
							
							errorSpans.each(
								function (i)
								{
									var ___this = $(this);
									if (!___this.hasClass(this.FORM_ERROR_CLASS_ERROR_HIDDEN)) ___this.addClass(this.FORM_ERROR_CLASS_ERROR_HIDDEN);
								}
							);
						},
						
						
						
					
					/*
						
					*/
						

			
					/*
					 * CONFIGURE 'SERVICE YOUR LEXUS' FORM/PAGE FUNCTIONALITY
					 */
						
						_configureServiceYourLexus : function ()
						{
							// Get target container
							var target = $(this.SERVICE_YOUR_LEXUS_JQ_TARGET_STATE_CONTAINER);
							
							// Configure according to current state
							this._configureServiceYourLexusDisplayState();
						},

						_serviceYourLexusDisplayStateConfigured : false,
						
						_configureServiceYourLexusDisplayState : function ()
						{
							var __this = this;

                            // alert( document.URL ); // cannot use this because url has already been rewritten to match the workflow and arguments have been stripped							
                            
							// get #divUvlContainer from the parent document
                            var jqParent = $("#divUvlContainer", parent.document.body);
                            
                            // find div.summary-service-your-lexus in #divUvlContainer 
                            var jqPanel = $(jqParent).find("div.summary-service-your-lexus");
                            
                            // find a.Service in div.summary-service-your-lexus
                            var jqAnchor = $(jqPanel).find("#aService");

                            // store whether request has come from the home view
                            var fromHomeView = $(jqAnchor).hasClass(this.SERVICE_YOUR_LEXUS_JQ_ATTRIBUTE_NAME);
                            
                            if (fromHomeView)
                            {
                                // give a debug message
                                // alert( 'this request has come from homeview' );										
                                // remove the class as already on the form
                                $(jqAnchor).removeClass(this.SERVICE_YOUR_LEXUS_JQ_ATTRIBUTE_NAME);
//                                if ($(jqAnchor).hasClass(this.SERVICE_YOUR_LEXUS_JQ_ATTRIBUTE_NAME))
//                                {
//                                    alert( 'class NOT successfully removed!' );										
//                                }
//                                else
//                                {
//                                    alert( 'class was successfully removed!' );										
//                                }
                            }
                            else
                            {
                                // alert( 'this request has NOT come from homeview' );
                            }
                            
                            // Check if request has come from the view view
                            if (fromHomeView)                            
                            {			
                                // request has come from the view view. So, reset the steps as IE is incapable of doing so.
                                				
                                var target = $(this.SERVICE_YOUR_LEXUS_JQ_TARGET_STATE_CONTAINER);
                                
							    if (target.hasClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_1)) target.removeClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_1);
							    if (target.hasClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_2)) target.removeClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_2);
							    if (target.hasClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_3)) target.removeClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_3);
							    if (target.hasClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_4)) target.removeClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_4);
							    if (target.hasClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_5)) target.removeClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_5);
							    if (target.hasClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_6)) target.removeClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_6);
							    if (target.hasClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_7)) target.removeClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_7);
    							
							    target.addClass(this.SERVICE_YOUR_LEXUS_CLASS_SERVICE_VEHICLE_STATE_1);
                            }
                            
							// Set configured = true
							this._serviceYourLexusDisplayStateConfigured = true;
						},
					
								
			
					/*
					 * CONFIGURE 'SELL YOUR LEXUS' FORM/PAGE FUNCTIONALITY
					 */
						
						_configureSellYourLexus : function ()
						{
							// Get target container
							var target = $(this.SELL_YOUR_LEXUS_JQ_TARGET_STATE_CONTAINER);
							
							// Configure according to current state
							if (target.hasClass(this.SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_1)) this._configureSellYourLexusDisplayState1();
							else if (target.hasClass(this.SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_2)) this._configureSellYourLexusDisplayState2();
							
						},
						
						
						
						_sellYourLexusDisplayState1Configured : false,
						
						_configureSellYourLexusDisplayState1 : function ()
						{
							var __this = this;
							
							// Find continue button
							var continueButton	= $(this.SELL_YOUR_LEXUS_JQ_TARGET_CONTINUE_BUTTON);
							
							// Attach click event to continue button
							continueButton.bind("click", null, function (e){ __this._switchDisplayStateSellYourLexus(2); });


//
// [ sIFR button ] activation / styling
//							
//							// If ie then add href attributes to <a>
//							if ($.browser.msie)
//							{
//								var link		= continueButton.find("a:first");
//								var linkString	= "javascript:" + this.instanceString + "._switchDisplayStateSellYourLexus(2);";
//								
//								link.attr("href", linkString);
//							}
//							
//							// Style buttons
//							sIFR.runDelayedButtonStyling(this.SELL_YOUR_LEXUS_PAGE_ID_JQ_TARGET + " " + this.SELL_YOUR_LEXUS_JQ_TARGET_CONTINUE_BUTTON + " " + sIFR.styles.DEFAULT_BUTTON_STYLE_TARGET_STRING_INTERNAL_PATH);
							
							
							// Set configured = true
							this._sellYourLexusDisplayState1Configured = true;
						},
						
						
						_sellYourLexusDisplayState2Configured : false,
						
						_configureSellYourLexusDisplayState2 : function ()
						{
							var __this = this;
							
							// Find back button
							var backButton = $(this.SELL_YOUR_LEXUS_JQ_TARGET_BACK_TO_INSTRUCTIONS_BUTTON);
							
							// Attach click event to back button
							backButton.bind("click", null, function (e){ __this._switchDisplayStateSellYourLexus(1); });
							
							// Set configured = true
							this._sellYourLexusDisplayState2Configured = true;
						},
					
					
					
					/*
					 * CONFIGURE 'FINANCE-QUOTE' FORM/PAGE FUNCTIONALITY
					 */
						_configureFinanceQuote : function ()
						{
							var __this = this;
							
							$(this.FINANCE_FORM_JQ_TARGET_RADIO_BUTTON + ":eq(0)").click(
								function() 
								{
									var _parentFieldset = $(this).parents("fieldset");

									__this._switchDisplayFinanceQuoteType(_parentFieldset,
																		  _parentFieldset.find("div.depositamount, div.termmonthsdeposit"),
																		  __this.FINANCE_FORM_TYPE_QUOTE_MONTHLY
																		  );
								}
							)

							$(this.FINANCE_FORM_JQ_TARGET_RADIO_BUTTON + ":eq(1)").click(
								function() 
								{
									var _parentFieldset = $(this).parents("fieldset");

									__this._switchDisplayFinanceQuoteType(_parentFieldset,
																		  _parentFieldset.find("div.amountmonthly, div.termmonthsmonthly"),
																		  __this.FINANCE_FORM_TYPE_QUOTE_DEPOSIT
																		  );
								}
							)

							//Set our default option by programatically firing the click handler on the selected radio button.
							$(this.FINANCE_FORM_JQ_TARGET_RADIO_BUTTON + ":checked").trigger("click");
							
						},
					
					
			
				/*
				 =============================
				 DISPLAY CREATION
				 =============================
				 */
			
			
			
				/*
				 =============================
				 DISPLAY CONTROL
				 =============================
				 */
				 
					/*
					 * 'SELL YOUR LEXUS'
					 */
						_switchDisplayStateSellYourLexus : function (id)
						{
							var target = $(this.SELL_YOUR_LEXUS_JQ_TARGET_STATE_CONTAINER);
							if (id == 1)
							{
								if (target.hasClass(this.SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_2)) target.removeClass(this.SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_2);
								target.addClass(this.SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_1);
								
								// If display state 1 not configured then configure
								if (!this._sellYourLexusDisplayState1Configured) this._configureSellYourLexusDisplayState1();
							}
							else if (id == 2)
							{
								if (target.hasClass(this.SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_1)) target.removeClass(this.SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_1);
								target.addClass(this.SELL_YOUR_LEXUS_CLASS_SELL_VEHICLE_STATE_2);
								
								// If display state 2 not configured then configure
								if (!this._sellYourLexusDisplayState2Configured) this._configureSellYourLexusDisplayState2();
							}
						},
					
					
					
					/*
					 * 'FINANCE QUOTE'
					 */
						_switchDisplayFinanceQuoteType : function (parentFieldset, itemsToDisable, type)
						{
							__this = this;
							
							// Remove any existing disabled overlays
							parentFieldset.find(this.FINANCE_FORM_JQ_TARGET_DISABLED_OVERLAY).remove();
							
							// Remove any disabling classes
							var currentlyDisabledItems = $("div." + this.FINANCE_FORM_JQ_TARGET_DISABLED_ITEM_CLASS);
							currentlyDisabledItems.removeClass(this.FINANCE_FORM_JQ_TARGET_DISABLED_ITEM_CLASS);
							
							// Add disabled overlay to required items
							itemsToDisable.each(
								function(i) 
								{
									var ___this = $(this);
									___this.append(__this.FINANCE_FORM_DISABLED_OVERLAY_HTML);
									
									if (!___this.hasClass(__this.FINANCE_FORM_JQ_TARGET_DISABLED_ITEM_CLASS)) ___this.addClass(__this.FINANCE_FORM_JQ_TARGET_DISABLED_ITEM_CLASS) 
								}
							);
						},
					
			
			
			
				/*
				 =============================
				 INTERNAL EVENT HANDLERS
				 =============================
				 */
					// carries out a search form submit event
					_handleFormSubmit : function (e)
					{
						this._handleFormAction(e,"submit");
					},
					
					// carries out a search form cancel event
					_handleFormCancel : function (e)
					{
						this._handleFormAction(e,"cancel");
					},
					
					_handleFormAction : function(e, action)
					{
						e.stopPropagation();
						e.stopImmediatePropagation();
						e.preventDefault();
						
						var form = $(e.target);
						
						// If target !form find closest parent form
						if (!form.is("form"))
							form = form.closest("form"); 
						
						// If no form found escape
						if (form.length == 0) return;
						
						// Submit form
						form.trigger(action);
					}
					
		}
	);
	
	//alert("...//...");




/*
 **************
 * IMPORTANT :: All runtime instance declarations MUST be bound to document 'js-class-setup' event
 **************
 */

	$(document).bind("js-class-setup", function ()
	{
		// Setup runtime namespace if doesn't exist
		if (!manheim.global.isNamespaceDefined("manheim.portfolio.runtime.display.controls")) manheim.global.createNamespace("manheim.portfolio.runtime.display.controls", "1.0");
		
		// Create instance
		manheim.portfolio.runtime.display.controls.formControls	= new manheim.portfolio.lexus.display.controls.FormControls("manheim.portfolio.runtime.display.controls.formControls");
	});



	/*
	 ========================
	 * REPLACEMENT CONTROL METHODS
	 ========================
	 */
		
		/*
		 ***************************************
		 * PAGE SPECIFIC ASSETS
		 ***************************************
		 */
		
			sIFR.replaceDealerPageAssets = function() 
			{
				//
				// DEALER RESULTS
				//				
				var dealer = $("body > div.dealer-container"); 
				
				if (dealer.length > 0)
				{
					var isResults = (dealer.find("div.results-container > div.vehicle-list-mode-list").length > 0) ? true : false;
					if (isResults)
					{
						sIFR.replace(sIFR.styles.FONT_1_STYLE_4, 
						{
							selector:	"div.dealer-container > div.uvl-container > div.search-criteria-container > form > div.search-criteria-panels > h3.search-center-stock"
										+ ", div.dealer-container > div.results-container > div.vehicle-list-mode-list > h3#resultCountHeader"
						});
					}

					sIFR.replace(sIFR.styles.FONT_3_STYLE_5, 
					{
						selector: "div.main-container > div.header-container > h2#centre-name"
					});
				}
			};


/* ============================== sophus3 ==============================
   logging script for                                                               29/09/2010
   
   Lexus
   
   Version 5.0.1
   Copyright (c) Sophus Ltd 2010. All rights reserved. Patent Pending.
   http://www.sophus3.com
   =====================================================================*/
   
/*=============================== Switch ==============================*/   
   if (typeof s3_logging_active == 'undefined') s3_logging_active = true;
   // If you want to switch off the tracking use the following line instead:
   // s3_logging_active = false;
/*=====================================================================*/

/* =========================== Customisation ===========================*/
   // required configuration parameters
   s3_site_id = tc_get_site_id();
   s3_server_url = "auto.sophus3.com";
   
   // SiteID Idenfication
   function tc_get_site_id() {
	var domain = document.location.hostname;
	domain = domain.toLowerCase();
	domain = domain.substring(domain.lastIndexOf(".")+1);
	   
	if (domain.toLowerCase() == "de") return 457;
	else if (domain.toLowerCase() == "it") return 458;
	else if (domain.toLowerCase() == "com") return 459;
	else if (domain.toLowerCase() == "fr") return 460;
	else if (domain.toLowerCase() == "uk") return 461; 

}


/*=====================================================================*/

/* ============================= Parameter =============================*/
   // attaches querystring parameters to thr page alias
   
   // If you want to to use a limited list of parameters, activate the array below
   /*var usePair = new Array();
   usePair['campaignid'] = 1;
   usePair['campaignid'] = 1;
   usePair['advertiserid'] = 1;
   usePair['bannerid'] = 1;
   */
   
   if (typeof tc_page_alias != 'undefined') {
	   
	s3_page_alias = tc_page_alias;
	   
	if (location.search != null && location.search.length > 1) {
		
		if(typeof usePair == 'undefined'){ // append entire query string
			if (s3_page_alias.indexOf('?') == -1) {
				s3_page_alias = s3_page_alias + location.search;
			}
			else {
				s3_page_alias = s3_page_alias + "&" + location.search.substring(1);
			}
		}
		
		else{ // append selected parameters
			var locSearch = location.search.substring(1);
			var s3Params = locSearch.split('&');
			var s3_params = '';
			var nextAppender = (s3_page_alias.indexOf('?') == -1) ? '?' : '&';

			for (var i=0; i<s3Params.length; i++) {
				if (s3Params[i].indexOf('=') != -1) {
					var pair = s3Params[i].split('=');
					if (usePair[pair[0]] == 1) {
						s3_params += nextAppender + s3Params[i];
						nextAppender = '&'; // Change from ? to &
					}
				}
			}
			s3_page_alias += s3_params;
		}
	}
   }
/*=====================================================================*/

/*=========================== StandardCode ============================*/
/*             DO NOT MAKE CHANGES TO THE CODE BELOW !                */
	
   function s3_configured() {
	s3_tag_version = "5.0.1";// see 501 comments
	s3_dtimeout = 5000;
	s3_d_loc = window.location;
	s3_sent = 0;
	if (typeof s3_server_url== 'undefined' ||typeof s3_site_id== 'undefined' ) return false;
	s3_timeout=(typeof s3_timeout== 'undefined' ?s3_dtimeout:s3_timeout*1000);
	s3_encfn=(typeof encodeURIComponent!= 'undefined' ?encodeURIComponent:escape);
	s3_http="http"+(s3_d_loc.href.substring(0,6)=="https:"?"s":"")+"://";
	s3_server_url=s3_http+s3_server_url;
	s3_url=((typeof s3_page_alias!= 'undefined')?s3_page_alias:s3_d_loc.href);
	s3_referrer=(typeof s3_referrer!= 'undefined' &&s3_referrer!=""&&s3_referrer!=null?s3_referrer:(typeof document.referrer== 'undefined' ?s3_ud:(document.referrer==null?"null":(document.referrer==""?"empty":document.referrer))));
	s3_time = new Date().getTime();
	return true;
   }


   function s3_log(alias, displayed) {
	if (!s3_logging_active) return;
	alias=s3_fixURL(alias);
	s3_image=new Image();
	s3_image.src=s3_get_log_URL_s3log("i",alias,new Date().getTime(), displayed);
  }
	function tc_log(alias, displayed) {
		s3_log(alias, displayed);
	}


   function s3_dltime() {
	if (!(document.getElementById||document.all)) return false;
	if (s3_logging_active&&(typeof s3_done!="undefined")&&s3_done&&!s3_sent) { setTimeout("s3_dltime()",1000);return false; }
	var sent=s3_sent;
	s3_image=new Image();
	s3_image.name = "s3d";
	s3_image.src=s3_get_log_URL("d");
	return sent;
   }
	function tc_dltime() {
		s3_dltime();
	}

   function s3_get_log_URL(type,locn,time,displayed) {
	if (typeof type== 'undefined' ) type='i';
	var url=s3_server_url+"/"+type+"?siteID="+s3_site_id;
	if (type!="d") {
		url+="&ts="+(typeof time!= 'undefined' ?time:s3_time);
		
		var al = s3_isAlias(locn);
		if (typeof s3_containers!= 'undefined' ) for(cc in s3_containers) url+="&ccID="+s3_containers[cc];
		if (type=="c") url+="&log=no";
		if (al) url+="&alias=true";
		if (typeof displayed!= 'undefined' ) url+=displayed;
		if (locn== 'undefined' ) locn=s3_d_loc;
		locn=s3_encfn(locn);
		while (locn.length>1999-url.length) locn=locn.substring(0,locn.lastIndexOf(s3_encfn("&")));
		url+="&location="+locn;
		var dg=new Object();
		dg.tagv=s3_tag_version;
		dg.tz=0-(new Date().getTimezoneOffset());
		dg.r=s3_encfn(s3_referrer);
		if (al) dg.aliased=s3_encfn(s3_d_loc.href);
		dg.title=s3_encfn(document.title);
		dg.flv=  s3_getFlashVersion(); 
		var plg = s3_getPlugInz();
		dg.Rep = plg.Rep;
		dg.Qut = plg.Qut;
		dg.WMP = plg.WMP;
		dg.ARe = plg.ARe;
		dg.Jav = plg.Jav;
		dg.SiL = plg.SiL;
			
		if (screen) {dg.cd=screen.colorDepth;dg.ah=screen.availHeight;dg.aw=screen.availWidth;dg.sh=screen.height;dg.sw=screen.width;dg.pd=screen.pixelDepth;}
		for (var key in dg) { var param="&"+key+"="+dg[key]; if (url.length+param.length<2000) url+=param; else break; }
	} else {
		url+="&dlts="+s3_time+"&dl="+(new Date().getTime()-s3_time);
		
	}
	return url;
   }

   function s3_get_log_URL_s3log(type,locn,time,displayed) {
		return s3_get_log_URL(type,locn,time,displayed) + "&s3log=1";
   }
   
   function s3_get_log_URL_s3red(type,locn,time,displayed) {
		return s3_get_log_URL(type,locn,time,displayed) + "&s3red=1";
   }
   
  function tc_redirect(target,url,alias,winproperties,products,script) {
	s3_redirect(target,url,alias,winproperties,products,script);
  } 
   
function s3_redirect(target,url,alias,winproperties,products,script) {
	if (typeof url==s3_ud||url=="") return;
	if (typeof script==s3_ud||script=="") script="s3_d_loc.href='"+url+"'";
	url=s3_fixURL(url);
	if (typeof alias==s3_ud) alias=url;
	alias=s3_fixURL(alias);
	if (typeof target==s3_ud||target==""||target=="_self") {
		if (s3_logging_active) {
			s3_timer=new Image();
			s3_timer.onload=function() { eval(script); clearTimeout(s3_timeout_id); }
			s3_timer.onerror=function() { eval(script); clearTimeout(s3_timeout_id); }
			s3_timer.src=s3_get_log_URL_s3red("i",alias,new Date().getTime());
			s3_timeout_id=setTimeout(script,s3_timeout);
		} else { eval(script); }
	} else if (typeof target=="object"&&target.document) {
		if (s3_logging_active) { s3_timer=new Image();s3_timer.src=s3_get_log_URL_s3red("i",alias); }
		target.location.href=url;
	} else { s3_open_window(target,url,alias,winproperties,products); }
}
   
function s3_open_window(name,url,alias,winproperties,products) {
	if (typeof url==s3_ud||url=="") return false;
	if (s3_logging_active) { s3_timer=new Image();s3_timer.src=s3_get_log_URL("i",alias,new Date().getTime()); }
	if (typeof winproperties==s3_ud) return window.open(url,name);
	else { return window.open(url,name,winproperties) }
}

   function s3_getFlashVersion() {
	/*501
	   var s3_flashversion = -1;
	// ie 
	try { 
		try { 
		// avoid fp6 minor version lookup issues 
		// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ 
		var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); 
		try { axo.AllowScriptAccess = 'always'; } 
		catch(e) { return '6,0,0'; } 
	} catch(e) {} 
	s3_flashversion = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1]; 
	// other browsers 
	}
	catch(e) { 
		try { 
			if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ 
				s3_flashversion = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]; 
			} 
		} catch(e) {} 
	} 
	return s3_flashversion.split(',').shift(); 
	501*/ 
	
	return "no detection";
   }


   function s3_fixURL(url) {
	if (url=="") { return s3_d_loc.href }
	if ((url.substring(0,4)!='http')&&(url.substring(0,1)!="/")) { url=s3_d_loc.pathname.substring(0,s3_d_loc.pathname.lastIndexOf('/')+1)+url }
	if (url.substring(0,1)=="/") { url=s3_http+s3_d_loc.host+url }
	var s3anchor = window.location.hash;
	if(s3anchor.length>0){
		if (url.indexOf("?") == -1) url = url + "?";
		else url = url + "&";
		url = url + "s3anchor=" + s3anchor.substring(1);
	}
	return url;
   }


   function s3_isAlias(alias) {
	alias=(typeof alias!= 'undefined' ?alias:(typeof s3_page_alias== 'undefined' ?"":s3_page_alias));
	alias=s3_fixURL(alias);
	if (alias.indexOf("?")>0) alias=alias.substring(0,alias.indexOf("?"));
	return (alias != s3_http+s3_d_loc.host+s3_d_loc.pathname);
   }


   function s3_loader() {
	s3_ud = "undefined";
	if (s3_logging_active&&s3_configured()&&(typeof s3_done== 'undefined' ||s3_done==false)) {
		url=s3_fixURL(s3_url);
		s3_image=new Image();
		s3_image.name = "s3i";
		s3_image.onload=function(){s3_sent=true;}
		s3_image.src=s3_get_log_URL("i",url,s3_time);
	}
	s3_done = true;
   }

   function s3_getPlugInz() {
	   
	var PlugIn=new Object();      
	   
	s3_ReP = "no detection";
	s3_QuT = "no detection";
	s3_WMP = "no detection";
	s3_Are = "no detection";
	s3_Jav = "no detection";
	s3_SiL = "no detection";
	/*501
	try{
		s3_nse = "";
		for (var i=0;i<navigator.mimeTypes.length;i++) s3_nse += navigator.mimeTypes[i].type.toLowerCase();
		if (s3_nse != "") {
			s3_ReP = s3_detectNS("audio/x-pn-realaudio-plugin");
			s3_QuT = s3_detectNS("video/quicktime");
			s3_WMP = s3_detectNS("application/x-mplayer2");
			s3_Are = s3_detectNS("application/pdf");
			s3_Jav = s3_detectNS("application/x-java-applet");
			s3_SiL = s3_detectNS("application/x-silverlight");
		}
		else {
		
			if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
				document.writeln('<script language="VBscript">');
				document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
				document.writeln('detectableWithVB = False');
				document.writeln('If ScriptEngineMajorVersion >= 2 then');
				document.writeln('  detectableWithVB = True');
				document.writeln('End If');
				document.writeln('\'this next function will detect most plugins');
				
				document.writeln('Function detectActiveXControl(activeXControlName)');
				document.writeln('  on error resume next');
				document.writeln('  detectActiveXControl = False');
				document.writeln('  If detectableWithVB Then');
				document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
				document.writeln('  End If');
				document.writeln('End Function');
				document.writeln('\'and the following function handles QuickTime');
				
				document.writeln('Function detectQuickTimeActiveXControl(activeXControlName)');
				document.writeln('  on error resume next');
				document.writeln('  detectQuickTimeActiveXControl = False');
				document.writeln('  If detectableWithVB Then');
				document.writeln('    detectQuickTimeActiveXControl = False');
				document.writeln('    hasQuickTimeChecker = false');
				document.writeln('    Set hasQuickTimeChecker = CreateObject(activeXControlName)');
				document.writeln('    If IsObject(hasQuickTimeChecker) Then');
				document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
				document.writeln('        detectQuickTimeActiveXControl = True');
				document.writeln('      End If');
				document.writeln('    End If');
				document.writeln('  End If');
				document.writeln('End Function');
				document.writeln('</scr' + 'ipt>');
			
				s3_ReP = detectActiveXControl("rmocx.RealPlayer G2 Control");
				s3_QuT = detectQuickTimeActiveXControl("QuickTimeCheckObject.QuickTimeCheck");
				s3_WMP = detectActiveXControl("MediaPlayer.MediaPlayer");
				s3_Are = detectActiveXControl("PDF.PdfCtrl");
				if (s3_Are==false) s3_Are = detectActiveXControl("AcroPDF.PDF");
				s3_Jav = detectActiveXControl("JavaWebStart.isInstalled");
				s3_SiL = detectActiveXControl("AgControl.AgControl");
			}
		}
	}
	
	catch (e) {

		s3_ReP = "error1";
		s3_QuT = "error1";
		s3_WMP = "error1";
		s3_Are = "error1";
		s3_Jav = "error1";
		s3_SiL = "error1";
		
	}
	
	PlugIn.Rep=s3_ReP;
	PlugIn.Qut=s3_QuT;
	PlugIn.WMP=s3_WMP;
	PlugIn.ARe=s3_Are;
	PlugIn.Jav=s3_Jav;
	PlugIn.SiL=s3_SiL;
	
	501*/ 
	
	return PlugIn;
}

function s3_detectNS(s3_ClassID) {
	try{
		if (s3_nse.indexOf(s3_ClassID) != -1) {
			if (navigator.mimeTypes[s3_ClassID].enabledPlugin != null) return true;
		}
		else return false
	}
	catch(e) {
		return "error2"
	}
}
   
s3_loader();


