window.addEvent('domready', function() {
var hhh = window.getSize();
var what =(hhh.y-400)/2;
var altwhat= what+100;
$('bg_image').style.height=hhh.y-what + "px";
$('bg_image').style.paddingTop=what + "px";
$('home').style.top=altwhat-what+2 + "px";
$('portofoliu').style.top=altwhat-what+2 + "px";
$('despre').style.top=-what + "px";
$('contact').style.top=-what + "px";
$$('#meniu a').each(function(item,index)
				{
				   item.addEvents({
							mouseenter: function()
								{
									 this.set('tween', {
											  duration: 200	
											  }).tween('background-color', '#000', '#fFF').tween('background-color', '#fff', '#921b39');
								},
							mouseleave: function()
								{
									
									this.set('tween', {}).tween('background-color', '#921b39', '#1e030a');
								},
							'click': function()
								{
									var care =this.className;
									var unde = this.id;
									
									$$('#container div.categorie').each(function(ce,cand)
									{
										if(care==ce.id) { ce.scrollTo(0,0); ce.style.overflow='hidden'; }
										else {
											
										ce.style.visibility='hidden';
										ce.style.height='20px';
										ce.style.overflow='hidden';
										ce.scrollTo(0,0);
										}
										
									});
									
									if(unde=="rightbot")
									{   
									   if($(care).style.visibility=="visible")
									   {
										//$(care).style.visibility="hidden"; 
										 var altavariabilacanumaistiusalezic = altwhat-what+2;
										$(care).style.overflow='hidden';
									var myEffect = new Fx.Morph(care, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
											myEffect.start({
														    'height': 20,
															'top':altwhat-what+2
														  
												  		  }).chain((
																	function(){
																		myEffect.start(
																					   {
																						  'width': [378, 0] 
																					    })
																		})
														           ).chain((
																			function(){
																				myEffect.start(
																							   {
																								   'visibility': 'hidden'
																								   
																							   })
																				       })
																           );
									   }
									   else
									   {
										   //alert($(care).style.visibility);
									    var altavariabilacanumaistiusalezic = altwhat-what+2;
										$(care).style.top=altavariabilacanumaistiusalezic + "px";
									var myEffect = new Fx.Morph(care, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
									myEffect.start({
												   'visibility': 'visible', //Morphs the 'height' style from 10px to 100px.
												   'width': [0, 378]  //Morphs the 'width' style from 900px to 300px.
												   }).chain((function(){myEffect.start({'height': 378,'top':[altwhat-what+2,altwhat-what-150]})})).chain((function(){myEffect.start({'overflow': "auto"})}));
									   }}
									else if(unde=="leftbot")
									{ if($(care).style.visibility=="visible")
									   {
										//$(care).style.visibility="hidden"; 
										 var altavariabilacanumaistiusalezic = altwhat-what+2;
										$(care).style.overflow='hidden';
									var myEffect = new Fx.Morph(care, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
											myEffect.start({
														    'height': 20,
															'top':altwhat-what+2
														  
												  		  }).chain((
																	function(){
																		myEffect.start(
																					   {
																						  'width': [378, 0] ,
																						  'left':[0,378]
																					    })
																		})
														           ).chain((
																			function(){
																				myEffect.start(
																							   {
																								   'visibility': 'hidden'
																								   
																							   })
																				       })
																           );
									   }
									   else
									   {
										 var altavariabilacanumaistiusalezic = altwhat-what+2;
										$(care).style.top=altavariabilacanumaistiusalezic + "px";
										var myEffect = new Fx.Morph(care, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
									myEffect.start({
												   'visibility': 'visible', //Morphs the 'height' style from 10px to 100px.
												   'width': [0, 376],  //Morphs the 'width' style from 900px to 300px.
												   'left':[378,0]
												   }).chain((function(){myEffect.start({'height': 378,'top':[altwhat-what+2,altwhat-what-150]})})).chain((function(){myEffect.start({'overflow': "auto"})}));
									
									   }}
									else if(unde=="righttop")
									{
										if($(care).style.visibility=="visible")
									   {
										//$(care).style.visibility="hidden"; 
										 var altavariabilacanumaistiusalezic = altwhat-what+2;
										$(care).style.overflow='hidden';
									var myEffect = new Fx.Morph(care, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
											myEffect.start({
														    'height': 20,
															'top':0
														  
												  		  }).chain((
																	function(){
																		myEffect.start(
																					   {
																						  'width': [378, 0] 
																					    })
																		})
														           ).chain((
																			function(){
																				myEffect.start(
																							   {
																								   'visibility': 'hidden'
																								   
																							   })
																				       })
																           );
									   }
									   else
									   {
										$(care).style.top="0px";
										this.style.backgroundColor="#921b39"
									var myEffect = new Fx.Morph(care, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
									myEffect.start({
												   'visibility': 'visible', //Morphs the 'height' style from 10px to 100px.
												   'width': [0, 378]  //Morphs the 'width' style from 900px to 300px.
												   }).chain((function(){myEffect.start({'height': 378, 'top':[0,-50]})})).chain((function(){myEffect.start({'overflow': "auto"})}));
									   }}
									else if(unde=="lefttop")
									{ 
									 if($(care).style.visibility=="visible")
									   {
										//$(care).style.visibility="hidden"; 
										 var altavariabilacanumaistiusalezic = altwhat-what+2;
										$(care).style.overflow='hidden';
									var myEffect = new Fx.Morph(care, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
											myEffect.start({
														    'height': 20,
															'top':0
														  
												  		  }).chain((
																	function(){
																		myEffect.start(
																					   {
																						  'width': [378, 0], 
																						  'left':[0, 378]
																					    })
																		})
														           ).chain((
																			function(){
																				myEffect.start(
																							   {
																								   'visibility': 'hidden'
																								   
																							   })
																				       })
																           );
									   }
									   else
									   {
									   $(care).style.top="0px";
										var myEffect = new Fx.Morph(care, {duration: '500', transition: Fx.Transitions.Sine.easeOut});
									myEffect.start({
												   'visibility': 'visible', //Morphs the 'height' style from 10px to 100px.
												   
												   'width': [0, 376],  //Morphs the 'width' style from 900px to 300px.
												   'left':[378,0]
												   }).chain((function(){myEffect.start({'height': 378,'top':[0,-50]})})).chain((function(){myEffect.start({'overflow': "auto"})}));
									   }}

								}
				                });

				  

				});

});