function checkRegistration() {
    var missing;
    var warning;
    
    missing = '';  
    warning= "The following fields are required: \n";
   
    if (document.userRegistration.title.value =='')
    {
         missing += "Title \n";
    }
     
    if (document.userRegistration.fname.value =='')
    {
         missing += "First Name \n";
    }
    
    if (document.userRegistration.lname.value =='')
    {
         missing += "Last Name \n";
    }
    
    
     
   // if (document.userRegistration.pass.value =='')
   // {
   //      missing += "Password \n";
   // }
    
      if (document.userRegistration.occupation.value =='')
    {
         missing += "Occupation \n";
    }
   
    if (testIsValidObject(document.userRegistration.otheroccupation))  
    { 
        if (document.userRegistration.otheroccupation.value =='')
        {
             missing += "Other Occupation\n";
        }
    }
    
   //  if(document.userRegistration.pass.value != document.userRegistration.confpass.value) {
   //     missing += "\nThe Password & Confirm Password fields are not the same.\n";
   // }
    
  
    if (document.userRegistration.email.value =='')
    {
       missing += "Email \n"; 
    }

    if (! isValidEmail(document.userRegistration.email.value)) {
        alert("Please enter a valid email address");
        return false;
    }
    
     if(document.userRegistration.email.value != document.userRegistration.confemail.value) {
       missing +=  "\nThe Email & Confirm email fields are not the same. \n";
    }
    
    if (missing!='')
    { 
        warning += missing;
        alert(warning);
        return false; 
    }
    else {
        return true;
        document.userRegistration.submit();
    }
    
}

function checkProvider() {
    var missing;
    var warning;
    
    missing = '';  
    warning= "The following fields are required: \n";
    
    if (document.postProvider.name.value =='')
    {
         missing += "Name \n";
    }
    
    if (document.postProvider.tel.value =='')
    {
         missing += "Telephone \n";
    }
    

    
    
    if (missing!='')
    { 
        warning += missing;
        alert(warning);
        return false; 
    }
    else {
        return true;
        document.postProvider.submit();
    }
    
}

                          
                          
function checkProject() {
    var missing;
    var warning;
    
    missing = '';  
    warning= "";
    
     if (document.postProject.title.value =='')
    {
         missing += "The Project Name field is required.\n\n";
    }
    
    
    if (document.postProject.projectDesc.value =='')
    {
         missing += "The Description field is required.\n\n";
    }
    
  
  
  var today;
  
  var date = new Date();
  var d  = date.getDate();
  var day = (d < 10) ? '0' + d : d;
  var m = date.getMonth() + 1;
  var month = (m < 10) ? '0' + m : m;
  var yy = date.getYear();
  var year = (yy < 1000) ? yy + 1900 : yy;
  today= year + "-" + month + "-" + day;


    
     if(document.postProject.expiry.value == today) {
        missing += "\The Project Expiry Date has to be after today.\n";
    }
    
  
    
    if (missing!='')
    { 
        warning += missing;
        alert(warning);
        return false; 
    }
    else {
        return true;
        document.userRegistration.submit();
    }
    
}
                          
                          
function checkPassReset() {
    var missing;
    var warning;
    
    missing = '';  
    warning= "";
    
     if(document.resetPass.email.value != document.resetPass.confemail.value) {
       missing +=  "\nThe Login & Confirm Login fields are not the same. \n";
    }
    
    if (missing!='')
    { 
        warning += missing;
        alert(warning);
        return false; 
    }
    else {
        return true;
        document.resetPass.submit();
    }
    
}

                          
function checkPassChange() {
    var missing;
    var warning;
    
    missing = '';  
    warning= "";
    
    
     if(document.changePass.oldp.value == '') {
       missing +=  "\Please enter the current password. \n";
    }
    
     if(document.changePass.newp.value == '') {
       missing +=  "\Please enter a new password. \n";
    }
    
     if(document.changePass.newp.value != document.changePass.confnewp.value) {
       missing +=  "\nThe New Password & Confirm New Password fields are not the same. \n";
    }
    
    if (missing!='')
    { 
        warning += missing;
        alert(warning);
        return false; 
    }
    else {
        return true;
        document.changePass.submit();
    }
    
}

   function testIsValidObject(objToTest) {
        if (objToTest == null || objToTest == undefined) {
            return false;
        }
        return true;
   }

