$(function() {
	
	// Pretty main navigation
	$('.navigation > ul').tvgMenu();
	
	// Pretty user navigation
	$('.user_navigation > ul').each(function() {
		$(this).tvgUserMenu();
	});
	
	// Pretty fonts
	//Cufon.replace($('.user_controls .identification, .pane .more a, .page_feature .more a, .events .more a'), { hover: true });
	Cufon.replace($('.page_content .more a, .pane .more a, .page_feature .more a, .events .more a'), { hover: true });
	
	// Widget onchange submit
	$('.find_a_hotel select').change(function() {
		$(this).closest('form').submit();
	});
	
	// Certain links open in a new window (target attribute not valid XHTML)
	$('a.new, a.external').attr('target', '_blank');
	
	// DIVs into clickable links
	$('.pane, .page_feature, .lodger_type li').each(function() {
		var $a = $(this).find('a');
		if ($a.length !== 1) {
			return;
		}
		$(this).click(function() {
			window.location.href = $a.attr('href');
		});
		$(this).hover(
			function() {
				$(this).addClass('hover');
			},
			function() {
				$(this).removeClass('hover');
			}
		);
	});
	
	// Autocomplete off
	$.each($('.no_autocomplete'), function () {
		this.setAttribute('autocomplete', 'off');
	});
	
	// Press release jumper
	$('.edit_jumper input').hide();
	$('.edit_jumper select').change(function() {
		$(this).closest('form').submit();
	});
	
	// FCKeditor
	var fck = new Array();
	var i = 0;
	$('textarea.html').each(function() {
		i++;
		fck[i] = new FCKeditor($(this).attr('id'));
		fck[i].BasePath = '/packages/fckeditor/';
		fck[i].Config['CustomConfigurationsPath'] = '/js/fckconfig_basic_user_edit.js';
		fck[i].Config['AutoDetectLanguage'] = true;
		fck[i].Height = '512';
		fck[i].ReplaceTextarea();
	});
});

function deleteAlert() {
	return confirm('Are you absolutely sure? You cannot undelete.');
}