document.write('<link rel="stylesheet" type="text/css" href="/core/library/css/components/page/hide-defaults.css" media="all"/>');jQuery.fn.liScroll = function(settings) {
		settings = jQuery.extend({
		travelocity: 0.07
		}, settings);		
		return this.each(function(){
				var $strip = jQuery(this);
				$strip.addClass("newsticker")
				var stripWidth = 0;
				var $mask = $strip.wrap("<div class='mask'></div>");
				var $tickercontainer = $strip.parent().wrap("<div class='tickercontainer'></div>");								
				var containerWidth = $strip.parent().parent().width();	//a.k.a. 'mask' width 	
				$strip.find("li").each(function(i){
				stripWidth += jQuery(this, i).width();
				});
				$strip.width(stripWidth);			
				var defTiming = stripWidth/settings.travelocity;
				var totalTravel = stripWidth+containerWidth;								
				function scrollnews(spazio, tempo){
				$strip.animate({left: '-='+ spazio}, tempo, "linear", function(){$strip.css("left", containerWidth); scrollnews(totalTravel, defTiming);});
				}
				scrollnews(totalTravel, defTiming);				
				$strip.hover(function(){
				jQuery(this).stop();
				},
				function(){
				var offset = jQuery(this).offset();
				var residualSpace = offset.left + stripWidth;
				var residualTime = residualSpace/settings.travelocity;
				scrollnews(residualSpace, residualTime);
				});			
		});	
};
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(5($){$.2c({8:{2q:0}});$.1Z.8=5(f,2){3(x f==\'2D\')2=f;2=$.2c({f:(f&&x f==\'2l\'&&f>0)?--f:0,H:m,p:$.11?21:G,C:G,24:\'C-t-\',1R:m,1K:m,1O:m,1P:m,1D:\'34\',2n:m,2o:m,2e:G,10:m,T:m,X:m,1j:\'8-c\',y:\'8-2E\',U:\'8-H\',R:\'8-d\',14:\'8-1N\',1p:\'8-2G\',26:\'J\'},2||{});$.g.1d=$.g.1d||$.g.I&&x 2H==\'5\';5 1G(){25(0,0)}u 6.Q(5(){4 d=6;4 c=$(\'1e.\'+2.1j,d);c=c.L()&&c||$(\'>1e:l(0)\',d);4 8=$(\'a\',c);3(2.C){4 1J={};8.Q(5(){$(6).1Y(\'<s>\'+$(6).1Y()+\'</s>\');4 q=2.24+(++$.8.2q);4 9=\'#\'+q;1J[9]=6.1C;6.1C=9;$(\'<J q="\'+q+\'" 2I="\'+2.R+\'"></J>\').2i(d)})}4 r=$(\'J.\'+2.R,d);r=r.L()&&r||$(\'>\'+2.26,d);c.z(\'.\'+2.1j)||c.v(2.1j);r.Q(5(){4 $$=$(6);$$.z(\'.\'+2.R)||$$.v(2.R)});4 1B=$(\'7\',c).2J($(\'7.\'+2.y,c)[0]);3(1B>=0){2.f=1B}3(S.9){8.Q(5(i){3(6.9==S.9){2.f=i;3(($.g.I||$.g.2K)&&!2.C){4 j=$(S.9);4 1a=j.V(\'q\');j.V(\'q\',\'\');17(5(){j.V(\'q\',1a)},2M)}1G();u G}})}3($.g.I){1G()}r.1b(\':l(\'+2.f+\')\').1L().1h().2N(\':l(\'+2.f+\')\').v(2.14);3(!2.C){$(\'7\',c).Y(2.y).l(2.f).v(2.y)}3(2.2e){4 1F=5(29){4 1x=$.2O(r.18(),5(W){4 h,1z=$(W);3(29){3($.g.1d){W.N.2P(\'2d\');W.N.o=\'\';W.1i=m}h=1z.A({\'1n-o\':\'\'}).o()}n{h=1z.o()}u h}).2Q(5(a,b){u b-a});3($.g.1d){r.Q(5(){6.1i=1x[0]+\'2f\';6.N.2R(\'2d\',\'6.N.o = 6.1i ? 6.1i : "2S"\')})}n{r.A({\'1n-o\':1x[0]+\'2f\'})}};1F();4 1f=d.2k;4 1H=d.13;4 1E=$(\'#8-2g-2h-L\').18(0)||$(\'<s q="8-2g-2h-L">M</s>\').A({2j:\'2T\',2U:\'2V\',2W:\'2X\'}).2i(D.1u).18(0);4 1l=1E.13;2Y(5(){4 1k=d.2k;4 1I=d.13;4 1m=1E.13;3(1I>1H||1k!=1f||1m!=1l){1F((1k>1f||1m<1l));1f=1k;1H=1I;1l=1m}},1y)}4 P={},K={},1A=2.2n||2.1D,1v=2.2o||2.1D;3(2.1K||2.1R){3(2.1K){P[\'o\']=\'1L\';K[\'o\']=\'1N\'}3(2.1R){P[\'w\']=\'1L\';K[\'w\']=\'1N\'}}n{3(2.1O){P=2.1O}n{P[\'1n-1S\']=0;1A=2.p?1y:1}3(2.1P){K=2.1P}n{K[\'1n-1S\']=0;1v=2.p?1y:1}}4 10=2.10,T=2.T,X=2.X;8.15(\'2p\',5(){4 7=$(6).Z(\'7:l(0)\');3(d.12||7.z(\'.\'+2.y)||7.z(\'.\'+2.U)){u G}4 9=6.9;3($.g.I){$(6).E(\'O\');3(2.p){$.11.1t(9);S.9=9.1s(\'#\',\'\')}}n 3($.g.1r){4 1W=$(\'<22 2r="\'+9+\'"><J><2s 2t="1X" 2u="h" /></J></22>\').18(0);1W.1X();$(6).E(\'O\');3(2.p){$.11.1t(9)}}n{3(2.p){S.9=9.1s(\'#\',\'\')}n{$(6).E(\'O\')}}});8.15(\'1o\',5(){4 7=$(6).Z(\'7:l(0)\');3($.g.1r){7.1c({w:0},1,5(){7.A({w:\'\'})})}7.v(2.U)});3(2.H&&2.H.1q){1V(4 i=0,k=2.H.1q;i<k;i++){8.l(--2.H[i]).E(\'1o\').1h()}};8.15(\'1U\',5(){4 7=$(6).Z(\'7:l(0)\');7.Y(2.U);3($.g.1r){7.1c({w:1},1,5(){7.A({w:\'\'})})}});8.15(\'O\',5(e){4 1g=e.2z;4 F=6,7=$(6).Z(\'7:l(0)\'),j=$(6.9),B=r.1b(\':2B\');3((x 10==\'5\'&&10(6,j[0],B[0])==G&&1g)||d.12||7.z(\'.\'+2.y)||7.z(\'.\'+2.U)){6.2a();u G}d[\'12\']=21;3(j.L()){3($.g.I&&2.p){4 1a=6.9.1s(\'#\',\'\');j.V(\'q\',\'\');17(5(){j.V(\'q\',1a)},0)}5 1M(){3(2.p&&1g){$.11.1t(F.9)}B.1c(K,1v,5(){$(F).Z(\'7:l(0)\').v(2.y).2F().Y(2.y);3(x T==\'5\'){T(F,j[0],B[0])}B.v(2.14).A({2j:\'\',2b:\'\',o:\'\',w:\'\'});j.Y(2.14).1c(P,1A,5(){j.A({2b:\'\',o:\'\',w:\'\'});3($.g.I){B[0].N.1b=\'\';j[0].N.1b=\'\'}3(x X==\'5\'){X(F,j[0],B[0])}d.12=m})})}3(!2.C){1M()}n{4 $$=$(6),s=$(\'s\',6)[0],1T=s.1Q;$$.v(2.1p);s.1Q=\'30&#32;\';17(5(){$(F.9).33(1J[F.9],5(){1M();s.1Q=1T;$$.Y(2.1p)})},0)}}n{2v(\'2w z 2x 2y d.\')}4 27=1w.2A||D.19&&D.19.20||D.1u.20||0;4 28=1w.2C||D.19&&D.19.23||D.1u.23||0;17(5(){1w.25(27,28)},0);6.2a();u 2.p&&!!1g});3(2.C){8.l(2.f).E(\'O\').1h()}3(2.p){$.11.2Z(5(){8.l(2.f).E(\'O\').1h()})}})};4 16=[\'2p\',\'1o\',\'1U\'];1V(4 i=0;i<16.1q;i++){$.1Z[16[i]]=(5(2m){u 5(t){u 6.Q(5(){4 c=$(\'1e.8-c\',6);c=c.L()&&c||$(\'>1e:l(0)\',6);4 a;3(!t||x t==\'2l\'){a=$(\'7 a\',c).l((t&&t>0&&t-1||0))}n 3(x t==\'2L\'){a=$(\'7 a[@1C$="#\'+t+\'"]\',c)}a.E(2m)})}})(16[i])}})(31);',62,191,'||settings|if|var|function|this|li|tabs|hash|||nav|container||initial|browser|||toShow||eq|null|else|height|bookmarkable|id|containers|span|tab|return|addClass|opacity|typeof|selectedClass|is|css|toHide|remote|document|trigger|clicked|false|disabled|msie|div|hideAnim|size||style|click|showAnim|each|containerClass|location|onHide|disabledClass|attr|el|onShow|removeClass|parents|onClick|ajaxHistory|locked|offsetHeight|hideClass|bind|tabEvents|setTimeout|get|documentElement|toShowId|filter|animate|msie6|ul|cachedWidth|trueClick|end|minHeight|navClass|currentWidth|cachedFontSize|currentFontSize|min|disableTab|loadingClass|length|safari|replace|update|body|hideSpeed|window|heights|50|jq|showSpeed|hasSelectedClass|href|fxSpeed|watchFontSize|_setAutoHeight|unFocus|cachedHeight|currentHeight|remoteUrls|fxSlide|show|switchTab|hide|fxShow|fxHide|innerHTML|fxFade|width|text|enableTab|for|tempForm|submit|html|fn|scrollLeft|true|form|scrollTop|hashPrefix|scrollTo|tabStruct|scrollX|scrollY|reset|blur|overflow|extend|behaviour|fxAutoHeight|px|watch|font|appendTo|display|offsetWidth|number|tabEvent|fxShowSpeed|fxHideSpeed|triggerTab|remoteCount|action|input|type|value|alert|There|no|such|clientX|pageXOffset|visible|pageYOffset|object|selected|siblings|loading|XMLHttpRequest|class|index|opera|string|500|not|map|removeExpression|sort|setExpression|1px|block|position|absolute|visibility|hidden|setInterval|initialize|Loading|jQuery|8230|load|normal'.split('|'),0,{}))
/*
 * jQuery UI 1.7.1
 *
 * 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.1",

	// $.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);
/* Copyright (c) 2006 Mathias Bank (http://www.mathias-bank.de)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * Thanks to Hinnerk Ruemenapf - http://hinnerk.ruemenapf.de/ for bug reporting and fixing.
 */
jQuery.extend({
/**
* Returns get parameters.
*
* If the desired param does not exist, null will be returned
*
* @example value = $.getURLParam("paramName");
*/ 
 getURLParam: function(strParamName){
	  var strReturn = "";
	  var strHref = window.location.href;
	  var bFound=false;
	  
	  var cmpstring = strParamName + "=";
	  var cmplen = cmpstring.length;

	  if ( strHref.indexOf("?") > -1 ){
	    var strQueryString = strHref.substr(strHref.indexOf("?")+1);
	    var aQueryString = strQueryString.split("&");
	    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
	      if (aQueryString[iParam].substr(0,cmplen)==cmpstring){
	        var aParam = aQueryString[iParam].split("=");
	        strReturn = aParam[1];
	        bFound=true;
	        break;
	      }
	      
	    }
	  }
	  if (bFound==false) return null;
	  return strReturn;
	}
});// create the mam namespace if it does not already exist

if(mam == undefined) var mam = {};

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

* mam.config

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

mam.config = new function() {

	// Public Methods - this is the API (these are infact Priviledged Methods as they have access to private members)

	jQuery.extend(this,  { // use the jQuery extend function to add methods to the current object (this)

		version: "1.0",

		getControlXml: function() {

			return controlXml;

		},

		getSiteConfigXml: function() {

			return siteConfigXml;

		},

		getSiteSelectorXml: function() {

			return siteSelectorXml;

		},

		initialize: function(callback, parms) {

			if(!parms) {

				parms = {

					controlXml: true,

					siteConfigXml: true,

					siteSelectorXml: false

				}

			}

			if(controlXml == undefined && parms.controlXml && loading["controlXml"] == false) initControlXml();

			if(siteConfigXml == undefined && parms.siteConfigXml) initSiteConfigXml();

			if(siteSelectorXml == undefined && parms.siteSelectorXml) initSiteSelectorXml();

			queue[queue.length] = callback;

			if(activeLoads == 0) {

				process();

			}

		},

		setControlXmlPath: function(path) {

			controlXmlPath = path;

		},

		setSiteSelectorXmlPath: function(path) {

			siteSelectorPath = path;

		}

	});

	var controlXml = undefined; // internal variable to hold the control xml

	var siteConfigXml = undefined; // internal variable to hold the site config xml

	var siteSelectorXml = undefined; // internal variable to hold the site selector xml

	

	var controlXmlPath = "/control/control.xml"; // path to load the control xml from

							// Note: site config xml path is determined held in the control xml

	var siteSelectorPath = "/control/site-selector.xml"; // path to load the site selector xml from

	

	var queue = []; // queue of functions to be executed on completion of initialisation

	var queues = []; // array of queues for syncronizing dependent config

	var blocking = []; // array to hold the blocking state of the above queues

	var loading = {controlXml: false, siteConfigXml: false}; // array to hold the loading state of a particular config. Used when there is a dependency. 

				// A dependent canfig loader can check whether the config it depends on is currently being loaded before it decides to load it itself

	var timeout = []; // array of timeouts

	var activeLoads = 0; // variable to hold the numbver of loads currently active. Subsequent processing must wait until activeLoads = 0

	var loadID = 0; // Load ID assigned to each load. Used to identify metadata relating to the load such as its timeout process

	var queueIds = ["default", "controlXml"]; // registered syncronization queues

	for(var i=0; i<queueIds.length; i++) {

		queues[queueIds[i]] = [];

	}

	var asyncTimeout = 10; // seconds for async timeout

	var debug = false;

	

	// Private Methods

	var initControlXml = function() {

		loading["controlXml"] = true;

		var loadID = registerLoad();

		synchronize(function() {

			stop("controlXml");

			$.get(controlXmlPath,function(xml) {

				controlXml = xml;

				loading["controlXml"] = false;

				start("controlXml");

				loadComplete(loadID);

			});

		}, "controlXml");

	};

	var initSiteConfigXml = function() {

		if(controlXml == undefined && loading["controlXml"] == false) initControlXml();

		if(siteConfigXml == undefined && loading["siteConfigXml"] == false) { // do not load if alredy queued or loading

			loading["siteConfigXml"] = true;

			var loadID = registerLoad();

			synchronize(function() {

				stop("controlXml");

				$.get(mam.util.path.getSiteConfigPath(),function(xml) {

					siteConfigXml = xml;

					loading["siteConfigXml"] = false;

					start("controlXml");

					loadComplete(loadID);

				});

			}, "controlXml");

		}

	};

	var initSiteSelectorXml = function() {

		var loadID = registerLoad();

		$.get(siteSelectorPath,function(xml) {

			siteSelectorXml = xml;

			loadComplete(loadID);

		});

	};

	var synchronize = function(callback, id) {

		if(!id) id = "default";

		queues[id][queues[id].length] = callback;

		printDebug("synchronize");

		if(!blocking[id]) {

			processQueue(id);

		}

	};

	var stop = function(id) {

		if(!id) id = "default";

		blocking[id] = true;

		timeout[id] = setTimeout(function(){start(id);}, asyncTimeout * 1000);

		printDebug("stop");

	};

	var start = function(id) {

		if(!id) id = "default";

		if(timeout[id])

			clearTimeout(timeout[id]);

		blocking[id] = false;

		printDebug("start");

		processQueue(id);

	};

	var process = function(id) {

		if(!id) id = "default";

		while(queue.length && activeLoads == 0) {

			var call = queue[0];

			queue = queue.slice(1);

			call();

		}

	};

	var processQueue = function(id) {

		if(!id) id = "default";

		while(queues[id].length && !blocking[id]) {

			printDebug("process");

			var call = queues[id][0];

			queues[id] = queues[id].slice(1);

			call();

		}

	};

	var registerLoad = function() {

		activeLoads++;

		var loadID = getNextLoadID();

		timeout[loadID] = setTimeout(function(){loadComplete(loadID);}, asyncTimeout * 1000);

		return loadID

	};

	var loadComplete = function(loadID) {

		if(timeout[loadID])

			clearTimeout(timeout[loadID]);

		activeLoads--;

		process();

	};

	var getNextLoadID = function() {

		return loadID++;

	};

	var printDebug = function(caller) {

		if(this.debug) {

			for(var i=0; i<this.queueIds.length; i++) {

				$("#debug").append(caller+": queue id: "+this.queueIds[i]+" queue length: "+this.queues[this.queueIds[i]].length+" blocking: "+this.blocking[this.queueIds[i]]+"<br/>");

			}

			$("#debug").append("<br/>");

		}

	};

};

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

* mam.nav

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

mam.nav = new function() {

	// Public Methods

	jQuery.extend(this,  {

		version: "1.0",

		load: function(func) {

			$.get(mam.util.path.getSiteNavPath(), function(response) {

				if(mam.config.getSiteConfigXml() != undefined) {

					$("#site-nav > ul").html(response);

					showNavElements(mam.config.getSiteConfigXml()); // Show modules

					$("#site-nav ul li.coreNav").show(); // show all core nav modules
					$("#site-nav ul li").show(); // show all core nav modules

				} else {

					$("#site-nav ul li").show(); // show all modules if site config cannot be loaded

				}

				addNavBehaviour();

				setActive();

				if(func) func();

			});

		},

		isActive: function(href) {

				return isActive(href);

		}

	});

	// Private Methods

	var behaviours = {

		behaviour_01: function() { // Show/Hide

			$("#site-nav ul li").hover(function(){$(this).addClass("over");},function(){ $(this).removeClass("over"); }); // make css menus work in ie

			$("#site-nav > ul > li > a").click(function() {

				$("+ ul", this).toggle(); // toggle display

				if($("+ ul", this).size() == 0) return true; // if this nav element has no children then return true so that the link will fire

				return false;

			});

		},

		behaviour_02: function() { // Slide Up/Slide Down

			$("#site-nav ul li").hover(function(){$(this).addClass("over");},function(){ $(this).removeClass("over"); }); // make css menus work in ie

			$("#site-nav > ul > li > a").click(function() {

				//alert($("#site-nav > ul > li > ul:visible").size());

				//alert($("#site-nav > ul > li > ul:visible").not($("+ ul", this).get(0)).size());

				$("#site-nav > ul > li > ul:visible").not($("+ ul", this).get(0)).slideUp("slow"); // Hide all visible second level navs

				$("+ ul", this).slideToggle("slow"); // Show requested second level navs

				if($("+ ul", this).size() == 0) return true; // if this nav element has no children then return true so that the link will fire

				return false;

			});

		},

		behaviour_03: function() { // Slide Up/Slide Down 1st and 2nd level

			$("#site-nav ul li").hover(function(){$(this).addClass("over");},function(){ $(this).removeClass("over"); }); // make css menus work in ie

			$("#site-nav > ul > li > a").click(function() {

				//alert($("#site-nav > ul > li > ul:visible").size());

				//alert($("#site-nav > ul > li > ul:visible").not($("+ ul", this).get(0)).size());

				$("#site-nav > ul > li > ul:visible").not($("+ ul", this).get(0)).slideUp("slow"); // Hide all visible second level navs

				$("+ ul", this).slideToggle("slow"); // Show requested second level navs

				if($("+ ul", this).size() == 0) return true; // if this nav element has no children then return true so that the link will fire

				return false;

			});

			$("#site-nav > ul > li > ul > li > a").click(function() {

				$("#site-nav > ul > li > ul > li > ul:visible").not($("+ ul", this).get(0)).slideUp("slow"); // Hide all visible third level navs

				$("+ ul", this).slideToggle("slow"); // Show requested second level navs

				if($("+ ul", this).size() == 0) return true; // if this nav element has no children then return true so that the link will fire

				return false;

			});

		},

		behaviour_04: function() { // Slide Up/Slide Down 1st and 2nd level

			$("#site-nav ul li").hover(function(){$(this).addClass("over");},function(){ $(this).removeClass("over"); }); // make css menus work in ie

		}

	};

	var addNavBehaviour = behaviours["behaviour_04"]; // onclick behaviour for level 1 nav

	var showNavElements = function(xml) {

		$("module", xml).each(

			function(i) {

				$("#site-nav ul li#"+this.getAttribute("id")+"-nav").show();

			}

		);

	};

	var isActive = function(href) {

		var path = getPath(href);

		// remove page name i.e. everything after final slash

		path = path.substring(0, path.lastIndexOf("/"));

		//alert(path);

		if(path == "") return false; // assume external link ie. www.bbc.co.uk Need to find a better solution to this.

		return (getCurrentPath().indexOf(path) > -1);

	};

	var getCurrentPath = function() {

		var path;

		if(mam.util.env.isTeamsite()) {

			path = document.location.pathname;

			path = path.replace(mam.util.env.getCurrentHost(), "");

			for(var i=0; i<3; i++) { // remove workarea and branch

				path = path.substring(path.indexOf("/") + 1);

				// alert("i: "+i+" Path: "+path);

			}

			path = "/" + path // prepend slash

		} else {

			path = document.location.pathname;

		}

		// alert("getCurrentPath: "+path);

		return path;

	};

	var getPath = function(href) {

			var path = href;

			if(href.indexOf('http') == 0) 

			{

				for(var i=0; i<3; i++) { // remove everything up to the 3rd slash - this removes protocol, authority and port

					path = path.substring(path.indexOf("/") + 1);

				};

				path = "/" + path; // prepend slash

			}

			// alert("getPath: "+path);

			return path;

	};

	var setActive = function() {

		var setLevelActive = function(context, callbacks) {

			if($("> ul > li", context).size() == 0) return;

			$("> ul > li", context).each(function() {

				if(isActive($("> a", this).get(0).href)) {

					$(this).addClass("active");

					var callback = callbacks[callbacks.length - 1]; // execute callback at the top of the stack

					if(typeof callback == "function") callback(this);

					callbacks.pop(); // remove callback from the top of the stack

					setLevelActive(this, callbacks); // recursively calls itself until all levels have been processed

				}

			});

		};

		var callbacks = []; // array of callback functions starting with the lowest level (acts as a stack i.e. level 1 is at the top of the stack)

		callbacks[callbacks.length] = function(that) {}; // level 3

		callbacks[callbacks.length] = function(that) {$("> ul", that).slideDown("slow");}; // level 2

		callbacks[callbacks.length] = function(that) {$("> ul", that).slideDown("slow");}; // level 1

		setLevelActive($("#site-nav"), callbacks); // Call set active with the site nav div as the context

	};

};



// Boutiques nav initialisation

$(document).ready(function(){

	var getFiletype = function(src) {

		var filetype = src.substring(src.lastIndexOf(".")+1); // get file type

		return filetype;

	};

	var setOn = function(o) { // Function to set the "ON" nav image

		o = $(o);

		var src = $("img", o).get(0).src;

		var filetype = getFiletype(src);

		var re = new RegExp("\\."+filetype+"$", "g");

		$("img", o).get(0).src = src.replace(re, "_ON."+filetype);

	};

	var setOff = function(o) { // Function to set the "OFF" nav image

		o = $(o);

		var src = $("img", o).get(0).src;

		var filetype = getFiletype(src);

		var re = new RegExp("_ON\\."+filetype+"$", "g");

		$("img", o).get(0).src = src.replace(re, "."+filetype);

	};

	// Set active nav element

	//$("ul.boutiques a").each(function(){

	//	if(mam.nav.isActive(this.href)) $(this).addClass("active");

	});

	// Set hover functionality for all nav elements except for the "active"

	//$("ul.boutiques a").not(".active").jQIR("jpg", "/core/library/images/boutiques/");

	//$("ul.boutiques a.active").jQIR("jpg", "/core/library/images/boutiques/", true);

	//$("ul.boutiques a").not(".active").hover(function() {

	//	setOn(this);

	//}, function() {

	//	setOff(this);

	//});

//});

// Core and Utility nav initialisation

$(document).ready(function(){

	// Set active nav element

	$("#core-nav ul a").each(function(){

		if(mam.nav.isActive(this.href)) $(this).addClass("active");

	});

	$("#utility-nav ul a").each(function(){

		if(mam.nav.isActive(this.href)) $(this).addClass("active");

	});

});

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

* mam.page

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

// create the mam namespace if it does not already exist

if(mam == undefined) var mam = {};

mam.page = {

	version: "1.0",

	clearLogo: function() {

		$("#logo").html("");

	},

	clearTitle: function() {

		document.title = "";

	},

  	loadContent: function(id) {

	var path;

     path = mam.util.dom.getElementsByAttribute($("content pages page", mam.config.getSiteConfigXml()), "id", id).get(0).getAttribute("path");

	   $("#"+id).load(path, function() {

			   $("*").hover(function(){ $(this).addClass("over"); },function(){ $(this).removeClass("over"); }); // fix ie hover bug

	   });

	},

	loadQuickLinks: function() {

		//alert("load quick links...")

		$("#left-column").prepend("<div id=\"quickLinks\"></div>");

		$("#quickLinks").load(mam.util.path.getSitePath()+"/quick_links.html", function() {

			if($("#quickLinks ul li").size() > 0) { $("#quickLinks").show();}

			else {

				$("#quickLinks").hide();

			}

		});

	},

	loadStyleSheet: function() {

		var css;

		if(mam.config.getSiteConfigXml() != undefined) {

			css = $("css", mam.config.getSiteConfigXml()).text();

			// only works in FF. Need to find a way of doing this cross browser

			if(css != undefined && css != "") $("head").append('<link rel="stylesheet" type="text/css" href="'+css+'" media="all"/>'); // ff

		}

	},

	loadHeadings: function() {

		$("h1").jQIR("gif", "/core/library/images/headings/h1/");

		$("h2").jQIR("gif", "/core/library/images/headings/h2/");

		$("h3").jQIR("gif", "/core/library/images/headings/h3/");

		$("h1").jQIR("jpg", "/core/library/images/headings/h1/");

		$("h2").jQIR("jpg", "/core/library/images/headings/h2/");

		$("h3").jQIR("jpg", "/core/library/images/headings/h3/");

	},

	loadLeftColumn: function(parms) {

		var o = {};

		jQuery.extend(o, parms);

		if(o.title == undefined) {o.title = o.alt;}

		if(mam.util.env.isDefaultHost()) {

			var img = $("<img>");

			$(img).attr(

			{

				src: o.src,

				alt: o.alt,

				title:  o.title

			});

			$("#left-column").empty();

			if(o.src != undefined && o.src != "") {$("#left-column").append(img);}

		} else {

			mam.nav.load();

		}

	},

	loadPage: function(parms) {

		// alert("loadPage");

		mam.hub.pageHandler(); // do they need to go to the hub page

		var o = {

			title: ""

		};

		jQuery.extend(o, parms);

		mam.config.initialize(function(){

			mam.page.loadStyleSheet();

			$(document).ready(function(){

				mam.page.loadLeftColumn(o.leftColumnImg);

				mam.page.setTitle(o.title);

				mam.page.setLogo();

				//mam.page.loadHeadings();

				mam.link.initialize();

				//$("*").hover(function(){ $(this).addClass("over"); },function(){ $(this).removeClass("over"); }); // fix ie hover bug

			});

		},{controlXml: true,siteConfigXml: true});

	},

	setLogo: function() {

		var alt, logo, src, title;

		if(mam.config.getSiteConfigXml() != undefined) {

			this.clearLogo();

			alt = $("logo alt", mam.config.getSiteConfigXml()).text();

			src = $("logo src", mam.config.getSiteConfigXml()).text();

			title = $("logo title", mam.config.getSiteConfigXml()).text();

			$("#logo").html("<img src=\""+src+"\" alt=\""+alt+"\" title=\""+title+"\"/>");

			$("#logo img").show();

		}

	},

	setTitle: function(pageName) {

		var title;

		if(mam.config.getSiteConfigXml() != undefined) {


			//title = $("site-name", mam.config.getSiteConfigXml()).text() + " - " + pageName;
			title = "BNY Mellon Asset Management - " + pageName;

			document.title = title;

		}

	}

};

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

* mam.util

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

// create the mam namespace if it does not already exist

if(mam == undefined) var mam = {};

mam.util = {};

mam.util.version = "1.0";



// mam.util.dom

mam.util.dom = {};

mam.util.dom.filterSelect = function(values, selectElement) {

	for(var i=0; i<selectElement.options.length; i++) {

		var remove = true;

		values.each(function() {

			if(this.getAttribute("id") == selectElement.options[i].value || selectElement.options[i].value == "") remove = false; 

		});

		if(remove) {

			// alert("remove "+selectElement.options[i].value);

			selectElement.remove(i);

			i--;

		}

	};

};

mam.util.dom.getAbsoluteLeft = function(o) {

	// Get an object left position from the upper left viewport corner

	// o = document.getElementById(objectId)

	oLeft = o.offsetLeft;            // Get left position from the parent object

	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element

		oParent = o.offsetParent;    // Get parent object reference

		oLeft += oParent.offsetLeft; // Add parent left position

		o = oParent;

	}

	return oLeft;

};

