function SF_DOM( m_oPrams )
{
	SF_DOMBase.call( this, m_oPrams );

	var self = this;

	// Enums
	this.EEventNames = 
	{
		Load		: "load",
		Select		: "onselect",
		MouseDown   : "mousedown",
		MouseMove   : "mousemove",
		MouseUp     : "mouseup",
		KeyDown     : "keydown",
		KeyPress    : "keypress",
		Click       : "click",
		Scroll      : "scroll",
		Resize      : "resize",
		FocusOnTab  : "onkeyup",	
		WindowBlur  : "blur",
		ContextMenu : "contextmenu"	
	}
	
	function FireOnCreate()
	{
		var fnPre = self.GetPreCreatePred();
		var fn = self.GetOnCreate();

		if( fnPre )
		{
			fnPre();
		}
		fn();
	}
/*
	this.PreCreate = function()
	{
		window.addEventListener( "load", FireOnCreate, false );
		return false;
	}
*/
    this.IsMoz = function()
    {
        return true;
    }
    
	this.AfterCreate = function( oFloatEl )
	{
		document.body.appendChild( oFloatEl );	
	}

	this.IsFloaterDetached = function()
	{
		return true;
	}

	// 
	this.GetElById = function( sID, oCont)
	{
		if (!oCont) oCont = document;
		if (oCont.getElementById)
		{
			return oCont.getElementById(sID);
		}
		else
		{
			function fnOnTreeWalk(xdn)
			{
				return xdn.getAttribute && (sID == xdn.getAttribute("id"));
			}

			var xdnRes = DOMWalk( oCont, fnOnTreeWalk );
			return xdnRes;
		}	
	}
	
	this.GetAttribute = function( oEl, sAttr )
	{
		return oEl.getAttribute( sAttr );
	}
	
	this.IsElContaining = function( oEl, oCont )
	{
		return IsElContaining( oCont, oEl )
	}
		
	this.GetOffset = function( oEl, oCont )
	{
		var nX = 0, nY = 0;

		var bPar = false;
		while (oEl && oEl != oCont && 
			(!oCont || IsElContaining( oCont, oEl ))
		)
		{	
			if (bPar)
			{
				if( oEl.tagName != "TABLE" )
				{
					var oElStl = getComputedStyle( oEl, "" );
					nX +=  parseInt( oElStl.borderLeftWidth, 10 );
					nY +=  parseInt( oElStl.borderTopWidth, 10 );
				}
			}
			
			nX += oEl.offsetLeft;
			nY += oEl.offsetTop;
			
			if( bPar )
			{
				nX -= oEl.scrollLeft;
				nY -= oEl.scrollTop;
			}
			
			bPar = true;			
			
			
			var oParentEl = oEl.offsetParent;
			if( oParentEl && IsElContaining( oParentEl, oEl ) && ( oParentEl.tagName == "BODY" ) )
			{
				var oElStl = getComputedStyle( oEl, "" );
				if( oElStl && oElStl.position == "static" )
				{
					var oParElStl = getComputedStyle( oParentEl, "" );
					nX +=  parseInt( oParElStl.borderLeftWidth, 10 );
					nY +=  parseInt( oParElStl.borderTopWidth, 10 );
				}
			}			
			oEl = oParentEl;
		}

		return { x: nX, y: nY };
	}

	this.GetLostOffset = function( oSubEl )
	{
		var oXY = null;
		var oSubElOffPar = oSubEl.offsetParent;
		if (oSubElOffPar)
		{
			var sTag = oSubElOffPar.tagName;
			if
			( sTag && "body" == sTag.toLowerCase() 
//				&& document.doctype && document.doctype.publicId.indexOf("XHTML 1") > 0
			)
			{
				var oBody = document.body;

				var nBX = oBody.offsetLeft;
				var nBY = oBody.offsetTop;

				if (nBX < 0 || nBY < 0)
				{
					oXY = { x: -nBX, y: -nBY };
				}
			}
		}
		return oXY;
	}
	
	this.IsClipSlow = function()
	{
		return true;
	}
	
	this.GetRTStyle = function( oEl )
	{
		return getComputedStyle( oEl, "");
	}
		
	this.GetElementWidthMargin = function( oEl, bLeft )
	{
		var nRes = 0;
		if( oEl.tagName )
		{
		    var oElSt = getComputedStyle( oEl, "" );
	        nRes = bLeft ? parseInt( oElSt.marginLeft, 10) : parseInt( oElSt.marginRight, 10);
		}
		return isNaN( nRes ) ? 0 : nRes;					
	}
	
	this.GetElementHeightMargin = function( oEl, bTop )
	{
		var nRes = 0;
		if( oEl.tagName )
		{
		    var oElSt = getComputedStyle( oEl, "" );
		    nRes = bTop ? parseInt( oElSt.marginTop, 10) : parseInt( oElSt.marginBottom, 10);
		}		
		return isNaN( nRes ) ? 0 : nRes;					
	}
	
	this.SetMargin = function( oTargetEl, oSourceEl )
	{
		var oTargetSt = oTargetEl.style;
		var oSourceSt = getComputedStyle( oSourceEl, "" );
		oTargetSt.marginTop = oSourceSt.marginTop;  
		oTargetSt.marginBottom = oSourceSt.marginBottom;  
		oTargetSt.marginLeft = oSourceSt.marginLeft;  
		oTargetSt.marginRight = oSourceSt.marginRight;  
	}
	
	this.GetTopmostLayoutEl = function()
	{
		var oEl;
		if( document.compatMode == "CSS1Compat" )
		{
			oEl = document.documentElement;
		}
		else
		{
			oEl = document.body;
		}
		return oEl;
	}
	
	this.GetScrollbarWidth = function( oEl, bHorizontal )
	{
		var nRes = 0;
		
		var oElStl = getComputedStyle( oEl, "" );		
		var nBorderWidth = bHorizontal ?
			( parseInt( oElStl.borderTopWidth, 10 )+ parseInt( oElStl.borderBottomWidth, 10 ) ) :
			( parseInt( oElStl.borderLeftWidth, 10 )+ parseInt( oElStl.borderRightWidth, 10 ) );
					
		if (bHorizontal)
		    nRes = oEl.offsetHeight - nBorderWidth - oEl.clientHeight;
		else
		    nRes = oEl.offsetWidth - nBorderWidth - oEl.clientWidth;
		
		return nRes;
	}
	
	this.GetElementExtHeight = function( oEl, bTop )
	{
		var oElStl = getComputedStyle( oEl, "" );
	
		var nBY = parseInt( bTop ? oElStl.borderTopWidth : oElStl.borderBottomWidth, 10 );
		var nPY = parseInt( bTop ? oElStl.paddingTop : oElStl.paddingBottom, 10 );
		var nEH = nBY + nPY;
		
		return nEH;
	}
	
	this.GetElementExtWidth = function( oEl, bLeft )
	{
		var oElStl = getComputedStyle( oEl, "" );

		var nBX = parseInt( bLeft ? oElStl.borderLeftWidth : oElStl.borderRightWidth, 10 );
		var nPX = parseInt( bLeft ? oElStl.paddingLeft : oElStl.paddingRight, 10 );
		var nEH = nBX + nPX ;
		
		return nEH;
	}
	
	this.GetIsOffsetWidthDeviating = function()
	{
		return true;
	}
	
	this.IsFocusedEl = function( oEl )
	{
		var bRes =( null != oEl.focus );
		return bRes;
	}
		
	this.EventCancel = function( oEv )
	{
		if (oEv)
		{
			oEv.stopPropagation();
			oEv.preventDefault();
		}
	}
	
	this.IsCompleteMouseOut = function( oEl, oEv )
	{
		var bFromExternalEl = !( IsElContaining( oEl, oEv.explicitOriginalTarget ) )
		return bFromExternalEl;
	}
	
	this.GetEventSrcElement = function( oEv )
	{
		return oEv.explicitOriginalTarget;//oEv.originalTarget;
	}
	
	this.AttachEvent = function( sEventName, fn, oEl )
	{
	    if( !oEl )
		{
			oEl = window;
		}
		
		oEl.addEventListener( sEventName, fn, false );
		
		if( ( oEl == window )&&( self.EEventNames.Scroll == sEventName ) )
		{
		    oEl.addEventListener( "DOMMouseScroll", fn, false );
		}
	}
	
	this.DetachEvent = function( sEventName, fn, oEl )
	{
	    if( !oEl )
		{
			oEl = window;
		}
		
		oEl.removeEventListener( sEventName, fn, false );
	}

	this.AttachCustomEvent = function( sEventName, fn, oEl )
	{
		var oDom = this;
		function Run( oEv )
		{
			fn( oEv, oDom );
		}
		if (!oEl)
		{
			oEl = self.GetTopmostLayoutEl();
		}
		oEl.addEventListener( sEventName, Run , false );
	}
	
	this.GetIsWindowBlur = function( oEv )
	{
	    var sNodeName = oEv.explicitOriginalTarget.nodeName;
	    return ( sNodeName == "HTML" );
	}

	this.ClearAlign = function( oEl )
	{
		oEl.align = "";
	}
		
	// fn(xdnNode), return true to break
	function DOMWalk( xdn, fn, oWalk )
	{
		var xdnRes = null;
		
		if (null == oWalk)
			oWalk = document.createTreeWalker( xdn, NodeFilter.SHOW_ALL, null, true);

		if (oWalk.firstChild())
		{
			do
			{
				var xdnCur = oWalk.currentNode;
				if (fn( xdnCur ))
				{
					xdnRes = xdnCur;
					break;
				}
				xdnRes = DOMWalk( xdnCur, fn, oWalk );
				if (xdnRes)
				{
					break;
				}
			}
			while( oWalk.nextSibling() );
			oWalk.parentNode();
		}

		return xdnRes;
	}
	
	// XULDOM utils
	function GetElRelationship( oEl, oOther, nCode )
	{
		var bRes = false;

		var nRes = oEl.compareDocumentPosition( oOther );
		bRes = (0 != (nCode & nRes));

		return bRes;	
	}

	function IsElContaining( oEl, oOther )
	{
		return GetElRelationship( oEl, oOther, oEl.DOCUMENT_POSITION_CONTAINED_BY );
	}

	function IsElFollowing( oEl, oOther )
	{
		return GetElRelationship( oEl, oOther, oEl.DOCUMENT_POSITION_FOLLOWING );
	}

	function IsElPreceding( oEl, oOther )
	{
		return GetElRelationship( oEl, oOther, oEl.DOCUMENT_POSITION_PRECEDING );
	}
	
}

function SF_CSS( m_oParams )
{
	SF_CSSBase.call( this, m_oParams );

	var self = this;

	// Filters
	this.FiltersSupported = function()
	{
		return false;
	}
	
	this.SetOpacity = function ( oEl, nIdx )
	{
		oEl.style.opacity = nIdx / 100;
	}
	
	this.SetFocusSetting = function( oEl, oValue )
	{
		var oRes = null;
		if( oEl )
		{
			var oElStl = getComputedStyle( oEl, "" );
			if( oElStl && ( oElStl.MozUserFocus != "none" ) )
			{
				oRes = oElStl.MozUserFocus;
				oEl.style.MozUserFocus = ( oValue ) ? oValue : "ignore";
			}
		}
		
		return oRes;
	}
	

	this.TransExpand = function( oEl, nDurSec, sFilt )
	{
		return false;
	}
	
	this.TransCollapse = function( oEl, nDurSec, sFilt )
	{
		return false;
	}

}
