function submitmail(){
	var mailField	= document.getElementById("mailField");
	
	if(checkMailField(mailField, "mail")){
		loadAjax("mailSubmit.xml.php?mail="+mailField.value,"",mailSended)
	}
	return false;
}

function mailSended(http){
	var xmlParser	= new XMLParser();
	var formContainer;
	
	if(http.responseXML.firstChild.firstChild.nodeName	== "error"){
		alert("Your email adress has already been submitted");
	}else{
		formContainer	= document.getElementById("emailform");
		formContainer.innerHTML	= "<span style=\"font-size:9px;font-color:#4894c4\">Your email adress has been successfully submitted</span>";
	}
	
}

function checkMailField(field,formName){
	var txt	= field.value;
	var atPos	= txt.indexOf("@");
	var dotPos	= txt.indexOf(".");
	if(atPos != -1 && dotPos != -1 && dotPos > atPos){
		return true
	}else{
		alert("Please field a valid mail adress at "+ formName);
		return false;
	}
}

function loadAjax(url,containerId,callback){
	var xmlHttp;
	try{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
		try{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e){
			alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			if(containerId != "") document.getElementById(containerId).innerHTML = xmlHttp.responseText;
			
			if(callback != undefined){
				callback(xmlHttp);
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}