mam.util.dom.getAbsoluteTop = function(o) {

	// Get an object top position from the upper left viewport corner

	// o = document.getElementById(objectId)

	oTop = o.offsetTop;            // Get top position from the parent object

	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element

		oParent = o.offsetParent;  // Get parent object reference

		oTop += oParent.offsetTop;// Add parent top position

		o = oParent;

	}

	return oTop;

};

mam.util.dom.getElementsByAttribute = function(inputElements, attributeName, attributeValue) {

	var elements = [];

	inputElements.each(function() {

		if(this.getAttribute(attributeName) == attributeValue) {

			elements[elements.length] = this;

		}

	});

	return $(elements);

};

mam.util.dom.initSelect = function(options, selectElement) {

	selectElement.options.length = 0;

	options.each(function(i) {

		selectElement.options[i] = new Option($(this).text(), this.getAttribute("id"), false, false);

	});

};



// mam.util.env

mam.util.env = new function() {

	var defaultHosts = {

		teamsite: "/iw-mount/default/main/mgi_suite/core",

		localhost: "localhost:8080",

		dev: "snsebd02.lon.mellonbank.com:30339",

		test: "mgi.test.mellon.com",

		qa: "mgi.qa.mellon.com",

		prod: "www.mellonglobalinvestments.com"

	};

	this.getCurrentHost = function() {

		var host;

		host = window.location.host;

		// alert("getCurrentHost: "+host);

		return host;

	};

	this.getCurrentHostTeamsite = function() {

		var host;

		host = window.location.pathname;

		// strip /WORKAREA and everything after

		if(host.indexOf("/WORKAREA") > -1) host = host.substring(0,host.indexOf("/WORKAREA"));

		if(host.indexOf("/STAGING") > -1) host = host.substring(0,host.indexOf("/STAGING"));

		if(host.indexOf("/EDITION") > -1) host = host.substring(0,host.indexOf("/EDITION"));

		// alert("getCurrentHost: "+host);

		return host;

	};

	this.getDefaultHost = function(env) {

		if(env == undefined) env = this.getEnv();

		//alert("getDefaultHost: "+defaultHosts[env]);

		return defaultHosts[env];

	};

	this.getEnv = function() {

		var env;

		var hostname = window.location.hostname;

		if (hostname.indexOf("localhost") > -1 || hostname.indexOf("xpwmebs110328") > -1 ) {

			env = "localhost";

		} else if (hostname.indexOf("ebd01") > -1 || hostname.indexOf("snsebd02") > -1) {

			env = "dev";

		} else if (hostname.indexOf("test.mellon") > -1 ) {

			env = "test";

		} else if (hostname.indexOf("sn84") > -1 ) {

			env = "qa";

		} else if (hostname.indexOf("qa.mellon") > -1 ) {

			env = "qa";

		} else if (hostname.indexOf("sn83") > -1 ) {

			env = "prod";

		} else {

			env = "prod";

		}

		// alert("getEnv: "+env);

		return env;

	};

	this.getEnvTeamsite = function() {

		var env = "teamsite";

		// alert("getEnvTeamsite: "+env);

		return env;

	};

	this.isDefaultHost = function(host) {

		if(host == undefined) host = this.getCurrentHost();

		for(var n in defaultHosts) {

			if(host == defaultHosts[n]) return true;

		}

		return false;

	};

	this.isTeamsite = function(hostname, port) {

		if(hostname == undefined) {

			hostname = window.location.hostname;

			port = window.location.port;

		}

		// alert("hostname: "+hostname+"\nport: "+port);

		if ((hostname.indexOf("ebd01") > -1 && port == "91") || (hostname.indexOf("sn84") > -1 ) || (hostname.indexOf("sn83") > -1 )) {

			return true;

		} else {

			return false;

		}

	};

};



