function checkMail(value, name)
{
  var a = false;
  var result = false;
  if(typeof(RegExp) == 'function')
    {
      var b = new RegExp('abc');
      if(b.test('abc') == true){a = true;}
    }

  if(a == true)
    {
      reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)([a-zA-Z0-9\\-\\.]+)' + '(\\.)([a-zA-Z]{2,4})$');
      result = (reg.test(value));
    }
  else
    {
      result = (value.search('@') >= 1 && value.lastIndexOf('.') > value.search('@') && value.lastIndexOf('.') >= value.length-5)
    }
//  return(result);
  if (result == false)
  { 
    alert('Die interne E-Mail Adresse ist nicht korrekt.\n');
    var allesOK = false;
    $('saving').disabled = true;
    $('saving1').disabled = true;
  }
  else
  {
//    return(result);
    var allesOK = true;
   $('saving').disabled = false;
   $('saving1').disabled = false;
  }
}

function checkEMail(value)
{
  var a = false;
  var result = false;
  var allesOK = true;
  
  if(typeof(RegExp) == 'function')
    {
      var b = new RegExp('abc');
      if(b.test('abc') == true){a = true;}
    }

  if(a == true)
    {
      reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)([a-zA-Z0-9\\-\\.]+)' + '(\\.)([a-zA-Z]{2,4})$');
      result = (reg.test(value));
    }
  else
    {
      result = (value.search('@') >= 1 && value.lastIndexOf('.') > value.search('@') && value.lastIndexOf('.') >= value.length-5)
    }
  if (result == false)
  { 
    allesOK = true;
  }
  else
  {
   allesOK = false;
   $('pubMail').focus();
   Effect.Grow($('pubMail'));
   err = err + "Die interne E-Mail Adresse ist nicht korrekt.\n";
  }
}


// used in index.php
function get_info(name)
{
  new Ajax.Request('get_info.php?name=' + name,
				{
					onSuccess: function(t)
					{
            $('response').innerHTML = t.responseText;
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

// used in index.php
function get_result(name)
{
  new Ajax.Request('get_result.php?name=' + name,
				{
					onSuccess: function(t)
					{
            $('content').style.display = 'none';
            $('ergebnis').innerHTML = t.responseText;
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

function get_region_result(name)
{
    new Ajax.Request('get_region_result.php?name=' + name,
				{
					onSuccess: function(t)
					{
            $('content').style.display = 'none';
            $('ergebnis').innerHTML = t.responseText;
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

function get_chapter_by_stat(stat)
{
    new Ajax.Request('get_chapter_by_stat.php?stat=' + stat,
				{
					onSuccess: function(t)
					{
            $('member').innerHTML = t.responseText;
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

function chapter_stat_down(id)
{
    new Ajax.Request('chapter_stat_down.php?id=' + id,
				{
					onSuccess: function(t)
					{
            location.reload();
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

function chapter_stat_up(id)
{
    new Ajax.Request('chapter_stat_up.php?id=' + id,
				{
					onSuccess: function(t)
					{
            location.reload();
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

function get_chapter_info(id)
{
  new Ajax.Request('get_chapter_info.php?id=' + id,
				{
					onSuccess: function(t)
					{
            $('member').innerHTML = t.responseText;
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

function get_chapter_contactform(id, region)
{
   new Ajax.Request('get_chapter_contactform.php?id=' + id + '&region=' + region,
				{
					onSuccess: function(t)
					{
            $('member').innerHTML = t.responseText;
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

function get_memberinfo(id)
{
   new Ajax.Request('get_memberinfo.php?id=' + id,
				{
					onSuccess: function(t)
					{
            $('memberinfo_' + id).style.display = 'block';
            $('memberinfo_' + id).innerHTML = t.responseText;
					},
					onFailure: function(t)
					{
						alert('Es ist ein Fehler aufgetreten.');
					}
				}
			);
}

function togglediv(id)
{
  if ($('block_' + id).style.display == 'none')
  {
//    Effect.Appear($('block_' + id));
   $('block_' + id).style.display = 'block';
    $('mehr_' + id).style.display = 'none';
  }
  else
  {
        $('mehr_' + id).style.display = 'block';
        $('block_' + id).style.display = 'none';
//        Effect.Fade($('block_' + id));
  }
}
