
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?',
	    'Find out how!',
	    '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?',
	    'Click here to view open courses',
	    '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',
	    'Fall 2009 (slide show)',
	    'Posted by Denise Hernandez.'
	),
	new Ad(
	    '',
	    '',
            '/morenovalley/files/RCCMorenoValleyNewsletter09.pdf',
	     'Fall 2009 Moreno Valley Campus Community Report Available',
	    'Fall 2009 MV Community Report',
	    ''
	)
);

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);
	
});
