
running = true;

function Ad(
			imgSrc,
			altTxt,
			lnkHref,
			adTitle,
			adText,
			postedBy
			){
  this.ImageSrc = imgSrc;
  this.AltText = altTxt;
  this.LinkHref = lnkHref;	
  this.AdTitle = adTitle;
  this.AdText = adText;
  this.PostedBy = postedBy;			
}

<!-- aD6 cODE -->
var additionalSlotAds = new Array(
	new Ad(
	    'images/movalgameartbutton.gif',
        'Ever dreamed of getting a degree in Gaming?',
        'http://academic.rcc.edu/movalgaming/',
	    'Ever dreamed of getting a degree in Gaming?',
	    '',
	    'Posted by Denise Hernandez.'	
        ),
	new Ad(
	    'images/opencourseD.jpg',
	    'Still looking to add a class?',
        '/programs/open_courses.cfm',
        'Still looking to add a class?',
	    '',
	    'Posted by Denise Hernandez.'
	),
	new Ad(
	    '/district/images/SwineFlu.jpg',
	    'Swine Flu Information',
        '/district/files/QuickFactsH1N1Flu.pdf',
        'Swine Flu Information',
	    '',
	    'Posted by Denise Hernandez.'
	),

/*	new Ad(
	    'images/fall2009_slideshow.jpg',
	    'First Day of Classes at RCCD',
        '/district/fall2009/index.cfm',
        'First Day of Classes at RCCD',
	    '',
	    'Posted by Denise Hernandez.'
	),*/

/*	new Ad(
	    'images/comm_rpt.gif',
	    'MVC Community Report',
        '/morenovalley/files/RCCMorenoValleyNewsletter09.pdf',
        'Fall 2009 Moreno Valley Campus Community Report Available',
	    '',
	    'Posted by Denise Hernandez.'
	),*/

	new Ad(
	    'images/legacyroundtable.gif',
	    'Scholarship Opportunity!',
        '/morenovalley/files/LegacyRoundTable.pdf',
	    'Legacy Round Table:  Summer 2010 Scholarship!',
	    '',
	    'Posted by Webmaster.'
	),
	new Ad(
	    'images/bhm.gif',
	    'Black History Month',
        '/morenovalley/files/BHM_2010.pdf',
	    'Black History Month Activities at the Moreno Valley Campus',
	    '',
	    'Posted by Webmaster.'
	),
	new Ad(
	    'images/scholarship.gif',
	    'Scholarship Opportunity!',
        '/morenovalley/files/DSPS_Scholarship_Flyer.pdf',
	    'The Molly Adams Scholarship Fund at the Community Foundation Serving Riverside and San Bernardino Counties.  Due 3/3 at 5pm',
	    '',
	    'Posted by Webmaster.'
	),
	new Ad(
	    'images/job.jpg',
	    'Career/Job Fair',
        '/morenovalley/files/JobFair_Spring2010.pdf',
	    'Annual Spring 2010 Career/Job Fair on March 11 @ 10:00 am',
	    '',
	    'Posted by Webmaster.'
	)
);

var stat6 = 0;	

function nextAd(status){
  var totalAds = additionalSlotAds.length;
  var rval = status;
  if(totalAds>0 && status+1<totalAds){
       rval++;
  }else if(status+1>totalAds){
       
       rval=0;
  }
  return rval;

}

function preAd(status){
  var totalAds = additionalSlotAds.length;
  var rval = status;
  if(totalAds>0 && status+1>=totalAds){
       rval--;
  }else if(status-1<totalAds){
       rval=totalAds ;
  }
  return rval;
}
	
function rotateAds(status){
	
//if(running){   
    var index = status; 
    $('div#AdContent').unbind();
    $('div#AdContent').one("click",function() {
	window.open(additionalSlotAds[status].LinkHref);
        return false;
    });
	if(additionalSlotAds[status].ImageSrc=='')
   {
	  // $('img#Ad').hide();
	  // $('img#Ad').attr('width','0px');
   }else
   {
	  // $('img#Ad').show();
	 //  $('img#Ad').attr('width','160px');
   }
    $('img#Ad').attr("src",additionalSlotAds[status].ImageSrc);
    $('img#Ad').attr("alt",additionalSlotAds[status].AltText);
   
    $('h4.AdTitle').html(additionalSlotAds[status].AdTitle);
    $('p.AdDesc').html(additionalSlotAds[status].AdText);
    $('small.AdPostedBy').html(additionalSlotAds[status].PostedBy);
    $('div.nextup').html('&diams;'+additionalSlotAds[nextAd(status)].AdText);
    $('li.counter').html((index+1)+'/'+additionalSlotAds.length);
$('a.flipperBack').attr('href','');    
$('a.flipperBack').click(function(){
		rotateAds(preAd(status));
                return true;
    });
    
    $('a.flipperNext').click(function(){
		rotateAds(nextAd(status));
                return true;
    });
    	
    
    if(status == additionalSlotAds.length-1){stat6=0;}else{stat6++;}
	
    setTimeout('rotateAds(stat6)',3500);	
//}	
}



$(document).ready(function() {
	//init();
        
	setTimeout('rotateAds(stat6)',0);
	
});

