// This file should be included in all pages in the header of the html. It contains
// regularly used functions.
// *** If you add a new function, please make sure to add comments for its purpose.

//This function is used to create a popup window - you can pass the URL, width, and height
//in order to open the site and size the window appropriately. You can insert the following code in 
//your html to call the this function.: 
//
//<a href="javascript: openwindow('yourPage.htm',420,280,1,500,250,500,250)" target="_parent">Your text goes here</a>

function openwindow(mywin,a,b,c,d,e)
{
	window.open(mywin,"mywindow","menubar=0,toolbar=0, scrollbars=" + c + ", left=" + d + ", top=" + e + ",location=0,resizable=0,width=" + a + ",height=" + b);
}

// Start javascript code for welcome_contactus.htm: The following code controls the javascript functions
// associated with the Contact form.

function clearForms()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
	}
	
}

function checkformALPHA ( form )
{
	
  //Captures the values from each DDL and save them to a hidden variable so they can be retrieved on the next page
  form.ContactEmail.value = form.ddlContact.value;
	if (form.rdoAttendee[0].checked)
		{
		form.hdnAttendee.value = "Yes";
		}
	else
		{
		form.hdnAttendee.value = "No";
		}  
					  
  if (form.ddlContact.value == "0")  {
    alert( "Please select a Department from the list" );
    form.ddlContact.focus();
    return false ;
  }
  
   if (form.txtFirstName.value == "") {
    alert( "Please enter your First Name." );
    form.txtFirstName.focus();
    return false ;
  }
  
  if (form.txtLastName.value == "") {
    alert( "Please enter your Last Name." );
    form.txtLastName.focus();
    return false ;
  }
  
  if (form.txtYourEmail.value == "") {
    alert( "Please enter your Email Address." );
    form.txtYourEmail.focus();
    return false ;
  }
  
  if (form.txtConfirmEmail.value == "") {
    alert( "Please enter your Confirm Email Address." );
    form.txtConfirmEmail.focus();
    return false ;
  }
  
  if (form.txtYourEmail.value != form.txtConfirmEmail.value) {
    alert( "Please make sure your Email Addresses are identical." );
    form.txtYourEmail.focus();
    return false ;
  }
  
  if ((!form.rdoAttendee[0].checked) && (!form.rdoAttendee[1].checked)) {
  		alert("Please let us know if you are an WOC Attendee");
		form.rdoAttendee[0].focus();
		return false;
  	}
  
  if (form.txtSubject.value == "") {
    alert( "Please enter a Subject." );
    form.txtSubject.focus();
    return false ;
  }
  
  if (form.txtaMessage.value == "") {
    alert( "Please enter a Message." );
    form.txtaMessage.focus();
    return false ;
  }
}  

// End javascript code for welcome_contactus.htm

//These functions are used to support the login validatoin for the Celebration Arts page, workship_celebrationarts.htm.

 function checkform ( form )
{
  //alert(form.password.value)
  if (form.password.value == "") {
    alert( "Please enter the password to continue. Please note that it is case sensitive." );
    form.password.focus();
    return false ;
  }

  if (form.password.value != "piano") {
    alert( "Please enter the correct password to continue. Please note that it is case sensitive." );
    form.password.focus();
    return false ;
}

  if (form.password.value == "piano" ) {
    return true ;
  }
}
// End javascript code for worship_celebrationarts.htm

//Start funtions for Student Ministry Infinity Contact List registration form, people_studentminitries_registration.htm.
function checkformValues ( form )
{
	{  //Captures the values from each DDL and save them to a hidden variable so they can be retrieved on the next page
	  	form.hdnGroup.value = form.ddlGroup.value;
  }
  
   if (form.txtFirstName.value == "") {
    alert( "Please enter your First Name." );
    form.txtFirstName.focus();
    return false ;
  }
  
  if (form.txtLastName.value == "") {
    alert( "Please enter your Last Name." );
    form.txtLastName.focus();
    return false ;
  }
  
  if (form.txtYourEmail.value == "") {
    alert( "Please enter your Email Address." );
    form.txtYourEmail.focus();
    return false ;
  }
  
  if (form.txtConfirmEmail.value == "") {
    alert( "Please enter your Confirm Email Address." );
    form.txtConfirmEmail.focus();
    return false ;
  }
  
  if (form.txtYourEmail.value != form.txtConfirmEmail.value) {
    alert( "Please make sure your Email Addresses are identical." );
    form.txtYourEmail.focus();
    return false ;
  }  
  
  if (form.ddlGroup.value == "0")  {
    alert( "Please select a Contact Group for your student" );
    form.ddlGroup.focus();
    return false ;
  }
}  

//End funtions for Student Ministry Infinity Contact List registration form, people_studentminitries_registration.htm.

