﻿function togglePage(pid,nid,np,p) {
    for (var i = 1; i <= np; i++) {
        var disp = (i == p) ? "" : "none";
        var bg = (i == p) ? "#cccccc" : "#eaeaea";
        document.getElementById(pid + i).style.display = disp;
        document.getElementById(nid + i).style.background = bg;
    }
}

function openSlideShow(imgFolder, imgCount, audioFile)
{
    var url = '/Data/Sites/1/Apps/SlideShow/slideshow.htm?path=' + imgFolder + '&cnt=' + imgCount + '&au=' + audioFile;
    openWindow(url,670,590);
}


function openWindow(url, width, height)
{
    window.open(url,'','location=0,status=0,scrollbars=0,resizable=1,scrollbars=1,width=' + width + ',height=' + height);
}

function confirmItemAction(action) {
    var ret = confirm('Are you sure you want to ' + action + ' this item?');
    return ret;
}

function toggleObj(objId, disp) {
    var obj = document.getElementById(objId);
    if (obj != null) {
        obj.style.display = disp;
    }
}

function onYouTubePlayerReady(playerId) {
    ytplayer = document.getElementById("myytplayer1");
}

function loadNewVideo(playerCount, id, startSeconds) {
    ytplayer = document.getElementById("myytplayer" + playerCount);
    if (ytplayer) {
        ytplayer.loadVideoById(id, parseInt(startSeconds));
    }
}