
var step = 2;
fadeInterval = null;
function Fade(pos)
{

	if(pos==undefined)
	{
		clearTimeout(fadeInterval);
		pos=0;
	}
	else pos+=step;
	elm = document.getElementById('tooltip');
	
	elm.className = 'clear op' + pos;
	

	elm.style.display = ''

 	if(pos<10)	fadeInterval = setTimeout("Fade("+pos+")", 100);
	//else alert('!');
}

function FadeOut(pos)
{

	if(pos==undefined)
	{
		clearTimeout(fadeInterval);
		pos=10;
	}
	else pos-=step;
	
	var elm = document.getElementById('tooltip');
	elm.className = 'clear op' + pos;
	

 	if(pos>0)	fadeInterval = setTimeout("FadeOut("+pos+")", 100);
	else elm.style.display = 'none';
}




function FadeEx(elmID, pos)
{
	elm = document.getElementById(elmID).firstChild;
	if(pos==undefined)
	{
		clearTimeout(elm.fadeIntervalEx);
		pos=0;
	}
	else pos+=step;

	elm.style.display = 'block'
	elm.className = 'img1 op' + pos;
	
 	if(pos<10)	elm.fadeIntervalEx = setTimeout("FadeEx('"+elmID+"',"+pos+")", 50);
}


function FadeOutEx(elmID,pos)
{
var elm = document.getElementById(elmID).firstChild;
	if(pos==undefined)
	{
		clearTimeout(elm.fadeIntervalEx);
		pos=10;
	}
	else pos-=step;
	
	
	elm.className = 'img1 op' + pos;
	

 	if(pos>0)	elm.fadeIntervalEx = setTimeout("FadeOutEx('"+elmID+"',"+pos+")",50);
	else elm.style.display = 'none';
}
function FadeTT(elmID,pos)
{
var elm = document.getElementById(elmID);
	if(pos==undefined)
	{
		clearTimeout(elm.fadeIntervalTT);
		pos=0;
	}
	else pos+=step;
	
	elm.style.display = 'block'
	elm.className = 'op' + pos;
	

 	if(pos<10)	elm.fadeIntervalTT = setTimeout("FadeTT('"+elmID+"',"+pos+")", 90);
//	else elm.style.display = 'none';
}


function FadeOutTT(elmID,pos)
{
var elm = document.getElementById(elmID);
	if(pos==undefined)
	{
		clearTimeout(elm.fadeIntervalTT);
		pos=10;
	}
	else pos-=step;
	
	
	elm.className = 'op' + pos;
	

 	if(pos>0)	elm.fadeIntervalTT = setTimeout("FadeOutTT('"+elmID+"',"+pos+")", 90);
	else elm.style.display = 'none';
}

function PrepareAnimation()
 {

   this.imgs = new Array();
   this.activeIndex = 0;
   this.prevIndex = 0;
   this.handle=null;
   this.handle2=null;


 }

 var anim = new PrepareAnimation();
 
 anim.StartAnimation = function(callbackOnMouseOverFunc, callbackOnMouseOutFunc)
 {
   anim.callbackOnMouseOverFunc = callbackOnMouseOverFunc;
   anim.callbackOnMouseOutFunc =callbackOnMouseOutFunc;
   anim.activeIndex=0;
   anim.prevIndex = 0;
   var imgs = document.getElementsByTagName("img");
   for(i = 0; i < imgs.length; i++)
   {
   	if(imgs[i].className=='img1')
	{
		anim.imgs.push(imgs[i]);

	}
   }
   clearInterval(anim.handle);
   anim.handle = setInterval(anim.HiliteImages, 2000);
 }
 
 anim.HiliteImages = function()
 {

   if(anim.activeIndex!=anim.prevIndex)
   {
	   anim.imgs[anim.prevIndex].className='img1';
   	   anim.imgs[anim.prevIndex].style.display='none';
   }
   anim.prevIndex = anim.activeIndex;

//	anim.imgs[anim.prevIndex]
	FadeEx(anim.imgs[anim.prevIndex].parentNode.id);
	anim.imgs[anim.prevIndex].step2 = setTimeout("FadeOutEx('"+anim.imgs[anim.prevIndex].parentNode.id+"')", 300);
	anim.imgs[anim.prevIndex].step3 = setTimeout("FadeEx('"+anim.imgs[anim.prevIndex].parentNode.id+"')", 300);
	anim.imgs[anim.prevIndex].step4 = setTimeout("FadeOutEx('"+anim.imgs[anim.prevIndex].parentNode.id+"')", 900);

   anim.activeIndex++;
   anim.activeIndex%=anim.imgs.length;

 }
 
 anim.StopAnimation = function()
 {
   clearInterval(anim.handle);
   clearTimeout(anim.handle2);
   
   clearTimeout(anim.imgs[anim.prevIndex].step2);
   clearTimeout(anim.imgs[anim.prevIndex].step3);
   clearTimeout(anim.imgs[anim.prevIndex].step4);
   
   anim.imgs[anim.prevIndex].className='img1';   
   anim.imgs[anim.prevIndex].style.display='none';   
   anim.imgs[anim.activeIndex].className='img1';   
   anim.imgs[anim.activeIndex].style.display='none';   
 }


	function png_alfa(obj)
	{
	  if( obj.runtimeStyle && obj.src.match( /\.png$/ ) )
	  {
		obj.runtimeStyle.filter= 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src='+ obj.src + ', sizingMethod=scale)'; 
		obj.src = 'img/spacer.gif';
          }
	}
	function fixAllImg()
        {
	    var imgs = document.getElementsByTagName('img');
	    for(var i=0;i<imgs.length;i++)
	    {
		var obj = imgs[i];
		if(obj.src.match( /\.png$/ ))
		{
		  png_alfa(obj);
		}
	    }
	}

