function getPass()
{
    var email = document.order.accountEmail.value;
    try {
        xmlhttp = window.XMLHttpRequest?new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
        // todo
    }
    xmlhttp.onreadystatechange = afterPassword;

    // create the input string
    var qs = 'http://my.dot.tk/registration/sendpass?email=' + encodeURIComponent(email);

    xmlhttp.open("GET", qs);
    xmlhttp.send(null);
}


function getPassSec()
{
    var email = document.order.accountEmail.value;
    try {
        xmlhttp = window.XMLHttpRequest?new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
        // todo
    }
    xmlhttp.onreadystatechange = afterPassword;

    // create the input string
    var qs = 'https://secure.dot.tk/registration/sendpass?email=' + encodeURIComponent(email);

    xmlhttp.open("GET", qs);
    xmlhttp.send(null);
}


function afterPassword()
{
    if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
        var response = xmlhttp.responseText;
        document.getElementById('passwordSent').innerHTML = response;
    }
}


function retrieveCookie( cookieName ) {
	/* retrieved in the format
	cookieName4=value; cookieName3=value; cookieName2=value; cookieName1=value
	only cookies for this domain and path will be retrieved */
	var cookieJar = document.cookie.split( "; " );
	for( var x = 0; x < cookieJar.length; x++ ) {
        var oneCookie = cookieJar[x].split( "=" );
	    if( oneCookie[0] == escape( cookieName ) ) { 
            return unescape( oneCookie[1] ); 
        }
	}
	return null;
}

function setTKCookie( cookieName, cookieValue, lifeTime, path, domain, isSecure ) 
{
    if ( !cookieName ) { 
        return false; 
    }
	if ( lifeTime == "delete" ) { 
        lifeTime = -10; 
    } //this is in the past. Expires immediately.
	/* This next line sets the cookie but does not overwrite other cookies.
	syntax: cookieName=cookieValue[;expires=dataAsString[;path=pathAsString[;domain=domainAsString[;secure]]]]
	Because of the way that document.cookie behaves, writing this here is equivalent to writing
	document.cookie = whatIAmWritingNow + "; " + document.cookie; */
	document.cookie = escape( cookieName ) + "=" + escape( cookieValue ) +
                    ( lifeTime ? ";expires=" + ( new Date( ( new Date() ).getTime() + ( 1000 * lifeTime ) ) ).toGMTString() : "" ) +
                    ( path ? ";path=" + path : "") + ( domain ? ";domain=" + domain : "");
	//check if the cookie has been set/deleted as required
	if( lifeTime < 0 ) { 
        if( typeof( retrieveCookie( cookieName ) ) == "string" ) { 
            return false; 
        } 
        return true; 
    }
	if( typeof( retrieveCookie( cookieName ) ) == "string" ) { 
        return true; 
    } 
    return false;
}			


startList = function() 
{
    if (document.all&&document.getElementById) {
	    langRoot = document.getElementById("containerHideLang");
		
        for (i=0; i<langRoot.childNodes.length; i++) {
            node = langRoot.childNodes[i];
            if (node.nodeName=="DIV") {
                node.onmouseover=function() {
                    this.className+=" over";
                }
                node.onmouseout=function() {
                    this.className=this.className.replace(" over", "");
                }
            }
        }
    }
}

window.onload = function(e) {
    setTKCookie('mydottk_languagenr','8','86400','/','.dot.tk','false');
    setTKCookie('wwwLn','de','86400','/','.dot.tk','false');
    startList();
}

function clickRename()
{
    if (document.rename.url.value == 'URL hier eintragen...') {
        document.rename.url.value = '';
    }
}

var benabled = false;
function switchbutton()
{
    if (benabled == false) {
        document.getElementById("s").disabled = false;
        benabled = true;
    } else {
        document.getElementById("s").disabled = true;
        benabled = false;
    }
}

function submitAnonymous(anonymous) 
{
    if (anonymous == 'y') {
        document.getElementById('anonymous').value = 'y';
    } else {
        document.getElementById('anonymous').value = 'n';
    }
    document.a14.submit();
}


