function flyOutMenu() {
	$each($$('ul.menu li[class!=active]'), function(element, index) {		
		$(element).addEvent('mouseenter', function(){   		
			$(this).getElements('ul').fade('in');
			/*$(this).getElements('ul').setStyles({'opacity':'0.92','display':'block'});*/	
		});	
		$(element).addEvent('mouseleave', function(){   		
			$(this).getElements('ul').fade('out');
			/*$(this).getElements('ul').setStyles({'opacity':'0.92','display':'none'});*/	
		});
		
		/* IE6 version:
		$(element).addEvent('mouseenter', function(){   		
			if(Browser.Engine.trident && Browser.Engine.version < 7) {
				$(this).getElements('ul').setStyles({'display':'block'});
			} else {
				$(this).getElements('ul').fade('in');
			}	
		});	
		$(element).addEvent('mouseleave', function(){   
			if(Browser.Engine.trident && Browser.Engine.version < 7) {
				$(this).getElements('ul').setStyles({'display':'none'});
			} else {
				$(this).getElements('ul').fade('out');
			}	
		});	
		*/
	});
	$each($$('ul.menu li[class=active] > a'), function(element, index) {		
		$(element).addEvent('mouseenter', function(){   		
			$(this).getParent('li').addClass('active-flyout');
			$(this).getNext('ul.menu2').fade('hide').fade('in');
			/*$(this).getElements('ul').setStyles({'opacity':'0.92','display':'block'});*/	
		});	
	});	
	$each($$('ul.menu li[class=active]'), function(element, index) {		
		$(element).addEvent('mouseleave', function(ev){   		
			$(this).removeClass('active-flyout');
			
			/*$(this).getElements('ul').setStyles({'opacity':'0.92','display':'none'});*/	
		});
		
		/* IE6 version:
		$(element).addEvent('mouseenter', function(){   		
			if(Browser.Engine.trident && Browser.Engine.version < 7) {
				$(this).getElements('ul').setStyles({'display':'block'});
			} else {
				$(this).getElements('ul').fade('in');
			}	
		});	
		$(element).addEvent('mouseleave', function(){   
			if(Browser.Engine.trident && Browser.Engine.version < 7) {
				$(this).getElements('ul').setStyles({'display':'none'});
			} else {
				$(this).getElements('ul').fade('out');
			}	
		});	
		*/
	});
	/*
	var container = $('header-bottom');
	var containerCoords = $(container).getCoordinates();
	var mainMenu = $('main_menu').getElement('ul.menu');
	var mainMenuCoords = $(mainMenu).getCoordinates(container);
	var activeLi = $('main_menu').getElement('ul.menu li[class=active]');
	
	var activeMenu = $('main_menu').getElement('ul.menu li[class=active] ul');
	//var activeMenuCoords = $(activeMenu).getCoordinates(activeLi);
	
	if($defined(activeLi)){
		var activeLiCoords = $(activeLi).getCoordinates(container);
		//mainmenu width 
		//var mainMenuWidth = 0;
		$each($(mainMenu).getChildren('li'), function(element, index){
			var tmpCoords = $(element).getComputedSize({styles: ['border','padding','margin']});
			mainMenuWidth += tmpCoords.totalWidth;
		});
		//right to left
		if(activeLiCoords.left > (mainMenuWidth/2)){
			//active menu width
			//var activeMenuWidthForPosition = 0;
			var activeMenuWidth = 0;
			var activeMenuLi = $(activeMenu).getChildren('li');
			var tmpCoords = null;
			$each((activeMenuLi), function(element, index){
				if(activeMenuLi.length == (index+1)){
					//last link must not include padding
					tmpCoords = $(element).getFirst('a').getComputedSize();
				} else {
					tmpCoords = $(element).getComputedSize({styles: ['border','padding','margin']});	
				}
				activeMenuWidthForPosition += tmpCoords.width;
				//console.log(tmpCoords.totalWidth); 
				activeMenuWidth += tmpCoords.totalWidth;
			});
			//console.log(activeMenuWidth); 
			//console.log(activeMenuWidthForPosition); 
			
			
			
			//position right to left 
			//12px right distance to next element including spacer 
			//last element must get smaller distance 
			var rightDistance = 12;
			//check if last element, if so smaller distance 
			var nextElement = $(activeLi).getNext('li');
			if(nextElement == null){
				rightDistance = 5;
			}
			
			var newLeftXOffset = activeLiCoords.right-activeMenuWidthForPosition-rightDistance;
			//check if newleftoffset is beyond left side of main menu 
			
			if(newLeftXOffset < mainMenuCoords.left){
				newLeftXOffset = mainMenuCoords.left;
			}
			$(activeMenu).setPosition({x: (newLeftXOffset)});
			$(activeMenu).setStyle('width',activeMenuWidth+1);
			
			
			
		} else {//left to right 
			$(activeMenu).setPosition({x: activeLiCoords.left});
			var menuWidth = containerCoords.width - activeLiCoords.left;
			$(activeMenu).setStyle('width',menuWidth);
		}
	}*/
}
/*
function mailformField() {
	var mailform = $('mailform');
	
	// if mailform exist
	if($defined(mailform)) {
		// get all input fields
		var fields = mailform.getElements('input');
		// if input fields exist
		if($defined(fields)) {
			// run foreach field
			fields.each(function(e) {
				// if not submit button
				if(e.get('type') != 'submit') {
					// on focus
					e.addEvent('focus', function() {
						// if not focused clicked
						if(!e.hasClass('clicked')) {
							// clear value
							e.set('value', '');
							// set clicked class
							e.addClass('clicked');
						}
					});
				}
			});
		}
		// get all textareas
		var textareas = mailform.getElements('textarea');
		// if textareas exist
		if($defined(textareas)) {
			// run for each
			textareas.each(function(e) {
				// set on focus event
				e.addEvent('focus', function() {
					// if not focused before
					if(!e.hasClass('clicked')) {
						// clear value
						e.set('value', '');
						// set clicked class
						e.addClass('clicked');
					}
				});
			});
		}

	}
}
*/

google.setOnLoadCallback(function() {
	window.addEvent('domready', function() {
		flyOutMenu();
		/*mailformField();*/
	});   
});

/***Clearing for Inputs***/
function clearInput(obj, cpValue) {
	if(obj.value == cpValue) { obj.value = ''; }
}

/***Clearing for TextAreas***/
function clearTextArea(obj, cpValue) {
	if(obj.innerHTML == cpValue) { obj.innerHTML = ''; }
}
