function clean_text(str)
{
	 //str = str.split("#").join("\#####");
	 //str = str.split("'").join("\'");
	 //str = str.split("\n").join("<br>");
	 str=encodeURIComponent(str);
	 str = str.split("%0D%0A").join("<br>");
	 str = str.split("%0A").join("<br>");
	 return str;
}

function send_mail()
{
	var check = true;
	if($F('txtVorname')=='')
	{
	   $('vorname').style.visibility='';
	   check = false;
	}

	if($F('txtName')=='')
	{
	   $('name').style.visibility='';
	   check = false;
	}
	if($F('txtStrasse')=='')
	{
	   $('strasse').style.visibility='';
	   check = false;
	}
	if($F('txtPLZ')=='')
	{
	   $('plz').style.visibility='';
	   check = false;
	}
	if($F('txtOrt')=='')
	{
	   $('ort').style.visibility='';
	   check = false;
	}
	if($F('txtTelefon')=='')
	{
	   $('telefon').style.visibility='';
	   check = false;
	}
	if($F('txtTelefon')=='')
	{
	   $('telefon').style.visibility='';
	   check = false;
	}
	if($F('txtMail')=='')
	{
	   $('mail').style.visibility='';
	   check = false;
	}
	if(check)
	{
		var info = 'txtVorname=' + clean_text($F('txtVorname'));
		info += '&txtName=' + clean_text($F('txtName'));
		info += '&txtFirma=' + clean_text($F('txtFirma'));
		info += '&txtZusatz=' + clean_text($F('txtZusatz'));
		info += '&txtStrasse=' + clean_text($F('txtStrasse'));
		info += '&txtPLZ=' + clean_text($F('txtPLZ'));
		info += '&txtOrt=' + clean_text($F('txtOrt'));
		info += '&txtTelefon=' + clean_text($F('txtTelefon'));
		info += '&txtMail=' + clean_text($F('txtMail'));
		info += '&txtBemerkung=' + clean_text($F('txtBemerkung'));

		show_processing('processing');
		new Ajax.Updater('processing','http://demo.teksoftprint.com/mediaswiss/fileadmin/send_mail.php', {method:'post',postBody:info});
	}
}

function show_processing(dest)
{
    document.getElementById(dest).style.display='';
    document.getElementById(dest).innerHTML = '<span class = "processing"> processing ...</span>';
}