<?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." $thetext $notes\n";
	echo "<font class=\"content\">$boxstuff</font>\n";
    }
}

function themeheader() {

    echo "<body rightmargin=0 topmargin=\"0\" bgcolor=\"#EFF2EC\" text=\"000000\" link=\"0000ff\" vlink=\"0000ff\">";
	echo "<!-- الثييم من تصميم قهوة نت -->";
    echo "<table border=\"0 cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" align=\"center\"><tr><td>"
        ."<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" bgcolor=\"ffffff\"><tr><td height=\"103\" width=\"205\" rowspan=2>"
        ."<a href=\"index.php\"><img width=\"205\" height=\"103\" src=\"themes/coffee4arab2/images/logo.gif\" alt=\"Welcome to $sitename\" title=\"مرحبا بك في $sitename\" border=\"0\"></a>"
        ."</td><td height=\"64\" width=\"100%\" background=\"themes/coffee4arab2/images/logoback1.gif\"><img src=\"images/pix.gif\" height=\"64\" border=\"0\"></td></tr>"
        ."<tr><td height=\"39\" width=\"100%\" background=\"themes/coffee4arab2/images/logoback2.gif\"><img src=\"images/pix.gif\" height=\"39\" border=\"0\"></td></tr>"
		."<tr><td align=\"center\" height=\"144\" colspan=\"2\" background=\"themes/coffee4arab2/images/midback.gif\">";
	$myad = ads(0);
	echo "$myad";

		echo "</td></tr>"
		."<tr><td colspan=\"2\" background=\"themes/coffee4arab2/images/toolsback.jpg\">"
		."<a href=\"index.php\"><img src=\"themes/coffee4arab2/images/home.gif\" alt=\"\" title=\"\" border=\"0\"></a>"
		."<a href=\"modules.php?name=Downloads\"><img src=\"themes/coffee4arab2/images/downloads.gif\" alt=\"\" title=\"\" border=\"0\"></a>"
		."<a href=\"modules.php?name=Web_Links\"><img src=\"themes/coffee4arab2/images/links.gif\" alt=\"\" title=\"\" border=\"0\"></a>"
		."<a href=\"modules.php?name=Your_Account\"><img src=\"themes/coffee4arab2/images/profile.gif\" alt=\"\" title=\"\" border=\"0\"></a>"
		."<a href=\"modules.php?name=Feedback\"><img src=\"themes/coffee4arab2/images/contact.gif\" alt=\"\" title=\"\" border=\"0\"></a>"
        ."</tr></table>";
    $public_msg = public_message();
    echo "$public_msg<br>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\"><tr><td valign=\"top\" width=\"150\">";
    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() {

    if (defined('INDEX_FILE')) {
	echo "</td><td>&nbsp;&nbsp;</td><td valign=\"top\">";
	blocks(right);
	echo "</td>";
    }
    echo "</td></tr></table></td></tr></table><center>";
    footmsg();
	echo "</center></td></tr></table>";
}

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous,$tipath;

	// copyright: coffee4arab.com. DO NOT REMOVE THIS PLEASE.
    preg_match("/sid=([0-9]{1,})/", $morelink, $matches);
    echo "<table style=\"border:1px solid #64715A\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"100%\"><tr><td>"
        ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\"><tr><td colspan=2 bgcolor=\"ffffff\">"
        ."<a class=\"arttile\" href=\"modules.php?name=News&amp;file=article&amp;".$matches[0]."\">$title</a> <font color=gray>($counter "._READS.")</font><br>"
        ."<font class=\"tiny\">"
        ."الكاتب: <b>";
    formatAidHeader($aid);
    echo "</b> في $time <br>"
	."</td></tr><tr><td bgcolor=\"ffffff\">"
	."<a href=\"modules.php?name=News&new_topic=$topic\"><img src=\"$tipath$topicimage\" alt=\"$topictext\" border=\"0\" align=\"right\"></a></td>"
	."<td bgcolor=\"ffffff\">";
    FormatStory($thetext, $notes, $aid, $informant);
    echo "<br><br>"
        ."</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 style=\"border:1px solid #64715A\" border=0 cellpadding=0 cellspacing=0 align=center width=100%><tr><td>
	<table border=0 cellpadding=3 cellspacing=1 width=100%><tr><td bgcolor=FFFFFF>
	<font class=\"mytitle\">$title</font><br><font class=tiny>$datetime";
	if ($admin) {
	    echo "&nbsp;&nbsp; $font2 [ <a href=admin.php?op=EditStory&sid=$sid>تعديل</a> | <a href=admin.php?op=RemoveStory&sid=$sid>حذف</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 .= "كتب <i>\"$thetext\"</i> $notes";
	echo "
	<table style=\"border:1px solid #64715A\" border=0 cellpadding=0 cellspacing=0 align=center width=100%><tr><td>
	<table border=0 cellpadding=3 cellspacing=1 width=100%><tr><td bgcolor=FFFFFF>
	<center><font class=\"mytitle\">$title</font></center><br><font class=content>الكاتب $informant في $datetime</font>";
	if ($admin) {
	    echo "&nbsp;&nbsp; $font2 [ <a href=admin.php?op=EditStory&sid=$sid>تعديل</a> | <a href=admin.php?op=RemoveStory&sid=$sid>حذف</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>";
    }
}

function themesidebox($title, $content) {
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"150\"><tr><td>"
        ."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"35\" background=\"themes/coffee4arab2/images/blocktitle.gif\">"
        ."<font class=\"content\"><center><b>$title</b></center></font>"
		."</td></tr><tr><td background=\"themes/coffee4arab2/images/blockback.gif\"><font class=\"content\">"
        ."$content </font><br /></td></tr>"
		."<tr><td><img src=\"themes/coffee4arab2/images/blockbot.jpg\" border=\"0\">"
		."</td></tr></table></td></tr></table><br>";
}

?>