$.fn.setCat=function() {
	var $bl=$(this).find(".catalogBlock"); var $tbl=$bl.find(".catalogLink");
	return this.each(function() {
		var num=$bl.size(); var i=0;
		while (i<num) {
			sbl=$bl.slice(i,i+3); i+=3; h=0; th=0;
			for (j=0;j<sbl.length;j++) {
				h=h<$(sbl[j]).height()?$(sbl[j]).height():h;
				th=th<$(sbl[j]).find(".catalogLink").height()?$(sbl[j]).find(".catalogLink").height():th;
			}
			for (j=0;j<sbl.length;j++) { $(sbl[j]).height(h); th<$(sbl[j]).find(".catalogLink").height(th); }
		}
	});
};

$(document).ready(function() {

	if (/MSIE((5\.5)|[6])/.test(navigator.userAgent)&&navigator.platform=="Win32") {
		sheets=document.styleSheets[0].rules;
  for (i=0;i<sheets.length;i++) {
	  obj=sheets[i].style;
   if (arr=/url\((\s*\S+\.png\s*)\)\s*/.exec(obj.backgroundImage.toLowerCase())) {
				obj.backgroundImage='url(/i/p.gif)';
    obj.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+arr[1]+"'"+(obj.backgroundRepeat!='no-repeat'?", sizingMethod='scale'":",sizingMethod='crop'")+")";
			}
  }
 }
	//$(document).pngFix(); 
    
	if ($('.img')) {
  $.getScript('/js/jquery.slideShow.js',function() {
   $('.img').slideShow({
				play:true,
				speed:1000,
				//forward:'.switch',
				sh:'.switch'
				//back:'#dev-arrow-back'
   });
  });
	}
	
	$("#image").find("div:not('.arrBlock')").each(function() {
		//var speed="slow";
		//var direction="top";
  $(this).hover(
			function() {
				$(this).addClass("on");
    //$(this).find(".animus-top").slideDown("slow");;
    //$(this).find(".animus-bottom").inner_slide($(this), direction, {duration: speed, easing: "linear"} );
    //return false;
   },
			function() { 
    $(this).removeClass("on");
    //$(this).find(".animus-top").slideUp("slow");
    //$(this).find(".animus-bottom").hide(); 
   }
		);
 });
   
	$(".catalogBlock").each(function() {
		$(this).hover(
			function() { $(this).addClass("on"); },
			function() { $(this).removeClass("on"); }
		);
		$(this).click(function() { location.href=$(this).find(".catalogLink a").attr("href"); });
 });
	
	if ($(".catalog").is(".catalog")) $(".catalog").setCat();
});