window.addEvent('domready', function()
{
	if (el = $('content'))
	{
		el.fxOpen = new Fx.Morph(el, {
			 duration: 1000
			,transition: Fx.Transitions.Bounce.easeOut
		});
		el.fxClose = new Fx.Morph(el, {
			 duration: 500
			,transition: Fx.Transitions.Back.easeIn
		});
		
		
		
		$$('a.aj_f').each(function(el)
		{
			el.Content = this.content;
			el.addEvents({
				'click': function(e)
				{
				 if($('ch_status').innerHTML != this.innerHTML){
				    $('ch_status').innerHTML = this.innerHTML;
					e.preventDefault();
					this.Content.fxClose.start({
						 height: 0
						,opacity: 0
					}).chain(function()
					{
						    new Request({
							   url: this.href
							  ,evalScripts: true
							  ,onComplete: function(resp)
								{
									this.Content.set('html', resp);
									this.Content.fxOpen.start({
									 height: 380
									,opacity: 0.97
									})
								}.bind(this)
							}).send();
		
					}.bind(this))
					
				 }
				  else {
				   e.preventDefault();
				   this.Content.fxClose.start({
						 height: 0
						,opacity: 0
					});
				   $('ch_status').innerHTML = 'false';
				  }
				}.bindWithEvent(el)
			});
		}.bind({content: el}));
	}
	
	
	$('underground').onkeydown = function(e) {
	    
		akU = parseInt($('aktUC').get('text'));
	    var dir = (e ? e : event).keyCode;
	    if(dir == 38)
	    {
	    	if(akU == 8)
	    		akU--;
	    	newA = akU - 1;
	    	
	    	if(akU > 1)
	    	{
	    	 updateSelF('Underground '+newA, 'http://s'+newA+'.speed4life.de', newA)
	    	} 
	    }
	    if(dir == 40)
	    {
	    	if(akU == 6)
	    		akU++;	    	
	    	newA = akU + 1;
	    	
	    	if(akU < 9)
	    	{
	    	 updateSelF('Underground '+newA, 'http://s'+newA+'.speed4life.de', newA)
	    	} 
	    }
	}
	
});


var opened = false;
function showValues(){
	if(!opened) {
	    $('sel_under').setOpacity(0.8);
		$('sel_under').setStyle('display', 'block');
		opened = true;
	}
	else {
		$('sel_under').setStyle('display', 'none');
		opened = false;
	}
}
function updateSelF(val, addy, nn){
	$('loginform').action = addy + '/vers3/index.php?actionl=login';
	$('underground').value = val;
	$('aktUC').set('text', nn);
	$('sel_under').setStyle('display', 'none');
	opened = false;
}
