/*
 * ProFrom - Professzionális Felhasználói Felületek $Id: _lib.ie.js,v 1.1 2008/04/08 13:55:05 szjozsef Exp $
 */


/**
 * $ prototype_A.ie.js,v 1.2 2005/05/31 13:36:26 gyuris Exp $
 * prototype A.ie
 * @package  lib.prototypeA.ie
 * @author   Gyuris Gellért
 */
/**
 * Node - csak IE, a hiányzó objektum pótlása
 */
if ( is.ie6 ) {
	var Node={};
}
window.Node = Node = {
	ELEMENT_NODE                : 1,
	ATTRIBUTE_NODE              : 2,
	TEXT_NODE                   : 3,
	CDATA_SECTION_NODE          : 4,
	ENTITY_REFERENCE_NODE       : 5,
	ENTITY_NODE                 : 6,
	PROCESSING_INSTRUCTION_NODE : 7,
	COMMENT_NODE                : 8,
	DOCUMENT_NODE               : 9,
	DOCUMENT_TYPE_NODE          : 10,
	DOCUMENT_FRAGMENT_NODE      : 11,
	NOTATION_NODE               : 12
};
/**
 * updateArrayPrototype - hozzáadja az Array-hoz Array.prototype.item, Array.prototype.nextItem elemeket, ezen kívül 
 * IE5-ben a hiányzó elemeket is hozzáadja ( Array.prototype.push, Array.prototype.pop, Array.prototype.shift,
 * Array.prototype.unshift, Array.prototype.splice - dokumentációk a hivatalos leírásokban)
 */
function updateArrayPrototype() {
	if ( !Array.prototype.push || [1, 1, 1].push( 1 ) != 4 ) {
		Array.prototype.push = function () {
			var i;
			for( i = 0; i < arguments.length; i++ ) {
				this[this.length] = arguments[i];
			};
			return this.length;
		};
	};
	if ( !Array.prototype.pop ) {
		Array.prototype.pop = function() {
			var xOld;
			xOld = this[this.length - 1];
			delete this[this.length - 1];
			this.length--;
			return xOld;
		};
	};
	if ( !Array.prototype.shift ) {
		Array.prototype.shift = function() {
			var xOld, i;
			xOld = this[0];
			for( i = 0; i < this.length - 1; i++ ) {
				this[i] = this[i + 1];
			};
			delete this[this.length - 1];
			this.length--;
			return xOld;
		};
	};
	if ( !Array.prototype.unshift || [1, 1, 1 ].unshift( 1 ) != 4 ) {
		Array.prototype.unshift = function () {
			var i;
			for ( i = this.length - 1; i >= 0; i-- ) {
				this[i + arguments.length] = this[i];
			};
			for ( i = 0; i < arguments.length; i++ ) {
				this[i] = arguments[i];
			};
			return this.length;
		};
	};
	if( !Array.prototype.splice ) {
		Array.prototype.splice = function ( nStart, nDeleteCount ) {
		    var aReturn = [], i;
		    for ( i = 0; i < nDeleteCount; i++ ) {
				aReturn[i] = this[i + nStart];
			};
			for ( i = nStart; i < this.length - nDeleteCount; i++ ) {
				this[i] = this[i + nDeleteCount];
			};
			this.length -= nDeleteCount;
			if ( arguments.length > 2 ) {
				for( i = this.length - 1; i >= nStart; i-- ) {
					this[i + nDeleteCount] = this[i];
				};
				for( i = 0; i < nDeleteCount; i++ ) {
					this[i + nStart] = arguments[i + 2];
				};
			};
			return aReturn;
		};
	};
};
updateArrayPrototype();
/**
 * cleanupArrayPrototype: - a for..in Array esetén szükséges kitakarítást végzi el.
 */
function cleanupArrayPrototype() {
	var i;
	for ( i in Array.prototype ) {
		delete Array.prototype[i];
	};
};


