﻿$.ajaxSetup({
	cache:false
}
)
//获取地址栏中参数的值
function getQueryString(key)
{
    var value = ""; 
    var sURL = window.document.URL;
    if (sURL.indexOf("?") > 0)
    {
        var arrayParams = sURL.split("?");
        var arrayURLParams = arrayParams[1].split("&");
        for (var i = 0; i < arrayURLParams.length; i++)
        {
            var sParam =  arrayURLParams[i].split("=");
            if ((sParam[0] == key) && (sParam[1] != ""))
            {
                value = sParam[1];
                break;
            }
        }  
    }
    return value;
} 
function LoadThisType()
{
    var s=getQueryString("s");
    if(s!="")
    {
        getBoard(s);
        //window.location="/F";
    }
}
var thisType=1;
function GetMsgBoard(t){
    thisType=t;
    if(t==1)
    {
        document.getElementById("tb1").style.display="none";
        document.getElementById("divMessageBoard").style.display="block";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="none";
    }
    else if(t==2)
    {
        document.getElementById("tb1").style.display="none";
        document.getElementById("divMessageBoard").style.display="block";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="none";
    }
    else
    {
        document.getElementById("tb1").style.display="block";
        document.getElementById("divMessageBoard").style.display="none";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="none";
    }
    GotoPage2(1);
}
var tp=1;
function getBoard(t)
{
    var s=getQueryString("s");
    if(s=="")
    {
        alert(s);
        window.location="/F";
    }
    if(t==1)
    {
        document.getElementById("tb1").style.display="block";
        document.getElementById("divMessageBoard").style.display="none";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="none";
	GotoPage3(1);
    }
    else if(t==0)
    {
        document.getElementById("tb1").style.display="block";
        document.getElementById("divMessageBoard").style.display="none";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="none";
        tp=0;
        GotoPage3(1);
    }
    else if(t==2)
    {
        document.getElementById("tb1").style.display="none";
        document.getElementById("divMessageBoard").style.display="none";
        document.getElementById("tb_photo").style.display="block";
        document.getElementById("tb_movie").style.display="none";
    }
    else if(t==3)
    {
      document.getElementById("tb1").style.display="none";
        document.getElementById("divMessageBoard").style.display="none";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="block";  
    }
    else if(t==4)
    {
    
        document.getElementById("tb1").style.display="none";
        document.getElementById("divMessageBoard").style.display="block";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="none";
        thisType=1;
        GotoPage2(1);
    }
    else if(t==5)
    {
        document.getElementById("tb1").style.display="none";
        document.getElementById("divMessageBoard").style.display="block";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="none";        
        thisType=2;
        GotoPage2(1);
    }
    else
    {
        document.getElementById("tb1").style.display="block";
        document.getElementById("divMessageBoard").style.display="none";
        document.getElementById("tb_photo").style.display="none";
        document.getElementById("tb_movie").style.display="none";
    }
    
}
function GetFaceList(){
	CloseAllInfoList();
	$('#faceList').load('/FaceList.aspx?AttrID=1');
	$('#faceList').show("slow");
}
function MakeFace(FaceID){
	document.getElementById('MInfo').value= document.getElementById('MInfo').value +"[:" +FaceID+"]";
	$('#faceList').hide();
}
function ToCloseFace(){
	$('#faceList').hide("slow");
}
function GetChanelList(){
	CloseAllInfoList();
	$('#chanelList').load('/SetChanel.aspx?AttrID=1');
	$('#chanelList').show("fast");
}
function MakeChanel(ChanelName){
	document.getElementById('MInfo').value= document.getElementById('MInfo').value +"[c]" +ChanelName+"[/c]";
	$('#chanelList').hide();
}
function ToCloseChanel(){
	$('#chanelList').hide("slow");
}
function ToCreatChanel(){
	CloseAllInfoList();
	$('#MakeChanel').load('/CreatChanel.aspx?AttrID=1');
	$('#MakeChanel').show("fast");
}
function ToCloseCreatChanel(){
	$('#MakeChanel').hide("slow");
}
function MakeNewChanelInfo(){
	var newc=document.getElementById('NewChanelName').value;
	var sendnewc=escape(newc);
	if(newc==""){
		alert('输入内容先！');
		return ;
	}
	var html = $.ajax({
		url: '/CreatChanelDoor.aspx?newChanel='+sendnewc,
		async: false
	}
	).responseText;
	if(html=="no"){
		alert('未登录！');
		return ;
	}
	if(html=="fail"){
		alert('未知失败,可能是已经创建！');
	}
	document.getElementById('MInfo').value= document.getElementById('MInfo').value +"[c]" +newc+"[/c]";
	$('#MakeChanel').hide("slow");
}
var start=0;
var end=0;
function GetLinkPage(){
	var LinkText="";
	if(typeof(MInfo.selectionStart) == "number"){
		start = MInfo.selectionStart;
		end = MInfo.selectionEnd;
		LinkText= MInfo.value.substring(start, end);
	}
	else if(document.selection){
		var range = document.selection.createRange();
		LinkText= range.text;
	}
	if(LinkText==""){
		alert("请选定文本后在输入链接！");
		return ;
	}
	LinkText=escape(LinkText);
	CloseAllInfoList();
	$('#MakeLink').load('/EditLink.aspx?AttrText='+LinkText);
	$('#MakeLink').show("fast");
}
function MakeLink(){
	var LinkToURL= document.getElementById('NewLinkToEdit').value;
	var LinkText= document.getElementById('NewLinkText').value;
	if(LinkToURL==""){
		alert('请输入内容！');
		return ;
	}
	var LinkStr="[url="+LinkToURL+"]"+LinkText+"[/url]";
	var MytextBox = document.getElementById("MInfo").value;
	if(start==0 && end==0){
		start=MytextBox.indexOf(LinkText);
		end=start+LinkText.length;
	}
	var pre = MytextBox.substr(0, start);
	var post = MytextBox.substr(end);
	document.getElementById('MInfo').value= pre + LinkStr + post;
	$('#MakeLink').hide();
}
function ToCloseLink(){
	$('#MakeLink').hide("slow");
}
function GetMusicPage(){
	CloseAllInfoList();
	$('#MakeMusic').load('/MakeMusic.aspx?AttrID=1');
	$('#MakeMusic').show("slow");
}
function MakeMusic(NewMusicID,MakeMusic){
	document.getElementById('MInfo').value= document.getElementById('MInfo').value +"[m1g]"+NewMusicID+"[/m1g]";
	$('#MakeMusic').hide();
}
function ToCloseMusic(){
	$('#MakeMusic').hide("slow");
}
function GetMapPage(){
	CloseAllInfoList();
	$('#MakeMap').html("<div style='text-align:center;'><img src='/SysImg/loading.gif'><br>加载中....</div>");
getUrlStatus('/EditMap.aspx?AttrID=1', function(htmlInfo){
	if(htmlInfo!="wrong"){
		$('#MakeMap').html(htmlInfo);
		$('#MakeMap').show("fast");
	}
}
);
}
function HideMap(){
	$('#MakeMap').hide();
}
function GetVideoPage(){
	CloseAllInfoList();
	$('#MakeVideo').load('/EditVideo.aspx?AttrID=1');
	$('#MakeVideo').show("fast");
}
function MakeVideo(){
	var LinkToURL= document.getElementById('NewVideoToEdit').value;
	if(LinkToURL==""){
		alert('请输入内容！');
		return ;
	}
	var NowVideoID = $.ajax({
		url: '/doajaxUploadVideo.aspx?AddURL='+LinkToURL,
		async: false
	}
	).responseText;
	if(NowVideoID=="wrong"){
		alert('失败！');
		return ;
	}
	document.getElementById('MInfo').value= document.getElementById('MInfo').value +"[fl]" +NowVideoID+"[/fl]";
	$('#MakeVideo').hide();
}
function ToCloseVideo(){
	$('#MakeVideo').hide("slow");
}
function GetImagePage(){
	CloseAllInfoList();
	$('#MakeImage').load('/EditImage.aspx?AttrID=1');
	$('#MakeImage').show("fast");
}
function MakeImage(NewImgURLID){
	document.getElementById('MInfo').value= document.getElementById('MInfo').value +"[ig]" +NewImgURLID+"[/ig]";
	$('#MakeImage').hide();
}
function ToCloseImage(){
	$('#MakeImage').hide("slow");
}
function CloseAllInfoList(){
	$('#MakeVideo').hide();
	$('#MakeLink').hide();
	$('#MakeMusic').hide();
	$('#chanelList').hide();
	$('#faceList').hide();
	$('#MakeChanel').hide();
	$('#MakeImage').hide();
	$('#MakeMap').hide();
}
function getUrlStatus(url, callback){
	$.ajax({
		url: url,
complete: function(xhr){
	callback(xhr.responseText);
}
}
);
}
function getUrlStatusAndInfo(url, callbackTest){
	$.ajax({
		url: url,
complete: function(xhr){
	callbackTest(xhr.status,xhr.responseText);
}
}
);
}
function GetReturnUrl()
{
    var url=window.location.href;
    url="?ReturnUrl="+encodeURI(url.substring(url.lastIndexOf("/")));
    return url;
}
function PubMainInfo(){
    getUrlStatusAndInfo('/getUserLoginId.aspx', function(status,htmlInfo)
    {
	    if(status==200)
	    {
    	    if(htmlInfo=="1")
    	    {
    	        if(confirm("您现在是游客身份，需要登录才能进行操作\r\n\r\n确定现在登录么？"))
    	        {
    	            window.location="/Login"+GetReturnUrl();
    	            return false;
    	        }
    	    }
    	    else
    	    {
    	        var xInfo=document.getElementById('MInfo').value;
	            var xTempInfo=xInfo;
	            if(xInfo==""){
		            alert('请输入内容！');
		            return ;
	            }
	            document.getElementById('MInfo').value="";
	            xInfo=escape(xInfo);
	            $('#PubWaiting').css({
		            opacity: '0.5', display:'block'
	            }
	            );
	            $('#PubWaiting').show();
            getUrlStatusAndInfo('/PubInfo.aspx?MainInfo='+xInfo, function(status,htmlInfo){
	            if(status==200){
	            }
	            else{
		            $("#FromServerInfo").html("发布失败,可能是发布的字符太多或字符不合法～!").show().fadeOut(5000);
		            $('#PubWaiting').hide();
		            return;
	            }
	            if(htmlInfo!="wrong"){
		            showInfoFromServer();
	            }
	            else{
		            $("#FromServerInfo").html("发布失败,可能是发布的字符太多!").show().fadeOut(5000);
		            document.getElementById('MInfo').value=xTempInfo;
	            }
	            $('#PubWaiting').hide();
            }
            );
    	    }
	    }
	    else
	    {
		    alert("抱歉，状态已丢失，请重新登录");
		    return;
	    }
	}
	);
	
}
function MessageBoard(){
getUrlStatusAndInfo('/getUserLoginId.aspx', function(status,htmlInfo)
    {
	    if(status==200)
	    {
    	    if(htmlInfo=="1")
    	    {
    	        if(confirm("您现在是游客身份，需要登录才能进行操作\r\n\r\n确定现在登录么？"))
    	        {
    	            window.location="/Login"+GetReturnUrl();
    	            return false;
    	        }
    	    }
    	    else
    	    {
	            var xInfo=document.getElementById('txtMsg').value;
	            var xTempInfo=xInfo;
	            if(xInfo==""){
		            alert('请输入内容！');
		            document.getElementById('txtMsg').focus();
		            return ;
	            }
	            document.getElementById('txtMsg').value="";
	            xInfo=escape(xInfo);
	            $('#PubWaiting2').css({
		            opacity: '0.5', display:'block'
	            }
	            );
	            $('#PubWaiting2').show();
            getUrlStatusAndInfo('/MessageBoardInfo.aspx?ToUserID='+FromServerMsgUserID+'&MainInfo='+xInfo+'&MsgTypes='+thisType, function(status,htmlInfo){
	            if(status==200){
	                //var count1=document.getElementById("ctl00_Pub1_lblMsgCount1").innerHTML;
	                //var count2=document.getElementById("ctl00_Pub1_lblMsgCount2").innerHTML;
//	                if(thisType==1)
//	                {
//	                    count1=parseInt(count1,0)+1;
//	                    document.getElementById("ctl00_Pub1_lblMsgCount1").innerHTML=count1;
//	                }
//	                if(thisType==2)
//	                {
//	                    count2=parseInt(count2,0)+1;
//	                    document.getElementById("ctl00_Pub1_lblMsgCount2").innerHTML=count2;
//	                }
	            }
	            else{
		            $("#FromServerInfo2").html("发布失败,可能是发布的字符太多或字符不合法～!").show().fadeOut(5000);
		            $('#PubWaiting2').hide();
	            }
	            if(htmlInfo!="wrong"){
		            showInfoFromServer2();
	            }
	            else{
		            $("#FromServerInfo2").html("发布失败,可能是发布的字符太多!").show().fadeOut(5000);
		            document.getElementById('txtMsg').value=xTempInfo;
	            }
	            $('#PubWaiting2').hide();
            }
            ); 
            }
	    }
	    else
	    {
		    alert("抱歉，状态已丢失，请重新登录");
		    return;
	    }
	}
	);
}
function MakeOut(FromBaseID){
getUrlStatusAndInfo('/getUserLoginId.aspx', function(status,htmlInfo)
    {
	    if(status==200)
	    {
    	    if(htmlInfo=="1")
    	    {
    	        if(confirm("您现在是游客身份，需要登录才能进行操作\r\n\r\n确定现在登录么？"))
    	        {
    	            window.location="/Login"+GetReturnUrl();
    	            return false;
    	        }
    	    }
    	    else
    	    {
	            $("#SendTimes"+FromBaseID).css({
		            cursor: 'inherit',color:'#999999'
	            }
	            );
	            $("#ReRealCount"+FromBaseID).load('zhuanfa.aspx?AttrID='+FromBaseID);
	            $("#zhuanfaOK"+FromBaseID).html('转发成功').show("slow").fadeOut(2000);
	            $("#Mout"+FromBaseID).css({
		            display: 'inline'
	            }
	            );
	            showInfoFromServer();
	        }
	    }
	}
	);
}
function MakeOutCancel(FromBaseID,FromBaseIDReal){
	$("#Mout"+FromBaseID).css({
		display: 'none'
	}
	);
	$("#ReRealCount"+FromBaseID).load('/zhuanfa.aspx?&IfOut=1&AttrID='+FromBaseIDReal);
	$("#SendTimes"+FromBaseID).css({
		cursor: 'pointer',color:'#007bc3'
	}
	);
	if(FromBaseID==FromBaseIDReal){
		$("#zhuanfaOK"+FromBaseID).html('撤销成功').show("slow").fadeOut(2000);
$("#SendTimes"+FromBaseID).click(function(){
	MakeOut(FromBaseID);
}
);
}
else{
$("#MainInfo"+FromBaseID).hide("fast");
}
}
function ViewListReUser(FromBaseID,FromBaseIDReal){
	if(FromBaseID=="0") return;
	var popDivViewList = $("#ViewListOtherInfo"+FromBaseID);
	if(popDivViewList.is(':visible')){
		popDivViewList.hide("slow");
	}
	else{
		popDivViewList.load('/ViewReUserList.aspx?AttrID='+FromBaseIDReal);
		popDivViewList.show("slow");
	}
}
function DoCommList(FromBaseID,FromBaseIDreal){
	var popDivViewList = $("#ViewCommInfo"+FromBaseID);
	if(popDivViewList.is(':visible')){
		popDivViewList.hide("slow");
	}
	else{
		popDivViewList.show();
		popDivViewList.html('<div style="text-align:center;"><img src="/SysImg/loading.gif"><br>加载中....</div>');
		var PopURL='/GetCommList.aspx?AttrViewID='+FromBaseID+'&AttrInfoID='+FromBaseIDreal;
getUrlStatus(PopURL, function(htmlInfo){
	popDivViewList.hide();
	popDivViewList.html(htmlInfo);
	popDivViewList.show("slow");
}
);
}
}
function DoCommListWithPage(FromBaseID,FromBaseIDreal,PageIndex){
	var popDivViewList = $("#ViewCommInfo"+FromBaseID);
	popDivViewList.show();
	popDivViewList.html('<div style="text-align:center;"><img src="/SysImg/loading.gif"><br>加载中....</div>');
	var PopURL='/GetCommListWithPage.aspx?AttrPageIndex='+PageIndex+'&AttrViewID='+FromBaseID+'&AttrInfoID='+FromBaseIDreal;
getUrlStatus(PopURL, function(htmlInfo){
	popDivViewList.hide();
	popDivViewList.html(htmlInfo);
	popDivViewList.show("slow");
}
);
}
function MakeCommGo(FromBaseID,FromBaseIDreal){
getUrlStatusAndInfo('/getUserLoginId.aspx', function(status,htmlInfo)
    {
	    if(status==200)
	    {
    	    if(htmlInfo=="1")
    	    {
    	        if(confirm("您现在是游客身份，需要登录才能进行操作\r\n\r\n确定现在登录么？"))
    	        {
    	            window.location="/Login"+GetReturnUrl();
    	            return false;
    	        }
    	    }
    	    else
    	    {
	            var cContent=document.getElementById('CommInfoContent'+FromBaseID).value;
	            if(cContent=="") 
	            {
	                alert("请输入评论内容");
	                document.getElementById('CommInfoContent'+FromBaseID).focus();
	                return;
	            }
	            var popDivViewList = $("#ViewCommInfo"+FromBaseID);
	            popDivViewList.html("<div style='text-align:center;'><img src='/SysImg/loading.gif'><br>评论提交中</div>");
	            var PopURL='/PubComm.aspx?AttrRealID='+FromBaseIDreal+'&AttrID='+FromBaseID+'&AttrInfo='+escape(cContent);
            getUrlStatus(PopURL, function(htmlInfo){
	                popDivViewList.fadeOut(1000);
	                $('#ViewCommList'+FromBaseID).html(htmlInfo);
	                $("#showCommOK"+FromBaseID).show("slow");
	                $("#showCommOK"+FromBaseID).fadeOut(2000);
	                showInfoFromServer();
                }
                );
            }
        }
    }
    );
}
function ToDelInfo(FromBaseID){
	$("#DelRead"+FromBaseID).show("fast");
}
function CancelToDelInfo(FromBaseID){
	$("#DelRead"+FromBaseID).hide("fast");
}
function ConfirmToDelInfo(FromBaseID){
	var html = $.ajax({
		url: '/RemoveInfo.aspx?AttrID='+FromBaseID,
		async: false
	}
	).responseText;
	$("#DelRead"+FromBaseID).hide("fast");
	$("#MainInfo"+FromBaseID).hide("slow");
}
function ConfirmToDelMsgBoard(FromBaseID){
	var html = $.ajax({
		url: '/RemoveMsgBoard.aspx?AttrID='+FromBaseID,
		async: false
	}
	).responseText;
    var count1=document.getElementById("ctl00_Pub1_lblMsgCount1").innerHTML;
    var count2=document.getElementById("ctl00_Pub1_lblMsgCount2").innerHTML;
    if(thisType==1)
    {
        count1=parseInt(count1,0)-1;
        document.getElementById("ctl00_Pub1_lblMsgCount1").innerHTML=count1;
    }
    if(thisType==2)
    {
        count2=parseInt(count2,0)-1;
        document.getElementById("ctl00_Pub1_lblMsgCount2").innerHTML=count2;
    }
	$("#DelRead"+FromBaseID).hide("fast");
	$("#MainInfo"+FromBaseID).hide("slow");
}
function DelComm(FromBaseID,FromDivID){
	$('#ViewCommList'+FromDivID).load('/RemoveComm.aspx?AttrID='+FromBaseID);
	$('#ViewCommItem'+FromBaseID).hide();
}
var FromServerLastID='0';
var FromServerMsgLastID="0";
var BasePara='';
function ToserverGetNewInfo(){
	var PopURL='/GetCountFromServer.aspx?AttrBaseID='+FromServerLastID;
getUrlStatus(PopURL, function(htmlInfo){
	if(htmlInfo=="0"){
		$("#FromServerInfo").hide("fast");
	}
	else{
		if(htmlInfo=="wrong") return ;
		$("#FromServerInfo").html(htmlInfo+"条新微博");
		$("#FromServerInfo").show("slow");
		showInfoFromServer();
	}
}
);
setTimeout("ToserverGetNewInfo()", 60000);
}
setTimeout("ToserverGetNewInfo()", 60000);
function showInfoFromServer(){
    CloseDivUserView();
	$("#FromServerInfo").html("加载中...").show();
	var PopURL='/GetNewListFromServer.aspx?AttrBaseID='+FromServerLastID;
getUrlStatus(PopURL, function(htmlInfo){
	if(htmlInfo=="no"){
		$("#FromServerInfo").hide("fast");
	}
	else{
		$("#FromServerInfo").hide("slow");
		var Fpoint= htmlInfo.indexOf(',');
		var NewAttrBaseID=htmlInfo.substring(0,Fpoint);
		FromServerLastID=NewAttrBaseID;
		var NewHtmlInfo=htmlInfo.substring(Fpoint+1);
		$('#PubInfoGoTo').prepend(NewHtmlInfo);
		try
		{
		    RefreshImgAndVideo();
		    document.getElementById('MInfo').value="";
		}
		catch(err)
		{}
		$('#PubWaiting').css({
			opacity: '0', display:'none'
		}
		);
	}
}
);
}
function showInfoFromServer2(){
    CloseDivUserView();
	$("#FromServerInfo2").html("加载中...").show();
	var PopURL='/GetMsgListFromServer.aspx?AttrBaseID='+FromServerMsgLastID+"&AttrUserID="+FromServerMsgUserID+'&MsgTypes='+thisType;
getUrlStatus(PopURL, function(htmlInfo){
	if(htmlInfo=="no"){
		$("#FromServerInfo2").hide("fast");
	}
	else{
		$("#FromServerInfo2").hide("slow");
		var Fpoint= htmlInfo.indexOf(',');
		var NewAttrBaseID=htmlInfo.substring(0,Fpoint);
		FromServerMsgLastID=NewAttrBaseID;
		var NewHtmlInfo=htmlInfo.substring(Fpoint+1);
		$('#PubInfoGoTo2').prepend(NewHtmlInfo);
		RefreshImgAndVideo();
		$('#PubWaiting2').css({
			opacity: '0', display:'none'
		}
		);
		try
		{  
		    document.getElementById('txtMsg').value="";
		}
		catch(err)
		{}
	}
}
);
}
function GotoTop(){
	scroll(0,0);
	CloseDivUserView();
}
function GotoPage(NewPageIndex){
	GotoTop();
	$("#Fpage").hide();
	$("#ShowItemList").html("");
	$("#PubInfoGoTo").html("");
	$("#FromServerInfo").html("加载中...").show();
	var PopURL='/GetInfoWithPage.aspx?'+BasePara+'&PageIndex='+NewPageIndex;
getUrlStatus(PopURL, function(htmlInfo){
	$("#FromServerInfo").hide("slow");
	$("#ShowItemList").html(htmlInfo);
	RefreshImgAndVideo();
}
);
}
function GotoPage2(NewPageIndex){
	GotoTop();
	$("#Fpage2").hide();
	$("#ShowItemList2").html("");
	$("#PubInfoGoTo2").html("");
	$("#FromServerInfo2").html("加载中...").show();
	//var baseparas="N=N";
	var PopURL='/GetMsgBoardWithPage.aspx?'+BasePara+'&PageIndex='+NewPageIndex+"&MsgTypes="+thisType;
	//window.open(PopURL);
getUrlStatus(PopURL, function(htmlInfo){
	$("#FromServerInfo2").hide("slow");
	$("#ShowItemList2").html(htmlInfo);
	RefreshImgAndVideo();
}
);
}
function GotoPage3(NewPageIndex){
	GotoTop();
	$("#Fpage").hide();
	$("#ShowItemList").html("");
	$("#PubInfoGoTo").html("");
	$("#FromServerInfo").html("加载中...").show();
	var UrlAdd="";
	if(tp==0)
	{
	    UrlAdd="&stg="+tp;
	}
	var PopURL='/GetInfoWithPage.aspx?'+BasePara+'&PageIndex='+NewPageIndex+UrlAdd;
	//window.open(PopURL);
getUrlStatus(PopURL, function(htmlInfo){
	$("#FromServerInfo").hide("slow");
	$("#ShowItemList").html(htmlInfo);
	RefreshImgAndVideo();
}
);
} 
function createTopLayer(){
	$('<div id="pTopBox" style="position:absolute;width:100%;height:100%;top:0px;left:0px;z-index:5;">&nbsp;</div>').prependTo('body');
	$('#pTopBox').css({
		opacity: '0'
	}
	);
	$('#pTopBox').css({
		opacity: '0.5', backgroundColor: '#000000', height: $(document).height().toString() + 'px'
	}
	);
$('#pTopBox').click(function(){
	$('#pTopBox').remove();
}
);
}
function ClearTopLayer(){
	$('#pTopBox').remove();
}
function fOpenDiv(popDivID, isModel, modelColor, modelOpacity){
	isModel = isModel || false;
	modelColor='#000000';
	modelOpacity = modelOpacity || '0.3';
	var popDiv = $(popDivID);
function createLayer(mColor,mOpacity){
	$('<div id="pBox" style="position:absolute;width:100%;height:100%;top:0px;left:0px;z-index:5;">&nbsp;</div>').prependTo('body');
	$('#pBox').css({
		opacity: mOpacity, backgroundColor: mColor, height: $(document).height().toString() + 'px'
	}
	);
}
if (isModel){
	createLayer(modelColor,modelOpacity);
}
var t = ($(window).height() - popDiv.height()) / 2 + $(document).scrollTop();
var l = ($(window).width() - popDiv.width()) / 2;
popDiv.css({
	'position': 'absolute'
}
);
function reSetPopDiv(){
	var qt = ($(window).height() - popDiv.height()) / 2 + $(document).scrollTop();
	var ql = ($(window).width() - popDiv.width()) / 2;
	popDiv.css({
		top: qt.toString() + 'px', left: ql.toString() + 'px'
	}
	);
}
popDiv.css({
	'opacity': '0.5', 'z-index': '5'
}
).slideDown('fast').fadeTo("fast", 1);
}
function ajaxFileUploadFromForm(){
	$("#loading")
.ajaxStart(function(){
	$(this).show();
}
)
.ajaxComplete(function(){
	$(this).hide();
}
);
$.ajaxFileUpload
({
	url:'/doajaxfileupload.aspx',
	secureuri:false,
	fileElementId:'fileToUpload',
	dataType: 'json',
success: function (data, status){
	if(typeof(data.error) != 'undefined'){
		if(data.error != ''){
			alert(data.error);
		}
		else{
			alert(data.msg);
		}
	}
}
,
error: function (data, status, e){
	alert(e);
}
}
)
return false;
}
function getX(obj)
{   
    var ParentObj=obj;   
    var left=obj.offsetLeft;   
    while(ParentObj=ParentObj.offsetParent)
    {   
        left+=ParentObj.offsetLeft;   
    }   
    return left;   
}   
  
