// Requires: Browser.js

Fade_NewZIndex = 0
Fade_SelectsToIgnore = null


function Fade_GetZIndex()
{

	return Fade_NewZIndex++

}


function Fade_SelectFix(StyleValue)
{

	if (Global_IsIE)
	{
		
		try
		{
		
			Fade_Selects = document.getElementsByTagName("select")
			
			for (i=0; i<Fade_Selects.length; i++)
			{
				
				CurrentSelect = Fade_Selects[i]
				
				if (Fade_SelectsToIgnore != null)
				{
				
					Fade_SelectsToIgnoreArray = Fade_SelectsToIgnore.split(",")
					Fade_ShouldBeIgnored = false
				
					for (x=0; x<Fade_SelectsToIgnoreArray.length; x++)
					{
						if (CurrentSelect.id == Fade_SelectsToIgnoreArray[x])
						{
						Fade_ShouldBeIgnored = true
						break
						}
					}
					
					if (!Fade_ShouldBeIgnored)
					{CurrentSelect.style.visibility = StyleValue}
				
				}
				
				else
				{CurrentSelect.style.visibility = StyleValue}
				
			}
			
		}
		
		catch (e)
		{}
		
	}
	
}


function Fade_ShowInfoNoFade(RunSelectFix,ElementID,TopPosition,LeftPosition,LayersToCheck,SelectsToIgnore,ScrollWindow,ElementHeight,ElementWidth)
{

	Fade_ShowInfo(RunSelectFix,ElementID,TopPosition,LeftPosition,LayersToCheck,SelectsToIgnore,ScrollWindow,false,ElementHeight,ElementWidth)

}


function Fade_ShowInfo(RunSelectFix,ElementID,TopPosition,LeftPosition,LayersToCheck,SelectsToIgnore,ScrollWindow,FadeInLayer,ElementHeight,ElementWidth)
{

	TheElement = document.getElementById(ElementID)

	if (FadeInLayer == null)
	{FadeInLayer = true}

	if (ScrollWindow == null)
	{ScrollWindow = true}
	
	if (ScrollWindow)
	{window.scroll(0,0)}
	
	if (Global_IsIE) 
	{
		BrowserHeight = document.body.clientHeight
		BrowserWidth = document.body.clientWidth
		BrowserTop = document.body.scrollTop
		BrowserLeft = document.body.scrollLeft
	} 
	
	else
	{
		BrowserHeight = window.innerHeight
		BrowserWidth = window.innerWidth
		BrowserTop = window.pageYOffset
		BrowserLeft = window.pageXOffset
	}

	if (SelectsToIgnore != null)
	{
	
		if (SelectsToIgnore.replace(/s+/g,"") != "")
		{Fade_SelectsToIgnore = SelectsToIgnore}
	
	}

	if (RunSelectFix)
	{Fade_SelectFix('hidden')}
	
	if (TopPosition == null)
	{TopPosition = 0}
			
	if (LeftPosition == null)
	{LeftPosition = 0}
	
	if (ElementHeight != null)
	{TopPosition = BrowserHeight/2 - ElementHeight/2}
	
	if (ElementWidth != null)
	{LeftPosition = BrowserWidth/2 - ElementWidth/2}
	
	if (LayersToCheck != null)
	{
	
		if (LayersToCheck.replace(/\s+/g,"") != "")
		{

			LayerArray = LayersToCheck.split(",")
		
			for (i=0; i<LayerArray.length; i++)
			{document.getElementById(LayerArray[i]).style.display = "none"}
			
		}
	
	}
	
	TheElement.style.zIndex = Fade_GetZIndex()
	TheElement.style.left = BrowserLeft + LeftPosition
	TheElement.style.top = BrowserTop + TopPosition
	TheElement.style.display = "block"
	
	if (FadeInLayer)
	{
		Fade_FadeIn(0,ElementID)
	}
	
}


function Fade_HideInfo(RunSelectFix,ElementID)
{

	TheElement = document.getElementById(ElementID)
	
	TheElement.style.display = 'none'
	
	if (RunSelectFix)
	{Fade_SelectFix('visible')}

}


function Fade_SetOpacity(opacity,ElementID) 
{

	if (opacity == 100)
	{
		opacity = 99
	}

	TheElement = document.getElementById(ElementID)

	TheElement.style.filter = "alpha(opacity:"+opacity+")"
	TheElement.style.KHTMLOpacity = opacity/100
	TheElement.style.MozOpacity = opacity/100
	TheElement.style.opacity = opacity/100

}


function Fade_FadeIn(opacity,ElementID) 
{

	if (opacity <= 100) 
	{
     
		Fade_SetOpacity(opacity,ElementID)
	  
		if (opacity < 100)
		{      
	  		opacity += 10
	       	window.setTimeout("Fade_FadeIn("+opacity+",'" + ElementID + "')", 50)
		}
	  
	}

}