﻿/*Description:Contains common DOM operations, Dependancies:None*/

function Dom () {}

/*
Returns an array of html elements that are of the specified tagname and end with the specified id
Parameters    tagName   - The tagName the html elements should be
                    data          - The id the elements must end with
*/
Dom.getElementsByTagNameEndingWithId=function(tagName, id) {
    var results=new Array();

    id=id.toLowerCase();
    tagName=tagName.toUpperCase();
    var elements=document.getElementsByTagName(tagName);    
    
    for (var i=0;i<elements.length;i++) {
        var elm=elements[i];
        var elmId=new String(elm.id).toLowerCase();
        if (elm!='') {
            var elmIdSegments=elmId.split(id);
            if (elmIdSegments.length==2 && elmIdSegments[1]=='') {
                results[results.length]=elm;
            }
        } 
    }
    
    return results;
}

Dom.hideObject=function(obj) {
	obj.style.visibility="hidden"
	obj.style.display="none"			
}
/*Shows the specified element*/
Dom.showObject=function(obj) {
	obj.style.visibility="visible"
	obj.style.display="block"			
}

Dom.isVisible=function (obj) {
	return (obj.style.visibility!="hidden") ? true : false
}

