function buildArray(lgt) {// opret et array med lgt elementer
    for (var i=1; i<=lgt; i++) this[i]=0;
    this.length = lgt;
    return this;
};

function buildTnPic(thumbNail,fullPic) { // build objekt
    this.tn=thumbNail;
    this.pic=fullPic;
    this.length=2;
    return this;
};

function tdTnField(i) {
  return "<td><a href='javascript:setpic("
       + i 
       + ")'><img src='"
       + img[i].tn
       + "' width="
       + tnWidth
       + " height="
       + tnHeight
       + " border=0></a></td>"
};

function tdPicField(i) {
  return "<img src='"
	   + img[i].tn
       + "' width="
       + picWidth
       + " height="
       + picHeight
       + " name='wpic'>"
}; 

function buildTable(numpicrow, totalpic) {
  with (self.document) 
  {	// now we build the table.
	  write("<table cellspacing='0' cellpadding='0' border='0'><tr><td>");
	  write("<table cellspacing='10' cellpadding='0' border='0' style='border: 2px solid #6A9913;'><tr><td>");	  
		write(tdPicField(1));
	  write("</td></tr></table>");
	  write("</tr></td><tr><td>");	
	  write("<table cellspacing='2' cellpadding='0' border='0'>");
	 write(trStart);
  	for (var i=1; i<=totalpic; i++) 
	{
	  write(tdTnField(i));
	  if(i%numpicrow == 0)	
	  	write(trStop+trStart);

	}
	write(trStop);
	write("</table></td></tr></table>");
  }
}
function setpic(n) { // udskift det store billede
     eval("self.document.images.wpic.src= img[n].pic")
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

var popUpWin2=0;
function popUpWindow2(URLStr, left, top, width, height)
{
  if(popUpWin2)
  {
    if(!popUpWin2.closed) popUpWin2.close();
  }
  popUpWin2 = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function addToFavorites(title, url)
{
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}