/* -----MAIL CHECKER IT v1.0--------------------------------*/

function CheckForm()
{
var theErrors	='';
var theErrIntro	='Per favore completare i seguenti dati: \n\n';
var theErrAlpha	=': può essere unicamamente composto\nda lettere alfabetiche!\n\n';
var theErrNumber=': può essere unicamamente composto da cifre numeriche!\n (P.f.: Numero senza spazi o apostrofi)\n\n';
var theErrMail	=': verificate il formato E-mail! (@;.ch/.com)\n\n';
var theObjValue;

Fields = CheckForm.arguments;
	for(i=0; i<(Fields.length-1); i+=2)
	{
	Fieldx= Fields[i];
	theObjValue = document.forms[0].elements[Fieldx].value;
	if( theObjValue == "")
		{
		theErrors += '- '+Fieldx+'\n';
		document.forms[0].elements[Fields[0]].focus();
		}
	if( theObjValue != "" && Fields[i+1] == 'A')
		{
		for (j = 0; j < theObjValue.length; j++)
			{		
			var abc = theObjValue.substring(j, j + 1);
			//if ((abc < "a" || "z" < abc) && (abc < "A" || "z" < abc))zahlen sind nicht zugelessen!
			if (abc < "A")                        //Zahlen sind nicht zugelessen!
				{
				theErrors += '- '+Fieldx+theErrAlpha;
				document.forms[0].elements[Fields[0]].focus();
				break;
				}
			}
		}
	if( theObjValue != "" && Fields[i+1] == '1')
		{
		for (j = 0; j < theObjValue.length; j++)
			{
			var abc = theObjValue.substring(j, j + 1);
			if (abc < "0" || "9" < abc) 		//Buchstaben sind nicht zugelessen				
				{
				theErrors += '- '+Fieldx+theErrNumber;
				break;
				}
			}		
		}
	//Hier die E-Mail-Abfrage hinzufügen, falls zwingend
	}
	//Falls die E-Mail-Abfrage zwingend wäre, ist dieser Modul innerhalb der Schleife notig
	//Folgender IF-Statement ersetzen durch:  theObjValue != "" && Fields[i+1] == '@'
	if( document.forms[0].elements[12].value !='')
		{	
		if(document.forms[0].elements[12].value.indexOf ('@',0) == -1 ||
	       document.forms[0].elements[12].value.indexOf ('.',0) == -1 )
				{
				theErrors += '- E-mail'+theErrMail;
				//break; innerhalb der Schelife, Break aktivieren
				}
		}
	if(theErrors =='')
	{
	CheckCustomer();
	}
	else
	{
	alert(theErrIntro+theErrors);
	return false;
	}
}
/* -----CHECK CUSTOMER--------------------------------------*/
/* -----SAVE CUSTOMER DATA----------------------------------../it/*/
function CheckCustomer()
{	
	titel = document.forms[0].elements[0].selectedIndex;
	parent.frames[1].Customer[0] = document.forms[0].elements[0].options[titel].text;
	parent.frames[1].Customer[1] = document.forms[0].elements[2].value;
	parent.frames[0].document.location.href ='rc_thanks.htm';

}
/* -----WRITE CUSTOMER DATA----------------------------------*/
function Mail_thanks()
{	
	document.write(	parent.frames[1].Customer[0]+' '+parent.frames[1].Customer[1]);
}

