/* *********************************************************************************************   Generate a popup window depending of the Screen and Picture sizes   You just have to modify in this script the two vars maxWscn and maxHScn witch define   the maximum width and height sizes of popup window.   Call the picPopup function with :     - the picture address     - the popup window title     - the popup window original position on desktop    Example: javascript:picPopup('http://pictureAddress', 'This is a lovely picture', 10, 0);    NB: Netscape and Explorer have some problems to load pictures, so that's why a timer is used.	********************************************************************************************* */var maxWscn = 800;var maxHscn = 600;function trim(strText) {  while (strText.substring(0,1) == ' ')      strText = strText.substring(1, strText.length);  while (strText.substring(strText.length-1,strText.length) == ' ')     strText = strText.substring(0, strText.length-1);  return strText;} function picPopup(picURL,winName,posX,posY) {  picURL = trim(picURL);  popupWin=window.open("","popupWin","toolbar=no,location=no,directories=no,status=no,copyhistory=no,scrollbars=yes,resizable=yes,width=250,height=150,screenX="+posX+",screenY="+posY+",top="+posX+",left="+posY);  popupWin.document.open();  popupWin.document.write("<html><head>\n");  popupWin.document.write("<script language='javascript'>\n");  popupWin.document.write("var maxWscn = " + maxWscn + ";\n");  popupWin.document.write("var maxHscn = " + maxHscn + ";\n");  popupWin.document.write("var picW = 0;\n");  popupWin.document.write("var picH = 0;\n");  popupWin.document.write("var tmpPic;\n");  popupWin.document.write("var waitingTimer;\n");  popupWin.document.write("var tmpURL;\n");  popupWin.document.write("tmpPic=new Image();\n");  popupWin.document.write("var addW = 0;\n");  popupWin.document.write("var addH = 0;\n");  popupWin.document.write("var sAgent = window.navigator.userAgent;\n");  popupWin.document.write("if (sAgent.indexOf(\"MSIE\") > 0) {\n");  popupWin.document.write("  addW = 28;\n");  popupWin.document.write("  addH = 31;\n");  popupWin.document.write("}\n");  popupWin.document.write("function callLoadPic(picURL) {\n");  popupWin.document.write("  tmpPic.src = picURL;\n");  popupWin.document.write("  picW = tmpPic.width+addW;\n");  popupWin.document.write("  picH = tmpPic.height+addH;\n");  popupWin.document.write("  if(picW>maxWscn) picW=maxWscn;\n");  popupWin.document.write("  if(picH>maxHscn) picH=maxHscn;\n");  popupWin.document.write("  window.resizeTo(picW,picH);\n");  popupWin.document.write("}\n");  popupWin.document.write("function loadPic(picURL) {\n");  popupWin.document.write("  tmpURL = picURL;\n");  popupWin.document.write("  tmpPic.src = picURL;\n");  popupWin.document.write("  waitingTimer = setTimeout(\"callLoadPic(tmpURL)\", 0);\n");  popupWin.document.write("}\n");  popupWin.document.write("</script>\n");  popupWin.document.write("<title>" + winName + "</title></head>\n");  popupWin.document.write("<body bgcolor='#FFFFFF' leftmargin=0 topmargin=0 marginheight=0 marginwidth=0 onLoad=javascript:loadPic(\""+picURL+"\");>\n");  popupWin.document.write("<img src='../site/scripts/%22%20%2B%20picURL%20%2B%20%22' border='0'>");  popupWin.document.write("</body></html>");  popupWin.document.close();  popupWin.focus();}