<?php
$apage = basename($_SERVER['PHP_SELF']);
$siteurl = "http://".$_SERVER['HTTP_HOST'].str_replace($apage, "", $_SERVER['PHP_SELF']);
$siteurl = str_replace("includes/jscripts/tiny_mce/plugins/emotions/", "", $siteurl);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Insert Emotion</title>
	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
	<script type="text/javascript" src="js/emotions.js"></script>
	<base target="_self" />
</head>
<body style="display: none">

<div align="center">
		<div class="title">Insert Emotion:<br /><br /></div>
<table border="0" cellspacing="0" cellpadding="4">
<?php
echo "<tr>";
$i = 0;
if ($handle = opendir("../../../../../includes/smilies")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$file2 = explode(".", $file);
$i = $i + 1;
echo "<td><a href=\"javascript:EmotionsDialog.insert('".$file."','emotions_dlg.".$file2[0]."');\"><img src='".$siteurl."includes/smilies/".$file."' border='0' alt='".ucwords($file2[0])." Emotion' title='".ucwords($file2[0])." Emotion'></a></td>";
if (($i % 3) === 0) {
echo "</tr><tr>";
}
}
}
}
echo "</tr></table>";
?>
</div>
</body>
</html>