<!--
function PasswordMark(passw){
	var Totalbar= 174;
	var scored = 0;
	var barcolor = "bar_green";
	var spasswOrig=passw;
    document.getElementById('bar_green').style.width = "0px";
    document.getElementById('bar_red').style.width = "0px";
    passw=deletebadchar(spasswOrig);
    //if (passw.length>=8){
	    scored = PasswStrong(passw);
	    Totalok = parseInt((Totalbar * scored) / 100);
		document.getElementById('bar_red').style.display = 'none';
		document.getElementById('bar_green').style.display = 'none';
	    if (checkonenum(passw)&&(passw.length>=8)&&(!detectbadchar(spasswOrig))){
			//if (Totalok < (Totalbar/3)){
			    //document.getElementById('bar_red').style.display = 'block';
			    //document.getElementById('bar_red').style.width = Totalok + "px";
			//}
			//else
			//{
				document.getElementById('bar_green').style.display = 'block';
			    document.getElementById('bar_green').style.width = Totalok + "px";
			//}
		}
		else
		{
			document.getElementById('bar_red').style.display = 'block';
			document.getElementById('bar_red').style.width = Totalok + "px";
		}
    //}
	//document.getElementById("barcolor").style.backgroundColor = barcolor;
	//document.getElementById(excvar).className = "";
	//document.getElementById("barblack").style.width = Totalbad + "px";
	//document.getElementById("percentdisplay").innerHTML = parseInt(scored) + "% ";
	//GetPasswText(scored);
}

function PasswStrong(origpassw)
{
var nu=0;
var nlw=0;
var nb=0;
var nsp=0;
var nd=0,nc=0;
var nlp=0, nl = origpassw.length;

var nmen = 0;
var cantLowerc = "";
var cantUpperc = "";
var cantNumber = "";
var cantSymbol = "";
var scored = 0;
var maxscored;

	if (nl > 0){
		nd = norepeatchars(origpassw);
		nc = nofollowchars(origpassw);

		for(i=0; i<origpassw.length; i++){
		//Revision in Unicode
			if (origpassw.charCodeAt(i) >= 'a'.charCodeAt(0) && origpassw.charCodeAt(i) <= 'z'.charCodeAt(0))
			{
			 cantLowerc += origpassw.substring(i, i+1);
			}
			  else if (origpassw.charCodeAt(i) >= 'A'.charCodeAt(0) && origpassw.charCodeAt(i) <= 'Z'.charCodeAt(0))
			  {
				cantUpperc += origpassw.substring(i, i+1);
			  }
				else if (origpassw.charCodeAt(i) >= '0'.charCodeAt(0) && origpassw.charCodeAt(i) <= '9'.charCodeAt(0))
				{
				 cantNumber += origpassw.substring(i, i+1);
				}
				else {
					cantSymbol += origpassw.substring(i, i+1);
				}	
		}

		//Know char type in password
		if (cantLowerc.length > 0)
		{
		  nlw=1;
		}  
		if (cantUpperc.length > 0)
		{
		  nb=1;
		}
		if (cantNumber.length > 0)
		{
		  nu=1;
		}
		if (cantSymbol.length > 0)
		{
		  nsp=1;
		}

		if (nl <=4 && nl>=1)
		{
		  nlp=nl/4;
		  nmen=nmen-20+nl;
		}
		if (nl < 6 && nl > 4)
		{
		  nlp=5*nl/6;
		  nmen=nmen-16+nl;
		}
		
		if (nl < 9 && nl >= 6)
		{
		  nlp=10*nl/9;
		  nmen=nmen-12+nl;
		}
		
		if (nl >= 9)
		{
		  nlp=30*nl/9;
		  nmen=0;
		}
		maxscored = Totalmaxscored(0,nlp);			   
				   
		if (cantNumber.length==0)
		{nmen=nmen-5;}
		if(cantUpperc.length==0)
		{nmen=nmen-2;}
		if(cantLowerc.length==0)
		{nmen=nmen-2;}
		if(cantSymbol.length==0)
		{
		  nmen=nmen-10;
		}


		if (nl < 6)
			{
			scored = parseInt(nlp + nmen + nu*5 + nlw*5 + nb*5 + (nsp*15) + nd*5 + nc*5 + 1*5 + 1*5 - 8/nl*6); //siendo el alta, no hay politica de psw definida, no tenemos ncg, nrp, ...
			}
		else{
			scored = parseInt(nlp + nmen + nu*5 + nlw*5 + nb*5 + (nsp*15)+ nd*5 + nc*5 + 1*5 + 1*5); //siendo el alta, no hay politica de psw definida, no tenemos ncg, nrp, ...
		}
		if (scored<=0){
			return 1;
		} //si scored es 0 y han insertado algun caracter mostrar un 1
		else{
			return (scored/maxscored)*100;			
		}
	}
	else{
		return scored;
	}

//nl/23*50+if(nu)*5+ if(nlw)*5+ if(nb)*5+ if(nsp)*15+if(nd)*10+if(nc)*10+if(ncg<=120)*10 + if(ncg>120 days and ncg<=180)*6 + if(ncg> 180 and ncg<360)*2 + if(never or nrep>20)*10+ if(nrep<=5)*2 + if(nrep>5 and nrep<=20)*7
//nl=longitude psw
//nu=si tiene numeros 
//nlw= si tiene mynuscolas
//nb= si tiene mayuscolas
//nsp= si tiene caracteres especiales
//nd= si caracteres repetidos continuos
//nc= si caracteres consecutivos continuos
//never= si no es posible repetir nunca un psw ya usado anteriormente
//nrep= veces que el psw tiene que ser diferente del anterior
//ncg=  dias si cambiar pws
	
	
}

