var slForm = new Array();
function selfLabel(formName,top, left) {
    $(document).ready(function () {
        $(formName).each(function () {
            $(this).find('p.selfLabel').each(function () {
                var field = this;
                field.label = this.getElementsByTagName('label')[0];
                field.input = this.getElementsByTagName('input')[0];

                field.style.position = 'relative';
                field.label.style.position = 'absolute';
                field.label.style.color = '#999';
                field.label.style.zIndex = '999999';
                if (field.input.value == '') {
                    field.label.style.display = 'block';
                }
                else {
                    field.label.style.display = 'none';
                }
                field.label.style.cursor = 'text';
                field.label.style.top = top + 'px';
                field.label.style.left = left + 'px';

                field.input.onfocus = function () {
                    field.label.style.display = 'none';
                }
                field.input.onblur = function () {
                    if (field.input.value == '') {
                        field.label.style.display = 'block';
                    }
                }
            });
        });
        /*thisIndex = slForm.length;
        $(formName).each(function () {
        slForm[thisIndex] = this;
        });
        if (slForm[thisIndex] == null) return false;
        alert('test');

        slForm[thisIndex].input = new Array();
        inputs = slForm[thisIndex].getElementsByTagName('input');
        inputs = slForm[thisIndex].getElementsByTagName('input');
        for (i = 0; i < inputs.length; i++) {
        if (inputs[i].parentNode.parentNode.className.match('selfLabel') || inputs[i].className.match('password')) {
        inputIndex = slForm[thisIndex].input.length;
        slForm[thisIndex].input[inputIndex] = inputs[i];
        slForm[thisIndex].input[inputIndex].label = inputs[i].parentNode.getElementsByTagName('label')[0];
        inputs[i].parentNode.style.position = 'relative';
        slForm[thisIndex].input[inputIndex].label.style.position = 'absolute';
        slForm[thisIndex].input[inputIndex].label.style.display = 'block';
        slForm[thisIndex].input[inputIndex].label.style.cursor = 'text';
        slForm[thisIndex].input[inputIndex].label.style.top = top + 'px';
        slForm[thisIndex].input[inputIndex].label.style.left = left + 'px';

        slForm[thisIndex].input[inputIndex].onfocus = function () {
        this.label.style.display = 'none';
        }
        slForm[thisIndex].input[inputIndex].onblur = function () {
        if (this.value == '') {
        this.label.style.display = 'block';
        }
        }
        }
        }*/
    });
}

function radioButtons(jQueryID){
    $(document).ready(function () {
        $(jQueryID).each(function () {
            var radio = this;
            $(this).find('span.inputWrap').each(function () {
                radio.icon = this;
            });
            radio.input = radio.getElementsByTagName('input')[0];
            radioButtonsGraphic(radio);
            radio.className = this.className + ' json';

            $(radio.icon).click(function () {
                if (radio.input.checked) {
                    radio.input.checked = false;
                    radioButtonsGraphic(jQueryID);
                }
                else {
                    radio.input.checked = true;
                    radioButtonsGraphic(jQueryID);
                }
            });
        });
    });
}
function radioButtonsGraphic(family) {
    $(family).each(function () {
        if (this.input.checked) {
            this.icon.className = 'checked inputWrap';
        }
        else {
            this.icon.className = 'inputWrap';
        }
    });
}
