function Dpl(id, id2){
	var e = document.getElementById(id);
	var e2 = document.getElementById(id2);
	if (e.style.display == 'block'){
		e.style.display = 'none';
	}else{
		e.style.display = 'block';
		e2.style.display = 'none';
	}
}

function intObject() {
    this.i;
    return this;
}

function ChangeOpacity(id, color){
	var obj = document.getElementById(id);
	obj.style.filter = 'alpha(opacity='+color+')';
	obj.style.opacity = color /100;
	obj.style.MozOpacity = color /100;
	obj.style.KHTMLOpacity = color /100;
}


function aparecer(id){
	var color = 0;
	var sum = 10;
	var time = 100;
	var obj = document.getElementById(id);
	obj.style.display = "block";
	while (!(color>=110)){
		color += sum;
		window.setTimeout ("ChangeOpacity('"+id+"', "+color+");", time);
		time += 100;
	}
}

function HideDiv(id){
	var obj = document.getElementById(id);
	obj.style.display = "none";
}

function desvanecer(id) {
	var color = 110;
	var sum = 10;
	var time = 100;
	while (!(color <=-10)){
		color -= sum;
		window.setTimeout ("ChangeOpacity('"+id+"', "+color+");", time);
		time += 100;
	}
	
	window.setTimeout ("HideDiv('"+id+"');", time);
	return time;
}
	
function Dpl2(id){
	var e = document.getElementById(id);
	if (e.style.display == 'none'){
		aparecer(id);
	}else{
		desvanecer(id);
	}
}
/* widgets
Stats
TopUsers
RecentPolls
TagCloud
PopularPolls
LatestPollsVoted

RandomPolls
UnactivePolls
*/




function Rotate(num){
	/*var WidgetsLeft = new Array();
	var WidgetsCenter = new Array();
	var WidgetsRight = new Array();
	
	WidgetsLeft[0] = 'Stats';
	WidgetsLeft[1] = 'TopUsers';
	WidgetsLeft[2] = 'RecentPolls';
	
	WidgetsCenter[0] = 'TagCloud';
	
	WidgetsRight[0] = 'PopularPolls';
	WidgetsRight[1] = 'LatestPollsVoted';
	WidgetsRight[2] = 'RandomPolls';
	UnactivePolls*/

	if (num % 2 == 0){
		if (num > 100)
			num = 0;
		window.setTimeout ("changeContent('TopUsers', 'Stats');", 6000);

	}else{
		window.setTimeout ("changeContent('Stats','TopUsers');", 6000);
	}
	
	if (num % 3 == 0){
		window.setTimeout ("changeContent('RandomPolls', 'UnactivePolls');", 4000);
	}else if(num % 3 == 1){
		window.setTimeout ("changeContent('UnactivePolls', 'LatestPollsVoted');", 4000);
	}else{
		window.setTimeout ("changeContent('LatestPollsVoted', 'RandomPolls');", 4000);
	}
	
	num += 1;
	window.setTimeout ("Rotate("+num+");", 10000);
	
}

function changeContent(id1, id2){
	var time = desvanecer(id1);
	window.setTimeout ("aparecer('"+id2+"');", time);
}

function initIndex(){
	aparecer('TopUsers');
	aparecer('RecentPolls');
	aparecer('TagCloud');
	aparecer('PopularPolls');
	aparecer('RandomPolls');

	window.setTimeout ("Rotate(0);", 0);
}

function initUser(){
	aparecer('StatsUser');
	aparecer('RecentPolls');
	aparecer('TagCloudUser');
	aparecer('PopularPolls');
	aparecer('RandomPolls');

	//window.setTimeout ("Rotate(0);", 3000);
}

