/*
 *------------------------------------------------------------------------------
 *
 * Project Title: Flying Start Challenge
 *
 *     File Name: fsc.js
 *
 *   Description: Client-side javascript functions
 *
 *------------------------------------------------------------------------------
 *
 * Amendment history
 *
 * Version | Date        | Author           | Details
 * --------+-------------+------------------+-----------------------------------
 *  1.0.0  | 21-Mar-2006 | Neil Hillard     | Initial release
 *
 *
 *------------------------------------------------------------------------------
 *      COPYRIGHT (C) and all other RIGHTS in this program are reserved by
 *                             WESTLAND HELICOPTERS
 *------------------------------------------------------------------------------
 */
function WarnIfBlank(oControl, sPrompt)
{
 if (oControl.value == "")
 {
  alert(sPrompt);
  oControl.focus();
  return true;
 }

 return false;
}

function SubmitContact()
{
 if (WarnIfBlank(document.iform.name, "You must enter your name"))
  return;
 if (WarnIfBlank(document.iform.phone, "You must enter your telephone number"))
  return;
 if (WarnIfBlank(document.iform.email, "You must enter your E-mail address"))
  return;
 if (WarnIfBlank(document.iform.comment, "You must enter a comment / query"))
  return;

 document.iform.action.value = "submit";
 document.iform.submit();
}

function SubmitRegister()
{
 if (WarnIfBlank(document.iform.name, "You must enter your name"))
  return;
 if (WarnIfBlank(document.iform.job, "You must enter your job or role"))
  return;
 if (WarnIfBlank(document.iform.org, "You must enter your school / organisation"))
  return;
 if (WarnIfBlank(document.iform.email, "You must enter your E-mail address"))
  return;
 if (WarnIfBlank(document.iform.phone, "You must enter your telephone number"))
  return;
 if (WarnIfBlank(document.iform.address, "You must enter your address"))
  return;
 if (WarnIfBlank(document.iform.interest, "You must enter your interest"))
  return;

 document.iform.action.value = "submit";
 document.iform.submit();
}

function new_year()
{
	document.getElementById('year').style.display='none';
	document.getElementById('year_new').style.display='block';
	document.getElementById('new_button').style.display='none';
}


function submitPhoto()
{
 if ((document.photoForm.year.value == "") && (document.photoForm.year_new.value == ""))
	{
		alert("Please either select an existing year or enter a new year");
		return false;
	}
	
	if ((document.photoForm.year.value != "") && (document.photoForm.year_new.value != ""))
	{
		alert("You have selected an existing year and entered a new one.\n Please either select an existing year OR enter a new year");
		return false;
	}
 if (WarnIfBlank(document.photoForm.picture, "You must select an image"))
  return;

 document.photoForm.action.value = "submit";
 document.photoForm.submit();
}