// JavaScript Document
var BroswerName=""
var bufferInterval=null;
var count=0
var Step=1;
	
var ObjID= new Object()
function Fade(FadeObj,Mode){
	EndTransition="False";
	ObjID=FadeObj;


		//store the supported form of opacity

		if(typeof ObjID.style.opacity != 'undefined')
		{
			BroswerName = 'w3c';
		}
		else if(typeof ObjID.style.MozOpacity != 'undefined')
		{
			BroswerName = 'moz';
		}
		else if(typeof ObjID.style.KhtmlOpacity != 'undefined')
		{
			BroswerName= 'khtml';
		}
		else if(typeof ObjID.filters == 'object')
		{
			//weed out win/ie5.0 by testing the length of the filters collection (where filters is an object with no data)
			//then weed out mac/ie5 by testing first the existence of the alpha object (to prevent errors in win/ie5.0)
			//then the returned value type, which should be a number, but in mac/ie5 is an empty string
			BroswerName = (ObjID.filters.length > 0 && typeof ObjID.filters.alpha == 'object' && typeof ObjID.filters.alpha.opacity == 'number') ? 'ie' : 'none';
		
		}
		else
		{

			BroswerName = 'none';
		}
		ObjID.style.visibility="visible";
		ObjID.style.display="";
		if (Mode=="In"){

			Step=5;
			count=1;
		}else{

			Step=-5;
			count=100;
		}
		
		if(bufferInterval!=null){
			clearInterval(bufferInterval);			
		}
		
		bufferInterval= setInterval('AlphaTransition()', 20);	


		
		
}
function AlphaTransition(){
	
		count=count+Step
		if (count<=0 || count >=100){
			clearInterval(bufferInterval);
			bufferInterval=null

			EndTransition="True";

		}else{
			SetAlpha(ObjID,count);	
		}
		
		
		if (count<=0){
			ObjID.style.visibility="hidden";
			ObjID.style.display="none";	
			EndTransition="FadeOutEnd";
		}
		if (count>=100){
			EndTransition="FadeInEnd";
		}


}
function SetAlpha(FadeObj,AlphaCount){

	switch(BroswerName)
	{
		case 'ie' :
			FadeObj.filters.alpha.opacity = AlphaCount;
			break;			
		case 'khtml' :
			FadeObj.style.KhtmlOpacity = AlphaCount;
			break;			
		case 'moz' : 
			//restrict max opacity to prevent a visual popping effect in firefox
			FadeObj.style.MozOpacity =(AlphaCount/100)
			break;
			
		default : 
			//restrict max opacity to prevent a visual popping effect in firefox
			FadeObj.style.opacity =AlphaCount/100;
	}

}


