function classwechsel(elementid)
{
  var classtauscher;
  //document.getElementById(classtauscher).className='MenuItem';
  //document.getElementById(elementid).className='MenuItemaktiv';
  //classtauscher=document.getElementById(elementid).id;
}

//whitespace characters
var whitespace = " \t\n\r";

//--------------------------------------------------------------------
// Description: Check whether string s is empty.
//---------------------------------------------------------------------
function isEmpty(s)
{ return ((s == null) || (s.length == 0)) }
//--------------------------------------------------------------------
// Description: Check whether all characters in string are whitespaces
//---------------------------------------------------------------------
function isWhitespace (s)
{
  var i;

  //Is s empty?
  if (isEmpty(s)) return true;

  //Search through string's characters one by one
  //until we find a non-whitespace character.
  //When we do, return false; if we don't, return true.
  for(i=0;i<s.length;i++)
  {
    // Check that current character isn't whitespace.
    var c = s.charAt(i);
    if(whitespace.indexOf(c) == -1) return false;
  }
  //All characters are whitespace.
  return true;
}
//--------------------------------------------------------------------
// Description: left and right trim string
//---------------------------------------------------------------------
function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}
//--------------------------------------------------------------------
// Description: Checks the specified string for a valid email address.
//---------------------------------------------------------------------
function isValidEmail(email) {
   email = trim(email);
   
   var usr = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
   var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
   var regex = "^" + usr + "\@" + domain + "$";
   var regExEmail = new RegExp(regex);
   if(regExEmail.test(email) && !isWhitespace(email))
      return true;
   else
      return false;
}

//--------------------------------------------------------------------
// Description: KiM-Anfrage ... ContactForm-Checker
//---------------------------------------------------------------------
function checkContactForm()
{
    var contactForm=document.contactForm;
    if (isWhitespace(contactForm.v_name.value)) //Name
    { 
        //alert ("Bitte geben Sie Ihren Namen ein!"); //Meldung wenn Fehler
        contactForm.v_name.focus(); //Sprung zum Feld
        //Tip('Das Feld Name ist ein Pflichtfeld und muss ausgefüllt werden!', FIX, ['kfEingabeName', 0, -2], BGCOLOR, '#ff9a9a', BGIMG, 'http://www.cadclick.com/_cont/cms/upload/images/tip_balloon/errorTipArrow.gif');
      
        $("BODY").append(
            "<div id='ValidationErrorTip'>" +
                "<div class='Arrow'>" +
                    " <div></div>" +
            "</div>" +
            "<div class='Content'>" +
                " <span id='ValidationErrorTipText'>Das Feld Name ist ein Pflichtfeld und muss ausgefüllt werden!</span>" +
            "</div>"
        ); 

       TagToTip(
            "ValidationErrorTip", 
            FIX, ['kfEingabeName', 0, -2], 
            COPYCONTENT, false,
            BORDERWIDTH, 0,
            SHADOW, false,
            BGCOLOR, ""          
        );
        return false; 
    } //false gibt zurück wenn Fehler
    
    if (!isValidEmail(contactForm.v_email.value)) //E-Mail
    { 
        //alert ("Bitte geben Sie eine gültige E-Mail-Adresse ein!");
        contactForm.v_email.focus();
        //Tip('Das Feld E-Mail ist ein Pflichtfeld und muss ausgefüllt werden!<br />Die muss in einer gültigen Form eingegeben werden, z.B. example@provider.de', FIX, ['kfEingabeEMail', 0, -2], BGCOLOR, '#ff9a9a');
        
          $("BODY").append(
            "<div id='ValidationErrorTip2'>" +
                "<div class='Arrow'>" +
                    " <div></div>" +
            "</div>" +
            "<div class='Content'>" +
                " <span id='ValidationErrorTipText'>Das Feld E-Mail ist ein Pflichtfeld und muss ausgefüllt werden!<br />Die E-Mail-Adresse muss in einer gültigen Form eingegeben werden, z.B. example@provider.de</span>" +
            "</div>"
        ); 

       TagToTip(
            "ValidationErrorTip2", 
            FIX, ['kfEingabeEMail', 0, -2], 
            COPYCONTENT, false,
            BORDERWIDTH, 0,
            SHADOW, false,
            BGCOLOR, ""          
        );
        return false; 
    }
    //Entferne die Hinweise wenn alles OK
    UnTip();
    return true;
}
