var AudioSync={};
window.onload=function()
{
    AudioSync.createMenuDivs();
    $("[data-tt=tooltip]").tooltip({ trigger: "hover" });
}
AudioSync.createMenuDivs=function()
{
    var mainDiv,pageDiv,iconDiv,icon,storyName,storyCover,imgCnt=0;
    for(var j=0;j<Math.ceil(AudioSync.storyData[0].storyList.length/5);j++)
    {
        mainDiv=document.createElement('div');
        $(mainDiv).prop('class','mainDiv row mt-5');
        $(".menuPage").append(mainDiv)
        for(var k=0;k<5;k++)
        {
            if (imgCnt < AudioSync.storyData[0].storyList.length) {
                pageDiv=document.createElement('div');
                $(pageDiv).prop('class','pageClass col-2');
                pageDiv.setAttribute('data-tt','tooltip');
                pageDiv.setAttribute('data-placement','top');
                $(pageDiv).prop('title',AudioSync.storyData[0].storyList[imgCnt].languageTitle);
                mainDiv.append(pageDiv);

                iconDiv=document.createElement('div');
                $(iconDiv).prop('class','iconDiv');
                pageDiv.append(iconDiv);
                for(var p=0;p<1;p++)
                {
                    icon=document.createElement('span');
                    icon.setAttribute('data-tt','tooltip');
                    icon.setAttribute('data-placement','bottom');
                    if(p==0)
                    {
                        $(icon).prop('class','fa fa-edit iconOptn');
                       
                       // icon.setAttribute('data-toggle','modal');
                        //icon.setAttribute('data-target','#editModal');
                         $(icon).prop('title','Edit Story');
                        /* $(icon).click(function(){
                            AudioSync.showSteps();
                        }) */
                    }
                    /* else
                    {
                        $(icon).prop('class','fa fa-trash iconOptn deleteIcon');
                        $(icon).prop('title','Delete This Story');
                       icon.setAttribute('data-toggle','modal');
                       icon.setAttribute('data-target','#confirmModal');
                        $(icon).click(function(){
                            confirmModalFun(this);
                        })
                    } */    
                    iconDiv.append(icon);
                }
                storyName=document.createElement('div');
                $(storyName).prop('class','storyNames noPadding my-2 col-10');
                $(storyName).text(AudioSync.storyData[0].storyList[imgCnt].languageTitle);
                pageDiv.append(storyName);

                storyCover=document.createElement('img');
                $(storyCover).prop('class',' col-12');
                $(storyCover).prop('src','image/'+AudioSync.storyData[0].storyList[imgCnt].icon);
                pageDiv.append(storyCover);
                imgCnt++;
               }
            }
 
    }
}
AudioSync.showSteps=function()
{
   // alert('g')
}
