
	var minpwlength = 6;
	var fairpwlength = 8;
	
	var STRENGTH_SHORT = 0;  // less than minpwlength 
	var STRENGTH_WEAK = 1;  // less than fairpwlength
	var STRENGTH_FAIR = 2;  // fairpwlength or over, no numbers
	var STRENGTH_STRONG = 3; // fairpwlength or over with at least one number
	var STRENGTH_MAX = 4; // contains lowercase, uppercase and number
	
	img0 = new Image(); 
	img1 = new Image();
	img2 = new Image();
	img3 = new Image();
	img4 = new Image();
	
	img0.src = '/images/pwd/10000.gif';
	img1.src = '/images/pwd/11000.gif';
	img2.src = '/images/pwd/11100.gif';
	img3.src = '/images/pwd/11110.gif';
	img4.src = '/images/pwd/11111.gif';
	
	var strengthlevel = 0;
	
	var strengthimages = Array( 	img0.src,
					img1.src,
					img2.src,
					img3.src,
					img4.src );
	
	function updatestrength( pw ) {
	
		if( istoosmall( pw ) ) {
			strengthlevel = STRENGTH_SHORT;
		} else if( !isfair( pw ) ) { 
			strengthlevel = STRENGTH_WEAK;
		} else if( maxstrength( pw ) ) {
			strengthlevel = STRENGTH_MAX;
		} else if( hasnum( pw ) ) {
			strengthlevel = STRENGTH_STRONG;
		} else if( hasUC( pw ) ) {
			strengthlevel = STRENGTH_STRONG;
		} else {
			strengthlevel = STRENGTH_FAIR;
		}
		document.getElementById( 'strength' ).src = strengthimages[ strengthlevel ];
	}
	
	function isfair( pw ) {
		if( pw.length < fairpwlength ) {
			return false;
		} else { 
			return true;
		}
	}
	
	function istoosmall( pw ) {
		if( pw.length < minpwlength ) {
			return true;
		} else {
			return false;
		}
	}
	
	function hasnum( pw ) {
		var hasnum = false;
		if ( (pw.search(/[0-9]+/) > -1)
		  && (pw.length > fairpwlength) ) {
			  hasnum = true;
		  } 
		return hasnum;
	}
	function hasUC( pw ) {
		var hasnum = false;
		if ( (pw.search(/[a-z]+/) > -1)
		  && (pw.search(/[A-Z]+/) > -1)
		  && (pw.length > fairpwlength) ) {
			  hasnum = true;
		  } 
		return hasnum;
	}	
	function maxstrength( pw ) {
		var maxstrength = false;
		if ( (pw.search(/[a-z]+/) > -1)
		  && (pw.search(/[A-Z]+/) > -1)
		  && (pw.search(/[0-9]+/) > -1)
		  && (pw.length > fairpwlength) ) {
			  maxstrength = true;
		  } 
		  return maxstrength;
	}	


