﻿$(function() {
  $.datepicker.setDefaults($.extend({ showMonthAfterYear: false }, $.datepicker.regional['de']));
  $("#ctl10_tbDatepicker_an, #ctl10_tbDatepicker_ab, #menu1_tbAnreise, #menu1_tbAbreise").datepicker({ showOn: 'button', buttonImage: '../js/ui-lightness/images/calendar.gif', buttonImageOnly: true });
});


function ValidLength(item, len) 
{	return(item.length >=len);
}

function ValidEmail(item)
{	if(!ValidLength(item,5)) return false;
	if(item.indexOf('@',0) == -1) return false;
	if(item.indexOf('.',0) == -1) return false;
	if(item.indexOf(',',0) > 0) return false;
	return true;	
}

function sendform()
{	errfound = false;
	if (!ValidEmail(document.form1.EMAIL.value))
		error(document.form1.EMAIL, "Fehlendes oder falsches E-Mail");
	if (!ValidLength(document.form1.COGNOME.value,3))
		error(document.form1.COGNOME,"Fehlender oder falscher Nachname oder Name");
	if (!ValidLength(document.form1.NOME.value,3))
		error(document.form1.NOME,"Fehlender oder falscher Nachname oder Name");
	if (errfound == false)
		document.form1.submit();
}

function error(elem, text)
{	if (errfound) return;
	window.alert(text)
	elem.select();
	elem.focus;
	errfound = true;
}

var yyy = 0;
var xxx = 0;
document.onmousemove=get_mouse;

function get_mouse(e)
{
	var isNS;
	var isIE=(document.all);
	var x=(isNS)?e.pageX:event.x+document.body.scrollLeft;
	xxx = x;
	if(isNS)
		var y=e.pageY;
	if(isIE)
	{
		y=event.y;
		if(navigator.appVersion.indexOf("MSIE 4")==-1)
			y+=document.body.scrollTop;
		}
	yyy = y;
}

function Eta(tmp, xx)
{
	for (i=1;i<10;i++)
	{
		var XPRE= document.getElementById('AGE_' + tmp + '_' + i);
		XPRE.style.display='none';
	}
	for (i=1;i<=xx;i++)
	{
		var XPRE= document.getElementById('AGE_' + tmp + '_' + i);
		XPRE.style.display='';
	}
}

function AddRoom()
{
	for (i=1;i<=10;i++)
	{
		var XPRE= document.getElementById('ROOM_' + i);

		if (XPRE.style.display=='none') 
		{
		XPRE.style.display='';
		if (i == 10)
			{
			var YPRE= document.getElementById('PLUS');
			YPRE.style.display='none';
			}
		return;
		}
	}
}