if(!islogin) var islogin =0;
String.prototype.leftB=function(len){
	var s=this.replace(/\*/g," ").replace(/[^\x00-\xff]/g,"**")
	return this.slice(0,s.slice(0,len).replace(/\*\*/g," ").replace(/\*/g,"").length)
}
var conf_quanzilogo = {
	normal : 'http://www.sinaimg.cn/book/2009/images/q/q_logo.gif',
	blog : 'http://www.sinaimg.cn/book/2009/images/q/blog_logo.gif',
	game :  'http://www.sinaimg.cn/book/2009/images/q/q_logo.gif',
	music : 'http://www.sinaimg.cn/book/2009/images/q/q_logo.gif',
	eladies : 'http://www.sinaimg.cn/book/2009/images/q/blog_logo.gif',
	sports : 'http://www.sinaimg.cn/pay/quanzi/y-lining/liningLogoSina.jpg',
	lining : 'http://www.sinaimg.cn/book/2009/images/bar/ly_logo1.gif',
	photo: 'http://www.sinaimg.cn/book/2009/images/q/photo_logo.gif',
	colleague : 'http://www.sinaimg.cn/book/2009/images/q/q_logo.gif',
	mate : 'http://www.sinaimg.cn/book/2009/images/q/q_logo.gif'
	};
var conf_channlmainpage = {
	normal : 'http://q.sina.com.cn',
	blog : 'http://blog.sina.com.cn',
	game : 'http://games.sina.com.cn',
	music : 'http://music.sina.com.cn/shequ/q/',
	eladies : 'http://eladies.sina.com.cn',
	sports : 'http://sports.sina.com.cn',
	lining : 'http://lining.sina.com.cn',
	photo: 'http://q.photo.sina.com.cn',
	colleague : 'http://q.sina.com.cn',
	mate : 'http://q.sina.com.cn'
	};
if(apptype=='photo'){
	thisalt = '新浪相册';
	thisregurl = 'http://photo.sina.com.cn/reg/register.php';
	thishelp = 'http://photo.sina.com.cn/help.php';
}else{
	thisalt = '新浪圈子';
	thisregurl = 'http://login.sina.com.cn/hd/reg.php?entry=quanzi';
	thishelp = 'http://blog.sina.com.cn/help/';
}
if(group_domain == "http://q.sina.net/")
	group_domain = "http://q.sina.com.cn/";
function sendsearch(fm)
{
	var searchtype = fm.searchtype.value;
	var searchtext = fm.searchtext.value;
	
	if(searchtext.replace(/^\s+|\s+$/g, '')=='')
	{
		alert("请输入查询内容");
		return;
	}
	if(searchtype == 0)
	{
		window.open(group_domain+groupinfo.domain+'/article_new/&searchtype=title&searchtext='+encodeURIComponent(searchtext)+'&start=1');
	} else if(searchtype == 4){
		fm.action = group_domain+"forum_search.php";
		fm.submit();
	}else
	{
		fm.action = group_domain+"search_result.php";
		fm.submit();
	}
}

