/**
* Copyright Ramon Gamma
*
* @copyright Copyright Ramon Gamma
* @version $Id$
* @author Ramon Gamma <ramon@gamma.li>
*/ 

//http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp
var xmlhttp;
if (window.XMLHttpRequest){
	// code for IE7+, Firefox, Chrome, Opera, Safari
  	xmlhttp=new XMLHttpRequest();
}else{
	// code for IE6, IE5
  	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

/**
 * wachsende punkte anzeigen
 */
function waitdots(){
	var dotspan = document.getElementById('dots');
	window.setInterval(function(){
		if(dotspan.textContent == '...'){
			dotspan.textContent = '';
		}else{
			dotspan.textContent += '.';
		}
	}, 500);
}

/**
 * Wartemeldung anzeigen
 */
function waitmsg(){
	document.getElementById("result").innerHTML='<b>Bitte warten</b><b id=dots></b>';
	waitdots();
}

/**
 * Formular der Standart Seite senden
 */
function send_data(){
	waitmsg();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send(	document.newl.ne_act2.value
					+'='+document.newl.email.value
					+'&'+document.newl.imgsectim.value+'=1');
	sectime = ''+(new Date().getTime()/1000);
	sectime = sectime.split('.');
	document.newl.imgsectim.value=sectime[0];
}

/**
 * Spezifische Daten senden
 */
function send_req(act,data){
	waitmsg();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send(act+'='+data);
}

// Bei ajax Status Wechsel die Antwort anzeigen
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("result").innerHTML=xmlhttp.responseText;
    }
  } 
