﻿var otlPageNo = -1;
var otlDataNext = 1;
var otlDataPrev = 0;
function getOTLVideos(res){
    gebid("otlPod_imgOTLImage").src = res.array[0].image.src;
    gebid("otlPod_imgOTLImage").onclick = function(){ eval(res.array[0].image.onClick); };
    gebid('otlPod_lblcounter').innerHTML = res.array[0].details.children[1].text;
    otlDataNext = parseInt(res.data.substr(2,1),10);
    otlDataPrev = parseInt(res.data.substr(0,1),10);
    
    if(otlDataNext == 1)
        gebid('otlPod_imgnext').src = 'images/pod/next_normal.gif';
    else
        gebid('otlPod_imgnext').src = 'images/pod/next_disabled.gif';
    if(otlDataPrev == 1)
        gebid('otlPod_imgprev').src = 'images/pod/previous_normal.gif';
    else 
        gebid('otlPod_imgprev').src ='images/pod/previous_disabled.gif';
};
function errorGet(res){
    logMesage('Video Callback error:'+res);
};
function getNextOTLVideo(){
    if(otlDataNext == 1){
        otlPageNo++;
        eval("Lynda.Web.P.M8([" + otlPageNo + ",1,0,0,0,0," + otlPageNo + "],getOTLVideos,errorGet);");
    }
};
function getPrevOTLVideo(){
    if(otlDataPrev == 1){
        otlPageNo--;
        eval("Lynda.Web.P.M8([" + otlPageNo + ",1,0,0,0,0," + otlPageNo + "],getOTLVideos,errorGet);");
    }
};
function handlePreviousPressOTLVideo(){
    if (document.images){
        if(otlDataPrev == 1)
            gebid('otlPod_imgprev').src="images/pod/back_down.gif";
     }
};
function handleNextPressOTLVideo(){
    if (document.images){
        if(otlDataNext == 1)
            gebid('otlPod_imgnext').src="images/pod/next_down.gif";
     }
};