function getY(obj)
{   
    var ParentObj=obj;   
    var top=obj.offsetTop;   
    while(ParentObj=ParentObj.offsetParent)
    {   
        top+=ParentObj.offsetTop;   
    }   
    return top;   
}  
function showDivUserView(user,ImgId)
{
    var WindowWidth = document.documentElement.clientWidth;
    var WindowHeight = document.documentElement.clientHeight;
    var DivUserView=document.getElementById("DivUserView");
    var userFace=document.getElementById(ImgId);
    var x=getX(userFace);
    var y=getY(userFace);
    DivUserView.style.display="block";
    if(WindowWidth-x<378)
    {
        x=x-(378-(WindowWidth-x));
    }
    DivUserView.style.top=y;
    DivUserView.style.left=x;
    getUrlStatusAndInfo('/doajaxGetUserView.aspx?UserID='+user, function(status,htmlInfo)
    {
	    if(status==200)
	    {
	        var item=htmlInfo.split(",");
	        if(item.length==9)
	        {
	            var beforeBtn="";
	            switch(item[6])
	            {
	                case "-1":
	                    beforeBtn="&nbsp;";//验证为自己时
	                break;
	                case "0":
	                    beforeBtn="<a href='javascript:BeforeUser("+user+",1)'><img src=\"/SysImg/NewSkin/BeforUser.gif\" border=\"0\"/></a>";//跟随ta
	                break;
	                case "1":
	                    beforeBtn="<a href='javascript:BeforeUser("+user+",2)'><img src=\"/SysImg/NewSkin/NoBeforUser.gif\" border=\"0\"/></a>";//取消跟随ta
	                break;
	            }
	            document.getElementById("spanUserNameLink").innerHTML=item[1]+" &nbsp;&nbsp;<a href=\"/"+item[1]+"\" target=\"_blank\"><img src=\"/SysImg/NewSkin/GoToBlog.gif\" border=\"0\"/></a>";
	            document.getElementById("spanUserName").innerHTML=item[2]==""?"无名氏":item[2];
	            document.getElementById("spanUserBirthday").innerHTML="("+item[3]+")";
	            document.getElementById("spanBeforUserNum").innerHTML=item[7];
	            document.getElementById("spanUserBlogNum").innerHTML=item[8];
	            document.getElementById("spanBeforeBtn").innerHTML=beforeBtn;
	            document.getElementById("spanUserMsg").innerHTML=item[4]==""?"这家伙很懒，什么都没留下":item[4];
	            document.getElementById("ImgUserFace").src=item[5];
	        }
	        else
    	    {
    	        $("#DivUserView").html("抱歉，资料获取失败").show().fadeOut(1800);
    	        return;
    	    }
	    }
	    else
	    {
		    DivUserView.innerHTML="抱歉，状态异常，请稍候再试！";
		    return;
	    }
	}
	);
}
function CloseDivUserView()
{
    if(document.getElementById("DivUserView"))
    {
        document.getElementById("DivUserView").style.display="none";
    }
}
function BeforeUser(User,t)
{
    var LoginID="";
    getUrlStatusAndInfo('/getUserLoginId.aspx', function(status,htmlInfo)
    {
	    if(status==200)
	    {
	        if(htmlInfo=="1")
	        {
	            if(confirm("您现在是游客身份，需要登录才能进行操作\r\n\r\n确定现在登录么？"))
                {
                    window.location="/Login"+GetReturnUrl();
                    return false;
                }
	        }
	        else
	        {
	            if(t==1)
	            {
	                window.location="/P/MakeFollow.aspx?AttrUserID=" + User;	                
	            }
	            else
	            {
	                window.location="/P/MakeFollow.aspx?M=not&AttrUserID=" + User;
	            }
                return false;
	        }
	    }
	}
	);
}
