﻿function validateEmptyValue(frmName, locationid, type) {
 var isEmptyValue = false;
 var CommonTypes = [1, 4, 6, 9, 10, 11, 12];

 if (jQuery.inArray(type, CommonTypes) > -1) {
  isEmptyValue = $.trim($('#' + frmName + 'field_' + locationid).val()) == '';
 }

 if (type == 3) {
  if (!$('#' + frmName + 'field_' + locationid).attr('checked')) {
   isEmptyValue = true;
  }
 }

 if (type == 5) {
  isEmptyValue = true;
  $("input[name='" + frmName + "field_" + locationid + "']").each(function() {
   if ($(this).attr('checked')) {
    isEmptyValue = false;
    return false;
   }
  });
 }


 if (type == 7) {
  isEmptyValue = $.trim($('#' + frmName + 'fieldArea_' + locationid).val()) == '' || $.trim($('#' + frmName + 'fieldPhone_' + locationid).val()) == '';
 }

 if (type == 8) {
  isEmptyValue = $.trim($('#' + frmName + 'fieldAddress_' + locationid).val()) == '';
 }

 if (type == 10) {
  var mState = $("input[name='" + frmName + "fieldOptCountry_" + locationid + "']:checked");
  if (mState.length > 0) {
   if (mState.val() == 1) {
    isEmptyValue = $.trim($('#' + frmName + 'fieldState_' + locationid).val()) == '';
   } else if (mState.val() == 2) {
    isEmptyValue = $.trim($('#' + frmName + 'fieldCountry_' + locationid).val()) == '' || $.trim($('#' + frmName + 'fieldTextState_' + locationid).val()) == '';
   }
  } else {
   isEmptyValue = true;
  }
 }

 if (isEmptyValue) {
  $('#' + frmName + 'requiredMessage' + locationid).css("visibility", "visible");
 } else {
  $('#' + frmName + 'requiredMessage' + locationid).css("visibility", "hidden");
 }

 return isEmptyValue;

}
