function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert(alerttxt);return false;
		}else {return true;
		}
	}
}

function validate_required(field,alerttxt)
{
	with (field)
	{
	  if (value==null||value=="")
	  {
	  alert(alerttxt);return false;
	  }
	  else
	  {
	  return true;
	  }
	}
}

function validate_approval(field,alerttxt)
{
	with (field)
	{
	  if (value!="Yes")
	  {
	  alert(alerttxt);return false;
	  }
	  else
	  {
	  return true;
	  }
	}
}

function validate_spam(field,alerttxt)
{
	with (field)
	{
	  if (value!=6)
	  {
	  alert(alerttxt);return false;
	  }
	  else
	  {
	  return true;
	  }
	}
}


function validate_form(thisform)
{
	with (thisform)
	{
		if (validate_email(email,"Not a valid e-mail address!")==false)
		{email.focus();return false;}
	}
}

function validate_SubmitWallpaper(thisform)
{
	with (thisform)
	{
		if (validate_required(title,"Please specify a title for your wallpaper")==false)
		{title.focus();return false;}
		if (validate_required(fullSize,"Please choose a file to upload")==false)
		{fullSize.focus();return false;}
		if (validate_required(author,"Please specify your name")==false)
		{author.focus();return false;}
		if (validate_approval(approval,"You must be the author, or have consent to publish this wallpaper to proceed")==false)
		{approval.focus();return false;}
		if (validate_spam(spamCatcher,"Wrong Answer!")==false)
		{spamCatcher.focus();return false;}
		
	}
}