function openPrinterFriendly() {
    open("WhyPrinterFriendly.html", "PrinterFriendly", "toolbar=0, location=0, directories=0, scrollbars=1,  status=0, menubar=0, resizable=1, width=420px, height=460px"  );
}


function IncludeCopyrightScreen() {
document.writeln('<p class="copyright-screen">');
document.writeln('Copyright © 2003, The Regents of the University of California.'); 
document.writeln('All Rights Reserved.');
document.writeln('This page is '); 
document.writeln('<a href="javascript:openPrinterFriendly()")>printer-friendly</a>.');
document.writeln('</p>');
}


function IncludeCopyrightPrint() {
document.writeln('<p class="copyright-print">');
document.writeln('Copyright © 2003, The Regents of the University of California.'); 
document.writeln('All Rights Reserved.');
document.writeln('</p>');
}

function IncludeLogoHeader() {
document.writeln('<div class="LogoHeader">');
document.writeln('     <div class="table">');
document.writeln('          <div class="table-cell-image">');
document.writeln('	             <img src="images/DeptLogo.gif"');
document.writeln('	                  alt="Physics & Astronomy logo"');
document.writeln('	                  width="650px"');
document.writeln('	                  height="70px"');
document.writeln('	             />');
document.writeln('          </div>');
document.writeln('     </div>');
document.writeln('</div>');
}

function IncludeFloatingHeader() {
with(document){
    writeln('<div class="Header">');
    writeln('<div class="HeaderContents">');
    writeln('<p>');
    writeln('<div class="HeaderTable">');
    writeln('     <div class="HeaderTable-cell-image">');
    writeln('	        <img src="images/DeptLogo.gif"');
    writeln('	             alt="Physics & Astronomy logo"');
    writeln('	             width="650px"');
    writeln('	             height="70px"');
    writeln('	        />');
    writeln('     </div>');
    writeln('</div>');
    writeln('</p>');
    writeln('</div>');
    writeln('</div>');
    }
}

