/**
 * @param sorce String src of js file
 * @param autoRemove Bool
 * @param id String Element's id when autoRemove:false
 * @author zhys99@gmail.com
 * @date 10-12-2007 dd-mm-yyyy
 * @todo Load javascript file async
 */
function jLoader (source,autoRemove,id, charset){
	id = id||"";
	charset = charset||"gb2312";
	autoRemove = autoRemove||false;
	var b=document.getElementsByTagName("head")[0];
	var c=document.createElement("script");
	c.type="text/javascript";
	c.charset=charset;
	if(id){
		c.id = id;
	}
	c.src=source;
	var remove=function(){
		c.onload=null;
		var h=c.parentNode;
		h.removeChild(c);
		delete c;
	};
	var e=function(h){
		var j=(h?h:window.event).target?(h?h:window.event).target:(h?h:window.event).srcElement;
		if(j.readyState=="loaded"||j.readyState=="complete")
		{
			j.onreadystatechange=null;
			if(autoRemove){
				remove();
			}
		}
	};
	if(navigator.product=="Gecko"&&autoRemove){
		c.onload=remove;
	}
	else{
		c.onreadystatechange=e;
	}
	b.appendChild(c);
}
function getCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while(i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) {
			var endstr = document.cookie.indexOf(";", j);
			if(endstr == -1) {
				endstr = document.cookie.length;
			}
			return unescape(document.cookie.substring(j, endstr));
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if(i == 0) break;
	}
	return "";
}
/* 
 * @author zhys9
 * @date 20071010
 * @param String string URL
 * @return Object oRs
 * e.g. input: 'http://so.56.com/index?type=video&key=aaa'
 * 		ouput: {'type':video, 'key':'aaa'}
 */
function parse_str(string){
	var a = [];
	var oRs = {};
	var query = string.substr(string.indexOf('?')+1);
	var tmp = query.split('&');
	var k;
	for(var i=0;i<tmp.length;i++){
		a = tmp[i].split('=');
		oRs[a[0]] = a[1];
	}
	return oRs;
}
/**
 * @author zhys9
 * @copyright 56.com
 * @todo menu global
 */
