/*
 Another class  to handle captcha forms - by Augusto Mathias Adams
*/

var AjaxIMCaptchaForm = {
    
    /*
    show recaptcha field
    */
    
    showRecaptcha: function(element,themeName ){
        if(typeof Recaptcha != 'undefined'){
            
            Recaptcha.destroy();
            
        }
            Recaptcha.create('6LeRtQUAAAAAAABSHod_6cSKGjDAzTZU0AmZh3nu', element, {
              theme: themeName,
              tabindex: 0,
              callback: Recaptcha.focus_response_field,
              lang: Languages.get('recaptchaLang')
              });
            
            setTimeout("try{Event.observe($('recaptcha_response_field'), 'keypress', ajaxIMAnonymousLogin);}catch(e){}",500);
            
    },
    
    /* callback to recaptcha_response_field focus - does nothing because the form has it's own rules on first field focus */
    
    doNothing: function(){
        //do nothing.
    }

};

function ajaxIMAnonymousLogin(event){
    
    event = event || window.event;
    var asc = document.all ? event.keyCode : event.which;
    if(asc == 13){
        
        AutoLogin.anonymousLogin();
        
    }
    
    return asc != 13;
    
}