var ns4 = document.layers;
var op5 = (navigator.userAgent.indexOf("Opera 5")!=-1) ||(navigator.userAgent.indexOf("Opera/5")!=-1);
var op6 = (navigator.userAgent.indexOf("Opera 6")!=-1) ||(navigator.userAgent.indexOf("Opera/6")!=-1);
var agt=navigator.userAgent.toLowerCase();
var mac = (agt.indexOf("mac")!=-1);
var ie = (agt.indexOf("msie") != -1);
var mac_ie = mac && ie;

function getStyleObject(objectId) {
    if(document.getElementById && document.getElementById(objectId))
        return document.getElementById(objectId).style;
    else if (document.all && document.all(objectId))
        return document.all(objectId).style;
    else if (document.layers && document.layers[objectId])
        return getObjNN4(document,objectId);
    else
        return false;
}

function moveSlider(direction){
    if((direction == -1 && this.imgSlider_slide_pos < this.imgSlider_slide_max - 1) || (direction == 1 && this.imgSlider_slide_pos > 0)){
        this.imgSlider_slide_pos += (direction * -1);
        clearTimeout(this.imgSlider_tId);

        if(direction == -1 && this.imgSlider_slide_pos == this.imgSlider_slide_max - 1)
            arrow_state('right-arrow', this.imgSlider_dis_alpha);
        if(direction == 1 && this.imgSlider_slide_pos == 0)
            arrow_state('left-arrow', this.imgSlider_dis_alpha);
        if(direction == 1 && this.imgSlider_slide_pos == this.imgSlider_slide_max - 2)
            arrow_state('right-arrow', 100);
        if(direction == -1 && this.imgSlider_slide_pos == 1)
            arrow_state('left-arrow', 100);

        slideIt(direction, -(this.imgSlider_slide_pos * this.imgSlider_slide_width) + this.imgSlider_offsetX);
    }
}

function arrow_state(strDiv, dblOpacity){
    var divStyle = getStyleObject(strDiv);
    divStyle.opacity      = (dblOpacity / 100);
    divStyle.MozOpacity   = (dblOpacity / 100);
    divStyle.KhtmlOpacity = (dblOpacity / 100);
    divStyle.filter       = "alpha(opacity=" + dblOpacity + ")";
    divStyle.cursor       = (dblOpacity == 100 ? "pointer" : "default");
}

function slideIt(direction, x_target){
    this.imgSlider_startX = x_target - (Math.floor(Math.abs(x_target - this.imgSlider_startX) / this.imgSlider_slower) * direction);
    moveXY('screenshots', this.imgSlider_startX, this.imgSlider_startY);
    if(this.imgSlider_startX != x_target)
        this.imgSlider_tId = setTimeout('slideIt(' + direction + ', ' + x_target + ')', this.imgSlider_speed);
}

function moveXY(myObject, x, y) {
    obj = getStyleObject(myObject)
    if (ns4) {
        obj.top = y;
        obj.left = x;
    }
    else {
        if (op5) {
            obj.pixelTop = y;
            obj.pixelLeft = x;
        }
        else {
            obj.top = y + 'px';
            obj.left = x + 'px';
        }
    }
}