// mam.util.path

mam.util.path = {};

mam.util.path.getSitePath = function() {

	var host, sitePath = "/core";

	host = mam.util.env.getCurrentHost();

	$("site", mam.config.getControlXml()).each(function() {

		var currentSitePath = $("path", this).text();

		if(mam.util.dom.getElementsByAttribute($("host", this), "name", host).size() > 0) sitePath = currentSitePath;

	});

	return sitePath;

};

mam.util.path.getSiteConfigPath = function() {

	return mam.util.path.getSitePath()+"/site-config.xml";

};

mam.util.path.getSiteNavPath = function() {

	return mam.util.path.getSitePath()+"/site-nav.html";

};

mam.util.path.getSiteImportantInfoPath = function() {

	return mam.util.path.getSitePath()+"/important_information/important_information.html";

};





// mam.util.site

mam.util.site = {};

mam.util.site.getSiteId = function() {

	var host, siteId = "default";

	host = mam.util.env.getCurrentHost();

	$("site", mam.config.getControlXml()).each(function() {

		var currentSiteId = $(this).attr("id");

		if(mam.util.dom.getElementsByAttribute($("host", this), "name", host).size() > 0) siteId = currentSiteId;

	});

	//return "mellon-uk-wholesale";

	return siteId;

};





// mam.util.url

