// JavaScript Document

// JavaScript Document

var text = new Array();
var totalCells = 0;
num1 = 0;
num2 = 2;

function getText() {
	$("#ads p").each(function(i) {
		text[i] = $(this).html();
		totalCells = i + 1;
	});	
}

function fadeIn() {
	$("#ads p").css("opacity","0");
	$("#ads p").show();
	
	if(num2<=totalCells) {
		for(i=0; i<2; i++) {
			$("#ads p").eq(i).html(text[i + num1]);
			$("#ads p").eq(i).animate({opacity: 1}, (i+1)*2000);
		}
		num1 = num1 + 2;
		num2 = num2 + 2;
	}
	else {
		num1 = 0;
		num2 = 2;				
		for(i=0; i<2; i++) {
			$("#ads p").eq(i).html(text[i + num1]);
			$("#ads p").eq(i).animate({opacity: 1}, (i+1)*2000);
		}
		num1 = num1 + 2;
		num2 = num2 + 2;
	}
	setTimeout("fadeOut()", 7000);
}

function fadeOut() {
	$("#ads p").animate({opacity: 0}, 3000);	
}


$(document).ready(function(e) {
	getText();
	fadeIn();
	setInterval("fadeIn()", 10 * 1000);
});








/*
$(document).ready(function(e) {
	$(".contentpaneopen_newsFlash > tr").children().eq(0).css("opacity","0");	
	$(".contentpaneopen_newsFlash > tr").children().eq(0).show();
	$(".contentpaneopen_newsFlash > tr").children().eq(0).animate({
		opacity: 1										
	}, 2000 );
	alert($("#upcomingEvents p").eq(0).text());
});
*/



/*
$(document).ready(function(e) {
	$("#upcomingEvents p").css("opacity","0");
	$("#upcomingEvents p").show();
	$("#upcomingEvents p").each(function(i) {
		$(this).animate({opacity: 1}, 2000);
	});
	
});
*/

/*function moveUp() {
	$("#leftSidebar table").eq(0).animate({
		marginTop: "-300px" 
	}, 3000, resetMove);	
}

function resetMove() {
	$("#leftSidebar table").eq(0).css("margin-top","0px");	
}

$(document).ready(function(e) {
	if( $("#current span").text()=="Home" ) {
		$("#leftSidebar table").css("opacity","0");
		$("#leftSidebar table").css("margin-top","300px");
		$("#leftSidebar table").show();
		$("#leftSidebar table").animate({opacity: 1, marginTop: "0px"}, 2000);
		
		$("#front_image").css("margin-top","-100px");
		$("#front_image").eq(0).animate({
			marginTop: "0px" 
		}, 2000 );
	}	
});*/












