// JavaScript Document

function echeck(str) {
 
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("Ungültige E-mail Adresse")
     return false
  }
 
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Ungültige E-mail Adresse")
     return false
  }
 
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Ungültige E-mail Adresse")
      return false
  }
 
   if (str.indexOf(at,(lat+1))!=-1){
      alert("Ungültige E-mail Adresse")
      return false
   }
 
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Ungültige E-mail Adresse")
      return false
   }
 
   if (str.indexOf(dot,(lat+2))==-1){
      alert("Ungültige E-mail Adresse")
      return false
   }
  
   if (str.indexOf(" ")!=-1){
      alert("Ungültige E-mail Adresse")
      return false
   }
 
    return true     
 }
 
  //Javascript validation for Property portfolio contact forms

 
function ValidateForm(){
//alert(document.getElementById("WebFormContactEmail-TextboxTextbox").value);

 var f_name = document.getElementById("orderReportfirst-name-textBoxTextbox").value;
 if ((f_name==null)||(f_name=="")){
  alert("Bitte tragen Sie Ihren Vornamen ein");
  return false
 }
 
 var l_name = document.getElementById("orderReportsur-name-textBoxTextbox").value;
 if ((l_name==null)||(l_name=="")){
  alert("Bitte tragen Sie Ihren Nachnamen ein");
  return false
 }


 var emailID= document.getElementById("orderReportemail-address-textBoxTextbox")
 //alert(emailID);
 if ((emailID.value==null)||(emailID.value=="")){
  alert("Bitte tragen Sie Ihre E-mail Adresse ein")
  emailID.focus()
  return false
 }
 
 if (echeck(emailID.value)==false){
  emailID.value=""
  emailID.focus()
  return false
 }
 
 
 var address = document.getElementById("orderReportstreet-textBoxTextbox").value;
 if ((address==null)||(address=="")){
  alert("Bitte tragen Sie Ihre Strasse ein");
  return false
 }
 
  var post = document.getElementById("orderReportnumber-textBoxTextbox").value;
 if ((post==null)||(post=="")){
  alert("Bitte tragen Sie Ihre Nummer ein");
  return false
 }
 
 var city = document.getElementById("orderReportcity-textBoxTextbox").value;
 if ((city==null)||(city=="")){
  alert("Bitte tragen Sie Ihren Ort ein");
  return false
 }
 
  var country = document.getElementById("orderReportcountry-textBoxTextbox").value;
 if ((country==null)||(country=="")){
  alert("Bitte tragen Sie Ihr Land ein");
  return false
 }
 

 /*var country = document.MainForm.orderReportcountryDropDown[document.MainForm.orderReportcountryDropDown.selectedIndex].value;
 if (country == "Country"){
  alert("Bitte Land auswählen");
  return false
 } */
  
 // document.MainForm.submit();
 return true
 }