
var audioPage=0;
var audioTitle = new Array();
audioTitle[0] = "Audio One";
audioTitle[1] = "Audio Two";
audioTitle[2] = "Audio 3";
audioTitle[3] = "Audio Four";
audioTitle[4] = "Audio Five";
audioTitle[5] = "Audio Six";
var audioFile = new Array();
audioFile[0] = "covenants.wma";
audioFile[1] = "edom.wma";
audioFile[2] = "edom.wma";
audioFile[3] = "edom.wma";
audioFile[4] = "edom.wma";
audioFile[5] = "edom.wma";
var audioText = new Array();
audioText[0] = "This is a test of the longer text description of the audio link.";
audioText[1] = "This is another test of the longer text.";
audioText[2] = "This is a test of the longer text description of the audio link.";
audioText[3] = "This is a test of the longer text description of the audio link.";
audioText[4] = "This is a test of the longer text description of the audio link.";
audioText[5] = "This is a test of the longer text description of the audio link.";


init();

function init(){
    // alert('in init');
    audioPage=1;
    showAudioTitle();
}

    
function showAudioTitle(){
    // alert('in showAudioTitle');
    var j=(audioPage*3)-3;
    for (i=1;i<4;i++) {    

        $("#audio_"+i).fadeOut(100);
        html='<span id="audio_descrip'+i+'" class="audioContents">'+audioTitle[j]+'</span>'+
        '<div id="audio_text'+i+'" class="audioText">'+audioText[j]+'</div>'+
        '<div><a id="playaudio'+i+'" href="'+audioFile[j]+'"'+' target="new"><img src="playbutton.png"></a></div>';
        $("#audio_"+i).html(html);
        $("#audio_"+i).fadeIn();
        
        j++;
    }        
}

function getMaxPage(){
    var maxPage=Math.ceil(audioTitle.length/3);
    return maxPage;
}


function nextPageAudio(){
    var maxPage=getMaxPage();
    audioPage=audioPage+1;
    if (audioPage>maxPage)
        audioPage=maxPage;
    showAudioTitle();
}

function prevPageAudio(){
    audioPage=audioPage-1;
    if (audioPage<1)
        audioPage=1;
    showAudioTitle();
}
