﻿// JScript File for Resource entry system

function curriculumfitEnable(object) {
    var objectId = object.id;

    document.getElementById("ctl00_BodyContent_dpSubjectNoSenior").disabled = !(objectId == "ctl00_BodyContent_rbSubjectNoSenior");
    document.getElementById("ctl00_BodyContent_lblSubjectNoSenior").disabled = !(objectId == "ctl00_BodyContent_rbSubjectNoSenior");
    document.getElementById("ctl00_BodyContent_dpGradeRangeNoSenior").disabled = !(objectId == "ctl00_BodyContent_rbSubjectNoSenior");
    document.getElementById("ctl00_BodyContent_lblGradeRangeNoSenior").disabled = !(objectId == "ctl00_BodyContent_rbSubjectNoSenior");

    document.getElementById("ctl00_BodyContent_dpSubjectSenior").disabled = (objectId == "ctl00_BodyContent_rbSubjectNoSenior");
    document.getElementById("ctl00_BodyContent_lblSubjectSenior").disabled = (objectId == "ctl00_BodyContent_rbSubjectNoSenior");
    document.getElementById("ctl00_BodyContent_dpCourseSenior").disabled = (objectId == "ctl00_BodyContent_rbSubjectNoSenior");
    document.getElementById("ctl00_BodyContent_lblCourseSenior").disabled = (objectId == "ctl00_BodyContent_rbSubjectNoSenior");
    document.getElementById("ctl00_BodyContent_dpGradeRangeSenior").disabled = (objectId == "ctl00_BodyContent_rbSubjectNoSenior");
    document.getElementById("ctl00_BodyContent_lblGradeRangeSenior").disabled = (objectId == "ctl00_BodyContent_rbSubjectNoSenior");
}

// Funtion to Author popup...
function openAuthorWin() {
    window.open('HelpPages/ResAuthorViewPopup.htm', 'Help', 'height=220, width=430, top=300, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
}

// Funtion to Title Format popup...
function openTitleFormatWin() {
    window.open('HelpPages/ResTitleFormatViewPopup.htm', 'Help', 'height=260, width=540, top=300, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
}

// Funtion to Main Resource popup...
function openMainResourceWin() {
    window.open('HelpPages/ResMainResourceViewPopup.htm', 'Help', 'height=200, width=600, top=300, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
}

// Funtion to Main Resource popup...
function openCompanionResourceWin() {
    window.open('HelpPages/ResCompanionResourceViewPopup.htm', 'Help', 'height=160, width=540, top=300, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
}

// Funtion to Series Resource popup...
function openSeriesResourceWin() {
    window.open('HelpPages/ResSeriesResourceViewPopup.htm', 'Help', 'height=160, width=430, top=300, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
}

// Funtion to Series Format popup...
function openSeriesfromatWin() {
    window.open('HelpPages/ResSeriesFormatViewPopup.htm', 'Help', 'height=200, width=540, top=300, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
}

// Funtion to Subject popup...
function openSubjectWin() {
    window.open('HelpPages/ResSubjectViewPopup.htm', 'Help', 'height=260, width=540, top=300, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
}

// Funtion to Senior Secondary popup...
function openSeniorSecondaryWin() {
    window.open('HelpPages/ResSeniorSecondaryViewPopup.htm', 'Help', 'height=260, width=540, top=300, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
}


// Funtion enable text associated to check boxes cbPlatform
function enable_cbPlatformText() {
    var cb_mac = document.getElementById("ctl00_BodyContent_cbPlatform" + "_0");
    if (cb_mac != null)
        document.getElementById("ctl00_BodyContent_txtMacVersion").disabled = !cb_mac.checked;
    var cb_win= document.getElementById("ctl00_BodyContent_cbPlatform" + "_1");
    if (cb_win != null)
        document.getElementById("ctl00_BodyContent_txtWinVersion").disabled = !cb_win.checked;
    var cb_lnx = document.getElementById("ctl00_BodyContent_cbPlatform" + "_2");
    if (cb_lnx != null)
        document.getElementById("ctl00_BodyContent_txtLnx").disabled = !cb_lnx.checked; 
}
// Funtion enable text associated to check boxes cbDistributionMedia
function enable_cbDistributionMediaText() {
    var cb_website = document.getElementById("ctl00_BodyContent_cbDistributionMedia" + "_2");
    if (cb_website != null)
        document.getElementById("ctl00_BodyContent_txtEvaluationUrl").disabled = !cb_website.checked;
}
// Funtion enable text associated to check boxes cbAdditionaEq
function enable_cbAdditionaEqText() {
    var cb_AdditionaEq = document.getElementById("ctl00_BodyContent_cbAdditionaEq" + "_5");
    if (cb_AdditionaEq != null)
        document.getElementById("ctl00_BodyContent_txtOther").disabled = !cb_AdditionaEq.checked;
}

// Funtion enable text associated to check boxes cbDistributionMediaVideo
function enable_cbDistributionMediaTextVideo() {
    var cb_website = document.getElementById("ctl00_BodyContent_cbDistributionMediaVideo" + "_2");
    if (cb_website != null)
        document.getElementById("ctl00_BodyContent_txtEvaluationUrlVideo").disabled = !cb_website.checked;
}


//// hide show Media Format
function dpEducationalResource() {

    var object = document.getElementById("ctl00_BodyContent_ddlEducationalResource");
    var objectValue = object.options[object.selectedIndex].value;
    var divPrint = document.getElementById("divPrintMedia");
    var divVideo = document.getElementById("divVideoMedia");
    var divLearnSw = document.getElementById("divLearningSw");

    divLearnSw.style.display = 'none';
    divPrint.style.display = 'none';
    divVideo.style.display = 'none';

    if (objectValue == "V") {
        divVideo.style.display = 'block';
        enable_cbDistributionMediaTextVideo();
    }
    if (objectValue == "T")
        divPrint.style.display = 'block';
    if (objectValue == "N")
        divPrint.style.display = 'block';
    if (objectValue == "W")
        divPrint.style.display = 'block';
    if (objectValue == "R")
        divPrint.style.display = 'block';
    if (objectValue == "M")
        divPrint.style.display = 'block';

    if (objectValue == "S" || objectValue == "O") {
        divLearnSw.style.display = 'block';
        enable_cbPlatformText();
        enable_cbDistributionMediaText();
        enable_cbAdditionaEqText();
    }

}

// Enable disable controls for Structi of Resource option Stand (A)lone, Part of (S)eries, (M)ulti-component
//function structureOfResourceEnable(option) {

//    // Controls for Series options
//    document.getElementById("ctl00_BodyContent_ddlSeriesName").disabled = option != 'S';
//    document.getElementById("ctl00_BodyContent_txbNewSeries").disabled = option != 'S';
//    document.getElementById("ctl00_BodyContent_btnAddSeries").disabled = option != 'S';

//    // Controls for Multi-component
//    document.getElementById("ctl00_BodyContent_rbtlResourceType").disabled = option != 'M';

//    var radio = document.getElementById("ctl00_BodyContent_rbtlResourceType")
//    for (var j = 0; j < radio.rows; j++) {
//        if (radio.rows[j].checked)
//            alert(radio.rows[j].value);
//    }
//    // error with get element 0 from rbtlResourceType
////    document.getElementById("ctl00_BodyContent_ddlResourceTitle").disabled = (option != 'M')
////                            || document.getElementById("ctl00_BodyContent_rbtlResourceType")[0].checked;
//}



