﻿function show_hide_column(col_no, do_show) {

    var stl;
    if (do_show) {
        stl = ''
    } else {
        stl = 'none';
    }

    var tbl = document.getElementById('ctl00_ctl00_main_main_ApplicantDetailsTable');
    var rows = tbl.getElementsByTagName('tr');

    for (var row = 0; row < rows.length; row++) {
        var cels = rows[row].getElementsByTagName('td')
        cels[col_no].style.display = stl;
    }
}


function showAddress() {

    if (document.getElementById("ctl00_ctl00_main_main_ExistingTenant").value == "Yes") {
        document.getElementById("ctl00_ctl00_main_main_CurrentAddressRow").style.visibility = "visible";
        //document.getElementById("ApplicantCurrentAddressTxt").style.visibility="visible";

    } else {
    document.getElementById("ctl00_ctl00_main_main_CurrentAddressRow").style.visibility = "hidden";
        //document.getElementById("ApplicantCurrentAddressTxt").style.visibility="hidden";
    }

    return true;
}



function showSex() {

    if (document.getElementById("ctl00_ctl00_main_main_Title").value == "Dr") {

        document.getElementById("ctl00_ctl00_main_main_ApplicantSexLabelCell").style.display = "block";
        document.getElementById("ctl00_ctl00_main_main_ApplicantSexCell").style.display = "block";
    } else {
    document.getElementById("ctl00_ctl00_main_main_ApplicantSexLabelCell").style.display = "none";
    document.getElementById("ctl00_ctl00_main_main_ApplicantSexCell").style.display = "none";
    }
    return true;
}



function showApproxDate() {
    if (document.getElementById("ctl00_ctl00_main_main_WhenRequired").value == "Other") {
        document.getElementById("ctl00_ctl00_main_main_ApproxDateRow").style.visibility = "visible";
        //document.getElementById("ApplicantApproxDateTxt").style.visibility="visible";

    } else {
    document.getElementById("ctl00_ctl00_main_main_ApproxDateRow").style.visibility = "hidden";
        //document.getElementById("ApplicantApproxDateTxt").style.visibility="hidden";
    }

    return true;
}



function showOtherAddress(rownumber) {

    if (document.getElementById("ctl00_ctl00_main_main_ApplicantExisting" + rownumber).value == "Yes") {

        document.getElementById("ctl00_ctl00_main_main_ApplicantAddress" + rownumber + "Row").style.display = "";

    } else {
    document.getElementById("ctl00_ctl00_main_main_ApplicantAddress" + rownumber + "Row").style.display = "none";
    }

    return true;
}




function showAdditional() {

    if (document.getElementById("ctl00_ctl00_main_main_PropertyType").value == "1") {

        document.getElementById("ctl00_ctl00_main_main_AdditionalApplicantRow").style.display = "";

    } else {
    document.getElementById("ctl00_ctl00_main_main_AdditionalApplicantRow").style.display = "none";
    }

    return true;
}


//functionality for javascript menu

//coding to handle resizing of sub menu's
function SetWidth() {
    var cssmenuids = ["cssmenu1", "cssmenu2"] //Enter id(s) of CSS Horizontal UL menus, separated by commas
    for (var i = 0; i < cssmenuids.length; i++) { //for each menu specified above
        var ultags = document.getElementById(cssmenuids[i]).getElementsByTagName("ul") //get the sub menu, if there is one
        for (var t = 0; t < ultags.length; t++) { //for each sub menu found
            var ulwidth = document.getElementById(ultags[t].id).parentNode.offsetWidth - 2; //get the width of the containing <li>
            document.getElementById(ultags[t].id).style.width = ulwidth + 'px'; //set the width of the sub <ul>
        }   
    }
}


//below code modified from example found at http://www.javascriptkit.com/script/script2/csstopmenu.shtml
//coding to handle hovers
var cssmenuids = ["cssmenu1","cssmenu2"] //Enter id(s) of CSS Horizontal UL menus, separated by commas

function createcssmenu2() {
    for (var i = 0; i < cssmenuids.length; i++) {
        var ultags = document.getElementById(cssmenuids[i]).getElementsByTagName("ul")
        for (var t = 0; t < ultags.length; t++) {
            ultags[t].parentNode.onmouseover = function() {
                this.style.zIndex = 100
                this.getElementsByTagName("ul")[0].style.visibility = "visible"
            }
            ultags[t].parentNode.onmouseout = function() {
                this.style.zIndex = 0
                this.getElementsByTagName("ul")[0].style.visibility = "hidden"
            }
        }
    }
}

if (window.addEventListener)
    window.addEventListener("load", createcssmenu2, false)
else if (window.attachEvent)
    window.attachEvent("onload", createcssmenu2)
    
    
    