/**
 cor-content.js
 @package      Core
 @copyright    Copyright (c) 2007 - 2009 Ragnar.cz. All rights reserved
 @license      GNU/GPL http://www.gnu.org/copyleft/gpl.html

 Albireo is free software!
*/

    // check strength of password
    // password is value of password in input and textTagId is id of tag which will have text content of strenght
    function passwordStrength ( password, textTagId ) {

        var score = 0;
        if ( password.length > 6) score++; //if password bigger than 6 give 1 point
        if ( ( password.match ( /[a-z]/ ) ) && ( password.match( /[A-Z]/ ) ) ) score++; //if password has both lower and uppercase characters give 1 point
        if ( password.match ( /\d+/ ) ) score++; //if password has at least one number give 1 point
        if ( password.match ( /.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/ ) ) score++; //if password has at least one special caracther give 1 point
        if ( password.length > 12 ) score++; //if password bigger than 12 give another 1 point
//$(\"#passwordStrength\").css(\"margin-left\",\"130px\");
//$( "#"+textTagId ).css("margin-left","135px");
        switch ( score ) {
            case 0:
                $ ( "#"+textTagId ).html ( '<strong class="warning">Opravdu špatné heslo (0/5)</strong>' );
            break;
            case 1:
                $ ( "#"+textTagId ).html ( '<strong class="warning">Slabé heslo (1/5)</strong>' );
            break;
            case 2:
                $ ( "#"+textTagId ).html ('<strong class="success">Normální heslo (2/5)</strong>' );
            break;
            case 3:
                $ ( "#"+textTagId ).html ( '<strong class="success">Docela dobré heslo (3/5)</strong>' );
            break;
            case 4:
                $ ( "#"+textTagId ).html ( '<strong class="success">Silné heslo (4/5)</strong>' );
            break;
            case 5:
                $ ( "#"+textTagId ).html ( '<strong class="success">Velice silné heslo (5/5)</strong>' );
            break;
        }

    }