﻿// JScript File
function chk_value(form)
{
//    alert("checking");
    if(! chk_non_empty("txt_org_name"))                               return false;
    else if(! chk_non_empty("txt_org_address"))                     return false;
    else if(! chk_non_empty("txt_org_phone"))                       return false;
    else if(! chk_non_empty("txt_pr_name"))                          return false;
    else if(! chk_non_empty("txt_pr_title_position"))               return false;
    else if(! chk_non_empty("txt_pr_email"))                           return false;
    else if(! chk_non_empty("txt_pr_password"))                    return false;
    else if(! chk_non_empty("txt_pr_password_confirm"))      return false;
    else if(! chk_non_empty("txt_pr_phone"))                         return false;
    else if(! chk_non_empty("txt_summarize"))                        return false;
    else if(! selectedItem("lbx_interested_field"))                        return false; 
    
     return true;
}

function chk_non_empty(id)
{
    var data = document.getElementById(id).value;
//    alert(id + " , " + data); 
    var len = data.length;
    var result = true; 
    
    if( len == 0)
    {
        alert("Please Fill the following field, all * type field are mendatory");
        document.getElementById(id).focus();
        result = false;
    }  
   
    return result;  
}

function selectedItem (id)
{
    //alert(id);
    var num =  document.getElementById(id).options.length;
   
    var  total_select = 0;
    
    for (i = 0; i < num ; i++) 
   { 
   if (document.getElementById(id).options[i].selected==true) 
    {
   if (total_select==0)
  {
  total_select=1;
  }  
  else
  {
    total_select=total_select+1;
   }
  } 
   }
  if (total_select<1)
  {
  alert("The interest field must be selected");
   return false;
  } 
return true;
   
}