var BROWSER_ABSTRACTION_INCLUDED = true;
//
// disable the selection in every browser abstracted window
//
// enabled for now
//
  var bSelectAllowed = true;

  function SetSelectAllowed(bValue)
  {
	bSelectAllowed = bValue;
  }
/*
	BrowserAbstraction abstract class
*/

// constructor
function BrowserAbstraction() 
{ 
	// this class is just a logical placeholder
	this.getDocument			= getDocumentMethod;
	this.getElementById			= getElementByIdMethod;	
	this.getElementsByTagName	= getElementsByTagNameMethod;	
	this.getElementByName		= getElementByNameMethod;
	this.getElementsByName		= getElementsByNameMethod;
	this.setVisibility			= setVisibilityMethod;
	this.setDisplay				= setDisplayMethod;
	this.setBgImage 			= setBgImageMethod;
	this.getRule				= getRuleMethod;

	this.getDivObj			= getDivObjMethod;

	this.getDivLeft			= getDivLeftMethod;
	this.getDivTop			= getDivTopMethod;
	this.setDivLeft			= setDivLeftMethod;
	this.setDivTop			= setDivTopMethod;

	this.setDivPos			= setDivPosMethod;

	this.getDivWidth		= getDivWidthMethod;
	this.getDivHeight		= getDivHeightMethod;
	this.setDivWidth		= setDivWidthMethod;
	this.setDivHeight		= setDivHeightMethod;
	
	this.setCursor			= setCursorMethod;
	this.getCursorHand		= getCursorHandMethod;
	
	this.supportFullScreen = supportFullScreenMethod;
	
	// methods	
	
	function getDocumentMethod(DocRef)
	{

		if (DocRef == null)
			DocRef = document;
					
		return DocRef;
	}

	function getElementByIdMethod(ElemID, DocRef)
	{
			
		return this.getDocument(DocRef).getElementById(ElemID);
				
	}

	function getElementsByNameMethod(ElemName, DocRef)
	{
		return this.getDocument(DocRef).getElementsByName(ElemName);	
	}
			
	function getElementByNameMethod(ElemName, DocRef)
	{
		DocRef = this.getDocument(DocRef);		// Take the current document
					
		var oRef = null;
		var	oArray = this.getElementsByName(ElemName, DocRef);
		
		if (oArray)
		{
			if (oArray.length > 0)
				oRef = oArray[0];
		}

		return oRef;
	}

	function getElementsByTagNameMethod(ElemName, DocRef)
	{
		return this.getDocument(DocRef).getElementsByTagName(ElemName);
	}

	function setVisibilityMethod(objRef, isVisible)
	{
		objRef.style.visibility = isVisible;
	}
		
	function setDisplayMethod(objRef, displayValue)
	{
		objRef.style.display = displayValue;
	}

	function setBgImageMethod(objRef, imageName)
	{
		if ( objRef != null )
		{
			//debug("bg: " + objRef.style.backgroundImage);
			objRef.style.backgroundImage = 'url(' + imageName + ')';
			//alert("bg: " + objRef.style.backgroundImage);
		}
	}
		
	function setImgSource(objRef, source)
	{
		if (objReg != null )
		{
			objRef.src = source;
		}
	}
		
	function getRuleMethod(sIndex, rIndex, DocRef)
	{
		var curDoc = this.getDocument(DocRef);
		var oRule = null;
		
		if (curDoc.styleSheets.length > 0)
			if (curDoc.styleSheets[sIndex].cssRules.length > 0)
				oRule = curDoc.styleSheets[sIndex].cssRules[rIndex];
		
		return oRule;
	}

	function setDivWidthMethod(objRef, width)
	{
		if ( objRef != null )
		{
			objRef.style.width = width + "px";
		}
	}

	function setDivHeightMethod(objRef, height)
	{
		if ( objRef != null )
		{
			objRef.style.height = height + "px";
		}
	}

	function getDivObjMethod(divID, parentDivObj)
	{
		// parentDivObj is optional if you want/need to traverse the DOM explicitly
		var objRef = null;
		objRef = document.getElementById(divID);
		return objRef;
		//FIX: this IE function should work
		//return eval(divID);
	}
		
	function getDivLeftMethod(objRef)
	{
		return ( objRef != null ) ? objRef.offsetLeft : null;
	}
		
	function getDivWidthMethod(objRef)
	{
		return ( objRef != null ) ? objRef.offsetWidth : null;
	}

	function getDivTopMethod(objRef)
	{
		return ( objRef != null ) ? objRef.offsetTop : null;
	}

	function getDivHeightMethod(objRef)
	{
		return ( objRef != null ) ? objRef.offsetHeight : null;
	}

	function setDivLeftMethod(objRef, x)
	{
		if ( objRef != null )
		{
			objRef.style.left = x + "px";
		}
	}
		
	function setDivTopMethod(objRef, y)
	{
		if ( objRef != null )
		{
			objRef.style.top = y + "px";
		}
		else
			alert('objRef ' + objRef.id + ' y is ' + y);
		
	}
		
	function setDivPosMethod(objRef, x, y)
	{
		if ( objRef != null )
		{
			objRef.style.left = x + "px";
			objRef.style.top = y + "px";
		}
	}

	function setCursorMethod(ObjRef, Type)
	{			
		if (ObjRef != null)
		{
			ObjRef.style.cursor = Type;
		}
	}
	
	function getCursorHandMethod()
	{
		return "pointer";
	}
	
	function supportFullScreenMethod()
	{
		return false;
	}
}