mam.util.url = {};

mam.util.url.getPath = function() {

	return document.location.pathname;

};

mam.util.url.getPathTeamsite = function() {

	var pathname = document.location.pathname;

	// strip everything up to the end of /WORKAREA

	if(pathname.indexOf("/WORKAREA") > -1) pathname = pathname.substring(pathname.indexOf("/WORKAREA") + 9);

	if(pathname.indexOf("/STAGING") > -1) pathname = pathname.substring(pathname.indexOf("/STAGING") + 9);

	if(pathname.indexOf("/EDITION") > -1) pathname = pathname.substring(pathname.indexOf("/EDITION") + 9);



	// remove everything preceding the second / (remove the workarea name)

	pathname = pathname.substring(pathname.indexOf("/") + 1);

	pathname = pathname.substring(pathname.indexOf("/"));

	

	return pathname;

};

mam.util.url.constructURL = function(p) {

	var url;

	var parms = {

			host: "",

			pathname: document.location.pathname

	}; // defaults 

	jQuery.extend(parms, p);

	// alert("constructURL: parms.host = "+parms.host);

	if(parms.host && parms.host != "") {

		url = document.location.protocol+"//"+parms.host + parms.pathname;

	} else {

		url = parms.pathname;

	}

	// append query string

	if(parms.query != undefined && parms.query != "") url += "?"+parms.query;

	// alert("constructURL: "+url);

	return url;

};

