<!--
gMandatoryFields = 0x0010077F; 

/*---------------------------------------------------------------------------------------------------------------------*/

function onSearchFocus()
{
	if (document.form_search.search.value == "Suchen...")
		 document.form_search.search.value = ""
}

/*---------------------------------------------------------------------------------------------------------------------*/

function DoSearch()
{
	var sStr = ""

	sStr += IsValidString(document.form_search.search.value, "---");
	if (sStr == "")
		if (document.form_search.search.value == "Suchen...")
			sStr = "---"
			
	if (sStr != "")
		alert("Sie müssen mindestens einen Suchbegriff eingeben")
	else
	{
		document.form_search.action = "/suchen.asp#results"
		document.form_search.submit()
	}
}

/*---------------------------------------------------------------------------------------------------------------------*/

function SubmitForm()
{
  var sStr = ""

	if ( (document.formular["First name"]) && (gMandatoryFields & 0x00000001) )
  	sStr += IsValidString(document.formular["First name"].value, "Vorname");
	
	if ( (document.formular["Last name"])  && (gMandatoryFields & 0x00000002) )
		sStr += IsValidString(document.formular["Last name"].value, "Name");
	
	if ( (document.formular["Title"])      && (gMandatoryFields & 0x00000004) )
	  sStr += IsValidString(document.formular["Title"].value, "Title/Funktion");
	
	if ( (document.formular["Company"])    && (gMandatoryFields & 0x00000008) )
	  sStr += IsValidString(document.formular["Company"].value, "Firma");
	
	if ( (document.formular["Email"])      && (gMandatoryFields & 0x00000010) )
	  sStr += IsValidEmail(document.formular["Email"].value, "E-mail");
	
	if ( (document.formular["Street"])     && (gMandatoryFields & 0x00000020) )
	  sStr += IsValidString(document.formular["Street"].value, "Straße");
	
	if ( (document.formular["City"])       && (gMandatoryFields & 0x00000040) )
	  sStr += IsValidString(document.formular["City"].value, "Ort");
	
	if ( (document.formular["State"])      && (gMandatoryFields & 0x00000080) )
	  sStr += IsValidString(document.formular["State"].value, "Bundesland");
	
	if ( (document.formular["Zip"])        && (gMandatoryFields & 0x00000100) )
	  sStr += IsValidString(document.formular["Zip"].value, "PLZ");
	
	if ( (document.formular["Country"])    && (gMandatoryFields & 0x00000200) )
	  sStr += IsValidString(document.formular["Country"].value, "Land");
	
	if ( (document.formular["Phone"])      && (gMandatoryFields & 0x00000400) )
	  sStr += IsValidString(document.formular["Phone"].value, "Telefon");

	if ( (document.formular["Fax"])        && (gMandatoryFields & 0x00000800) )
	  sStr += IsValidString(document.formular["Phone"].value, "Fax");


	if ( (document.formular["Comments"])       && (gMandatoryFields & 0x00010000) )
	  sStr += IsValidString(document.formular["Comments"].value, "Kommentar");

	if ( (document.formular["Industry"])       && (gMandatoryFields & 0x00020000) )
	  sStr += IsValidString(document.formular["Industry"].value, "Branche");

	if ( (document.formular["Annual revenue"]) && (gMandatoryFields & 0x00040000) )
	  sStr += IsValidString(document.formular["Annual revenue"].value, "Jährlicher Umsatz");

	if ( (document.formular["Employees"])      && (gMandatoryFields & 0x00080000) )
	  sStr += IsValidString(document.formular["Employees"].value, "Anzahl Mitarbeiter");

	if ( (document.formular["ERP"])            && (gMandatoryFields & 0x00100000) )
	  sStr += IsValidString(document.formular["ERP"][document.formular["ERP"].selectedIndex].value, "ERP");


  if (sStr != "")
    alert(sStr)
  else
    document.formular.submit()
}


/*---------------------------------------------------------------------------------------------------------------------*/

function IsValidNumber(sValue, sName)
{
  if ( (sValue == null) || (sValue == "") )
    return "[" + sName + "] Bitte machen Sie eine Angabe!\n";
  
  if (isNaN(sValue))
    return "[" + sName + "] Bitte geben Sie eine Zahl ein!\n";

  return "";
}

/*---------------------------------------------------------------------------------------------------------------------*/

function IsValidString(sValue, sName)
{
  if ( (sValue == null) || (sValue == "") )
    return "[" + sName + "] Bitte machen Sie eine Angabe!\n";

  return "";
}

/*---------------------------------------------------------------------------------------------------------------------*/

function IsValidEmail(sValue, sName)
{
  if (sValue == null)
      return "[" + sName + "] Bitte geben Sie eine gültige E-Mail-Adresse ein!\n";

  var pos = sValue.indexOf('@');

  if (pos < 1 || pos == (sValue.length-1))
     return "[" + sName + "] Bitte geben Sie eine gültige E-Mail-Adresse ein!\n";

  return "";
}

/*---------------------------------------------------------------------------------------------------------------------*/

function IsValidHTTPURL(sValue, sName)
{
  if (sValue == null)
      return "[" + sName + "] Bitte machen Sie eine Angabe!\n";

  var pos1 = sValue.indexOf('http://');
  var pos2 = sValue.lastIndexOf('.');

  if (pos1 != 0 || pos2 < 8 || pos2 > (sValue.length-3))
     return "[" + sName + "] Bitte geben Sie eine gültige http-Adresse ein!\n";

  return "";
}

/*---------------------------------------------------------------------------------------------------------------------*/

function IsInRange(sValue, min, max, sName)
{
  if ((sValue == null) || isNaN(sValue) || (sValue < min || max < sValue))
      return "[" + sName + "] Bitte geben Sie eine Zahl von " + min + " bis " + max + " ein!\n";

  return "";
}

/*---------------------------------------------------------------------------------------------------------------------*/

function IsMatchingRegEx(sValue, sPattern, sFlag,  sName)
{
  if (sValue == null)
      return "[" + sName + "] Eingabe nicht gültig!\n";

  var rRegEx = new RegExp(sPattern, sFlag);

  if (! rRegEx.test(sValue))
      return "[" + sName + "] Eingabe nicht gültig!\n";

  return "";
}

//-->
