<!-- Dark blue = #054C7F 	Lite blue = #D9EFFF  Other lite blue = #CFE9FB -->
	
<SCRIPT TYPE="text/javascript">
<!--
window.focus();
//-->
</SCRIPT>

<HTML>
	<LINK REL=stylesheet HREF="styles.css" TYPE="text/css">

	<TITLE>
		Dr. Lisa Cassileth - Plastic Surgery - 
<?php
	$sx = $_GET['sx'];
	$sx = str_replace("~", " ", $sx);  // turns the tildes into spaces
	echo "$sx ";
?>
		Before & After Photos
	</TITLE>

	<BODY BGCOLOR=#CFE9FB STYLE="background-color: #CFE9FB; padding: 2; margin: 0; border: 0px;">
			<!-- name -->
			<TABLE WIDTH=715 CELLPADDING=0 CELLSPACING=0 BORDER=0 class="nomargin" ALIGN=CENTER>
				<TR>
					<TD VALIGN=TOP>
						<IMG border=0 SRC="images/lbc.gif">
					</TD>
					<TD VALIGN=TOP>
						<span STYLE="font-family: trebuchet ms; font-size: 16pt; color: #054C7F; text-align: right; ">310.278.8200</span>
					</TD>
				</TR>
				<TR HEIGHT=20>
					<TD COLSPAN=2 WIDTH=714 ALIGN=CENTER BGCOLOR=#054C7F STYLE="position: relative; left: -4px; ">
						<span class="stdfont" STYLE="background-color: #054C7F; margin: auto; color: #D9EFFF; font-size: 12pt; text-align: center; font-variant: small-caps">
				<?php			
					echo "$sx\n";
				?>
					</TD>
				</TR>
				<TR>

<?php
	$pt = $_GET['pt'];
	
	$notes = "";
	if (file_exists("photos/$pt.dat"))
	{
		$stats_notes = file_get_contents("photos/$pt.dat");
		$stats_notes = str_replace("\n", "<br>", $stats_notes);
		
		$stats = $stats_notes;
		list($stats, $notes) = explode("^", $stats_notes);
	}

	if (strlen($notes) > 2)
	{
		echo "<TD COLSPAN=1 STYLE='text-align:left; font-size: 8pt;' CLASS='stdfont'>";
		echo "$stats</td><td STYLE='text-align:left; font-size: 8pt;' CLASS='stdfont' valign=top width=350>$notes</td></tr><tr>\n";
	}
	else
	{
		echo "<TD COLSPAN=2 STYLE='text-align:left; font-size: 8pt;' CLASS='stdfont'>";
		echo "$stats</td></tr><tr>\n";
	}

	//echo "pt = $pt<br>\n";

	$views = array("ap" => 0, "ol" => 0, "ll" => 0, "pa" => 0, "lr" => 0, "or" => 0);
	$thviews = array("ap" => 0, "ol" => 0, "ll" => 0, "pa" => 0, "lr" => 0, "or" => 0);
    $thcount = 0;
	foreach (glob("photos/$pt*.jpg") as $filename) /* find the images for this patient */
	{
	    list($surg, $ptname, $view, $thumb) = split("[-.]", $filename);
	    
		if (($view <> "") and (in_array($view, $views)))
		{
			if ($thumb == "th") 
			{
				++$thviews[$view];
				++$thcount;
			}
			else
			{
				++$views[$view];
			}
		}
	}

	$mainview = $_GET['mainview'];
	if (! $mainview)
	{
		$mainview = array_search(1, $views);;
	}

	if ($mainview)
	{
		echo "<TD colspan=2 height=319>";
		echo "<a name='mainview'>";
		echo "<IMG height=319 SRC='photos/$pt-$mainview.jpg'>";
?>
						</TD>	
					</TR>
					<TR CLASS="stdfont" HEIGHT=9>
						<TD ALIGN=CENTER WIDTH=355><B>Before</B></TD>
						<TD ALIGN=CENTER WIDTH=355><B>After</B></TD>
					</TR>
		
	
<?php
	}
?> 			
					</TR>
					<TR>
						<TD COLSPAN=2 ALIGN=left VALIGN=TOP STYLE="font-size: 10pt;" CLASS="stdfont">
							<TABLE STYLE="font-size: 10pt;" >
								<TR>
									<TD>
<?php
	if ($thcount > 1)
	{
		echo "More photos:<BR>\n";
		$sx = str_replace(" ", "~", $sx);  // turns the spaces back into tildes
		$i = 0;
		foreach ($thviews as $view => $n) 
		{
			if ($n > 0)
			{
				++$i;
				echo "<span style='float:left; white-space:nowrap; vertical-align: center; align: center; margin: 0px; padding: 3px; border: 1px solid green'>";
				echo "<a href='patientprofile.php?pt=$pt&sx=$sx&mainview=$view#mainview'><IMG class='graphics' BORDER=0 align=middle SRC='photos/$pt-$view-th.jpg'></a> ";
				echo "</span>";
				echo "<span style='float:left; white-space:nowrap; vertical-align: center; align: center; width: 10px;'>";
				echo "</span>";
				if ($i == 3)
				{
					echo "</td></tr><tr><td>";
					$i = 0;
				}
			}
		}	
	}
?>				

						</TD>
					</TR>
				</TABLE>
	</BODY>
</HTML>

