/*
 * Name: default
 * Version: 1.0
 * Author: embeddednode
 * E-Mail: embeddednode@users.sourceforge.net
 * Licence: only for me
 * 
 * Usage:
 * function addOnloadListener(function)
 * function addOnloadListener(new Array(function, function, ...))
 * object   loadXML(string)
 */

function addOnloadListener(any) {
	var type = typeof any;
	if(type == 'function') {
		compatible(any);
	} else if(type == 'object') {
		var index = 0;
		do {
			compatible(any[index++]);
		} while(index<any.length);
	} else throw new Error('This specified type is error');
	
	function compatible(listener) {
		if(window.attachEvent)
			window.attachEvent('onload',listener);
		else if(window.addEventListener)
			window.addEventListener('load', listener, false);
		else throw new Error('It is not found compatible function');
	}
}

function loadXML(responseText) {
	var doc;
	if (window.ActiveXObject)
		doc = new ActiveXObject('Microsoft.XMLDOM');
	else if(document.implementation && document.implementation.createDocument)
		doc = document.implementation.createDocument("", "", null);
	else throw new Error('It is not found compatible function');
	doc.loadXML(responseText);
	return doc;
}
