window.addEvent("domready",function(){
	var panel = document.id('adminfooter');
	if (panel) {
		panel.setStyle('visibility','visible');
		var slideFx = new Fx.Tween(panel,{link:'wait'});
		var opacityFx = new Fx.Tween(panel,{link:'cancel',duration:1000});
		var panelStatus = ((Cookie.read('adminpanel_open') == 'true') ? true:false);
		var panelHeight = panel.getSize().y.toInt();
		var openThing = panelStatus;
		var thingByF2 = false;
		(panelStatus ? document.id(document.body).setStyle('marginBottom',panelHeight) : document.id(document.body).setStyle('marginBottom',0));
		panel.store('open',panelStatus).setStyles({
			'bottom':((panelStatus) ? 0 :(-1 * panelHeight))/*,
			'opacity':((panelStatus) ? 1 :.01)*/
		}).addEvents({
			'mouseenter':function(){
				/*opacityFx.start('opacity',1);*/
			},
			'mouseleave':function(){
				if (this.retrieve('open') == false){
					/*if (this.thingByF2 == false) {
						opacityFx.start('opacity',.01);
					} else {
						opacityFx.start('opacity',1);
					}*/
				}
			},
			'click':function(e){
				/*if (!this.getParent('ul')) {
					if (this.retrieve('open') == false){
						Cookie.write('adminpanel_open', true,{domain: window.location.host,path:'/'});
						this.store('open',true);
						document.body.tween('marginBottom',[panelHeight]);
						slideFx.start('bottom',[0]);
						this.openThing = true;
						this.thingByF2 = false;
					} else {
						Cookie.write('adminpanel_open', false,{domain: window.location.host,path:'/'});
						this.store('open',false);
						document.body.tween('marginBottom',[0]);
						slideFx.start('bottom',[(-1 * panelHeight)+12]);
						this.openThing = false;
						this.thingByF2 = false;
					}
				}*/
			}
		});
		document.addEvent(
			'keydown',function(evt){ 
				var panelStatus2 = ((Cookie.read('adminpanel_open') == 'true') ? true:false);
				if (evt.key == 'f2' || evt.code == 192) {
					if (!openThing) {
						Cookie.write('adminpanel_open', true,{domain: window.location.host,path:'/'});
						document.body.tween('marginBottom',[panelHeight]);
						slideFx.start('bottom',[0]);
						openThing = true;
						thingByF2 = true;
					} else {
						Cookie.write('adminpanel_open', false,{domain: window.location.host,path:'/'});
						document.body.tween('marginBottom',[0]);
						slideFx.start('bottom',[(-1 * panelHeight)]);
						openThing = false;
						thingByF2 = true;
					}
				}
			}
		);
	}
});
