<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
//v1.00 www.bcoos.net 2006-08 GPL
// Change to the foldername of your theme
define("XOOPS_THEME", "helloworld");
//  Function themeheader() - Everything that comes before stuff in the center of your site. 
function themeheader($show_rblock=0) {
global $bcoosConfig, $xoopsUser,$db;
	echo "<script type='text/javascript' src='".XOOPS_URL."/include/date.js' ></script></head>";
	//if logged
	if ($xoopsUser) { echo "<body onload='startclock();' background=''>";  }
	else { echo "<body onload='startclock();document.loginform.uname.focus();' background=''>"; }
	//open the wait box defined below at theme_waitbox function generally says loading...
	OpenWaitBox();
	//logo and banner
	echo "<table width='100%' class='main' ><tr><td>
	<table width='100%'><tr><td width='160'  align='left'class='exoops'>
	<a href='".XOOPS_URL."/'><img src='".XOOPS_URL."/images/".$bcoosConfig['logo']."' alt='".$bcoosConfig['title']."/'></a></td>
	<td colspan='2'><div align='center'>";
	showbanner();
	echo "</div></td></tr></table>
	<table width='100%'><tr><td colspan='2' ></td></tr><tr class='loginbar'>";
	//if logged
	if ($xoopsUser) { echo "<td class='loginbar' align='left' >
		&nbsp;<a href='".XOOPS_URL."/user.php'>"._VIEWACCOUNT."</a>
		&nbsp;&nbsp;<a href='".XOOPS_URL."/user.php?op=logout'>"._LOGOUT."</a>";
		list($total_messages) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("priv_msgs")." WHERE to_userid = ".$xoopsUser->getVar("uid").""));
		list($new_messages)   = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("priv_msgs")." WHERE to_userid = ".$xoopsUser->getVar("uid")." AND read_msg=0"));
		if ($total_messages > 0) {
			if ($new_messages > 0) {
				echo  "&nbsp;&nbsp;".$new_messages.": <a id='msgtxt' href='".XOOPS_URL."/viewpmsg.php' onmouseover='setBlink(0);' onmouseout='setBlink(1);'>"._NEWMESSAGES."</a><br />";
				echo  '
				<script type="text/javascript">
				<!--
				var blink    = 1;
				var blinkdom = xoopsGetElementById("msgtxt");
				function blink1() {
					blinkdom.style.visibility = "hidden";
					if (blink == 1) { setTimeout("blink2()", 500); }
					else { blinkdom.style.visibility = "visible"; }
				}
				function blink2() {
					blinkdom.style.visibility = "visible";
					if (blink == 1) { setTimeout("blink1()", 1000); }
				}
				function setBlink(val) {
					blink = val;
					blink1();
				}
				setBlink(1);
				//-->
				</script>';
			} else { echo  "&nbsp;&nbsp;"._NOMESSAGES.""; }
			echo  "&nbsp;&nbsp;".$total_messages.": <a href='".XOOPS_URL."/viewpmsg.php'>"._TOTALMESSAGES."</a>";
		} else { echo  "&nbsp;&nbsp;<a href='".XOOPS_URL."/viewpmsg.php'>"._NOMESSAGES."</a>"; }
		
		if ($xoopsUser->isAdmin()) {echo "&nbsp;&nbsp;<a href='".XOOPS_URL."/admin.php'>"._ADMINMENU."</a>"; }
		echo "&nbsp;&nbsp;</td>";
	} else { 
		echo '<form action="'.XOOPS_URL.'/user.php" name="loginform" method="post">
		<td class="loginbar"  width="300" >
		<input type="hidden" name="op" value="login" />
		&nbsp;<img src="'.XOOPS_URL.'/images/icons/'.$bcoosConfig['iconset'].'user.gif" alt="username" align="absmiddle" />
		&nbsp;<input type="text" class="login" size="10" name="uname"  />
		<img src="'.XOOPS_URL.'/images/icons/'.$bcoosConfig['iconset'].'key.gif" alt="password" align="absmiddle" />
		&nbsp;<input type="password" class="login" size="10" name="pass" />
		<input type="image" name="submit" src="'.XOOPS_URL.'/images/icons/'.$bcoosConfig['iconset'].'pen.gif" alt="login" align="absmiddle"  />
		</td>
		</form>
		<td class="loginbar">
		<a href="'.XOOPS_URL.'/register.php">
		<img src="'.XOOPS_URL.'/images/icons/'.$bcoosConfig['iconset'].'register.gif" alt="register" align="absmiddle"  ></a>
		<a href="'.XOOPS_URL.'/user.php#lost">
		<img src="'.XOOPS_URL.'/images/icons/'.$bcoosConfig['iconset'].'lostpass.gif" alt="lostpass" align="absmiddle" ></a></td>';
	} 
	echo '<form id="pagesearch" action="'.XOOPS_URL.'/search.php" method="post">
	<td class="loginbar" align="right">
	<img style="cursor: hand;" onclick="xoopsGetElementById(\'pagesearch\').submit();" align="absmiddle" src="'.XOOPS_URL.'/images/icons/'.$bcoosConfig['iconset'].'search.gif" alt="search" />
	<input type="text" class="login" name="query" size="23" />
	<input type="hidden" name="action" value="results" />
	</td></form>
	</tr></table>
	<table><tr>
	<td background="" id="leftblocks" name="leftblocks" align="left" valign="top" class="sidebar1" >';
	make_sidebar("left");
	echo '</td><td width="100%" valign="top">
	<table class="sidboxtitle" width="100%"  background=""><tr>
	<td width="1"><img style="cursor: hand;" onclick="toggleDisplay(\'leftblocks\');" src="'.XOOPS_URL.'/images/icons/'.$bcoosConfig['iconset'].'sidebar.gif" align="absmiddle" alt="'._TOGGLE.'" /></td>
	<td><div class="myclock" align="right" id="myclock">&nbsp;</div></td>
	<td width="1"><img style="cursor: hand;" onclick="toggleDisplay(\'rightblocks\');" src="'.XOOPS_URL.'/images/icons/'.$bcoosConfig['iconset'].'sidebar.gif" align="absmiddle" alt="'._TOGGLE.'" /></td>
	</tr></table>';
}
// Function themefooter() - This is everything that appears right after any center stuff 
function themefooter($show_rblock=0, $footer='') {
	echo "<br /></td>";
	if ($show_rblock) {
		echo '<td id="rightblocks" name="rightblocks" align="right" valign="top" class="sidebar2">';
		make_sidebar("right");
		echo '</td>';
	} else { echo "<td width='1' id='rightblocks' style='display:none;'>&nbsp;</td>"; } 
	echo '</tr></table></td></tr></table>';
	
	echo '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
	<td class="footer" align="center">'.$footer.'</a></td>
	</tr></table>
	</td></tr></table>';	
}
				//side blocks
