var window_interval_id = null;
var current_transition = 0;
function fnToggle()
{
	var oContainer = document.getElementById(this.container_id);
	var oElem1 = document.getElementById(this.elem_name+""+this.current_elem1);
	var oElem2 = document.getElementById(this.elem_name+""+this.current_elem2);

	oContainer.filters[0].Apply();
    if (this.bTranState=='0')
	{
		this.bTranState = 1;
        oElem2.style.visibility="visible";
		oElem1.style.visibility="hidden";
	}
    else
	{
		this.bTranState = 0;
        oElem2.style.visibility="hidden";
		oElem1.style.visibility="visible";
	}
	oContainer.filters[0].Play();
}

function update()
{
	if(this.current_elem2 == this.total_elems)
	{
		this.current_elem1 = this.total_elems;
		this.current_elem2 = 1;
	}
	else if(this.current_elem1 == this.total_elems)
	{
		this.current_elem1 = 1;
		this.current_elem2 = 2;
	}
	else
	{
		this.current_elem1 = this.current_elem1 + 1;
		this.current_elem2 = this.current_elem1 + 1;
	}
	this.bTranState = 0;
}

function go_next_transition()
{
	transitions[current_transition].update();
	transitions[current_transition].fnToggle();
	if(current_transition == transitions.length-1)
		current_transition = 0;
	else
		current_transition++;
}

function init()
{
	window_interval_id = window.setInterval("go_next_transition()", 2000);
}


function home_transition(container_id, sElemName, total_elems)
{
	this.bTranState = 0;
	this.fnToggle = fnToggle;
	this.update = update;

	this.container_id = container_id;
	this.elem_name = sElemName;
	this.total_transitions = total_elems;
	this.total_elems = total_elems;
	this.current_elem1 = 0;
	this.current_elem2 = 1;

}

transitions = new Array();
transitions[2] = new home_transition('d_container', 'd_pic', 5);
transitions[1] = new home_transition('p_container', 'p_pic', 5);
transitions[0] = new home_transition('r_container', 'r_pic', 11);


