var Base = function() {}

function include(strFileName)
{
    var objIncludedScripts, objScript, strIncludedFile, strIncludePath;
    
    objIncludedScripts = document.getElementsByTagName("script");

    for(var intIndex=0; intIndex<objIncludedScripts.length; intIndex++)
    {
        objScript = objIncludedScripts[intIndex];
        strIncludedFile = objScript.src.substring(objScript.src.lastIndexOf("/") + 1);

        if(strIncludedFile == "Base.js")
        {
            strIncludePath = objScript.src.substring(0, objScript.src.indexOf("core/"));
        }
        
        if(strIncludedFile == strFileName)
        {
            return(false);
        }
    }

    objScript = document.createElement("script");
    objScript.type = "text/javascript";
    objScript.language = "javascript";
    objScript.src = strIncludePath + strFileName;
    document.getElementsByTagName("head")[0].appendChild(objScript);
}

function getElem(strSearchClass, objNode, strTag)
{
    var classElements = [];
    if(objNode === null)
    {
        objNode = document;
    }

    if(strTag === null)
    {
        strTag = '*';
    }

    var els = objNode.getElementsByTagName(strTag);
    var elsLen = els.length;
    var pattern = new RegExp('(^|\\s)'+strSearchClass+'(\\s|$)');
    for(var i=0, j=0; i<elsLen; i++)
    {
        if(pattern.test(els[i].className))
        {
            classElements[j] = els[i];
            j++;
        }
    }
    return(classElements);
}

/**
 * Valida si un objeto tiene una propiedad
 * 2008/07/09
 */
function isDefined(object, variable) {
    return((typeof(object[variable]) == "undefined")?  false: true);
}

