(function($){ 
     $.fn.extend({  
         pwdstr: function(el) {			
			return this.each(function() {
					$(this).keyup(function(){
						//$(el).html(getTime($(this).val()));
						$(el).css('width',getTime($(this).val())+'%');
					});
					
					function getTime(str){
					
					var chars = 0;
					var rate = 2800000000;
					
					if((/[a-z]/).test(str)) chars +=  26;
					if((/[A-Z]/).test(str)) chars +=  26;
					if((/[0-9]/).test(str)) chars +=  10;
					if((/[^a-zA-Z0-9]/).test(str)) chars +=  32;

					var pos = Math.pow(chars,str.length+2);
					var s = pos/rate;
					
					var decimalYears = s/(3600*24*365);
					var years = Math.floor(decimalYears);
					
					var decimalMonths =(decimalYears-years)*12;
					var months = Math.floor(decimalMonths);
					
					var decimalDays = (decimalMonths-months)*30;
					var days = Math.floor(decimalDays);
					
					var decimalHours = (decimalDays-days)*24;
					var hours = Math.floor(decimalHours);
					
					var decimalMinutes = (decimalHours-hours)*60;
					var minutes = Math.floor(decimalMinutes);
					
					var decimalSeconds = (decimalMinutes-minutes)*60;
					var seconds = Math.floor(decimalSeconds);
					

					 if(years>1){
					 	return 100;
					 }else if(months > 6){
					 	return 90;
					 }else if(months > 2){
					 	return 80;
					 }else if(months > 1){
					 	return 70;
					 }else if(days > 15){
					 	return 60;
					 }else if(days > 1){
					 	return 50;
					 }else if(hours > 12){
					 	return 40;
					 }else if(hours > 3){
					 	return 30;
					 }else if(hours > 1){
					 	return 20;
					 }else if(minutes > 10){
					 	return 10;
					}else{
					 	return 0;
					 }
					 //return 'Attaquable en '+time.substring(0,time.length-2);
					}
					
			 });
        } 
    }); 
})(jQuery); 
