// insertAdjacentHTML(), insertAdjacentText() and insertAdjacentElement()
// for Netscape 6/Mozilla by Thor Larholm me@jscript.dk
// Usage: include this code segment at the beginning of your document
// before any other Javascript contents.

<!--
if(typeof HTMLElement!="undefined" && !
HTMLElement.prototype.insertAdjacentElement)
{
	HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode)
	{
		switch (where)
		{
			case 'beforeBegin':
				this.parentNode.insertBefore(parsedNode,this)
				break;
			case 'afterBegin':
				this.insertBefore(parsedNode,this.firstChild);
				break;
			case 'beforeEnd':
				this.appendChild(parsedNode);
				break;
			case 'afterEnd':			
				if (this.nextSibling) 
				{
				    //alert(this.nextSibling);
					this.parentNode.insertBefore(parsedNode,this.nextSibling);
				}			
				else 
				{
				//alert(parsedNode);
					this.parentNode.appendChild(parsedNode);
				}
			break;
		}
	}

	HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr)
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML);
	}


	HTMLElement.prototype.insertAdjacentText = function(where,txtStr)
	{
		var parsedText = document.createTextNode(txtStr);
		this.insertAdjacentElement(where,parsedText);
	}
}
//-->

<!--
if(typeof HTMLElement!="undefined" && !
HTMLElement.prototype.removeNode)
{
	HTMLElement.prototype.removeNode = function(_shouldRemove)
	{
		for (var i=0; i<this.childNodes.length; x++)
		{
			this.removeChild(this.childNodes[i]);
		}
		
		var y=this.parentNode;
			
		for (var i=0; i<y.childNodes.length; i++)
		{
			if (y.childNodes[i]==this) y.removeChild(this);
		}		
	}
}
//-->

<!--
if(typeof HTMLElement!="undefined" && !
	HTMLElement.prototype.innerText)
{
	// support "innerText"
	HTMLElement.prototype.__defineGetter__("innerText", function() 
	{    
		return this.textContent;
	});
	
	HTMLElement.prototype.__defineSetter__("innerText", function($value) 
	{    
		this.textContent = $value;
	});
}

//-->		

<!--
	function getRealLeft(el) {
		if (arguments.length==0) el = this;
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		}
		return xPos;
	}

	function getRealTop(el) {
		if (arguments.length==0) el = this;
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		return yPos;
	}


//-->

