/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function initNewPassword(){
    $('#ajaxload').hide();
    $('#passwordremindForm').validate({
        errorPlacement: general.errorPlacement,
        highlight: general.highlight,
        unhighlight: general.unhighlight,
        debug: general.debug,
        submitHandler:function(){
            var data="email="+$('#passwordRemind #email').val()+"&option=createpw";
            //Sende der Daten
            ajaxCreatNewPassword(data);
        },
        //Einstellen der Validierungsregeln für diese Formular
        rules:allRules.passrem
    });
}

function ajaxGetNewPasswordPage(){
    $.ajax({
        type: "GET",
        url: "account/forgottenPasswordPage.jsp",
        dataType:"html",
        success:
        function(data){
            $("#content").html(data);
            initNewPassword();
        },
        error:
        function (xhr){
            alert(xhr.status+" "+xhr.statusText);
        }
    });
}

function ajaxCreatNewPassword(data){
    $.ajax({
        type: "POST",
        url: "account/forgottenPasswordPage.jsp",
        data:data,
        dataType:"html",
        beforeSend:function(){
            //Zeige Element mit ID 'ajaxload' und verstecke vorheriges Element
            $('#ajaxload').show().prev().hide();
        },
        success:
        function(data){
            $("#content").html(data);
        },
        error:
        function (xhr){
            alert(xhr.status+" "+xhr.statusText);
        }
    });
}

