function createAnimation()
{
    var iVar1 = 20 + Math.round(Math.random()*20, 0);
    var iVar2 = 30 + Math.round(Math.random()*70, 0);
    var iVar3 = 3 + Math.round(Math.random()*3, 0);
    var iVar4 = 1 + Math.round(Math.random()*6, 0);
    var iExPa = Math.round(Math.random()*1, 0);
    var iAbY = 95;
    var iAbX = Math.round(1+Math.random()*98, 0);
    var iExY = 10 + Math.round(1+Math.random()*70, 0);
    var iExX = 20 + Math.round(1+Math.random()*60, 0);
    setTimeout('createAnimation()',1+parseInt(Math.random()*2500));
    createFirework(iVar1, iVar2, iVar3, iVar4, iAbX, iAbY, iExX, iExY, iExPa, false);
}

function aeAjaxRequest(n, urls, params, fields, ghosts) {
    <!-- if(document.getElementById(fields[ n ])) { alert("Feld exestiert!\n\nGhost: " + ghosts[ n ] + "\nFeld: " + fields[ n ] + "\nURL: " + urls[ n ] + "\nParameter: " + params[ n ]); } else { alert("Feld exestiert nicht: " + fields[ n ]); } -->
    var xhr = false;
    if(window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
        if(xhr.overrideMimeType) { xhr.overrideMimeType('text/html'); }
    } else {
        if(window.ActiveXObject) {
    	    try{
    		    xhr = new ActiveXObject("Microsoft.XMLHTTP");
    		} catch (e) { }
    	}
    }
    if(xhr) {
    	xhr.onreadystatechange = function() {
    	    if(xhr.readyState == 4) {
    	        if(xhr.status == 200) {
    			    var outData = xhr.responseText;
                    if(document.getElementById(fields[n])) {
                        document.getElementById(fields[n]).innerHTML = outData;
                        aeZeigeFeld(fields[n], ghosts[n]);
                    }
                    if(n < urls.length - 1) { aeAjaxRequest( n + 1, urls, params, fields, ghosts ); }
                } else { location.href="index.php"; }
    		}
    	}
        xhr.open("POST", urls[n], true);
        xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xhr.setRequestHeader("Content-length", (params[n].length * 8));
        xhr.setRequestHeader("Connection", "close");
    	xhr.send(params[n]);
    } else { document.getElementById(fields[n]).innerHTML = "Couldn't create an AJAX-Request!"; }
}

function sendMail(s1, s2, s3)
{
	var email = s1 + "@" + s2;
	w1 = window.open("mailto:" + email + "?subject=" + s3);
	w1.close();
}

function setCookie(sName)
{
	objCookie = document.cookie;
	sNewWert = 1;
	while(objCookie != '')
	{
		while(objCookie.substr(0,1) == ' ')
			objCookie = objCookie.substr(1, objCookie.length);

		sCooName = objCookie.substring(0, objCookie.indexOf('='));

		if(objCookie.indexOf(';') != -1)
			sCooWert = objCookie.substring(objCookie.indexOf('=')+1, objCookie.indexOf(';'));
		else
			sCooWert = objCookie.substr(objCookie.indexOf('=')+1, objCookie.length);

		if(sName == sCooName)
			sNewWert = (sCooWert == 0)? 1: 0;

		i = objCookie.indexOf(';')+1;

		if(i == 0)
			i = objCookie.length;

		objCookie = objCookie.substring(i, objCookie.length);
 	}
 	document.cookie = sName + "=" + sNewWert;
}

function checkAllFromList(sForm, sElement, bStatus)
{
	var elem = document.forms[sForm].elements[sElement];
	for(i=0; i<elem.options.length; i++)
		elem.options[i].selected = bStatus;
}

function aeResizePic(objPic, origWidth, origHeight)
{
	var aktWidth = objPic.width;
	if(aktWidth >= origWidth)
	{
		objPic.width = Math.round(objPic.width / 2);
		objPic.height = Math.round(objPic.height / 2);
	}
	else
	{
		objPic.width = origWidth;
		objPic.height = origHeight;
	}
}

function aeHide(obj)
{
	obj.style.display = "none";
	obj.style.visibility = "hidden";
}

function aeLimitChars(obj_limit, name_show, max)
{
	var countChars = obj_limit.value.length;
	if( countChars >= max )
	{
		obj_limit.value = obj_limit.value.substring(0, (max-1) );
		countChars = max;
	}
	document.getElementById(name_show).innerHTML = max - countChars;
}

function aeGetEmail(n, web, subject)
{
	var full = "mailto: " + n + "@" + web + "?Subject=" + subject;
	w1 = window.open( full );
	if(w1.closed != true) w1.close();
}

function aeFeldStatus(name)
{
	if( document.getElementById(name).style.display != 'none' ||
        document.getElementById(name).style.visibility != 'hidden' )
    {
        document.getElementById(name).style.display = 'none';
        document.getElementById(name).style.visibility = 'hidden';
    }
    else
    {
        document.getElementById(name).style.display = 'block';
        document.getElementById(name).style.visibility = 'visible';
    }
}

function aeZeigeFeld(name, event) {
    if(event == true) {
        document.getElementById(name).style.display = 'block';
        document.getElementById(name).style.visibility = 'visible';
    } else {
        document.getElementById(name).style.display = 'none';
        document.getElementById(name).style.visibility = 'hidden';
    }
}

function aeTextStatus(obj, sData)
{
	obj.value = sData;
}
