var ads = null;
var currentIndex = null;
/**
* �L��������
*/
function adsInit(adsId) {
    // �����̍L����܂ލL���g
    var obj = $(adsId);
    
    if (obj) {
        // �N���X�� ad �ōL���I�u�W�F�N�g���
        ads = obj.getElementsByClassName("ad");
        
        // �ŏ��̃o�i�[�ȊO��B��
        for (i=1; i<ads.length; i++) {
            ads[i].hide();
        }
        currentIndex = 0;
    }
    
    // �L���g��\���i��\���N���X���j
    obj.className = "";
}
/**
* ���[�e�[�V����������
*/
function rotationInit() {
    setInterval(rotation, 7000);
}
/**
* ���[�e�[�V����
*/
function rotation() {
    // �\�����̍L����B��
    ads[currentIndex].hide();
    
    currentIndex++;
    if (currentIndex >= ads.length) {
        currentIndex = 0;
    }
    
    // ���̍L����\��
    ads[currentIndex].show();
}
/**
* �y�[�W������
*/
function pageInit() {
    adsInit("ads");
    rotationInit();
}
Event.observe(window, "load", pageInit);
