function mcolh() {
	$('.main-col').each(
			function() {
				mcol1 = $(this).outerHeight() + $(this).offset().top;
				$('.side-col').each(function() {
					mcol2 = $(this).outerHeight() + $(this).offset().top;
				});
				if (mcol2 - mcol1 > 0) {
					$('.main-col .box .crow2')
							.css(
									'height',
									$('.main-col .box .crow2').height() + mcol2
											- mcol1);
				}
			});
}

$.fn.equal = function(reset) {
	if (!window.curmax || reset) {
		window.curmax = 0;
	}

	$(this).each(function() {
		if ($(this).height() > window.curmax) {
			window.curmax = $(this).height();
		}
	});

	$(this).css({
		'min-height' : window.curmax
	});
};

$.fn.max = function() {
	max = 0;
	$(this).each(function() {
		if (max < $(this).height()) {
			max = $(this).height();
		}
	});
	return max;
};

$(document).ready(function() {
	$('.menu>li>a').each(
			function() {
				var linkCont = $(this).html();
				$(this).html(
						'<span class="tx">' + linkCont
								+ '</span><span class="tx-h">'
								+ linkCont + '</span>');
			});
	$('.menu>li').hover(function() {
		$(this).addClass('hover');
		if ($(this).find('ul').html() != null) {
			$(this).addClass('sub');
		}
	}, function() {
		$(this).removeClass('hover').removeClass('sub');
	});

	Cufon
			.replace('.menu .tx,.menu .tx-h,.box h1,.box h2,#data h1, #data h2');

	$('.main-col').each(
			function() {
				if ($.browser.webkit) {
					mcolh();
					$('img').load(
							function() {
								$('.main-col .box .crow2').css(
										'height', 'auto');
								mcolh();
							});
				} else {
					mcolh();
				}
			});
	$('.search-box .txt').each(function() {
		if ($(this).val() == '') {
			$(this).siblings('label').show();
		}
		$(this).siblings('label').click(function() {
			$(this).hide();
			$(this).siblings('input.txt').focus();
		});
		$(this).focus(function() {
			if ($(this).val() == '') {
				$(this).siblings('label').hide();
			}
		});
		$(this).blur(function() {
			if ($(this).val() == '') {
				$(this).siblings('label').show();
			}
		});
	});

	$(".crow .crow2 h4, .crow .crow2 .intr").each(function() {
		if ($(this).html().replace(' ', "") == "") {
			$(this).remove();
		}
	});

	setTimeout(function() {
		$('div .icont').equal();
		$('div .btn-more').equal(true);
	}, 0);

});
