$(document).ready(function ()
{
	$('#searchfield').autocomplete({source: "kunde/HotelOrteAjax.php", select: function(event, ui) {this.value = ui.item.value; $('#searchform').submit();}});	
		
	$('#searchfield').focus();

	$('#start_search').click(function () {
		if ($('#searchfield').val() == $('#searchfield').attr('title'))
		{
			$('#searchfield').val('');
		}
	});
	
	var eng = ($('html').attr('lang') == 'de') ? '' : '_eng';
	
	var preTagung = new Image();
	preTagung.src = "taan_aktiv" + eng + ".png";
				
	$('#tagungsanfrage').hover(function ()
	{
		this.src =  preTagung.src;   
	},
	function()
	{
		this.src = "taan_inaktiv" + eng + ".png"; 
	});
	
	var preGruppen = new Image();
	preGruppen.src = "gran_aktiv" + eng + ".png";
	
	$('#gruppenanfrage').hover(function ()
	{
		this.src =  preGruppen.src 
	},
	function()
	{
		this.src =  "gran_inaktiv" + eng + ".png";
	});
	
	
	$('#kunden_loginformular_passwort').focus(function ()
	{
		$('#kunden_loginformular_passwort').hide();
		$('#kunden_loginformular_passwortschutz').show();
		$('#kunden_loginformular_passwortschutz').focus();
	});

	$('#kunden_loginformular_passwortschutz').blur(function ()
	{
		if ($(this).val() == '')
		{           
			$('#kunden_loginformular_passwort').show();
			$('#kunden_loginformular_passwortschutz').hide();
			$('#kunden_loginformular_passwort').val(this.title);   
		}
	});
	
	$('#hotel_loginformular_passwort').focus(function ()
	{
		$('#hotel_loginformular_passwort').hide();
		$('#hotel_loginformular_passwortschutz').show();
		$('#hotel_loginformular_passwortschutz').focus(); 
	});
	
	$('#hotel_loginformular_passwortschutz').blur(function ()
	{
		if ($(this).val() == '')
		{           
			$('#hotel_loginformular_passwort').show();
			$('#hotel_loginformular_passwortschutz').hide();
			$('#hotel_loginformular_passwort').val(this.title); 
		}
	});
	
	$('#kunden_submit').click(function ()
	{
		$("#kunden_loginformular").submit(); 
	});
	
	$('#hotel_submit').click(function ()
	{
		$("#hotel_loginformular").submit();
	});
	
	$('#hotel_loginformular_passwortschutz').keypress(function (e)
	{
		if (e.keyCode == 13)
		{
			$("#hotel_loginformular").submit();
		}
	});
	
	$('#kunden_loginformular_passwortschutz').keypress(function (e)
	{
		if (e.keyCode == 13)
		{
			$("#kunden_loginformular").submit();
		}
	});
	
	if($.browser.msie && $.browser.version < 7)
	{

		$('#infodiv').css('position', 'absolute')
		$(window).scroll(function() {
			$('#infodiv').css('top', $(this).scrollTop()+20 + "px");
		});
	}	
	
	
	$(document).keypress(function(e)
	{
		if (e.keyCode == 27)
		{
			$('#infodiv').fadeOut(500);
		}
	});
	
	$('#infodivclose').click(function() {
		$('#infodiv').fadeOut(500);
	});
});
