function WpGetBrowser()
{
  if(navigator.appName=="Microsoft Internet Explorer")
    return 0; // IE
  else
    return 1; // MOZILLA
}

if (typeof(Window) != 'undefined' && Window.prototype)
{
  Window.prototype.__defineSetter__( 'returnValue', function (p){ if (this.opener) this.opener.__returnValue = p; } );
  Window.prototype.__defineGetter__( 'dialogArguments', function () { return (this.opener ? this.opener.__dialogArguments : null); } );

  Window.prototype.__defineGetter__( 'screenLeft', function ()
  {
    return this.screenX;
  } );

  HTMLIFrameElement.prototype.__defineGetter__( 'document', function() { return this.contentDocument; } );
  HTMLDocument.prototype.frames = function( p_sID ) { return this.getElementById( p_sID ); };
  HTMLDocument.prototype.__defineGetter__( 'parentWindow', function () { return this.defaultView; } );
  HTMLTextAreaElement.prototype.__defineGetter__( 'document', function () { return this.ownerDocument; } );
  HTMLInputElement.prototype.__defineGetter__( 'document', function () { return this.ownerDocument; } );
  HTMLHtmlElement.prototype.__defineGetter__( 'document', function () { return this.ownerDocument; } );
}

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) 
					this.parentNode.insertBefore(parsedNode,this.nextSibling);
				else
					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)
	}
}

