function fx_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}



/**
 * ---------------------------------------------------
 * Hashmap
 * This has the following methods:
 *     set(name, value) - sets a name / value pair
 *     get(name)        - gets the value for a name
 */
function HashMap() {
    this.i = 0;
    this.names = new Array();
    this.values = new Array();

    this.set = _hashmap_set;
    this.get = _hashmap_get;
}

function _hashmap_set(name, value) {
    // Reset existing first
    for(var j=0;j<this.i;j++) {
        if(this.names[j] == name) {
            this.values[j] = value;
            return;
        }
    }
    // Doesn't exist, so add new entry
    this.names[this.i] = name;
    this.values[this.i] = value;
    this.i++;
}

function _hashmap_get(name) {
    for(var j=0;j<this.i;j++) {
        if(this.names[j] == name) {
            return this.values[j];
        }
    }
    return null;
}
// --------------------------------------------------------

/**
 * --------------------------------------------------------
 * ImageHandler
 * This has the following methods:
 *     preload(ref, image_path)         - Preload an image
 *     load(target, ref, image_path)    - Load an image and set a target to it
 *     swap(image_name, ref)            - Swap the target image for a preloaded one
 *     fade(image_name, ref)            - Fade transition the target image for a preloaded one (IE5.5 up only)
 *
 *     setFade(fade_time)               - Set the Fade time in seconds
 *
 * Notes: If it can't fade, it will swap. if it can't swap, it won't do anything!
 */
function ImageHandler() {
    // Attributes
    this.map = new HashMap();
    this.agt = navigator.userAgent.toLowerCase();
    this.is_ie5 = (this.agt.indexOf("msie 5.0")!=-1);
    this.is_ie5_5 = (this.agt.indexOf("msie 5.5") !=-1);
    this.is_ie6 = (this.agt.indexOf("msie 6.")!=-1);
    this.fade_time = 1;

    this.preload = _imagehandler_preload;
    this.load = _imagehandler_load;
    this.swap = _imagehandler_swap;
    this.fade = _imagehandler_fade;
    this.setFade = _imagehandler_set_fade;
}

function _imagehandler_preload(name, src) {
    img = new Image();
    img.src = src;
    this.map.set(name, img);
}

function _imagehandler_load(target, to, src) {
    if(!this.map.get(to)) {
        this.preload(to, src);
    }
    this.swap(target, to);
}

function _imagehandler_swap(target, to) {
    if(document.images) {
        img = document.images[target];
        ref = this.map.get(to);
        if(img && ref) {
            img.src = ref.src;
        }
    }
}

function _imagehandler_fade(target, to) {
    if(document.images) {
        img = document.images[target];
        ref = this.map.get(to);
        if(img && ref) {
            if((this.is_ie5_5 || this.is_ie6) && img.style) {
                img.style.filter = "progid:DXImageTransform.Microsoft.Fade(overlap=1.00,duration="+this.fade_time+")";
                img.filters[0].apply();
                img.src = this.map.get(to).src;
                img.filters[0].play();
            }
            else {
                img.src = ref.src;
            }
        }
    }
}

function _imagehandler_set_fade(t) {
    this.fade_time = t;
}