<?php

$bgcolor1 = "#ffffff";
$bgcolor2 = "#cccccc";
$bgcolor3 = "#ffffff";
$bgcolor4 = "#eeeeee";
$textcolor1 = "#ffffff";
$textcolor2 = "#000000";

function OpenTable() {
    global $bgcolor1, $bgcolor2;
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\"><tr><td>\n";
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"$bgcolor1\"><tr><td>\n";
}

function OpenTable2() {
    global $bgcolor1, $bgcolor2;
    echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\" align=\"center\"><tr><td>\n";
    echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"$bgcolor1\"><tr><td>\n";
}

function CloseTable() {
    echo "</td></tr></table></td></tr></table>\n";
}

function CloseTable2() {
    echo "</td></tr></table></td></tr></table>\n";
}

function FormatStory($thetext, $notes, $aid, $informant) {
    global $anonymous;
    if ($notes != "") {
	$notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
	$notes = "";
    }
    if ("$aid" == "$informant") {
	echo "<font class=\"content\">$thetext$notes</font>\n";
    } else {
	if($informant != "") {
	    $boxstuff = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$informant\">$informant</a> ";
	} else {
	    $boxstuff = "$anonymous ";
	}
	$boxstuff .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
	echo "<font class=\"content\">$boxstuff</font>\n";
    }
}


function themeheader() {
    echo "<body topmargin=\"5\" bgcolor=\"#ffffff\" text=\"000000\" link=\"0000ff\" vlink=\"0000ff\">";
    if ($banners) {
	include("banners.php");
    echo "<br>";
    }

	echo "<!-- theme designed by coffee4arab.com -->"
		. "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" align=\"center\"><tr><td bgcolor=\"ffffff\">"
        ."<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\" bgcolor=\"ffffff\">"
		."<tr><td style=\"filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#4B92D9', endColorStr='#CEDFF6', gradientType='1')\">"
        ."<a href=\"index.php\"><img src=\"themes/Mohannad/images/logo.gif\" alt=\"مرحبا بك في $sitename\" title=\"Welcome to $sitename\" border=\"0\"></a>"
        ."</td></tr>"
		."<tr><td height=\"10\" bgcolor=\"#0066CC\"><img src=\"images/pix.gif\" border=\"0\" height=\"10\"></td></tr>"
		."</table>"
		."</td></tr><tr><td valign=\"top\" width=\"100%\" bgcolor=\"ffffff\">";
    $public_msg = public_message();
    echo "$public_msg<br>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\"><tr><td valign=\"top\" width=\"150\" bgcolor=\"#EEEEEE\">";
    blocks(left);
    echo "<img src=\"images/pix.gif\" border=\"0\" width=\"150\" height=\"1\"></td><td>&nbsp;&nbsp;</td><td width=\"100%\" valign=\"top\">";
}

function themefooter() {
    global $index;
    if ($index == 1) {
	echo "</td><td>&nbsp;&nbsp;</td><td valign=\"top\" bgcolor=\"#EEEEEE\">";
	blocks(right);
	echo "</td>";
    }
    echo "</td></tr></table>"
		."</td></tr><tr><td bgcolor=\"gray\"><img src=\"images/pix.gif\" height=\"20\" border=\"0\">"
		."</td></tr></table>";
	echo "<center>";
    footmsg();
}

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous;
    echo ""
        ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\"><tr><td bgcolor=\"ffffff\">"
        ."<font class=\"articletitle\">$title</font> ($counter "._READS.")<br>"
        ."<font class=\"tiny\">"
        .""._POSTEDBY." <b>";
    formatAidHeader($aid);
    echo "</b> "._ON." $time <br>"
	."</font></td></tr><tr><td bgcolor=\"ffffff\">";

	echo "<table border=0 width=\"100%\">"
		."<tr><td valign=\"top\"><a href=\"modules.php?name=News&amp;new_topic=$topic\"><img src=\"images/topics/$topicimage\" border=\"0\"></a></td>"
		."<td>";
    FormatStory($thetext, $notes, $aid, $informant);
	echo "</td></tr></table>";

    echo "<br><br>"
        ."</td></tr><tr><td bgcolor=\"ffffff\" align=\"left\">"
        ."<font class=\"content\">$morelink</font>"
        ."</td></tr></table>"
	."<br>";
}

function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
    global $admin, $sid;
    if ("$aid" == "$informant") {
	echo"
	<table border=0 cellpadding=3 cellspacing=1 width=100%><tr><td bgcolor=FFFFFF>
	<font class=\"articletitle\">$title</font><br><font class=tiny>$datetime";
	if ($admin) {
	    echo "&nbsp;&nbsp; $font2 [ <a href=admin.php?op=EditStory&sid=$sid>Edit</a> | <a href=admin.php?op=RemoveStory&sid=$sid>Delete</a> ]";
	}
	echo "
	<br>الموضوع: <a href=modules.php?name=News&amp;new_topic=$topic>$topictext</a>
	</td></tr><tr><td bgcolor=ffffff>
	$thetext
	</td></tr></table></td></tr></table><br>";
    } else {
	if($informant != "") $informant = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&username=$informant\">$informant</a> ";
	else $boxstuff = "$anonymous ";
	$boxstuff .= "writes <i>\"$thetext\"</i> $notes";
	echo "
	<table border=0 cellpadding=0 cellspacing=0 align=center bgcolor=000000 width=100%><tr><td>
	<table border=0 cellpadding=3 cellspacing=1 width=100%><tr><td bgcolor=FFFFFF>
	<b>$title</b><br><font class=content>$informant في $datetime</font>";
	if ($admin) {
	    echo "&nbsp;&nbsp; $font2 [ <a href=admin.php?op=EditStory&sid=$sid>Edit</a> | <a href=admin.php?op=RemoveStory&sid=$sid>Delete</a> ]";
	}
	echo "
	<br>الموضوع: <a href=modules.php?name=News&amp;new_topic=$topic>$topictext</a>
	</td></tr><tr><td bgcolor=ffffff>
	$thetext
	</td></tr></table><br>";
    }
}

function themesidebox($title, $content) {

if (substr($title,0,4)=="مخفي") {
	echo $content;
} else {
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"150\"><tr><td>"
        ."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
		."<tr><td align=\"center\"><img align=\"center\" src=\"themes/Mohannad/images/blocks_div.gif\" border=\"0\"></td></tr>"
		."<tr><td height=\"20\" bgcolor=\"#DCDCDC\">"
        ."<font color=\"#333333\"><center><b>$title</b> <img src=\"themes/Mohannad/images/arrow_small.gif\" border=\"0\"></center></font></td></tr>"
		."<tr><td><img src=\"themes/Mohannad/images/blocks_div.gif\" border=\"0\"></td></tr>"
		."<tr><td><font class=\"content\">"
        ."$content"
	."</font></td></tr></table></td></tr></table><br>";
}

}

?>