var ct_multi = 0;
var alpha = 1;
var firstmulti = true; 

function changeContent(animation)
{
	ar = cont_array;
        if(ar.length == ct_multi)
        {
                ct_multi = 0;
        }
        
        if(firstmulti)
        {
                id1 = 'multicontent_'+ar[1];
                id2 = 'multicontent_'+ar[0];
                ct_multi = 1;
                firstmulti = false;
        }
        else
        {
                id1 = 'multicontent_'+ar[ct_multi];
                if(ct_multi == 0)
                {
                        id2 = 'multicontent_'+ar[ar.length-1];
                }
                else
                {
                        id2 = 'multicontent_'+ar[ct_multi-1];
                }
        }
        switch(animation)
        {
        case 'gradual':
                gradual(id1, id2);
                break;
        case 'instant':
                instant(id1, id2);
                break;
        default:
                break;
        }
        ct_multi++;
}

function multicontent(interval, animation)
{
        if(cont_array.length > 1)
        {
	        setInterval("changeContent('"+animation+"')", interval);
        }
}

function instant(id1, id2)
{
	document.getElementById(id1).style.visibility = 'visible';
	//document.getElementById(id1).style.height = '100%';
	document.getElementById(id2).style.visibility = 'hidden';
	//document.getElementById(id2).style.height = '0px';
}

function gradual(id1, id2)
{
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		document.getElementById(id1).style.filter = 'alpha(opacity=0)';
		document.getElementById(id2).style.filter = 'alpha(opacity=100)';
		setTimeout("changeExplorerAlpha('"+id1+"','"+id2+"', 100)", 50);
	}
	else
	{
		document.getElementById(id1).style.opacity = '0';
		document.getElementById(id2).style.opacity = '1';
		setTimeout("changeAlpha('"+id1+"','"+id2+"', 1)", 50);
	}
	document.getElementById(id1).style.visibility = 'visible';
	document.getElementById(id2).style.visibility = 'visible';
}

function changeAlpha(id1, id2, al)
{
	if(al >= -0.1)
	{
		document.getElementById(id1).style.opacity = 1-al;
		document.getElementById(id2).style.opacity = al;
		al = al - 0.05;
		setTimeout("changeAlpha('"+id1+"','"+id2+"', "+al+")", 50);
	}
	else
	{
		document.getElementById(id2).style.visibility = 'hidden';
	}
}

function changeExplorerAlpha(id1, id2, al)
{
	if(al >= -5)
	{
		document.getElementById(id1).style.filter = 'alpha(opacity=' +(100-al)+ ')';
		document.getElementById(id2).style.filter = 'alpha(opacity=' +al+ ')';
		al = al - 5;
		setTimeout("changeExplorerAlpha('"+id1+"','"+id2+"', "+al+")", 50);
	}
	else
	{
		document.getElementById(id2).style.visibility = 'hidden';
                document.getElementById(id2).style.filter = '';
                document.getElementById(id1).style.filter = '';
	}
}

function setMarquee(id)
{
	var obj = document.getElementById(id);
	if(obj)
	{
		var mar = document.createElement("marquee");
		mar.innerHTML = obj.innerHTML;
		obj.parentNode.appendChild(mar);
		obj.parentNode.removeChild(obj);
	}
}
