
//this is a true false relationship to set the elements "value" too
function setChecked(el, value){
    el.value = value;
    el.checked = value;
}

function clearSelection(){
    if (window.getSelection)
    {
        window.getSelection().removeAllRanges();
    }
    else if (document.getSelection)
    {
        document.getSelection().removeAllRanges();
    }
    else if (document.selection)
    {
        document.selection.removeAllRanges;
    }
    else return;

}

function getNamedChildren(element){
    elements = new Array();
    getNamedChildElements(element, elements);
    return elements;
}

function getNamedChildElements(element, elements){
    if(element.hasChildNodes){
        for(var i=0; i < element.childNodes.length; i++){
            var e = element.childNodes[i];
            if(e.nodeType == Node.ELEMENT_NODE){
                if(e.getAttribute('name') !=''){
                    elements[e.getAttribute('name')] = e;
                }
                if(e.hasChildNodes){
                    getNamedChildElements(e,elements)
                }
            }
        }
    }
}
function swapSpans(obj){
    var spans = obj.parentNode.getElementsByTagName('span');
    for (var i=0;i < spans.length; i++){
        Element.toggle(spans[i]);
    }
}