/**
 * $ xml.js,v 1.9 2005/06/10 12:47:24 gyuris Exp $
 * XML kezelés IE alatt.
 * @package  lib.xml
 * @author   Gyuris Gellért
 * @see      browserCheck
 */
/**
 * getMSXMLProgId - csak IE alatt: megkeresi, hogy melyik activeX van telepítve az XmlHttp és az XmlDocument számára.
 * @return String  A progId emberi neve.
 */
function getMSXMLProgId( sId ) {
	var oXML, i, sFunction, sProgId;
	progId = {
		xml : ['Msxml2.DOMDocument.3.0', 'Msxml2.DomDocument', 'MSXML3.DomDocument', 'MSXML.DomDocument', 'Microsoft.DomDocument', 'Microsoft.XMLDOM'],
		xmlHttp : [ 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'MSXML.XmlHttp', 'MSXML3.XmlHttp', 'Microsoft.XmlHttp' ]
	};
	sFunction = 'function testProgId( sProgId ) {' +
				'	try {' +
				'		oXML = new ActiveXObject( sProgId );' +
				'		return sProgId;' +
				'	}' +
				'	catch ( ex ) { return null };' +
				'};';
	eval( sFunction );
	for ( i = 0; i < progId[sId].length; i++ ) {
		sProgId = testProgId( progId[sId][i] );
		if ( sProgId != null ) {
			return sProgId;
		};
	};
};

/**
 * XmlHttp - XML kommunikáció létrehozása.
 */
if ( typeof XMLHttpRequest == 'undefined' ) {
	XMLHttpRequest = function() {
		return new ActiveXObject( getMSXMLProgId( 'xmlHttp' ) );
	};
};
/**
 * XMLSerializer - IE kiegészítés: XML sztringgé alakítása. Dokumentációja a mozilla.org-on.
 */
if ( typeof XMLSerializer == 'undefined' ) {
	function XMLSerializer() {
		this.toString = function() { 
			return '[object XMLSerializer]';
		};
		this.serializeToString = function( elDOM ) {
			return elDOM.xml || elDOM.outerHTML; 
		};
		this.serializeToStream = function() {};
		return this;
	};
};
/**
 * DOMParser - IE kiegészítés: sztring XML-lé alalítása. Dokumentációja a mozilla.org-on.
 */
if ( typeof DOMParser == 'undefined' ) {
	function DOMParser() {
		this.toString = function() { 
			return '[object DOMParser]';
		};
		this.baseURI = '';
		this.parseFromString = function( sDOM, sContentType ) {
			var oXMLDocument = new ActiveXObject( getMSXMLProgId( 'xml' ) );
			oXMLDocument.loadXML( sDOM );
			return oXMLDocument;
		};
		this.parseFromStream = function() {};
		return this;
	};
};

/**
 * XSLTProcessor - IE kiegészítés: XSL átalakításra. Dokumentációja a mozilla.org-on.
 */
if ( typeof XSLTProcessor == 'undefined' ) {
	function XSLTProcessor() {
		this.toString = function() { 
			return '[object XSLTProcessor]'
		};
		this.importStylesheet = function( oXSLDoc ) {
			this.xslDoc = oXSLDoc;
		};
		this.transformToFragment = function( oXMLDoc, oDOMDocument ) {
			oDOMDocument.async = false;
  			oDOMDocument.validateOnParse = true;
			oXMLDoc.transformNodeToObject( this.xslDoc, oDOMDocument );
			return oDOMDocument;
		};
		this.transformToDocument = function( oXMLDoc ) {
			oDOMDocument = new ActiveXObject( getMSXMLProgId( 'xml' ) );
			return this.transformToFragment( oXMLDoc, oDOMDocument );
		};
		this.setParameter = function() {};
		this.getParameter = function() {};
		this.removeParameter = function() {};
		this.clearParameters = function() {};
		this.reset = function() {};
		return this;
	};
};
