
var timer;var lastEmail="";var lastLogin="";var lastMdp="";var lastMdp2="";var lastParrain="";var lastCode="";var lastZipcode="";var lastPhone="";var regExEmail=new RegExp('^[a-zA-Z0-9]([+-_a-zA-Z0-9.])*_?@[a-zA-Z0-9]([-.]?[a-zA-Z0-9]*)+\\.[A-z]{2,4}$');var regExLogin=new RegExp('^[-_.a-zA-Z0-9]{3,20}$');var regExMdp=new RegExp('^[-_.!:,?a-zA-Z0-9]{6,20}$');var regExCode=new RegExp('^[0-9]{5}$');var regExZipcode=new RegExp('^[0-9]{5}$');var regExPhone=new RegExp('^0[1-69]([-. ]?[0-9]{2}){4}$');var regExImgOk=new RegExp('/check.gif$');function valueChanged(source)
{switch(source)
{case"mail":if(!hasToCheckEmail)
{var mail=document.getElementById('mail').value;var icoMail=document.getElementById('mailCheck');var fieldError=document.getElementById('mailError');if(lastEmail!=mail&&mail.length&&mail!='Passwort')
{fieldError.style.display='none';icoMail.setAttribute('src',staticRelPath+'common/images/www/inscription/wait.gif');hasToCheckEmail=true;}}
break;case"userId":case"login":if(!hasToCheckLogin)
{var login=document.getElementById('userId').value;var ico=document.getElementById('loginCheck');var fieldError=document.getElementById('loginError');if(lastLogin!=login&&login.length&&login!='Login')
{fieldError.style.display='none';ico.setAttribute('src',staticRelPath+'common/images/www/inscription/wait.gif');hasToCheckLogin=true;}}
break;case"mdp":if(!hasToCheckMdp)
{var mdp=document.getElementById('mdp').value;var ico=document.getElementById('mdpCheck');var fieldError=document.getElementById('mdpError');if(lastMdp!=mdp&&mdp.length&&mdp!='Passwort')
{lastMdp=mdp;fieldError.style.display='none';ico.setAttribute('src',staticRelPath+'common/images/www/inscription/wait.gif');hasToCheckMdp=true;}}
break;case"mdp2":if(!hasToCheckMdp2)
{var mdp2=document.getElementById('mdp2').value;var ico=document.getElementById('mdp2Check');var fieldError=document.getElementById('mdp2Error');if(lastMdp2!=mdp2&&mdp2.length)
{lastMdp2=mdp2;fieldError.style.display='none';ico.setAttribute('src',staticRelPath+'common/images/www/inscription/wait.gif');hasToCheckMdp2=true;}}
break;case"parrain":if(!hasToCheckParrain)
{var parrain=document.getElementById('parrain').value;var ico=document.getElementById('parrainCheck');var fieldError=document.getElementById('parrainError');if(lastParrain!=parrain&&parrain.length)
{fieldError.style.display='none';ico.setAttribute('src',staticRelPath+'common/images/www/inscription/wait.gif');hasToCheckParrain=true;}}
break;case"conditions":check_conditions();break;case"code":if(!hasToCheckCode)
{var code=document.getElementById('code').value;var ico=document.getElementById('codeCheck');var fieldError=document.getElementById('codeError');if(lastCode!=code&&code.length)
{fieldError.style.display='none';ico.setAttribute('src',staticRelPath+'common/images/www/inscription/wait.gif');hasToCheckCode=true;}}
break;case"zipcode":if(!hasToCheckZipcode)
{var zipcode=document.getElementById('zipcode').value;var ico=document.getElementById('zipcodeCheck');var fieldError=document.getElementById('zipcodeError');if(lastZipcode!=zipcode&&zipcode.length)
{fieldError.style.display='none';ico.setAttribute('src',staticRelPath+'common/images/www/inscription/wait.gif');hasToCheckZipcode=true;}}
break;case"phone":if(!hasToCheckZipcode)
{var phone=document.getElementById('phone').value;var ico=document.getElementById('phoneCheck');var fieldError=document.getElementById('phoneError');if(lastPhone!=phone&&phone.length)
{fieldError.style.display='none';ico.setAttribute('src',staticRelPath+'common/images/www/inscription/wait.gif');hasToCheckPhone=true;}}
break;}
clearTimeout(timer);timer=setTimeout(check_form,1000);}
check_email_callback=function(res,e)
{var icoMail=document.getElementById('mailCheck');var tabRes=res.split(/:/g);var returnCode=tabRes[0];var suggest=tabRes[1];if(isNaN(returnCode)||e)
{var mailError=document.getElementById('mailError');mailError.className='inscriptionError';icoMail.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');mailError.style.display='';mailError.innerHTML='Maximale Anzahl von Anmeldungsversuchen erreicht:';}
else if(returnCode=='1')
{icoMail.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');var mailError=document.getElementById('mailError');if(suggest)
{mailError.className='inscriptionWarning';mailError.style.display='';mailError.innerHTML='<span style="float: left;">Bitte eine g&uuml;ltige E-Mail angeben! Meinen Sie<a href="javascript:replace(\'mail\', \''+suggest+'\');">'+suggest+'</a> ? </span><span style="float: right;"><a href="javascript:close_warning();"><img src="'+staticRelPath+'common/images/www/inscription/close.png" alt="fermer" width="12" height="12" /></a></div>';}
else
{mailError.innerHTML='';}}
else if(returnCode=='2')
{var mailError=document.getElementById('mailError');mailError.className='inscriptionError';icoMail.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');mailError.style.display='';mailError.innerHTML='Ein Account mit dieser E-Mail-Adresse ist bei uns schon vorhanden. Haben Sie Ihre Zugangsdaten vergessen? Wir k&ouml;nnen diese an Ihre E-Mail-Adresse schicken.';}
else
{var mailError=document.getElementById('mailError');mailError.className='inscriptionError';icoMail.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');mailError.style.display='';mailError.innerHTML='Bitte eine g&uuml;ltige E-Mail-Adresse angeben!';}};check_login_callback=function(res,e)
{var ico=document.getElementById('loginCheck');var fieldError=document.getElementById('loginError');var tabRes=res.split(/:/g);var returnCode=tabRes[0];var suggest=tabRes[1];var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(isNaN(returnCode)||e)
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Maximale Anzahl von Anmeldungsversuchen erreicht:';}
else if(returnCode=='1')
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');fieldError.innerHTML='';}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';if(suggest)
{fieldError.innerHTML='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning-grey.png" alt="/!\\" /> Ein Account mit diesem Benutzernamen ist bei uns schon vorhanden<br />Der Benutzername<a href="javascript:replace(\'userId\', \''+suggest+'\');">'+suggest+'</a>ist vorhanden';}
else
{fieldError.innerHTML=imgError+' Ein Account mit diesem Benutzernamen ist bei uns schon vorhanden';}}};check_parrain_callback=function(res,e)
{var ico=document.getElementById('parrainCheck');var fieldError=document.getElementById('parrainError');var returnCode=res;var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(isNaN(returnCode)||e)
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Maximale Anzahl von Anmeldungsversuchen erreicht:';}
else if(returnCode=='1')
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');fieldError.innerHTML='';}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Kein User gefunden!';}};check_code_callback=function(res,e)
{var ico=document.getElementById('codeCheck');var fieldError=document.getElementById('codeError');var returnCode=res;var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(isNaN(returnCode)||e)
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Maximale Anzahl von Anmeldungsversuchen erreicht:';}
else if(returnCode=='1')
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');fieldError.innerHTML='';}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Der eingegebene Code stimmt nicht mit dem Bild &uuml;berein';}};function check_login()
{var ico=document.getElementById('loginCheck');var fieldError=document.getElementById('loginError');var login=document.getElementById('userId').value;lastLogin=login;var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(regExLogin.test(login))
{Ajax.ajaxCheckLogin(relPath,login);}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';if(login.length<3||login.length>20)
{fieldError.innerHTML=imgError+' Der Benutzername muss aus 3 bis 20 Zeichen bestehen';}
else
{if(login.indexOf(" ")>0)
{suggest=login.replace(" ",".");fieldError.innerHTML='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning-grey.png" alt="/!\\" /> Im Benutzernamen darf kein Leerzeichen vorkommen<br />'
+'Verf&uuml;gbar:<a href="javascript:replace(\'userId\',\''+suggest+'\')">'+suggest+'</a> '
+'<br />erlaubte Zeichen: Buchstaben, Ziffern, Bindestrich \'-\', Underscore \'_\', Punkt \'.\'';}
else
{fieldError.innerHTML=imgError+' Im Benutzernamen darf kein Leerzeichen oder Sonderzeichen vorkommen. erlaubte Zeichen: Buchstaben, Ziffern, Bindestrich \'-\', Underscore \'_\', Punkt \'.\'';}}}
hasToCheckLogin=false;}
function check_email()
{var mail=document.getElementById('mail').value;var icoMail=document.getElementById('mailCheck');var mailError=document.getElementById('mailError');lastEmail=mail;var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(regExEmail.test(mail))
{Ajax.ajaxCheckEmail(relPath,mail);}
else
{icoMail.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');mailError.style.display='';mailError.className='inscriptionError';mailError.innerHTML=imgError+' Bitte eine g&uuml;ltige E-Mail-Adresse angeben!';}
hasToCheckEmail=false;}
function check_mdp()
{var mdp=document.getElementById('mdp').value;var ico=document.getElementById('mdpCheck');var fieldError=document.getElementById('mdpError');var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(regExMdp.test(mdp))
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');fieldError.style.display='none';fieldError.innerHTML='';}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';if(mdp.length<6||mdp.length>20)
{fieldError.innerHTML=imgError+' Das Passwort muss aus 6 biz 20 Zeichen bestehen';}
else
{fieldError.innerHTML=imgError+' Im Passwort darf kein Leerzeichen oder Sonderzeichen vorkommen. erlaubte Zeichen: Buchstaben, Ziffern, \'-\', \'_\', \'!\', \'?\', \',\', \':\'';}}
hasToCheckMdp=false;}
function check_mdp2()
{var mdp=document.getElementById('mdp').value;var mdp2=document.getElementById('mdp2').value;var ico=document.getElementById('mdp2Check');var fieldError=document.getElementById('mdp2Error');var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(mdp==mdp2)
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');fieldError.style.display='none';fieldError.innerHTML='';}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Die Wiederholung des Passworts stimmt nicht mit dem ersten Passwort &uuml;berein';}
hasToCheckMdp2=false;}
function check_parrain()
{var ico=document.getElementById('parrainCheck');var fieldError=document.getElementById('parrainError');var parrain=document.getElementById('parrain').value;lastParrain=parrain;var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(parrain=="")
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/blank.png');}
else
{if(regExLogin.test(parrain)||regExEmail.test(parrain))
{Ajax.ajaxCheckParrain(relPath,parrain);}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Kein User gefunden!';}}
hasToCheckParrain=false;}
function check_code()
{var code=document.getElementById('code').value;var ico=document.getElementById('codeCheck');var fieldError=document.getElementById('codeError');var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';lastCode=code;if(regExCode.test(code))
{Ajax.ajaxCheckCode(relPath,code);}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Der Code muss aus 5 Ziffern (ohne Leerzeichen) bestehen';}
hasToCheckCode=false;}
function check_conditions()
{var cond=document.getElementById('conditions').checked;var ico=document.getElementById('conditionsCheck');var fieldError=document.getElementById('conditionsError');var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(cond)
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');fieldError.style.display='none';fieldError.innerHTML='';}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' Sie m&uuml;ssen den AGB zustimmen!';}
hasToCheckConditions=false;}
function check_zipcode()
{var zipcode=document.getElementById('zipcode').value;var fieldError=document.getElementById('zipcodeError');var ico=document.getElementById('zipcodeCheck');var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(regExZipcode.test(zipcode))
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');fieldError.style.display='none';fieldError.innerHTML='';}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' IG_js_inscription_invalid-zipcode';}
hasToCheckZipcode=false;}
function check_phone()
{var phone=document.getElementById('phone').value;var fieldError=document.getElementById('phoneError');var ico=document.getElementById('phoneCheck');var imgError='<img style="vertical-align: middle;" src="'+staticRelPath+'common/images/www/inscription/warning.png" alt="/!\\" />';if(regExPhone.test(phone))
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/check.gif');fieldError.style.display='none';fieldError.innerHTML='';}
else
{ico.setAttribute('src',staticRelPath+'common/images/www/inscription/croix.gif');fieldError.style.display='';fieldError.innerHTML=imgError+' IG_js_inscription_invalid-phone';}
hasToCheckPhone=false;}
function replace(fieldName,value)
{var field=document.getElementById(fieldName);field.value=value;valueChanged(fieldName);}
function close_warning()
{var mailError=document.getElementById('mailError');mailError.style.display='none';}
var check_form=function()
{if(hasToCheckEmail)
{check_email();}
if(hasToCheckLogin)
{check_login();}
if(hasToCheckMdp)
{check_mdp();check_mdp2();}
if(hasToCheckMdp2)
{check_mdp2();}
if(hasToCheckParrain)
{check_parrain();}
if(hasToCheckCode)
{check_code();}
if(hasToCheckConditions)
{check_conditions();}
if(hasToCheckZipcode)
{check_zipcode();}
if(hasToCheckPhone)
{check_phone();}
clearTimeout(timer);timer=setTimeout(check_form,1000);};
