function open_close_attribute(i) {

    var ii
    if (i < 10) {
        ii = "0" + i
    }
    else {
        ii = i
    }

    var obj

    obj = document.getElementById("div_attribute_values_" + i)

    var to_open

    var att_id

    if (obj.style.display == "none") {
        obj.style.display = "block";
        to_open = true;
    }
    else {
        obj.style.display = "none";
        to_open = false;
    }

    // save or remove attribute ID for future (to be used after postback)
    att_id = document.getElementById("rep_attributes_ctl" + ii + "_hid_attribute_id").value

    obj = document.getElementById("hid_open_attributes")

    var str_open_attributes = obj.value;

    if (to_open == true) {
        // add attribute ID to the hidden field
        if (str_open_attributes == "")
            obj.value = att_id;
        else
            obj.value = obj.value + "|" + att_id;
    }
    else {
        // remove attribute ID from the hidden field, i.e. copy them all apart from the deleted one
        var arr_open_attributes = str_open_attributes.split("|");

        str_open_attributes = "";

        for (i = 0; i < arr_open_attributes.length; i++) {
            if (arr_open_attributes[i] != att_id)
                str_open_attributes += arr_open_attributes[i] + "|";
        }
        // finally save the new string of attribute IDs

        obj.value = str_open_attributes.substring(0, str_open_attributes.length - 1);
    }

}

function open_close_attribute_price() {

    var obj;

    obj = document.getElementById("div_attribute_values_price");

    var to_open;

    if (obj.style.display == "none") {
        obj.style.display = "block";
        to_open = true;
    }
    else {
        obj.style.display = "none";
        to_open = false;
    }

    obj = document.getElementById("hid_open_attribute_price");
    obj.value = to_open;

}

function open_close_attribute_category() {

    var obj;

    obj = document.getElementById("divAttributeValuesCategory");

    var to_open;

    if (obj.style.display == "none") {
        obj.style.display = "block";
        to_open = true;
    }
    else {
        obj.style.display = "none";
        to_open = false;
    }

    obj = document.getElementById("hidOpenAttributeCategory");
    obj.value = to_open;

}

function turn_to_uppercase(obj) {
    obj.value = obj.value.toUpperCase();
}