function PopupGuarantee()
{
	window.open('/Common/Popups/Guarantee.cfm', 'Guarantee','toolbar=no,width=500,height=315,left=300,top=300,status=no,scrollbars=yes,resize=yes');
}

function PopupFreeRooms()
{
	window.open('/Common/Popups/FreeRooms.cfm', 'FreeRooms','toolbar=no,width=500,height=255,left=300,top=300,status=no,scrollbars=yes,resize=yes');
}

function PopupDemoGroup() 
{
	popupDemoGroup = window.open('http://www.HotelPlanner.com/Common/Popups/DemoGroup.cfm', 'DemoGroup','location=yes,scrollbars=yes,width=805,height=730,left=5,top=5,status=no,toolbar=no,location=no,resizable=yes'); 
} 
	
function checkEnter(e, theForm)
{ 
	var characterCode;
	
	if (e && e.which)
	{ //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
	}
	else
	{
		e = event;
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}
	
	if (characterCode == 13)
	{ 
		//if generated character code is equal to ascii 13 (if enter key)
		theForm.submit(); //submit the form
		return false;
	}
	else
	{
		return true; 
	}
}

function checkIfGroup(NumRooms, GroupTypes)
{ 
	if ( parseInt(NumRooms.value) <= 5 )
	{ 
		GroupTypes.disabled = true;
		if (GroupTypes.selectedIndex == 0)
		{
			GroupTypes.options[1].selected=true;
		}
	}
	else
	{
		GroupTypes.disabled = false;
		if (GroupTypes.selectedIndex == 1)
		{
			GroupTypes.options[0].selected=true;
		}
	}
}

function validate(thenum)
{
	var valid = "0123456789"
	var mynum = eval(thenum.length);
	var ok = "yes";
	var temp;
	for (var i=0; i<mynum; i++) 
	{
		temp = "" + thenum.substring(i, i+1);
		if(valid.indexOf(temp) == "-1") ok = "no";
	}
	return (ok == "no")?1:0;
}

function CalcRoom()
{
	var iRoomType = -1;
	pp=document.frmSpace.NumPeople.value;
	if(pp=="") pp = "";
	var d=validate(pp);
	if(d==1)
	{
		//alert("You must enter a number.");
	}
	else
	{
		nogo=1;
		iRoomType = document.frmSpace.RoomType.options[document.frmSpace.RoomType.selectedIndex].value;

		switch( iRoomType )
		{
		case 3: //Conference
			if(pp>24) alert("A Conference Style Layout is Not Recommended for Groups of More than 24 People.");
			break;
		case 4: //H-Square
			if(pp>52 || pp<10) alert("A Hollow Square Style Layout is Only Recommended for Groups Between 10 and 52 People.");
			break;
		default:
			nogo = 0;
		};

		if(nogo!=1)
		{
			i=0;
			if(1 == iRoomType) i = 12.0192;
			if(2 == iRoomType) i = 12.0192;
			if(13 == iRoomType) i = 24.0211;
			if(3 == iRoomType) i = 40.16667;
			if(4 == iRoomType) i = 38.461;
			if(5 == iRoomType) i = 9.46969;
			if(6 == iRoomType) i = 9.46969;
			if(7 == iRoomType) i = 17.543;
			if(8 == iRoomType) i = 10;
			if(9 == iRoomType) i = 9.009;
			if(10 == iRoomType) i = 160;
			if(11 == iRoomType) i = 200;
			if(12 == iRoomType) i = 35;
			if(14 == iRoomType) i = 17.17032;
			
			roomz=pp*i;
			
			if (document.frmSpace.WidthMetric.options[document.frmSpace.WidthMetric.selectedIndex].value == 'Feet' && Math.round(roomz) > 0)
				document.frmSpace.RoomSize.value=Math.round(roomz);
			else if ( Math.round(roomz) > 0)
				document.frmSpace.RoomSize.value=Math.round(roomz* 0.09290304);  //Convert to sq meters
				
			if(iRoomType == 10 || iRoomType == 11)
			{
				hide('PeopleLabel');
				show('BoothLabel');
			}	
			else
			{
				show('PeopleLabel');
				hide('BoothLabel');
			}	
				
		}
	}
}
	