var fade_timer
var fading = false;
var fade_timer;

function popUp(popupURL)
{
      width = 700;height = 550;leftPosition = (screen.width) ? (screen.width-width)/2 : 0;
      if (screen.height && (screen.height <= 600)) {topPosition = 0;} else {topPosition = (screen.height) ? (screen.height-height)/2 : 0;}
      var settings='width='+width+',height='+height+',left='+leftPosition+',top='+topPosition+'toolbar=0,location=0,directories=0,menubar=0,scrollbar=0,resizable=0,status=0';
      var popup=window.open(popupURL, 'gamepopup', settings);popup.focus();
}


function fadein(args)
{
	fading=false;
	document.getElementById('gameregteaser').style.display='block';
}

function fadeout(args)
{
	if (args != true)
	{
		fading = true;
		window.clearTimeout(fade_timer);
		fade_timer = window.setTimeout("fadeout(true)",200);		
	}
	else
	{
		if (fading == true)
		{
			document.getElementById('gameregteaser').style.display='none';
			fading = false;
		}
	}
}

//Mit dieser Funktion wird ein Zufallswert und an den Namen des PopUp gehängt
//Damit wird beim erneuten Aufruf der Funktion ein neues Fenster erstellt und  
//nicht das alte überschrieben
function gamePopup(link, game)
{
	rand = Math.random() * 9999;
	gameRand = game + parseInt(rand);
	var window = openPopup(link, gameRand , 'status=no,resizable=no,scrollbars=no' , '1010' , '700');
}
