// <script>

// Copyright (C) 2005 Ilya S. Lyubinskiy. All rights reserved.
// Technical support: http://www.php-development.ru/
//
// YOU MAY NOT
// (1) Remove or modify this copyright notice.
// (2) Distribute this code, any part or any modified version of it.
//     Instead, you can link to the homepage of this code:
//     http://www.php-development.ru/javascripts/dropdown.php.
//
// YOU MAY
// (1) Use this code on your website.
// (2) Use this code as a part of another product provided that
//     its main use is not creating javascript menus.
//
// NO WARRANTY
// This code is provided "as is" without warranty of any kind, either
// expressed or implied, including, but not limited to, the implied warranties
// of merchantability and fitness for a particular purpose. You expressly
// acknowledge and agree that use of this code is at your own risk.


// ----- Popup Control ---------------------------------------------------------

function at_display(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ----- Show Aux -----

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  //c.style.top        = top +'px';
  //c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ----- Show -----

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

// ----- Hide -----

function at_hide()
{
  var c = document.getElementById(this["at_child"]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

// ----- Click -----

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible")
       at_show_aux(p.id, c.id);
  else c.style.visibility = "hidden";

  return false;
}

// ----- Attach -----

// PARAMETERS:
// parent   - id of visible html element
// child    - id of invisible html element that will be dropdowned
// showtype - "click" = you should click the parent to show/hide the child
//            "hover" = you should place the mouse over the parent to show
//                      the child
// position - "x" = the child is displayed to the right of the parent
//            "y" = the child is displayed below the parent
// cursor   - Omit to use default cursor or check any CSS manual for possible
//            values of this field

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}

//////// AJAX FOR TEAMCHANGE


var xmlHttp

function changeteam(str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="includes/changeteam.php"
	url=url+"?id="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedteam 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChangedteam() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("teamchange").innerHTML=xmlHttp.responseText 
	} 
}
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
	}
	return xmlHttp;
}

// ###################################
// ######## Wichtige g4g Popups ######
// ###################################



var win=null;
function training()
{
	myleft=20;
	mytop=20;
	settings="width=920,height=600,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("includes/training.php","training",settings);
	win.focus();
}

var win=null;
function vorschau(gameid)
{
	myleft=20;
	mytop=20;
	settings="width=800,height=550,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("includes/vorschau.php?gid=" + gameid + "","vorschau",settings);
	win.focus();
}
var win=null;
function analyse(gameid)
{
	myleft=20;
	mytop=20;
	settings="width=800,height=550,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("includes/analyse.php?gid=" + gameid + "","vorschau",settings);
	win.focus();
}
var win=null;
function taktiktisch(gameid)
{
	myleft=20;
	mytop=20;
	settings="width=1300,height=550,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("includes/aufstellung.php?gid=" + gameid + "","aufstellung",settings);
	win.focus();
}

var win=null;
function ticker(gameid,rootpath)
{
	myleft=20;
	mytop=20;
	if(rootpath==1){rootpath="../";}else{rootpath="./";}
	settings="width=900,height=550,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open(rootpath+"ticker.php?gid=" + gameid + "","ticker",settings);
	win.focus();
}

var win=null;
function aufgebot()
{
	myleft=20;
	mytop=20;
	settings="width=900,height=750,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("templates/aufgebot.php","Aufgebot",settings);
}
var win=null;
function player(playerid,rootpath)
{
	myleft=20;
	mytop=20;
	if(rootpath==1){rootpath="../";}else{rootpath="./";}
	settings="width=640,height=600,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open(rootpath+"showplayer.php?id=" + playerid + "","" + playerid + "",settings);
	win.focus();
}
var win=null;
function insidegroupware()
{
	myleft=20;
	mytop=20;
	settings="width=1000,height=500,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("inside.php","inside",settings);
	win.focus();
}
var win=null;

function tutorial()
{
	myleft=20;
	mytop=20;
	settings="width=1000,height=500,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("inside.php?mode=tutorial","inside",settings);
	win.focus();
}
var win=null;
function newpm(user)
{
	myleft=20;
	mytop=20;
	settings="width=1000,height=500,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("inside.php?mode=newmessage&user=" + user +"","inside",settings);
	win.focus();
}
var win=null;
function immobilie(immobid)
{
	myleft=20;
	mytop=20;
	settings="width=640,height=480,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("includes/immob/changeimmob.php?id=" + immobid +"","mypopup",settings);
	win.focus();
}
var win=null;
function pokal(country)
{
	myleft=20;
	mytop=20;
	settings="width=800,height=550,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("includes/cup.php?country=" + country + "","pokalu",settings);
	win.focus();
}
var win=null;
function beobbericht(gameid,rootpath)
{
	myleft=20;
	mytop=20;
	if(rootpath==1){rootpath="../";}else{rootpath="./";}
	settings="width=640,height=200,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open(rootpath+"includes/beobachter/spielbericht.php?gid=" + gameid + "","" + gameid + "",settings);
	win.focus();
}
var win=null;
function mitarbeiter(mid)
{
	myleft=20;
	mytop=20;
	settings="width=400,height=300,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("includes/team/mitarbeiter/mitarbeiter_info.php?id=" + mid + "","Mitarbeiter",settings);
	win.focus();
}
var win=null;
function help(text)
{
	myleft=20;
	mytop=20;
	settings="width=896,height=600,top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("help/index.php?id=" + text + "","Manual",settings);
	win.focus();
}
var win=null;
function zeitung(id)
{
	myleft=20;
	mytop=20;
	settings="width=896,height=600,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	if(id==undefined){
		win=window.open("includes/zeitung.php","Zeitung",settings);
	}else{
		win=window.open("includes/zeitung.php?id=" + id + "","Zeitung",settings);
	}
	win.focus();
}
var win=null;
function spielertausch(tid)
{
	myleft=20;
	mytop=20;
	settings="width=920,height=600,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open("includes/spielertausch.php?tid="+tid+"","training",settings);
	win.focus();
}