function Totalmaxscored(nmen,nlp)
{
	return parseInt(nlp + nmen + 5 + 5 + 5 + (1*15) + 5 + 5 + 5 + 5);
}

//Devuelve string con char no continuados (ej: abcv -> av)
function Getnofollowchars(passw){
	val=0;
	nofollow = passw.substring(0,1);
	prevchar=passw.charCodeAt(0);

	for(i=1;i<passw.length;i++){
		val = passw.charCodeAt(i) - prevchar;
		prevchar = passw.charCodeAt(i);				
		if (val != 1 && val != -1) 
		{
		  nofollow += passw.substring(i,i+1);
		}
	}
	return nofollow;
}

//Devuelve string con caracteres no repetidos (ej: aab -> ab)
function Getnorepeatchars(passw)
{
	val=0
	norepeat = passw.substring(0,1);
	prevchar=passw.charCodeAt(0);
	for(i=1;i<passw.length;i++){
		val = passw.charCodeAt(i) - prevchar;
		prevchar = passw.charCodeAt(i);				
		if (val != 0) 
		{
		  norepeat += passw.substring(i,i+1);
		}
	}
	return norepeat;
}

function nofollowchars(stringpws)
{
  if(stringpws.length == Getnofollowchars(stringpws).length){ 
	return 1;
  }
  else{
	return 0;
  }
}

function norepeatchars(stringpws)
{
  if(stringpws.length == Getnorepeatchars(stringpws).length){ 
	return 1;
  }
  else{
	return 0;
  }
}
function detectbadchar(spwd)
{
    //Buscamos que no contenga caracteres como '<' '>' o espacio en blanco
    var bdetected = false;
    var icode=0;
    var lpwd=spwd.length;
    
    for(i=0; i<lpwd; i++){
        icode=spwd.charCodeAt(i);
        if (icode=='>'.charCodeAt(0) || icode=='<'.charCodeAt(0) || icode==' '.charCodeAt(0))
        {
            bdetected = true;
        }
    }
    return(bdetected);
}
function deletebadchar(spwd)
{
    //Elimina del string caracteres como '<' '>' o espacio en blanco
    var sValidated="";
    var sChar="";
    var icode=0;
    var ilen=spwd.length;
    
    for(i=0; i<ilen; i++){
        icode=spwd.charCodeAt(i);
        sChar=spwd.substring(i,i+1);
        if (icode!='>'.charCodeAt(0) && icode!='<'.charCodeAt(0) && icode!=' '.charCodeAt(0))
        {
            sValidated = sValidated + spwd.substring(i,i+1);
        }
    }
    return(sValidated)
}

function checkonenum(varpwd){
    //Buscamos que contenga mínimo un número
    var minim=0;
    var lpwd=varpwd.length;
    
    for(i=0; i<lpwd; i++){
        if (varpwd.charCodeAt(i) >= '0'.charCodeAt(0) && varpwd.charCodeAt(i) <= '9'.charCodeAt(0)) minim++;
    }
    if (lpwd>=8 && minim>0){
        return true;
    }
    else{
        return false;
    }
}

/*
function InitText(){
	document.getElementById('textdisplay2').style.display = 'none';
	document.getElementById('textdisplay3').style.display = 'none';
	document.getElementById('textdisplay4').style.display = 'none';
	document.getElementById('textdisplay5').style.display = 'none';
}

function GetPasswText(num)
{
	InitText();
	if (num > 0 && num < 26)
	{
		document.getElementById('textdisplay2').style.display = 'inline';
	}
	else if (num > 25 && num < 51)
	{
		document.getElementById('textdisplay3').style.display = 'inline';
	}
	else if (num > 50 && num < 76)
	{
		document.getElementById('textdisplay4').style.display = 'inline';
	}
	else if (num > 75 && num <= 100)
	{
		document.getElementById('textdisplay5').style.display = 'inline';
	}
	
}
*/
//-->