   img0 = new Image(); 
   img1 = new Image();
   img2 = new Image();
   img3 = new Image();

   img0.src = 'http://www.pastest.co.uk/images/PWordStrength/short.gif';
   img1.src = 'http://www.pastest.co.uk/images/PWordStrength/weak.gif';
   img2.src = 'http://www.pastest.co.uk/images/PWordStrength/medium.gif';
   img3.src = 'http://www.pastest.co.uk/images/PWordStrength/strong.gif';

   var strengthlevel = 0;
   var strengthimages = Array( img0.src, img1.src, img2.src, img3.src );

   function updatestrength( pw,el ) {
  if( istoosmall( pw ) ) {
 strengthlevel = 0;
  }
  else if( !isfair( pw ) ) { 
 strengthlevel = 1;
  }    
  else if( hasnum( pw ) ) {
 strengthlevel = 3;
  }
  else {
 strengthlevel = 2;
  }
  document.getElementById(el).src = strengthimages[ strengthlevel ];
   }
   function isfair( pw ) {
  if( pw.length < 7 ) {
 return false;
  }
  else { 
 return true;
  }
   }

   function istoosmall( pw ) {
  if( pw.length < 4 ) {
 return true;
  }
  else {
 return false;
  }
   }
   function hasnum( pw ) {
  var hasnum = false;
  for( var counter = 0; counter < pw.length; counter ++ ) {
 if( !isNaN( pw.charAt( counter ) ) ) {
hasnum = true;
 }
  }
  return hasnum;
   }