// JavaScript Document
function clearText(inputID,textCheck)
{
	var formElement= document.getElementById(inputID);
	if (formElement.value == textCheck)
	formElement.value = "";
} 
function submitForm(formId) {
	var formToSend = document.getElementById(formId);
	formToSend.submit();
}


function openEmailBox() {
	jQuery(document).ready(function(){
	 tb_show('','cart.php?TB_inline=&height=400&width=400&inlineId=emailBox','null');
	});
}
function openErrorBox() {
	jQuery(document).ready(function(){
	 tb_show('','cart.php?TB_inline=&height=400&width=400&inlineId=errorBox','null');
	});
}
function openRegBox() {
	jQuery(document).ready(function(){
	 tb_show('','calendar.php?TB_inline=&height=440&width=425&inlineId=regBox','null');
	});
}


function updateFunc() {
	var update = document.getElementById("updatecart");
	update.value="yes";	
}

function emailLink(email, emailHost){
  document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+ ">" + email + "@" + emailHost+ "</a>")
}


function showFields() {
	
	//first hide all
	var counter = 2;
	
	for (i=2;i<16;i++) {
		var section = "att-" + counter;
		//alert(section);
		
		var section_show = document.getElementById(section);
		section_show.style.display = "none";
		
		counter++;
	
	}
	
	//get form value
	var numAttendees= document.getElementById("groupSize");
	var num = numAttendees.value;
	
	//loop through to show fields
	var counter = 2;
	
	for (i=2;i<=num;i++) {
		var section = "att-" + counter;
		//alert(section);
		
		var section_show = document.getElementById(section);
		section_show.style.display = "block";
		
		counter++;
	
	}
	
}


