var x=0;
var left=0;
var right=0;
var menu="";
var fly="";

function hide_glow()
{
  $('#flyhigh').hide();
}

function bewege_glow(Ereignis)
{                       
  if (!Ereignis) Ereignis = window.event;
  x = Ereignis.screenX;
  
  if(x < left + 35) x = left + 35;
  if(x > right - 10) x = right - 10;
  
  opLeft = left + 35;
  opRight = right - 68;
  
  opMiddle = ((opRight - opLeft) / 2);
  
  opVar = 1 - ((Math.abs(opMiddle - (x - opLeft)) / (opMiddle / 100)) / 100 );
  
  opVar = Math.round(opVar * 100) / 100;
   
 	$('#flyhigh').css({'left' : (x-10) + "px"});
 	$('#flyhigh').fadeTo(0, opVar);
 	//$('#flyhigh').css({'border' : "1px solid red"});
  
  if(Ereignis.screenX < left){
		hide_glow();
		console.log("kleiner");
	}
  if(Ereignis.screenX > right){
	 	hide_glow();
		console.log("größer");	
	}
}

function set_glow(Ereignis, wert)
{  
  if (!Ereignis) Ereignis = window.event;
  x = Ereignis.screenX;

  $('#flyhigh').css({'left' : wert + "px"}); 
  $('#flyhigh').fadeTo(0, 1);
}

function config_variables()
{  
	left = $('#menu').offset().left; 
	right = left + 992;
}