$(document).ready(function() {
	var currContentHeight = 0;
	var maxContentHeight = 0;
	var currTitleHeight = 0;
	var maxTitleHeight = 0;
	var oneRowLevel = $(".oneRowLeveler");
	oneRowLevel.each(function() {
		var titleLeveler = $(this).find(".titleLeveler");
		//console.log(titleLeveler);
		titleLeveler.each(function() {
			currTitleHeight = $(this).height();
			if (currTitleHeight > maxTitleHeight) {
				maxTitleHeight = currTitleHeight;
			}
		});
		titleLeveler.height(maxTitleHeight);
		//console.log(maxTitleHeight);
		currTitleHeight = 0;
		maxTitleHeight = 0;

		var contentLeveler = $(this).find(".contentLeveler");
		//console.log(contentLeveler);
		contentLeveler.each(function() {
			currContentHeight = $(this).height();
			if (currContentHeight > maxContentHeight) {
				maxContentHeight = currContentHeight;
			}
		});
		contentLeveler.height(maxContentHeight);
		//console.log(maxContentHeight);
		currContentHeight = 0;
		maxContentHeight = 0;
	});

	hs.graphicsDir = '/js/highslide/graphics/';
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.outlineType = 'rounded-white';
	hs.fadeInOut = true;
	//hs.dimmingOpacity = 0.75;

	// Add the controlbar
	if (hs.addSlideshow) hs.addSlideshow({
		//slideshowGroup: 'group1',
		interval: 3000,
		repeat: false,
		useControls: true,
		fixedControls: false,
		overlayOptions: {
			opacity: 1,
			position: 'top right',
			hideOnMouseOut: false
		}
	});

	$('#oneProduct .smallPic').hover(function() {
		smallIMG = $(this).attr('href');
		bigIMG = $(this).attr('alt');
		oldIMG = $('#oneProduct .bigPic img');
		$('#oneProduct .bigPic')
			.attr('href', bigIMG);
		if (oldIMG.attr('src') !== smallIMG) {
			oldIMG
				.fadeTo(200, 0.1, function() {
					$(this)
						.attr('src', smallIMG)
						.fadeTo(200, 1);
				});
		}
	}, function() {});

	$("input:text").hint();

	$(".latestInfo, #footer").corner("5px");
	$("#navMenu").parent().css("background-color", "#e6e6e6").css("padding", "1px").corner("5px").children("#navMenu").css("background-color", "#f6f6f6").corner("5px");
	
	$('a.target_blank')
		.attr('target', '_blank');
		
	$('.noAction')
		.click(function (e) {
			e.preventDefault();
		});
		
	$('#contactUs .right .map')
		.click(function () {
			location.href = $('#maplink').attr('href');
		})
		.css({ cursor: 'pointer' });
});