// Function themesidebox_left()  - Controls the look of your left blocks. 
function themesidebox_left($title='', $content) {
	echo "<div class='sidblocktitle'>$title</div>
	<div class='sidblockcontent'>$content</div>";
}
//Function themesidebox_right()  - Controls the look of your right blocks. 
function themesidebox_right($title='', $content) {
	echo "<div class='sidblocktitle' align='left'>$title</div>
	<div class='sidblockcontent'>$content</div>";
}
				//center blocks
// Function themecenterbox_left()  - Controls the look of your left-center blocks.
function themecenterbox_left($title='', $content) {
	echo "<div class='centerblocktitle'>$title</div>
	<div class='centerblockcontent'>$content</div>";
}
// Function themecenterbox_center()  - Controls the look of your center-center blocks.
function themecenterbox_center($title='', $content) {
echo "<div class='centerblocktitle'>$title</div>
	<div class='centerblockcontent'>$content</div>";
}
// Function themecenterbox_right()  - Controls the look of your right-center blocks.
function themecenterbox_right($title='', $content) {
echo "<div class='centerblocktitle'>$title</div>
	<div class='centerblockcontent'>$content</div>";
}
// Function themenews() - This function formats the stories on your homepage  
function themenews($poster,$time,$title,$counter,$thetext,$timglink,$adminlink,$morelink='') {
	echo '<table width="100%" class="news" ><tr>
		<td align="left">'.$title.'</td>
		<td align="right">'.$poster.' '._ON.' '.$time.' '.$counter.' '._READS.'</td>
	</tr><tr>
		<td colspan="2"></td>
	</tr><tr>
		<td colspan="2"><p>'.$timglink.' '.$thetext.'</p></td>
	</tr><tr>
		<td>&nbsp;</td><td align="right">'.$adminlink.' '.$morelink.'</td>
	</tr></table><br />';
}
// Function themecenterposts() - Controls the look of various center blocks  Like when you preview posts in the forum & news 
function themecenterposts($title='', $content) {
	echo "$title<br />
	$content<br />";
}
// Function theme_waitbox()  - Controls the look of the waitbox when it's turned on  
function theme_waitbox() {
global$bcoosConfig;
echo "<table cellpadding='3' cellspacing='3' class='waitbox'><tr><td align='center'>
<b><big>"._LOADING."</big></b><br />
<img src='".XOOPS_URL."/images/icons/".$bcoosConfig['iconset']."await.gif' alt='' /><br />
"._PLEASEWAIT."
</td></tr></table>";
}
// Function theme_post() - Used for displaying thread content for comments in various modules.
function theme_post(
			$subject,
			$text,
			$color_number='',
			$subject_image='',
			$post_date='',
			$ip_image='',
			$reply_image='',
			$edit_image='',
			$delete_image='',
			$username='',
			$rank_title='',
			$rank_image='',
			$avatar_image='',
			$reg_date='',
			$posts='',
			$user_from='',
			$online_image='',
			$profile_image='',
			$pm_image='',
			$email_image='',
			$www_image='',
			$icq_image='',
			$aim_image='',
			$yim_image='',
			$msnm_image=''
			) {
if ($color_number == 1) {
	$bg1 = 'bg1';
	$bg2 = 'bg3';
	} else {
		$bg1 = 'bg3';
		$bg2 = 'bg1';
	}
?>
<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%"><tr>
<td class="bg2">
	  <table width="100%" border="0" cellspacing="1" cellpadding="2">
        <tr class="<?php echo $bg1;?>" align="left" >  
          <td width="140" ><b><?php echo $username?> </b></td>
          <td><?php echo $subject_image;?> <b><?php echo $subject;?></b>&nbsp;-&nbsp;<i><?php echo $post_date;?></i>&nbsp;&nbsp;<?php echo $ip_image;?> 
            <?php echo $delete_image;?> <?php echo $edit_image;?> <?php echo $reply_image;?> </td>
          <td width="20%" ><center><?php echo $pm_image;?> <?php echo $email_image;?> <?php echo $www_image;?> 
              <?php echo $icq_image;?> <?php echo $aim_image;?> <?php echo $yim_image;?> 
              <?php echo $msnm_image;?></center> </td>
        </tr>
        <tr class="<?php echo $bg1;?>" align="left">  
          <td ><?php echo $rank_image, $posts;?><br /> 
            <?php echo $rank_title;?><br /> <br /> <div align="center"><?php echo $avatar_image;?></div>
            <!-- SPACER IMAGE -->
            <img width="105" height="1" src="<?php echo XOOPS_URL;?>/images/pixel.gif"></td>
          <td colspan="2" valign="top" ><table border="0">
              <tr> 
                <td><?php echo $text;?></td>
              </tr>
            </table></td>
        </tr>
      </table> </td>
</tr></table>
<?php
}
/* OpenTable Functions - The look of certain tables opend/closed in variousparts of xoops, like                                                 
 the tables in the center of the admin section, and in various modules   */
function OpenTable($width='100%') {
	echo "<table width='$width'><tr><td valign='top'>
	<table width='100%' ><tr class='bg1'><td valign='top'>";
}
function CloseTable() {
	echo "</td></tr></table></td></tr></table>";
}
?>