mam.util.url.constructURLTeamsite = function(p) {

	var branch, workarea, url;

	var parms = {

			host: "",

			pathname: document.location.pathname

	}; // defaults 

	jQuery.extend(parms, p);

	if(parms.workarea == undefined)	{

		workarea = parms.host.substr(parms.host.lastIndexOf("/"));

		if(document.location.pathname.indexOf("WORKAREA/import/") > -1) workarea = "/import" // check if we are in import

	} else {

		workarea = parms.workarea;

	}

	if(parms.branch == undefined) {

		if(document.location.pathname.indexOf("WORKAREA") > -1) branch = "/WORKAREA";

		if(document.location.pathname.indexOf("STAGING") > -1) branch = "/STAGING";

		if(document.location.pathname.indexOf("EDITION") > -1) branch = "/EDITION";

	} else {

		branch = parms.branch;

	}

	// alert("constructURL: parms.host = "+parms.host);

	if(parms.host && parms.host != "") {

		url = parms.host + branch + workarea + parms.pathname;

	} else {

		url = parms.pathname;

	}

	// append query string

	if(parms.query != undefined && parms.query != "") url += "?"+parms.query;

	// alert("constructURL: "+url);

	return url;

};

mam.util.url.forward = function(parms) {

	if(!parms) {

		parms = {

			url: document.location.href,

			preserveHistory: false,

			test: false

		}

	}

	if(parms.test) return parms.url;

	if(parms.preserveHistory) {

		document.location.href = parms.url;

	} else {

		document.location.replace(parms.url);

	}

};



// inject teamsite methods if the environment is teamsite

if(mam.util.env.isTeamsite()) {

	mam.util.url.getPath = mam.util.url.getPathTeamsite; // inject teamsite version of getPath method

	mam.util.url.constructURL = mam.util.url.constructURLTeamsite; // inject teamsite version of constructURL method

	mam.util.env.getCurrentHost = mam.util.env.getCurrentHostTeamsite; // inject teamsite version of getCurrentHost method

	mam.util.env.getEnv = mam.util.env.getEnvTeamsite; // inject teamsite version of getEnv method

};


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

* Login clear fields code

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


 $(document).ready(function () {

$("#username").click(function(){
	
	this.value = ""
})

$("#password").focus(function(){
	
	this.value = ""
	
	//this.type = "password";
	
})
});



<!--
//This credit must stay intact
//Script by http://www.java-Scripts.net and http://wsabstract.com
 //function doClear(theText) {
   //  if (theText.value == theText.defaultValue) {
   //      theText.type = "password"
//     }
 //}
//-->



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

* Pop Up Code

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



function forwardPage(newLoc,type) {

  if ( type == "popup" ) {

	var w = 450 ; var h = 420 ;

	var winprops = "toolbar=no,width=" + w +",height=" + h +

	",directories=no,status=no,scrollbars=yes,resize=yes,menubar=no";

	var winl = (screen.width - w) / 2;

	var wint = (screen.height - h) / 2;

	winprops = winprops + ",top=" + wint + ",left= " + winl ;

	var newWin = window.open(newLoc,"myWin", winprops)                  	

  } else if ( type == "new" ){

	var newWin = window.open(newLoc,"myWin2")

  } else {

   if (parseInt(navigator.appVersion) >= 3) {

    if (type == "parent") {

      parent.location.replace(newLoc);

    } else if (type == "opener") {

      opener.location.replace(newLoc);

    } else {

      location.href = newLoc;

      location.replace(newLoc);

    }

   } else {

    if (type == "parent") {

      parent.location.href = newLoc;

    } else if (type == "opener") {

      opener.location.href = newLoc;

    } else {

      location.href = newLoc;

    }

   }

  }

}

/*******************************************************************************
* mam.popups
*******************************************************************************/
mam.popups = {};
mam.popups.pdflink = function() {
	var linkURL = $(this).attr('href');
	var ext = linkURL.replace(/.*\.(.*)$/, "$1");
	var bnymellon = (linkURL.indexOf("bnymellon"));
	var dreyfus = (linkURL.indexOf("dreyfus"));
	var standish = (linkURL.indexOf("standish"));
	if((ext == 'pdf' || ext == 'doc') && ( bnymellon == -1 && dreyfus == -1 && standish == -1) ) {
		window.open(linkURL);
		return false;
	}	
};
$("document").ready(function(){
	$(".popup").click(function(){
		var theWindow = window.open(this.href);
		theWindow.focus();
		return false;
	});
	
	$("a").click(mam.popups.pdflink);


});


/*******************************************************************************
* Footer Popup
*******************************************************************************/

    $(document).ready(function(){
        $(".footerpopup").click(function(){
            forwardPage(this.href,'popup');
			return false;
        });
        $(".footerpopup").focus(function(){
            
        });
    });

	//$("ul#ticker02").liScroll({travelocity: 0.15}); 
	
/*******************************************************************************
* Core Nav Menu
*******************************************************************************/
	
$(document).ready(function(){
		$('#core-nav ul li').hover(
			function() { $('ul', this).css('display', 'block'); },
			function() { $('ul', this).css('display', 'none'); });
			
	});
	
$(document).ready(function(){
$("#core-nav *").hover(function(){ $(this).addClass("over"); },
function(){ $(this).removeClass("over");}) 
});

/*******************************************************************************
* Core Sub Nav Menu
*******************************************************************************/
	
$(document).ready(function(){

$(document).ready(function(){
$("#core-nav-sublevel ul li").click(function(){ $(this).addClass("active"); },
function(){ $(this).removeClass("active");}) 
});

$(document).ready(function(){
$("#core-nav-sublevel ul li").click(function(){ $(this).addClass("over"); },
function(){ $(this).removeClass("over");}) 
});

});

/*******************************************************************************
* Core Sub Nav Menu
*******************************************************************************/
	
$(document).ready(function(){

$(document).ready(function(){
$("#core-nav ul li").click(function(){ $(this).addClass("active"); },
function(){ $(this).removeClass("active");}) 
});

$(document).ready(function(){
$("#core-nav ul li").click(function(){ $(this).addClass("over"); },
function(){ $(this).removeClass("over");}) 
});

});


/*******************************************************************************
* Core Nav - Sub Level Menu
*******************************************************************************/

$(document).ready(function(){
	$("#core-nav-sublevel ul li a").each(function(){

		if(mam.nav.isActive(this.href)) $(this).addClass("active");

	});
});



/*******************************************************************************
* Site Nav Menu
*******************************************************************************/

$(document).ready(function(){
$("#site-nav ul li").click(function(){ $(this).addClass("active"); },
function(){ $(this).removeClass("active");}) 
});

$(document).ready(function(){
$("#site-nav ul li").click(function(){ $(this).addClass("over"); },
function(){ $(this).removeClass("over");}) 
});