if(apptype == 'space')
{
  if(typeof(apptypevalue)=='undefined' || apptypevalue=="" || apptypevalue==null){
	apptype='normal';
  }else{
    if(apptypevalue==11){
		apptype='colleague';
	}else if(apptypevalue==12){
		apptype='mate';
	}	
  }
}
document.write('\
<!--head-->\
<div id="top_bar_bg">\
<div id="top_bar">\
');
if(islogin) {
var sub_loginname = myloginname.length>10 ? myloginname.substr(0,8)+'..' : myloginname;
   
    if(apptype == "photo"){
		document.write('<div id="person_info" style="width:178px;margin-right:7px;padding-right:0px">\
		<span style="width:140px">'+sub_loginname+'&nbsp;&nbsp;<a href="'+group_domain+'logout.php" title="退出">退出</a>\
		<em>\
		<a target="_blank" href="'+group_domain+'myindex.php" title="我的相册圈">我的相册圈</a>>> <a target="_blank" href="http://photo.sina.com.cn/u/' + myuid + '" title="我的相册">我的相册</a>>>\
		</em>\
		</span><a target="_blank" href="'+group_domain+'myindex.php" title="进入个人中心" id="person_img"><img src="'+myicon+'" width="26" height="26" /></a>\
		</div>');
	}else if(apptype == "lining"){
		document.write('<div id="person_info" style="margin-right:7px;padding-right:0px">\
		<span>'+sub_loginname.leftB(10)+'&nbsp;&nbsp;<a href="'+group_domain+'logout.php" title="退出">退出</a>\
		<em>\
		<a target="_blank" href="'+group_domain+'myindex.php" title="进入个人中心">进入个人中心</a>&gt;&gt;\
		</em>\
		</span><a target="_blank" href="'+group_domain+'myindex.php" title="进入个人中心" id="person_img"><img src="'+myicon+'" width="26" height="26" /></a>\
		</div>');
	}else{
		document.write('<div id="person_info" style="margin-right:7px;padding-right:0px">\
		<span>'+sub_loginname.leftB(10)+'&nbsp;&nbsp;<a href="'+group_domain+'logout.php" title="退出">退出</a>\
		<em>\
		<a target="_blank" href="http://profile.blog.sina.com.cn/circle.php?uid='+myuid+'" title="我的圈子">我的圈子</a>&gt;&gt;\
		</em>\
		</span><a target="_blank" href="http://q.sina.com.cn/u/'+myuid+'" title="我的圈子" id="person_img"><img src="'+myicon+'" width="26" height="26" /></a>\
		</div>');
	}
}else{
document.write('<div id="person_info" style="width:90px;">\
<span style="line-height:28px;width:85px;"><a href="http://login.sina.com.cn/hd/signin.php?entry=quanzi" title="登录" style="color:#F00">登录</a>&nbsp;&nbsp;\
<a target="_blank" href="'+ thisregurl +'" title="注册">注册</a>\
</span>\
</div>');
}
var _key="　　　"
if(islogin){_key=""}
if(apptype == "photo"){
	document.write('\
<div id="top_nav" style="padding-right:0px">\
<a target="_blank" href="http://photo.sina.com.cn" title="相册首页">相册首页</a>\
<a target="_blank" href="http://q.sina.com.cn" title="圈子首页">圈子首页</a>\
<a target="_blank" href="http://www.sina.com.cn" title="新浪首页">新浪首页</a>\
');
}else if(apptype == "colleague"){
document.write('\
<div id="top_nav" style="padding-right:0px">\
<a target="_blank" href="'+group_domain+'workplaceall.php" title="全部同事圈">全部同事圈</a>'+_key+'\
<a target="_blank" href="http://www.sina.com.cn" title="新浪首页">新浪首页</a>\
<a target="_blank" href="http://q.sina.com.cn" title="圈子首页">圈子首页</a>\
');
}else if(apptype == "mate"){
document.write('\
<div id="top_nav" style="padding-right:0px">\
<a target="_blank" href="'+group_domain+'univall.php" title="全部同学圈">全部同学圈</a>'+_key+'\
<a target="_blank" href="http://www.sina.com.cn" title="新浪首页">新浪首页</a>\
<a target="_blank" href="http://q.sina.com.cn" title="圈子首页">圈子首页</a>\
');
}else{
document.write('\
<div id="top_nav" style="padding-right:0px">\
<a target="_blank" href="'+group_domain+'catagory.php" title="圈子分类"></a>'+_key+'\
<a target="_blank" href="http://www.sina.com.cn" title="新浪首页">新浪首页</a>\
<a target="_blank" href="http://q.sina.com.cn" title="圈子首页">圈子首页</a>\
');
}
if(apptype=='blog')
{
	document.write('<a target="_blank" href="http://q.blog.sina.com.cn" title="博客圈">博客圈</a>');
}
if(apptype=='game')
{
	document.write('<a target="_blank" href="http://q.games.sina.com.cn" title="游戏公会">游戏公会</a>');
}
if(apptype=='music')
{
	document.write('<a target="_blank" href="http://q.music.sina.com.cn" title="粉丝圈">粉丝圈</a>');
}
document.write('<a target="_blank" href="'+ thishelp +'" title="帮助" id="help">帮助</a>');

