//use this to set a maxlength for multiline textboxes
function maxLength(text,long) 
{
    var maxlength = new Number(long); // Change number to your max length.

    if (text.value.length > maxlength){

        text.value = text.value.substring(0,maxlength);

        alert("This field allows a maximum of " + long + " characters");

    }
}

//open a new window
function openWindow(url,w,h)
{   
    window.open(url,"HMIS","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width="+w+", height="+h+", top=220, left=200");
}

//open a new window with toolbars
function openWindowToolbars(url,w,h)
{   
    window.open(url,"HMIS","toolbar=yes, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width="+w+", height="+h+", top=220, left=200");
}

function toggleDescription (containerName)
{
    //get all divs
    var divs = document.getElementsByTagName("div");
    var full;
    var preview;
    
    for ( i = 0; i < divs.length; i++ )
    {
        if ( divs[i].getAttribute('name') == containerName + "full")
        {
            full = divs[i];
        }
        
        if ( divs[i].getAttribute('name') == containerName + "preview")
        {
            preview = divs[i];
        }
    }

        full.style.display = 'inline';
        preview.style.display = 'none';
}

function toggleIconExplanation()
{
    var div = $get("iconExplanation");
    
    if (div.style.display == 'none')
        div.style.display = 'inline';
    else
        div.style.display = 'none';
}
