
window.addEvent('domready', function(){
var isSlid=false;
var isopen = false;
	// Second Example
			var InitialHeight = $("DepartementDiv").getStyle("height");
			InitialHeight = InitialHeight.replace("px","")
			InitialHeight = parseInt(InitialHeight);
			
		//	document.getElementById('overflowhidden').style.height =InitialHeight ;
			InitialHeight = 350
			
			//InitialHeight = 185
//			//$('DepartementDiv').setStyle("height", "0px");
//
//	// The same as before: adding events
	$('OurDepartment').addEvents({
		'mouseenter': function(){
			
			document.getElementById('depImage').src = 'images/departement_all_selected.png';
			//document.getElementById('depImage').style.display = 'block'
//			//changeheight();
//			//$('myOtherElement').set('tween', {
////				duration: 1000,
////				bounce: Fx.Transitions.Bounce.out // This could have been also 'bounce:out'
////				
////			}).tween('height', '280px');
////			//document.getElementById('myOtherElement').style.width="1000px";
//				
//			//	alert(InitialHeight);
				var exampleFx = new Fx.Morph('DepartementDiv', {
						duration: 500,
						onComplete: function(){
                //and here we apply the highlight effect on complete
	        										//alert('df')
										isSlid=false;
										isopen = true;
									}

					});
				if (!isSlid & !isopen){
					isSlid=true;
					exampleFx.start({
						'opacity':[0,1],
						//'width':[0,600],
						//'width':[0,362],
						'height':[0,InitialHeight]
						//'top':[posy,posy-407],
						//'left':[posx,100]
						
						//'display:'block
						
						
					});	

				}
		}
	});
		$('OurDepartment').addEvents({
		'mouseleave': function(){
			
			// Resets the tween and changes the element back to its original size
		var exampleFx = new Fx.Morph('DepartementDiv', {
						duration: 500,
						onComplete: function(){
                //and here we apply the highlight effect on complete
	        										//alert('df')
										isSlid=false;
										isopen=false;
										document.getElementById('depImage').src = 'images/departement_all.png';
									}

					});
				
				if (!isSlid & isopen){
					isSlid=true;
					exampleFx.start({
									
						'opacity':[1,0],
						//'width':[0,362],
						//'width':[600,0],
						'height':[InitialHeight,0]
						//'top':[posy,posy-407],
						//'left':[posx,100]
						
						//'display:'block
						
						
					});	
				}
		}
	});
		
		
//		
//	$('OurDepartment').addEvents({
//		'mouseenter': function(){
//			//changeheight();
//			document.getElementById('DepartementDiv').style.visibility ='visible';
//			$('DepartementDiv').set('tween', {
//				duration: 1000,
//				bounce: Fx.Transitions.Bounce.out // This could have been also 'bounce:out'
//				
//			}).tween('height', InitialHeight);
//			//document.getElementById('myOtherElement').style.width="1000px";
//		}
//	});
//		$('DepartementDiv').addEvents({
//		'mouseleave': function(){
//			// Resets the tween and changes the element back to its original size
//			this.set('tween', {}).tween('height', '1px');
//			document.getElementById('DepartementDiv').style.visibility ='hidden';
//
//		}
//		
//	});


});

//function CloseMenu(id){
//		$(id).addEvents({
//		'mouseenter': function(){
//			// Resets the tween and changes the element back to its original size
//			myOtherElement.set('tween', {}).tween('height', '38px');
//		}
//	});
//
//	}
	
//function ChangeDiv(){
//			document.getElementById('BorderId').src='images/LeftPicB.jpg';
//	
function ExpandtopMenu(divAction){
	
					var exampleFx = new Fx.Morph(divAction, {
						duration: 500,
						onComplete: function(){
                //and here we apply the highlight effect on complete
	        										//alert('df')
										//isSlid=false;
										//isopen = true;
										
									},
						onStart: function(){
										document.getElementById(divAction).style.visibility = 'visible'
									}
				

					});
					
					exampleFx.start({
									
						//'opacity':[0,0.9],
						//'width':[0,362],
						//'width':[600,0],
						'height':[1,100]
						//'top':[posy,posy-407],
						//'left':[posx,100]
						
						//'display:'block
						
						
					});	
	
	
	}
function HidetopMenu(divAction){
	
					var exampleFx = new Fx.Morph(divAction, {
						duration: 500,
						onComplete: function(){
                //and here we apply the highlight effect on complete
	        										//alert('df')
										isSlid=false;
										isopen = true;
										document.getElementById(divAction).style.visibility ='hidden'
									}

					});
					
					exampleFx.start({
									
						//'opacity':[0.9,0],
						//'width':[0,362],
						//'width':[600,0],
						'height':[100,1]
						//'top':[posy,posy-407],
						//'left':[posx,100]
						
						//'display:'block
						
						
					});	
	
	
	}
	
simplePreload('images/departement_all.png', 'ar/images/departement_all.png','images/aboutUs_no.png','ar/images/aboutUs_no.png','images/aboutUs_selected.png','ar/images/aboutUs_selected.png','images/visitor_no.png','ar/images/visitor_no.png','images/visitor_selected.png','ar/images/visitor_selected.png'); 

function simplePreload()

{ 

  var args = simplePreload.arguments;

  document.imageArray = new Array(args.length);

  for(var i=0; i<args.length; i++)

  {
	  
	  //alert(imageArray[i])
    document.imageArray[i] = new Image;

    document.imageArray[i].src = args[i];

  }

}
function changeClass(id,thiscalss){

document.getElementById(id).className = thiscalss;	
	alert(thiscalss)	
}


function closeMenu(id) {
	 $('myOtherElement'+id).set('tween', {}).tween('height', '0px');
}
function OpenMenu(id) {
	
//	         for (i=1;i<=3;i++) {
//			     closeMenu(i);	 
//			 }
			
	 		$('myOtherElement'+id).set('tween', {
				duration: 1000,
				bounce: Fx.Transitions.Bounce.out // This could have been also 'bounce:out'
			}).tween('height', '36px'); 
			 
}
function CloseAll() {
	for (i=1;i<=2;i++) {
			     closeMenu(i);	 
			 }
}
