/*
 *  REDCODE.DE JavaScript - redcode-effects.js
 *  (C)opyright 2001-2005 REDCODE.DE. All Rights reserved.
 *  Visit us at http://www.redcode.de/          
 *  fecit tmh
 */


/** ChiliPepper: object for layer-handling */

var allChiliPeppers = new Array();

function showChiliPepper() {
    if (is.ns && is.v <= 4) this.chili.visibility = "show"
    else if (is.ie || is.ns5 || is.op) this.chili.visibility = "visible"
    return true;
}

function hideChiliPepper() {
    if (is.ns && is.v <= 4) this.chili.visibility = "hide"
    else if (is.ie || is.ns5 || is.op) this.chili.visibility = "hidden"
    return true;
}

function moveChiliPepper(x, y) {
    // Bei ns6 etc. evtl. "px" anhängen
    this.chiliX = x;
    this.chiliY = y;
    this.chili.left = x;
    this.chili.top = y;
}

function clipChiliPepper(t, r, b, l) {
    if (is.dom) {
        this.chili.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
    } else if (is.ns) {
        this.chili.clip.top = t;
        this.chili.clip.right = r;
        this.chili.clip.bottom = b;
        this.chili.clip.left = l;
    }
}

function showAllChiliPepper() {
    var chili;
    for (chili in allChiliPeppers) {
        allChiliPeppers[chili].show();
    }
    return true;
}

function hideAllChiliPepper() {
    var chili;
    for (chili in allChiliPeppers) {
        allChiliPeppers[chili].hide();
    }
    return true;
}

function clipAllChiliPepper(t, r, b, l) {
    var chili;
    for (chili in allChiliPeppers) {
        allChiliPeppers[chili].clip(t, r, b, l);
    }
    return true;
}


function ChiliPepper(id) {
    if (is.dom) this.chili = document.getElementById(id).style;
    else if (is.ns) this.chili = document.layers[id];
    else if (is.ie) this.chili = document.all[id].style;
    this.chiliX = parseInt(this.chili.left);
    this.chiliY = parseInt(this.chili.top);
    if (is.dom) this.pepper = document.getElementById(id);
    else if (is.ns) this.pepper = document.layers[id];
    else if (is.ie) this.pepper = document.all[id];
    this.pepperID = id;

    this.show = showChiliPepper;
    this.hide = hideChiliPepper;
    this.move = moveChiliPepper;
    this.clip = clipChiliPepper;
    this.showAll = showAllChiliPepper;
    this.hideAll = hideAllChiliPepper;
    this.clipAll = clipAllChiliPepper;

    allChiliPeppers[id] = this;
}



/** HotImage: object for image-handling */

var allHotImages = new Array();

function showHotImage(id) {
    if (this.cachedImage[id]) {
        this.hotImage.src = this.cachedImage[id].src;
        this.current = id;
    }
    return true;
}

function loadHotImage(id, src) {
    this.cachedImage[id] = new Image();
    this.cachedImage[id].src = src;
    return true;
}

function showAllHotImage(id) {
    var chili;
    for (chili in allHotImages) {
        allHotImages[chili].show(id);
    }
    return true;
}

function highHotImage() {   this.show("high");  return true;  }
function lowHotImage() {   this.show("low");  return true;  }

function HotImage(id, highsrc, layer) {
    // Zugriff über dom funktioniert nicht mit mozilla/ns5
    if (is.ns4 && layer) this.hotImage = document.layers[layer].document.images[id];
    else this.hotImage = document.images[id];

    this.cachedImage = new Array();

    this.high = highHotImage;
    this.low  = lowHotImage;
    this.load  = loadHotImage;
    this.show  = showHotImage;
    this.showAll  = showAllHotImage;

    this.current = "low";
    this.load("low", this.hotImage.src);
    if (highsrc) this.load("high", highsrc);

    allHotImages[id] = this;
}


/*
##############################
#   effects-javascript----   #
#   Version: 2               #
#   License Upd.: 01/12:03   #
#   License ID: redcode002   #
#   xCdaSO-99ai8zH5600suI2   #
##############################
*/
