Code:
Hi

Can anybody help me? Ive been playing around with this for a while and I am shaw it is something very obvious but I cant spot it.
Basically I am trying to add a dynamic drive script for popups into my slideshow script.
The problem I think lies in the coding in the links array:

links[2] = "javascript:enlarge('pic/mag1.jpg',event)";

When I run it through the browser it gives an error message saying object expected.
What am I doing wrong?

<html>
<head>

<style type="text/css">

#showimage{
position:absolute;
visibility:hidden;
border: 1px solid gray;
}
#dragbar{
cursor:hand;
cursor: pointer;
background-color: #EFEFEF;
min-width: 100px; /*NS6 style to overcome bug*/

}
#dragbar #closetext{font-weight:bold;
font-size:14px;
font-family:Arial, Helvetica, sans-serif;
margin-right: 1px;
}
</style>

<script language="javascript" type="text/javascript">

var SlideShowSpeed = 3000;
var CrossFadeDuration = 2;
var picture = new Array(); 
var caption = new Array(); 
var links = new Array();
var ie=document.all
var ns6=document.getElementById&&!document.all

picture[0] = "pic/bcn2.jpg";
picture[1] = "pic/bcn1b.jpg";
picture[2] = "pic/bcn3.jpg";
picture[3] = "pic/bcn4.jpg";

caption[0] = "pic/btn1.gif";
caption[1] = "pic/btn2.gif";
caption[2] = "pic/btn3.gif";
caption[3] = "pic/btn4.gif";

links[0] = "";
links[1] = "javascript:doImagePopUp1()";
links[2] = "javascript:enlarge('pic/mag1.jpg',event)";
links[3] = "http://www.google.com";

count=0
preload= new Array()
for(i =0 ; i < picture.length; i++){
preload[i] = new Image();
preload[i].src = picture[i];
}

function control(how){
if (how=="F"){count++}
if (how=="B"){count--}

if(count<0){count=picture.length-1}
if(count>picture.length-1){count=0}

if (document.all){
document.images.picturebox.style.filter="blendTrans(duration=2)";
document.images.picturebox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.picturebox.filters.blendTrans.Apply();
}

document.images.picturebox.src = picture[count]
document.images.captionbox.src = caption[count]
document.getElementById("theLink").href = links[count];

if (document.all){
document.images.picturebox.filters.blendTrans.Play();
}

}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_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;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/***********************************************
* Image Thumbnail viewer- ?Dynamic Drive (www.dynamicdrive.com)
* Last updated Sept 26th, 03'. This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight){
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}
crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">X&nbsp;</span> </div><img src="'+which+'">'
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")

</script>

</head>

<body onLoad="showHot=true;self.focus(); MM_preloadImages('pic/arr1b.gif','pic/arr2b.gif','pic/bot1.gif','pic/bot2.gif','pic/bot4.gif','pic/bot5.gif','pic/bot6.gif')">



<div class="container">
	
<div class="botbox">

<div id="showimage"></div> 

<table width="390" border="0" cellspacing="0" cellpadding="0" align="right">
  <tr>
      <td width="330"><a href="#" id="theLink"><img src="pic/bcn2.jpg" name=picturebox width=330 height=220 border=0></a></td>
      <td width="60" valign="bottom"><a href="javascript:control('F');" class="aro2" ></a><a href="javascript:control('B');" class="aro1"></a></td>
    </tr>
</table>
</div>
</div>
</body>
</html>