function Link(layer, id, preImageOff, evalOnClick, label, alt , preImageOn, preImageSel, target, evalOnMouseOver, evalOnMouseOut,size){this.layer= layer;this.app= layer.app;if(!this.app.links[id]){this.id= id
this.type= LINK_TYPE
this.index= this.app.links.length;this.appObjectModelPath= APP_NAME + ".links[" + this.index + "]"
this.menu= null;this.page= this.layer.page;this.imgOff= (preImageOff.type==PREIMAGE_TYPE?preImageOff:this.app.preImages[preImageOff])
this.imgOn= (!preImageOn?null:(preImageOn.type==PREIMAGE_TYPE?preImageOn:this.app.preImages[preImageOn]))
this.imgSel= (!preImageSel?null:(preImageSel.type==PREIMAGE_TYPE?preImageSel:this.app.preImages[preImageSel]));this.size= (!size?this.imgOff.size.getCopy():size.getCopy());this.label= (!label?"":label);this.alt= (!alt?"":alt);this.selected= false;this.isMain= false;this.evalOnClick= (evalOnClick?evalOnClick:"");this.evalOnMouseOver= (evalOnMouseOver?evalOnMouseOver:"");this.evalOnMouseOut= (evalOnMouseOut?evalOnMouseOut:"");this.goTo= goTo;this.rollover= rollover
this.rollout= rollout
this.getHtml= getHtmlLink
this.getCopy= getCopyLink
this.changeLayer=changeLayerLink
this.page.assignPreImage(this.imgOff,this.imgOn,this.imgSel)
this.changeLayer()
this.app.links[this.app.links.length]= this.app.links[id]= this}else{this.app.links[id].changeLayer(layer)
return this.app.links[id]}
return this}
function getHtmlLink(){var rollingPart="onMouseOver='theApp.links[\"" + this.id + "\"].rollover()' onMouseOut='theApp.links[\"" + this.id + "\"].rollout()'";var tag= '<img name="link' + this.id + '" border="0" src="' + this.imgOff.path + '" height="' + this.size.height + '" width="' + this.size.width + '" alt="' + this.alt + '">';var hrefPart="<a href='javascript:window.focus();theApp.links[\"" + this.id + "\"].goTo()' ";tag= hrefPart + rollingPart + ">" + tag + "</a>";return tag}
function rollover(){this.app.iddle= false;if(this.label)this.app.useStatus(this.label);if(this.imgOn)eval(this.changeToImgOnCommand);if(this.evalOnMouseOver)eval(this.evalOnMouseOver)}
function rollout(){if(this.changeToImgOffCommand)
if(this.changeToImgSelCommand)
eval(this.selected?this.changeToImgSelCommand:this.changeToImgOffCommand);else
eval(this.changeToImgOffCommand);if(this.evalOnMouseOver)eval(this.evalOnMouseOut);this.app.useStatus("");this.app.iddle= true;return true}
function goTo(stage){if(this.menu)if(this.menu.menuSystem)this.menu.menuSystem.collapseMenu();if(this.target){var tmp= window.open(this.evalOnClick, target, "height=800,width=600")}else{if(this.evalOnClick)eval(this.evalOnClick)}}
function getCopyLink(newId, newLayer){return new Link((newLayer?newLayer:this.layer), newId, this.preImageOff, this.evalOnClick, this.label, this.alt, this.preImageOn, this.preImageSel, this.target, this.evalOnMouseOver, this.evalOnMouseOut,size)}
function changeLayerLink(layer){if(!layer){if(this.layer) layer= this.layer}else{this.layer= layer}
if(layer){this.changeToImgOffCommand= (ns4?"this.layer.layer.images.link":"document.all.link")+ this.id + ".src= this.imgOff.path"
this.changeToImgOnCommand= (this.imgOn?(ns4?"this.layer.layer.images.link":"document.all.link")+ this.id + ".src= this.imgOn.path":"")
this.changeToImgSelCommand= (this.imgSel?(ns4?"this.layer.layer.images.link":"document.all.link")+ this.id + ".src= this.imgSel.path":"")}}