/*
	XPDOM Cross-Platform DOM 
	Compatibility Wrapper for Web Scripting with W3C DOM
	using  W3C Java DOM interfaces.
	http://xpdom.sourceforge.net
	http://www.sourceforge.net/projects/xpdom

	(c) 2000-2002, José María Arranz Santamaría
	mailto:jmarranz@users.sourceforge.net
	mailto:jmarranz@eresmas.com
	(Spanish citizen)
 
	Copyright of this library is covered with GNU General Public License (GPL) v2
	(see file COPYING)

	Comercial use at commercial web sites is forbidden without a license
	of the author.
*/

function pkg_net_sf_xpdom_htmlcore_ns6()
{
	this.HTMLDOMImplementationFactory = HTMLDOMImplementationFactory;
	this.HTMLDOMImplementation = HTMLDOMImplementation;
	this.HTMLCollection = HTMLCollection;
	this.HTMLDocumentFactory = HTMLDocumentFactory;
	this.HTMLDocument = HTMLDocument;
	this.HTMLElementFactory = HTMLElementFactory;
	this.HTMLElement = HTMLElement;
	this.HTMLHtmlElementFactory = HTMLHtmlElementFactory;
	this.HTMLHtmlElement = HTMLHtmlElement;
	this.HTMLHeadElementFactory = HTMLHeadElementFactory;
	this.HTMLHeadElement = HTMLHeadElement;
	this.HTMLBodyElementFactory = HTMLBodyElementFactory;
	this.HTMLBodyElement = HTMLBodyElement;


	// HTMLDOMImplementation Interface
	// **************************************
	function HTMLDOMImplementationFactory()
	{
		this.DOMImplementationFactory = xpdom_dom_DOMImplementationFactory;
		this.DOMImplementationFactory();

		// Bind functions
		this.toString = xpdom_dom_HTMLDOMImplementation_toString
		this.overload = overload;

		function overload(native_object,wrap_elem)
		{
			this.init(native_object,wrap_elem);

			wrap_elem.HTMLDOMImplementation = HTMLDOMImplementation; // Constructor
			wrap_elem.HTMLDOMImplementation();	

			native_object = null; // Help garbage col.
		}
	}

	function HTMLDOMImplementation() 
	{
		this.DOMImplementation = net.sf.xpdom.core.ns6.DOMImplementation;
		this.DOMImplementation();

		// Interfaces
		this.ViewDOMImplementation = net.sf.xpdom.views.ns6.ViewDOMImplementation;
		this.ViewDOMImplementation();

		this.CSSDOMImplementation = xpdom_dom_CSSDOMImplementation;
		this.CSSDOMImplementation();
		
		// Bind methods
		this.DOMImplementation_init = this.init;
		this.init = init;
		this.init_constants = init_constants;

		this.createHTMLDocument = createHTMLDocument;


		function init()
		{
			this.DOMImplementation_init();
			this.ViewDOMImplementation_init();

			var listfactory = this.aux_list_node_factory;

			listfactory["#document"] = new HTMLDocumentFactory();
			listfactory["_OTHER"] = new HTMLElementFactory();
			listfactory["BODY"] = new HTMLBodyElementFactory();
			listfactory["HEAD"] = new HTMLHeadElementFactory();
			listfactory["HTML"] = new HTMLHtmlElementFactory();
		}

		function init_constants(native_window)
		{
			this.CSSDOMImplementation_init_constants(native_window);
		}

		function createHTMLDocument()
		{
			return null; // TODO
		}
	}


	// HTMLCollection Interface
	// **************************************
	function HTMLCollection(native_list, doc)
	{	
		this.NodeList = net.sf.xpdom.core.ns6.NodeList;
		this.NodeList(native_list,doc);

		this.toString = xpdom_dom_HTMLCollection_toString; 
		this.namedItem = namedItem;

		function namedItem(name)
		{
			var elem = this.native_object.namedItem(name);
			return this.aux_document.aux_overloadNode(elem); 				
		}

	}


	// HTMLDocument Interface
	// **************************************
	function HTMLDocumentFactory()
	{
		this.DocumentFactory = xpdom_dom_DocumentFactory;
		this.DocumentFactory();

		// Bind functions
		this.overload = overload;

		function overload(native_object,wrap_elem)
		{
			this.init(native_object,wrap_elem); // Call to NodeFactory.init()

			wrap_elem.HTMLDocument = HTMLDocument; // Constructor
			wrap_elem.HTMLDocument();	
		}
	}

	function HTMLDocument()
	{
		this.Document = net.sf.xpdom.core.ns6.Document;
		this.Document();

		// Bind functions
		this.HTMLDocumentImpl = xpdom_dom_HTMLDocumentImpl;
		this.HTMLDocumentImpl();
		
		// Overload functions

		// These methods aren't W3C DOM (Java)
		this.aux_createHTMLCollection = createHTMLCollection;

		// Objects and Collections

		// Implementation
		function createHTMLCollection(native_list)
		{
			return new HTMLCollection(native_list, this);
		}
	}


	// HTMLElement Interface
	// **************************************
	function HTMLElementFactory()
	{
		this.ElementFactory = net.sf.xpdom.core.ns6.ElementFactory;
		this.ElementFactory();

		// Bind functions
		this.overload = overload;

		function overload(native_object,wrap_elem)
		{
			this.init(native_object,wrap_elem); // Call to NodeFactory.init()

			wrap_elem.HTMLElement = HTMLElement; // Constructor
			wrap_elem.HTMLElement();	
		}

	}


	function HTMLElement() 
	{
		this.Element = net.sf.xpdom.core.ns6.Element;
		this.Element();

		// Bind functions
		this.HTMLElementImpl = xpdom_dom_HTMLElementImpl;
		this.HTMLElementImpl();
	}


	// HTMLHtmlElement Interface
	// **************************************
	function HTMLHtmlElementFactory()
	{
		this.HTMLElementFactory = HTMLElementFactory;
		this.HTMLElementFactory();

		// Bind functions
		this.overload = overload;

		function overload(native_object,wrap_elem)
		{
			this.init(native_object,wrap_elem); // Call to NodeFactory.init()

			wrap_elem.HTMLHtmlElement = HTMLHtmlElement; // Constructor
			wrap_elem.HTMLHtmlElement();	
		}

	}


	function HTMLHtmlElement()
	{
		this.HTMLElement = HTMLElement;
		this.HTMLElement();

		// Bind functions
		this.HTMLHtmlElementImpl = xpdom_dom_HTMLHtmlElementImpl;
		this.HTMLHtmlElementImpl();
	}


	// HTMLHeadElement Interface
	// **************************************
	function HTMLHeadElementFactory()
	{
		this.HTMLElementFactory = HTMLElementFactory;
		this.HTMLElementFactory();

		// Bind functions
		this.overload = overload;

		function overload(native_object,wrap_elem)
		{
			this.init(native_object,wrap_elem); // Call to NodeFactory.init()

			wrap_elem.HTMLHeadElement = HTMLHeadElement; // Constructor
			wrap_elem.HTMLHeadElement();	
		}

	}


	function HTMLHeadElement()
	{
		this.HTMLElement = HTMLElement;
		this.HTMLElement();

		// Bind functions
		this.HTMLHeadElementImpl = xpdom_dom_HTMLHeadElementImpl;
		this.HTMLHeadElementImpl();
	}


	// HTMLBodyElement Interface
	// **************************************
	function HTMLBodyElementFactory()
	{
		this.HTMLElementFactory = HTMLElementFactory;
		this.HTMLElementFactory();

		// Bind functions
		this.overload = overload;

		function overload(native_object,wrap_elem)
		{
			this.init(native_object,wrap_elem); // Call to NodeFactory.init()

			wrap_elem.HTMLBodyElement = HTMLBodyElement; // Constructor
			wrap_elem.HTMLBodyElement();	
		}
	}

	function HTMLBodyElement()
	{
		this.HTMLElement = HTMLElement;
		this.HTMLElement();

		this.HTMLBodyElementImpl = xpdom_dom_HTMLBodyElementImpl;
		this.HTMLBodyElementImpl();
	}
}

