﻿

function validateEmptyValue(frmName, locationid, type) {
 var isEmptyValue = false;
 var CommonTypes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 19, 20, 21];

 if (jQuery.inArray(type, CommonTypes) > -1) {
  isEmptyValue = $.trim($('#' + frmName + 'field_' + locationid).val()) == '';
 }

 if (type == 13) {
  if (!$('#' + frmName + 'field_' + locationid).attr('checked')) {
   isEmptyValue = true;
  }
 }

 if (type == 15) {
  isEmptyValue = true;
  $("input[name='" + frmName + "field_" + locationid + "']").each(function() {
   if ($(this).attr('checked')) {
    isEmptyValue = false;
    return false;
   }
  });
 }



 if (type == 22) {
   var mState = $("input[name='" + frmName + "field_" + locationid + "_statecountry']:checked");
  if (mState.length > 0) {
   if (mState.val() == 1) {
     isEmptyValue = $.trim($("#" + frmName + "field_" + locationid + "_state").val()) == '';
   } else if (mState.val() == 2) {
     isEmptyValue = $.trim($("#" + frmName + "field_" + locationid + "_country").val()) == '' || $.trim($("#" + frmName + "field_" + locationid + "_area").val()) == '';
   }
  } else {
   isEmptyValue = true;
  }
 }

 if (isEmptyValue) {
  $('#' + frmName + 'requiredMessage' + locationid).css("visibility", "visible");
 } else {
  $('#' + frmName + 'requiredMessage' + locationid).css("visibility", "hidden");
 }

 return isEmptyValue;

}
