﻿/*
© Copyright 2008 City of Huntington Beach. All rights reserved.
*/

function resetfields(div)
{
    if (div != null)
    {
        // Clear text input contols
        var t=document.getElementsByTagName('input');
        if (t != null)
        {
            for (i=0;i<t.length;i++)
            {
                // Check if the input control is a text box
                if (t[i].type == "text")
                {
                    // Clear the value
                    t[i].value="";
                }
            }
        }
        
        // Clear select controls
        var s=document.getElementsByTagName('select');
        if (s != null)
        {
            for (i=0;i<s.length;i++)
            {
                // Check if the select control is not the document type list
                if (s[i].id != "ctl00_ContentPlaceHolder1_DropDownList1")
                {
                    // Remove the selection
                    s[i].selectedIndex=-1;
                }
            }
        }
    }
}

function toggleTypes(prefix, link) {
    if (prefix != null && link != null) {
        var i = 0;
        var box = document.getElementById(prefix + '_' + i);
        while (box != null) {
            if (link.innerHTML == "&nbsp;Check All&nbsp;") {
                box.checked = "checked";
            }
            else {
                box.checked = "";
            }
            i++;
            box = document.getElementById(prefix + '_' + i);
        }

        if (link.innerHTML == "&nbsp;Check All&nbsp;") {
            link.innerHTML = "&nbsp;Uncheck All&nbsp;";
        }
        else {
            link.innerHTML = "&nbsp;Check All&nbsp;";
        }
    }
}
