var Dauer = 86400; // in Sekunden
var Seite = "../index.html";


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 = "/";
    var domain = "pentaxon.com";
    var secure = "false";
    document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; 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 Check()
{
    var count = CookieLesen('PentaxonDisclaimer');

    if (count == null)
    {
		window.location.href = Seite;
    }
    else
    {
		count++;
        CookieSetzen('PentaxonDisclaimer', count, exp);
        
    }
}

// Testfunktion um zu schauen ob Cookies erlaubt sind
function CookieAllowed()
{
	if (navigator.cookieEnabled == true) {
  		document.write("");
		} else if (navigator.cookieEnabled == false) {
  			document.write("Bitte Cookies in Ihrem Browser aktivieren! <br> Please activate cookies in your webbrowser! <br>");
		} else {
  			document.write("");
	}
}

//normaler Disclaimer, deutsch
function Goahead () {
  if (document.Testform.Art.checked == true) {
    window.location.href = "../wp/";
	CookieSetzen ('PentaxonDisclaimer', 1, exp)
    } else {
    alert("Sie haben die Vereinbarung noch nicht akzeptiert \n You have not accepted our terms yet");
  }
}


//normaler Disclaimer, english
function Goahead_de_en () {
  if (document.Testform.Art.checked == true) {
    window.location.href = "../wp/en/";
	CookieSetzen (PentaxonDisclaimer, 1, exp)
    } else {
    alert("Sie haben die Vereinbarung noch nicht akzeptiert \n You have not accepted our terms yet");
  }
}

//Liechtensteiner Disclaimer, deutsch
function Goahead_lie_de () {
  if (document.Testform.Art.checked == true) {
    window.location.href = "disc-lie2.htm";
	CookieSetzen ('PentaxonDisclaimer', 1, exp)
    } else {
    alert("Sie haben die Vereinbarung noch nicht akzeptiert \n You have not accepted our terms yet");
  }
}

//Liechtensteiner Disclaimer, deutsch
function Goahead_lie_en () {
  if (document.Testform.Art.checked == true) {
    window.location.href = "disc-lie2-en.htm";
	CookieSetzen ('PentaxonDisclaimer', 1, exp)
    } else {
    alert("Sie haben die Vereinbarung noch nicht akzeptiert \n You have not accepted our terms yet");
  }
}

//schweizer Disclaimer mit Zusatz, deutsch
function Goahead_ch_de () {
  if (document.Testform.Art.checked == true) {
		window.location.href = "disc-ch2.htm";
		CookieSetzen (PentaxonDisclaimer, 1, exp)
	} else {
    alert("Sie haben die Vereinbarung noch nicht akzeptiert \n You have not accepted our terms yet");
  }
}


//schweizer Disclaimer mit Zusatz, englisch
function Goahead_ch_en () {
  if (document.Testform.Art.checked == true) {
		window.location.href = "disc-ch2-en.htm";
		CookieSetzen (PentaxonDisclaimer, 1, exp)
	} else {
    alert("Sie haben die Vereinbarung noch nicht akzeptiert \n You have not accepted our terms yet");
  }
}







function Go (select) {
  var wert = select.options[select.options.selectedIndex].value;
  if (wert == "leer") {
    select.form.reset();
    return;
  } else {
      parent.location.href = wert;
      select.form.reset();
      parent.focus();
    }
  }
