

			function languageReload ( language )
			{
				_gaq.push(['_trackEvent', 'Languages', 'click', language]);
				changeTitle( globalTitle );
				self.location = "./" + language;
				return false;
			}
			
			function changeTitle(title) 
			{ 
				document.title = title.replace(/&#(\d+);/g, function (m, n) { return String.fromCharCode(n); })
;
			}
						
			function subMenuItem (name, caption)
			{
				this.name = name;
				this.caption = caption;
				this.list = null;
				this.page = null;
				
				this.setList = function( aList )
				{
					this.list = aList;	
				}
				
				this.setPage = function( aPage )
				{
					this.page = aPage;	
				}

				this.hasList = function ()
				{
					return ( !(this.list == null ) );	
				}
				
				this.unSelectSubMenuItem = function ()
				{
					$("menu_" + this.parent.index + "_" + this.index ).parentNode.parentNode.className = $("menu_" + this.parent.index + "_" + this.index ).parentNode.parentNode.className.replace(new RegExp(" subselected\\b"), "");
					return false;	
				}
				
				this.selectSubMenuItem = function ()
				{
					$("menu_" + this.parent.index + "_" + this.index ).parentNode.parentNode.className +=" subselected";
					return false;	
				}
				
				this.getParentName = function ()
				{
					return this.parent.name;	
				}
				
				this.isSubMenu = function ()
				{
					return true;	
				}
			}
			
			function menuItem (name, caption)
			{
			    this.name = name;
				this.caption = caption;
				this.subMenus = new Array();
				this.index = -1;
				this.parent = "";
				this.imgSrc = "";
				this.list = null;
				this.page = null;
				
				this.setPage = function( aPage )
				{
					this.page = aPage;	
				}
				
				this.setList = function( aList )
				{
					this.list = aList;	
				}
				
				this.hasList = function ()
				{
					return ( !(this.list == null ) );	
				}
				
				this.addSubMenuItem = function ( subMenuItem )
				{
					subMenuItem.parent = this;
					subMenuItem.index = this.subMenus.push ( subMenuItem ) - 1;
				}
				
				this.selectMenuItem = function ()
				{
					$("menu_" + this.index).parentNode.parentNode.className +=" selected";
					
					if ( this.subMenus.length > 0 )
					{
						$("menu_" + this.index).style.lineHeight = "30px";
						$("menu_" + this.index).style.height = "18px";
						//$("menu_" + this.index).firstChild.style.lineHeight = "30px";
						//$("menu_" + this.index).firstChild.style.height = "18px";
					}
					return false;	
				}
				
				this.unSelectMenuItem = function ()
				{
					var className = $("menu_" + this.index).parentNode.parentNode.className;
					var myID = "menuli_" + this.index;
					className = className.replace(new RegExp(" selected\\b"), "");
					$("menu_" + this.index).parentNode.parentNode.className = className;
					return false;	
				}
				
				this.addImageMenuItem = function ( imgsrc )
				{
					this.imgSrc = imgsrc;
				}
				
				this.getParentName = function ()
				{
					return this.name;	
				}
				
				
				this.isSubMenu = function ()
				{
					return false;	
				}
			}
			
			function menu ()
			{
				this.previousItemSelectedName = "";
				this.itemSelectedName = "none";
				this.menusByName = {};
				this.menus = new Array;
				this.itemIndex = -1;
				
				this.addMenuItem = function ( menuItem )
				{
					menuItem.parent = this;
					menuItem.index = this.menus.push ( menuItem ) - 1;
				}
				
				this.selectMenu = function ( aItemName, itemIndex )
				{
					var bPreviousIsSubMenu = false;
					var bSelectedIsSubMenu = false;
					var bPreviousIsNone = true;
					var bSelectedIsNone = true;
	
					var bSameParent = false;
	
					
					if ( aItemName == this.itemSelectedName )
						return false;
		
					this.previousItemSelectedName = this.itemSelectedName;
					this.itemSelectedName = aItemName;
					
					if ( itemIndex == undefined ) 
						itemIndex = -1;
					this.itemIndex = itemIndex;
					
					previousItemSelected = this.getItemByName(this.previousItemSelectedName);
					itemSelected = this.getItemByName(this.itemSelectedName);
					
					bPreviousIsSubMenu = previousItemSelected.isSubMenu();
					bSelectedIsSubMenu = itemSelected.isSubMenu();
					bSameParent = ( previousItemSelected.getParentName() == itemSelected.getParentName() );
					bPreviousIsNone = ( this.previousItemSelectedName == "none" );
					bSelectedIsNone = ( this.itemSelectedName == "none" );
	
	
					if ( bPreviousIsSubMenu )
					{
						previousItemSelected.unSelectSubMenuItem();
						if ( !bSameParent )
							previousItemSelected.parent.unSelectMenuItem();
					}
					else if ( !bSameParent && !bPreviousIsNone)
						previousItemSelected.unSelectMenuItem();
					if ( bSelectedIsSubMenu )
					{
						itemSelected.selectSubMenuItem();	
						if (!bSameParent)
							itemSelected.parent.selectMenuItem();
					}
					else if ( !bSameParent && !bSelectedIsNone)
						itemSelected.selectMenuItem();
					
					return menuSelect ();
				}
				
				this.getMenu = function ( Index )
				{
					return this.menus[Index];
				}
				
				this.setSelectedItem = function ( itemName, index )
				{
					var aMenuItem;
					var aList;
					
					this.itemSelectedName = itemName;
					
					aItem = this.getItemByName(itemName);
					if ( aItem != null )
					{
						if ( aItem.hasList() )
						{
							aList = aItem.list;
							aList.initialSelectedItem = index;
						}
					}
				}
				
				this.getMenuItemByName = function ( menuItemName )
				{
					var x = this.menusByName[menuItemName];
					if ( x == undefined )
						return null;
					else
						return this.menus[x[0]];
				}
				
				this.getSubMenuItemByName = function ( subMenuItemName )
				{
					var x = this.menusByName[menuItemName];
					if ( x == undefined )
						return null;
					else if ( x[1] == -1 )
						return null;
					else
						return this.menus[x[0]].subMenus[x[1]];
				}
				
				this.getItemByName = function ( itemName )
				{
					var x = this.menusByName[itemName];
					if ( x == undefined )
						return null;
					else if ( x[1] == -1 )
						return this.menus[x[0]];
					else
						return this.menus[x[0]].subMenus[x[1]];
				}
				
				this.getIndexesByName = function ( ItemName )
				{
					var x;
					return (x = this.menusByName[menuItemName]);
				} 
			}
			
			function page (width,height)
			{
				this.width = width;
				this.height = height;
			}
			
			function centerWindow(aChildName, v_width, v_height) 
			{     
				
				if ( v_width == undefined )
					w=$(aChildName).getWidth();
				else
					w=v_width;
				if ( v_height == undefined )
					h=$(aChildName).getHeight();
				else
					h=v_height;
				
				var a=Math.round(parseInt($(aChildName).getOffsetParent().getHeight())/2);
				
				if (a == 0 )
				{
					// ie8 fix
					var a=Math.round(parseInt($(aChildName).parentNode.getHeight())/2);
					var d=Math.round(parseInt($(aChildName).parentNode.getWidth())/2);
				}
				else
				{
					 var a=Math.round(parseInt($(aChildName).getOffsetParent().getHeight())/2);
					 var d=Math.round(parseInt($(aChildName).getOffsetParent().getWidth())/2);
				}
				
				
				var b=Math.round(h/2);
				var c=a-b;
				var e=Math.round(w/2);
				var f=d-e;

				if ( (h < 30 ) || (w < 30) )
				{
					c=0;
					f=0;	
				}
				$(aChildName).style.top = c +"px";
				$(aChildName).style.left = f +"px";
				
			}
			
			afterPrepareShowListItem = function (aName, aIndex)
			{
				var elementId = aName + "_text_" +  aIndex;
				
				if ( $(elementId) != null )
				{
					var element = $(elementId);
					element.style.display = "none";
					element.style.visibility = "visible";
					//centerWindow (elementId, this.v_width, this.v_height);
					
					new Effect.Appear(elementId,{duration: 0.2, transition:Effect.Transitions.sinoidal});
				}
				else
					return false;
			}
		
			
			onCompleteLoadListItem = function (request, aName, aIndex)
			{
				//alert ( 'onCompleteLoadListItem ' + aName  + ' ' + aIndex);
				$(aName + "_text").innerHTML += request.responseText;
				afterPrepareShowListItem(aName, aIndex);
			}

			prepareShowListItem = function (aName, aIndex)
			{
				if ( $(aName + "_text_" + aIndex ) != null )
					 afterPrepareShowListItem(aName, aIndex);
				else
				{
					 var complete = this.onCompleteLoadListItem;
					 var url = "";
					 var pars = "?listcontent=1&menu=" + aName + "&index=" + aIndex ;
					 new Ajax.Request( url, { method: 'get', parameters: pars, onComplete:function(request) { complete.call(this,request, aName, aIndex); } } );		
				}
			}
			
			function listItem ( aName, aCaption, aInnerHtml, aSubtitle, v_width, v_height )
			{
				this.parentObject;
				this.name = aName;
				this.caption = aCaption;
				this.innerHtml = aInnerHtml;	
				this.itemIndex;
				this.height = 0;
				this.v_height = v_height;
				this.v_width = v_width;

				if (!aSubtitle)
					var aSubtitle ="";
				
				this.aSubtitle = aSubtitle;
							
				this.hideShowListItem = function ()
				{
					if ( this.parentObject.previousIndex == -1 )
					{
						var aName =  this.parentObject.name;
						var aIndex = this.itemIndex;
						prepareShowListItem(aName, aIndex);
					}
					else
					{
						var aName =  this.parentObject.name;
						var aIndex = this.itemIndex;
						//prepareShowListItem(aName, aIndex);
						
						
						new Effect.Fade(aName + "_text_" +  this.parentObject.previousIndex ,{duration: 0.2, transition:Effect.Transitions.sinoidal, afterFinish:function() { prepareShowListItem( aName, aIndex);}});	
						
					}
						
					
					/*
					element.parentNode.insertBefore(clone, element);
					clone.style.display = "block";
					clone.style.visibility = "visible";
					element.style.visibility = "hidden";
					*/
					
				}
				
				this.onClick = function (e)
				{
					e.preventDefault();
					this.changeListItem();
					return false;
				}
				
				this.changeListItem = function ()
				{	
					// google analystics
					_gaq.push(['_trackEvent', 'Lists', 'click', aMenu.itemSelectedName + this.name ]);

					if (  this.parentObject.selectedItem != this.itemIndex  ) 
					{
						this.parentObject.previousIndex = this.parentObject.selectedItem;
						if ( this.parentObject.previousIndex != -1)
						{
							$(this.parentObject.name + '_list_content_' + this.parentObject.previousIndex).className = "scrollable_list_item";
						}
						this.parentObject.selectedItem = this.itemIndex;
						$(this.parentObject.name + '_list_content_' + this.itemIndex).className = "scrollable_list_selected";
						this.hideShowListItem();
					}
					return false;
				}	
					
				this.setObserver = function ()
				{
					$(this.parentObject.name + '_list_content_' + this.itemIndex ).observe('click', this.onClick.bind(this) );			
				}
			}
						
			function list ( aListName, bShowTitle, viewNrOfItems, itemHeight )
			{
				this.position = 0;
				this.bstart = false;
				this.name = aListName;
				this.nrOfItems = 0;
				this.listItems = new Array();
				this.move = 0; // 0 = don't move, 1 = down, -1 = up
				this.bRunning = false;
				this.bInitialized = false;
				if ( viewNrOfItems != undefined )
					this.viewNrOfItems = viewNrOfItems;
				else
					this.viewNrOfItems = 6;
				this.totalHeight = 0;
				if ( itemHeight != undefined )
					this.itemHeight = itemHeight;
				else
					this.itemHeight = 0;
				this.selectedItem = -1;
				this.initialSelectedItem = 0;
				this.bDownHover = false;
				this.bUpHover = false;
				this.bShowTitle = bShowTitle;
				
												
				this.getTopPosition = function ()
				{
					return $(this.name + "_list_content").positionedOffset().top;				
				}
				
				this.addListItem = function ( aListItem ) {
					this.listItems[this.nrOfItems] = aListItem;
					this.listItems[this.nrOfItems].itemIndex = this.nrOfItems;
					this.listItems[this.nrOfItems].parentObject = this;
					this.nrOfItems++;
				}
				
				this.getItemByIndex = function (aIndex)
				{
					return this.listItems[aIndex];
				}
				
				this.setObservers = function () {
					 var index;
				 	 for (index=0;index<this.nrOfItems; index++)
				  	 {
				  		listItemObj = this.getItemByIndex(index);
						listItemObj.setObserver();
					 }
				}
				
				this.getScrollOffset = function ()
				{
					return this.itemHeight;
				}
				
				this.bUpHover = function()
				{
					return this.bUpHover;
				}
				
				this.bDownHover = function()
				{
					return this.bDownHover;
				}
				
				this.setUpHover = function()
				{
					this.bUpHover = true;
				}
				
				this.setDownHover = function()
				{
					this.bDownHover = true;
				}
				
				this.setUpNormal = function()
				{
					this.bUpHover = false;
				}
				
				this.setDownNormal = function()
				{
					this.bDownHover = false;
				}
				
				this.bUpEnabled = function()
				{
					// move
					//   -1: up, 1:down, 0: no move
					var scrollOffset = this.getScrollOffset();
					var topPosition = this.getTopPosition();

					return ( ( topPosition + scrollOffset ) <= 0  );
				}
				
				this.bDownEnabled = function()
				{
					// move
					//   -1: up, 1:down, 0: no move
					var scrollOffset = this.getScrollOffset();
					var topPosition = this.getTopPosition();

					return ( (topPosition - scrollOffset) >= -( this.totalHeight - this.viewHeight )  );
				}
	
				this.drawUpArrow = function ()
				{
					var aOpacity = 0;
					var aPointer = "pointer";
					
					if ( !this.bDownEnabled() && !this.bUpEnabled() )
					{
						aPointer = "default";
						//aOpacity = 0;
						aOpacity = 0.4;
					}
					else if ( this.bUpEnabled() )
					{ 
						aPointer = "pointer";
						if (this.bUpHover)
							aOpacity = 1.0;						
						else
							aOpacity = 0.4;
					}
					else
					{
						aPointer = "default";
						aOpacity = 0.1;
					}
					$(this.name + '_list_up').style.cursor = aPointer;
					new Effect.Opacity( this.name + '_list_up', { to: aOpacity, duration: 0.01 });
				}

				this.drawDownArrow = function ()
				{
					var aOpacity = 0;
					var aPointer = "pointer";
					
					if ( !this.bDownEnabled() && !this.bUpEnabled() )
					{
						aPointer = "default";
						//aOpacity = 0;
						aOpacity = 0.4;
					}
					else if ( this.bDownEnabled() )
					{ 
						aPointer = "pointer";
						if (this.bDownHover)
							aOpacity = 1.0;						
						else
							aOpacity = 0.4;
					}
					else
					{
						aOpacity = 0.1;
						aPointer = "default";
					}
					$(this.name + '_list_down').style.cursor = aPointer;
					new Effect.Opacity( this.name + '_list_down', { to: aOpacity, duration: 0.01 });
				}

				
				this.drawArrows = function ()
				{
					this.drawUpArrow ();
					this.drawDownArrow ();
				}
				
				this.clearListItem = function ()
				{
					var element = $(this.name + "_text");                
       			    
					element.innerHTML = "";
				}
				
				this.showList = function () {
					if ( !this.bInitialized )
					{
						  var innerHTML;
						  var index;
						  var listItemObj;
						  var theItemHeight=0;
						  
						  //$(this.name + "_list_content").style.top = "180px";;
						  $(this.name + "_list_content").style.overflowY = "visible";
						  $(this.name + "_list_content").style.overflowX = "visible";
						  
						  //$(this.name + "_list_content").innerHTML = "";
						  //this.clearListItem();
						  //$(this.name + "_list_content").style = "" ;

						  this.current = 0;
						  this.totalHeight = 0;
						  $(this.name + "_list_container").style.height = "0px"; 
						  for (index=0;index<this.nrOfItems; index++)
						  {
							$( this.name + "_list_content_"  + index).className = "scrollable_list_item";	
							listItemObj = this.getItemByIndex(index);
							var newdiv = document.createElement('div');
							newdiv.setAttribute('id', this.name + "_list_content_"  + index );
							newdiv.className = "scrollable_list_item";					
							//var a = document.createElement('a');
							//a.setAttribute( 'href', '#');
							//a.innerHTML = listItemObj.caption;
							//newdiv.appendChild(a);
							newdiv.innerHTML = listItemObj.caption;
							
							
							//$(this.name + "_list_content").appendChild(newdiv);
							
							if ( this.itemHeight != 0 )
								newdiv.style.height =  ( this.itemHeight ) + "px"; ;
								
							if ( this.itemHeight == 0 )
								listItemObj.height = $(this.name + "_list_content_"  + index).getHeight();
							else
								listItemObj.height = this.itemHeight;
							
							//listItemObj.height = $(this.name + "_list_content_"  + index).offsetHeight;
							if ( this.itemHeight == 0 ) 
							  this.totalHeight += listItemObj.height;
							else
							  this.totalHeight += ( this.itemHeight + 12 );
							
						  }
						  /*str = "";
						  str += " getHeight :" + $(this.name + "_list_content_"  + 0).getHeight() + "\n" ;
						  str += " innerHeight :" + $(this.name + "_list_content_"  + 0).innerHeight + "\n" ;
						  str += " height :" + $(this.name + "_list_content_"  + 0).height + "\n" ;
						  str += " clientHeight :" + $(this.name + "_list_content_"  + 0).clientHeight + "\n" ;
						  str += " scrollHeight :" + $(this.name + "_list_content_"  + 0).scrollHeight + "\n" ;
						  alert (str); */
						  if ( this.itemHeight == 0 ) 
							  this.itemHeight = listItemObj.height;
						  else
							  this.itemHeight = this.itemHeight + 12;
										
						 /*
						  if ( this.nrOfItems > 1 )
						  {
								// fix for ie 7 
								if 	( $(this.name + "_list_content_"  + 1).offsetTop < this.itemHeight )
									this.itemHeight = 	$(this.name + "_list_content_"  + 1).offsetTop;					
						  }
						  */
						  this.viewHeight = this.viewNrOfItems * ( this.itemHeight );
						  $(this.name + "_list_container").style.height = ( this.viewHeight ) + "px"; 
						  $(this.name + "_list_content").style.height = ( this.viewHeight ) + "px";
						  
						  this.setObservers();
						  
						  
						  new Effect.Move($(this.name + "_list_content"),{ x: 0, y: 0, duration: 0, mode:'absolute' });
						  
					  //this.listItems[0].showListItem();
						  this.bInitialized = true;
					}
					else
						this.setObservers();
				}

				this.scrollListItemsUp = function ()
				{
					this.scrollListItems ( true );
				}
			
				this.scrollListItemsDown = function ()
				{
					this.scrollListItems ( false );
				}
				
				this.stopScrollListItemsUp = function ()
				{
					this.stopScrollListItems();
				}
				
				this.stopScrollListItemsDown = function ()
				{
					this.stopScrollListItems();
				}

				
				this.prepare = function () {
					var myItemIndex; 
					var bInitial = false;
					bInitial = !this.bInitialized;
					bScroll = false;
					
					if ( this.nrOfItems == 1 )
					{
						hideDisplay(myList.name + '_list_up');
						hideDisplay(myList.name + '_list_down');
						this.listItems[0].prepareShowListItem();
						this.listItems[0].showListItem();
					} 
					else
					{
						showDisplay(myList.name + '_list_up');
						showDisplay(myList.name + '_list_down');
						//this.listItems[0].showListItem();
						this.showList();
						if ( aMenu.itemIndex != -1 )
						{
							bScroll = true;
							myItemIndex = aMenu.itemIndex;
							aMenu.itemIndex = -1;
						}
						else if ( bInitial )
						{
							bScroll = true;
							myItemIndex = this.initialSelectedItem;
						}
						else
							myItemIndex = this.selectedItem;
						if ( ( myItemIndex < 0 ) || ( myItemIndex > ( this.nrOfItems - 1)   ) ) 
						{
							bScroll = true;
							myItemIndex = 0;
						}
						this.listItems[myItemIndex].changeListItem();
												
						if ( bScroll )
						{
							if ( this.selectedItem > ( myList.viewNrOfItems - 1) ) 
							{
								//alert ( 'curr_item_index ' + curr_item_index );
								var scrollOffset = myList.getScrollOffset();
								var aMove = ( myList.viewNrOfItems -1 - this.selectedItem ) * scrollOffset;
								new Effect.Move($(myList.name + "_list_content"),{ x: 0, y: aMove, duration: 0, mode:'relative'});
							}
						}
						myList.start = true;
						myList.startScroll();
						$(myList.name + '_list_up').observe('mouseover', this.setUpHover.bind(this) );
						$(myList.name + '_list_down').observe('mouseover', this.setDownHover.bind(this) );
						$(myList.name + '_list_up').observe('mouseout', this.setUpNormal.bind(this) );
						$(myList.name + '_list_down').observe('mouseout', this.setDownNormal.bind(this) );

					
						$(this.name + '_list_up').observe('mousedown', this.scrollListItemsUp.bind(this) );
						$(this.name + '_list_down').observe('mousedown', this.scrollListItemsDown.bind(this) );
						$(this.name + '_list_up' ).observe('mouseup', this.stopScrollListItemsUp.bind(this) );
						$(this.name + '_list_down' ).observe('mouseup', this.stopScrollListItemsDown.bind(this) );
					}
				}
				
				this.setRunning = function () {
					this.bRunning = true;
				}
				
				this.setRunningOff = function () {
					this.bRunning = false;
				}
				
				this.stopScroll = function () {
					this.start = false;
				}
				
				this.startScroll = function () {
					
					var aMove = 0;
					
					if ( this.start )
					{
						this.drawArrows();
						if ( this.bRunning == false )
						{	
							if ( this.move != 0 )
							{
								var scrollOffset = this.getScrollOffset();
																	
								this.setRunning();
															  	
								if ( this.move == -1 )
								{
									//up
									if ( this.bUpEnabled()  )
										aMove = scrollOffset;
								}
								else 
								{
									//down
									if ( this.bDownEnabled() )
										aMove = -scrollOffset;
								}
								if ( aMove != 0 )
								{
									new Effect.Move($(this.name + "_list_content"),{ x: 0, y: aMove, duration: 0.25, mode:'relative', afterFinish:this.setRunningOff.bind(this), queue: { position: 'end', scope: 'scrolllist', limit:1 } });
								}
								this.setRunningOff();
							}
							

						}
						setTimeout( this.startScroll.bind(this), 20); 
					}
				}
		
				this.stopScrollListItems = function ()
				{
					//alert ( "[" + aListIndex + "]");
					this.move = 0;
				} 
			
				this.scrollListItems = function ( bUp)
				{
					//alert ( "[" + aListIndex + " ][" + bUp + "]");
					if (bUp)
						this.move = -1;
					else
						this.move = 1;
				}
			
			}
			
			function hide (id)
			{
				$(id).style.visibility = "hidden";
			}
			
			function show (id)
			{
				$(id).style.visibility = "visible";
			}
			function hideDisplay (id)
			{
				$(id).style.display = "none";
			}
			
			function showDisplay (id)
			{
				$(id).style.display = "block";
			}
			
			
			function closeWindow (aWindow)
			{
				if (typeof(myList) != "undefined" && myList != null )
					myList.stopScroll();
			}
			
			function prepareWindow( aWindow, myDuration )
			{
				if ( $("span_app_" + aWindow) == null )
				{
  					 var complete = this.onCompleteLoadWindow;
					 var url = "";
					 var pars = "?content=1&menu=" + aWindow;
					 var target = "span_app_" + aWindow;
					 new Ajax.Request( url, { method: 'get', parameters: pars, onComplete:function(request) { complete.call(this, request, aWindow, myDuration); } } );		
				}
				else
					AfterprepareWindow( aWindow, myDuration );
			}
			
			function onCompleteLoadWindow(request, aWindow, myDuration)
			{
				$("application_window").innerHTML += request.responseText;
				AfterprepareWindow(aWindow, myDuration);
			}
			
			function hideAllWindowsExcept ( aWindow )
			{
				$('application_window').childElements().each(function(index, element)
				{
					if ( index.id != aWindow )
					{
						hide( index.id );
						hideDisplay (index.id);
					}
				});
				
			}
			
			function AfterprepareWindow ( aWindow, myDuration )
			{					
				var myPage = null;
				
				
				if  ($("span_app_" + aWindow) != null )
				{
					// to make sure hide all others span_app's //
					hideAllWindowsExcept( "span_app_" + aWindow );
				
					hide("span_app_" + aWindow);
					showDisplay("span_app_" + aWindow);
					aItem = aMenu.getItemByName(aWindow);
					
					
					if ( aItem.hasList() )
					{
						myList = aItem.list;
						myList.prepare();
					}
					else 
					{
						myPage = aItem.page;
						myList = null;
						centerWindow ( aWindow + "_text", myPage.width, myPage.height);
					}
					hideDisplay("span_app_" + aWindow);
					show("span_app_" + aWindow);
					
					new Effect.Appear(  "span_app_" + aWindow, { duration:myDuration, queue: { position: 'end', scope: 'windows' }} );	
				}
			}
			
			function AfterFadeTransistionEffect( window1, window2, myDuration )
			{
				if  ($(window2) != null )
					closeWindow (window2) ;
				
				prepareWindow (window1, myDuration);
		
			}
			
			function doWindowsTransistionEffect( window1, window2, myDuration )
			{
				if ( $("span_app_" + window2) != null )
				{
					new Effect.Fade  (  "span_app_" + window2, { duration:myDuration, afterFinish:function(){ AfterFadeTransistionEffect( window1, window2, myDuration ); }, queue: { scope: 'windows' } } ); 
				}
				else
					AfterFadeTransistionEffect( window1, window2, myDuration );
			}
			
			function menuSelect()
			{ 
				var myDuration = 0.2;
	
				prev_window = aMenu.previousItemSelectedName;
				curr_window = aMenu.itemSelectedName;
				
				if ( curr_window != prev_window )
				{
					// google analystics
					_gaq.push(['_trackEvent', 'Menus', 'click', curr_window]);
					
					doWindowsTransistionEffect( curr_window, prev_window, myDuration );
					var aItem = aMenu.getItemByName(curr_window);
					if (aItem.caption == "none")
						changeTitle( globalTitle );
					else
						changeTitle( globalTitle + ' ' +  aItem.caption  );
				}
				return false;
			} 
		
			function Initialize()	
			{	
			   if (!bReload)
			   {
			   		prepareWindow( aMenu.itemSelectedName );
					showDisplay( "span_app_" + aMenu.itemSelectedName );
					show( "span_app_" + aMenu.itemSelectedName );
			   }
			   else
			   {
				   	hideDisplay ("main_window");
			   		prepareWindow( aMenu.itemSelectedName );
			   		showDisplay( "span_app_" + aMenu.itemSelectedName );
			   		show( "span_app_" + aMenu.itemSelectedName );
			   		showDisplay ("main_window");
			   		show ("main_window");
			   		new Effect.SlideDown("main_window", {duration:2});
			   }
			   //else
			   	//	new Effect.SlideDown("main_window", {duration:0});
			}
			
			document.observe("dom:loaded", Initialize );

