function fillInput(elemid) {
	
	var num = prompt('Enter a number:','');
	if(isNaN(num)) {
	
		alert('The value ' + num + ' is not a number');
		exit;
	} 
	if(num == 0)
	{
		exit;
	}
	for(i=0; i<7; i++) {
	var field = (elemid + "[" + i + "]");
	document.getElementById(field).value=num;
	document.getElementById(field).className='filled';

}
}
function fillInput2(elemid, category) {
	
	var num = prompt('Enter a number:','');
	if(isNaN(num)) {
	
		alert('The value ' + num + ' is not a number');
		exit;
	} 
	if(num == 0)
	{
		exit;
	}
	for(i=0; i<7; i++) {
	var field = (category + "[" + elemid + "]" + "[" + i + "]");
	document.getElementById(field).value=num;
	document.getElementById(field).className='filled';

}
}

function changeClass(elem) {
	document.getElementById(elem).value='';
	document.getElementById(elem).className='textchange';
}
function switchClass(id) {
	document.getElementById(id).className='focus';
}
function switchBack(id) {
	document.getElementById(id).className='back';
}
function newClass(elem) {
	if(document.getElementById(elem).value != 0) {
	document.getElementById(elem).className='filled';
	} else {
	document.getElementById(elem).className='num';
		}
}
function checkSum(elem) {
	
}
function showInput(id,style,id2,style2) {
	document.getElementById(id).className=style;
	document.getElementById(id2).className=style2;
}

function showMsg(id,h2,msg,parent) {
	leftPos = findPosX(document.getElementById(parent)) + 40;
	topPos = findPosY(document.getElementById(parent)) + 43;
	leftPos = leftPos + 'px';
	topPos = topPos + 'px';
	var div = document.createElement('div');
	div.setAttribute('class','hover_box');
	div.setAttribute('id',id);
	div.setAttribute('className','hover_box');
	div.style.left=leftPos;
	div.style.top=topPos;
	document.getElementById(parent).appendChild(div);
	var heading = document.createElement('h2');
	heading.setAttribute('class','box_heading');
	heading.setAttribute('className','box_heading');
	heading.setAttribute('id', 'box_heading');
	var title = document.createTextNode(h2);
	heading.appendChild(title);
	div.appendChild(heading);
	var text = document.createElement('p');
	var tcontent = document.createTextNode(msg);
	text.appendChild(tcontent);
	div.appendChild(text);
	
}
function showMsg2(id,p,parent) {
	leftPos = findPosX(document.getElementById(parent)) + 40;
	topPos = findPosY(document.getElementById(parent)) + 43;
	leftPos = leftPos + 'px';
	topPos = topPos + 'px';
	var div = document.createElement('div');
	div.setAttribute('class','hover_box');
	div.setAttribute('id',id);
	div.setAttribute('className','hover_box');
	div.style.left=leftPos;
	div.style.top=topPos;
	document.getElementById(parent).appendChild(div);
	var heading = document.createElement('p');
	heading.setAttribute('class','box_text');
	heading.setAttribute('className','box_text');
	heading.setAttribute('id', 'box_text');
	var title = document.createTextNode(p);
	heading.appendChild(title);
	div.appendChild(heading);
	
}

function removeMsg(id,parent) {
	
	var elem = document.getElementById(parent);
	var box = document.getElementById(id);
	elem.removeChild(box);
	
}
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}
function showMeals() {
	document.getElementById('lunch-2').className='show';
	document.getElementById('lunch-3').className='show';
	document.getElementById('bbq-1').className='show';
	document.getElementById('bbq-2').className='show';
	document.getElementById('dinner-2').className='show';
	document.getElementById('meals_show').className='noshow';
	document.getElementById('meals_dynamic').className='show';
}
function hideMeals() {
	document.getElementById('lunch-2').className='noshow';
	document.getElementById('lunch-3').className='noshow';
	document.getElementById('meals_show').className='show';
	document.getElementById('meals_dynamic').className='noshow';
	document.getElementById('bbq-1').className='noshow';
	document.getElementById('bbq-2').className='noshow';
	document.getElementById('dinner-2').className='noshow';
	}
	function startForm() {
		document.getElementById('fname').focus();
	}
	function submitForm() {
		document.myform.submit();
	}
	
	function load(url) {
var load = window.open(url,'','scrollbars=yes,menubar=no,height=600,width=400,resizable=yes,toolbar=no,location=no,status=no');
}

/**
* Toggle the last six accommodation types for the website
*/
function showMore()
{
	//var options = new Array("Triple", "Quad", "Five", "Six", "SpaSingle", "SpaDouble");
	var options = new Array(6);
	
	options[0] = "Triple";
	options[1] = "Quad";
	options[2] = "Five";
	options[3] = "Six";
	options[4] = "SpaSingle";
	options[5] = "SpaDouble";
	
	var link = document.getElementById("showLink").childNodes[0];
	
	for(var i = 0; i<options.length; i++)
	{
		var row = document.getElementById("accom" + options[i]);
		if(row.style.display == 'none')
		{
			row.style.display = 'table-row';
			link.nodeValue = 'Show Less';
		}
		else
		{
			row.style.display = 'none';
			link.nodeValue = 'Show More';
		}
	}
}

	
	
