var scdialog = null;

function onContentScroll (div)
{
    SetAttribute (div, "scrollPos", div.scrollLeft.toString ());
}

function onchktxtclick (ctrl)
{
    var txtid = ctrl.id.slice(3);
    var txtct = document.getElementById(txtid);
    
    if (txtct.disabled)
        txtct.disabled = false;
    else
        txtct.disabled = true;
}

function onuploadclick(ctrl) {

    var inparam = ctrl.attributes["upldata"].value.split('|');
    var lnk = ctrl.innerHTML;

    if (lnk == "seleziona file...")
        window.open("associafile.aspx?sessionid=" + document.getElementById("sessionState").value + "&ffield=" + inparam[0]);
    else
        window.open("upload/" + lnk);
}

function info_hide(ctrl) {
    scdialog.hide(false);
}

function lblhov(ctrl) {
    var infodivid = ctrl.id + "infodiv";
    var infodiv = document.getElementById(infodivid);
    if (infodiv != null) {
        ctrl.style["text-decoration"] = "underline";
        ctrl.style["cursor"] = "pointer";
    }
}

function lblmouseout(ctrl) {
    ctrl.style["text-decoration"] = "none";
}


function onlblhover(ctrl) {
    var infodivid = ctrl.id + "infodiv";
    var infodiv = document.getElementById(infodivid);
    if (infodiv != null) {
        infodiv.style['display'] = "block";
        scdialog = new jt_DialogBox(true, infodivid);
        scdialog.setTitle("Info");
        scdialog.moveTo(-1, -1);
        scdialog.show();
        scdialog.moveTo(-1, -1);
    
    }
}

function onchkcmbclick(ctrl) {
    var txtid = ctrl.id.slice(3);
    var txtct = document.getElementById(txtid);

    if (txtct.disabled)
        txtct.disabled = false;
    else
        txtct.disabled = true;
}

function onchkdateclick(ctrl) {
    var txtid = ctrl.id.slice(3);

    var txtct = document.getElementById(txtid);

    if (ctrl.checked == true) {
        txtct.disabled = false;
    }
    else {

        SetAttribute(txtct, "dd", "");
        SetAttribute(txtct, "MM", "");
        SetAttribute(txtct, "yyyy", "");
        SetAttribute(txtct, "value", "");
        txtct.children[0].value = "";
        txtct.children[2].value = "";
        txtct.children[4].value = "";
        txtct.children[0].children[0].value = "";
        txtct.children[2].children[0].value = "";
        txtct.children[4].children[0].value = "";
        txtct.disabled = true;
    }

    // per disabili BS anagrafica...
    try {
        if ($('chkdataverbinv').checked) {
            $('divfirstinv').style['display'] = "block";

        }
        else {
            $('divfirstinv').style['display'] = "none";
        }

        if ($('chkdataverbinv2').checked)
            $('divsecondinv').style['display'] = "block";
        else
            $('divsecondinv').style['display'] = "none";
    }
    catch (ex) {
    }


}

