    function clearFieldsPF(){
        document.photoForm.user_State.selectedIndex = 0;
        document.photoForm.user_State.options[0].selected = true;
        document.photoForm.user_Country.selectedIndex = 0;
        document.photoForm.user_Country.options[0].selected = true;
        document.photoForm.MID.selectedIndex = 0;
        document.photoForm.MID.options[0].selected = true;
        document['photoForm']['user_fName'].value='';
        document["photoForm"]['user_fName'].style.border = 'solid 1px lightgrey';
        document['photoForm']['user_lName'].value='';
        document["photoForm"]['user_lName'].style.border = 'solid 1px lightgrey';
        document['photoForm']['user_Email'].value='';
        document["photoForm"]['user_Email'].style.border = 'solid 1px lightgrey';
        document["photoForm"]['user_Email'].style.background = 'White';
        document['photoForm']['user_City'].value='';
        document["photoForm"]['user_City'].style.border = 'solid 1px lightgrey';
        document["photoForm"]['user_Country'].style.border = 'solid 1px lightgrey';
        document["photoForm"]['MID'].style.border = 'solid 1px lightgrey';
        document['photoForm']['picture_Caption'].value='';
        document['photoForm']['photoUpload'].value='';
    }
    
    function cancelFormPF(){
        document.location='/mission_life/snapshots';
    }
    
    function validationPF(){
        var error=false;
        if ((document["photoForm"]["user_fName"].value.length== "")||(document["photoForm"]["user_lName"].value.length== "")||(document["photoForm"]["user_Email"].value.length== "")
            ||(document["photoForm"]["user_City"].value.length == "")||(document["photoForm"]["user_Country"].value.length== "")){
            alert("Please fill in all required fields.");
            document["photoForm"]["user_fName"].style.border = 'solid 1px red';
            document["photoForm"]["user_lName"].style.border = 'solid 1px red';
            document["photoForm"]["user_Email"].style.border = 'solid 1px red';
            document["photoForm"]["user_City"].style.border = 'solid 1px red';
            document["photoForm"]["user_Country"].style.border = 'solid 1px red';
            document["photoForm"]["MID"].style.border = 'solid 1px red';
            document["photoForm"].user_Name.focus();
            error=true;
        }
        if(document["photoForm"]["user_Email"].value.length>0){
            var noError="";
            var fval= document["photoForm"]["user_Email"].value;
            var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
            var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
            
            if (!emailFilter.test(fval)) {              //test email for illegal characters
                document["photoForm"]["user_Email"].style.background = '#CC3333';
                alert("Please enter a valid email address.\n");
                error=true;
            } 
            if (fval.match(illegalChars)) {
                document["photoForm"]["user_Email"].style.background = '#CC3333';
                alert("The email address contains illegal characters.\n");
                error=true;
            }
        }
        if(error == false){
            document["photoForm"].submit();
        }
    }
