﻿
$.fn.clearForm = function() {
    return this.each(function() {
        var type = this.type, tag = this.tagName.toLowerCase();
        if (tag == 'form')
            return $(':input', this).clearForm();

        if (type == 'text' || type == 'password' || tag == 'textarea') {
            this.className = this.className.replace(" requerido", "");
            this.value = '';
        }
        else if (type == 'checkbox' || type == 'radio') {
            this.className = this.className.replace(" requerido", "");
            this.checked = false;
        }
        else if (tag == 'select') {
            this.className = this.className.replace(" requerido", "");
            this.selectedIndex = -1;
        }
    });
};

function ShowMessage(strMsg) {
    $(document).ready(function() {
        jQuery.facebox(strMsg);
    })
}

function ShowMessageAndClear(strMsg) {
    $('form').clearForm();
    
    ShowMessage(strMsg);
}
