<?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() {
	global $banners;
    echo "<body background=\"themes/sky/images/pageback.gif\" bgcolor=\"ffffff\" text=\"000000\" link=\"0000ff\" vlink=\"0000ff\">";
	echo "<!-- الثييم من تصميم قهوة نت -->";
    echo "<br>"
	."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"750\" align=\"center\"><tr><td bgcolor=\"ffffff\">"
        ."<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" bgcolor=\"ffffff\"><tr><td>"
        ."<a href=\"index.php\"><img src=\"themes/sky/images/logo.gif\" alt=\"Welcome to $sitename\" title=\"Welcome to $sitename\" border=\"0\"></a>"
        ."</td><td align=\"right\">";
    if ($banners) {
	include("banners.php");
    }
	echo "</td></tr><tr><td colspan=\"2\" width=\"100%\" align=\"center\" valign=\"middle\" height=\"27\" background=\"themes/sky/images/toptool.jpg\">"
		."<table width=\"90%\" cellpadding=0 cellspacing=0 border=0><tr>"
		."<td><a class=\"topbar\" href=\"index.php\">الصفحة الأولى</a></td>"
		."<td><a class=\"topbar\" href=\"modules.php?name=Downloads\">دليل البرامج</a></td>"
		."<td><a class=\"topbar\" href=\"modules.php?name=Web_Links\">دليل المواقع</a></td>"
		."<td><a class=\"topbar\" href=\"modules.php?name=Topics\">المواضيع</a></td>"
		."<td><a class=\"topbar\" href=\"modules.php?name=Feedback\">راسلنا</a></td>"
		."</tr></table>";
    echo "</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=\"4\" width=\"100%\"><tr><td valign=\"top\" width=\"150\" bgcolor=\"#E7EFF7\">";
    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=\"#E7EFF7\">";
	blocks(right);
	echo "</td>";
    }
    echo "</td></tr></table>"
	."</td></tr><tr><td bgcolor=\"#E7EFF7\">";
	footmsg();
	echo "</td></tr></table>";
}

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\" width=\"100%\"><tr><td>"

        ."<table bgcolor=\"#E7EFF7\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
		."<tr><td width=\"7\"><img width=\"7\" height=\"6\" src=\"themes/sky/images/rtc.gif\" border=\"0\"></td>"
		."<td height=\"6\" background=\"themes/sky/images/tb.gif\"><img src=\"images/pix.gif\" border=\"0\"></td>"
		."<td width=\"7\"><img width=\"7\" height=\"6\" src=\"themes/sky/images/ltc.gif\" border=\"0\"></td></tr>"

		."<tr>"
		."<td background=\"themes/sky/images/rb.gif\"><img width=\"7\" src=\"images/pix.gif\" border=\"0\"></td>"
		."<td bgcolor=\"ffffff\">"
	        ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\"><tr><td bgcolor=\"ffffff\">"
	        ."<font class=\"blocktitle\">$title</font><br>"
	        ."<font class=\"tiny\">"
	        .""._POSTEDBY." <b>";
		    formatAidHeader($aid);
		    echo "</b> "._ON." $time $timezone ($counter "._READS.")<br>"
			."</font></td></tr><tr><td bgcolor=\"ffffff\"><img align=\"left\" src=\"images/topics/$topicimage\" border\"0\">";
		    FormatStory($thetext, $notes, $aid, $informant);
		    echo "<br><br>"
	        ."</td></tr><tr><td bgcolor=\"ffffff\" align=\"right\">"
			."<center><hr height=1 color=\"#84B2C6\" width=\"65%\">"
	        ."<font class=\"content\">$morelink</font></center>"
	        ."</td></tr></table>"	
		."</td>"
		."<td background=\"themes/sky/images/lb.gif\"><img width=\"7\" src=\"images/pix.gif\" border=\"0\"></td>"
		."</tr>"	

		."<tr><td width=\"7\"><img width=\"7\" height=\"6\" src=\"themes/sky/images/brc.gif\" border=\"0\"></td>"
		."<td height=\"6\" background=\"themes/sky/images/bb.gif\"><img src=\"images/pix.gif\" border=\"0\"></td>"
		."<td width=\"7\"><img width=\"7\" height=\"6\" src=\"themes/sky/images/blc.gif\" border=\"0\"></td></tr>"


		."</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=\"#84B6C6\" width=100%><tr><td>
	<table border=0 cellpadding=3 cellspacing=1 width=100%><tr><td bgcolor=FFFFFF>
	<font class=\"blocktitle\">$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 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>Contributed by $informant on $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>Topic: <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) {

if (substr($title,0,4)=="مخفي") {
	echo $content;
} else {
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"150\"><tr><td>"
        ."<table bgcolor=\"#E7EFF7\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
		."<tr><td width=\"7\"><img width=\"7\" height=\"6\" src=\"themes/sky/images/rtc.gif\" border=\"0\"></td>"
		."<td height=\"6\" background=\"themes/sky/images/tb.gif\"><img src=\"images/pix.gif\" border=\"0\"></td>"
		."<td width=\"7\"><img width=\"7\" height=\"6\" src=\"themes/sky/images/ltc.gif\" border=\"0\"></td></tr>"

		."<tr>"
		."<td background=\"themes/sky/images/rb.gif\"><img width=\"7\" src=\"images/pix.gif\" border=\"0\"></td>"
		."<td align=\"center\" bgcolor=\"ffffff\">"
			."<table width=\"100%\" cellpadding=\"0\" cellspcaing=\"0\"><tr><td bgcolor=\"ffffff\">"
    	    ."<font class=\"blocktitle\"><center>$title</center></font></td></tr><tr><td bgcolor=\"ffffff\"><font class=\"content\">"
	        ."$content"
			."</font></td></tr></table>"
		."</td>"
		."<td background=\"themes/sky/images/lb.gif\"><img width=\"7\" src=\"images/pix.gif\" border=\"0\"></td>"
		."</tr>"	

		."<tr><td width=\"7\"><img width=\"7\" height=\"6\" src=\"themes/sky/images/brc.gif\" border=\"0\"></td>"
		."<td height=\"6\" background=\"themes/sky/images/bb.gif\"><img src=\"images/pix.gif\" border=\"0\"></td>"
		."<td width=\"7\"><img width=\"7\" height=\"6\" src=\"themes/sky/images/blc.gif\" border=\"0\"></td></tr>"
		."</table></td></tr></table><br>";
}

}

?>