////////////////////////////////////////////////////////////////////////////////////////////////////// L A Y E R   R E G I S T E R
// L A Y E R   R E G I S T E R
function LayerRegister(){
	this.m_arLayers = new Array();
	////////////////////////////////////////////////////////////////////////////////////////////////////// L A Y E R   R E G I S T E R :: R E G I S T E R
	// L A Y E R   R E G I S T E R :: R E G I S T E R
	this.Register = function(Layer){
		this.m_arLayers.push(Layer);
		if(this.m_arLayers.length == 1) ChangeComboboxesVisibility('hidden');
	}
	////////////////////////////////////////////////////////////////////////////////////////////////////// L A Y E R   R E G I S T E R :: U N R E G I S T E R
	// L A Y E R   R E G I S T E R :: U N R E G I S T E R
	this.Unregister = function(Layer){
		var arTemp = new Array();
		for(var i = 0; i < this.m_arLayers.length; i++)
			if(this.m_arLayers[i].uniqueID != Layer.uniqueID) arTemp.push(this.m_arLayers[i]);
		this.m_arLayers = arTemp;
		if(this.m_arLayers.length == 0) ChangeComboboxesVisibility('visible');
	}
	////////////////////////////////////////////////////////////////////////////////////////////////////// L A Y E R   R E G I S T E R :: G E T   C O U N T
	// L A Y E R   R E G I S T E R :: G E T   C O U N T
	this.GetCount = function(){
		return this.m_arLayers.length;
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////// C H A N G E   C O M B O B O X E S   V I S I B I L I T Y
// C H A N G E   C O M B O B O X E S   V I S I B I L I T Y
function ChangeComboboxesVisibility(sVisibility, wndWindow){
	if(document.all){
		//alert('Changing visibility!');
		if(!wndWindow) wndWindow = window;
		arCombos = wndWindow.document.all.tags("select");
		for(var i = 0; i < arCombos.length; i++){
			if(typeof(arCombos[i].parentNode) != "undefined"){
				var ComboParent = _GetParentTagWithSetVisibility(arCombos[i].parentNode);
				if(ComboParent != null && ComboParent.style.visibility == "hidden")
					continue;
			}
			arCombos[i].style.visibility = sVisibility;
		}
		var arFrames = wndWindow.frames;
		for(var j = 0; j < arFrames.length; j++){
			if(arFrames[j].frameElement.isSvg == "1")
				arFrames[j].frameElement.style.visibility = sVisibility;
			else
				ChangeComboboxesVisibility(sVisibility, arFrames[j]);
		}		
	}
}
function _GetParentTagWithSetVisibility(Element){
	if(Element.style.visibility != ""){
		return Element;
	}else{
		if(typeof(Element.parentNode) != "undefined" && Element.parentNode.tagName != "BODY"){
			return _GetParentTagWithSetVisibility(Element.parentNode);
		}else{
			return null;
		}
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////// G E T   C O O R D I N A T E S
// G E T   C O O R D I N A T E S
function GetCoordinates(oElement){
	//var arCoordinates = new Array(0, 0);
	var X, Y, oParent;
	X = oElement.offsetLeft;
	Y = oElement.offsetTop;
	oParent = oElement;
	while(oParent = oParent.offsetParent){
		if(oParent.style.position == 'absolute' || oParent.style.position == 'relative') break;
		X += oParent.offsetLeft;
		Y += oParent.offsetTop;
	}
	return new Array(X, Y);
}
