$(init);

function init(){
	$("#anwsers p").hide();
	$("#anwsers li h3").click(animateEffect);
	//$("#anwsers li:first-child p").animate({opacity: 'toggle'},1000);		//First item start uncollapsed
	$("#eventNav ul li").click(showEvent);
	hideEvents();
	var dayName = "#day0";
	$(dayName).show();
	$(dayName).children().each(restore);
}

function animateEffect(){
	$("#anwsers p").hide();
	var elem = $(this).siblings();
	$(elem).each( showContent );
}

function showContent(){
	$(this).animate({opacity: 'toggle'},1000);
}

function showEvent(){
	var liContainer = $("#eventNav ul li");
	var index = $(liContainer).index(this);
	$("#smallTab").removeAttr("id");
	$(this).attr("id","smallTab");
	var id = "#day"+index;
	//add current tab to this
	hideEvents();
	if ( $(id) != null ){
		$(id).show();
		$(id).children().each(restore);
	}
	else{
		alert("Error occured during operations");
	}
	
}

function restore(){
		$(this).animate({opacity: 'toggle'},1000);
}

function hideEvents(){
	$(".oddEvent").hide();
	$(".evenEvent").hide();

}

