// JavaScript Document
window.addEvent('domready', function() {
	
	/* menu js code  */	
	var list = $$('ul.menu_ays li');
	$$('.promotiontext').set('opacity', 0.7); 
	
	list.each(function(elem) {		
		
		var childElem = elem.getElement('ul');
		var childElemLast = elem.getElements('li:nth-child(last)');		
		var childFx = new Fx.Morph(childElem, { 
  			duration: 600
		});
		/*
		if(!Browser.Engine.trident4) {
			
			if(parentClass = elem.hasClass('item2'))
				bgimage = 'url(/ays/templates/ays_madeira/images/submenubgyellowlast.png)';
			else if(parentClass = elem.hasClass('item3')) 
				bgimage = 'url(/ays/templates/ays_madeira/images/submenubggreenlast.png)';
			else if(parentClass = elem.hasClass('item4')) 
				bgimage = 'url(/ays/templates/ays_madeira/images/submenubgpinklast.png)';
			else
				bgimage = 'url(/ays/templates/ays_madeira/images/submenubgdefaultlast.png)';
			
			var opacityLevel = new Array(0,1);			
			childElemLast.setStyles({
			'background-image': bgimage,
			'height':'31px'
			});
			
		} else {
			var opacityLevel = new Array(0,0.7);
		}
		*/
		var opacityLevel = new Array(0,1);
		
		elem.addEvent('mouseenter', function() {		
			childFx.cancel();
			if(childElem) {
				childFx.start({		  
					opacity: opacityLevel,
					display:'block'
				});
			}			
		});
		
		elem.addEvent('mouseleave', function() {
			childFx.cancel();
			if(childElem) {
				childFx.start({
					opacity: 0
				});
			}			
		});

	});
	/* end of menu js code */
	
	/* increase decrease text size */
	 var maincontent = $$('.maincontentpadding'); //contentor to the text you want to increase
	
	 $$('#TextSizeIncrement').addEvent('click', function(e) {
		 var currentfontsize = new String(maincontent.getStyle('font-size'));
		 
		 newfontsize = currentfontsize.toInt() + 1;
		 
		 maincontent.setStyle('font-size',newfontsize);
	 });
	
	 $$('#TextSizeDecrement').addEvent('click', function(e) {
		 var currentfontsize = new String(maincontent.getStyle('font-size'));
		 if(currentfontsize.toInt() > 5) {
			 newfontsize = currentfontsize.toInt() - 1;
	 	}
	 maincontent.setStyle('font-size',newfontsize);
	 });
	
	 $$('#TextSizeReset').addEvent('click', function(e) {
	 	maincontent.setStyle('font-size','12px');
	 });
	 
});