﻿function onMouseOver(object, strImagePath) {
    object.src = strImagePath;
}

function onMouseOut(object, strImagePath) {
    object.src = strImagePath;
}

function SelectAll(parentControlId, selectorId, rowSelectorControlId)
{
    var grid = document.getElementById(parentControlId);  
    var inputFields;
    if(grid != null)
    {
        inputFields = grid.getElementsByTagName("input");
        for(var i=0;i<inputFields.length;i++)
        {
            if(inputFields[i].type == "checkbox")
            {
                //rowSelect is the id of the row selection checkbox
                var id = inputFields[i].id.toString();
                if(id.indexOf(rowSelectorControlId,0)>0)
                    inputFields[i].checked = document.getElementById(selectorId).checked;
            }
        }
    }
    else
    {
        inputFields = document.getElementsByTagName("input");
        for(var i=0;i<inputFields.length;i++)
        {
            if(inputFields[i].type == "checkbox")
            {
                //rowSelect is the id of the row selection checkbox
                var id = inputFields[i].id.toString();
                if(id.indexOf(parentControlId,0)>=0 && id.indexOf(rowSelectorControlId,0)>=0)
                    inputFields[i].checked = document.getElementById(selectorId).checked;
            }
        }
    }
}

function setFocus(clientID) {

    return function() { $get(clientID).focus(); };

}

function clearText(field, initialText, restoreColor)
{
    if(field!= null)
    {
        if(field.value == initialText)
        {
            field.value = "";
            field.style.color = restoreColor;
        }
    }
}

function resetText(field, initialText, initialColor)
{
    if(field.value == "")
    {
        field.value = initialText;
        field.style.color = initialColor;
    }
}
