function slideSwitch() {
    var $active = jQuery('DIV.rotatingSponsors A.active');

    if ( $active.length == 0 ) $active = jQuery('DIV.rotatingSponsors A:last');

    var $next =  $active.next().length ? $active.next()
        : jQuery('DIV.rotatingSponsors A:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

jQuery(function() {
    setInterval( "slideSwitch()", 5000 );
});


function swapNGContents(obj){
		var ngitem = obj;
		//set id of link
		ngitem.id = 'currentNGitem';
		//set id of parent div
		jQuery('#currentNGitem').parent().attr('id','curparent');
		//store image src in variable
		var currentimg = jQuery('#currentNGitem IMG').attr('src');
		//set #curNGImg src
		jQuery('#imgWindow #curNGImg').attr('src', currentimg);		
		//alert the img src
		//alert (currentimg);

		//alert the contents of the parent div
		//alert($('#curparent').html());
		//store the contents of the teaser paragraph in variable
		var teaser = jQuery('#curparent p.teaser').html() + '...<a href="' + jQuery('#curparent h1 a').attr('href') + '">more</a>';
		//set the contents of # to the teaser variable
		jQuery('#newsGallery #teaser').html(teaser);
		
		//dump variables and remove id attributes
		teaser = null;
		currentimg = null;
		jQuery('#curparent').attr('id', '');
		jQuery('#currentNGitem').attr('id' , '');
		ngitem = null;
}

jQuery(function(){
	jQuery('#imgWindow #curNGImg').attr('src' , (jQuery('#newsGallery #items .mNews a.swaper img').eq(0).attr('src')));
	var teaser = jQuery('#newsGallery #items .mNews p.teaser').eq(0).html() + '...<a href="' + jQuery('#newsGallery #items .mNews h1 a').eq(0).attr('href') + '">more</a>';
	jQuery('#newsGallery #teaser').html(teaser);
})
