
var timer
var currentPhoto = 0;
var photoCount;
var photoLinks = new Array();

function SetPath(ImgPath, Count) {
    photoCount = Count;
    photoLinks = ImgPath.split('@');
    //startphotoslideshow();
}

function nextphoto(fade) {
    currentPhoto++;
    if (currentPhoto == photoCount)
        currentPhoto = 0;
    var imgObj = getObjectByID("CommunityPhoto");
    if (fade) {
        imgObj.style.filter = "blendTrans(duration=2)";
        imgObj.style.filter = "blendTrans(duration=crossFadeDuration)";
        if (imgObj.filters)
            imgObj.filters.item(0).Apply();

    }
    imgObj.src = photoLinks[currentPhoto];
    if (fade) {
        if (imgObj.filters)
            imgObj.filters.item(0).Play();
    }
    
    
    
}

function startphotoslideshow() {
    //if (document.all.photoplay) {
        timer = window.setInterval("nextphoto(1)", 3000);
        //document.all.photoplay.href = "javascript:stopphotoslideshow()"
        //document.all.photoplayimg.src="images/btn_stop.gif"
        //document.all.photoplay.title="Stop"
    //}
}

function getObjectByID(id) {
    if (document.getElementById) {
        return document.getElementById(id);
    }
    else if (document.all) {
        return document.all[id];
    }
    else if (document.layers) {
        return document.layers[id];
    }
    else {
        return false;
    }
}

//change the opacity for different browsers 
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}