jQuery(document).ready(function()
{
 jQuery('#password').keyup(function()
 {
  return passwordChanged();
 });
});

function passwordChanged()
{
 var strength = document.getElementById('strength');
 var mediumRegex = /^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$/;
 //var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\W).*$", "g");
 var strongRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
 var enoughRegex = new RegExp("(?=.{6,}).*", "g");
 var pwd = document.getElementById("password");


 if (pwd.value.length<5)
 {
  jQuery('#pass-indicator').animate({width:'130px'}, 'slow').css('backgroundColor','red');
  jQuery('#passStatus').html('Too Short');
 }
 else if (false == enoughRegex.test(pwd.value))
 {
  jQuery('#pass-indicator').animate({width:'130px'}, 'slow').css('backgroundColor','red');
  jQuery('#passStatus').html('Weak');
 }
 else if (strongRegex.test(pwd.value))
 {
  jQuery('#pass-indicator').animate({width:'130px'}, 'slow').css('backgroundColor','green');
  jQuery('#passStatus').html('Strong');
 }
 else if (mediumRegex.test(pwd.value))
 {
  jQuery('#pass-indicator').animate({width:'130px'}, 'slow').css('backgroundColor','yellow');
  jQuery('#passStatus').html('Medium');
 }
 else
 {
  jQuery('#pass-indicator').animate({width:'130px'}, 'slow').css('backgroundColor','red');
  
 }
 
}

Event.observe(window, 'load', function() {

	var arrProducts	=	document.getElementsByClassName('catProduct_name');
	if(arrProducts != 'undefined'){
		for(i=0;i<arrProducts.length;i+=3)
		{
			h1	=	getMax(i,arrProducts);
			
			for(j=0;j<3;j++)
			{
				if((i+j)<arrProducts.length)
					arrProducts[i+j].style.height	=	(h1+5)+'px';
			}
		}
	}
});


function getMax(loc,arrProducts)
{
	var count	=	0;
	max1	=	arrProducts[loc].offsetHeight;

	if(	(loc+1 < arrProducts.length) && (max1 < arrProducts[loc+1].offsetHeight ) )
	{
		max1	=	arrProducts[loc+1].offsetHeight;
		if(	(loc+2 < arrProducts.length) && (max1 < arrProducts[loc+2].offsetHeight ) )
			max1	=	arrProducts[loc+2].offsetHeight;
		
		return max1;
	}else if((loc+2 < arrProducts.length) && (max1 < arrProducts[loc+2].offsetHeight )){
		max1	=	arrProducts[loc+2].offsetHeight;
		return max1;
	}
	

	return max1;
}

