if (typeof window.console === 'undefined') {
	window.console = {
		log: function () {
			void(0);
		}
	};
}

var hoverTime;
function hideDropDownMenu() {
	$('#dropDownMenu')
		.hide()
	;
}

jQuery(function($) {
	var currContentHeight = 0;
	var maxContentHeight = 0;
	var currTitleHeight = 0;
	var maxTitleHeight = 0;
	var rowLeveler = $('.rowLeveler');
	rowLeveler.each(function() {
		var titleLeveler = $(this).find('.titleLeveler');
		titleLeveler.each(function() {
			currTitleHeight = $(this).height();
			//console.log(this, 'title height:', currTitleHeight, 'px');
			if (currTitleHeight > maxTitleHeight) {
				maxTitleHeight = currTitleHeight;
			}
		});
		titleLeveler.height(maxTitleHeight);
		//console.log('Setting all above objects\' title height to:', maxTitleHeight, 'px');
		currTitleHeight = 0;
		maxTitleHeight = 0;
		
		var contentLeveler = $(this).find('.contentLeveler');
		contentLeveler.each(function() {
			currContentHeight = $(this).height();
			//console.log(this, 'content height:', currContentHeight, 'px');
			if (currContentHeight > maxContentHeight) {
				maxContentHeight = currContentHeight;
			}
		});
		contentLeveler.height(maxContentHeight);
		//console.log('Setting all above objects\' content height to:', maxContentHeight, 'px');
		currContentHeight = 0;
		maxContentHeight = 0;
	});
	
	/*$('input:text, textarea')
		.hint()
	;*/
	
	$('.target_blank')
		.attr('target', '_blank')
	;
	
	$('.submitCheck')
		.attr('value', '1')
	;
	
	$('a.inputButton')
		.click(function() {
			$(this)
				.parents('form')
					.submit()
			;
		})
	;
	
	$('.preventDefault')
		.click(function(e) {
			e
				.preventDefault()
			;
		})
	;
	
	var freecapCode = $('#freecapCode');
	freecapCode
		.click(function () {
			var src = $(this).attr('src');
			var pos = src.lastIndexOf('?');
			if (pos === -1) {
			    pos = src.length;
			}
			src = src.substring(0, pos);
			$(this)
				.attr('src', src + '?' + Math.round(Math.random() * 9999999999));
		})
	;
	
	var servicesShower = $('.servicesShower');
	var servicesShowerXPos = $('.servicesShower').position().left;
	var servicesShowerYPos = $('.servicesShower').position().top;
	var servicesShowerHeight = $('.servicesShower').height();
	var dropDownMenu = $('#dropDownMenu');
	servicesShower
		.hover(function() {
			dropDownMenu
				.css('left', servicesShowerXPos + 18)
				.css('top', servicesShowerYPos + servicesShowerHeight - 7)
				.show()
			;
		}, function() {
			hoverTime = setTimeout("hideDropDownMenu()", 200);
		})
	;
	dropDownMenu
		.hover(function() {
			clearTimeout(hoverTime);
		}, function() {
			dropDownMenu
				.hide()
			;
		})
	;
	
	$('#slideShow')
		.cycle({ 
			fx: 'fade',
			timeout: 5000,
			speed: 2000
		})
	;
});