curWin = new Array(); //array of opened windows objects

function Preload_img()
{ 
  var img_list = Preload_img.arguments;
  if (document.preloadlist == null) 
    document.preloadlist = new Array();
  var top = document.preloadlist.length;
  for (var i=0; i < img_list.length-1; i++) {
    document.preloadlist[top+i] = new Image;
    document.preloadlist[top+i].src = img_list[i+1];
  } 
}

function Change_img_src(name, nsdoc, rpath, preload)
{ 
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img) {
    img.altsrc = img.src;
    img.src    = rpath;
  } 
}

function Restore_img_src(name, nsdoc)
{
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img && img.altsrc) {
    img.src    = img.altsrc;
    img.altsrc = null;
  } 
}

function popWindow(w_url, w_name, w_width, w_height, w_left, w_top, w_toolbar, w_scroll, w_loc, w_status, w_menu, w_title, w_resize)
{
	//assigns a handle
	popWin = window.open("", w_name, "width="+ w_width + ",height=" + w_height + ",left=" + w_left + ",top=" + w_top + ",toolbar=" + w_toolbar + ",scrollbars=" + w_scroll + ",location=" + w_loc + ",status=" + w_status + ",menubar=" + w_menu + ",titlebar=" + w_title + ",resizable=" + w_resize);

	if (popWin != null) //if the creation was successfull
	{
		if (curWin[w_name] != popWin) //if the handle does not exist in the array
		{
			//popWin.rootWin = self;
			popWin.location.href = w_url; //refreshes the content
			curWin[w_name] = popWin; //insert the window in the curWin array as an object
		}
		else
		{
			popWin.focus(); //show it
		}
	}
	
	return(popWin);
}

function popImage(imgPath)
{
	var url =  rootPath + "/showimage.php?" + imgPath;
	popWindow(url, "ShowImage", 890, 720, 10, 10, "no", "yes", "no", "yes", "no", "no", "yes")
}
