// JavaScript Document

var GluedTools = {

	dom : function() {
		if (!GluedTools._DOM) {
			throw "Glued Tools DOM module is missing.";
		} else {
			return GluedTools._DOM;
		}
	},
	
	animator : function() {
		if (!GluedTools._Animator) {
			throw "Glued Tools Animation module is missing.";
		} else {
			return GluedTools._Animator;
		}
	},
	
	form : function() {
		if (!GluedTools._Form) {
			throw "Glued Tools Form module is missing.";
		} else {
			return GluedTools._Form;
		}
	},

	gui : function() {
		if (!GluedTools._GUI) {
			throw "Glued Tools GUI module is missing.";
		} else {
			return GluedTools._GUI;
		}
	},
	
	widgetFactory : function() {
		if (!GluedTools._WidgetFactory) {
			throw "Glued Tools Widget module is missing.";
		} else {
			return GluedTools._WidgetFactory;
		}
	}
	
}
/*
	FUNCION: $(elem);
	DESCRIPCION: 
		Nos devuelve el objeto de un elemento pasado por parametro
	ARGUMENTOS: 
			- elem: Elemento a buscar (en String)
	DEVUELVE: 
		El objeto buscado o un error en caso de no existir.
*/
function $(elem) {
    if (document.getElementById) {
        if (typeof elem == "string") {
            elem = document.getElementById(elem);
            if (elem===null) throw 'No se ha podido coger el elemento: ' + elem + ' no existe';
        } else if (typeof elem != "object") {
            throw 'No se ha podido coger el elemento: tipo de datos invalido';
        }
    } else throw 'No se ha podido coger el elemento: DOM no soportado';
    return elem;
}