function IncludeFloatingMenu() {
var PathName = window.location.pathname
with(document){
writeln('<div class="Menu">');
writeln('<div class="MenuContents">');
writeln('<p>');
if ((PathName.indexOf("DataAcquisition")) > 0) 
{  writeln('<a href="index.html">Home </a>');
   writeln('<ah>Data Acquisition </ah>');
   writeln('<a href="Statistics/index.html">Statistics </a>');
   writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
   writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
   writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
   writeln('<a href="Magnetism/index.html">Magnetism </a>');
   writeln('<a href="SoundLight/index.html">Sound & Light </a>');
   writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
   writeln('<a href="Diffraction/index.html">Diffraction </a>');
} 
else 
{ if ((PathName.indexOf("Statistics")) > 0)
  {  writeln('<a href="index.html">Home </a>');
     writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
     writeln('<ah>Statistics </ah>');
     writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
     writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
     writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
     writeln('<a href="Magnetism/index.html">Magnetism </a>');
     writeln('<a href="SoundLight/index.html">Sound & Light </a>');
     writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
     writeln('<a href="Diffraction/index.html">Diffraction </a>');
  }
  else
  { if ((PathName.indexOf("Electrostatics")) > 0)
    {  writeln('<a href="index.html">Home </a>');
       writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
       writeln('<a href="Statistics/index.html">Statistics </a>');
       writeln('<ah>Electrostatics </ah>');
       writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
       writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
       writeln('<a href="Magnetism/index.html">Magnetism </a>');
       writeln('<a href="SoundLight/index.html">Sound & Light </a>');
       writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
       writeln('<a href="Diffraction/index.html">Diffraction </a>');
   }
    else
    { if ((PathName.indexOf("Magnetism")) > 0)
      {  writeln('<a href="index.html">Home </a>');
         writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
         writeln('<a href="Statistics/index.html">Statistics </a>');
         writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
         writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
         writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
         writeln('<ah>Magnetism </ah>');
         writeln('<a href="SoundLight/index.html">Sound & Light </a>');
         writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
         writeln('<a href="Diffraction/index.html">Diffraction </a>');
      }
      else
      { if ((PathName.indexOf("SoundLight")) > 0)
        { writeln('<a href="index.html">Home </a>');
          writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
          writeln('<a href="Statistics/index.html">Statistics </a>');
          writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
          writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
          writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
          writeln('<a href="Magnetism/index.html">Magnetism </a>');
          writeln('<ah>Sound & Light </ah>');
          writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
          writeln('<a href="Diffraction/index.html">Diffraction </a>');
        }
        else
        { if ((PathName.indexOf("DCCircuits")) > 0)
          { writeln('<a href="index.html">Home </a>');
            writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
            writeln('<a href="Statistics/index.html">Statistics </a>');
            writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
            writeln('<ah>DC Circuits </ah>');
            writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
            writeln('<a href="Magnetism/index.html">Magnetism </a>');
            writeln('<a href="SoundLight/index.html">Sound & Light </a>');
            writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
            writeln('<a href="Diffraction/index.html">Diffraction </a>');
          }
          else
          { if ((PathName.indexOf("ACCircuits")) > 0)
            { writeln('<a href="index.html">Home </a>');
              writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
              writeln('<a href="Statistics/index.html">Statistics </a>');
              writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
	      writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
	      writeln('<ah>AC Circuits </ah>');
              writeln('<a href="Magnetism/index.html">Magnetism </a>');
              writeln('<a href="SoundLight/index.html">Sound & Light </a>');
              writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
              writeln('<a href="Diffraction/index.html">Diffraction </a>');
            }
            else
            { if ((PathName.indexOf("GeomOptics")) > 0)
              { writeln('<a href="index.html">Home </a>');
                writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
                writeln('<a href="Statistics/index.html">Statistics </a>');
                writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
	        writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
                writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
                writeln('<a href="Magnetism/index.html">Magnetism </a>');
                writeln('<a href="SoundLight/index.html">Sound & Light </a>');
                writeln('<ah>Geometrical Optics </ah>');
                writeln('<a href="Diffraction/index.html">Diffraction </a>');
              }
              else
              { if ((PathName.indexOf("Diffraction")) > 0)
                { writeln('<a href="index.html">Home </a>');
                  writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
                  writeln('<a href="Statistics/index.html">Statistics </a>');
                  writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
	          writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
                  writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
                  writeln('<a href="Magnetism/index.html">Magnetism </a>');
                  writeln('<a href="SoundLight/index.html">Sound & Light </a>'); 
                  writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
                  writeln('<ah>Diffraction </ah>');
                }
                else
                { writeln('<ah>Home </ah>');
                  writeln('<a href="DataAcquisition/index.html">Data Acquisition </a>');
	          writeln('<a href="Statistics/index.html">Statistics </a>');
	          writeln('<a href="Electrostatics/index.html">Electrostatics </a>');
	          writeln('<a href="DCCircuits/index.html">DC Circuits </a>');
	          writeln('<a href="ACCircuits/index.html">AC Circuits </a>');
                  writeln('<a href="Magnetism/index.html">Magnetism </a>');
                  writeln('<a href="SoundLight/index.html">Sound & Light </a>');
                  writeln('<a href="GeomOptics/index.html">Geometrical Optics </a>');
                  writeln('<a href="Diffraction/index.html">Diffraction </a>');
                }
              }
            }
          }
        }
      }
    }
  }  
}
writeln('</p>');
writeln('<p>');
writeln('<a href="http://validator.w3.org/check/referer"');
writeln('   class="image">');
writeln('   <img src="images/valid-xhtml10.png"');
writeln('	  alt="Valid XHTML 1.0!"');
writeln('	  height="31px"');
writeln('	  width="88px"');
writeln('    />');
writeln('</a>');
writeln('<a href="http://jigsaw.w3.org/css-validator/"');
writeln('   class="image">');
writeln('   <img src="images/vcss.png"');
writeln('        alt="Valid CSS!"');
writeln('	  height="31px"');
writeln('	  width="88px"');
writeln('   />');
writeln('</a>');
writeln('</p>');
writeln('<p>');
writeln('This website complies with Web standards.');
writeln('If IE does not work, use Firefox, Safari, etc.');
writeln('</p>');
writeln('</div>');
writeln('</div>');
}
}


function openImageWindow(URL, baseURL, ALT, WIDTH, HEIGHT) 
{	WindowName = URL.substring(URL.lastIndexOf("/")+1);
	WindowProps = "width=" + (WIDTH+50) + ",height=" + (HEIGHT+75);
	text  = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
	text += '<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">';
	text += '<head>';
	text += '<title>'+ WindowName + ' (' + WIDTH + 'x' + HEIGHT + ' pixels) </title>';
	text += '<style	type="text/css">';
	text += '@import "' + baseURL + 'CSS/4BLStyle.css";';
	text += '</style>';
	text += '</head>';
	text += '<body>';
	text += '<div class="plain-image">';
	text += '<div class="table">';
	text += '<div class="table-row">';
	text += '<div class="table-cell-image">';
	text += '<img src="' + baseURL + URL + '" ';
	text += 'width="' + WIDTH + 'px" ';
	text += 'height="' + HEIGHT + 'px" ';
	text += 'alt="' + ALT + '" />';
	text += '</div>';
	text += '</div>';
	text += '<div class="table-row">';
	text += '<div class="table-cell-short-caption">';
	text += '<p>';
	text += '<a href="javascript:parent.window.close()"';
	text += 'onclick="parent.window.close()">CLOSE THIS WINDOW</a>';
	text += '</p>';
	text += '</div>';
	text += '</div>';
	text += '</div>';
	text += '</body></html>';
//NOTE: could not use WindowName for "name" as in:
//
//	ImageWindow = window.open("", WindowName, WindowProps);
//
// because IE chokes with a "mismatched type" error. Mozilla doesn't.
	ImageWindow = window.open("", "", WindowProps);
	ImageWindow.document.open();
	ImageWindow.document.write(text);
	ImageWindow.document.close();
}

