// выставить максимальную равную высоту группе объектов
function setEqualHeight(columns, max) {
   var tallestcolumn = 0
   columns.each(function() {
   currentHeight = $(this).height()
   if(currentHeight > tallestcolumn) {
      if (typeof(max)!='undefined' && currentHeight>max) {
         tallestcolumn = max
      }
      else {
         tallestcolumn = currentHeight
      }

   }
   });
   columns.height(tallestcolumn);
}

/*function setEqualHeight1(columns) {
   var tallestcolumn = 0;
   columns.each(function() {
   currentHeight1 = $(this).blochim();
   if(currentHeight1 > tallestcolumn) {
      tallestcolumn  = currentHeight1;
   }
   });
   columns.blochim(tallestcolumn);

}*/

// выставить события на наведение мыши
function setHover(columns, className) {
   //alert(className);
   columns.mouseover(function() {$(this).addClass(className);});
   columns.mouseout(function() {$(this).removeClass(className);});
}

jQuery(document).ready(function() {
   //setEqualHeight($("div.cat"));
   //setHover($("div.cat"), "cathover");
   //setHover($('.subcat_td'), "hover");

   // обработка клика - переход по первой ссылке внутри объекта
   $(".f1").click(function(){
      window.location=$(this).find("a").attr("href"); return false;
   });

   setEqualHeightAll()
});

function setEqualHeightAll() {
   //setEqualHeight($(".height"));
   setEqualHeight($(".zagol"), 31);
	setEqualHeight($(".zagol1"), 48);
   setEqualHeight($(".hei"));
   setEqualHeight($(".f2"));
   setEqualHeight($(".col7"));
   //console.log("ready")
}
function setEqualheightOnload(numrows) {
   jQuery(window).load(function() {
		for (i=0; i<numrows; i++) {

			setEqualHeight($(".height" + i));
			setEqualHeight($(".f2" + i));
			setEqualHeight($("div.cellrow" + i));
			//setHover($("div.cellrow" + i), "cathover");
			//console.log("ready: row "+i)
		}

		// убираем бордеры у последних ячеек
		/*$(".last_in_row .f1, .last_in_row p.buy a").css('border-right', 'none');*/

	});
}

