            jQuery(document).ready(function($) {
				// $('#nav .one').mouseover(function(){$(this).children(".two").css("display","block");$(this).addClass('now')}).mouseout(function(){$(this).children(".two").css('display','none');$(this).removeClass('now')});
				// $('#nav .my').mouseover(function(){$('#nav .my').children(".two").css("display","block")}).mouseout(function(){$('#nav .my').children(".two").css("display","none")});
				ROOTPATH = 'http://www.bindnews.com/';
				$('a[rel*=facebox]').facebox();
				if($('#comment_num').length > 0)
				{
					var number = $('#comment_num').text();
					$('#comment_num_copy').html('<a href="#comment_num">留下'+number+'回复</a>');
				}
               });
			

            function ajaxLogin()
            {
                var email = $("input[name='email']").val();
                var passwd = $("input[name='passwd']").val();
                var remember = $("input[name='remember']").attr('checked');
                if(remember == true) var trust = 70;
                else var trust = '';
                if(checkEmail(email) == true)
                {
                    $.post('/asyn/login_get/',{email:email,passwd:passwd},function(data){if(data.ok == 1){$.each(data.user_info,function(key,value){$.cookie(key,value,{expires:trust,path:'/'})});showTip('#loginTip','^_^ 登录成功.',1);setTimeout(function(){document.location.reload()},500);}else{showTip('#loginTip','-_-!!! email或密码错误,再来一次.',0)}},'json');
                    // $.post('asyn/login_get/',{email:email,passwd:passwd},function(data){if(data.ok == 1){$.each(data.user_info,function(key,value){alert(key)});showTip('#loginTip','^_^ 登录成功.',1);setTimeout(function(){document.location.reload()},500);}else{showTip('#loginTip','-_-!!! email或密码错误,再来一次.',0)}},'json');
                }
                else
                {
                    showTip('#loginTip','-_-!!! email格式输入错误,再来一次.',0);
                }
            }

            function ajaxLogout()
            {
				// alert(ROOTPATH)
                $.getJSON('/asyn/logout/',function(data){if(data.ok == 1){$.facebox(function(){$('#faceboxTitle').html(data.title);$.facebox.reveal(data.info);setTimeout(function(){document.location.reload()},600);})}});
            }

			// 2009.06.23
            function publishNews(ok)
            {
                var title = $('#cTitle').val();
                var category = $('input[name=category]:checked').val();
                var content = $('#newsTextarea').val();
				var agree = $('#agree1').attr('checked');
                if(title == '') showTip('#callbackInfo','-_- 第一步异常:请填写标题内容.',0)
                else if(category == undefined) showTip('#callbackInfo','-_- 第二步异常:请选择新闻类别.',0)
                else if(content == '') showTip('#callbackInfo','-_- 第三步异常:没有内容的新闻不叫新闻,请填写新闻内容.',0)
                else if(agree == false) showTip('#callbackInfo','-_- 第四步异常:板凳铁律是板凳生存和发展的根本,请遵守.',0)
                if(title != '' && category != undefined && content != '' && agree == true)
                {
					var btn = $('#publishSetp1 .btn').html();
					$('#publishSetp1 .btn').html('<img src="/mainFramePics/loading.gif" alt="loading" />');
					showTip('#callbackInfo','-_- hi,信息正在提交中,waiting for it patient...',1);
					$.post('/asyn/publishNews/',{title:title,category:category,content:content,addPhoto:ok},function(data){if(data.ok == 1){showTip('#callbackInfo','^_^ 新闻发布成功,即将进入新闻浏览页.',1);setTimeout(function(){document.location = '/news/'+data.newsID+'/'},500)} else if(data.ok == 2){showTip('#callbackInfo','^_^ 新闻发布成功,即将进入图片上传页面.',1);setTimeout(function(){document.location = ROOTPATH+'addPhoto/'+data.newsID+'/'},500)} else{showTip('#callbackInfo','-_- 新闻发布失败,重新试一下,建议您备份您的内容先.',0);$('#publishSetp1 .btn').html(btn)}},'json');
                }
            }

			
			// 2009.06.23
            function publishPost(group_id)
            {
				var title = $('#pTitle').val();
				var content = $('#postTextarea').val();
				if(title == '') showTip('#callbackInfo','-_- 第一步异常:请填写标题内容.',0)
				else if(content == '') showTip('#callbackInfo','-_- 第二步异常:没有内容的新闻不叫新闻,请填写新闻内容.',0)
				if(title != '' && content != '')
				{
					$('#submitBtn').html('<img src="/mainFramePics/loading.gif" alt="loading" />');
					// $.post('asyn/publishPost.php',{title:title,content:content},function(data){if(data.ok == 1){showTip('#callbackInfo','^_^ 新闻发布成功,即将进入新闻浏览页.',1);setTimeout(function(){document.location = 'post.php?number='+data.newsID},500)},'json');
					$.post('/asyn/publishPost/',{group_id:group_id,title:title,content:content},function(data){if(data.ok == 1){showTip('#callbackInfo','^_^ 帖子发布成功,即将进入您发表的帖子浏览页.',1);setTimeout(function(){document.location = '/post/'+data.lastID+'/'},500)}},'json');
				}
            }

            function showTip(id,msg,ok)
            {
                if(ok == 0) $(id).attr('class','hideTipR').fadeIn().html(msg);
                else $(id).attr('class','hideTipG').fadeIn().html(msg);
            }

            function checkEmail(email)
            {
                var reEmail = /^(.+)@(\w)+(\.)(com|com\.cn|net|cn|net\.cn|org|biz|info|gov|gov\.cn|edu|edu\.cn|sh.cn)/;
                //var reEmail = /^(?:\w+\.?)*\w+@(?:\w+\.?)*\w+$;
                if (email.match(reEmail)) return true;
                else return false;
            }

		    function goTo(id)
		    {
		        var offset = $('#'+id+'').offset();
		        $('html,body').animate({scrollTop: offset.top}, 500);
		    }
		
			function hideBtn(id)
			{
				if(!$('#'+id+' cite')[0]) $('#'+id+'').append('<cite><img src="/mainFramePics/submitting.gif" /> 正在提交数据...</cite>');
				$('#'+id+' a').css('display','none');
			}
			function showBtn(id)
			{
				$('#'+id+' cite').css('display','none');
				$('#'+id+' a').css('display','block');
			}
			
			// 2009.06.18
			function hotNewsInsert(adhere)
			{
				$.post('/asyn/hotNews/',{adhere:adhere},function(data){$('#hotNews').html(data)},"html");
			}
			
			// 回复这篇帖子
			// postID:帖子ID
			// 2009.06.24
			function replyPC(postID)
			{
				var content = $('#replyPC').val();
				if(content !='')
				{
					SUBMITC = $('#sendComment .btn').html();
					$('#sendComment .btn').html('<img src="/mainFramePics/loading.gif" alt="loading" />');
					// alert(postID);
					$.post('/asyn/replyPost/', {postID:postID,content:content} , function(data){if(data.ok==1){addPostComment(content,data.datetime,data.lastID)}} , 'json');
				}
			}
			
			// 添加以及回复到dom			
			// 2009.06.24
			function addPostComment(content,datetime,lastID)
			{
				if($('#commentC').length <= 0) $('#newsContent').after('<h3 class="h3">凳友评论</h3><div id="commentC"></div>');
				var html = '<div class="commentCB colorAdd" id="comment_'+lastID+'"><div class="persion floatLeft"><a href="#nogo"><img src="'+$.cookie('img_thumb')+'" /></a></div><div class="commentC"><p class="commentT">'+$.cookie('nickname')+'</p><p class="commentM">'+content+'</p><p class="commentB">'+datetime+'</p></div><div class="clear"></div></div>';
				if($('#commentC #fenye').length == 0) $('#commentC').append(html);
				else $('#commentC #fenye').before(html);	
				$('#replyPC').val('');
				$('#sendComment .btn').html(SUBMITC);			
			}
			
			
			
			// 回复这篇新闻
			// newsID:新闻ID root_id:针对的根ID to_user:针对的用户ID
			// 2009.06.10
			function replyNC(newsID)
			{
				var root_id = arguments[1] || 0;
				var to_user = arguments[2] || 0;
				if(root_id == 0)
				{
					var content = $('#replyNC').val();
				}
				else
				{
					var content = $('#ta_'+root_id+'').val();
				}
				if(content !='')
				{
					if(root_id == 0)
					{
						SUBMITC = $('#sendComment .btn').html();
						$('#sendComment .btn').html('<img src="/mainFramePics/loading.gif" alt="loading" />');
					}
					else $('#ta_'+root_id+'').next().html('<img src="/mainFramePics/loading.gif" alt="loading" />');
					$.post('/asyn/replyNews/', {newsID:newsID,content:content,root_id:root_id,to_user:to_user} , function(data){if(data.ok==1){addComment(content,data.datetime,data.lastID)} else if(data.ok == 2){addCComment(root_id,content,data.datetime,data.lastID)}} , 'json');
				}
			}
			
			// 添加以及回复到dom			
			// 2009.06.10
			function addComment(content,datetime,lastID)
			{
				if($('#commentC').length <= 0) $('#newsContent').after('<h3 class="h3">凳友评论</h3><div id="commentC"></div>');
				var html = '<div class="commentCB colorAdd" id="comment_'+lastID+'"><div class="persion floatLeft"><a href="#nogo"><img src="'+$.cookie('img_thumb')+'" /></a></div><div class="commentC"><p class="commentT">'+$.cookie('nickname')+'</p><p class="commentM">'+content+'</p><p class="commentB">'+datetime+'</p></div><div class="clear"></div></div>';
				if($('#commentC #fenye').length == 0) $('#commentC').append(html);
				else $('#commentC #fenye').before(html);	
				$('#replyNC').val('');
				$('#sendComment .btn').html(SUBMITC);			
			}

			// 插入二级回复 到 dom
			// 2009.06.10
			function addCComment(reply_to,content,datetime,lastID)
			{
				$('#commentRe_'+reply_to+'').append('<div id="comment_'+lastID+'" class="replyCC"><div class="persion floatLeft"><a href="#nogo"><img src="'+$.cookie('img_thumb')+'" /><span>'+$.cookie('nickname')+'</span></a></div><div class="commentC"><p class="commentT">'+$.cookie('nickname')+'</p><p class="commentM">'+content+'</p><p class="commentB">'+datetime+'</p></div><div class="clear"></div></div>');
			    removeCC(reply_to);
			}
			
			// 在所在的 评论 下面 插入 textarea框
			// date:2009.06.10
			function insertTextarea(id,newsID,to_user,nickname)
			{
				var toMyID = arguments[4] || 0;
				if(toMyID == 0)
				{
					if($('#commentRe_'+id+'').length == 0)
					{
						$('#comment_'+id+'').append('<div class="commentRe" id="commentRe_'+id+'"></div>');	
					}
					if($('#replyCC_'+id+'').length > 0)
					{
						$('#replyCC_'+id+'').remove();
					}
					$('#commentRe_'+id+'').append('<div class="replyCC" id="replyCC_'+id+'"><div class="persion floatLeft"><a href="#nogo"><img src="'+$.cookie('img_thumb')+'" /><span>'+$.cookie('nickname')+'</span></a></div><div class="commentC"><textarea id="ta_'+id+'" class="textarea1 textarea2" style="height: 50px;">回复'+nickname+': </textarea><p class="btn btn2" style="margin:5px 0pt;"><a onclick="replyNC('+newsID+','+id+','+to_user+');" href="#nogo"><span>ok,发表评论</span><b></b></a><a onclick="removeCC('+id+');" href="#nogo"><span>取消</span><b></b></a></p></div><div class="clear"></div></div>');
					$('#ta_'+id+'').focus();
				}
				else
				{
					if($('#commentRe_'+id+'').length == 0)
					{
						$('#comment1_'+id+'').append('<div class="commentRe" id="commentRe_'+id+'"></div>');	
					}
					if($('#replyCC_'+id+'').length > 0)
					{
						$('#replyCC_'+id+'').remove();
					}
					$('#commentRe_'+id+'').append('<div class="replyCC" id="replyCC_'+id+'"><div class="persion floatLeft"><a href="#nogo"><img src="'+$.cookie('img_thumb')+'" /><span>'+$.cookie('nickname')+'</span></a></div><div class="commentC"><textarea id="ta_'+id+'" class="textarea1 textarea2" style="height: 50px;">回复'+nickname+': </textarea><p class="btn btn2" style="margin:5px 0pt;"><a onclick="replyNC('+newsID+','+id+','+to_user+');" href="#nogo"><span>ok,发表评论</span><b></b></a><a onclick="removeCC('+id+');" href="#nogo"><span>取消</span><b></b></a></p></div><div class="clear"></div></div>');
					$('#ta_'+id+'').focus();
				}

			}


			// 移除指定的 textarea
			// 2009.06.11
			function removeCC(id)
			{
				if($('#replyCC_'+id+'').length >= 0) $('#replyCC_'+id+'').remove();
				if($('#commentRe_'+id+' .replyCC').length == 0) $('#commentRe_'+id+'').remove();		
			}
			
			// 删除 指定的 新闻评论
			// 2009.06.11
			function deleteComment(id)
			{
				$.post('/asyn/deleteComment/',{id:id},function(data){if(data.ok == 1){$('#comment_'+id+'').remove()}else{alert('删除失败.')}},"json");
			}
			
			// 删除 指定的 帖子评论
			// 2009.06.25
			function deletePostComment(id)
			{
				$.post('/asyn/deletePostComment/',{id:id},function(data){if(data.ok == 1){$('#comment_'+id+'').remove()}else{alert('删除失败.')}},"json");
			}
			
			// 分页函数,异步添加新闻评论到页面里面
			// newsID:新闻的ID page:第几个分页 once:一次查询数目 total:第一次读取时候的评论数目
			// 2009.06.11
			function readComment(newsID,page,once,total)
			{
				$('#commentC #fenye').remove();
				$('#commentC').append('<div id="loading6" class="alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>')
				$.post('/asyn/readComment/',{newsID:newsID,page:page,once:once,total:total},function(data){$('#loading6').before(data);$('#loading6').remove()},"html");
			}
			
			// 分页函数,异步添加帖子评论到页面里面
			// postID:帖子的ID page:第几个分页 once:一次查询数目 total:第一次读取时候的评论数目
			// 2009.06.11
			function readPostComment(postID,page,once,total)
			{
				$('#commentC #fenye').remove();
				$('#commentC').append('<div id="loading6" class="alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>')
				$.post('/asyn/readPostComment/',{postID:postID,page:page,once:once,total:total},function(data){$('#loading6').before(data);$('#loading6').remove()},"html");
			}
			
			
			// 分页函数 异步调用新闻列表到页面中
			// 2009.06.11
			function readNewsList(userID,page,once)
			{
				$('#newsDL .fenye').remove();
				$('#newsDL').append('<div id="loading1" class="alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
				$.post('/asyn/readNewsList/',{userID:userID,page:page,once:once},function(data){$('#loading1').before(data);$('#loading1').remove()},"html");
			}
			
			// 分页函数 异步调用新闻列表到页面中 分类页面
			// 2009.06.16
			function readNewsList1(adhere,page,once)
			{
				$('#newsDL .fenye').remove();
				$('#newsDL').append('<div class="loading alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
				$.post('/asyn/readNewsList1/',{adhere:adhere,page:page,once:once},function(data){$('#newsDL .loading').before(data);$('#newsDL .loading').remove()},"html");
			}
			
			// 分页函数 异步调用小组新闻列表到页面中
			// 2009.06.25
			function readGroupPostList(groupID,page,once)
			{
				$('#postList .fenye').remove();
				$('#postList').append('<div class="loading alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
				$.post('/asyn/readGroupPost/',{groupID:groupID,page:page,once:once},function(data){$('#postList .loading').before(data);$('#postList .loading').remove()},"html");
			}
			
			// 分页函数 异步调用小组staff
			// 2009.06.27
			function readGroupStaff(groupID,page,once)
			{
				$('#staff .fenye').remove();
				$('#staff .clear').before('<div class="loading alignCenter">loading...</div>');
				$.post('/asyn/readGroupStaff/',{groupID:groupID,page:page,once:once},function(data){$('#staff .loading').before(data);$('#staff .loading').remove()},"html");
			}
			
			// 分页函数 异步调用当前用户所在小组发表的帖子
			// 2009.06.27
			function readPostofGroup(userID,page,once)
			{
				$('#postOfGroup .fenye').remove();
				$('#postOfGroup').append('<div class="loading alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
				$.post('/asyn/readPostOfGroup/',{userID:userID,page:page,once:once},function(data){$('#postOfGroup .loading').before(data);$('#postOfGroup .loading').remove()},"html");
			}
			
			// 分页函数 异步调用当前用户发表帖子的回复
			// 2009.07.02
			function readPCofMy(userID,page,once)
			{
				$('#commentC .fenye').remove();
				$('#commentC').append('<div class="loading alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
				$.post('/asyn/readPCofMy/',{userID:userID,page:page,once:once},function(data){$('#commentC .loading').before(data);$('#commentC .loading').remove()},"html");
			}
			
			// 分页函数 asyn好友的动作
			// 2009.07.05
			function readAction(page,once)
			{
				$('#action .fenye').remove();
				$('#action').append('<div class="loading alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
				$.post('/asyn/readAction/',{page:page,once:once},function(data){$('#action .loading').before(data);$('#action .loading').remove()},"html");
			}
			
			// 分页函数 异步调用当前用户所参加的小报社
			// 2009.06.29
			function readMyAddGroup(userID,page,once)
			{
				$('#myGroups .fenye').remove();
				$('#myGroups .clear').before('<div class="loading alignCenter">loading...</div>');
				$.post('/asyn/readMyAddGroup/',{userID:userID,page:page,once:once},function(data){$('#myGroups .loading').before(data);$('#myGroups .loading').remove()},"html");
			}
			
			function readPersonComment(userID,page,once,total)
			{
				$('#P_C .fenye').remove();
				$('#P_C').append('<div id="loading2" class="alignCenter">loading...</div>');
				// $.post('asyn.readNewsList/',{userID:userID,page:page,once:once,total:total},function(data){alert('dd')});
				$.post('/asyn/readPersonComment/',{userID:userID,page:page,once:once,total:total},function(data){$('#loading2').before(data);$('#loading2').remove()},"html");
			}
			
			function readGFList(GF,userID)
			{
				if(GF == 'G')
				{
					$('#group .fenye').remove();
					$('#group .clear').before('<div class="loading"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
					$.post('/asyn/GFList/',{userID:userID,GF:GF},function(data){$('#group .loading').before(data);$('#group .loading').remove()},"html");	
				}
				else if(GF == 'F')
				{
					$('#friend .fenye').remove();
					$('#friend .clear').before('<div class="loading"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
					$.post('/asyn/GFList/',{userID:userID,GF:GF},function(data){$('#friend .loading').before(data);$('#friend .loading').remove()},"html");	
				}
			}

			// 对某个人发表新闻的 回复,不包括作者的
			// 2009.06.14
			function readNC(userID,page,once,total)
			{
				$('#commentC .fenye').remove();
				$('#commentC').append('<div id="loading5" class="alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
				$.post('/asyn/readNC/',{userID:userID,page:page,once:once,total:total},function(data){$('#loading5').before(data);$('#loading5').remove()},"html");

			}
			
			// 对某个人评论的 回复,不包括作者的
			// 2009.06.14
			function showMyNCReply(userID,page,once)
			{
				$('#MyNCReply .fenye').remove();
				$('#MyNCReply').append('<div class="loading alignCenter"><img src="/mainFramePics/loading.gif" alt="loading" /></div>');
				$.post('/asyn/showMyNCReply/',{userID:userID,page:page,once:once},function(data){$('#MyNCReply .loading').before(data);$('#MyNCReply .loading').remove()},"html");

			}
			
			// 添加朋友的请求
			// 2009.7.9
			function friendAddSubmit(id)
			{
				$('#friendShip .btn').html('<img src="/mainFramePics/loading.gif" alt="loading" />');
				$.post('/asyn/friendAddSubmit/',{id:id},function(data){if(data == 1){$('#friendShip .btn').html('朋友请求发送成功')}},"html");
			}
			
			// 添加朋友
			// 2009.7.9
			function friendAdd(id,sender_id,ok)
			{
				$('#request'+id+' span').html('<img src="/mainFramePics/loading.gif" alt="loading" />');
				$.post('/asyn/friendAdd/',{id:id,sender_id:sender_id,ok:ok},function(data){if(data == 1){$('#request'+id).remove()}},"json");
			}
			

			
