var dataArr=[
{
    'list':[
        {
            'headingName':'Hair Styling L1',
            'link':'certificate.html',
            'imgName':'certified.png'
        },{
            'headingName':'Hair Styling L2',
            'link':'referrence.html',
            'imgName':'referred.png'
        },{
            'headingName':'Waxing',
            'link':'selfDeclared.html',
            'imgName':'self_declared.png'
        },{
            'headingName':'Threading',
            'link':'certificate.html',
            'imgName':'certified.png'
        }
    ]
},{
    'list':[
        {
            'headingName':'Hair Styling L3',
            'link':'certificate.html',
            'imgName':'certified.png'
        },{
            'headingName':'Hair Styling L4',
            'link':'referrence.html',
            'imgName':'referred.png'
        },{
            'headingName':'Waxing1',
            'link':'card.html',
            'imgName':'self_declared.png'
        },{
            'headingName':'Threading2',
            'link':'certificate.html',
            'imgName':'certified.png'
        }
    ]
}
   
];

var next=0,prev=0;
function nextPage(element)		//display story pages , calls on onclick of pre & next button
{
	if(element=="prev" && next>0)			//if prev button clicked
	{
		var cloneCover1=$('.cover1').clone().addClass('remove');
        $('#cover2').append(cloneCover1);
       
		cloneCover1.css({'position':'absolute','z-index':1});
		//$('.cover1').addClass('prevturn page');
		next--;
        placeThings(1000,0,0);
        $(cloneCover1).addClass('prev page');
		setTimeout(function(){  
			$('.remove').addClass('prevturn page');
			setTimeout(() => {
				$('.remove').remove();	
			}, 510);
		},500)
	}		
	else if(element=="next" && next<dataArr.length-1)
	{
        next++;
		var cloneCover2=$('.cover1').clone().addClass('remove');
		$('#cover2').append(cloneCover2);
		cloneCover2.css({'position':'absolute','z-index':1});
	//	$('.cover2').addClass('nextturn page');
		placeThings(0,1000,next);
	
		setTimeout(function(){
			$('.remove').addClass('nextturn page');
			setTimeout(() => {
				$('.remove').remove();	
			}, 510);			
		},500)
	} 	
}

function placeThings(textTimeout,imgTimeout,cnt)
{
	$('.cover1').removeClass('prevturn nextturn page')
	var divEle,heading,imgDiv,img;
	
    setTimeout(() => {
        document.getElementById("imgContainer").innerHTML="";
        for(var i=0;i<4;i++)
        {
            divEle= document.createElement("div");
            divEle.setAttribute("class","skill_info  col-lg-6 col-md-6 col-xs-6 col-sm-6");
            divEle.setAttribute("id","div"+(i+1));

            heading= document.createElement("h3");
            heading.setAttribute("class","skill_name text-center");
            heading.innerHTML=dataArr[cnt].list[i].headingName;
            divEle.append(heading);

            imgDiv=document.createElement('div');
            imgDiv.setAttribute('class','certified_container col-lg-8 col-md-8 col-xs-8 col-sm-8 col-lg-offset-2 col-md-offset-2 col-xs-offset-2 col-sm-offset-2');

            a=document.createElement('a');
            a.setAttribute('target','_self');
            a.setAttribute('href',dataArr[cnt].list[i].link);
            imgDiv.append(a);

            img=document.createElement('img');
            img.setAttribute('class','text-center img-responsive');
            img.setAttribute('src',dataArr[cnt].list[i].imgName);
            a.append(img);
            divEle.append(imgDiv);
            
            document.getElementById("imgContainer").appendChild(divEle);
        }	
    }, textTimeout);
 }
var url='https://devgamerepo.prathamopenschool.org/Game/Demo/SkillsPortal/index.html';
function whatsappShare_click(msg) {
    window.open('https://api.whatsapp.com/send?text='+'Greetings - '+msg+'   Link-'+encodeURIComponent(url))
}

 function fbShare_click() {
   // u = "https://prathamopenschool.org/";
    // t=document.title;
    t = $('hello').text();
    window.open('http://www.facebook.com/sharer.php?u=' + encodeURI(url) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436'); return false;
}
function twitterShare_click() {
   // u = url;
    // t=document.title;
    var text = $('hello').text();
    window.open('http://twitter.com/share?url=' + encodeURIComponent(url) + '&text=' + encodeURIComponent(text), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0'); return false;
}