function uniqueId(input) 
{
    re = /[A-Za-z0-9]/g;
    myArray = input.match(re);
    output = "";
    for (i=0;i<myArray.length;i++) {
        output = output + myArray[i];
    }
    return output;
}

function ShowPage(path, wd, ht, explanation)
{
  WindowName = uniqueId(path);
  s = 'status=no,resizable=yes,scrollbars=yes,left=1,top=1' + ',width=' + wd + ',height=' + ht;
  window.open(path, WindowName, s);
}


function ShowFullPicture(path, wd, ht, explanation) 
{ 
  WindowName = uniqueId(path);
  wdf = wd + 18;
  htf = ht + 77;
  s = 'status=no,resizable=yes,scrollbars=yes,left=1,top=1' + ',width=' + wdf + ',height=' + htf;
  secWnd = window.open('', WindowName, s);
  with (secWnd)
   {
       
     document.write('<HTML><head><title>' + explanation + '</title>' + "\n");
     document.write('<META http-equiv=Content-Type content="text/html; charset=windows-1251">' + "\n");

     document.write('<script type="text/javascript">' + "\n");
     document.write('<!--' + "\n");
     document.write('var wd = ' + wd + ';' + "\n");
     document.write('var ht = ' + ht + ';' + "\n");


     document.write('focus();' + "\n");

     document.write('function getClientWidth()' + "\n");
     document.write('{' + "\n");
     document.write("	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;" + "\n");
     document.write('}' + "\n");

     document.write('function getClientHeight()' + "\n");
     document.write('{' + "\n");
     document.write("	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;" + "\n");
     document.write('}' + "\n");

     document.write('function imageSize()' + "\n");
     document.write('{' + "\n");
     document.write('	widthBrowser = getClientWidth() -3;' + "\n");
     document.write('	heightBrowser = getClientHeight() -4;' + "\n");
	
	
     document.write('NewWidth = widthBrowser;' + "\n");
     document.write('NewHeight = Math.round(widthBrowser/wd*ht);' + "\n");

     document.write('if (NewWidth <= wd)' + "\n");
     document.write(' {' + "\n");
     document.write('   document.BigImage.width = NewWidth;' + "\n");
     document.write('   document.BigImage.height = NewHeight;' + "\n");
     document.write(' }' + "\n");
     document.write(' else ' + "\n");
     document.write(' {' + "\n");
     document.write('   document.BigImage.width = wd;' + "\n");
     document.write('   document.BigImage.height = ht;' + "\n");
     document.write(' }' + "\n");


     document.write("	setTimeout('imageSize()', 1000);" + "\n");
     document.write('}' + "\n");

     document.write('-->' + "\n");
     document.write('</script>' + "\n");

     document.write('</head>' + "\n");

     document.write('<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0" bgcolor="#F5D355" onLoad="imageSize()">' + "\n");
     document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">' + "\n");
     document.write('<tr><td align=center valign=top><IMG name="BigImage"  SRC="' + path + '" BORDER="0"></td></tr></table>' + "\n");

     document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" style="background: #28730A;" height="77">' + "\n");
     document.write('<tr><td valign="center" align="center"><p style="margin: 2px 4px"><font size="3" color="#FFFFFF">' + explanation + '</font></p>' + "\n");
     document.write('<a href="#" onclick="javascript: window.close();"><p style="margin: 2px 4px" ><b><font size="3" color="#FFFFFF">Закрыть</font></b></p></a></td>' + "\n");
     document.write('</table>' + "\n");

     document.write('</BODY></HTML>' + "\n");  
       
     document.close();
     focus();
   }
}