var _G_56_Menu = {};
_G_56_Menu.e = function(s){
	if(document.location.href.indexOf(s)!=-1) {
		return ' class="current"';
	}else{
		return '';
	}
}
_G_56_Menu.showHeader = function () {
	//sms
	//document.write('<script type="text/javascript" src="http://www.56.com/js/msg/lib.sms.blink.js" charset="utf-8"></script>');
	document.write('<script type="text/javascript" src="http://www.56.com/js/msg/lib.sms.send.js" charset="utf-8"></script>'); //2009-10-20
	
	//style
	var style = '<link href="http://www.56.com/admin/style/manager/admin_center_09v3/admin_090927.css" type="text/css" rel=stylesheet />';
	var headerHtml = '<div id="Head">'+
	'  <div class="narrow">'+
	'    <!--Logo-->'+
	'		<div id="Logo"> <a href="http://www.56.com/" title="56网" target="_blank"><img src="http://www.56.com/admin/style/manager/admin_center_09v3/ac_logo.gif" /></a> </div>'+
	'    <!--HelpMenu-->'+
	'		<div id="HelpMenu"><div class="sysInfo" id="_sysInfo">'+
	( gLoginUser ? '您好,<a  href="http://'+ gLoginUser +'.56.com/" class="user_name" target="_blank">'+(gLoginUserNickName?gLoginUserNickName:gLoginUser)+'</a> | ' : '' )+
	
	(
	gLoginUser 
		?
	'			<a href="http://account.56.com/uinfo/Profile/" target="_blank">帐户</a> | '+
	'			<a href="http://pay.56.com/" target="_blank">充值</a> | '+
	'			<a href="http://www.56.com/help/" target="_blank">帮助</a> | ' +
	'			<a href="http://space.56.com/php/logout.php" class="quit">退出</a></div> '+
	'		</div><!--end HelpMenu-->'+
	'		<!--MainMenu-->'+
	'		<div id="MainMenu">'+
	'			<div class="TabMenu">'+
	'				<!--一级导航-->'+
	'				<ul id="M1">'+
//	'					<li'+this.e('uv.modify')+'><a id="Space" href="http://www.56.com/h11/uv.modify_New_20080916.php" target="_self">空间管理</a></li>'+
	'					<li '+this.e('/home/')+'><a href="http://www.56.com/h'+(Math.floor(Math.random()*88)+11)+'/home/" target="_self">管理中心</a></li>'+
	'					<li><a href="http://www.56.com/" target="_self">首页</a></li>'+
	'					<li><a href="http://so.56.com/videolist-type-hot.html" target="_self">视频</a></li>'+
	'					<li><a href="http://www.56.com/w/album_list-type-today.html" target="_self">专辑</a></li>'+
	'					<li><a href="http://www.56.com/w11/space_index.phtml" target="_self">空间</a></li>'+
	'					<li><a href="http://tieba.56.com/" target="_self">贴吧</a></li>'+
	'					<li class="last"><a href="http://youxi.56.com/" target="_blank">网游</a></li>'+
	'				</ul><!--一级导航-->'+
	'			</div>'+
	'		</div>'
		: 
	'		<a href="http://w.56.com/userLogin.php">登录</a> | ' +
	'		<a class="reg" href="http://urs.56.com/Reg1.php">注册</a> |'+
	'		<a href="http://www.56.com/help/" target="_blank">帮助</a>' +
	'	</div><!--end HelpMenu-->'
	)+
	'    </div>'+
	'  </div><!--narrow-->'+
	'</div><!-- Head End-->';
	document.write(style);
	document.write(headerHtml);
};
_G_56_Menu.showLeftMenu = function() {
	if(!document.getElementById("_LeftMenu")) {
		document.write('<div class="sideMenu" id="_LeftMenu"></div>');
	}
	var i=0;
	if(gLoginUser) {	//登录用户
		var app_list = '<!--LeftMenu Star-->'+
	'	<div id="LeftMenu">'+
	'		<!--prdMenu-->'+
	'		<ul class="side_nav">'+
	'			<li id="leftMenuLi_'+(++i)+'" '+(this.e('/home/') ||this.e('/my/')|| this.e('action=Upload')||this.e('superupload') || this.e('action=Vlist&pct=u') || this.e('videoList&pct=u') || this.e('admin_rss') || this.e('/addvideo.php')||this.e('admin_edit.php?big=y&pct=u') ||this.e('/2008/index.html') || this.e('addvideo.php?action=select&videoUrl') || this.e('/share.php'))+'>'+
	'			 <h3><a href="javascript:void(0)" onclick="_G_56_Menu.ToggleMenu(this)" hidefocus="true">视频</a></h3>'+
	'			 <ul>'+
	'				<li'+(this.e('upload_flash')||this.e('admin_upload')||this.e('action=Upload')||this.e('superupload'))+'><a  href="http://v.56.com/admin_upload_flash.php?m=web"  hidefocus="true" target="_self">上传视频</a></li>'+
	'				<li'+(this.e('mode=list&pct=u')||this.e('action=Vlist&pct=u')||this.e('admin_edit.php?big=y&pct=u') ||this.e('/2008/index.html') || this.e('addvideo.php?action=select&videoUrl') || this.e('share.php') || this.e('/addvideo.php') )+'><a href="http://w.56.com/admin/?mode=list&pct=u"  hidefocus="true" target="_self">我的上传视频</a></li>'+
	'				<li'+this.e('videoList')+'><a href="http://w.56.com/admin/fav.php?action=videoList&pct=u"  hidefocus="true" target="_self">我的收藏视频</a></li>'+
	'				<li'+this.e('admin_rss')+'><a href="http://v.56.com/2008/admin_rss.php"  hidefocus="true" class="last">我的订阅</a></li>'+
	'			 </ul>'+
	'			</li>'+
	'		'+
	'			<li id="leftMenuLi_'+(++i)+'" '+ (this.e('add_album.p') || this.e('my_album_list') || this.e('videoList&pct=a') || this.e('add_album_step2.php') || this.e('edit_album.php') || this.e('album_share.php') || this.e('del_album.php') || this.e('/edit_album.php') || this.e('delvideo.php')) +'>'+
	'			 <h3><a href="javascript:void(0)" onclick="_G_56_Menu.ToggleMenu(this)" hidefocus="true">专辑</a></h3>'+
	'			 <ul>'+
	'				<li'+this.e('add_album.p')+'><a href="http://w.56.com/add_album.php" target="_self" class="op"  hidefocus="true">制作专辑</a></li>'+
	'				<li'+(this.e('my_album_list') || this.e('add_album_step2.php') || this.e('edit_album.php') || this.e('album_share.php') || this.e('del_album.php') || this.e('/edit_album.php') || this.e('delvideo.php'))+'><a href="http://w.56.com/my_album_list.php" target="_self"  hidefocus="true">我的专辑</a></li>'+
	'				<li'+this.e('videoList&pct=a')+'><a href="http://w.56.com/admin/fav.php?action=videoList&pct=a"  hidefocus="true" class="last">我的收藏专辑</a></li>'+
	'			 </ul>'+
	'			</li>'+
	'		'+
	'			<li id="leftMenuLi_'+(++i)+'" ' + (this.e('/m2v/') ||this.e('mode=list&pct=p') || this.e('videoList&pct=p') || this.e('2008/edit.php')) + '>'+
	'			 <h3><a href="javascript:void(0)" onclick="_G_56_Menu.ToggleMenu(this)" hidefocus="true">相册视频</a></h3>'+
	'			 <ul>'+
	'				<li'+this.e('/m2v/')+'><a href="http://www.56.com/m2v/" target="_blank" class="op"  hidefocus="true">制作相册视频</a></li>'+
	'				<li'+(this.e('mode=list&pct=p') || this.e('2008/edit.php'))+'><a href="http://w.56.com/admin/index.php?mode=list&pct=p" target="_self"  hidefocus="true">我的相册视频</a></li>'+
	'				<li'+this.e('videoList&pct=p')+'><a href="http://w.56.com/admin/fav.php?action=videoList&pct=p"  hidefocus="true" class="last">相册视频收藏</a></li>'+
	'			 </ul>'+
	'			</li>'+
	'		'+
	'			<li id="leftMenuLi_'+(++i)+'" '+ (this.e('rec_2009')|| this.e('mode=list&pct=l')) +'>'+
	'			 <h3><a href="javascript:void(0)" onclick="_G_56_Menu.ToggleMenu(this)" hidefocus="true">录制视频</a></h3>'+
	'			 <ul>'+
	'				<li'+this.e('rec_2009')+'><a href="http://www.56.com/flashApp/rec_2009/v2.9.html" target="_self" class="op"  hidefocus="true">录制视频</a></li>'+
	'				<li'+this.e('mode=list&pct=l')+'><a href="http://w.56.com/admin/?mode=list&pct=l" target="_self"  hidefocus="true" class="last">我的录制视频</a></li>'+
	'			 </ul>'+
	'			</li>'+
	'		'+
	'			<li id="leftMenuLi_'+(++i)+'" '+(this.e('uv.modify') || this.e('uv.blog') || this.e('uv.mycsslist') || this.e('uv.csslist'))+'>'+
	'			 <h3><a href="javascript:void(0)" onclick="_G_56_Menu.ToggleMenu(this)" hidefocus="true">空间</a></h3>'+
	'			 <ul>'+
	'				<li'+this.e('uv.modify')+'><a href="http://www.56.com/h17/uv.modify.php" target="_self" class="op"  hidefocus="true">修改资料</a></li>'+
	'				<li'+this.e('uv.blog')+'><a href="http://www.56.com/h17/uv.blog.php" target="_self"  hidefocus="true">修改大字报</a></li>'+
	'				<li'+this.e('uv.mycsslist')+'><a href="http://www.56.com/h17/uv.mycsslist.php"  hidefocus="true">管理我的模板</a></li>'+
	'				<li'+this.e('uv.csslist')+'><a href="http://www.56.com/h17/uv.csslist.php?type=allshare&good=1"  hidefocus="true" class="last">模板共享中心</a></li>'+
	'			 </ul>'+
	'			</li>'+
	'		'+
	'			<li id="leftMenuLi_'+(++i)+'" '+(this.e('comment.') || this.e('comment_other') || this.e('admin_comment_bad') )+'>'+
	'			 <h3><a href="javascript:void(0)" onclick="_G_56_Menu.ToggleMenu(this)" hidefocus="true">评论</a></h3>'+
	'			 <ul>'+
	'				<li'+this.e('comment.')+'><a href="http://www.56.com/admin/comment.html" target="_self" class="op"  hidefocus="true">给我的评论</a></li>'+
	'				<li'+(this.e('comment_other'))+'><a href="http://images.56.com/js/0929/comment_other.html" target="_self"  hidefocus="true">我发表的评论</a></li>'+
	'				<li'+this.e('admin_comment_bad')+'><a href="http://v.56.com/2008/admin_comment_bad.php" target="_self"  hidefocus="true" class="last">评论黑名单管理</a></li>'+
	'			 </ul>'+
	'			</li>'+
	'		'+
	'			<li id="leftMenuLi_'+(++i)+'" '+(this.e('msg') ||  this.e('ufriend') || this.e('/uinfo/') || this.e('pay') || this.e('RenRen') )+'>'+
	'			 <h3><a href="javascript:void(0)" onclick="_G_56_Menu.ToggleMenu(this)" hidefocus="true">其他功能</a></h3>'+
	'			 <ul>'+
	'				<li'+this.e('msg')+'><a href="http://msg.56.com/" target="_self" class="op"  hidefocus="true">短消息</a></li>'+
	'				<li'+this.e('ufriend')+'><a href="http://account.56.com/ufriend/" target="_self"  hidefocus="true">好友</a></li>'+
	'				<li'+this.e('/uinfo/')+'><a href="http://account.56.com/uinfo/Profile/"  hidefocus="true">个人资料</a></li>'+
	'				<li'+this.e('pay')+'><a href="http://pay.56.com/" target="_blank"  hidefocus="true">充值中心</a></li>'+
	'			 </ul>'+
	'			</li>'+
	'		'+
	'			<li id="leftMenuLi_'+(++i)+'" '+(this.e('foto')||this.e('music')||this.e('admin_game')||this.e('pig')||this.e('app_list')||this.e('gift')|| this.e('/vote/')|| this.e('/ym8/') || this.e('startTest')|| this.e('/share/'))+'>'+
	'			 <h3><a href="javascript:void(0)" onclick="_G_56_Menu.ToggleMenu(this)" hidefocus="true">组件</a></h3>'+
	'			 <ul>'+
	'				<li'+this.e('foto')+'><a href="http://app.56.com/foto" target="_self" class="op"  hidefocus="true">趣图</a></li>'+
	'				<li'+this.e('music')+'><a href="http://music.56.com/index.php?action=toplist&amp;type=top100" target="_self"  hidefocus="true">音乐盒</a></li>'+
	'				<li'+this.e('admin_game')+'><a href="http://www.56.com/images/games/admin_game.html"  hidefocus="true">网页游戏</a></li>'+
	'				<li'+this.e('pig')+'><a href="http://app.56.com/pig/" target="_self"  hidefocus="true">养猪</a></li>'+
	'				<li'+this.e('app_list')+'><a href="http://app.56.com/index.php?action=app_list" target="_self"  hidefocus="true">火星游戏</a></li>'+
	'				<li'+this.e('gift')+'><a href="http://app.56.com/gift/" target="_self"  hidefocus="true">礼 物</a></li>'+
	'				<li'+this.e('ym8')+'><a href="http://app.56.com/ym8/" target="_self"  hidefocus="true">郁闷吧</a></li>'+
	'				<li'+this.e('vote')+'><a href="http://app.56.com/vote/" target="_self"  hidefocus="true">投 票</a></li>'+
	'				<li'+this.e('startTest')+'><a href="http://friend.reg.56.com/index.php?action=namesTest&amp;do=startTest" target="_self"  hidefocus="true">缘分测试</a></li>'+
	'				<li'+this.e('/share/')+'><a href="http://app.56.com/share/?action=share&amp;do=hot&amp;state=1" target="_self"  hidefocus="true" class="last">分 享</a></li>'+
	'			 </ul>'+
	'			</li>'+
	'		'+
	'		</ul>'+
	'	</div><!--LeftMenu End-->';
		document.getElementById("_LeftMenu").innerHTML = app_list;
		//if(this.TIndex('app_list') || this.TIndex('gift') || this.TIndex('ym8') || this.TIndex('vote') || this.TIndex('namesTest') || this.TIndex('share')) _G_56_Menu.ToggleMoreLeftMenu(this);
	}else{
		var menu = '<div class="login_area">'+
					'<h2>登陆56网</h2>'+
					' <form method="post" name="userLogin" action="http://space.56.com/php/urs.php" target="_top">'+
					'  <label for="userName">用户名：</label>'+
					'  <input id="userName" name="username" type="text" value="" class="inp_txt" />'+
					'  <label for="userPassword">密 码：</label>'+
					'  <input id="userPassword" name="password" type="password" value="" class="inp_txt" />'+
					'  <input type="hidden" name="ourl" value="'+document.location.href+'" />'+
					'  <label for="remember"><input name="autoLogin" id="remember" type="checkbox" value="true" checked>记住登录状态</label>'+
					'  <p class="btn"><input type="submit" class="btn_login" value="" /> ' +
//					'  <a href="http://urs.56.com/servlet/Rps1">忘记密码</a>'+
					'  <button class="btn_reg" onclick="window.location.href=\'http://urs.56.com/Reg1.php\'"></button></p>'+
					' </form>'+
					'</div>';
		document.getElementById("_LeftMenu").innerHTML = menu;
	}
};
_G_56_Menu.TIndex = function(str) {
	if(window.location.href.indexOf(str) >= 0) return true;
	else return false;
}; 
_G_56_Menu._showLeftMenu = function(data){
	var show_num = 15;
	var app_arr = [];
	
};
_G_56_Menu.ToggleMoreLeftMenu = function(el){
	var o = document.getElementById('_LeftMenuMore');
	if(o.style.display=='none') {
		o.style.display='';
		el.innerHTML = '<a class="close" href="javascript://">收起</a>';
	}else{
		o.style.display='none';
		el.innerHTML = '<a class="open" href="javascript://">展开</a>';
	}
};
_G_56_Menu.ToggleMenu = function(el){
	while(!el.id || el.id.substr(0,11)!="leftMenuLi_") {
		el=el.parentElement?el.parentElement:el.parentNode;
	}
	if(el.className=='current') {
		el.className='';
		return false;
	}else{
		//_G_56_Menu.CloseAll();
		el.className='current';
	}
};
_G_56_Menu.CloseAll = function(){
	if(this.mainMenu==undefined) {
		this.mainMenu=[];
		var lis=document.getElementById("LeftMenu").getElementsByTagName("LI");
		for(var i=0;i<lis.length;i++) {
			if(lis[i].id && lis[i].id.substr(0,11)=="leftMenuLi_") {
				this.mainMenu.push(lis[i]);
			}
		}
	}
	for(var o in this.mainMenu) {this.mainMenu[o].className='';}
};

var APP_CENTER = APP_CENTER_ROOT = "http://app.56.com/";
var _get = parse_str(document.location.href);
_get["app_id"] = _get["app_id"]?_get["app_id"]:(_get["g_id"]?_get["g_id"]:0);
gLoginUser = getCookie("member_id").replace(/(@.*)/,"");
gLoginUser = /guest\d{10}/.test(gLoginUser) ? null : gLoginUser;
gLoginUserNickName = decodeURIComponent&&getCookie("user_nickname_js").length?decodeURIComponent(getCookie("user_nickname_js")):"";
var _page_={};