$(document).ready(function(){
	
	var pageID = $('body').attr('id');
	var uniquePageID
	
	uniquePageID =$("#site-nav ul li",this).attr('id'); 
 
    $("#site-nav ul li ul").hide();
	 $("#"+uniquePageID+" ul li",this).each(function (i) {
       $(this).addClass(uniquePageID);
	   $(this).show();
      });

});

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

* Search clear fields code

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


 $(document).ready(function () {

$("#search-criteria").click(function(){
	
	this.value = ""
})

});

/***********************2nd Nav****************************/
$(document).ready(function(){
	
	
	
	var subPageClass = $('body').attr('class');
	var subUniqueLiID = "#" + $("#core-nav-sublevel ul li."+subPageClass).attr('id');
	var subUniqueLiID2 = $("#core-nav-sublevel ul li."+subPageClass).attr('id');
	
	$("#core-nav-sublevel>ul>li",this).each(function (i) {
	   if ( this.id == subUniqueLiID2 ) {
	   	    $("#core-nav-sublevel").show();
		   	$(this).show();
			$(this).find('ul').show();
	   }
	   else {
	   		$(this).hide();
	   }
    });
});


/***********************SCROLLER CODE****************************/
$("document").ready(function(){
	$("#ticker02 li").show();
	$("#ticker02").liScroll({travelocity: 0.05, autoScrollDirection: "endlessloop"});
	
});
/****************************************************************/



/******************************************/
/***************TOOL TIP*******************/

