var SBDialog
var SpielerDialog
var winKontaktDialog = null;
var winpdf
var TagDialog

function CloseWindows()
{
	if ( SBDialog )         { SBDialog.close();}
	if ( SpielerDialog )    { SpielerDialog.close();}
	if ( winKontaktDialog ) { winKontaktDialog.close();}
	if ( winpdf )           { winpdf.close();}
	if ( TagDialog )        { TagDialog.close();}
}

function openSpielerDialog(p_SPLID,p_SubMenu)
{

	if (!SpielerDialog|| SpielerDialog.closed)
		{
		}
	else
		{
		SpielerDialog.focus();
		SpielerDialog.close();
		}
	SpielerDialog = window.open("/whois/spieler/spieler.php?SPLID=" + p_SPLID + "&SUBMENU=" + p_SubMenu,"SpielerDialog","dependent=no,width=836,height=500");
	SpielerDialog.focus();
	SpielerDialog.moveTo(25,25);
}


function openSBDialog(p_PARID)
{
	if (!SBDialog|| SBDialog.closed)
		{
		}
	else
		{
		SBDialog.focus();
		SBDialog.close();
		}

	SBDialog = window.open("/liga/paarungen/spielbericht.php?PARID=" + p_PARID,"SBDialog","dependent=no,resizable=no,width=600,height=640,Scrollbars");
	SBDialog.focus();
	SBDialog.moveTo(250,25);
}

function openwinKontaktDialog(Name, Art, Kontakt)
	{
	if (winKontaktDialog != null)
		{
		winKontaktDialog.close();
		}
	    var tooltip = open('', '', 'width=200' + ',height=30');
        winKontaktDialog = tooltip;
        winKontaktDialog.document.open();
        winKontaktDialog.document.writeln('<html><head><title>Kontakt Info</title></head><link rel="stylesheet" type="text/css" href="/css/style_main.css"><body class="normal">');
        winKontaktDialog.document.writeln('<p>' + Name + '<br>'  + Art + '<br>' + Kontakt + '</p>');
        winKontaktDialog.document.writeln('</body></html>');
        winKontaktDialog.document.close();
        winKontaktDialog.moveTo(400,200);
        winKontaktDialog.focus();
	}


function openTagDialog(MANID_HEIM, MANID_GAST)
{
  if (!TagDialog|| TagDialog.closed)
		{
		}
	else
		{
		TagDialog.focus();
		TagDialog.close();
		}

	TagDialog = window.open("/liga/tabelle/team_vergleich.php?MANID_HEIM=" + MANID_HEIM + "&MANID_GAST=" + MANID_GAST,"TagDialog","dependent=no,resizable=yes,width=850,height=480,Scrollbars");
	TagDialog.focus();
	TagDialog.moveTo(5,180);
	}


function ShowPdf(pdf)
{
	if (!winpdf || winpdf.closed)
		{
		}
	else
		{
		winpdf.focus();
		winpdf.close();
		}

	winpdf = window.open(pdf,"winpdf","dependent=no,resizable=yes,Scrollbars");
	winpdf.focus();
	winpdf.moveTo(0,0);

}

function setFooter()
	{
   	if (document.getElementById)
    	{
        var windowHeight = getWindowHeight();
        var windowWidth = getWindowWidth();
        if (windowHeight > 0)
        	{
            var contentHeight = document.getElementById('content').offsetHeight;
            var footerElement = document.getElementById('footer');
            var footerHeight  = footerElement.offsetHeight;
            var foottableElement = document.getElementById('foottable');
            var footerWidth  = foottableElement.offsetWidth;

            if (windowHeight - (contentHeight + footerHeight) >= 0)
                {
                footerElement.style.position = 'absolute';
                footerElement.style.top = (windowHeight - footerHeight) + 'px';
                footerElement.style.left = (windowWidth - footerWidth)/2 + 'px';
                }
            else
                {
                footerElement.style.position = 'static';
                }
            }
		}
	}

function getWindowHeight() {
    var windowHeight = 0;
    if (typeof(window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        }
        else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}

function getWindowWidth() {
    var windowWidth = 0;
    if (typeof(window.innerWidth) == 'number') {
        windowWidth = window.innerWidth;
    }
    else {
        if (document.documentElement && document.documentElement.clientWidth) {
            windowWidth = document.documentElement.clientWidth;
        }
        else {
            if (document.body && document.body.clientWidth) {
                windowWidth = document.body.clientWidth;
            }
        }
    }
    return windowWidth;
}


function Insert_Smilie(Smilie)
{
	document.GB.GB_EINTRAG.value += " "+Smilie;
	document.GB.GB_EINTRAG.focus();
}
