/*** gantry-articledetails-mt1.2.js ***/

/**
 * @package		Gantry Template Framework - RocketTheme
 * @version		1.5.5 November 15, 2010
 * @author		RocketTheme http://www.rockettheme.com
 * @copyright 	Copyright (C) 2007 - 2010 RocketTheme, LLC
 * @license		http://www.rockettheme.com/legal/license.php RocketTheme Proprietary Use License
 */

eval(function(p,a,c,k,e,r){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--)r[e(c)]=k[c]||e(c);k=[function(e){return r[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}('3 7={n:4(){3 a=7;a.6=$$(\'.M-L .l-J\');a.f=a.6.H().G(\'.F-E\');a.D=[];a.j()},j:4(){3 e=7;e.6.B(4(a,i){z(e.f[i]){3 b=v u(\'t\',{\'s\':\'l-p\'}).q(\'r\',\'<o>6</o>\').w(a);b.A(e.f[i],\'8\');3 c=b.k(),g=a.k();3 d=-(g.y),h=-(g.x/2-c.x/2);a.C({\'8\':d,\'h\':h,\'9\':0});b.I({\'K\':4(){a.m({\'8\':d-5,\'9\':1})},\'N\':4(){a.m({\'8\':d,\'9\':0})}})}})}};O.P(\'Q\',7.n);',53,53,'|||var|function||infos|GantryArticleDetails|top|opacity||||||titles|iSize|left||makeButtons|getSize|rt|morph|init|span|infobutton|set|html|class|div|Element|new|adopt|||if|inject|each|setStyles|buttons|title|module|getElement|getParent|addEvents|articleinfo|mouseenter|layout3|details|mouseleave|window|addEvent|domready'.split('|'),0,{}))

/*** gantry-morearticles.js ***/

/**
 * @version		3.2.13 December 1, 2011
 * @author		RocketTheme http://www.rockettheme.com
 * @copyright 	Copyright (C) 2007 - 2011 RocketTheme, LLC
 * @license		http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */

var GantryMoreArticles=new Class({Implements:[Options],options:{leadings:2,moreText:"more articles",url:""},initialize:function(a){this.setOptions(a);this.wrapper=document.getElement(".rt-teaser-articles")||document.getElement(".rt-leading-articles");if(!this.wrapper){return;}this.start=this.options.leadings;this.buildButton();this.ajax=new Request({url:this.options.url,method:"get",onRequest:function(){this.button.addClass("spinner");}.bind(this),onSuccess:this.handle.bind(this)});},buildButton:function(){this.button=new Element("a",{id:"more-articles",href:"#"}).adopt(new Element("span").set("text",this.options.moreText));var a=new Element("div",{"class":"rt-more-articles"}).inject(this.wrapper,"after");this.button.inject(a).addEvent("click",function(b){b.stop();if(this.button.hasClass("disabled")){return;}this.ajax.get({limitstart:this.start});}.bind(this));},handle:function(b){this.start+=this.options.leadings;this.button.removeClass("spinner");var d=new Element("div").set("html",b);var a=d.getElements(".rt-article");if(!a.length){this.button.removeEvent("click");this.button.addClass("disabled");}else{if(a.length<this.options.leadings){this.button.removeEvent("click");this.button.addClass("disabled");}a.inject(this.wrapper);if(typeof GantryBuildSpans=="function"){var c=["rt-block"];var e=["h3","h2","h1"];GantryBuildSpans(c,e);}if(typeof GantryArticleDetails!="undefined"){GantryArticleDetails.init();}}if(typeof rokbox!="undefined"&&rokbox.refresh){rokbox.refresh();}}});
;

/*** gantry-smartload.js ***/

/**
 * @version		3.2.13 December 1, 2011
 * @author		RocketTheme http://www.rockettheme.com
 * @copyright 	Copyright (C) 2007 - 2011 RocketTheme, LLC
 * @license		http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */

var GantrySmartLoad=new Class({Implements:[Events,Options],options:{placeholder:"blank.gif",container:window,cssrule:"img",offset:{x:200,y:200},exclusion:[]},initialize:function(b){this.setOptions(b);this.container=document.id(this.options.container);this.images=$$(this.options.cssrule);this.dimensions={size:this.container.getSize(),scroll:this.container.getScroll(),scrollSize:this.container.getScrollSize()};var c=this.options.exclusion[0].split(",");if(c.length&&(c.length!=1&&c[0]!="")){c.each(function(e){var d=$$(e+" "+this.options.cssrule);d.each(function(f){this.images.erase(f);},this);},this);}this.init=0;this.storage=new Hash({});this.images.each(function(d,f){if(typeof d=="undefined"){return;}if(!d.get("width")&&!d.get("height")){this.storage.erase(d.get("smartload"));this.images.erase(d);return;}var e=d.getSize();if(d.getProperty("width")){e.x=d.getProperty("width");e.y=d.getProperty("height");}if(!d.getProperty("width")&&e.x&&e.y){d.setProperty("width",e.x).setProperty("height",e.y);}d.setProperty("smartload",f);this.storage.set(f,{src:d.src,width:e.x,height:e.y,fx:new Fx.Tween(d,{duration:250,transition:Fx.Transitions.Sine.easeIn})});if(!this.checkPosition(d)){d.setProperty("src",this.options.placeholder).addClass("spinner");}else{this.storage.erase(d.getProperty("smartload"));this.images.erase(d);}},this);if(this.images.length){document.id(this.container).addEvent("scroll",this.scrolling.bind(this));}var a=this.container;},checkPosition:function(b){var a=b.getPosition(),d=this.options.offset;var c={size:this.container.getSize(),scroll:this.container.getScroll(),scrollSize:this.container.getScrollSize()};return((a.y>=c.scroll.y-d.y)&&(a.y<=c.scroll.y+this.dimensions.size.y+d.y));},scrolling:function(b){var a=this;if(!this.images||!this.init){this.init=1;return;}this.images.each(function(c){if(typeof c=="undefined"){return;}if(this.checkPosition(c)&&this.storage.get(c.getProperty("smartload"))){var d=this.storage.get(c.getProperty("smartload"));new Asset.image(d.src,{onload:function(){var e={width:d.width,height:d.height};if(e.width&&!e.height){e.height=e.width;}if(!e.width&&e.height){e.width=e.height;}if(!e.width&&!e.height){e.width=this.width;e.height=this.height;}if(e.width!=this.width&&e.height==this.height){e.width=this.width;}else{if(e.width==this.width&&e.height!=this.height){e.height=this.height;}}d.fx.start("opacity",0).chain(function(){c.setProperty("width",e.width).setProperty("height",e.height);c.setProperty("src",d.src).removeClass("spinner");this.start("opacity",1);});a.images.erase(c);a.storage.erase(c.getProperty("smartload"));}});}},this);}});
;

/*** gantry-buildspans.js ***/

/**
 * @version		3.2.13 December 1, 2011
 * @author		RocketTheme http://www.rockettheme.com
 * @copyright 	Copyright (C) 2007 - 2011 RocketTheme, LLC
 * @license		http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */

var GantryBuildSpans=function(c,b,a){(c.length).times(function(d){var h="."+c[d];var g=function(f){f.setStyle("visibility","visible");var e=f.get("text");var k=e.split(" ");first=k[0];rest=k.slice(1).join(" ");html=f.innerHTML;if(rest.length>0){var j=f.clone().set("text"," "+rest),i=new Element("span").set("text",first);i.inject(j,"top");j.replaces(f);}};$$(h).each(function(e){b.each(function(f){e.getElements(f).each(function(i){var j=i.getFirst();if(j&&j.get("tag")=="a"){g(j);}else{g(i);}});});});});};
;

/*** gantry-inputs.js ***/

/**
 * @version		3.2.13 December 1, 2011
 * @author		RocketTheme http://www.rockettheme.com
 * @copyright 	Copyright (C) 2007 - 2011 RocketTheme, LLC
 * @license		http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */

var InputsExclusion = ['.content_vote'];

var InputsMorph={version:1.7,init:function(){InputsMorph.rtl=document.id(document.body).getStyle("direction")=="rtl";InputsMorph.list=new Hash({all:[]});var a=$$("input[type=radio]");var d=$$(InputsExclusion.join(" input[type=radio], ")+" input[type=radio]");d.each(function(b){a=a.erase(b);});a.each(function(b,c){InputsMorph.setArray("list","all",b);if(InputsMorph.list.has(b.name)){InputsMorph.setArray("list",b.name,b);}else{InputsMorph.list.set(b.name,[b]);}InputsMorph.morph(b,"radios").addEvent(b,"radios");});a=$$("input[type=checkbox]");d=$$(InputsExclusion.join(" input[type=checkbox], ")+" input[type=checkbox]");d.each(function(b){a=a.erase(b);});a.each(function(b,c){InputsMorph.setArray("list","all",b);if(InputsMorph.list.has(b.name)){InputsMorph.setArray("list",b.name,b);}else{InputsMorph.list.set(b.name,[b]);}InputsMorph.morph(b,"checks").addEvent(b,"checks");});},morph:function(e,d){var h=e.getNext(),g=e.getParent(),f=e.name.replace("[","").replace("]","");if(h&&h.get("tag")=="label"){e.setStyles({position:"absolute",left:"-10000px"});if(InputsMorph.rtl&&Browser.Engine.gecko){e.setStyles({position:"absolute",right:"-10000px"});}else{e.setStyles({position:"absolute",left:"-10000px"});}if(InputsMorph.rtl&&(Browser.Engine.presto||Browser.Engine.trident)){e.setStyle("display","none");}if(Browser.Engine.trident5){e.setStyle("display","none");}h.addClass("rok"+d+" rok"+f);if(e.checked){h.addClass("rok"+d+"-active");}}else{if(g&&g.get("tag")=="label"){if(InputsMorph.rtl&&Browser.Engine.gecko){e.setStyles({position:"absolute",right:"-10000px"});}else{e.setStyles({position:"absolute",left:"-10000px"});}if(InputsMorph.rtl&&(Browser.Engine.presto||Browser.Engine.trident)){e.setStyle("display","none");}g.addClass("rok"+d+" rok"+f);if(e.checked){g.addClass("rok"+d+"-active");}}}return InputsMorph;},addEvent:function(e,d){e.addEvent("click",function(){if(Browser.Engine.presto||Browser.Engine.trident){if(e.opera){InputsMorph.switchReplacement(e,d);}e.opera=(d=="checks")?false:true;}else{InputsMorph.switchReplacement(e,d);}});if(Browser.Engine.presto||Browser.Engine.trident||(e.getNext()&&!e.getNext().getProperty("for"))){var g=e.getNext(),f=e.getParent();if(g&&g.get("tag")=="label"&&(Browser.Engine.trident||(Browser.Engine.presto&&!e.opera))){g.addEvent("click",function(){if((Browser.Engine.presto||Browser.Engine.trident)&&!e.opera){e.opera=true;}e.fireEvent("click");});}else{if(f&&f.get("tag")=="label"||(e.getParent()&&!e.getParent().getProperty("for"))){f.addEvent("click",function(){e.fireEvent("click");});}}}return InputsMorph;},switchReplacement:function(l,k){if(k=="checks"){var j=l.getNext(),c=l.getParent(),a="rok"+k+"-active";var i=((j)?j.get("tag")=="label":false);var b=((c)?c.get("tag")=="label":false);if(i||b){if(i){if(j.hasClass(a)&&i){j.removeClass(a);if(l.checked){l.checked=false;}}else{if(!j.hasClass(a)&&i){j.addClass(a);if(!l.checked){l.checked=true;}}}}else{if(b){if(c.hasClass(a)&&b){c.removeClass(a);if(l.checked){l.checked=false;}}else{if(!c.hasClass(a)&&b){c.addClass(a);if(!l.checked){l.checked=true;}}}}}}}else{InputsMorph.list.get(l.name).each(function(e){var d=e.getNext(),f=e.getParent();var h=l.getNext(),g=l.getParent();$$(d,f).removeClass("rok"+k+"-active");if(d&&d.get("tag")=="label"&&h==d){e.setProperty("checked","checked");d.addClass("rok"+k+"-active");}else{if(f&&f.get("tag")=="label"&&g==f){f.addClass("rok"+k+"-active");e.setProperty("checked","checked");}}});}},setArray:function(f,e,h){var g=InputsMorph[f].get(e);g.push(h);return InputsMorph[f].set(e,g);}};window.addEvent("domready",InputsMorph.init);
;

/*** fusion.js ***/


var Fusion = new Class({
	Implements: [Options],
	version: "1.9.8",
	options: {
		centered: false,
		tweakInitial: {x: 0, y: 0},
		tweakSubsequent: {x: 0, y: 0},
		tweakSizes: {'width': 0, 'height': 0},
		pill: true,
		direction: { x: 'right', y: 'down' },		
		effect: 'slide and fade',
		orientation: 'horizontal',
		opacity: 1,
		hideDelay: 50000,
		menuFx: {
			duration: 500,
			transition: 'quad:out'
		},
		pillFx: {
			duration: 400,
			transition: 'back:out'
		}
	},
	initialize: function(element, options) {
		this.element = $$(element)[0];
		this.id = $$('.fusion')[0];
		if (this.id) this.id = this.id.id;
		else this.id = '';
		this.setOptions(options);
		var links = this.element.getElements('.item'), opts = this.options;
		
		this.rtl = document.id(document.body).getStyle('direction') == 'rtl';
		
		this.options.tweakSubsequent.x -= this.options.tweakSizes.width / 2;
		this.options.tweakSubsequent.y -= this.options.tweakSizes.height / 2;
		
		if (this.rtl) {
			this.options.direction.x = 'left';
			this.options.tweakInitial.x *= -1;
			this.options.tweakSubsequent.x *= -1;
		}
		
		if (this.options.pill) {
			var pill = new Element('div', {'class': 'fusion-pill-l'}).inject(this.element, 'after').setStyle('display', 'none'), self = this;
			new Element('div', {'class': 'fusion-pill-r'}).inject(pill);
			this.pillsRoots = this.element.getElements('.root');
			var active = this.element.getElement('.active');
			this.pillsMargins = pill.getStyle('margin-left').toInt() + pill.getStyle('margin-right').toInt();
			this.pillsTopMargins = pill.getStyle('margin-top').toInt() + pill.getStyle('margin-bottom').toInt();
			
			if (!active) {
				this.options.pill = false;
			} else {
				pill.setStyle('display', 'block');
				this.pillsDefaults = {
					'left': active.offsetLeft,
					'width': active.offsetWidth - this.pillsMargins,
					'top': active.offsetTop
				};
			
				this.pillFx = new Fx.Morph(pill, {
					duration: opts.pillFx.duration, 
					transition: opts.pillFx.transition, 
					link: 'cancel'
				}).set(this.pillsDefaults);
			
				var ghosts = this.pillsRoots.filter(function(item) { return !item.hasClass('parent'); });
				$$(ghosts).addEvents({
					'mouseenter': function() {
						self.ghostRequest = true;
						self.pillFx.start({
							'left': this.offsetLeft,
							'width': this.offsetWidth - self.pillsMargins,
							'top': this.offsetTop
						});
					},
					'mouseleave': function() {
						self.ghostRequest = false;
						self.pillFx.start(self.pillsDefaults);
					}
				});
			}
		};
		
		this.parentLinks = {};
		this.parentSubMenus = {};
		this.childMenu = {};
		this.menuType = {};
		this.subMenus = [];
		this.hideAllMenusTimeout = null;
		this.subMenuZindex = 1;
		
		links.each(function(link, i) {
			link.getCustomID();
			this.parentLinks[link.id] = link.getParent().getParents('li').getElement('.item');
			this.childMenu[link.id] = link.getNext('.fusion-submenu-wrapper') || link.getNext('ul') || link.getNext('ol');
			if (this.childMenu[link.id]) link.fusionSize = this.childMenu[link.id].getCoordinates();
			if (this.childMenu[link.id] && Browser.Engine.trident) {
				var ul = this.childMenu[link.id].getElement('ul');
				if (ul) {
					var padding = ul.getStyle('padding-bottom').toInt() || 0;
					link.fusionSize.height += padding;
				}
			}
			
			var type = 'subseq';
			if (document.id(link.getParent('.fusion-submenu-wrapper') || link.getParent('ul') || link.getParent('ol')) === this.element) type = 'init';
			
			this.menuType[link.id] = type;
			
		}, this);
		
		this.jsContainer = new Element('div', {'class': 'fusion-js-container menutop'}).inject(document.body);
		this.jsContainer.addEvents({
			'mouseenter': function() { window.RTFUSION = true; },
			'mouseleave': function() { window.RTFUSION = false; }
		});
		var cls = this.element.className.replace("menutop", "");
		if (this.id.length) this.jsContainer.id = this.id;
		if (cls.length) {
			var newCls = "fusion-js-container " + cls + " menutop";
			this.jsContainer.className = newCls.clean();
		}
		
		var els = this.element.getElements('.fusion-submenu-wrapper');
		if (!els.length) els = this.element.getElements('ul');
		els.each(function(item,index){
			var active = item.getElements('.item')[index];
			
			if (active && this.parentLinks[active.id].length == 1) active = this.parentLinks[active.id].getLast().getParents('li')[0];
			
			var subContainer = new Element('div', {'class': 'fusion-js-subs'}).inject(this.jsContainer).adopt(item);

			if (active && active.hasClass('active')) {
				item.getParent().addClass('active');
			}
		}, this);
		
		this.jsContainer.getElements('.item').setProperty('tabindex', '-1');
		
		links.each(function(link, i){
			if (!this.childMenu[link.id]) {return;}
			
			this.childMenu[link.id] = this.childMenu[link.id].getParent('div');
			this.subMenus.include(this.childMenu[link.id]);

			var tmp = [];
			this.parentLinks[link.id].each(function(parent, i) {
				tmp.push(this.childMenu[parent.id]);
			}, this);
			
			this.parentSubMenus[link.id] = tmp;
			this.aSubMenu = new FusionSubMenu(this.options,this, link);

		}, this);
	}
	
});

var FusionSubMenu = new Class({
	Implements: [Options],
    options: {
		onSubMenuInit_begin: (function(subMenuClass){}),
		onSubMenuInit_complete: (function(subMenuClass){}),
		
		onMatchWidth_begin: (function(subMenuClass){}),
		onMatchWidth_complete: (function(subMenuClass){}),
		
		onHideSubMenu_begin: (function(subMenuClass){}),
		onHideSubMenu_complete: (function(subMenuClass){}),
		
		onHideOtherSubMenus_begin: (function(subMenuClass){}),
		onHideOtherSubMenus_complete: (function(subMenuClass){}),		
		
		onHideAllSubMenus_begin: (function(subMenuClass){}),
		onHideAllSubMenus_complete: (function(subMenuClass){}),
		
		onPositionSubMenu_begin: (function(subMenuClass){}),
		onPositionSubMenu_complete: (function(subMenuClass){}),
		
		onShowSubMenu_begin: (function(subMenuClass){}),
		onShowSubMenu_complete: (function(subMenuClass){})
	},
	root:null,
	btn:null,
	hidden:true,
	myEffect:null,
		
	initialize: function(options,root,btn){
		this.setOptions(options);		
		this.root = root;
		this.btn = document.id(btn);
		this.childMenu = document.id(root.childMenu[btn.id]);
		this.subMenuType = root.menuType[btn.id];
		this.parentSubMenus =  $$(root.parentSubMenus[btn.id]);
		this.parentLinks =  $$(root.parentLinks[btn.id]);
		this.parentSubMenu = document.id(this.parentSubMenus[0]);
		this.otherSubMenus = {};
		this.fxMorph = {};
		this.rtl = root.rtl;
		
		this.options.tweakInitial = this.root.options.tweakInitial;
		this.options.tweakSubsequent = this.root.options.tweakSubsequent;
		this.options.centered = this.root.options.centered;

		this.childMenu.fusionStatus = 'closed';
		
		this.options.onSubMenuInit_begin(this);		

		
		this.childMenu.addEvent('hide', this.hideSubMenu.bind(this, false));
		this.childMenu.addEvent('show', this.showSubMenu.bind(this, false));
		
		var child = this.childMenu;
		if (this.options.effect) {
			this.myEffect = new Fx.Morph(this.childMenu.getFirst(), {	
				duration: this.options.menuFx.duration, 
				transition: this.options.menuFx.transition,  
				link: 'cancel',
				onStart: function() {
					//if (Browser.Engine.trident) 
					this.element.setStyle('display', 'block');
				},
				onComplete: function() {
					
					if (child.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							child.setStyle('display', 'none');
						} else {
							this.element.setStyle('display', 'none');
						}
					}
				}
			});
		}
		
		if (this.options.effect == 'slide' || this.options.effect == 'slide and fade') {
			if (this.subMenuType == 'init' && this.options.orientation == 'horizontal') this.myEffect.set({'margin-top': '0'});
			else {
				if (!this.rtl) this.myEffect.set({'margin-left': '0'});
				else this.myEffect.set({'margin-right': '0'});
			}
		}
		else if (this.options.effect == 'fade' || this.options.effect == 'slide and fade') this.myEffect.set({'opacity': 0});
		
		if (this.options.effect != 'fade' && this.options.effect != 'slide and fade') this.myEffect.set({'opacity': this.options.opacity});

		
		//attach event handlers to non-parent sub menu buttons
		var nonParentBtns = document.id(this.childMenu).getElements('.item').filter(function(item, index){ return !root.childMenu[item.id]; });
		
		nonParentBtns.each(function(item, index){
			document.id(item).getParent().addClass('f-submenu-item');
			
			var prnt = item.getParent();
			var listParents = item.getParents('li').length;
			
			if (listParents < 2 && !prnt.hasClass('fusion-grouped')) {
				prnt.getParent().addEvents({
					'mouseenter': function(e){
						$clear(child.tmpTimer);
						this.childMenu.fireEvent('show');
						this.cancellHideAllSubMenus();					
						this.hideOtherSubMenus();				
					}.bind(this),
				
					'focus': function(e){
						this.childMenu.fireEvent('show');
						this.cancellHideAllSubMenus();		
						this.hideOtherSubMenus();
					}.bind(this),
				
					'mouseleave': function(e){
						this.cancellHideAllSubMenus();
						this.hideAllSubMenus();					
					}.bind(this),
				
					'blur': function(e){
						this.cancellHideAllSubMenus();
						this.hideAllSubMenus();
					}.bind(this)
				});
			} else {
				prnt.addEvents({
					'mouseenter': function(e){
						this.childMenu.fireEvent('show');
						this.cancellHideAllSubMenus();				
						if (!prnt.hasClass('fusion-grouped')) this.hideOtherSubMenus();				
					}.bind(this),
					'mouseleave': function(e){
						//this.childMenu.fireEvent('hide');
						//this.cancellHideAllSubMenus();
						//this.hideAllSubMenus();
					}.bind(this)
				});
			}
		}, this);
		
		this.btn.removeClass('fusion-submenu-item');
		
		if (this.subMenuType == 'init') this.btn.getParent().addClass('f-main-parent');	
		else this.btn.getParent().addClass('f-parent-item');	
		
		//attach event handlers to parent button
		var prnt = this.btn.get('text').clean() + ' --- ' + this.btn.getParent().className;
		this.btn.getParent().addEvents({
			'mouseenter' : function(e){
				$clear(child.tmpTimer);
				this.cancellHideAllSubMenus();
				this.hideOtherSubMenus();
				this.showSubMenu.delay(10, this, false);
				if (this.subMenuType == 'init' && this.options.mmbClassName && this.options.mmbFocusedClassName) {
					if (!this.fxMorph[this.btn.id]) this.fxMorph[this.btn.id] = {};
					if (!this.fxMorph[this.btn.id]['btnMorph']) 
						this.fxMorph[this.btn.id]['btnMorph'] = new Fx.Morph(this.btn, { 
							'duration': this.options.menuFx.duration, 
							transition: this.options.menuFx.transition, 
							link: 'cancel'
						});
						
						
					this.fxMorph[this.btn.id]['btnMorph'].start(this.options.mmbFocusedClassName);
				}
			}.bind(this),
			
			'focus' : function(e) {
				this.cancellHideAllSubMenus();
				this.hideOtherSubMenus();
				this.showSubMenu();
				if (this.subMenuType == 'init' && this.options.mmbClassName && this.options.mmbFocusedClassName) {
					if (!this.fxMorph[this.btn.id]) this.fxMorph[this.btn.id] = {};
					if (!this.fxMorph[this.btn.id]['btnMorph']) 
						this.fxMorph[this.btn.id]['btnMorph'] = new Fx.Morph(this.btn, { 
							'duration': this.options.menuFx.duration, 
							transition: this.options.menuFx.transition,
							link: 'cancel'
						});
						
					this.fxMorph[this.btn.id]['btnMorph'].start(this.options.mmbFocusedClassName);
				}
			}.bind(this),
				
			'mouseleave': function(e) {
				var ol = this.btn.getParent().getParent().get('tag') == 'ol';
				if (this.subMenuType != 'init' && !ol) child.tmpTimer = (function(){ child.fireEvent('hide'); }).delay(100);
				this.cancellHideAllSubMenus();
				this.hideAllSubMenus(this.btn, this.btn.getParent().getParent().get('tag') == 'ol');
			}.bind(this),
			
			'blur': function(e) {
				this.cancellHideAllSubMenus();
				this.hideAllSubMenus();
			}.bind(this)
		});
		
		this.options.onSubMenuInit_complete(this);
		
    },
	
	matchWidth:function(){
		if (this.widthMatched || this.subMenuType === 'subseq') { return; }

		this.options.onMatchWidth_begin(this);

		var parentWidth = this.btn.getCoordinates().width;

		this.childMenu.getElements('.item').each(function(item,index) {
			var borderWidth = parseFloat(this.childMenu.getFirst().getStyle('border-left-width')) + parseFloat(this.childMenu.getFirst().getStyle('border-right-width'));
			var paddingWidth = parseFloat(item.getStyle('padding-left')) + parseFloat(item.getStyle('padding-right'));

			var offset = borderWidth + paddingWidth;

			if(parentWidth > item.getCoordinates().width){
				item.setStyle('width',parentWidth - offset);
				item.setStyle('margin-right',-borderWidth);
			}

		}.bind(this));

		this.width = this.btn.fusionSize.width;
		this.widthMatched = true;
		this.options.onMatchWidth_complete(this);

	},
	
	hideSubMenu: function() {
		if(this.childMenu.fusionStatus === 'closed'){return;}	
		this.options.onHideSubMenu_begin(this);
		if (this.subMenuType == 'init') {
			if (this.options.mmbClassName && this.options.mmbFocusedClassName) {
				if (!this.fxMorph[this.btn.id]) this.fxMorph[this.btn.id] = {};
				
				if (!this.fxMorph[this.btn.id]['btnMorph'])
					this.fxMorph[this.btn.id]['btnMorph'] = new Fx.Morph(this.btn, {
						'duration': this.options.menuFx.duration, 
						transition: this.options.menuFx.transition, 
						link: 'cancel'
					});
				
				this.fxMorph[this.btn.id]['btnMorph'].start(this.options.mmbClassName).chain(function() {
					this.btn.getParent().removeClass('f-mainparent-itemfocus');
					this.btn.getParent().addClass('f-mainparent-item');
				}.bind(this));

			} else {
				this.btn.getParent().removeClass('f-mainparent-itemfocus');
				this.btn.getParent().addClass('f-mainparent-item');
			}
		} else {
			this.btn.getParent().removeClass('f-menuparent-itemfocus');
			this.btn.getParent().addClass('f-menuparent-item');
		}
		
		this.childMenu.setStyle('z-index',1);
		if (this.options.effect && this.options.effect.toLowerCase() === 'slide') {
			
			if (this.subMenuType == 'init' && this.options.orientation == 'horizontal' && this.options.direction.y == 'down') {
				
				this.myEffect.start({'margin-top': -this.height}).chain(function() { 
					if (this.childMenu.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							this.myEffect.set({'display': 'none'});
						} else {
							this.myEffect.element.setStyle('display', 'none');
						}
					}
				}.bind(this));
				
			} else if (this.subMenuType == 'init' && this.options.orientation == 'horizontal' && this.options.direction.y == 'up') {
				this.myEffect.start({'margin-top': this.height}).chain(function() { 
					if (this.childMenu.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							this.myEffect.set({'display': 'none'});
						} else {
							this.myEffect.element.setStyle('display', 'none');
						}
					}

				}.bind(this));
				
			} else if (this.options.direction.x == 'right') {
				if (!this.rtl) tmp = {'margin-left': -this.width};
				else tmp = {'margin-right': this.width};
				
				this.myEffect.start(tmp).chain(function(){
					if (this.childMenu.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							this.myEffect.set({'display': 'none'});
						} else {
							this.myEffect.element.setStyle('display', 'none');
						}
					}

				}.bind(this));
				
			} else if (this.options.direction.x == 'left') {
				if (!this.rtl) tmp = {'margin-left': this.width};
				else tmp = {'margin-right': -this.width};
				
				this.myEffect.start(tmp).chain(function(){
					if (this.childMenu.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							this.myEffect.set({'display': 'none'});
						} else {
							this.myEffect.element.setStyle('display', 'none');
						}
					}

				}.bind(this));
				
			}
		} else if (this.options.effect == 'fade') {
			
			this.myEffect.start({'opacity': 0}).chain(function() {
				if (this.childMenu.fusionStatus == 'closed') {
					if (!Browser.Engine.trident) {
						this.myEffect.set({'display': 'none'});
					} else {
						this.myEffect.element.setStyle('display', 'none');
					}
				}

			}.bind(this));
			
		} else if (this.options.effect == 'slide and fade') {
			if (this.subMenuType == 'init' && this.options.orientation == 'horizontal' && this.options.direction.y == 'down') {

				this.myEffect.start({'margin-top': -this.height,opacity: 0}).chain(function(){
					if (this.childMenu.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							this.myEffect.set({'display': 'none'});
						} else {
							this.myEffect.element.setStyle('display', 'none');
						}
					}

				}.bind(this));
				
			} else if (this.subMenuType == 'init' && this.options.orientation == 'horizontal' && this.options.direction.y == 'up') {
				
				this.myEffect.start({'margin-top': this.height,opacity: 0}).chain(function() {
					if (this.childMenu.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							this.myEffect.set({'display': 'none'});
						} else {
							this.myEffect.element.setStyle('display', 'none');
						}
					}

				}.bind(this));
				
			} else if (this.options.direction.x == 'right') {
				if (!this.rtl) tmp = {'margin-left': -this.width, 'opacity': 0};
				else tmp = {'margin-right': this.width, 'opacity': 0};
				
				this.myEffect.start(tmp).chain(function() { 
					if (this.childMenu.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							this.myEffect.set({'display': 'none'});
						} else {
							this.myEffect.element.setStyle('display', 'none');
						}
					}

				}.bind(this));
				
			} else if (this.options.direction.x == 'left') {
				if (!this.rtl) tmp = {'margin-left': this.width, 'opacity': 0};
				else tmp = {'margin-right': -this.width, 'opacity': 0};
				
				this.myEffect.start(tmp).chain(function() {
					if (this.childMenu.fusionStatus == 'closed') {
						if (!Browser.Engine.trident) {
							this.myEffect.set({'display': 'none'});
						} else {
							this.myEffect.element.setStyle('display', 'none');
						}
					}

				}.bind(this));
				
			}
		} else {
			if (!Browser.Engine.trident) {
				this.myEffect.set({'display': 'none'});
			} else {
				this.myEffect.element.setStyle('display', 'none');
			}
		}
		
		this.childMenu.fusionStatus = 'closed';
		this.options.onHideSubMenu_complete(this);
	},
	
	hideOtherSubMenus: function() {		
		this.options.onHideOtherSubMenus_begin(this);
		if(!this.otherSubMenus[this.btn.id]){
			this.otherSubMenus[this.btn.id] = $$(this.root.subMenus.filter(function(item){ return !this.root.parentSubMenus[this.btn.id].contains(item) && item != this.childMenu; }.bind(this)) );
		}
		this.parentSubMenus.fireEvent('show');
		this.otherSubMenus[this.btn.id].fireEvent('hide');
		this.options.onHideOtherSubMenus_complete(this);
	},
	
	hideAllSubMenus: function(btn, group){
		this.options.onHideAllSubMenus_begin(this);
		$clear(this.root.hideAllMenusTimeout);
		this.root.hideAllMenusTimeout = (function(){
			if (!window.RTFUSION) {
				$clear(this.hideAllMenusTimeout);
				this.myEffect.cancel();
				if (this.root.options.pill && !this.root.ghostRequest) this.root.pillFx.start(this.root.pillsDefaults);
				if (group) {
					var itms = $$(this.root.subMenus).filter(function(wrap) {
						return !wrap.hasChild(btn);
					});
					$$(itms).fireEvent('hide');
				}
				else $$(this.root.subMenus).fireEvent('hide');			
			}
		}).bind(this).delay(this.options.hideDelay);
		this.options.onHideAllSubMenus_complete(this);		
	},

	cancellHideAllSubMenus: function(){ 
		$clear(this.root.hideAllMenusTimeout);	
		//$clear(this.tmpTimer);
	},
	
	showSubMenu: function(now){
		if (this.root.options.pill && this.subMenuType == 'init') {
			this.root.ghostRequest = false;
			this.root.pillFx.start({
				'left': this.btn.getParent().offsetLeft,
				'width': this.btn.getParent().offsetWidth - this.root.pillsMargins,
				'top': this.btn.getParent().offsetTop
			});
		};

		if(this.childMenu.fusionStatus === 'open') { return; }
		
		this.options.onShowSubMenu_begin(this);
		
		if (this.subMenuType == 'init') {
			this.btn.getParent().removeClass('f-mainparent-item');
			this.btn.getParent().addClass('f-mainparent-itemfocus');
		} else {
			this.btn.getParent().removeClass('f-menuparent-item');
			this.btn.getParent().addClass('f-menuparent-itemfocus');
		}

		this.root.subMenuZindex++;

		this.childMenu.setStyles({'display':'block','visibility':'hidden','z-index': this.root.subMenuZindex });
		
		if(!this.width || !this.height ){
			this.width = this.btn.fusionSize.width;
			this.height = this.btn.fusionSize.height;
			this.childMenu.getFirst().setStyle('height',this.height,'border');
			if(this.options.effect == 'slide' || this.options.effect == 'slide and fade'){
				if (this.subMenuType == 'init' && this.options.orientation == 'horizontal' ) {
					this.childMenu.getFirst().setStyle('margin-top','0' );
					if (this.options.direction.y == 'down') {
						this.myEffect.set({'margin-top': - this.height});
					} else if (this.options.direction.y == 'up') {
						this.myEffect.set({'margin-top': this.height});
					}
				} else {
					if (this.options.direction.x == 'left') {
						if (!this.rtl) tmp = {'margin-left': this.width};
						else tmp = {'margin-right': -this.width};
						
						this.myEffect.set(tmp);
					} else {
						if (!this.rtl) tmp = {'margin-left': -this.width};
						else tmp = {'margin-right': this.width};
						
						this.myEffect.set(tmp);
					}
				}
			}
		}
		
		this.matchWidth();
		this.positionSubMenu();
		
		this.fixedHeader = document.body.hasClass('fixedheader-1');
		
		if (this.fixedHeader && !this.scrollingEvent){
			this.scrollingEvent = true;
			window.addEvent('scroll', function(){
				this.positionSubMenu();
			}.bind(this));
		}
		
		if (this.options.effect == 'slide' ) {
			
			this.childMenu.setStyles({'display': 'block', 'visibility': 'visible'});
			
			if (this.subMenuType === 'init' && this.options.orientation === 'horizontal') {
				if (now) this.myEffect.set({'margin-top': 0}).chain(function() { this.showSubMenuComplete(); }.bind(this));
				else this.myEffect.start({'margin-top': 0}).chain(function() { this.showSubMenuComplete(); }.bind(this));
			} else {
				if (!this.rtl) tmp = {'margin-left': 0};
				else tmp = {'margin-right': 0};
				
				if (now) this.myEffect.set(tmp).chain(function() { this.showSubMenuComplete(); }.bind(this));
				else this.myEffect.start(tmp).chain(function(){	this.showSubMenuComplete();	}.bind(this));
			}
			
		} else if (this.options.effect == 'fade') {
			
			if (now) this.myEffect.set({'opacity': this.options.opacity}).chain(function() { this.showSubMenuComplete(); }.bind(this));
			else this.myEffect.start({'opacity': this.options.opacity}).chain(function() { this.showSubMenuComplete(); }.bind(this));
			
		} else if (this.options.effect == 'slide and fade') {
			
			this.childMenu.setStyles({'display': 'block', 'visibility': 'visible'});
			this.childMenu.getFirst().setStyles({'left': 0});
			if (this.subMenuType == 'init' && this.options.orientation == 'horizontal') {
				if (now) this.myEffect.set({'margin-top': 0, 'opacity': this.options.opacity}).chain(function() { this.showSubMenuComplete(); }.bind(this));
				else this.myEffect.start({'margin-top': 0, 'opacity': this.options.opacity}).chain(function() { this.showSubMenuComplete(); }.bind(this));
				
			} else {
				if (!this.rtl) tmp = {'margin-left': 0, 'opacity': this.options.opacity};
				else tmp = {'margin-right': 0, 'opacity': this.options.opacity};
				
				if (now) {
					if (this.options.direction.x == 'right') {
						this.myEffect.set(tmp).chain(function() { this.showSubMenuComplete(); }.bind(this));
					} else if (this.options.direction.x == 'left') {
						this.myEffect.set(tmp).chain(function() { this.showSubMenuComplete(); }.bind(this));
					}
					
				} else {
					
					if (this.options.direction.x == 'right') {
						
						this.myEffect.set({'margin-left': -this.width, 'opacity': this.options.opacity});						
						this.myEffect.start(tmp).chain(function() { this.showSubMenuComplete(); }.bind(this));
						
					} else if (this.options.direction.x == 'left') {
						this.myEffect.set({'margin-left': this.width, 'opacity': this.options.opacity});
						this.myEffect.start(tmp).chain(function(){ this.showSubMenuComplete(); }.bind(this));
					}
				}
			}
			
		} else {
			
			this.childMenu.setStyles({'display': 'block', 'visibility': 'visible'});
			this.showSubMenuComplete(this);
			
		}
		
		this.childMenu.fusionStatus = 'open';
		
	},
	
	showSubMenuComplete:function(){
		
		this.options.onShowSubMenu_complete(this);
		
	},
	
	positionSubMenu: function(){
		if (this.root.disableScroll) return;
		this.options.onPositionSubMenu_begin(this);
		
		var height = this.childMenu.getStyle('padding-bottom').toInt() + this.options.tweakSizes.height;
		var width = this.options.tweakSizes.width;
		if (!Browser.Engine.presto || !Browser.Engine.gecko || !Browser.Engine.webkit) {
			width = 0;
			height = 0;
		}
		if (!this.rtl) {
			this.childMenu.setStyles({
				'width': this.width + this.options.tweakSizes.width, 
				'padding-bottom': this.options.tweakSizes.height,
				'padding-top': this.options.tweakSizes.height / 2,
				'padding-left': this.options.tweakSizes.width / 2
			});
		} else {
			this.childMenu.setStyles({
				'width': this.width + this.options.tweakSizes.width, 
				'padding-bottom': this.options.tweakSizes.height,
				'padding-top': this.options.tweakSizes.height / 2,
				'padding-right': this.options.tweakSizes.width / 2
			});
		}
		this.childMenu.getFirst().setStyle('width', this.width);
				
		if (this.subMenuType == 'subseq') {
			this.options.direction.x = 'right';
			this.options.direction.xInverse = 'left';
			this.options.direction.y = 'down';
			this.options.direction.yInverse = 'up';
			
			if (this.rtl) {
				this.options.direction.x = 'left';
				this.options.direction.xInverse = 'right';
			}
		}

		var top;
		var overlap;
		if (this.subMenuType == 'init') {
			if (this.options.direction.y == 'up') {

				if (this.options.orientation == 'vertical') top = this.btn.getCoordinates().bottom - this.height + this.options.tweakInitial.y;
				else top = this.btn.getCoordinates().top - this.height + this.options.tweakInitial.y;

				this.childMenu.style.top = top + 'px';
				
			} else if (this.options.orientation == 'horizontal') this.childMenu.style.top = this.btn.getCoordinates().bottom + this.options.tweakInitial.y + 'px';
			
			else if (this.options.orientation == 'vertical') {
			
				top = this.btn.getPosition().y + this.options.tweakInitial.y;
				
				if ((top + this.childMenu.getSize2().y) >= document.body.getScrollSize2().y) {
					overlap = (top + this.childMenu.getSize2().y) - document.body.getScrollSize2().y;
					top = top - overlap - 20;
				}
				
				this.childMenu.style.top = top + 'px';
			}
			
			if (this.options.orientation == 'horizontal') {
				var position = this.btn.getPosition().x + this.options.tweakInitial.x, compensation = 0;

				if (this.rtl) {
					var x = 0;
					if (this.btn.getStyle('margin-left').toInt() < 0 && !this.options.centered) x = this.btn.getParent().getPosition().x + this.options.tweakInitial.x;
					else if (this.btn.getStyle('margin-left').toInt() < 0 && this.options.centered) x = this.btn.getPosition().x - this.options.tweakInitial.x;
					else x = this.btn.getPosition().x;

					position = x + this.btn.getSize2().x - this.childMenu.getSize2().x;
				}				

				if (this.options.centered) {
					compensation = 0;
					var itemSize = this.btn.getSize2().x;
					if (this.btn.getStyle('margin-left').toInt() < 0 && !this.rtl) compensation = Math.abs(this.btn.getStyle('margin-left').toInt()) - Math.abs(this.btn.getFirst().getStyle('padding-left').toInt());
					else compensation = Math.abs(this.btn.getStyle('margin-right').toInt()) - Math.abs(this.btn.getFirst().getStyle('padding-right').toInt());
					var childSize = this.childMenu.getSize2().x;
					itemSize += compensation;
					var max = Math.max(itemSize, childSize), min = Math.min(itemSize, childSize);

					size = (max-min) / 2;
					if (!this.rtl) position -= size;
					else position += size;
				}
				
				this.childMenu.style.left = position + 'px';
				
			} else if (this.options.direction.x == 'left') {
				this.childMenu.style.left = this.btn.getPosition().x - this.childMenu.getCoordinates().width + this.options.tweakInitial.x + 'px';
				
			} else if (this.options.direction.x == 'right') {
				this.childMenu.style.left = this.btn.getCoordinates().right + this.options.tweakInitial.x + 'px';
				
			}
			
		} else if (this.subMenuType == 'subseq') {
			
			if (this.options.direction.y === 'down') {
				if ((this.btn.getCoordinates().top + this.options.tweakSubsequent.y + this.childMenu.getSize2().y) >= document.body.getScrollSize2().y) {
					
					overlap =  (this.btn.getCoordinates().top + this.options.tweakSubsequent.y + this.childMenu.getSize2().y) - document.body.getScrollSize2().y;
					this.childMenu.style.top = (this.btn.getCoordinates().top + this.options.tweakSubsequent.y) - overlap - 20 + 'px';
					
				} else {
					
					this.childMenu.style.top = this.btn.getCoordinates().top + this.options.tweakSubsequent.y + 'px';
					
				}
				
			} else if (this.options.direction.y === 'up') {
				
				if ((this.btn.getCoordinates().bottom - this.height + this.options.tweakSubsequent.y) < 1) {
					
					this.options.direction.y = 'down';
					this.options.direction.yInverse = 'up';
					this.childMenu.style.top = this.btn.getCoordinates().top + this.options.tweakSubsequent.y + 'px';
					
				} else {
					
					this.childMenu.style.top = this.btn.getCoordinates().bottom - this.height + this.options.tweakSubsequent.y + 'px';
					
				}
			}

			if (this.options.direction.x == 'left') {
				
				this.childMenu.style.left = this.btn.getCoordinates().left - this.childMenu.getCoordinates().width + this.options.tweakSubsequent.x + 'px';

				if (this.childMenu.getPosition().x < 0) {
				
					this.options.direction.x = 'right';
					this.options.direction.xInverse = 'left';
					this.childMenu.style.left = this.btn.getPosition().x + this.btn.getCoordinates().width + this.options.tweakSubsequent.x + 'px';
					
					if(this.options.effect === 'slide' || this.options.effect === 'slide and fade'){
						if (!this.rtl) tmp = {'margin-left': -this.width, 'opacity': this.options.opacity};
						else tmp = {'margin-right': this.width, 'opacity': this.options.opacity};
						
						this.myEffect.set(tmp);
					}
				}
				
			} else if(this.options.direction.x == 'right') {
				
				this.childMenu.style.left = this.btn.getCoordinates().right + this.options.tweakSubsequent.x + 'px';
				var smRight = this.childMenu.getCoordinates().right;
				var viewportRightEdge = document.body.getSize2().x + window.getScroll2().x;
				
				if(smRight > viewportRightEdge) {
					this.options.direction.x = 'left';
					this.options.direction.xInverse = 'right';

					this.childMenu.style.left = this.btn.getCoordinates().left - this.childMenu.getCoordinates().width - this.options.tweakSubsequent.x + 'px';
					
					if (this.options.effect == 'slide' || this.options.effect == 'slide and fade') {
						if (!this.rtl) tmp = {'margin-left': this.width, 'opacity': this.options.opacity};
						else tmp = {'margin-right': -this.width, 'opacity': this.options.opacity};
						
						this.myEffect.set(tmp);
					}
				}
			}
		}
		
		this.options.onPositionSubMenu_complete(this);
	}	
});


Element.implement({
    getCustomID: function(){
        if(!this.id){ 
			var rid = this.get('tag') + "-" + $time() + $random(0, 1000);
			//while ($(rid)) {this.getTag() + "-" + $time() + $random(0, 1000);}
			this.id = rid;
		};
	    return this.id;
    }
});

Native.implement([Element], {
	getSize2: function(){
		if ((/^(?:body|html)$/i).test(this.tagName)) return this.getWindow().getSize();
		return {x: this.offsetWidth, y: this.offsetHeight};
	},

	getScrollSize2: function(){
		if ((/^(?:body|html)$/i).test(this.tagName)) return this.getWindow().getScrollSize();
		return {x: this.scrollWidth, y: this.scrollHeight};
	},

	getScroll2: function(){
		if ((/^(?:body|html)$/i).test(this.tagName)) return this.getWindow().getScroll();
		return {x: this.scrollLeft, y: this.scrollTop};
	}
});

Native.implement([Document, Window], {
	getSize2: function(){
		return this.getSize();
	},

	getScroll2: function(){
		return this.getScroll();
	},

	getScrollSize2: function(){
		return this.getScrollSize();
	}
});
;
