$(function()
{
	$('input[title], textarea[title]').each(function()
	{
		InputHelperCreate(this, this.title);
	});
	
	if ($('#pane ul').length) {
		var paneConfig = {
			 sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
			 interval: 200, // number = milliseconds for onMouseOver polling interval    
			 over: paneOver, // function = onMouseOver callback (REQUIRED)    
			 timeout: 500, // number = milliseconds delay before onMouseOut    
			 out: paneOut // function = onMouseOut callback (REQUIRED)    
		};
		$('#pane ul').hoverIntent(paneConfig);
	}
	
	if ($('ul.menu').length) {
		$('ul.menu').superfish();
	}
	
	if ($('.lentafoot ul').length) {
		$('.lentafoot ul li:last').addClass('last');
	}
});

function paneOver() {
	$('#pane ul li').slideDown();
	$('#pane ul li:first').addClass('first');
	$('#pane ul li.current').addClass('over');
}

function paneOut() {
	$('#pane ul li').slideUp();
	$('#pane ul li.current').stop().removeClass('over');
}

function InputHelperIn(obj, text) {
	if (obj.value == text)
		$(obj).val('');
}

function InputHelperOut(obj, text) {
	if (obj.value == '' || obj.value == text)
		$(obj).val(text);
}

function InputHelperCreate(obj, text) {
	$(obj).bind ('focus',function() {
		InputHelperIn(this, text);
	}).bind ('blur', function() {
		InputHelperOut(this, text);
	});
	
	InputHelperOut(obj, text);
}
