$( function() {
$(".blok:gt(0)").hide();
$("#mainMessage p:gt(0)").hide();

$("#mainMessage .text").cycle({ 
	fx:     'none', 
	timeout: 7000 ,
	cleartype: "false",
	cleartypeNoBg: "false",
	after: onAfter, 
	before: onBefore
 });
 
 $("#mainMessage .blocks").animate({opacity: '1.0'}, 2000).cycle({ 
	fx:     'none', 
	timeout: 7000 
 });
  function onBefore() { 
  	
    	$(".headings h2.active" ).animate({ backgroundColor: "#33CC33" }, 750).removeClass("active");
    	var num = $(this).attr("class");
    	$(".headings h2:eq("+num+")" ).animate({ backgroundColor: "#f00" }, 750).addClass("active");
    	$("#mainMessage .text p" ).hide();
} 
 function onAfter() { 
	$(this).show();
} 

$(".headings h2").hover(
function() {
	 $("#mainMessage .blocks").cycle("pause");
	 $("#mainMessage .text").cycle("pause");
	 
	 $(".headings h2.active" ).animate({ backgroundColor: "#33CC33" }, 250).removeClass("active");
	 $(this).animate({ backgroundColor: "#f00" }, 250).addClass("active");
	$("#mainMessage .text p").hide();	 
	 $("#mainMessage .text p."+$(".headings h2").index(this)).show();
	 $(".blok:visible").addClass("lastVis");
	 $(".blok:visible").hide();

	 $(".blok"+$(".headings h2").index(this) ).show();
},
function() {
	 $(".blok:visible").hide();
	 $(".lastVis").show().removeClass("lastVis");
	 $("#mainMessage .blocks").cycle("resume");
	 $("#mainMessage .text").cycle("resume");

}
);


});
