var ebwin=null;

// type==image or file; content == what to display; e==event
function enlarge(image,caption,desc,w,h,e){
    // close if open
    if (ebwin && !ebwin.closed) { ebwin.close(); }
    
    // render the content
    var content = 
      "<table width='100%' height='100%' cellpadding='0' border='0' cellspacing='0'>" +
      "<tr><td bgcolor='white' align='left'><font color='black'>" + caption + "</font></td></tr>" +
      "<tr><td align='center' valign='middle'>" +
      "<img width='" + w + "' height='" + h + "'src='"+image+"'>" + 
      "</td></tr>" +
      "<tr><td id='drag' align='left'><font color='black'>" + desc + "</font></td></tr>" +
      "<tr><td>&nbsp;</td></tr>" +
      "</table>";
      
    var newwin = NewWindow("","Image",screen.width,screen.height,"yes","yes","center","0","0");
    newwin.document.clear();
    newwin.document.write(
      "<html>" +
      "<head>" +
      "<title='Prints'></title>" +
      "</head>" +
      "<body style='bgcolor:white;font-family:arial,'lucida console',sans-serif;font-size:small'>" +
      content +
      "</body>" +
      "</html>"
      );
    newwin.document.close();
}

function NewWindow(mypage,myname,w,h,scroll,resize,pos,x,y){
	if (x&&y) {LeftPosition=x;TopPosition=y;}
	else if(pos=="random"){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	else if(pos=="center"){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null){
		LeftPosition=0;TopPosition=20
	}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=yes,menubar=no,toolbar=yes,resizable='+resize;
	ebwin=window.open(mypage,myname,settings);
	blur();
	ebwin.focus();
	return ebwin;
}


