var unmark = 14;
var mark = -1;
var max = 0;
var isRunning = false;
var str = '';
var str2 = '';
var str3 = '';
var selected = '';

function select(id) {
    document.getElementById(id).className += " selected";
    document.getElementById(id).style.color = "#C7C7C7";
}

//function select(id) {
//    document.getElementById(id).style.backgroundImage = "url(stylesheets/header3.gif)";
//    document.getElementById(id).style.backgroundRepeat = "repeat-x";
//}

function cycleSetup(count, baseStr, picStr, thumbStr) {
    str = baseStr;
    str2 = picStr;
    str3 = thumbStr;
    max = count;
    unmark = count-2;

var id = '';
var half = count/2;
var px = '';

    for (i=0;i<count;i++) {
        id = str3.concat(i);
        px = ((i*60)+10).toString();
        px = px.concat('px');
        document.getElementById(id).style.left = px;
    }

    highlightCapabilities();

}

function highlightCapabilities() {
    isRunning = true;
    mark = (mark+1)%max;
    unmark = (unmark+1)%max;

    var highlight = str.concat(mark);
    var unhighlight = str.concat(unmark);
    var show = str2.concat(mark);
    var hide = str2.concat(unmark);
    var yes = str3.concat(mark);
    var no = str3.concat(unmark);

    document.getElementById(highlight).style.backgroundColor = "#01A5FF";
    document.getElementById(unhighlight).style.backgroundColor = "#EEE";
    var element = document.getElementById(show);
    $(element).fadeTo("slow", 1.0);
//    document.getElementById(show).style.display = "block";
    document.getElementById(hide).style.display = "none";
    document.getElementById(yes).style.backgroundColor = "#01A5FF";
    document.getElementById(no).style.backgroundColor = "#EEE";
    t=setTimeout("highlightCapabilities()",3500);
}

function Stop() {
    if(isRunning == true) {
        unhighlightAll();
        clearTimeout(t);
        unmark = max-2;
        mark = -1;
        isRunning = false;
    }
}

function Pause() {
    if(isRunning == true) {
        isRunning = false;
        clearTimeout(t);
    }
}

function Play() {
    if(isRunning == false) {
        isRunning = true;
        highlightCapabilities();
    }
}

function changePointer(id) {
    var point = str.concat(id);
    document.getElementById(point).style.cursor = "pointer";
}

function Selected(id) {
    clearTimeout(t);
    isRunning = false;

    var highlight = str.concat(id);
    var show = str2.concat(id);
    var yes = str3.concat(id);

    unhighlightAll();
    document.getElementById(highlight).style.backgroundColor = "#01A5FF";
    document.getElementById(show).style.display = "block";
    document.getElementById(yes).style.backgroundColor = "#01A5FF";

    mark = (id)%max;
    unmark = (mark-1)%max;
}

function unhighlightAll() {
    for(i=0; i<max; i++) {
        var unhighlight = str.concat(i);
        document.getElementById(unhighlight).style.backgroundColor = "#EEE";
        var no = str3.concat(i);
        document.getElementById(no).style.backgroundColor = "#EEE";
        var hide = str2.concat(i);
        document.getElementById(hide).style.display = "none";
    }
}

function changeMediaPointer(id) {
    document.getElementById(id).style.cursor = "pointer";
}

function jobSetup(cnt) {
    //var px = '';

//    px = ((cnt*50)+0).toString();
    //px = px.concat('px');

    //document.getElementById('job').style.height = px;
}
