<?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 = "<b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
	$notes = "";
    }
    if ("$aid" == "$informant") {
	echo "<font class=\"content\">$thetext<br>$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=\"0\" bgcolor=\"#F3F3F3\" text=\"000000\" link=\"0000ff\" vlink=\"0000ff\">";

    echo "<!-- this theme is designed by coffee4arab.com -->"
	."<table style=\"border:solid #434343 1px\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"760\" align=\"center\"><tr><td bgcolor=\"ffffff\">"
        ."<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" bgcolor=\"ffffff\"><tr><td colspan=2 bgcolor=\"#F39B33\">"
		."<img src=\"images/pix.gif\" height=\"10\" border=\"0\"></td></tr>"
        ."<tr bgcolor=\"#003770\"><td><a href=\"index.php\"><img src=\"themes/Thadiq/images/logo.jpg\" alt=\"Welcome to $sitename\" title=\"Welcome to $sitename\" border=\"0\"></a>"
        ."</td><td align=\"left\">";
    if ($banners) {include("banners.php");}

	echo "</td></tr>"
		."<tr><td colspan=2 bgcolor=\"#F39B33\">"
		."<img src=\"images/pix.gif\" height=\"10\" border=\"0\"></td></tr>"
		."</td></tr>"
		."</table></td></tr><tr><td valign=\"top\" width=\"100%\" bgcolor=\"ffffff\">";
    $public_msg = public_message();
    if ($public_msg !="") echo "$public_msg<br>";
	echo "<br>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td style=\"border-left:1px solid #434343\" valign=\"top\" width=\"150\" bgcolor=\"#E6E6E6\">";
    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=\"#ffffff\">";
	blocks(right);
	echo "</td>";
    }
    echo "</td></tr></table></td></tr></table><center>";
    footmsg();
	echo "</center>";
}

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous;
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" bgcolor=\"ffffff\" width=\"100%\"><tr><td>"
        ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\"><tr><td bgcolor=\"#F39B33\">"
        ."<font class=\"blockhead\">$title</font><br>"
        ."<font class=\"tiny\">"
        .""._POSTEDBY." <b>";
    formatAidHeader($aid);
    echo "</b> "._ON." $time $timezone ($counter "._READS.")<br>"
	."<b>"._TOPIC."</b> <a href=\"modules.php?name=News&amp;new_topic=$topic\">$topictext</a><br>"
	."</font></td></tr><tr><td bgcolor=\"#E6E6E6\">";
    FormatStory($thetext, $notes, $aid, $informant);
    echo "<br><br>"
        ."</td></tr><tr><td bgcolor=\"F39B33\" align=\"right\">"
        ."<font class=\"content\">$morelink</font>"
        ."</td></tr></table></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=0 cellspacing=0 align=center bgcolor=ffffff width=100%><tr><td>
	<table border=0 cellpadding=3 cellspacing=1 width=100%><tr><td bgcolor=F39B33>
	<font class=\"blockhead\">$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=\"#E6E6E6\">
	$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 .= "كتب <i>\"$thetext\"</i> $notes";
	echo "
	<table border=0 cellpadding=0 cellspacing=0 align=center bgcolor=ffffff width=100%><tr><td>
	<table border=0 cellpadding=3 cellspacing=1 width=100%><tr><td bgcolor=F39B33>
	<font class=\"blockhead\">$title</font><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=\"#E6E6E6\">
	$thetext
	</td></tr></table></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\" bgcolor=\"#E6E6E6\"><tr><td>"
        ."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
		."<tr><td bgcolor=\"#F39B33\"><img src=\"imagex/pix.gif\" border=\"0\" height=\"1\"></td></tr>"
		."<tr><td align=\"center\" bgcolor=\"#F39B33\">"
        ."<font class=\"blockhead\">$title</font></td></tr>"
		."<tr><td>"
		."<font class=\"content\">"
        ."$content"
	."</font>"
	."</td></tr>"
	."</table></td></tr></table><br>";
}

}

?>