
	function checkWholeForm(theForm) {
   var why = "";
    var focusSet = "";

	if (!theForm.f00_agree.checked) {
		why += 'You must agree with the terms to submit images. \n'
    	focusSet = "set"
    }
	if (theForm.f05_uploadImage.value == ''){
	why += 'You must select a file to upload. \n'
	}
   	why += checkName(theForm.f01_fullName.value);
    if (why != ""){
    	theForm.f01_fullName.focus();
    	focusSet = "set"
    }
   why += checkEmail(theForm.f02_email.value);
     if (why != "" && focusSet == ""){
      	theForm.f02_email.focus();
      	focusSet = "set"
      }
	why += checkLoc(theForm.f04_location.value);
    if (why != ""){
    	theForm.f04_location.focus();
    	focusSet = "set"
    }
	why += checkCaption(theForm.f05_caption.value);
    if (why != ""){
    	theForm.f05_caption.focus();
    	focusSet = "set"
    }

     if (why != "") {
		
           alert(why);
           return false;
    
        }
var splitfileName=myform.f05_uploadImage.value.split("\\");
var fileName=splitfileName[splitfileName.length-1];
theForm.fpMailFromAddr.value = theForm.f02_email.value;
theForm.ds.value = fileName+"|"+myform.f01_fullName.value+"|"+myform.f02_email.value+'|'+myform.OK.value+'|'+myform.f04_location.value+'|'+myform.f05_caption.value+'|'+myform.Album_ID.value;
return true;
}
       

function checkEmail(strng) {
var error="";
if (strng == "") {
   error = "Please enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
	   var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/

         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }

return error;    
}


function checkName(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your full name. \n"
  }
return error;	  
}

function checkLoc(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter location information for the image. \n"
  }
return error;	  
}

function checkCaption(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter a caption for the image. \n"
  }

return error;	  
}

function valButton(btn) {
var cnt = -1;
for (var i=btn.length-1; i > -1; i--) {
if (btn[i].checked) {cnt = i; i = -1;}
}
if (cnt > -1) return btn[cnt].value;
else return null;
}
function valForm(form) {
var btn = valButton(form.group1);
if (btn == null) alert('No radio button selected');
form.OK.value=btn;
}


