window.addEvent('domready', function() { 
	
	
	var tepEl = $('pan');
	var menuSwitchEl = $('menu-switch');
	if (menuSwitchEl && tepEl ){
		
		tepEl.setStyles({ overflow:'hidden' });
		tepEl.origHeight = tepEl.getStyle('height');
		tepEl.origWidth = tepEl.getStyle('width');
		
		menuSwitchEl.closeIt = function(){
			tepEl.morph({ height: 0, width: 0});
			menuSwitchEl.setStyles( {'background-image': 'url(fileadmin/tmpl/images/arrow_down.png)'});
			Cookie.write('panStatus','closed', { path:'/' });
		};
		menuSwitchEl.openIt = function(){
			tepEl.morph({ height: tepEl.origHeight, width: tepEl.origWidth});
			menuSwitchEl.setStyles( {'background-image':'url(fileadmin/tmpl/images/arrow_up.png)'});
			Cookie.write('panStatus','open', { path:'/' });
		};
		
		if (Cookie.read('panStatus')=='closed') { 
			menuSwitchEl.closeIt.delay(1000);
		}
		
		menuSwitchEl.addEvent('click',function(event){
			event.stop()
			if (Cookie.read('panStatus')!='closed') {
				menuSwitchEl.closeIt();
			} else {
				menuSwitchEl.openIt();
			}
		});
		

		
	}
	
	
	//-----------------------------------
	

});