/*
	Library tydChkEmailFct
	
	Author			Date		Changes made
   	------------------	------------	-------------------------------
   	Flavio Castro, TYDAC	10.31.02	Original definition
   	
   	Overview:
   	---------
   	Checks if the email address is "well formatted" before sending the download request
	If not, an alert message is displayed and the user has the ability to change the email input

	Checks on email format:
	1)does the email contain the character "@"
	2)does the string at the right side of the character "@" contain a point (".")
   	
   	The function tydChkEmail() can be called from a download form containig the following properties:
   	1) Name of the form: 		"Download"
   	2) Name of the email field:	"email"
*/
function tydChkEmail(){
	var sEmailTxt = document.forms[0].email.value
	
	/* type in this variable the error message you want to display */
	var strErrMsg = "Die eingegeben e-mail Adresse \" " + sEmailTxt + " \" ist ungültig"
	
	if (sEmailTxt.indexOf('@')!=-1){
      		if (sEmailTxt.substring((sEmailTxt.indexOf('@')+1),sEmailTxt.length).indexOf('.')!=-1){
      			document.forms[0].submit()
      		}else{
      			alert(strErrMsg)
      		}
   	}else{
   		alert(strErrMsg)
   	}
}
