function show(id,button)
{
	document.getElementById(id).style.display="";
	button.style.display="none";
}

function widgetover()
{
	this.oldcol=this.style.borderColor;
	this.oldbcol=this.style.backgroundColor;
	this.style.borderColor="black";
	this.style.backgroundColor="#c8ecfb";
	var n=this.nextSibling;
	while (n) {
		if (n.className=="buttoncaption") break;
		n=n.nextSibling;
	}
	if (n) {
		this.oldcaption=n;
		this.oldcc=n.style.color;
		n.style.color="black";
	}
}

function reallycancel()
{
	return confirm("Are you sure you want to cencel this booking?");
}

function widgetout()
{
	this.style.borderColor=this.oldcol;
	this.style.backgroundColor=this.oldbcol;
	var n=this.oldcaption;
	if (n) n.style.color=this.oldcc;
}

function init()
{
//	var l=document.getElementsByTagName("div");
//	for (var i=0;i<l.length;i++)
//	{
//		if (l[i].className=="item"||l[i].className=="button") {
//			l[i].onmouseover=widgetover;
//			l[i].onmouseout=widgetout;
//		}
//	}	
	var l=document.getElementsByTagName("input");
	for (var i=0;i<l.length;i++)
	{
		if (l[i].className=="numeric") {
			l[i].onkeypress=nc;
		}
	}	
}

function nc(e)
{
	var key;
	var keychar;
	if (window.event)
		key = window.event.keyCode;
	else if (e)
		key = e.which;
	else
		return true;
	keychar = String.fromCharCode(key);

	// control keys
	if ((key==null) || (key==0) || (key==8) || 
		(key==9) || (key==13) || (key==27) )
		return true;

	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
		return true;

	else
	return false;
}

function checkguests(fm)
{
	var l=fm.getElementsByTagName("input");
	var b=false;
	for (var i=0;i<l.length;i++)
	{
		var n=l[i].value;
		if (n=="") b=true;
	}	
	if (b) alert("One of the guest names is empty");
	return !b;
}

window.onload=init;

