/*
############################################################
###                    check.js                          ###
###         Javascript von Michael Duetting              ###
###                 copyright 2005                       ###

                für Lebensfeiern Marion Klose
	 
			
            CMS              |----||----|
            Datenbanken      |    ||    |
                             |----||----|
            eShops                 |----|
                        |------|   |    |
            Webdesign   |      |   |----|
                        | multi|p l i c o          
            Multimedia  |------|

 										 
###                  Telemannstr. 26                     ###	
###                   48147 Münster                      ###			
###             http://www.multiplico.de                 ###
###             USt-IdNr.: DE 233 806 458                ###
############################################################
*/
onload = function(){
document.getElementById("jsmail").style.display =  "none";
}
OldMoz = "";
var fehler = 0;
function checkmail()
{
wert_firma = document.forms[0].Name.value;
wert_mail = document.forms[0].Mail.value;
	verifyMail = wert_mail.search("@");
	if (verifyMail == -1){wert_mail="lore"};
wert_text = document.forms[0].Nachricht.value;
firmaErr = 0;mailErr = 0;textErr = 0;charErr = 0;
for (i=0;i<document.forms[0].elements.length;i++)
{
			for (j=0;j<document.forms[0].elements[i].value.length;j++)
			{
			zeichen = document.forms[0].elements[i].value.charCodeAt(j);
				if (zeichen == 60 || zeichen == 62)
				{
				charErr =1;
				}
			}	
}		
if (wert_firma == "" || wert_mail == "" || wert_text == "" || wert_mail == "lore")
	{
		if (wert_firma == "") 
		{firmaErr = 1;document.forms[0].Name.style.backgroundColor = "#ffcccc";}
		if(wert_mail == "") 
		{mailErr = 1;document.forms[0].Mail.style.backgroundColor = "#ffcccc";}
	 	if(wert_text == "") 
		{textErr = 1;document.forms[0].Nachricht.style.backgroundColor = "#ffcccc";}
	}
	if (charErr != 0)
	{showError("visible","notallowed");error = 1;}	
Error = firmaErr + mailErr + textErr;	
	if (Error != 0)
	{showError("visible","empty");}
else
	{
	document.forms[0].Name.style.backgroundColor="#f6f6f6";
	document.forms[0].Nachricht.style.backgroundColor="#f6f6f6";
		if(wert_mail == "lore")
		{
		document.forms[0].Mail.style.backgroundColor="#ffcccc";
		showError("visible","nomail");
		error = 1;
		} 
		else
		{
		document.forms[0].Mail.style.backgroundColor="#ffffff";
			if(charErr == 0)
			{
			document.getElementById("danke").style.visibility = "visible";
			window.setTimeout('senden()',2000);
			}
		}
	}
}
function showError(wert,layrd)
{
document.getElementById(layrd).style.visibility = wert;
	if(OldMoz == 1  && window.netscape && !window.opera)
	{document.getElementById(layrd).style.left = "400px";}
}
function senden()
{
var getArray = [];
	for(var i=0;i<document.forms[0].elements.length;i++)
	{
		if(document.forms[0].elements[i].type != "button")
		{getArray.push(document.forms[0].elements[i].name + "=" + document.forms[0].elements[i].value);}
	}
var vars = getArray.join("&");
var url = "http://www.telescopium.formativ.net/mailer/sendklose.php?" + vars;	
var mailImage = document.createElement("img");
mailImage.style.display =  "none";
mailImage.src = url;
document.getElementsByTagName("body")[0].appendChild(mailImage);
}