document.write('\
</div>\
<div id="main_logo">\
<a target="_blank" href="'+conf_channlmainpage[apptype]+'" title= '+ thisalt +' id="logolink"><img id="logo" src="'+conf_quanzilogo[apptype]+'" alt= '+ thisalt +' /></a>\
</div>\
<div id="advertisement" style="padding-top:0px;width:360px">\
	<form name="fm_search" id="fm_menu_search" method="get" target="_blank" onsubmit="sendsearch(this);return false;" >\
	<select name="searchtype" id="menu_searchtype" class="ntr_slt" style="margin:0px;width:72px">\
		<option value="9">圈子搜索</option>');
document.write('<option value="4">帖子搜索</option>');
if(apptype == "colleague"){
document.write('\
	</select><input name="sort" type="hidden" value="0"/>\
	<input type="text" name="searchtext" id="menu_searchtext" class="keyword" style="width:110px"/>\
	<input type="submit" value="" style="background:url(http://image2.sina.com.cn/pay/quanzi/order/search.gif);border:0px;width:74px;height:24px;cursor: pointer;" title="搜索"/>\
	<input type="button" value="" style="background:url(http://www.sinaimg.cn/pay/quanzi/order/createts.gif);border:0px;width:80px;height:24px;cursor: pointer;" onclick="location.href=\''+group_domain+'createcolleague.php\'" title="创建同事圈"/>\
	</form>\
</div>\
</div>\
</div>\
');
}else if(apptype == "mate"){
document.write('\
	</select><input name="sort" type="hidden" value="0"/>\
	<input type="text" name="searchtext" id="menu_searchtext" class="keyword" style="width:110px"/>\
	<input type="submit" value="" style="background:url(http://image2.sina.com.cn/pay/quanzi/order/search.gif);border:0px;width:74px;height:24px;cursor: pointer;" title="搜索"/>\
	<input type="button" value="" style="background:url(http://www.sinaimg.cn/pay/quanzi/order/createtx.gif);border:0px;width:80px;height:24px;cursor: pointer;" onclick="location.href=\''+group_domain+'createmate.php\'" title="创建同学圈"/>\
	</form>\
</div>\
</div>\
</div>\
');
}else{
document.write('\
	</select><input name="sort" type="hidden" value="0"/>\
	<input type="text" name="searchtext" id="menu_searchtext" class="keyword" style="width:110px"/>\
	<input type="submit" value="" style="background:url(http://image2.sina.com.cn/pay/quanzi/order/search.gif);border:0px;width:74px;height:24px;cursor: pointer;" title="搜索"/>\
	<input type="button" value="" style="background:url(http://image2.sina.com.cn/pay/quanzi/order/create.gif);border:0px;width:74px;height:24px;cursor: pointer;" onclick="location.href=\''+group_domain+'create.php\'" title="创建圈子"/>\
	</form>\
</div>\
</div>\
</div>\
');
}
if(navigator.userAgent.indexOf("IE")==-1&&!islogin)
	document.getElementById("advertisement").style.paddingTop="8px"
//if(apptype=='game'){document.getElementById("top_nav").style.paddingRight="3px"}
function SetBbsCss(obj){
	try{
		if(obj.color!=null)
			obj.style.color=obj.color
		if(obj.size==null)
			return
		var size=new Array(7,9,12,14,18,24,30)
		obj.style.fontSize=size[obj.size-1]
	}catch(e){}
}
