<!DOCTYPE html>
<html>
	
	<head>
			<script language="javascript" src="svgconverter.js">
			</script>
			<link rel="stylesheet" type="text/css" href="svgconverter.css">
	</head>
	
	<body>
		<table><tr>
			<td id='preview'>
				<?php
					function endsWith($haystack, $needle, $case=true) {
						if($case){
							return( strcmp( substr( $haystack, strlen( $haystack ) - strlen( $needle )), $needle ) === 0 );
						}
						return( strcasecmp( substr( $haystack, strlen( $haystack) - strlen( $needle )), $needle ) === 0 );
					}
					$dir = opendir( '../media/svgconverter' );
					while(( $file = readdir( $dir )) !== false ) {
						if( endsWith( $file, ".svg" )) {
							echo "<span onmouseover='this.style.backgroundColor=\"#000\";this.style.color=\"#fff\"' onmouseout='this.style.backgroundColor=\"#fff8f8\";this.style.color=\"#000\"' style='cursor:pointer;' onclick='getSVG(\"".$file."\");'>".$file."</span><br>";
						}
					}
				?>
			</td>
			<td id='preview'>
				Preview:<br>
				<canvas width="700" height="700" id="previewCanvas">
				</canvas>
			</td>
			<td id='preview'>
				<pre id='content'>
				</pre>
			</td>
		</tr></table>
	</body>

</html>