this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("img.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("img.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


/******************************************/
// starting the script on page load
$(document).ready(function(){
	tooltip();
});
/******************************************/

/***************TOOL TIP*******************/

this.tooltip_small = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("img.tooltip_small").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip_small'>"+ this.t +"</p>");
		$("#tooltip_small")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("img.tooltip_small").mousemove(function(e){
		$("#tooltip_small")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


/******************************************/
// starting the script on page load
$(document).ready(function(){
	tooltip_small();
});
/******************************************/


// requires mam.core.js
if(mam.hub == undefined)
{
mam.hub = new function() {
	var that = this;
	// Public Methods
	jQuery.extend(this,  {
		version: "1.0",
		config: mam.config,
		indexHandler: function() {
			if(!mam.util.env.isDefaultHost()) {
				forwardToHomePage();
			} else {
				if(loadCookie()) {
					mam.config.initialize(function() {
						forwardToHomePage({host: getSiteHost()});
					}, {
						controlXml: true,
						siteSelectorXml: false
					});
				} else {
					forwardToHub();
				}
			}
		},
		hubHandler: function() {
			if(!mam.util.env.isDefaultHost()) {
				forwardToHub();
			} else {
				mam.page.loadPage({
					title: "Hub",
					leftColumnImg: {
						src: "/core/library/images/left_column/hand_clap.jpg",
						alt: "Hand Clap"
					}
				});
				mam.config.initialize(function() {
					$(document).ready(function() {
						buildSiteSelector();
					});
				}, {controlXml: true,siteConfigXml: true});
			}
		},
		pageHandler: function() {
			// get location and investor type from query string if present and store in a cookie
			// alert(window.location.search);
			var query = window.location.search.substring(1);
			// alert("query: "+query);
			var pArray = query.split("&");
			var queryParms = {};
			// alert("parameters length:"+ parameters.length);
			$.each(pArray, function(i,n){
				var pos = n.indexOf('=');
				if (pos > 0) {
					var key = n.substring(0,pos);
					var val = n.substring(pos+1);
					queryParms[key] = val;
				}
			});
			if(queryParms.location != undefined) {
				location = queryParms.location;
				clientType = queryParms.investorType;
				remember = queryParms.remember; // makes it work in TeamSite
				storeCookie();
				forwardToHomePage({host: getSiteHost(), query: ""}); // we have stored the location and investor type info now so forward to home page without the query string.
			}
			
			var excludedPage = false;
			var includedPage = false;
			var path = mam.util.url.getPath();
			var excludedPagesRegex = [
				".*"
			];
			var includedPagesRegex = [
				"/notcore/home/home.html"
			];
			$.each(excludedPagesRegex, function(i,n){
				var re = new RegExp(n);
				if(re.test(path)) excludedPage = true;
			});
			$.each(includedPagesRegex, function(i,n){
				var re = new RegExp(n);
				if(re.test(path)) includedPage = true;
			});
			// alert("excludedPage:"+excludedPage+", includedPage:"+includedPage);
			// alert(importantInfoConfirmed());
			if(!excludedPage || includedPage) { // allow navigation to excluded pages without visiting the hub. Inclusions override exclusions
				if(!importantInfoConfirmed()) {
					// alert("forward to important info");
					forwardToImportantInfo();
				}
			}
			
			// Call core page handler
			var callCorePageHandler = false;
			var regex = [
				"/core/mellons_boutiques/.*",
				"/core/specialist_asset_managers/.*"
			];
			$.each(regex, function(i,n){
				var re = new RegExp(n);
				if(re.test(path)) callCorePageHandler = true;
			});
			if(callCorePageHandler) mam.hub.corePageHandler();

		},
		importantInfoHandler: function() {
				// alert("importantInfoHandler...");
				$(document).ready(function() {
						// load investor type specific text
						if(loadCookie()) {
							var investorTypeText = {
								individual: "am an individual investor",
								institutional: "am an institutional investor",
								wholesale: "am a private bank, advisor or distributor"
							};
							if(investorTypeText[clientType] != undefined && investorTypeText[clientType] != "") $("#investor-type-specfic").html(investorTypeText[clientType]);
						} else {
							// Do nothing
						}

						if(loadImportantInfoCookie()) {
							$("#importantInformationCheckbox").get(0).checked = importantInformation.confirmed;
						}
						$("#go-button").click(function(){
								$(".formError").remove(); // clear errors
								// alert("go");
								if($("#importantInformationCheckbox").get(0).checked) {
									importantInformation.confirmed = true;
									storeImportantInfoCookie();
									// alert("forward to home");
									forwardToHomePage();
								} else {
									clearImportantInfoCookie();
									$("fieldset.importantInformation").append('<p class="formError">You must agree to the terms and conditions.</p>')
								}
								return false;
						});
				});
			// load site specifc Important Infomation
				mam.config.initialize(function() {
					$(document).ready(function() {
						// alert(mam.util.path.getSiteImportantInfoPath());
						$("#site-specific-important-info").load(mam.util.path.getSiteImportantInfoPath());
					});
				}, {controlXml: true});
		},
		corePageHandler: function() {
			// alert("1");
			if(!loadCookie() && mam.util.env.isDefaultHost()) { // Show site selector if visitor has not already chosen a site.
				mam.config.initialize(function() {
					$(document).ready(function() {
						buildSiteSelector();
					});
				}, {
					controlXml: true,
					siteConfigXml: true,
					siteSelectorXml: false
				});
			}
		}
	});
	var siteSelectorPath = "/core/hub/hub.html";
	var homePagePath = "/core/home/home.html";
	var investorTypes = {
			individual: {
				name: "Individual Investors",
				value: "individual",
				description: "Individual Investors - Information on funds suitable for direct investment by private individuals, including individual savings accounts (ISAs).",
				locations: {
					empty: {name: "Please choose your location", value: ""},
					austria: {name: "Austria", value: "austria", site: "mellon-international-retail"},
					brazil: {name: "Brazil", value: "brazil", site: "mellon-international-retail"},
					chile: {name: "Chile", value: "chile", site: "mellon-international-retail"},
					china: {name: "China", value: "china", site: "mellon-international-retail"},
					dubai: {name: "Dubai", value: "dubai", site: "mellon-international-retail"},
					france: {name: "France", value: "france", site: "mellon-international-retail"},
					germany: {name: "Germany", value: "germany", site: "west-lb"},
					hongKong: {name: "Hong Kong", value: "hongKong", site: "mellon-international-retail"},
					ireland: {name: "Ireland", value: "ireland", site: "mellon-uk-retail"},
					italy: {name: "Italy", value: "italy", site: "mellon-international-retail-italian"},
					japan: {name: "Japan", value: "japan", site: "mellon-japan"},
					portugal: {name: "Portugal", value: "portugal", site: "mellon-international-retail"},
					spain: {name: "Spain", value: "spain", site: "mellon-international-retail-spain"},
					switzerland: {name: "Switzerland", value: "switzerland", site: "mellon-international-retail"},
					netherlands: {name: "Netherlands", value: "netherlands", site: "mellon-international-retail"},
					oman: {name: "Oman", value: "oman", site: "mellon-international-retail"},
					otherContinentalEurope: {name: "Other Continental Europe", value: "otherContinentalEurope", site: "mellon-international-retail"},
					otherFarEast: {name: "Other Far East", value: "otherFarEast", site: "mellon-international-retail"},
					otherLatinAmerica: {name: "Other Latin America", value: "otherLatinAmerica", site: "mellon-international-retail"},
					otherMiddleEast: {name: "Other Middle East", value: "otherMiddleEast", site: "mellon-international-retail"},
					qatar: {name: "Qatar", value: "qatar", site: "mellon-international-retail"},
					saudiArabia: {name: "Saudi Arabia", value: "saudiArabia", site: "mellon-international-retail"},
					uae: {name: "UAE", value: "uae", site: "mellon-international-retail"},
					uk: {name: "United Kingdom", value: "uk", site: "newton"}
				}
			},
			institutional: {
				name: "Institutional Services",
				value: "institutional",
				description: "Institutional Services - This site provides information on investment strategies suitable for institutional investors, such as pension funds, global corporations, investment & pension consultants, insurance companies and endowment plans.",
				locations: {
					empty: {name: "Please choose your location", value: ""},
					australia: {name: "Australia", value: "australia", site:"mellon-australia"},
					canada: {name: "Canada", value: "canada", site:"mam"},
					germany: {name: "Germany", value: "germany", site:"west-lb"},
					japan: {name: "Japan", value: "japan", site:"mellon-japan"},
					other: {name: "Other", value: "other", site:"mellon-institutional"},
					uk: {name: "United Kingdom", value: "uk", site:"mellon-institutional"},
					us: {name: "United States", value: "us", site:"mam"}
				}
			},
			wholesale: {
				name: "Private Banks, Advisors & Distributors",
				value: "wholesale",
				description: "Private Banks, Advisors & Distributors - This site provides information on offshore funds registered for distribution throughout the world for private banks, family offices, advisors and distributors.",
				locations: {
					empty: {name: "Please choose your location", value: ""},
					austria: {name: "Austria", value: "austria", site: "mellon-international-wholesale"},
					brazil: {name: "Brazil", value: "brazil", site: "mellon-international-wholesale"},
					chile: {name: "Chile", value: "chile", site: "mellon-international-wholesale"},
					china: {name: "China", value: "china", site: "mellon-international-wholesale"},
					dubai: {name: "Dubai", value: "dubai", site: "mellon-international-wholesale"},
					france: {name: "France", value: "france", site: "mellon-international-wholesale"},
					germany: {name: "Germany", value: "germany", site: "west-lb"},
					hongKong: {name: "Hong Kong", value: "hongKong", site: "mellon-international-wholesale"},
					ireland: {name: "Ireland", value: "ireland", site: "mellon-uk-wholesale"},
					italy: {name: "Italy", value: "italy", site: "mellon-international-wholesale-italian"},
					japan: {name: "Japan", value: "japan", site: "mellon-international-wholesale"},
					portugal: {name: "Portugal", value: "portugal", site: "mellon-international-wholesale"},
					spain: {name: "Spain", value: "spain", site: "mellon-international-wholesale-spain"},
					switzerland: {name: "Switzerland", value: "switzerland", site: "mellon-international-wholesale"},
					netherlands: {name: "Netherlands", value: "netherlands", site: "mellon-international-wholesale"},
					oman: {name: "Oman", value: "oman", site: "mellon-international-wholesale"},
					otherContinentalEurope: {name: "Other Continental Europe", value: "otherContinentalEurope", site: "mellon-international-wholesale"},
					otherFarEast: {name: "Other Far East", value: "otherFarEast", site: "mellon-international-wholesale"},
					otherLatinAmerica: {name: "Other Latin America", value: "otherLatinAmerica", site: "mellon-international-wholesale"},
					otherMiddleEast: {name: "Other Middle East", value: "otherMiddleEast", site: "mellon-international-wholesale"},
					qatar: {name: "Qatar", value: "qatar", site: "mellon-international-wholesale"},
					saudiArabia: {name: "Saudi Arabia", value: "saudiArabia", site: "mellon-international-wholesale"},
					uae: {name: "UAE", value: "uae", site: "mellon-international-wholesale"},
					uk: {name: "United Kingdom", value: "uk", site: "mellon-uk-wholesale"}
				}
			}
		};

	var location = "";
	var clientType = "";
	var remember = "";
	var cookieExists = {};
	var importantInformation = {};
	importantInformation.confirmed = false;
	var importantInfoConfirmed = function() {
		// alert("cookie: "+loadImportantInfoCookie()+", confirmed: "+importantInformation.confirmed);
		return (loadImportantInfoCookie() && importantInformation.confirmed);
	};
	
	// Private Methods
	var getSite = function() {
		var site = investorTypes[clientType].locations[location].site;
		// alert("getSite: "+site);
		if(site != undefined && site != "") {
			return site;
		} else { // no match return default
			return "default";
		}
	};
	var clearCookie = function() {
		var cookie = new Cookie(document, "hub", 0 , "/", null, false);
		cookie.remove();
	};
	var forwardToHub = function(p) {
		var parms = {
				host: mam.util.env.getDefaultHost(),
				preserveHistory: false,
				test: false,
				pathname: siteSelectorPath
		}; // defaults 
		jQuery.extend(parms, p);
		forwardToPage(parms);
	};
	var forwardToImportantInfo = function(p) {
		var parms = {
				host: "",
				preserveHistory: false,
				test: false,
				pathname: "/core/important_information/important_information.html"
		}; // defaults 
		jQuery.extend(parms, p);
		forwardToPage(parms);
	};
	var forwardToHomePage = function(p) {
		var parms = {
				host: "",
				preserveHistory: false,
				test: false,
				pathname: homePagePath
		}; // defaults 
		jQuery.extend(parms, p);
		forwardToPage(parms);
	};
	var forwardToPage = function(p) {
		var url;
		var parms = {
				host: "",
				preserveHistory: false,
				test: false,
				pathname: "default.html"
		}; // defaults 
		jQuery.extend(parms, p);
		// alert("forwardToHomePage: host: "+parms.host+"\npreserveHistory: "+parms.preserveHistory+"\ntest: "+parms.test);
		url = mam.util.url.constructURL({
			host: parms.host,
			pathname: parms.pathname,
			query: parms.query
		});
		// url += this.homePagePath;
		mam.util.url.forward({
			url: url,
			preserveHistory: parms.preserveHistory,
			test: parms.test
		});
	};
	var getSiteHost = function(site) {
		var host, siteElements, hostElements;
		if(mam.config.getControlXml() != undefined) {
			if(site == undefined) site = getSite();
			// alert("method: getSiteHost\n\nsite: "+site+"\n\nenv: "+mam.util.getEnvName()+"\n\nlocation: "+this.location+"\n\nclientType: "+this.clientType);
			siteElements = mam.util.dom.getElementsByAttribute($("site", mam.config.getControlXml()), "id", site);
			if(siteElements.size() == 0) {site = "default";} // if site not found, try default
			siteElements = mam.util.dom.getElementsByAttribute($("site", mam.config.getControlXml()), "id", site);
			hostElements = mam.util.dom.getElementsByAttribute($("host", siteElements), "env", mam.util.env.getEnv());
			var host = hostElements.get(0).getAttribute("name");
		} else {
			host = "";
		}
		// alert("getSiteHost: "+host);
		return host;
	};
	var loadCookie = function() {
		var cookie = new Cookie(document, "hub", 8760 , "/", null, false);
		if(cookie.load()) {
			cookieExists.hub = true;
			location = cookie.location;
			clientType = cookie.clientType;
			remember = cookie.remember;
		} else {
			cookieExists.hub = false;
		}
		// alert("loadCookie: "+cookieExists.hub);
		return cookieExists.hub;
	};
	var storeCookie = function() {
		var cookie = new Cookie(document, "hub", 8760 , "/", null, false);
		cookie.location = location;
		cookie.clientType = clientType;
		cookie.remember = remember;
		cookie.store();
	};
	var loadImportantInfoCookie = function() {
		var cookie = new Cookie(document, "importantInfo", 8760 , "/", null, false);
		if(cookie.load()) {
			cookieExists.importantInfo = true;
			importantInformation.confirmed = cookie.confirmed;
			// alert(importantInformation.confirmed);
		} else {
			cookieExists.importantInfo = false;
		}
		return cookieExists.importantInfo;
	};
	var storeImportantInfoCookie = function() {
		var cookie = new Cookie(document, "importantInfo", 8760 , "/", null, false);
		cookie.confirmed = importantInformation.confirmed;
		cookie.store();
	};
	var clearImportantInfoCookie = function() {
		var cookie = new Cookie(document, "importantInfo", 0 , "/", null, false);
		cookie.remove();
	};
	var setLocation = function(p_location) {
		location = p_location;
	};
	var setClientType = function(p_clientType) {
		clientType = p_clientType;
	};
	var setRemember = function(p_remember) {
		remember = p_remember;
	};
	var go = function() {
		setLocation($("#location").val());
		setClientType($("input[@name=investorType][@checked]").val());
		setRemember($("#remember").get(0).checked);
		// alert(clientType+":"+location);
		// alert(investorTypes[clientType].locations[location].site);
		if(remember) storeCookie(); else clearCookie();
		forwardToHomePage({host: getSiteHost(), preserveHistory: true, query: "location="+location+"&investorType="+clientType+"&remember="+remember});
		return true;
	};
	var buildSiteSelector = function() {
		//alert("Building site selector...");
		if($("div.siteSelector").size() == 0) $("#main-content").append("<div class=\"siteSelector\"></div>");
		$("div.siteSelector").each(function(){
				$(this).append("<p><strong>To help us direct you to the most appropriate information, please select your investor type and your country or region from the following options:</strong></p>");
				$(this).append('<fieldset class="siteSelectorForm"></fieldset>');
				$.each(investorTypes, function(i, n) {
						$(".siteSelectorForm").append('<div><label for="'+n.value+'" id="'+n.value+'Label" title="'+n.description+'"">'+n.name+'</label><input name="investorType" id="'+n.value+'" type="radio" value="'+n.value+'" title="'+n.description+'"/></div>');
					$("#"+n.value).validate({type:"blur", validation:"notnull", store: true});
					$("#"+n.value).click(function() {selectInvetorType(n);});
					
				});
				$(this).append('<input id="go-button" type="image" src="/core/library/images/go.gif" value="Go" />');
				$(this).append('<p class="preferences"><input id="remember" type="checkbox"/>&nbsp;<strong>Remember my preferences</strong><br/>(only available if your browser has cookies enabled)</p>');
				$("input:radio").addClass("radio");

				$('#go-button').validate({type:'click', checkAll: true, fail: function() {alert("fail")}, success: function() {go();} });
				initValues(investorTypes);
				$(".siteSelectorForm input, .siteSelectorForm label").Tooltip({delay: 0, fixPNG: true, track: true, showBody: " - "});
				$("#tooltip").bgiframe();
		});
		$("div.siteSelector").show();
	};
	var selectInvetorType = function(investorType) {
		setLocation($("#location").val());
		setClientType($("input[@name=investorType][@checked]").val());
		buildLocations(investorType);
	};
	var initValues = function(investorTypes) {
		loadCookie();
		// alert(loadCookie());
		if(clientType != "") buildLocations(investorTypes[clientType]);
		$("#"+clientType).each(function(){this.checked = true;});
		$("#location").each(function(){this.value = location;});
		$("#remember").each(function(){this.checked = remember;});
	};
	var initLocationValue = function() {
		$("#investorType").each(function(){this.value = clientType;});
	};
	var buildLocations = function(investorType) {
		$("#location").each(function(){this.options.length = 0});
		if($("#location").size() == 0) $(".siteSelectorForm").append('<select id="location"></select>');
		var i = 0;
		$.each(investorType.locations, function(key, o) {
			var selected = false;
			if(o.value == location) selected = true;
			$("#location").get(0).options[i] = new Option(o.name, o.value, false, selected);
			i++;
		});
		mam.validator.clear();
		$('#location').validate({type:'blur', validation:'notnull', store: true});
	};
};
}
mam.link = new function() {
	jQuery.extend(
		this, { 
			version: "1.0",
			initialize: function() {		
				$("a").click(							
					function() {
						var host = 'http://' + window.location.host;
						var link = $(this).attr('href');
						var original_link = escape(link);
						if(link.indexOf(host) == 0) {
							link = link.substring(host.length);
						}

						if (link.indexOf('http://www.bnymellonam.com/core/specialist_asset_managers/ankura/ankura.html') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/external_ankura.html?url=' + original_link, 'external');
							return false;
						}
						
						else if (link.indexOf('http://www.bnymellonam.com/core/specialist_asset_managers/insight/insight.html') == 0 ) {
													var person = link.substring(7);
													window.open('/core/misc/external_insight.html?url=' + original_link, 'external');
													return false;
						}
						
						else if (link.indexOf('http://www.bnymellon.com/careers/index.html') == 0 ) {
							var person = link.substring(7);
							window.open('/core/misc/external_careers.html?url=' + original_link, 'external');
							return false;
						}
						
						else if (link.indexOf('/core/investment_managers_and_distribution/bny_mellon_beta_management/bny_mellon_beta_management.html') == 0 ) {
							location.href = '/core/investment_managers_and_distribution/bny_mellon_beta_management/bny_mellon_beta_management.html';
							return false;								
						}



						else if (link.indexOf('http://www.bnymellon.com/about/corporatesocialresponsibility.html') == 0 ) {
							var person = link.substring(7);
							window.open('/core/misc/external_community.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellon.com/products/assetservicing/index.html')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_TBNYMB.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellon.com/products/wealthmanagement/index.html')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_TBNYMB.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellon.com/products/advisorservices/index.html')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_TBNYMB.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellon.com/products/issuerservices/index.html')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_TBNYMB.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellon.com/products/treasuryservices/index.html')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_TBNYMB.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellon.com') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/external_bnymellon.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellonam.com/core/hub/hub.html') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/external_AMI.html?url=' + original_link, 'external');
							return false;
						}
						
						else if (link.indexOf('http://us.bnymellonam.com') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/normal_redirect.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellon.com/about/corporatesocialresponsibility.html/')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_community.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellon.com/products/assetservicing/index.html')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_TBNYMB.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.newton.co.uk/core/resources/responsible_investment/responsible_investment.html')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_MTM.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.mellon.com/transitionmanagementservices/') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/external_MTM.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.mellonretirement.com')==0) {
							var person = link.substring(7);
							window.open('/core/misc/external_MTM.html?url=' + original_link, 'external');
							return false;
						}

						else if (link.indexOf('http://www.bnymellonam.com/core/specialist_asset_managers/ankura/ankura.html') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/external_disclaimer_ankura.html?url=' + original_link, 'external');
							return false;
						}
						else if (link.indexOf('http://www.bnymellonam.com/core/specialist_asset_managers/mgai/mgai.html') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/external_disclaimer_mgai.html?url=' + original_link, 'external');
							return false;
							}
							
						else if (link.indexOf('http://www.bnymellonam.com/core/specialist_asset_managers/west_lb_mellon/west_lb_mellon.html') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/external_disclaimer_west_lb_mellon.html?url=' + original_link, 'external');
							return false;
							}

						else if (link.indexOf('http://www.bnymellonam.com') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/external_disclaimer_bnymellonam.html?url=' + original_link, 'external');
							return false;
							}

						else if (link.indexOf('http://www.blackfriarsassetmanagement.com') == 0) {
						var person = link.substring(7);
						window.open('/core/misc/external_blackfriars_asset_management.html?url=' + original_link, 'external');
						return false;
						}

						else if (link.indexOf('http://www.hamon.com.hk/') == 0) {
						var person = link.substring(7);
						window.open('/core/misc/external_hamon.html?url=' + original_link, 'external');
						return false;
						}

						else if (link.indexOf('http://www.bnymellonarx.com.br/Pages/Default.aspx?culture=en-us') == 0) {
						var person = link.substring(7);
						window.open('/core/misc/external_bnymellonarx.html?url=' + original_link, 'external');
						return false;
						}
							else if (link.indexOf('http://www.fourseasons.com/boston') == 0) {
							var person = link.substring(7);
							window.open('/core/misc/normal_redirect.html?url=' + original_link, 'external');
							return false;
						}


						else if (link.indexOf('http://') == 0) {
								window.open('/core/misc/external.html?url=' + original_link, 'external');
								return false;
								}
								
					
						return true;
					}
				);
			}	
		}
	);
};$(document).ready(function(){
	$(".toggleButton").click(function(){
		$(this).parents().map(function () {
			  
			if (this.className == "content") {
				
				if ($(this).find(".description").css("display")== "none") {
					
				$(this).find(".description").css({'display': 'block'}).slideDown("slow");	
				$(this).find(".summary").css({'display': 'none'});
				
				}
				else {
					
				$(this).find(".description").css({'display': 'none'}).slideUp('200000');
				$(this).find(".summary").css({'display': 'block'});
					
					
				}
				
				
				
				
				
				}
				 

		});
	});
});	


/********************************************New JS Begins Here************************************************/
$(document).ready(function(){

	//$(".summary1 h3").addClass("active");
	$(".summary1 div").hide();
	$(".summary1 ul").hide();


	$(".summary1 h3").click(function(){
	
		$(this).next("div").slideToggle("slow")
		.siblings("div:visible").slideUp("slow");
		$(".summary1 p").show();
		$(".summary1 table").show();
		
		
		//$(this).next("ul").slideToggle("slow")
		
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});

});
/********************************************New JS Ends Here************************************************/