


function newsToggleActivate () {
	$slides = $('.csc-frame-invisible');
	$slides.wrapAll('<div class="newsSlide" />');
	$container = $('.newsSlide');
	$headers=$container.find('h1');
	$headers.each(function (i) {
		$(this).css('margin-top',-$(this).outerHeight());
		//alert (this);
	});	
}






$.fn.fader = function() {
    
    return this.each(function() {
    
        var $container = jQuery(this);
        var $images = $container.find('.csc-frame-invisible');


        var $first_image = $images.filter(":first");
        
        $images.filter(":not(:first)").hide();
        
        $container.height($first_image.height());
        $container.width($first_image.width());
        
        $images.css("position", "absolute");

        
        $images.filter(":not(:last)").each(function(index) {
            $(this).data("next", index + 1);
        });
        $images.filter(":last").data("next", 0);
        
        function fade_image() {
        
            var $current_image;
            var next_id;
            var $next_image;
            
            $current_image = $images.filter(":visible");
            next_id = $current_image.data("next");
            $next_image = $images.filter(":eq(" + next_id + ")");
            
            $current_image.fadeOut(250);
			
            $next_image.delay(250).fadeIn(250);
        }
        
        window.setInterval(fade_image, 6000);
    });

}











$(document).ready(function() {
	newsToggleActivate();
	$('.newsSlide').fader();
	$('#rightCol').find('input:checkbox').first().attr('checked','1');
});





	
	