function openFigWindow(URL, baseURL, ALT, CAPTION,  WIDTH, HEIGHT) 
{	UncleanCaption = String(CAPTION)
	UncleanCaption = UncleanCaption.replace('\t','')
	UncleanCaption = UncleanCaption.replace('  ',' ')
	temp0 = UncleanCaption.split("<a")
	CleanCaption   = new String("")
	for (i=0; i < temp0.length; ++i)
	{ if (i == 0)
	  {  CleanCaption += String(temp0[i])
	  }
	  else
	  {  temp = String(String(temp0[i]).split('\'>')[1]).split("</a>")
	     CleanCaption += temp[0].concat(temp[1])
	  }
	}
	if (WIDTH > 800) 
	{  CaptSpace = 18*(CleanCaption.length)*10/600;
	   if (CaptSpace < 18){CaptSpace = 18};
	}
	else
	{  CaptSpace = 18*(CleanCaption.length)*10/WIDTH;
	   if (CaptSpace < 18){CaptSpace = 18};
	}
	WindowWidth = WIDTH + 50;
	WindowHeight = HEIGHT + 50 + 40 + CaptSpace;
	if (WindowHeight > 1000)
	{
	    WindowHeight = 1000;
	}
	WindowName = URL.substring(URL.lastIndexOf("/")+1);
	WindowProps = "width=" + WindowWidth + ",height=" + WindowHeight;
	text  = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
	text += '<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">';
	text += '<head>';
	text += '<base href="'+ baseURL + '" />';
	text += '<title>'+ WindowName + ' (' + WIDTH + 'x' + HEIGHT + ' pixels) </title>';
	text += '<style	type="text/css">';
	text += '@import "' + baseURL + 'CSS/4BLStyle.css";';
	text += '</style>';
	text += '</head>';
	text += '<body>';
	text += '<div class="plain-image">';
	text += '<div class="table">';
	text += '<div class="table-row">';
	text += '<div class="table-cell-image">';
	text += '<img src="' + URL + '" ';
	text += 'width="' + WIDTH + 'px "';
	text += 'height="' + HEIGHT + 'px "';
	text += 'alt="' + ALT + '" />';
	text += '</div>';
	text += '</div>';
	text += '</div>';
	if ( WIDTH > 800) 
	{  text += '<div class="table-600px">';
	   text += '<div class="table-row">';
	   if (CleanCaption.length*8 > 600)
	   {  text += '<div class="table-cell-caption">';
	   } 
	   else
	   {  text += '<div class="table-cell-short-caption">';
	   }
	}
	else
	{  text += '<div class="table-75">';
	   text += '<div class="table-row">';
	   if (CleanCaption.length*10 > 0.75*WIDTH)
	   {  text += '<div class="table-cell-caption">';
	   } 
	   else
	   {  text += '<div class="table-cell-short-caption">';
	   }
	}
	text += '<p>';
	text += UncleanCaption;
	text += '</p>';
	text += '<p class="formula">';
	text += '<a href="javascript:parent.window.close()"';
	text += 'onclick="parent.window.close()">CLOSE THIS WINDOW</a>';
	text += '</p>';
	text += '</div>';
	text += '</div>';
	text += '</div>';
	text += '</div>';
	text += '</body></html>';
	ImageWindow = window.open("", WindowName, WindowProps);
	ImageWindow.document.open();
	ImageWindow.document.write(text);
	ImageWindow.document.close();
}

function IncludeCopyrightScreen() {
document.writeln('<p class="copyright-screen">');
document.writeln('Copyright © 2004, The Regents of the University of California.'); 
document.writeln('All Rights Reserved.');
document.writeln('<br />');
document.writeln('This manual was written by <a href="mailto:stenzel@physics.ucla.edu">R. L. Stenzel</a>, with help from  ');
document.writeln('<a href="mailto:urrutia@ucla.edu">J. Manuel Urrutia</a>, ');
document.writeln('and <a href="http://www.w3.org/Style/">CSS</a> makes it '); 
document.writeln('<a href="javascript:openPrinterFriendly()")>printer-friendly</a>.');
document.writeln('<br />');
document.writeln('Last partial update: Jan 17, 2008.');
document.writeln('</p>');
}

