var PNav = function(obj) {
    var _src = obj.firstChild.src;
    var _cursor;
    var _newsrc;
    if (_src.indexOf('off') > -1) {
        _cursor = "pointer";
        _newsrc = obj.firstChild.src.replace(/off.gif/,'on.gif'); 
    } else {
        _cursor = "auto";
        _newsrc = obj.firstChild.src.replace(/on.gif/,'off.gif');  
    }
    obj.style.cursor = _cursor;
    obj.firstChild.src = _newsrc;
}

var chgImg = function(n,s) {
    document.images[n].src = s.src;
}

var that = 'no0';
var BrochureNav = function(n,s,t) {
    document.images[n].src = s;
    
    var oldObj = document.getElementById(that);
    oldObj.className = "No ab16";
    
    t.className = "No ab10";
    that = t.id;
}

var BrochureAdvance = function(dir) {
    var oldObj = document.getElementById(that);
    oldObj.className = "No ab16";
    var temp = that.substr(2,that.length);
    
    var newid;
    if (dir == "+") { 
        newid = 1 + (temp*1);
    } else if (dir == "-") { 
        newid = (temp*1)-1; 
    } else {
        newid = dir;
    }
    
    if (newid <= 0) { newid = imgs.length-1; }
    if (newid >= imgs.length) { newid = 0; }
    
    that = 'no'+newid;
    var newObj = document.getElementById(that);
    newObj.className = "No ab10";
    
    document.images['bImg'].src = '../i/slideshow/' + imgs[newid];
    var newTxt = (titles[newid] != "" && titles[newid] != " ") ? titles[newid] : "&nbsp;";
    document.getElementById('BrochureText').innerHTML = newTxt;
}

var SNavOver = function(lObj) {
    lObj.style.cursor = "pointer";
    lObj.style.textDecoration = "underline";
    lObj.style.color = "#000000";
}

var SNavOut = function(lObj) {
    lObj.style.cursor = "auto";
    lObj.style.textDecoration = "none";
    lObj.style.color = "#666666";
}

var TNavOver = function(lObj) {
    if (lObj.id == 'n'+LastYear) { return; }
    lObj.style.cursor = "pointer";
    lObj.style.color = "#000000";
}

var TNavOut = function(lObj) {
    if (lObj.id == 'n'+LastYear) { return; }
    lObj.style.cursor = "auto";
    lObj.style.color = "#999999";
}

var DBNavOver = function(lObj) {
    lObj.style.cursor = "pointer";
    lObj.style.color = "#000000";
}

var DBNavOut = function(lObj) {
    lObj.style.cursor = "auto";
    lObj.style.color = "#999999";
}

var MOut = function(obj) {		// resets cursor for simple mouseover
    if (obj) { obj.style.cursor = ''; }
}

var MOver = function(obj) {     // simple mouseover
    if (obj) { obj.style.cursor = 'pointer'; }
}

var MClick = function(url,target) {    // navigation for DIV/SPAN onlicks
    if (url == "") { return; }
    if (!target) {
        document.location = url;
    } else {
        window.open(url).focus();
    }
}

var NextImage = function(dir) {
    var url = './image.php?pid='+PageId+'&iid=';
    var nextIndex = OtherImage + dir;
    if (nextIndex < 0) { nextIndex = otherimages.length-1; }
    if (nextIndex >= otherimages.length ) { nextIndex = 0; }
    var nextImage = otherimages[nextIndex];
    document.location = url+nextImage;
}
