<?php
include_once("includes/global.php");
//=================================
function showUser($is_inquery=false)
{
	if($is_inquery)
	{
		if(!empty($_COOKIE['offer_inquery']))
			$inum=count(array_unique(explode(",",$_COOKIE['offer_inquery'])));	
		return $inum?$inum:"0";
	}
	else
	{
		global $config,$db,$buid;
		$new=$inum=0;
		include($config["webroot"]."/lang/".$config['language']."/front.php");
		$b2bbuilder_auth=bgetcookie("USERID");
		$buid=$b2bbuilder_auth['0'];
		if($buid)
		{
			include_once($config["webroot"]."/module/message/includes/plugin_msg_class.php");
			$msg=new msg();
			$new=$msg->getMailNum();
			$new=$new['new'];
			if($new>0)
			{
				$mail_num=" | <BGSOUND balance=0 src='$config[weburl]/image/default/newmsg.wma' volume=-600 loop=0><a href='$config[weburl]/main.php?m=message&s=admin_message_list_inbox'><img src='$config[weburl]/image/default/notice_newpm.gif' />".$lang['new_msg']."($new)</a> ";
			}
		}
		if(!empty($_COOKIE['USER'])){
			$new = "<li>Welcome <a href='$config[weburl]/main.php'>".$_COOKIE['USER']."</a>!</li>";
			$new.= "<li><a href='$config[weburl]/main.php?action=logout'>Sign Out</a></li>";
		}else{
			$new = "<li>New user? <a href='".$config["weburl"]."/$config[regname]'>Join Free</a></li>";
			$new.= "<li><a href='".$config["weburl"]."/login.php'>Sign In</a></li>";
		}
		if(!empty($_COOKIE['offer_inquery']))
			$inum=count(array_unique(explode(",",$_COOKIE['offer_inquery'])));
		$inquiry="<li class='nbr'><a href='$config[weburl]/?m=message&s=inquiry_basket'>Inquiry Basket (<b id='inquiry_num'>$inum</b>)</a></li>";
		return $new.$inquiry;
	}
}
echo "document.write(\"".showUser($_GET['is_inquery'])."\");";
?>