timer = null;
index = 0;
//numOfAds = $('#r1 #r1c1 div[id^=ad]').size();

function rotate() {


    if ( index < numOfAds ) {

	index++;

    } else {

	index = 1;

    }

    hideAll();
    $('#r1 #r1c1 #ad' + index).show();
    //alert('Showing: ' + index + ' of ' + numOfAds);
    timer = setTimeout('rotate()',10000);


}

function hideAll() {

    for ( var i = 1; i <= numOfAds; i++ ){

	$('#r1 #r1c1 #ad' + i).hide();

    }

}
