var popup=null;

function OpenTeamanmeldung(){
	var win=null;
	var w=1000;
	var h=700;
	var infocus="front";
	var myleft=null;
	var mytop=null;
	var url="http://www.bit-liga.de/Teamanmeldung.html";
	var csLeer="";
	var myleft=(screen.width)?(screen.width-w)/2:100;
	var mytop=(screen.height)?(screen.height-h)/2:100;
	var settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes";
	win=window.open(url,csLeer,settings);
	win.focus();
}
function OpenDartTurniere(){
	var win=null;
	var w=800;
	var h=600;
	var infocus="front";
	var myleft=null;
	var mytop=null;
	var url="http://www.bit-liga.de/turniere/dartturniere.html";
	var csLeer="";
	var myleft=(screen.width)?(screen.width-w)/2:100;
	var mytop=(screen.height)?(screen.height-h)/2:100;
	var settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";
	win=window.open(url,csLeer,settings);
	win.focus();
}
function OpenKickerTurniere(){
	var win=null;
	var w=800;
	var h=600;
	var infocus="front";
	var myleft=null;
	var mytop=null;
	var url="http://www.bit-liga.de/turniere/kickerturniere.html";
	var csLeer="";
	var myleft=(screen.width)?(screen.width-w)/2:100;
	var mytop=(screen.height)?(screen.height-h)/2:100;
	var settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";
	win=window.open(url,csLeer,settings);
	win.focus();
}
function OpenPokal(){
	var win=null;
	var w=800;
	var h=600;
	var infocus="front";
	var myleft=null;
	var mytop=null;
	var url="http://www.bit-liga.de/turniere/pokal.html";
	var csLeer="";
	var myleft=(screen.width)?(screen.width-w)/2:100;
	var mytop=(screen.height)?(screen.height-h)/2:100;
	var settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";
	win=window.open(url,csLeer,settings);
	win.focus();
}
function OpenPopUp(){
	if(popup==null){
		var win=null;
		var w=300;
		var h=420;
		var url="http://www.bit-liga.de/popup.html";
		var titel="";
		var settings="width=320,height=316,top=50,left=50,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
		win=window.open(url, titel, settings);
		if(window.focus){
			popup=win;
			win.focus();
		}
	}
}

var Dauer = 600; // in Sekunden
 
var Seite = "popup.html";
var Fensteroptionen = "width=320,height=316,top=50,left=50,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
 
function CookieLesen (name)
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
 
    while (i < clen)
    {
        var j = i + alen;
 
        if (document.cookie.substring(i, j) == arg)
        {
            return CookieEinlesen (j); 
        }
 
        i = document.cookie.indexOf(" ", i) + 1;
 
        if (i == 0)
        {
            break;
        }
    }
 
    return null;
}
 
function CookieSetzen (name, value)
{
    var argv = CookieSetzen.arguments;
    var argc = CookieSetzen.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}
 
function CookieLoeschen (name)
{
    var exp = new Date();
    exp.setTime (exp.getTime() - 1);
    var cval = CookieLesen (name);
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
 
var exp = new Date(); 
exp.setTime(exp.getTime() + (Dauer*1000));
 
function CookieEinlesen(offset)
{
    var endstr = document.cookie.indexOf (";", offset);
 
    if (endstr == -1)
    {
        endstr = document.cookie.length;
    }
 
    return unescape(document.cookie.substring(offset, endstr));
}
 
function PopUpCheck()
{
    var count = CookieLesen('PopUp');
 
    if (count == null)
    {
        count = 1;
        CookieSetzen('PopUp', count, exp);
        win=window.open(Seite, "", Fensteroptionen);
		  win.focus();
    }
    else
    {
        count++;
        CookieSetzen('PopUp', count, exp);
    }
}