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

function clearText(inputID,textCheck)
{
	var formElement= document.getElementById(inputID);
	if (formElement.value == textCheck) {
	formElement.value = "";
	}
} 
function submitForm(formId) {
	//alert(formId);
	var formToSend = document.getElementById(formId);
	formToSend.submit();
}
function openErrorBox() {
	$(document).ready(function(){
	 tb_show('','?&TB_inline=&height=400&width=400&inlineId=errorBox','null');
	});
	
	//tb_show('','#?TB_inline=height=580&width=700&inlineId=errorBox','null');
}
function openPaymentBox() {
	$(document).ready(function(){
	 tb_show('','?&TB_inline=&height=400&width=400&inlineId=paymentBox','null');
	});
	
	//tb_show('','#?TB_inline=height=580&width=700&inlineId=errorBox','null');
}

clickbefore="no";

function openQuestionBox() {
	
	if (clickbefore == "yes") {
		
	} else {
	
		$(document).ready(function(){
		 tb_show('','?&TB_inline&=height=400&width=400&inlineId=questionBox','null');
		});
	
		clickbefore = "yes";
	}
	
	//tb_show('','#?TB_inline=height=580&width=700&inlineId=errorBox','null');
}





function validateRegistration() {
	
	
	
	var error = 1;
	
	//check signature
	var formElement= document.getElementById('signature');
	var formElement2= document.getElementById('attendee_name_1');
	var formElement3= document.getElementById('attendee_email_1');
	
	if (formElement.checked != 1) {
		
		error = 2;
		var first_error = "Please check that you have read and understand the policies.<br>";
	
	} else {
		var first_error ="";	
	}
	
	if (formElement2.value == "") {
		
		error = 2;
		var second_error = "Please enter the first employee's name.<br>";
		
	} else {
		var second_error ="";	
	}
	
	if (formElement3.value == "") {
		
		error = 2;
		var third_error = "Please enter the first employee's email.<br>";
		
	}else {
		var third_error ="";	
	}
	
	if (error == 2) {
		
		$(document).ready(function(){
		 tb_show('','?TB_inline=&height=220&width=400&inlineId=regtrationErrorBox','null');
		});
		var regText= document.getElementById('registrationText');
		regText.style.color="red";
		
		var errorText= document.getElementById('errorTextDesc');
		errorText.innerHTML= first_error + second_error + third_error;
		
		
	} else {
		
		submitForm('editUpdate');
		
	}
	
	
}


function openRegThankyouBox() {
	$(document).ready(function(){
	 tb_show('','?TB_inline=&height=220&width=400&inlineId=registrationThankYouBox','null');
	});
}


