jQuery.fn.setEqualHeight=function(o) {
    	var maxHeight=0;
    	var maxElement=null;
     	jQuery(this).each(function(i) {
          		if((jQuery(this).height()+parseInt(jQuery(this).css("padding-bottom"))+parseInt(jQuery(this).css("padding-top")))>maxHeight) {
    			maxHeight=jQuery(this).height()+parseInt(jQuery(this).css("padding-top"))+parseInt(jQuery(this).css("padding-bottom"));
    			maxElement=this;
    		}
    	});
    	jQuery(this).not($(maxElement)).each(function() {$(this).height(maxHeight-parseInt(jQuery(this).css("padding-top"))-parseInt(jQuery(this).css("padding-bottom")))})
    }
$(function() {
 $('#topMenu li:last').addClass('lastChild');
 $("ul#prodList li:nth-child(4n)").addClass('fourth');
 $("#sitemap ul li.parent:nth-child(3n)").addClass('third');
 $('#sitemap ul li.parent').setEqualHeight();
 $("#left ul li").hover(
  function () {
    $(this).addClass('active');
  }, 
  function () {
     $(this).removeClass('active');
  }
);
$("ul#prodList li").hover(
  function () {
    $(this).addClass('active');
  }, 
  function () {
     $(this).removeClass('active');
  }
);
$("#search label").hover(
  function () {
    $("#tooltip").css('display','block');
  }, 
  function () {
     $("#tooltip").css('display','none');
  }
);
	$('#enquiry .enquiry').click(function() {
  		$('#enquiryForm').fadeIn('slow');
		return false;
	});
	$('#enquiry a.close').click(function() {
  		$('#enquiryForm').fadeOut('slow');
		return false;
	});
});



function newsletter(d)
{
	
  var emailRegEx = new RegExp(/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/);

  if(d.name.value=='')
	{
		alert('please enter your name.');
		d.name.focus();
		return false;
	}
	if(d.email.value=='')
	{
		alert('please enter your email id');
		d.email.focus();
		return false;
	}
	
	if(d.email.value!='')
	{
	    if(!d.email.value.match(emailRegEx)){
			alert('please enter valid email id');
			d.email.focus();
			return false;
			}
	}
	if(d.security_code.value=='')
	{
		alert('please enter security code');
		d.security_code.focus();
		return false;
	}	
}

