/**************************************************
Trivantis (http://www.trivantis.com)

This JavaScript code uses techniques found at
The Dynamic Duo - http://www.dansteinman.com/dynduo/
**************************************************/

// StaticImage Object
function StaticImage(name,imgName,altName,x,y,width,height,visible,zorder) {
    this.name = name
    this.altName = altName
    this.x = x
    this.y = y
    this.w = width
    this.h = height
    if( visible ) 
        this.v = (is.ns4)? "show" : "visible"
    else
        this.v = (is.ns4)? "hide" : "hidden"
    this.z = zorder
    this.obj = this.name+"Object"
    this.hrefPrompt = 'javascript:;'
    eval(this.obj+"=this")
    this.preload(this.obj+".img",imgName)
}

function StaticImageActionGoTo( destURL, destFrame ) {
    this.lyr.actionGoTo( destURL, destFrame );
}
function StaticImageActionPlay( ) {
    this.lyr.actionPlay();
}
function StaticImageActionStop( ) {
    this.lyr.actionStop();
}
function StaticImageActionShow( ) {
    this.lyr.actionShow();
}
function StaticImageActionHide( ) {
    this.lyr.actionHide();
}
function StaticImageActionLaunch( ) {
    this.lyr.actionLaunch();
}
function StaticImageActionExit( ) {
    this.lyr.actionExit();
}
function StaticImageActionChangeContents( newImage ) {
    this.lyr.doc.images[this.name+"Img"].src = newImage
}
function StaticImageActionTogglePlay( ) {
    this.lyr.actionTogglePlay();
}
function StaticImageActionToggleShow( ) {
    this.lyr.actionToggleShow();
}
StaticImage.prototype.preload = StaticImagePreload
StaticImage.prototype.build = StaticImageBuild
StaticImage.prototype.activate = StaticImageActivate
StaticImage.prototype.change = StaticImageChange
StaticImage.prototype.down = StaticImageDown
StaticImage.prototype.over = StaticImageOver
StaticImage.prototype.out = StaticImageOut
StaticImage.prototype.capture = 0
StaticImage.prototype.onOver = new Function()
StaticImage.prototype.onOut = new Function()
StaticImage.prototype.onSelect = new Function()
StaticImage.prototype.onDown = new Function()
StaticImage.prototype.actionGoTo = StaticImageActionGoTo
StaticImage.prototype.actionPlay = StaticImageActionPlay
StaticImage.prototype.actionStop = StaticImageActionStop
StaticImage.prototype.actionShow = StaticImageActionShow
StaticImage.prototype.actionHide = StaticImageActionHide
StaticImage.prototype.actionLaunch = StaticImageActionLaunch
StaticImage.prototype.actionExit = StaticImageActionExit
StaticImage.prototype.actionChangeContents = StaticImageActionChangeContents
StaticImage.prototype.actionTogglePlay = StaticImageActionTogglePlay
StaticImage.prototype.actionToggleShow = StaticImageActionToggleShow
StaticImage.prototype.writeLayer = StaticImageWriteLayer

function StaticImagePreload(imgObj,imgSrc) {
    if (imgSrc) {
        eval(imgObj+' = new Image()')
        eval(imgObj+'.src = "'+imgSrc+'"')
        eval(imgObj+'s = true')
    }
    else eval(imgObj+'s = false')
}
function StaticImageBuild() {
    this.css = css(this.name,this.x,this.y,this.w,this.h,this.v,this.z)

    var divStart
    var divEnd
    if( is.ns4 )
    {
        divStart = '<div id="'+this.name+'"><a name="'+this.name+'">'
        divEnd   = '</a></div>'
    }
    else
    {
        divStart = '<div id="'+this.name+'">'
        divEnd   = '</div>'
    }
    
    
    if( this.capture & 4 && is.ns4 ){
        divStart = divStart + '<A HREF="' +this.hrefPrompt+'">'
        divEnd   = '</A>' + divEnd 
    }

    this.div = divStart + '<img name="'+this.name+'Img" src="'+this.img.src
    if( this.altName )
        this.div += '" alt="['+this.altName+']'
    this.div += '" width='+this.w+' height='+this.h

    if( this.capture & 4 && !is.ns4 )
        this.div += ' style="cursor:hand"'
        
    this.div += ' border=0>'+divEnd+'\n'
}
function StaticImageActivate() {
    this.lyr = new DynLayer(this.name)
    if( this.lyr && this.lyr.css )
        this.lyr.css.visibility = this.v

    if( this.capture & 4 ) {
        if (is.ns4) this.lyr.elm.captureEvents(Event.MOUSEDOWN)
        this.lyr.elm.onmousedown = new Function(this.obj+".down(); return false;")
    }
    if( this.capture & 1 )
        this.lyr.elm.onmouseover = new Function(this.obj+".over(); return false;")
    if( this.capture & 2 )
        this.lyr.elm.onmouseout = new Function(this.obj+".out(); return false;")
}
function StaticImageChange(img) {
    this.lyr.doc.images[this.name+"Img"].src = img.src
}
function StaticImageDown() {
    this.onSelect()
    this.onDown()
}
function StaticImageOver() {
    this.onOver()
}
function StaticImageOut() {
    this.onOut()
}
function StaticImageWriteLayer( newContents ) {
    this.lyr.write( newContents )
}

