
		function Del(Word) {
			a = Word.indexOf("<");
			b = Word.indexOf(">");
			len = Word.length;
			c = Word.substring(0, a);
			if(b == -1)
			b = a;
			d = Word.substring((b + 1), len);
			Word = c + d;
			tagCheck = Word.indexOf("<");
			if(tagCheck != -1)
			Word = Del(Word);
			return Word;
		}
		
		function validate(field) {

		  return (emailCheck(field))
		}
				
	function submitfrm()
	{
		document.frmSubmit.submit();

	}		
		function Check(theForm) {
		 
		 var ToCheck;
		 var Checked;
		// alert(theForm);

		
			  if (theForm.fname.value == "")
					{
					  alert("Geben Sie bitte Ihren Vornamen ein");
					  theForm.fname.focus();
					  return (false);
					}
			 else
					{
						ToCheck = theForm.fname.value;
						Checked = Del(ToCheck);
						theForm.fname.value = Checked;
					}
			  if (theForm.lname.value == "")
					{
					  alert("Geben Sie bitte Ihren Nachnamen ein");
					  theForm.lname.focus();
					  return (false);
					}
			 else
					{
						ToCheck = theForm.lname.value;
						Checked = Del(ToCheck);
						theForm.lname.value = Checked;
					}
				
			if (theForm.address1.value == "")
					{
					  alert("Geben Sie bitte Ihre Adresse ein");
					  theForm.address1.focus();
					  return (false);
					}
					else
					{
						ToCheck = theForm.address1.value;
						Checked = Del(ToCheck);
						theForm.address1.value = Checked;
					}
					
					
			if (theForm.city.value == "")
					{
					  alert("Geben Sie bitte Ihren Wohnort ein");
					  theForm.city.focus();
					  return (false);
					}
					else
					{
						ToCheck = theForm.city.value;
						Checked = Del(ToCheck);
						theForm.city.value = Checked;
					}

if (theForm.country.selectedIndex <=0)
					{
					  alert("Whlen Sie bitte Ihr Land");
					  theForm.country.focus();
					  return (false);
				}					
			
			
			

  if (theForm.email.value == "")
					{
					  alert("Geben Sie bitte Ihre E-Mail-Adresse ein");
					  theForm.email.focus();
					  return (false);
					}
			  if (!validate(removeSpaces(theForm.email.value) ))
					{
					  alert("Geben Sie bitte eine gltige E-Mail-Adresse ein.");
					  theForm.email.focus();
					  return (false);
					}
			 else
					{
						ToCheck = theForm.email.value;
						Checked = Del(ToCheck);
						theForm.email.value = Checked;
					}
				
				if (removeSpaces(theForm.email.value) != removeSpaces(theForm.confemail.value))
					{
					  alert("Die E-Mail-Adresse und die wiederholte E-Mail-Adresse sind nicht gleich.");
					  theForm.confemail.focus();
					  return (false);
					}
					
if (theForm.userdesc.selectedIndex <=0)
					{
					  alert("Whlen Sie die Kategorie, die Sie am ehesten beschreibt.");
					  theForm.userdesc.focus();
					  return (false);
				}
				
if (theForm.hearabout.selectedIndex <=0)
					{
					  alert("Whlen Sie bitte, wie Sie von dieser Promotion erfahren haben.");
					  theForm.hearabout.focus();
					  return (false);
				}					
					
			
			
			
		
			
			if (!theForm.terms.checked)
					{
						alert("Sie mssen den Teilnahmebedingungen zustimmen.");
						theForm.terms.focus();
						return (false);
					}


		return true;

		}
		var nw
function openAnyWindow(url, name, w, h)
	{
	  if (!nw || nw.closed)
	  {
	    nw = window.open(url, name, 'scrollbars=yes,resizable=yes,status=no,location=no,menubar=yes,width=' + w + ',height=' + h);
	    if(!nw.opener)
	    {
	      nw.opener
	    }
	    //nw.document.close()
	  } 
	  else 
	  {
	    nw.close()
	    nw = window.open(url, name, 'scrollbars=yes,resizable=yes,status=no,location=no,menubar=yes,width=' + w + ',height=' + h);
		nw.focus()
	  }
	}

function removeSpaces(string) {
 return string.split(' ').join('');
}
function emailCheck(strEmail)
{
	/*
	email check
	returns a true for good email
	and false for a bad one
	*/

	/* partern for emails */
	var emailPat=/^(.+)@(.+)$/
	/* characters that cannot be in the email
	 ( ) < > @ , ; : \ " . [ ] */
	var specChar="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]=?*&!#$%\\+\\/\\'"
	/* chars not allowed */
	var invalidChars="\[^\\s" + specChar + "\]"
	var quotedUser="(\"[^\"]*\")"
	var atom=invalidChars + '+'
	//var atomDom=invalidChars + '+\\_-'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$")

	/* compare here with the first patern */
	var matchArray = strEmail.match(emailPat)
	if (matchArray==null) {
		return false;
	}
	
	var user=matchArray[1];
	var domain=matchArray[2];
	
	// first check to see if the user part of the email address is valid.
	//alert(user.match(userPat));
	if (user.match(userPat)==null) {
		return false;
	}
	
	var domainArray=domain.match(domainPat);
	//alert(domainArray);
	if (domainArray==null) {
		return false;		
	}
	
	/* if all passes.. we now need to break apart the domain.. to check for valid domain addresses	 */
	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;
	//alert(atomPat + " " + domArr + " " + len);
	if (domArr[domArr.length-1].length < 2 || domArr[domArr.length-1].length > 4) {
		// address must end in 2 or 4 letters.
		return false;		
	}

	if (len < 2) {
		return false;
		
	}

	return true;

}
