

		
var hexunAPI = {};
hexunAPI.callMethod = function(APIMethod, params, listener, testingURL, attempts) {
	//debugger;
	if (typeof params != 'object') params = {}; // because we are going to stick a few things in even if no params are passed
	params.method = APIMethod; // see? And this also makes sure a method parameter is not passed
	
	var RESTURLROOT = '/ResponseClient.aspx';
	var RESTURL='';
	for (var p in params) {
		if(RESTURL=='')
			RESTURL=p + '=' + escape_utf8(params[p]);
		else
			RESTURL+= '&' + p + '=' + escape_utf8(params[p]);
	}
	
	params.RESTURL = RESTURL; // again. we stick this in here because we pass params to the callback, and it might want to see the URL
	
	var attempts = (attempts == undefined) ? 1 : attempts;
	var req = new XMLHttpRequest();
	if (req) {
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				if (req.responseText == '' && attempts<2) {
					attempts++;
					req.abort();
					hexunAPI.callMethod(APIMethod, params, listener, testingURL, attempts);
				} else {
					hexunAPI.handleResponseForTitle(req.responseXML, APIMethod, params, req.responseText, listener);
				}
			}
		}
		
		if (testingURL) RESTURLROOT = testingURL;
		req.open('POST', RESTURLROOT);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

		req.send(RESTURL);
	}
}


hexunAPI.getCallBackName = function (dotted) {
	return dotted.split('.').join('_')+'_onLoad';
}

hexunAPI.handleResponseForTitle = function(responseXML, APIMethod, params, responseText, listener) {
	if (!responseXML) { //OPERA!
		var success = (responseText.indexOf('stat="ok"') > -1) ? true : false;
	} else {
		var success = (responseXML.documentElement && responseXML.documentElement.getAttribute('stat') == 'ok') ? true : false;
	}
	listener = (listener) ? listener : this;
	listener[this.getCallBackName(APIMethod)](success, responseXML, responseText);
}

//save sound div
var soundstate=0;
initPagePhotoTitle_div = function(photo_id) {

	if (!okForXMLHTTPREQUEST()) return false; 
	var div = initGenericTitle_div(photo_id, photo_hash);
	var divsound = document.getElementById('site_description'+photo_id).innerHTML;
	div.getInput = function() 
	{   /*
	    if(soundstate==1)
	    {
		   return '<input name="content" value="'+this.form_content.replace('"', '&#34;')+'" style="font-size:14px; font-weight:bold; font-family:arial; padding:3px; width:60%; border:1px inset #e9e9ae; background-color:#FFFFd3; margin-bottom:5px;width:200px"  \/>';	
		}
		else
		{
		   return '<input name="content" value="'+divsound+'" style="font-size:14px; font-weight:bold; font-family:arial; padding:3px; width:60%; border:1px inset #e9e9ae; background-color:#FFFFd3; margin-bottom:5px;width:200px"   \/>';	
		}
		*/
		if(soundstate==1)
	    {
		   return '<input name="content" value="'+this.form_content.replace('"', '&#34;')+'" style="font-size:14px; font-weight:bold; font-family:arial; width:100%; border:1px inset #e9e9ae; background-color:#FFFFd3;width:280px "  \/>';	
		}
		else
		{
		   return '<input name="content" value="'+divsound+'" style="font-size:14px; font-weight:bold; font-family:arial; width:100%; border:1px inset #e9e9ae; background-color:#FFFFd3;width:280px "   \/>';	
		}
		
	}
	div.getExtra = function() 
	{
		return '<br>';
	}
	return true;
}
//sound

String.prototype.getBytes = function() {
    var cArr = this.match(/[^\x00-\xff]/ig);
    return this.length + (cArr == null ? 0 : cArr.length);
}

initGenericTitle_div = function(hash_id, hash) 
{
	if (!okForXMLHTTPREQUEST()) return false; 
	var div = document.getElementById('site_description'+hash_id);
	div.title = '点击编辑';
	div.hash_id = hash_id;
	
	if (!hash[div.hash_id]) 
	{
		alert('ERROR: no hash ob exists for '+div.hash_id);
		return false;
	}
	
	div.form_content = hash[div.hash_id].title;
	
	div.emptyText = '单击此处添加声音';
	
	div.getExtra = function() 
	{
		return '';
	}
	
	div.saveChanges = function(form) 
	{
	    soundstate=1;
		var mycontent = form.content.value;
		var len = mycontent.getBytes();
		if( len > 200 )
		{
			alert("长度超过限制");
			return;
		}
		hash[this.hash_id].title = form.content.value;
		this.innerHTML = '<span>保存...</span>';
		this.endEditing();
		hexunAPI.hexun_photos_setMeta_onLoad = hexunAPI.hexun_photosets_editMeta_onLoad = function(success, responseXML, responseText) {
			if (success) {
				div.form_content = hash[div.hash_id].title;
				div.innerHTML = (hash[div.hash_id].title=='') ? '&nbsp;' : hash[div.hash_id].title.escapeForDisplay();
			} else {
			    
			    alert('你输入的内容与网站要求不符，请重新输入！');
				hash[div.hash_id].title = div.form_content;
				div.innerHTML = (hash[div.hash_id].title=='') ? '&nbsp;' : hash[div.hash_id].title.escapeForDisplay();
			}
		}
		if (!hash[this.hash_id]) 
		{
			this.innerHTML = '错误';
			return false;
		}

		if (hash == set_hash) 
		{
			alert("set");
			hexunAPI.callMethod('hexun.photosets.editMeta', {photoset_id:this.hash_id, title:hash[this.hash_id].title});
		}
		 else if (hash == photo_hash)  
		{
			hexunAPI.callMethod('hexun.photos.setMeta', {photo_id:this.hash_id, title:hash[this.hash_id].title});
		} 
		else 
		{
			alert('unknown hash')
		}
	}
	
	return initEditable_div(div);
}

//点击声音开始编辑
initEditable_div = function(div) 
{

	div.startEditing = function() 
	{
		this.isEditing = true;
		this.unhighlight();
		this.style.display = 'none';
		var form_div = this.getForm_div();
		form_div.style.display = 'block';
		var form = form_div.firstChild;
		form.content.focus();
		form.content.select();
	}
	div.endEditing = function() 
	{
		this.isEditing = false;
		var form_div = this.getForm_div();
	//	this.parentNode.removeChild(form_div);
	//	this.form_div=null;
		form_div.innerHTML = '';
		form_div.style.display = 'none';
		this.style.display = '';
		
	}
	div.onclick = div.startEditing;
	
	div.getForm_div = function() 
	{
		if (!this.form_div) 
		{
		    //alert(this.parentNode.tagName);
			this.form_div = document.createElement('span');
			this.parentNode.insertBefore(this.form_div, this);
			this.form_div.display_div = this;
			
		}
		
		var formHTML = '<form onsubmit="this.parentNode.display_div.saveChanges(this); return false;" style="margin-left:'+this.style.marginLeft+'" style="margin-right:'+this.style.marginRight+';margin-top:15px">';
		formHTML+= this.getInput();
		formHTML+= '&nbsp;&nbsp;<input type=image src="/img/img_bc.gif" align=absmiddle \/>&nbsp;&nbsp;<span style="font-family:arial; font-size:12px;">&nbsp;&nbsp;</span>&nbsp;<input type=image align=absmiddle  src=/img/img_qx.gif onclick=this.form.parentNode.display_div.endEditing(); \/><\/form>';
		this.form_div.innerHTML = formHTML;
		
		return this.form_div;
	}
	
	div.onmouseover = function() 
	{
		this.highlight();
	}
	
	div.onmouseout = function() 
	{
		if (this.hideTimer) clearTimeout(this.hideTimer);
		this.hideTimer = setTimeout('document.getElementById("'+this.id+'").unhighlight()', 500)
	}

	//高亮
	div.highlight = function() 
	{
		if (this.hideTimer) clearTimeout(this.hideTimer);
		
		div.style.backgroundColor = '#ECF1F4';
	
		if (this.emptyText && (div.innerHTML=='&nbsp;' || div.innerHTML==' ' || div.innerHTML.charCodeAt(0) == 160)) 
		{
			div.style.fontStyle = 'italic';	
			div.style.color = '#888';	
			div.innerHTML = this.emptyText;
		}
	}
	
	div.unhighlight = function() 
	{
		if (this.hideTimer) clearTimeout(this.hideTimer);
		div.style.backgroundColor = '';
		if (this.emptyText && div.innerHTML==this.emptyText) 
		{
			div.innerHTML = '&nbsp;';
			div.style.fontStyle = 'normal';
			div.style.color = '#000';
		}
	}
	return div;
}
hexunAPI.hexun_test_echo_onLoad = function(success, responseXML) {
	var mom = responseXML.documentElement;
	var str = '';
	for (var t=0;t<mom.childNodes.length;t++) {
		var node = mom.childNodes[t];
		if (node.nodeType != 3 && node.nodeType != 8) {
			str+= node.nodeType+' '+node.nodeName+' '+node.firstChild.nodeValue+' ';
		}
	}
	alert(str);
}

hexunAPI.hexun_photos_getInfo_onLoad = function(success, responseXML) {
	var tags = responseXML.documentElement.getElementsByTagName('tag');
	if (responseXML.documentElement.getElementsByTagName('description')[0].firstChild) {
		var description = responseXML.documentElement.getElementsByTagName('description')[0].firstChild.nodeValue;
	} else {
		var description = '<i>add your description here.<\/i>';
	}
	var title = responseXML.documentElement.getElementsByTagName('title')[0].firstChild.nodeValue;
	var str = title+'/'+description+'/ ';
	for (var t=0;t<tags.length;t++) {
		var node = tags[t];
		if (node.nodeType != 3 && node.nodeType != 8) {
			str+= node.nodeType+' '+node.nodeName+' '+node.firstChild.nodeValue+' ';
		}
	}
	document.getElementById('site_description').innerHTML = title.escapeForDisplay();
	document.getElementById('description_div').innerHTML = description.chop().nl2br();
}


function rebuild_tags_for_photo_hash(photo_id, tags) {
	if (photo_hash[photo_id] == undefined) return;
	photo_hash[photo_id].tagsA = [];
	photo_hash[photo_id].tags_rawA = [];
	photo_hash[photo_id].tags_idA = [];
	photo_hash[photo_id].tags_canDeleteA = [];
	for (var t=0;t<tags.length;t++) {
		var node = tags[t];
		
		var tag = node.firstChild.nodeValue; // this is clean
		var tag_raw = node.getAttribute('raw');
		var tagId = node.getAttribute('id');
		var adderId = node.getAttribute('author');
		var canDelete = (photo_hash[photo_id].isOwner || global_nsid == adderId) ? true : false;
		
		photo_hash[photo_id].tagsA.push(tag);
		photo_hash[photo_id].tags_rawA.push(tag_raw);
		photo_hash[photo_id].tags_idA.push(tagId);
		photo_hash[photo_id].tags_canDeleteA.push(canDelete);
	}
}

initMessage_div = function(userid,username2,message2) 
{
	//if(isLogin == 0)
	//	GotoLogin();
	var listener = document.getElementById('Message_div');
	listener.hexun_photos_SendMessage_onLoad = function(success, responseXML, responseText) 
	{	
		if (success) 
		{
			if(responseXML.documentElement.getElementsByTagName('message')[0].firstChild.nodeValue=="请先登录")
			{
				GotoLogin();
			}
			else
			{
				//document.getElementById("Friend_div").innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				alert(responseXML.documentElement.getElementsByTagName('message')[0].firstChild.nodeValue);
			}								
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.SendMessage', {id:userid,username:username2,message:message2}, listener);		
	
	return ;
} 



initMessage_div = function(userid,username2,message2) 
{
	//if(isLogin == 0)
	//	GotoLogin();
	var listener = document.getElementById('Message_div');
	listener.hexun_photos_SendMessage_onLoad = function(success, responseXML, responseText) 
	{	
		if (success) 
		{
			if(responseXML.documentElement.getElementsByTagName('message')[0].firstChild.nodeValue=="请先登录")
			{
				GotoLogin();
			}
			else
			{
				//document.getElementById("Friend_div").innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				alert(responseXML.documentElement.getElementsByTagName('message')[0].firstChild.nodeValue);
			}								
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.SendMessage', {id:userid,username:username2,message:message2}, listener);		
	
	return ;
} 



initSaveMsg_ID = function(userid,message2,blogname)
{
	var listener = document.getElementById('SaveMsg_ID');

	listener.hexun_photos_SaveBrief_onLoad = function(success, responseXML, responseText) 
	{	
		if (success) 
		{
			var ret = responseXML.documentElement.getElementsByTagName('message')[0].firstChild.nodeValue;
			
			if(  ret =="请先登录" )
			{
				GotoLogin();
			}
			if(  ret =="保存失败" )
			{
				alert('保存失败');
			}
			else
			{
				//document.getElementById("Friend_div").innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				//alert(responseXML.documentElement.getElementsByTagName('message')[0].firstChild.nodeValue);
				RestoreMessage( responseXML.documentElement.getElementsByTagName('message')[0].firstChild.nodeValue );
			}								
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.SaveBrief', {id:userid,message:message2,blogname:blogname}, listener);		
	
	return ;
} 


initfriend_div = function(friendID) 
{

	document.getElementById("Friend_div").innerHTML ='<font color="#FF6600">正在处理中,请稍候..</font>';
	
	var listener = document.getElementById('Friend_div');
	listener.hexun_photos_AddFriend_onLoad = function(success, responseXML, responseText) 
	{	if (success) 
		{
			if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
			{
				GotoHead();
			}
			else
			{
				document.getElementById("Friend_div").innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				//alert(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue);
			}
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.AddFriend', {friend:friendID}, listener);	
	
	return ;
}


initfriend_div_new = function(friendID) 
{
	document.getElementById("Friend_div"+friendID).innerHTML ='<font color="#FF6600">正在处理中,请稍候..</font>';

	var listener = document.getElementById('Friend_div'+friendID);
	listener.hexun_photos_AddFriend_onLoad = function(success, responseXML, responseText) 
	{	if (success) 
		{
			if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
			{
				GotoHead();
			}
			else
			{
				document.getElementById("Friend_div"+friendID).innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				//alert(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue);
			}
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.AddFriend', {friend:friendID}, listener);	
	
	return ;
}


initfriend_delfriend = function(friendID) 
{


			var deleteMessage =  "确定要删除好友吗？";
	
			if (!confirm(deleteMessage))
			{		
				return;			
			}
	
	document.getElementById("Friend_delmessage"+friendID).innerHTML ='<font color="#FF6600">正在处理中,请稍候..</font>';		
			
	var listener = document.getElementById('delfriend'+friendID);
	listener.hexun_photos_AddFriend_onLoad = function(success, responseXML, responseText) 
	{	if(success) 
		{
			if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				document.getElementById("delfriend"+friendID).style.display ="none";
				setfriendnum();
				alert('删除成功！');				
			}
			else			
			{
				//document.getElementById("delfriend"+friendID).style.display ="none";
				document.getElementById("Friend_delmessage"+friendID).innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				//alert(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue);
			}
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.AddFriend', {delfriend:friendID}, listener);	
	
	return ;
}
initfriend_AcceptFriend = function(myid,objectid,state) 
{

   document.getElementById("Friend_AcceptFriend"+objectid).innerHTML ='<font color="#FF6600">正在处理中,请稍候..</font>';		
			
	var listener = document.getElementById("Friend_AcceptFriend"+objectid);
	listener.hexun_photos_AcceptFriend_onLoad = function(success, responseXML, responseText) 
	{	if(success) 
		{
			if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				document.getElementById("Friend_AcceptFriend"+objectid).innerHTML ="<a href=javascript:initfriend_RejectFriend('"+myid+"','"+objectid+"','1') class=\"add_2\">提醒文章更新</a></span>";
								
			}
			else			
			{
				//document.getElementById("delfriend"+friendID).style.display ="none";
				document.getElementById("Friend_AcceptFriend"+objectid).innerHTML.innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				//alert(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue);
			}
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.AcceptFriend', {myid:myid,objectid:objectid,state:state}, listener);	
	
	return ;
}
initfriend_RejectFriend = function(myid2,objectid2,state2) 
{

   document.getElementById("Friend_AcceptFriend"+objectid2).innerHTML ='<font color="#FF6600">正在处理中,请稍候..</font>';		
			
	var listener = document.getElementById("Friend_AcceptFriend"+objectid2);
	listener.hexun_photos_RejectFriend_onLoad = function(success, responseXML, responseText) 
	{	if(success) 
		{
			if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				document.getElementById("Friend_AcceptFriend"+objectid2).innerHTML ="<a href=javascript:initfriend_AcceptFriend('"+myid2+"','"+objectid2+"','0') class=\"add_2\">不再提醒文章更新</a></span>";
								
			}
			else			
			{
				//document.getElementById("delfriend"+friendID).style.display ="none";
				document.getElementById("Friend_AcceptFriend"+objectid2).innerHTML.innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				//alert(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue);
			}
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.RejectFriend', {myid2:myid2,objectid2:objectid2,state2:state2}, listener);	
	
	return ;
}


//
function  GetNoteValueByRow(row , note)
{
  if( row == "")
  return "";
  var list= new Array( );
  list = row.split(':');
  for( var str in list)
  {
	 if( str.indexOf(note)>=0 )
	 {
			return str.Substring(str.indexOf("=")+1);
	 }
   }
   return "";
} 
//

//Jax:拖拽
ModPos = function(UserId,ConfigNew)
{
	
	var listener;
	listener=document.getElementById("left_side_inner");
	listener.hexun_edit_modpos_onLoad=function(success, responseXML, responseText) 
	{
	  
	   if(success)
	   {     
	          
	          var ret = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
			  if(  ret =="-1" )
			  {    
			       
					GotoLogin();
			  }
			  if(  ret =="0" )
			  {
			     
				   alert('保存失败');
			  }
	          else
	          { 
	               
	          }
	   }
	   else
	   {
	      //alert('错误');
	   }
	}
	hexunAPI.callMethod('hexun.edit.modpos', {UserId:UserId,ConfigNew:ConfigNew,ModPos:1}, listener,'/photoresponse.aspx');	
	return;
	
}

//JS:开关
function ColumnExpand(cateid,obj)
{
    var divId=ReWrite(parseInt(cateid));
    
    obj = document.getElementById(obj);
	if(obj == null)
	{
		return ;
	}
	if( obj.style.display=="none")
	{
		obj.style.display="";
		document.getElementById(divId).setAttribute('open',1);
	}
	else
	{
		obj.style.display="none";
		document.getElementById(divId).setAttribute('open',0);
		
	}
	var objid=obj.id;
	if(objid=="BlogDivItem"||objid=="PhotoDivItem"||objid=="BookMarkDivItem"||objid=="RssDivItem"||objid=="AudioDivItem"||objid=="VideoDivItem")
	{   
	    var objTag=document.getElementById(objid+"_Tag");
	    if( objTag.style.display=="none")
	    {
		    objTag.style.display="";
	    }
	    else
	    {
		    objTag.style.display="none";
	    }
	    if(objid=="PhotoDivItem")
	    {
	       var objPanel=document.getElementById(objid+"_Panel")
	       {
	            
	            
	            if(document.getElementById("Photo").getAttribute('showState')=="1")
	            {
	                if( objPanel.style.display=="none")
	                {
		                objPanel.style.display="";
	                }
	                if(objPanel.style.display=="")
	                {
		                objPanel.style.display="none";
	                }
	            }
	            else
	            {
	                   objPanel.style.display="none";
	            }
	       }
	    }
	}
}
//我的声音添加
SaveMySound = function(enMessage)
{    
    //debugger;
    var listener = document.getElementById("MySoundDivItem");
    listener.hexun_blog_SaveMySound_onLoad = function(success, responseXML, responseText) 
	{	
	    
		//debugger;
		//alert(success);
		if (success) 
		{
		    var saveResult = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;		
		    //var retMySound = responseXML.documentElement.getElementsByTagName('SoundContent')[0].firstChild.nodeValue;		
		    //document.getElementById("MySoundDivItem").innerHTML = "回调成功！";
		    //debugger;
		    var myDate = new Date();                
			if(  saveResult !="" && saveResult != "0" && saveResult != "-1" && saveResult != "-2" )
			{
		        var temNewMsg = "<img src='http://hexun.com/img/sound_img/li04.gif' />“" + enMessage.replace(">", "&gt;").replace("<", "&lt;") + "”<br/>--&nbsp;" + GetDateT() + "&nbsp;<a href=\"/" + BlogName + "/soundmore.html\">[全部声音]</a>";
		        //document.getElementById("MySoundDivItem").innerHTML = temNewMsg;		
		        document.getElementById("MySoundDivItem").innerHTML = "<img src='http://hexun.com/img/sound_img/li04.gif' />“" + saveResult.replace(">", "&gt;").replace("<", "&lt;") + "”<br/>--&nbsp;" + GetDateT() + "&nbsp;<a href=\"/" + BlogName + "/soundmore.html\">[全部声音]</a>";
				document.getElementById("message").value = '';
				document.getElementById("popupsound").style.display = "none";
				alert("您的声音设置成功！");
			}			
			if( saveResult == "0" || saveResult == "-1")
			{ 
			    alert("非常抱歉，您输入的文字中含有不符合网站要求的非法词语，我们不得不禁止这些信息的提交!");
			}	
			if( saveResult == "-2")
			{ 
			    alert("您可能长时间没有处于活动状态了，请重新登陆一次再提交信息!");
			}		
		} 
		else 
		{
			alert("声音设置错误！");
		}
	}	
	enMessage = enMessage.replace("&gt;", ">").replace("&lt;", "<");
    hexunAPI.callMethod('hexun.blog.SaveMySound', {mySoundMessage:enMessage}, listener,'/ResponseClient.aspx');
    return;
}
//根据UserID和ArticleID 取声音内容 -- 暂时不用了
GetSoundContentByUserIDandArticleID = function (articleID,toUserID,fromUserName,ParentUserID)
{
    //formReplySoundDiv.style.top = document.body.clientHeight / 2 - 60;
    //formReplySoundDiv.style.left =document.body.clientWidth / 2 -100;
    formReplySoundDiv.style.visibility='visible';
    var listener = document.getElementById("mask");
    listener.hexun_blog_getSoundContentByUserIDandArticleID_onLoad = function(success, responseXML, responseText)
    {
        //debugger;
        if (success)
        {
            var SoundContent = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
            //alert(SoundContent);
            var ReplySoundDiv = replaySoundHtml(SoundContent).replace("]", ">").replace("[", "<");
            

             var SoundInputDiv = "<div><textarea rows='4' cols='30' name='TxtContent' id='TxtContent' style='OVERFLOW:hidden;color:#666666' onfocus='if( this.value==\"留言不能超过500字\") { this.value=\"\";}'>留言不能超过500字</textarea></div>";

             //SoundInputDiv += "<div>&nbsp;&nbsp;<input type='button' value='提交' name='MbSumbit' id='MbSubmit' class='release_2_sub' onclick=checkReplaySound(" + toUserID +",'"+fromUserName+"','"+ParentUserID+"')>";
             //SoundInputDiv += "&nbsp;&nbsp;<input name='MbCancel' id='MbCancel' type='button' value='取消' class='release_2_res' onclick='ReplaySoundCancel()' /></div>";


            
            //alert(ReplySoundDiv);
            document.getElementById("ReplySoundDiv").innerHTML = ReplySoundDiv;
            document.getElementById("ReplySoundInputDiv").innerHTML = SoundInputDiv;
            document.getElementById("divSubmit").innerHTML = "<input type='button' value='提交' name='MbSumbit' id='MbSubmit' class='formButton' onclick=checkReplaySound(" + toUserID +",'"+fromUserName+"','"+ParentUserID+"')>" + "&nbsp;&nbsp;<input type='button' value='取消' onclick='DialogClose()'class='formButton'/>";
           
        }
        else
        {
            document.getElementById("ReplySoundDiv").innerHTML = "";
            document.getElementById("ReplySoundInputDiv").innerHTML = "对不起！发生了一些错误：<br>读取数据失败，请与我们客服联系！";
            document.getElementById("divSubmit").innerHTML = "<input type='button' value='取消' onclick='DialogClose()'class='formButton'/>";
        }
    }
    hexunAPI.callMethod('hexun.blog.getSoundContentByUserIDandArticleID', {soundArticleID:articleID,soundUserID:toUserID,ParentUserID:ParentUserID}, listener,'/ResponseClient.aspx');
    return;
 
}
//判断两用户是否是好友
getUserFriends = function (SoundContent,ParentUserID,fromUserName,toUserID)
{
    //debugger;
    var retIsFriend = false;
    var listener = document.getElementById("mask");
    listener.hexun_blog_getUserFriends_onLoad = function(success, responseXML, responseText)
    {
        //debugger;
        if (success)
        {
            var retValue = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
            //alert(IsSelf);
            if (retValue == "1")
            {
                document.getElementById("yanzheng").innerHTML = "";
            }
            else
            {
                var info2 = "<div id=\"vfp_font\" style=\"margin: 0 0 0 10px;\">验证码：<input name=\"VerificationPic2\" id=\"VerificationPic2\" type=\"text\" maxlength=4 style=\"width: 46px; height: 18px; font-family: Verdana;\"  /><img id=\"VerificationPic\" alt=\"验证码\" border=\"0\" align=\"absmiddle\" src=\"VCodePicManage.aspx?userid="+ParentUserID+"\" width=50></div>"
                +"<div style=\"margin: 0 0 0 10px;\">"
                +"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:refreshCode_Sound("+ParentUserID+");\"> 看不清楚？</a></div>";                
                document.getElementById("yanzheng").innerHTML = info2; 
            }
        }
    }
    hexunAPI.callMethod('hexun.blog.getUserFriends', {isFriendsUserID1:ParentUserID,isFriendsUserID2:toUserID}, listener,'/ResponseClient.aspx');
}
function replaySoundHtml(temSoundContent)
{
    //debugger;    
    temSoundContent="[DIV class=quote][DIV]----- 引用声音 -----[/DIV][DIV class=replaySound] "+temSoundContent+"[/DIV][/DIV]";
    return temSoundContent;
}
function checkReplaySound(toUserID,fromUserName,ParentUserID)
{
    //debugger;
    if (document.getElementById("VerificationPic2") != null)
        VerificationNum = document.getElementById("VerificationPic2").value;
    else
        VerificationNum = 0;
    ReplayContent =  document.getElementById("ReplySoundDiv").innerHTML;
    ReplayContent += document.getElementById("TxtContent").value;
    var inputContent = document.getElementById("TxtContent").value;
    if(inputContent==null||inputContent=="" || inputContent=="留言不能超过500字")
    {
         alert("内容不能为空！");
         document.getElementById("TxtContent").focus();
         document.getElementById("TxtContent").value="";
         return;
    }
    if(ReplayContent.length >500)
    {
          alert("内容超过500字");
          document.getElementById("TxtContent").focus();
          return;
    } 
    
    ReplayContent = ReplayContent.replace("=","＝");
    
    
//    var r1 = new RegExp("<","g");
//    ReplayContent = ReplayContent.replace(r1,"[");
//    var r2 = new RegExp(">","g");
//    ReplayContent = ReplayContent.replace(r2,"]");
    
    document.getElementById("yanzheng").innerHTML = "写入数据，请稍候... ...";
    SaveReplaySound(ReplayContent,toUserID,fromUserName,ParentUserID,VerificationNum);
}
function ReplaySoundCancel()
{
    document.getElementById("TxtContent").value="";
    formReplySoundDiv.style.visibility='hidden';
    return;
}

//声音回复保存
SaveReplaySound = function (ReplayContent,toUserID,fromUserName,ParentUserID,VerificationNum)
{
    var listener = document.getElementById("ReplySoundDiv");
    listener.hexun_blog_SaveReplaySoundCs_onLoad = function(success, responseXML, responseText) 
	{	
	    
		if (success) 
		{
            var SaveResult = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
            if (SaveResult==1)
            {
                alert("回复成功！现在对方的留言中就有您的回复了！");                
                DialogClose();
            }
            else if (SaveResult==-100)
                alert("验证码错误！");		    
		}
		else
           alert("回复失败！未预知的错误。");

    }
    hexunAPI.callMethod('hexun.blog.SaveReplaySoundCs', {ReplayContent:ReplayContent,toUserID:toUserID,fromUserName:fromUserName,ParentUserID:ParentUserID,VerificationNum:VerificationNum}, listener,'/ResponseClient.aspx');
    return;

}
//绑定个人MSN
SaveAddBindMSN = function (MSNID,IsSynch)
{   
    var listener = document.getElementById("SpanBindMSN");
    listener.hexun_blog_addBindMSN_onLoad = function(success, responseXML, responseText) 
	{	
	    
		if (success) 
		{
		    var saveResult = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
		    //var retRobotEMail = responseXML.documentElement.getElementsByTagName('RobotEMail')[0].firstChild.nodeValue;
		    if (saveResult == "0")
		    {
		        window.location.href=location.href;
		        //document.getElementById('msnset2').style.display="none";
		        //document.getElementById('msnset').style.display="block";
		        //document.getElementById('SpanBindMSN').innerHTML="目前您绑定的MSN是：<font color=red>"+document.getElementById('TextBoxEMail2').value+"</font>";
		        //alert("MSN绑定成功完成！");
		        		    		    
		    }
		    else if(saveResult == "-1" || saveResult == "10" || saveResult == "11")
		    {
		        alert("MSN绑定失败！");		    		    
		    }
		    else if(saveResult == "1")
		    {
		        alert("该绑定已经存在，请选择其它MSN帐户！");		    		    
		    }
		    else if(saveResult == "3")
		    {
		        alert("该MSN帐号已经被使用，请使用其它帐号绑定！");		    		    
		    }
		    else if(saveResult == "-2")
		    {
		        alert("您可能很长时间没有登陆了，请重新登陆再试一下！");		    		    
		    }
		    else
		    {
		        alert("未知错误，请与和讯管理员联系！");		    		    
		    }
		} 
		else 
		{
			alert("MSN绑定设置错误！");
		}
	}
    hexunAPI.callMethod('hexun.blog.addBindMSN', {bindMsnID:MSNID,IsSynch:IsSynch,actionType:1}, listener,'/ResponseClient.aspx');
    return;
}
SaveEditBindMSN = function (MSNID,IsSynch)
{   
    var listener = document.getElementById("SpanBindMSN");
    listener.hexun_blog_editBindMSN_onLoad = function(success, responseXML, responseText) 
	{	
	    
		if (success) 
		{
		    var saveResult = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
		    //var retRobotEMail = responseXML.documentElement.getElementsByTagName('RobotEMail')[0].firstChild.nodeValue;
		    if (saveResult == "0")
		    {
		        //window.location.href=location.href;
		        window.location.reload();
		        //document.getElementById('msnset2').style.display="none";
		        //document.getElementById('msnset').style.display="block";
		        //document.getElementById('SpanBindMSN').innerHTML="目前您绑定的MSN是：<font color=red>"+document.getElementById('TextBoxEMail2').value+"</font>";
		        alert("设置已保存！");		    		    
		    }
		    else if(saveResult == "-1" || saveResult == "10" || saveResult == "11")
		    {
		        alert("MSN绑定失败！");		    		    
		    }
		    else if(saveResult == "1")
		    {
		        alert("该绑定已经存在，请选择其它MSN帐户！");		    		    
		    }
		    else if(saveResult == "3")
		    {
		        alert("该MSN帐号已经被使用，请使用其它帐号绑定！");		    		    
		    }
		    else if(saveResult == "-2")
		    {
		        alert("您可能很长时间没有登陆了，请重新登陆再试一下！");		    		    
		    }
		    else
		    {
		        alert("未知错误，请与和讯管理员联系！");		    		    
		    }
		} 
		else 
		{
			alert("MSN绑定设置错误！");
		}
	}
    hexunAPI.callMethod('hexun.blog.editBindMSN', {bindMsnID:MSNID,IsSynch:IsSynch,actionType:2}, listener,'/ResponseClient.aspx');
    return;
}
deleteBindMSN = function (userID)
{
    var listener = document.getElementById("SpanBindMSN");
    listener.hexun_blog_deleteBindMSN_onLoad = function(success, responseXML, responseText) 
	{	
	    
		if (success) 
		{
		    //window.location.href=location.href; 
		    window.location.reload();
		}
	}
	hexunAPI.callMethod('hexun.blog.deleteBindMSN', {deleteBindUserID:userID}, listener,'/ResponseClient.aspx');
    return;

}

function GetDateT() 
{
    //debugger;    
    var d,s;
    d = new Date(); 
    s="";
    var month = (d.getMonth()+1).toString();//取月份
    month.length == 1 ? s += "0"+month : s += month; 
    s+= "-";
    
    var date = (d.getDate()).toString();//取月份
    date.length == 1 ? s += "0"+date : s += date; 
    s+= "&nbsp;";
    
    var hours = (d.getHours()).toString();//取小时 
    hours.length == 1 ? s += "0"+hours : s += hours; 
    s+= ":";
    
    var minutes = (d.getMinutes()).toString();//取小时 
    minutes.length == 1 ? s += "0"+minutes : s += minutes;     
    
    return(s); 
}

//模板设置 
SaveTemplateSet = function(templateid,updateblog)
{
    var listener = document.getElementById("frmTemplateSet");   
	
    listener.hexun_photos_TemplateSet_onLoad = function(success, responseXML, responseText) 
	{	
	    
		if (success) 
		{
		    var TemplateSet = responseXML.documentElement.getElementsByTagName('TemplateSet')[0].firstChild.nodeValue;		
		    
		    /*			
			if(  TemplateSet =="1" )
			{
				alert("模板更新成功！");
			}
			 */
			if( TemplateSet == "0" )
			{ 
			    alert("模板更新失败！");
			}
			else if(  TemplateSet =="-1" )
			{
				alert("您还没有登陆！");
			}
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.TemplateSet', {templateid:templateid,updateblog:updateblog,TemplateSet:1}, listener,'/ResponseClient.aspx');	

	return ;
}
 

//博客
showBlogItem = function(blogName,userID,isMe,tagID,tagName)
{
	var sourceObj = document.getElementById("Blog");
	if( sourceObj !=null)
	{
	    sourceObj.setAttribute('CurTagID',tagID);
	    sourceObj.setAttribute('CurTagName',tagName);
		
	}
	var topCount=sourceObj.getAttribute("topcount");
	var listener = document.getElementById('BlogDivItem');
	listener.hexun_photos_showBlog_onLoad = function(success, responseXML, responseText) 
	{	
		
		if (success) 
		{
		
		    
			var BlogItems = responseXML.documentElement.getElementsByTagName('BlogItem');
			
			if(BlogItems.length>0)
			{
				var itemsDiv = "";
				var edit="";
			
			  
				for (var t=0;t<BlogItems.length;t++) 
				{
					//ArticleTitle,Author,PostTime,Content,PostType,CommentCount,ClickCount,Recommend,WordCount,RecommendCount,TrackBackStr;
					

					var title = BlogItems[t].getAttribute('title');
					
					var author = BlogItems[t].getAttribute('author');
					var posttime = BlogItems[t].getAttribute('posttime');
					var posttype = BlogItems[t].getAttribute('posttype');
		
					var articleid = BlogItems[t].getAttribute('articleid');
					var blogid = BlogItems[t].getAttribute('blogid');
					var content = BlogItems[t].getAttribute('content');
					
					content = content.replace("&lt;","<");
					content = content.replace("&gt;",">");

					var Href = "http://" + blogName.replace("_","-") + ".blog.hexun.com/" + articleid + "_d.html";
					if( t == 0)
					{					
						itemsDiv+="<div class=\"substance_1\"><strong><a target=\"_blank\" href=\"" + Href + "\">"+title+"</a></strong>[ "+posttype+" "+posttime+" ]</div>";
						itemsDiv+="<div class=\"substance_2\">"+content+"</div>";
						itemsDiv+="<div class=\"substance_3\"><strong><a target=\"_blank\" href=\""+Href+"\">[阅读全文]</a></strong></div>";
						itemsDiv+="<div class=\"substance_list\">";
					}
					else
					{
						itemsDiv+="<div class=\"Slist\"><div class=\"Slist_1\"><a target=\"_blank\" href=\"" + Href + "\">"+title+"</a></div><div class=\"Slist_2\">"+posttime+"</div></div>";					
					}
				}						
				itemsDiv+="</div>";
				
				
				if(tagID == null)
				{
					document.getElementById('blogDivMore').innerHTML = "<a href=http://" + blogName.replace("_","-") + ".blog.hexun.com/default.aspx target=_blank >更多</a>&nbsp;";
				}
				else
				{
					document.getElementById('blogDivMore').innerHTML = "<a href=http://" + blogName.replace("_","-") + ".blog.hexun.com/list.aspx?tag=" + escape(tagName)+" target=_blank >更多</a>&nbsp;";				
				}
				
				document.getElementById('BlogDivItem').innerHTML = itemsDiv;
				
				
			}
			else
			{
				document.getElementById('BlogDivItem').innerHTML = "";
				document.getElementById('blogDivMore').innerHTML = "";
			}

			
		} 
		else 
		{
		//	alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.showBlog', {userID:userID, tagID:tagID,blogName:blogName,topCount:topCount,isMe:isMe,Blog:1}, listener);	
	
	return ;
}
//图片
showPhotoItem = function(blogName,userID,tagID,tagName)
{
    var sourceObj = document.getElementById("Photo");
	if( sourceObj !=null)
	{
	    sourceObj.setAttribute('CurTagID',tagID);
	    sourceObj.setAttribute('CurTagName',tagName);
		
	}
	var pCount=10;
	if(sourceObj!=null)
	{
	   pCount=parseInt(sourceObj.getAttribute('topcount'));
	}
	var listener = document.getElementById('PhotoDivItem');
	
	listener.hexun_photos_showPhoto_onLoad = function(success, responseXML, responseText) 
	{	
	
	    if (success) 
		{
			var PhotoItems = responseXML.documentElement.getElementsByTagName('PhotoItem');	
			TagID=tagID;
			TagName=tagName;
			if(PhotoItems.length>0)
			{
				var itemsDiv="";
				for (var t=0;t<PhotoItems.length;t++) 
				{					
					var photoID = PhotoItems[t].getAttribute('id');					
					var url = PhotoItems[t].getAttribute('url');					
	                itemsDiv+= "<a href='http://" + blogName.replace("_","-") + ".Photo.hexun.com/" + photoID + "_d.html' target=_blank ><img  src='"+url+"' border=0></a>";
				}
				
			    if(tagID == null)
				{
					document.getElementById('PhotoDivMore').innerHTML = "<a href=http://" + blogName.replace("_","-") + ".Photo.hexun.com target=_blank >更多</a>&nbsp;";
				}
				else
				{
					document.getElementById('PhotoDivMore').innerHTML = "<a href=http://" + blogName.replace("_","-") + ".Photo.hexun.com/tag.aspx?tag="+escape(tagName)+" target=_blank >更多</a>&nbsp;";				
				}
				itemsDiv+="<div id='imgp' style='display:none'></div>"; // 新增
				document.getElementById('PhotoDivItem').innerHTML = itemsDiv;
				if( document.getElementById('PhotoDivItem_Panel') != null)
					document.getElementById('PhotoDivItem_Panel').style.display='none';   // 新增
				
			}
			else
			{
			    document.getElementById('PhotoDivItem').innerHTML="";
				document.getElementById('PhotoDivItem').innerHTML = "<div id='imgp' style='WIDTH: 100%;display:none'></div>"; //修改
				document.getElementById('PhotoDivMore').innerHTML = "";
				
			}
		
		} 	
		else 
		{
		//	alert("错误！");
		}
	}
	
	if(tagID == null)
	{
		hexunAPI.callMethod('hexun.photos.showPhoto', {userID:userID,Photo:1,pCount:pCount}, listener);	
	}
	else
	{
		hexunAPI.callMethod('hexun.photos.showPhoto', {userID:userID, tagID:tagID,tagName:tagName,Photo:1,pCount:pCount}, listener);	
	}
	return ;
}

//网摘
showBookMarkItem = function(blogName,userID,tagID,tagName,isMe)
{
	var sourceObj = document.getElementById("BookMark");
	if( sourceObj !=null)
	{
	    sourceObj.setAttribute('CurTagID',tagID);
	    sourceObj.setAttribute('CurTagName',tagName);
		
	}
	var topCount = sourceObj.getAttribute("topcount");
	
	var listener = document.getElementById('BookMarkDivItem');
	listener.hexun_photos_showBookMark_onLoad = function(success, responseXML, responseText) 
	{	if (success) 
		{
			var BookMarkItems = responseXML.documentElement.getElementsByTagName('BookMarkItem');
			
			if(BookMarkItems.length>0)
			{
				var itemsDiv =""; 
				
				var edit="";
			    for (var t=0;t<BookMarkItems.length;t++) 
				{
					
					var itemID = BookMarkItems[t].getAttribute('bookmarkid');
					var itemTitle = BookMarkItems[t].getAttribute('title');
					var updateDate = BookMarkItems[t].getAttribute('bookmarktime');
					
					if( isMe == "true" )
					{
						edit="<a target='_blank' href='http://bookmark.hexun.com/" + blogName + "/edit.aspx?bid=" + itemID + "'><img src='/images/modify.gif' width=17 height=14 border=0></a>";
						edit+="<a target='_blank' onclick=\"return del();\" href=http://bookmark.hexun.com/" + blogName + "/delete.aspx?bid=" + itemID + "><img src='/images/del.gif' width='16' height='16' border=0></a>" 
						
					}
					
					itemsDiv+= "<div class=\"Slist\"><div class=\"Slist_1\"><a target='_blank' href='http://bookmark.hexun.com/" + blogName + "/detailframe.aspx?bid=" + itemID + "'>" + itemTitle + "</a></div><div class=\"Slist_2\">"+updateDate+"</div></div>";
	   	
				}
				if(tagID == null)
				{
					document.getElementById('BookMarkDivMore').innerHTML = "<a href=http://bookmark.hexun.com/"+blogName+"/default.aspx target=_blank >更多</a>&nbsp;";
				}
				else
				{
					document.getElementById('BookMarkDivMore').innerHTML = "<a href=http://bookmark.hexun.com/" + blogName + "/default.aspx?tag=" + escape(tagName)+" target=_blank >更多</a>&nbsp;";				
				}
				document.getElementById('BookMarkDivItem').innerHTML = itemsDiv;
				
			}
			else
			{
				document.getElementById('BookMarkDivItem').innerHTML = "";
				document.getElementById('BookMarkDivMore').innerHTML = "";
			}

			
		} 
		else 
		{
			//alert("错误！");
		}
	}
	
	hexunAPI.callMethod('hexun.photos.showBookMark', {userID:userID, tagID:tagID,tagName:tagName,topCount:topCount,BookMark:1}, listener);	

	return ;
}
//Rss
showRssItem = function(blogName,userID,tagID,tagName)
{
	var sourceObj = document.getElementById("Rss");
	if( sourceObj !=null)
	{
	    sourceObj.setAttribute('CurTagID',tagID);
	    sourceObj.setAttribute('CurTagName',tagName);
		
	}
	var topCount = sourceObj.getAttribute("topcount");
	var listener = document.getElementById('RssDivItem');
	listener.hexun_photos_showRss_onLoad = function(success, responseXML, responseText) 
	{	if (success) 

		{
			var RssItems = responseXML.documentElement.getElementsByTagName('RssItem');			
			if(RssItems.length>0)
			{
				var itemsDiv = "";
				for (var t=0;t<RssItems.length;t++) 
				{
					
					var itemID = RssItems[t].getAttribute('itemID');
					var itemTitle = RssItems[t].getAttribute('itemTitle');
					
					var itemLink = RssItems[t].getAttribute('itemLink');
					var updateDate = RssItems[t].getAttribute('updateDate');
	
	
					itemsDiv += "<div class=\"Slist\"><div class=\"Slist_1\">";
					itemsDiv += "<a href='http://rss.hexun.com/SingleItem.aspx?itemID="+itemID+"&userID="+UserID+"&isSearch=1' target=_blank >"+itemTitle+"</a> ";
					itemsDiv += "</div><div class=\"Slist_2\">"+updateDate+"</div></div>";
				}
				//itemsDiv += "</div></div>";
				
				if(tagID == null)
				{
					document.getElementById('RssDivMore').innerHTML = "<a href=http://rss.hexun.com/"+blogName+"/default.aspx target=_blank >更多</a>&nbsp;";
				}
				else
				{
					document.getElementById('RssDivMore').innerHTML = "<a href=http://rss.hexun.com/TagDetail.aspx?userid="+UserID+"&tagName="+escape(tagName)+" target=_blank >更多</a>&nbsp;";				
				}
				
				document.getElementById('RssDivItem').innerHTML = itemsDiv;
				
			}
			else
			{
				document.getElementById('RssDivItem').innerHTML = "";
				document.getElementById('RssDivMore').innerHTML = "";
			}
		
		} 	
		else 
		{
			//alert("错误！");
		}
	}
	
	if(tagID == null)
	{
		hexunAPI.callMethod('hexun.photos.showRss', {userID:userID,topCount:topCount,Rss:1}, listener);	
	}
	else
	{
		hexunAPI.callMethod('hexun.photos.showRss', {userID:userID, tagID:tagID,tagName:tagName,topCount:topCount,Rss:1}, listener);	
	}
	return ;
}
// 自定义模块处理
showSelfListItem=function(faveCategoryID,userID)
{
    var divName="SelfList"+faveCategoryID+"DivItem";
    
	var sourceObj = document.getElementById("SelfList"+faveCategoryID);
	if(sourceObj!=null)
	{
	   var topCount = sourceObj.getAttribute("topcount");
       var listID   = sourceObj.getAttribute("listid");
    }
    var listener= document.getElementById(divName);
    
    listener.hexun_photos_showSelfListItem_onLoad=function(success, responseXML, responseText) 
    {
       
       if(success)
       {
           
            var SelfListItems=responseXML.documentElement.getElementsByTagName('SelfListItem');
             
            if(SelfListItems.length>0)
            {
               var itemDiv="";
               for(var i=0;i<SelfListItems.length;i++)
               {
                  var ListItemName=SelfListItems[i].getAttribute('ListItemName');
                  var relateLink=SelfListItems[i].getAttribute('relateLink');
                  itemDiv+="<div><a href='"+relateLink+"' target='_blank'>"+ListItemName+"</a></div>";
               }
               document.getElementById(divName).innerHTML=itemDiv;
               
            }
            else
            {
               document.getElementById(divName).innerHTML="";
            }
       }
       else
       {
          alert('错误');
       }
    }
   hexunAPI.callMethod('hexun.photos.showSelfListItem', {userID:userID,topN:topCount,faveCategoryID:faveCategoryID,listID:listID,SelfList:1}, listener,'/photoresponse.aspx');	
   return ;
}
showVideoItem = function(blogName,userID,isMe,tagID,tagName,pos)
{
    
    var sourceObj = document.getElementById("Video");
	if( sourceObj !=null)
	{
	    sourceObj.setAttribute('CurTagID',tagID);
	    sourceObj.setAttribute('CurTagName',tagName);
		
	}
	var topCount = sourceObj.getAttribute("topcount");
	var VideoHeight ;
	if(sourceObj.getAttribute("column").toLowerCase()=="center")
	{
	    VideoHeight="359px";
	}
	else
	{
	   VideoHeight="193px";
	}
	var listener = document.getElementById('VideoDivItem');
	
	listener.hexun_photos_showVideo_onLoad = function(success, responseXML, responseText) 
	{	
	
		if (success) 
		{		
		    
			var VideoItems = responseXML.documentElement.getElementsByTagName('VideoItem');
			if(VideoItems.length>0)
			{
				var itemsDiv = "";
				var itemsList="";
				
					for (var t=0;t<VideoItems.length;t++) 
					{
						
						var title = VideoItems[t].getAttribute('name');
						var descript = VideoItems[t].getAttribute('Description');
						var pubdate = VideoItems[t].getAttribute('PubDate');
						var src = VideoItems[t].getAttribute('FileUrl');	//tmp data"http://down1.ttxyx.com/play/836191942.wmv";	//	
						var link = "http://hexun.com/jujube";		
						var cid = VideoItems[t].getAttribute('CategoryID');					
						var clickcount = VideoItems[t].getAttribute('ClickedCount');
						var commentcount = VideoItems[t].getAttribute('CommentCount');
						var vid = VideoItems[t].getAttribute('VideoID');
						var mid = VideoItems[t].getAttribute('MediaCatygoryID');	
						var format = VideoItems[t].getAttribute('FileFormat');	
						
						var type="";
						var href="http://" + blogName.replace("-","_") + ".music.hexun.com/V" + vid + ".html";
						//href="javascript:play('" + dr["FileUrl"].ToString() + "','" + HttpUtility.HtmlEncode(dr["name"].ToString()) + "','" + dr["Description"].ToString() + "');";
						var pm="";
                        if(format==".FLV")
                        {
						   
						    pm +="<object id=nstv  width='100%' height='" + VideoHeight + "' classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"  id=\"Play0\"  align=\"middle\" VIEWASTEXT>";
                            pm += "<param name=\"movie\" value=\"http://v.hexun.com/Flash/player.swf?fileID=" + vid + "&autoStart=0\">";
                            pm+="<param name=\"quality\" value=\"high\">";
                            pm+="<param name=\"wmode\" value=\"transparent\">";
                           
                            pm+="<embed   width='100%' height='" + VideoHeight + "' src=\"http://v.hexun.com/Flash/player.swf?fileID="+vid+"&autoStart=0\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\">";
                            pm+="</embed>";
                            pm +="</object>";
						}
						else
						{
						    pm+="<object  width='100%' height='" + VideoHeight + "' id=nstv classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'  codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52 ,701' standby=Loading Microsoft? Windows Media? Player components... type=application/x-oleobject >";
						    pm+="	<param name='URL' value='http://music.hexun.com/PM.aspx?CID=" + mid + "&MID=" + vid + "&IsFirefox=0&FileUrl=" + src + "'>";
						    pm+="	<param name='AutoStart' VALUE='false'>";
						    pm+="	<param name='Enabled' VALUE='true'>";
						    pm+="	<param name='enableContextMenu' VALUE='false'>";
						    pm+="	<param name='loop' VALUE='true'>";
						    pm+="	<param name='WindowlessVideo' VALUE='true'>";
						    pm+="</object>"; 
						}
						if( t == 0)
						{   
						    itemsDiv +=pm;
						    itemsDiv += "<div class='music_boder'>";
                            itemsDiv += "<div class='music_boder_1'><span>名称：</span><a href='http://" + blogName + ".v.hexun.com/D" + vid + ".html' target='_blank'>" + title + "</a> | <span>格式：</span>" + format + "</div>";
                            itemsDiv += "<div class='music_boder_2'><span>简介：</span>" + descript + "</div></div>";
                            itemsDiv += "<div id='' class='music_list'>";					
						}
						else
						{
							 itemsDiv += "<div class='Slist'>";
                             itemsDiv += "<div class='Slist_1'><a href='http://" + blogName + ".v.hexun.com/D" + vid + ".html' target='_blank'>" + title + "</a></div>";
                             itemsDiv += "<div class='Slist_2'>" + pubdate + "</div>";
                             itemsDiv += "</div>";				
						}
					
					itemsDiv+="</div>";
					
					if(tagID == null||tagID=="")
					{
					    
						document.getElementById('VideoDivMore').innerHTML = "<a href=http://" + blogName.replace("_","-") + ".v.hexun.com target=_blank >更多</a>&nbsp;";
					}
					else
					{
						document.getElementById('VideoDivMore').innerHTML = "<a href=http://" + blogName.replace("_","-") + ".v.hexun.com/BListTag" + tagID + ".html  target=_blank >更多</a>&nbsp;";				
					}	
				}
					
				document.getElementById('VideoDivItem').innerHTML = itemsDiv;
				
			}
			else
			{
				document.getElementById('VideoDivItem').innerHTML = "";
				document.getElementById('VideoDivMore').innerHTML = "";
			}			
		} 
		else 
		{
			
		}
	}
	hexunAPI.callMethod('hexun.photos.showVideo', {userID:userID, tagID:tagID,blogName:blogName,tagName:tagName,topCount:topCount,isMe:isMe,Video:1}, listener,'/VideoResponse.aspx');	
	return ;
}
initfriend_div = function(friendID) 
{

	document.getElementById("Friend_div").innerHTML ='<font color="#FF6600">正在处理中,请稍候..</font>';
	
	var listener = document.getElementById('Friend_div');
	listener.hexun_photos_AddFriend_onLoad = function(success, responseXML, responseText) 
	{	if (success) 
		{
			if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
			{
				GotoHead();
			}
			else
			{
				document.getElementById("Friend_div").innerHTML ="<font class='uhei5'>"+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"</font>" ;								
				//alert(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue);
			}
		} 
		else 
		{
			alert("错误！");
		}
	}
	hexunAPI.callMethod('hexun.photos.AddFriend', {friend:friendID}, listener);	
	
	return ;
}
SetAcpt=function(userId,acptdiv)
{
    document.getElementById(acptdiv).innerHTML ='<font color="red">[正在处理中,请稍候..]</font>';
    var listener = document.getElementById(acptdiv);
	listener.hexun_photos_SetAcpt_onLoad = function(success, responseXML, responseText) 
	{	
	   
	    if (success) 
		{
			if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
			else
			{
			    document.getElementById(acptdiv).innerHTML ="<font color=\"red\">["+responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue+"]</font>" ;								
		    }
		} 
		
	}
	hexunAPI.callMethod('hexun.photos.SetAcpt', {actpuserId:userId}, listener);	
	return ;
}
function dispProcessing()
{
     var div = document.createElement("div");
     div.id="processing";
     div.innerHTML = "<br><center><img src=\"http://blog.hexun.com/img/loading.gif\" alt=\"\" />  <font style=\"color: #063667;font-weight: bold;font-size: 12px;\">正在发送邮件，请稍侯...</font></center>";
     div.className="searching";
     div.style.filter = "alpha(Opacity=70)";
     div.style.position = "absolute";
     div.style.top =300;
     div.style.left = 300;
     div.style.zIndex = 101;
     document.body.appendChild(div);
     document.getElementById("gfriends").focus();
}
function getfocus(n,cur)
{
    for(var i=1;i<=n;i++)
    {
        if(document.getElementById("litab_"+i)!=null)
        {
          if(i==cur)
          {
             document.getElementById("litab_"+i).className="onfocus";
          }
          else
          {
             document.getElementById("litab_"+i).className="";
          }
       }
    }
}
SendMail=function(sendId,maillist)
{
   dispProcessing();
   var listener=document.getElementById('if');
   listener.hexun_photos_SendMail_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
		    {
		    　 document.getElementById("processing").style.display="none";
		    }
		    else 
		    {
		       
		       document.getElementById("processing").style.display="none";
		       var mailhtml="";
		       var tempHtml="";
		       var mailarr=new Array();
		       mailarr=maillist.split(",");
		       
		       var sendCount=0;
		       for(var i=0;i<mailarr.length-1;i++)
		       {
		          if(mailarr[i]!="")
		          {
		              var mailaddress=mailarr[i];
		              tempHtml+="<li><div class=\"name\">"+mailaddress+"</div></li>";
				      sendCount++;  
				   }
		       }
		       if(sendCount>0)
		       {
		          mailhtml="<p class=\"addtip\">已经向 "+sendCount+" 位 Mail好友发送了邀请</p>";
		          mailhtml+="<div class=\"selectbox\"><ul>";
		          mailhtml+=tempHtml;
		          mailhtml+="</ul></div>";
		          mailhtml+="<div class=\"sbtn\"><input type=\"button\" value=\"继续邀请\" style=\"cursor:hand;\" onclick=\"javascript:document.location='admin_inviteFriends.aspx';\"/>　　<a href=\"http://hexun.com/home/\">回到我的家</a></div>";
		       }
		       
		       document.getElementById("if").innerHTML=mailhtml;
		       document.getElementById("if").style.display="block";
		    }
		}
      
   }
   hexunAPI.callMethod('hexun.photos.SendMail', {mSend:1,sendId:sendId,maillist:maillist}, listener);	
   return ;
   
}
DelStockToApI=function(codeId,stockUserId)
{
   var listener=document.getElementById('InnerStockDiv');
   listener.hexun_photos_DelStockToApI_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {  
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
		    {
		    }
		    else
		    {
		        
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var mystockDivHtml="";
                mystockDivHtml="<table cellpadding='0' cellspacing='0'>";
                mystockDivHtml+="		<tr>";
                mystockDivHtml+="			<th>代码</th>";
                mystockDivHtml+="			<th>名称</th>";
                mystockDivHtml+="			<th>现价</th>";
                mystockDivHtml+="			<th>涨跌幅</th>";
                mystockDivHtml+="			<th>开盘价</th>";
                mystockDivHtml+="			<th>成交量</th>";
                mystockDivHtml+="			<th>换手率</th>";
                mystockDivHtml+="			<th>&nbsp;</th>";
                mystockDivHtml+="			<th>&nbsp;</th>";
                mystockDivHtml+="		</tr>";
                if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
                {
		            if(Items.length>0)
		            {
    		            
		                for (var t=0;t<Items.length;t++) 
					    {
						    var codeId = Items[t].getAttribute('codeId');
						    var rqcodeId = Items[t].getAttribute('rqcodeId');
						    var name = Items[t].getAttribute('name');
						    var price=Items[t].getAttribute('price');
    						
						    var open = Items[t].getAttribute('open');
						    var volume = Items[t].getAttribute('volume');
						    var UpDownRate = Items[t].getAttribute('UpDownRate');
						    var AvgPrice=Items[t].getAttribute('AvgPrice');
						    var color=Items[t].getAttribute('color');
						    mystockDivHtml = mystockDivHtml + "<tr><td>" + rqcodeId + "</td><td><a href='http://stockdata.stock.hexun.com/" + rqcodeId + ".shtml' target=_blank>" + name + "</a></td><td " + color + ">" + price + "</td><td " + color + ">" + UpDownRate + "%</td><td>" + open + "</td><td>" + volume + "</td><td>" + AvgPrice + "%</td><td><a href='http://guba.hexun.com/" + rqcodeId + ",guba.html' target=_blank>股吧</a></td><td><a  class='close' style='cursor:hand;' onclick='javascript:delstock(" + codeId + ")'>×</a></td></tr>";
				        }
		            }
		        }
		        mystockDivHtml=mystockDivHtml+"</table>";
		        if(document.getElementById("InnerStockDiv")!=null)
                {
                       document.getElementById("InnerStockDiv").innerHTML=mystockDivHtml;
                }
		    }
      }
   }
   hexunAPI.callMethod('hexun.photos.DelStockToApI', {codeId:codeId,stockUserId:stockUserId}, listener);
   return;	
}
ShowMyKfFunds=function(smkid)
{
   var listener=document.getElementById('InnerKfFundsDiv');
   listener.hexun_photos_ShowMyKfFunds_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {  
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
		    {
		    }
		    else
		    {
		        
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var KfFundsDivHtml="";
                KfFundsDivHtml+="<table cellpadding='0' cellspacing='0' id='mykffundsTable'>";
                KfFundsDivHtml+="		<tr>";
                KfFundsDivHtml+="			<th>开基代码</th>";
                KfFundsDivHtml+="			<th width='100'>开基名称</th>";
                KfFundsDivHtml+="			<th>今日估算净值</th>";
                KfFundsDivHtml+="			<th>昨日净值</th>";
                KfFundsDivHtml+="			<th>日涨跌</th>";
                KfFundsDivHtml+="			<th>费率　</th>";
                KfFundsDivHtml+="			<th>&nbsp;</th>";
                KfFundsDivHtml+="			<th>&nbsp;</th>";
                KfFundsDivHtml+="		</tr>";
                if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
                {
		            if(Items.length>0)
		            {
    		            
		                for (var t=0;t<Items.length;t++) 
					    {
						    var cardid = Items[t].getAttribute('cardid');
						    var code = Items[t].getAttribute('code');
						    var fname = Items[t].getAttribute('fname');
						    var UnitPrice=Items[t].getAttribute('UnitPrice');
    						var todayPrice=Items[t].getAttribute('todayprice');
						    var fUpDownrate = Items[t].getAttribute('fUpDownrate');
						    var applyfeerate = Items[t].getAttribute('applyfeerate');
						    var colorcss = Items[t].getAttribute('colorcss');
						    
						    KfFundsDivHtml = KfFundsDivHtml + "<tr><td>" + code + "</td><td><a href='http://funds.money.hexun.com/fundsdata/open/default.aspx?code=" + code + "' target=_blank>" + fname + "</a></td><td align=center>"+todayPrice+"</td><td>" + UnitPrice + "</td><td " + colorcss + ">" + fUpDownrate + "%</td><td><a href='http://funds.money.hexun.com/fundsdata/open/summarize/data4.aspx?code="+code+"' target=_blank>" + applyfeerate + "</a></td><td><a href='http://jijinba.hexun.com/" + code + ",jijinba.html' target=_blank>基金吧</a></td><td><a style='cursor:hand;' onclick='javascript:delfunds("+cardid+",1)' class='close'>×</a></td></tr>";
                
					    }
		            }
		        }
                KfFundsDivHtml+="</table>";
		        
		        if(document.getElementById("InnerKfFundsDiv")!=null)
                {
                     document.getElementById("InnerKfFundsDiv").innerHTML=KfFundsDivHtml;
                }
		    }
      }
   }
   hexunAPI.callMethod('hexun.photos.ShowMyKfFunds', {smkid:smkid}, listener);
   return;	
}
DelKfFundsToApI=function(cardId,kfUserId,accountId)
{
   var listener=document.getElementById('InnerKfFundsDiv');
   listener.hexun_photos_DelKfFundsToApI_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {  
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
		    {
		    }
		    else
		    {
		        
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var KfFundsDivHtml="";
                KfFundsDivHtml+="<table cellpadding='0' cellspacing='0' id='mykffundsTable'>";
                KfFundsDivHtml+="		<tr>";
                KfFundsDivHtml+="			<th>开基代码</th>";
                KfFundsDivHtml+="			<th width='100'>开基名称</th>";
                KfFundsDivHtml+="			<th>今日估算净值</th>";
                KfFundsDivHtml+="			<th>昨日净值</th>";
                KfFundsDivHtml+="			<th>日涨跌</th>";
                KfFundsDivHtml+="			<th>费率　</th>";
                KfFundsDivHtml+="			<th>&nbsp;</th>";
                KfFundsDivHtml+="			<th>&nbsp;</th>";
                KfFundsDivHtml+="		</tr>";
                if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
                {
		            if(Items.length>0)
		            {
    		            
		                for (var t=0;t<Items.length;t++) 
					    {
						    var cardid = Items[t].getAttribute('cardid');
						    var code = Items[t].getAttribute('code');
						    var fname = Items[t].getAttribute('fname');
						    var UnitPrice=Items[t].getAttribute('UnitPrice');
    						var todayPrice=Items[t].getAttribute('todayprice');
						    var fUpDownrate = Items[t].getAttribute('fUpDownrate');
						    var applyfeerate = Items[t].getAttribute('applyfeerate');
						    var colorcss = Items[t].getAttribute('colorcss');
						    var accountid= Items[t].getAttribute('accountid');
						    
                           KfFundsDivHtml = KfFundsDivHtml + "<tr><td>" + code + "</td><td><a href='http://funds.money.hexun.com/fundsdata/open/default.aspx?code=" + code + "' target=_blank>" + fname + "</a></td><td align=center>"+todayPrice+"</td><td>" + UnitPrice + "</td><td " + colorcss + ">" + fUpDownrate + "%</td><td><a href='http://funds.money.hexun.com/fundsdata/open/summarize/data4.aspx?code="+code+"' target=_blank>" + applyfeerate + "</a></td><td><a href='http://jijinba.hexun.com/" + code + ",jijinba.html' target=_blank>基金吧</a></td><td><a style='cursor:hand;' onclick='javascript:delfunds("+cardid+",1,"+accountid+")' class='close'>×</a></td></tr>";
                
					    }
		            }
		        }
                KfFundsDivHtml+="</table>";
		        
		        if(document.getElementById("InnerKfFundsDiv")!=null)
                {
                     document.getElementById("InnerKfFundsDiv").innerHTML=KfFundsDivHtml;
                }
		    }
      }
   }
   hexunAPI.callMethod('hexun.photos.DelKfFundsToApI', {cardId:cardId,kfUserId:kfUserId,accountId:accountId}, listener);
   return;	
}
ShowShengShi=function()
{
    var listener=document.getElementById("shengshi");
    listener.hexun_photos_ShowShengShi_onLoad=function(success,responseXML,responseText)
    {
        if(success)
        {  
           if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
           {
               var Items=responseXML.documentElement.getElementsByTagName('friend');
               var ShengDivHtml="";
               if(Items.length>0)
               {
                   var up=Items[0].getAttribute('up');
                   var ssnum=Items[0].getAttribute('ssnum');
                   
                   var color="";
                   if(up>0)
                   {
                      color="#FE0000";
                   }
                   else
                   {
                      color="#01CE03";
                   }
                   ShengDivHtml="<a href=http://stock.hexun.com/ target=_blank>深</a>：<font color="+color+">"+ssnum+"</font>";
                }
                document.getElementById("shengshi").innerHTML=ShengDivHtml;
           }
           
        }
    }
    hexunAPI.callMethod('hexun.photos.ShowShengShi', {shengshi:1}, listener);
    return;
}
ShowHuShi=function()
{
    var listener=document.getElementById("hushi");
    listener.hexun_photos_ShowHuShi_onLoad=function(success,responseXML,responseText)
    {
        if(success)
        {  
           if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
           {
               var Items=responseXML.documentElement.getElementsByTagName('friend');
               var HuShiHtml="";
               if(Items.length>0)
               {
                   var up=Items[0].getAttribute('up');
                   var ssnum=Items[0].getAttribute('ssnum');
                   
                   var color="";
                   if(up>0)
                   {
                      color="#FE0000";
                   }
                   else
                   {
                      color="#01CE03";
                   }
                   HuShiHtml="<a href=http://stock.hexun.com/ target=_blank>沪</a>：<font color="+color+">"+ssnum+"</font>";
                }
                document.getElementById("hushi").innerHTML=HuShiHtml;
           }
           
        }
    }
    hexunAPI.callMethod('hexun.photos.ShowHuShi', {hushi:1}, listener);
    return;
}

ShowMyFbFunds=function(smfId)
{
   var listener=document.getElementById('InnerFbFundsDiv');
   listener.hexun_photos_ShowMyFbFunds_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {  
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
		    {
		    }
		    else
		    {
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var FbFundsDivHTML="";
                FbFundsDivHTML+="<table cellpadding='0' cellspacing='0' id='myfbfundsTable'>";
                FbFundsDivHTML+="		<tr>";
                FbFundsDivHTML+="			<th>封基代码</th>";
                FbFundsDivHTML+="			<th width='130'>封基名称</th>";
                FbFundsDivHTML+="			<th>市场价格</th>";
                FbFundsDivHTML+="			<th>日涨跌</th>";
                FbFundsDivHTML+="			<th>折价率</th>";
                FbFundsDivHTML+="			<th>&nbsp;</th>";
                FbFundsDivHTML+="			<th>&nbsp;</th>";
                FbFundsDivHTML+="		</tr>";
                if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
                {
		            if(Items.length>0)
		            {
    		            
		                for (var t=0;t<Items.length;t++) 
					    {
						    var fbcarid = Items[t].getAttribute('fbcarid');
						    var fbcode = Items[t].getAttribute('fbcode');
						    var fbname = Items[t].getAttribute('fbname');
						    var MarketPrice=Items[t].getAttribute('MarketPrice');
    						
						    var fbUpDownrate = Items[t].getAttribute('fbUpDownrate');
						    var Disrate = Items[t].getAttribute('Disrate');
						    var colorcss = Items[t].getAttribute('colorcss');
						    
						    FbFundsDivHTML = FbFundsDivHTML + "<tr><td>" + fbcode + "</td><td><a href='http://funds.money.hexun.com/fundsdata/close/default.aspx?code=" + fbcode + "' target=_blank>" + fbname + "</a></td><td>" + MarketPrice + "</td><td " + colorcss + ">" + fbUpDownrate + "%</td><td>" + Disrate + "</td><td><a href='http://jijinba.hexun.com/" + fbcode + ",jijinba.html' target=_blank>基金吧</a></td><td><a style='cursor:hand;' onclick='javascript:delfunds(" + fbcarid + ",2)' class='close'>×</a></td></tr>";
                
					    }
		            }
		        }
                FbFundsDivHTML+="</table>";
		        if(document.getElementById("InnerFbFundsDiv")!=null)
                {
                     document.getElementById("InnerFbFundsDiv").innerHTML=FbFundsDivHTML;
                }
		    }
      }
   }
   hexunAPI.callMethod('hexun.photos.ShowMyFbFunds', {smfId:smfId}, listener);
   return;	
}
DelFbFundsToApI=function(fbcardId,fbUserId,accountId)
{
   var listener=document.getElementById('InnerFbFundsDiv');
   listener.hexun_photos_DelFbFundsToApI_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {  
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
		    {
		    }
		    else
		    {
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var FbFundsDivHTML="";
                FbFundsDivHTML+="<table cellpadding='0' cellspacing='0' id='myfbfundsTable'>";
                FbFundsDivHTML+="		<tr>";
                FbFundsDivHTML+="			<th>封基代码</th>";
                FbFundsDivHTML+="			<th width='130'>封基名称</th>";
                FbFundsDivHTML+="			<th>市场价格</th>";
                FbFundsDivHTML+="			<th>日涨跌</th>";
                FbFundsDivHTML+="			<th>折价率</th>";
                FbFundsDivHTML+="			<th>&nbsp;</th>";
                FbFundsDivHTML+="			<th>&nbsp;</th>";
                FbFundsDivHTML+="		</tr>";
                if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
                {
		            if(Items.length>0)
		            {
    		            
		                for (var t=0;t<Items.length;t++) 
					    {
					        var fbaccountid= Items[t].getAttribute('accountid');
						    var fbcarid = Items[t].getAttribute('fbcarid');
						    var fbcode = Items[t].getAttribute('fbcode');
						    var fbname = Items[t].getAttribute('fbname');
						    var MarketPrice=Items[t].getAttribute('MarketPrice');
    						
						    var fbUpDownrate = Items[t].getAttribute('fbUpDownrate');
						    var Disrate = Items[t].getAttribute('Disrate');
						    var colorcss = Items[t].getAttribute('colorcss');
						    
						    FbFundsDivHTML = FbFundsDivHTML + "<tr><td>" + fbcode + "</td><td><a href='http://funds.money.hexun.com/fundsdata/close/default.aspx?code=" + fbcode + "' target=_blank>" + fbname + "</a></td><td>" + MarketPrice + "</td><td " + colorcss + ">" + fbUpDownrate + "%</td><td>" + Disrate + "</td><td><a href='http://jijinba.hexun.com/" + fbcode + ",jijinba.html' target=_blank>基金吧</a></td><td><a style='cursor:hand;' onclick='javascript:delfunds(" + fbcarid + ",2,"+fbaccountid+")' class='close'>×</a></td></tr>";
                
					    }
		            }
		        }
                FbFundsDivHTML+="</table>";
		        if(document.getElementById("InnerFbFundsDiv")!=null)
                {
                     document.getElementById("InnerFbFundsDiv").innerHTML=FbFundsDivHTML;
                }
		    }
      }
   }
   hexunAPI.callMethod('hexun.photos.DelFbFundsToApI', {fbcardId:fbcardId,fbUserId:fbUserId,accountId:accountId}, listener);
   return;	
}
AddStock=function(stockuserid,stockvalue)
{
   var listener=document.getElementById('InnerStockDiv');
   listener.hexun_photos_AddStock_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {  
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
		    {
		        if(document.getElementById("fontstock")!=null)
		        {
		           document.getElementById("fontstock").style.display="block";
		        }
		    }
		    else
		    {
		        
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var mystockDivHtml="";
                mystockDivHtml="<table cellpadding='0' cellspacing='0'>";
                mystockDivHtml+="		<tr>";
                mystockDivHtml+="			<th>代码</th>";
                mystockDivHtml+="			<th>名称</th>";
                mystockDivHtml+="			<th>现价</th>";
                mystockDivHtml+="			<th>涨跌幅</th>";
                mystockDivHtml+="			<th>开盘价</th>";
                mystockDivHtml+="			<th>成交量</th>";
                mystockDivHtml+="			<th>换手率</th>";
                mystockDivHtml+="			<th>&nbsp;</th>";
                mystockDivHtml+="			<th>&nbsp;</th>";
                mystockDivHtml+="		</tr>";
                if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
                {
		            if(Items.length>0)
		            {
    		            
		                for (var t=0;t<Items.length;t++) 
					    {
						    var codeId = Items[t].getAttribute('codeId');
						    var rqcodeId = Items[t].getAttribute('rqcodeId');
						    var name = Items[t].getAttribute('name');
						    var price=Items[t].getAttribute('price');
    						
						    var open = Items[t].getAttribute('open');
						    var volume = Items[t].getAttribute('volume');
						    var UpDownRate = Items[t].getAttribute('UpDownRate');
						    var AvgPrice=Items[t].getAttribute('AvgPrice');
						    var color=Items[t].getAttribute('color');
						    mystockDivHtml = mystockDivHtml + "<tr><td>" + rqcodeId + "</td><td><a href='http://stockdata.stock.hexun.com/" + rqcodeId + ".shtml' target=_blank>" + name + "</a></td><td " + color + ">" + price + "</td><td " + color + ">" + UpDownRate + "%</td><td>" + open + "</td><td>" + volume + "</td><td>" + AvgPrice + "%</td><td><a href='http://guba.hexun.com/" + rqcodeId + ",guba.html' target=_blank>股吧</a></td><td><a  class='close' style='cursor:hand;' onclick='javascript:delstock(" + codeId + ")'>×</a></td></tr>";
				        }
		            }
		        }
		        mystockDivHtml=mystockDivHtml+"</table>";
		        if(document.getElementById("InnerStockDiv")!=null)
                {
                       document.getElementById("InnerStockDiv").innerHTML=mystockDivHtml;
                }
		    }
      }
   }
   hexunAPI.callMethod('hexun.photos.AddStock', {stockuserid:stockuserid,stockvalue:stockvalue}, listener);
   return;	
}
ShowMyStock=function(smsId)
{
    var listener=document.getElementById('InnerStockDiv');
   listener.hexun_photos_ShowMyStock_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {  
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
		    {}
		    else
		    {
		        
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var mystockDivHtml="";
                mystockDivHtml="<table cellpadding='0' cellspacing='0'>";
                mystockDivHtml+="		<tr>";
                mystockDivHtml+="			<th>代码</th>";
                mystockDivHtml+="			<th>名称</th>";
                mystockDivHtml+="			<th>现价</th>";
                mystockDivHtml+="			<th>涨跌幅</th>";
                mystockDivHtml+="			<th>开盘价</th>";
                mystockDivHtml+="			<th>成交量</th>";
                mystockDivHtml+="			<th>换手率</th>";
                mystockDivHtml+="			<th>&nbsp;</th>";
                mystockDivHtml+="			<th>&nbsp;</th>";
                mystockDivHtml+="		</tr>";
                if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
                {
		            if(Items.length>0)
		            {
    		            
		                for (var t=0;t<Items.length;t++) 
					    {
						    var codeId = Items[t].getAttribute('codeId');
						    var rqcodeId = Items[t].getAttribute('rqcodeId');
						    var name = Items[t].getAttribute('name');
						    var price=Items[t].getAttribute('price');
    						
						    var open = Items[t].getAttribute('open');
						    var volume = Items[t].getAttribute('volume');
						    var UpDownRate = Items[t].getAttribute('UpDownRate');
						    var AvgPrice=Items[t].getAttribute('AvgPrice');
						    var color=Items[t].getAttribute('color');
						    mystockDivHtml = mystockDivHtml + "<tr><td>" + rqcodeId + "</td><td><a href='http://stockdata.stock.hexun.com/" + rqcodeId + ".shtml' target=_blank>" + name + "</a></td><td " + color + ">" + price + "</td><td " + color + ">" + UpDownRate + "%</td><td>" + open + "</td><td>" + volume + "</td><td>" + AvgPrice + "%</td><td><a href='http://guba.hexun.com/" + rqcodeId + ",guba.html' target=_blank>股吧</a></td><td><a  class='close' style='cursor:hand;' onclick='javascript:delstock(" + codeId + ")'>×</a></td></tr>";
				        }
		            }
		        }
		        mystockDivHtml=mystockDivHtml+"</table>";
		        if(document.getElementById("InnerStockDiv")!=null)
                {
                       document.getElementById("InnerStockDiv").innerHTML=mystockDivHtml;
                }
		    }
      }
   }
   hexunAPI.callMethod('hexun.photos.ShowMyStock', {smsId:smsId}, listener);
   return;	
}
AddFunds=function(fundsuserid,fundsvalue)
{
   var listener=document.getElementById('InnerKfFundsDiv');
   listener.hexun_photos_AddFunds_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {  
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="1")
		    {
		        if(document.getElementById("fontfunds")!=null)
		        {
		           document.getElementById("fontfunds").style.display="block";
		        }
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
            {
		    
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var KfFundsDivHtml="";
                KfFundsDivHtml+="<table cellpadding='0' cellspacing='0' id='mykffundsTable'>";
                KfFundsDivHtml+="		<tr>";
                KfFundsDivHtml+="			<th>开基代码</th>";
                KfFundsDivHtml+="			<th width='100'>开基名称</th>";
                KfFundsDivHtml+="			<th>今日估算净值</th>";
                KfFundsDivHtml+="			<th>昨日净值</th>";
                KfFundsDivHtml+="			<th>日涨跌</th>";
                KfFundsDivHtml+="			<th>费率　</th>";
                KfFundsDivHtml+="			<th>&nbsp;</th>";
                KfFundsDivHtml+="			<th>&nbsp;</th>";
                KfFundsDivHtml+="		</tr>";
                if(Items.length>0)
	            {
		            
	                for (var t=0;t<Items.length;t++) 
				    {
					    var cardid = Items[t].getAttribute('cardid');
					    var code = Items[t].getAttribute('code');
					    var fname = Items[t].getAttribute('fname');
					    var UnitPrice=Items[t].getAttribute('UnitPrice');
					    var todayPrice=Items[t].getAttribute('todayprice');
						var fUpDownrate = Items[t].getAttribute('fUpDownrate');
					    var applyfeerate = Items[t].getAttribute('applyfeerate');
					    var colorcss = Items[t].getAttribute('colorcss');
					    var accountId=Items[t].getAttribute('accountid');
					    KfFundsDivHtml = KfFundsDivHtml + "<tr><td>" + code + "</td><td><a href='http://funds.money.hexun.com/fundsdata/open/default.aspx?code=" + code + "' target=_blank>" + fname + "</a></td><td align=center>"+todayPrice+"</td><td>" + UnitPrice + "</td><td " + colorcss + ">" + fUpDownrate + "%</td><td><a href='http://funds.money.hexun.com/fundsdata/open/summarize/data4.aspx?code="+code+"' target=_blank>" + applyfeerate + "</a></td><td><a href='http://jijinba.hexun.com/" + code + ",jijinba.html' target=_blank>基金吧</a></td><td><a style='cursor:hand;' onclick='javascript:delfunds("+cardid+",1,"+accountId+")' class='close'>×</a></td></tr>";
                     }
	            }
		        KfFundsDivHtml+="</table>";
		        if(document.getElementById("InnerKfFundsDiv")!=null)
                {
                     document.getElementById("InnerKfFundsDiv").innerHTML=KfFundsDivHtml;
                }
		    }
		    else
		    {
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        var FbFundsDivHTML="";
                FbFundsDivHTML+="<table cellpadding='0' cellspacing='0' id='myfbfundsTable'>";
                FbFundsDivHTML+="		<tr>";
                FbFundsDivHTML+="			<th>封基代码</th>";
                FbFundsDivHTML+="			<th width='130'>封基名称</th>";
                FbFundsDivHTML+="			<th>市场价格</th>";
                FbFundsDivHTML+="			<th>日涨跌</th>";
                FbFundsDivHTML+="			<th>折价率</th>";
                FbFundsDivHTML+="			<th>&nbsp;</th>";
                FbFundsDivHTML+="			<th>&nbsp;</th>";
                FbFundsDivHTML+="		</tr>";
                if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="3")
                {
		            if(Items.length>0)
		            {
    		            
		                for (var t=0;t<Items.length;t++) 
					    {
						    var fbcarid = Items[t].getAttribute('fbcarid');
						    var fbcode = Items[t].getAttribute('fbcode');
						    var fbname = Items[t].getAttribute('fbname');
						    var MarketPrice=Items[t].getAttribute('MarketPrice');
    						var fbUpDownrate = Items[t].getAttribute('fbUpDownrate');
						    var Disrate = Items[t].getAttribute('Disrate');
						    var colorcss = Items[t].getAttribute('colorcss');
						    var fbaccountid=Items[t].getAttribute('accountid');
						    FbFundsDivHTML = FbFundsDivHTML + "<tr><td>" + fbcode + "</td><td><a href='http://funds.money.hexun.com/fundsdata/close/default.aspx?code=" + fbcode + "' target=_blank>" + fbname + "</a></td><td>" + MarketPrice + "</td><td " + colorcss + ">" + fbUpDownrate + "%</td><td>" + Disrate + "</td><td><a href='http://jijinba.hexun.com/" + fbcode + ",jijinba.html' target=_blank>基金吧</a></td><td><a style='cursor:hand;' onclick='javascript:delfunds(" + fbcarid + ",2,"+fbaccountid+")' class='close'>×</a></td></tr>";
                
					    }
		            }
		        }
                FbFundsDivHTML+="</table>";
		        if(document.getElementById("InnerFbFundsDiv")!=null)
                {
                     document.getElementById("InnerFbFundsDiv").innerHTML=FbFundsDivHTML;
                }
		    }
       }
   }
   hexunAPI.callMethod('hexun.photos.AddFunds', {fundsuserid:fundsuserid,fundsvalue:fundsvalue}, listener);
   return;	
}
SendInvite=function(sendId,maillist)
{
   dispProcessing();

   var listener=document.getElementById('if');
   listener.hexun_photos_SendInvite_onLoad=function(success,responseXML,responseText)
   {
      if(success)
      {
            if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
		    {
		    　　document.getElementById("processing").style.display="none";
		    }
		    else 
		    {
		       
		       document.getElementById("processing").style.display="none";
		       var mailhtml="";
		       var tempHtml="";
		       var mailarr=new Array();
		       mailarr=maillist.split(",");
		       var sendCount=0;
		       for(var i=0;i<mailarr.length-1;i++)
		       {
		         
		          if(mailarr[i]!="")
		          {
		              var mailname=mailarr[i].split("|")[1];
		              var mailaddress=mailarr[i].split("|")[0];
		              tempHtml+="<li><div class=\"name\">"+mailname+"</div><div class=\"email\">&lt;"+mailaddress+"&gt;</div></li>";
				      sendCount++;  
				   }
		       }
		       
		       if(sendCount>0)
		       {
		          mailhtml="<p class=\"addtip\">已经向 "+sendCount+" 位 Mail好友发送了邀请</p>";
		          mailhtml+="<div class=\"selectbox\"><ul>";
		          mailhtml+=tempHtml;
		          mailhtml+="</ul></div>";
		          mailhtml+="<div class=\"sbtn\"><input type=\"button\" value=\"继续邀请\" style=\"cursor:hand;\" onclick=\"javascript:document.location='admin_xzhy.aspx';\"/>　　<a href=\"http://hexun.com/home/\">回到我的家</a></div>";
		       }
		       
		       document.getElementById("if").innerHTML=mailhtml;
		       document.getElementById("if").style.display="block";
		       document.getElementById("otheraddtip").style.display="none";
		       document.getElementById("otherselect").style.display="none";
		       document.getElementById("otherbtn").style.display="none";
		       document.getElementById("friaddtip").style.display="none";
		       document.getElementById("friselect").style.display="none";
		       document.getElementById("hexunaddip").style.display="none";
		     
		       document.getElementById("hexunselect").style.display="none";
		       
		       getfocus(4,3);
		       
		     }
		}
      
   }
   hexunAPI.callMethod('hexun.photos.SendInvite', {sendmail:1,sendId:sendId,maillist:maillist}, listener);	
   return ;
}
getmaillist=function(mailname,pwd,mailhost,userid)
{
    
    document.getElementById("waitdiv").style.display="block";
    document.getElementById("attentionp").style.display="none";
    var listener = document.getElementById('sf');
    
    listener.hexun_photos_getmaillist_onLoad = function(success, responseXML, responseText) 
	{	
		
		if(success) 
		{
		  
		    if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			{
				GotoHead();
			}
			else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			{
			    GotoHead();
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="4")
		    {
		        document.getElementById("waitdiv").style.display="none";
		        document.getElementById("attentionp").style.display="";
		        document.getElementById("attentionp").innerHTML = "系统出现了一些微小而不可预知的错误，没有获取到联系人" ;
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="2")
		    {
		        document.getElementById("waitdiv").style.display="none";
		        document.getElementById("attentionp").style.display="";
		        document.getElementById("attentionp").innerHTML = "您这个邮箱貌似没有联系人";
		    }
		    else if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="3")
		    {
		        document.getElementById("waitdiv").style.display="none";
		        document.getElementById("attentionp").style.display="";
		        document.getElementById("attentionp").innerHTML = "用户名或密码错";
		    }
		    else
		    {
		       
		      
		        var hexunHtml="",otherHtml="",friHtml="";
		        var hexunCount=0,otherCount=0,friCount=0;
		        var Items = responseXML.documentElement.getElementsByTagName('friend');
		        if(Items.length>0)
		        {
		            for(var i=0;i<Items.length;i++)
		            {
		                var friendname=Items[i].getAttribute('friendname');
		                var friendmail=Items[i].getAttribute('friendmail');
		                var hexunid=Items[i].getAttribute('hexunid');
		                var hexunmail=Items[i].getAttribute('hexunmail');
		                var photourl=Items[i].getAttribute('photourl');
		                var hexunname=Items[i].getAttribute('hexunname');
		                var isfri=Items[i].getAttribute('isfri');
		                if(hexunid=="0")
		                {
		                    if(otherCount==0)
		                    {
		                      otherHtml+="<div class=\"selectall\" id=\"selallchk\">";
				              otherHtml+="<a onclick=\"otherchk(true);\" style=\"cursor:hand;\">全选</a></div>";
			                }
		                    otherHtml+="<ul>";
				            otherHtml+="<li><input type=\"checkbox\" id=\"Listchk\" name=\"Listchk\" value=\""+friendmail+"|"+friendname+"\"><div class=\"name\">"+friendname+"</div><div class=\"email\">"+friendmail+"</div></li></ul>";
		                    otherCount++;
		                }
		                else
		                {
		                   if(isfri==0)
		                   {
		                       if(hexunCount==0)
		                       {
		                          hexunHtml+="<div class=\"selectall\">";
				                  hexunHtml+="</div>";
				               }
		                       hexunHtml+="<dl>";
                               hexunHtml+="<dt><a href=\"http://hexun.com/"+hexunid+"\" target=_blank><img src=\""+photourl+"\" /></a></dt>";
                               hexunHtml+="<dd><a href=\"http://hexun.com/"+hexunid+"\" target=_blank><strong>"+hexunname+"</strong></a></dd>";
                               hexunHtml+="<dd>&lt;"+friendmail+"&gt;</dd>";
                               hexunHtml+="<dd><input type=\"button\"  style=\"width: 75px; height: 19px; border: none; background: url(/manage/img/btn-mashang.gif);font-size: 12px;cursor: pointer;line-height: 19px;\" onclick=\"javascript:window.open('http://message.hexun.com/FriendsAdd.aspx?friend="+hexunid+"','添加好友',' toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=yes, status=yes')\" value=\"加为好友\"></dd>"; 
                               hexunHtml+="</dl>";
		                       hexunCount++;
		                   }
		                   else
		                   {
		                         if(friCount==0)
		                         {
		                             friHtml+="<div class=\"selectall\">";
				                     friHtml+="</div>";
		                         }
		                         friHtml+="<dl>";
				                 friHtml+="<dt><a href=\"http://hexun.com/"+hexunid+"\" target=_blank><img src=\""+photourl+"\" /></a></dt>";
				                 friHtml+="<dd><a href=\"http://hexun.com/"+hexunid+"\" target=_blank><strong>"+hexunname+"</strong></a></dd>";
				                 friHtml+="<dd>&lt;"+friendmail+"&gt;</dd>";
			                     friHtml+="</dl>";
		                         friCount++;
		                   }
		                }
		           }
		           if(hexunCount>0||otherCount>0||friCount>0)
		           {
		             
		             document.getElementById("waitdiv").style.display="none";
		             document.getElementById("searchdiv").style.display="none";
		             document.getElementById("finddiv").style.display="none";
		           }
		           if(friCount>0)
		           {
		             document.getElementById("friaddtip").innerHTML="有 "+friCount+" 位已经是你的和讯好友，去转转？";
		             document.getElementById("friaddtip").style.display="block";
		             document.getElementById("friselect").innerHTML=friHtml;
		             document.getElementById("friselect").style.display="block";
		           }
		           if(hexunCount>0)
		           {
		             document.getElementById("hexunaddip").innerHTML="有 "+hexunCount+" 位已经在和讯安家了，把他们加为好友吧";
		             document.getElementById("hexunaddip").style.display="block";
		             document.getElementById("hexunselect").innerHTML=hexunHtml;
		             document.getElementById("hexunselect").style.display="block";
		             document.getElementById("hexunbtn").style.display="block";
		           }
		           if(otherCount>0)
		           {
		             
		               document.getElementById("otheraddtip").innerHTML="有 "+otherCount+" 位还没有在和讯安家，邀请他们来和讯和你做邻居吧";
		               document.getElementById("otheraddtip").style.display="block";
		               document.getElementById("otherselect").innerHTML=otherHtml;
		               document.getElementById("otherselect").style.display="block";
		               document.getElementById("otherbtn").style.display="block";
		             
		           }
		        }
		    }
		    
		
	    }	
	}
	hexunAPI.callMethod('hexun.photos.getmaillist', {mailname:mailname,pwd:pwd,mailhost:mailhost,userid:userid}, listener);	
    return ;
	
     
}

init_quoteSaveMessage=function(blogname,loginstate,UserName,Url,Content,screen,quotemesid,quoteuserid,quoteusername,chkcode)
{
  //debugger;
  var listener = document.getElementById('MessageBoardDivItem');
  
   listener.hexun_photos_MessageQuoteInfo_onLoad = function(success, responseXML, responseText) 
	{	
		
		if(success) 
		{
		    var ret = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
            if(ret.toLowerCase()=="false")
		    {
		      alert("验证码错误！");
		      return ;
        		      
		    }
		    else if(ret !="1")
		    {
				 alert("留言中含有禁用词！");
				  return ;

			}
			ShowMessageInfo(blogname,loginstate,UserName,screen);
		} 
		else 
		{
			alert("错误");
		}
	}
	hexunAPI.callMethod('hexun.photos.MessageQuoteInfo', {blogname1:blogname,loginstate1:loginstate,UserName1:UserName,Url1:Url,Content1:Content,quotemesid:quotemesid,quoteuserid:quoteuserid,quoteusername:quoteusername,Quote:1,chkcode:chkcode}, listener);	
    return ;
  
}

init_SaveMessageInfo=function(blogname,loginstate,UserName,Url,Content,screen,code)
{
   var listener = document.getElementById('MessageBoardDivItem');
   listener.hexun_photos_MessageInfo_onLoad = function(success, responseXML, responseText) 
	{	
		
		if(success) 
		{
		    
		    var ret = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
		    if(ret.toLowerCase()=="false")
		    {
		      alert("验证码错误！");
        		      
		    }
		    else if( ret=="-1")
		    {
				 alert("您暂时不能发表留言！");
			}
			else if( ret=="0")
		    {
				 alert("留言中含有禁用词！");
			}
			else if(ret=="-2")
			{
			    alert("您没有留言的权限！")
			}
			else
			{
			    var sfriend=responseXML.documentElement.getElementsByTagName('friend');
			    if(sfriend.length>0)
			    {
			        var sblogname=sfriend[0].getAttribute('blogname');
			        var suserid  =sfriend[0].getAttribute('userid');
			        var susername=sfriend[0].getAttribute('username');
			        var sposttime=sfriend[0].getAttribute('posttime');
			        var slogourl =sfriend[0].getAttribute('logourl');

			    }
			    if(slogourl=="")
			    {
			       slogourl="http://hexun.com/img/ms_userLogo.gif";
			    }
			    var oldHtml=document.getElementById("MessageBoardDivItem").innerHTML;
			    var addHtml;
			    if(suserid>0)
			    {
			        addHtml="<table border='0' cellpadding='0' cellspacing='0' class='message_list'>";
			        addHtml+="<tr valign='top'>		<td class='message_list_left'><div class='message_list_left_1'>";
			        addHtml+="<a href='http://hexun.com/"+sblogname+"' target='_blank'><img  src='"+slogourl+"' border='0' width='40' height='40'></a></div>";
			        addHtml+="<div class='message_list_left_2'><a href='http://hexun.com/"+sblogname+"' target='_blank'>"+susername+"</a></div>	";
			        addHtml+="</td><td class='message_list_right'><div class='message_list_right_text'>"+Content+"</div>";
			        addHtml+="<div>"+sposttime+"</div></td></tr></table>";
			    }
			    else
			    {
			        addHtml="<table border='0' cellpadding='0' cellspacing='0' class='message_list'>";
			        addHtml+="<tr valign='top'>		<td class='message_list_left'><div class='message_list_left_1'>";
			        addHtml+="<img  src='"+slogourl+"' border='0' width='40' height='40'></div>";
			        addHtml+="<div class='message_list_left_2'>"+susername+"</div>	";
			        addHtml+="</td><td class='message_list_right'><div class='message_list_right_text'>"+Content+"</div>";
			        addHtml+="<div>"+sposttime+"</div></td></tr></table>";
			    }
			    document.getElementById("MessageBoardDivItem").innerHTML=addHtml+oldHtml;
			    refreshCode();
			   
			}
		} 
		else 
		{}
	}
	hexunAPI.callMethod('hexun.photos.MessageInfo', {blogname:blogname,loginstate:loginstate,UserName:UserName,Url:Url,Content:Content,code:code}, listener);	
    return ;
}

ShowMessageInfo=function(blogname,loginstate,UserName,screen)
{
    var obj=document.getElementById("MessageBoard");
    var topCount=obj.getAttribute('topcount');
    var listener=document.getElementById('MessageBoardDivItem');
    listener.hexun_photos_ShowMessageInfo_onLoad = function(success, responseXML, responseText)
    {
        if(success)
        {
           var ShowMessageInfoItems=responseXML.documentElement.getElementsByTagName('ShowMessageInfoItem');
           var itemsDiv ="";
           if(ShowMessageInfoItems.length>0)
           {
              for(var t=0;t<ShowMessageInfoItems.length;t++)
              {
                var logo = ShowMessageInfoItems[t].getAttribute('logo');
                logo=JsReplace(logo);
				var Content = ShowMessageInfoItems[t].getAttribute('Content');
				Content=JsReplace(Content);
			    var centerlogo=ShowMessageInfoItems[t].getAttribute('centerlogo');
			    centerlogo=JsReplace(centerlogo);
			    var PostTime=ShowMessageInfoItems[t].getAttribute('PostTime');
			    var CenterContent=ShowMessageInfoItems[t].getAttribute('CenterContent');
			    CenterContent=JsReplace(CenterContent);
			    var QuoteContent=ShowMessageInfoItems[t].getAttribute('QuoteContent');
			    QuoteContent=JsReplace(QuoteContent);
			    var quoteuserid=ShowMessageInfoItems[t].getAttribute('quoteuserid');
			    var quoteusername=ShowMessageInfoItems[t].getAttribute('quoteusername');
			    var quoterealname=ShowMessageInfoItems[t].getAttribute('quoterealname');
			    var mesid=ShowMessageInfoItems[t].getAttribute('mesid'); 
			    itemsDiv+= "<table border='0' cellpadding='0' cellspacing='0' class='message_list'>";
                itemsDiv+="<tr valign='top'>";
				itemsDiv+="		<td class='message_list_left'>";
                itemsDiv+= centerlogo;
				itemsDiv+="		</td>";
				itemsDiv+="		<td class='message_list_right'>";
				itemsDiv+="			<div class='message_list_right_text'>"+CenterContent+"</div>";
                itemsDiv+= "			<div>" +PostTime + " <a style='cursor:hand;' onclick=\"javascript:quote('"+mesid+"','"+QuoteContent+"','"+quoteusername+"','"+quoteuserid+"','"+quoterealname+"')\">[引用]</a></div></td></tr></table>";
		    }
		    document.getElementById('MessageBoardDivItem').innerHTML = itemsDiv;
		  }
        }
        else
        {
         
        }
    } 
    hexunAPI.callMethod('hexun.photos.ShowMessageInfo', {blogname:blogname,TopCount:topCount}, listener);	
	return ;
}
function Change2Column()    //将最右边的加到最左边
{       
        //得到左边div的数量
        var maxPosition = left_side_inner.childNodes.length;
        for(var j=0;j<left_side_inner.childNodes.length; j++)
       {
            if(left_side_inner.childNodes[j].tagName=='DIV')
            {
                var po =  left_side_inner.childNodes[j].getAttribute("position");
                if( po > maxPosition )
                    maxPosition = po;
			}	
        }
       //将右边的div加入到左边 
       var idList = new Array();
       var cateIDList = new Array();
       var ids="";
       for(var j=0;j<right_side_inner.childNodes.length; j++)
       {
            if(right_side_inner.childNodes[j].tagName=='DIV')
            {
                idList[j] = right_side_inner.childNodes[j].id ;
                cateIDList[j]= right_side_inner.childNodes[j].getAttribute("cateid");
                if( j < right_side_inner.childNodes.length - 1 )
                {
                    ids+=",";
                }
			}	
        }
        for( j=0 ; j < idList.length;j++ )
        {
           RemoveDiv(idList[j]);  
           maxPosition++;
           strconfig = SetNoteToConfig(strconfig,cateIDList[j],"position",maxPosition);
           strconfig = SetNoteToConfig(strconfig,cateIDList[j],"screen","left");
        }
       
        //调边距离
        ControlDivWidth("right_side_inner",0);
        ControlDivWidth("main_inner",722);
       
        //控制高度
        var L_Height=document.getElementById("left_side_inner").getAttribute("l_PosHeight");
        var M_Height=document.getElementById("main_inner").getAttribute("m_PosHeight");
        var R_Height=document.getElementById("right_side_inner").getAttribute("r_PosHeight");
        L_Height=L_Height+R_Height;
        document.getElementById("left_side_inner").setAttribute("l_PosHeight",L_Height);
        var MaxHeight;
        MaxHeight=L_Height>M_Height?L_Height:M_Height;
        document.getElementById("main_inner").style.height=MaxHeight;
        document.getElementById("right_side_inner").style.height=MaxHeight;
        document.getElementById("left_side_inner").style.height=MaxHeight;
                
        
        CreateDragContainer(document.getElementById('left_side_inner'), document.getElementById('main_inner'), document.getElementById('right_side_inner'));
      
        var listener = document.getElementById('left_side_inner');
        listener.hexun_drag_Change2Column_onLoad = function(success, responseXML, responseText) 
	    {	
	        if(success) 
		    {
    			
			   if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			    {
    				alert("合并错误!");
			    }
			    if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			    {
    				alert("请先登录!");
			    }
		    } 
		    else 
		    {
			    alert("错误！");
		    }
	    } 
	    //IDS: 需要搬迁的栏目ID列表      MAXPOSITION:左栏目前的栏目数量
	    hexunAPI.callMethod('hexun.drag.Change2Column', {userId:UserID,ConfigNew:strconfig,FormatType:1,ChangeColumn:1}, listener,'/photoresponse.aspx');	
    	
	return ;            
}
function GotoHead()
{
	document.location.href='http://reg.hexun.com/login.aspx?gourl='+document.URL;	
}
function Change3Column()    //变三列
{
   
     ControlDivWidth("right_side_inner",204);
     ControlDivWidth("main_inner",508);
     CreateDragContainer(document.getElementById('left_side_inner'), document.getElementById('main_inner'), document.getElementById('right_side_inner'));
     var listener = document.getElementById('left_side_inner');
     listener.hexun_drag_Change2Column_onLoad = function(success, responseXML, responseText) 
	 {	
	        if(success) 
		    {
    			
			    if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="0")
			    {
    				alert("合并错误!");
			    }
			    if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-1")
			    {
    				alert("请先登录!");
			    }
			    if(responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue=="-2")
			    {
    				alert("更新数据失败!");
			    }
		    } 
		    else 
		    {
			    alert("错误！");
		    }
	 } 
	    //IDS: 需要搬迁的栏目ID列表      MAXPOSITION:左栏目前的栏目数量

	hexunAPI.callMethod('hexun.drag.Change2Column', {userId:UserID,ConfigNew:strconfig,FormatType:0,ChangeColumn:1}, listener,'/photoresponse.aspx');	
}
function ControlDivWidth(divID,width)
{
    if( document.getElementById(divID)!=null )
        document.getElementById(divID).style.width= width;
}
function RemoveDiv(removeDivID)
{
    var e = document.getElementById(removeDivID); 
    var html = e.innerHTML;
   // alert(html);
    e.innerHTML="";
  
    var divid = e.id;           e.id="";
    var cateid = e.cateid;      e.cateid="";
    var catename = e.cateName;  e.cateName="";
    var catediv=e.cateDiv;      e.cateDiv="";
    var showtype= e.showType;   e.showType="";
    var listid = e.listid;      e.listid="";
    var status = e.status;      e.status="";
    var topcount = e.topcount;  e.topcount="";
    var open = e.open;          e.open="";
    var position = e.position;  e.position="";
    var column = e.column;      e.column="";
    var mydiv;       
              
    mydiv=document.createElement("div");
    mydiv.id=divid
    mydiv.cateid = cateid
    mydiv.cateName=catename;
    mydiv.cateDiv = catediv;
    mydiv.showType = showtype;
    mydiv.listid = listid;
    mydiv.status = status;
    mydiv.topcount = topcount;
    mydiv.opn = open;
    mydiv.position = position;
    mydiv.column = column;
    mydiv.className = "side_block";
    mydiv.innerHTML = html;
    right_side_inner.removeChild(e);
    left_side_inner.appendChild(mydiv);

}
Wap_SendWapPush = function(ActionDiv,SendType,WatchBlogName,WatchUserName)
{
	var listener = document.getElementById(ActionDiv);
	listener.hexun_edit_wappush_onLoad = function(success, responseXML, responseText) 
	{	
		if (success) 
		{	
			var stat = responseXML.documentElement.getElementsByTagName('state')[0].firstChild.nodeValue;
			
			if(stat == "-1")
			{
				alert("请先登陆！");
			}		
			else  if ( stat == "-2")
			{
				if( confirm("您还没有绑定手机,请您绑定手机后再进行操作") )
					document.location.href = "http://reg.hexun.com/mobileconfirm.aspx";
			}
			else if( stat == "0")
			{														
				alert("手机地址已发送,请查收！");	
			}
			else
				alert("发送失败！");	
		} 
		else 
		{
			alert("错误！");
		}	
	}	
	hexunAPI.callMethod('hexun.edit.wappush', {SendType:SendType,BlogName:WatchBlogName,UserName:WatchUserName,WapPush:1}, listener,'/teamResponse.aspx');	
	return ;

}
//模板选择
SaveTemplateSet = function (tID)
{
    var listener = document.getElementById("phlist");
    var loginUrl = document.URL.replace("=","＝");
    //alert(loginUrl);
    listener.hexun_blog_templateset_onLoad = function(success, responseXML, responseText) 
	{	
		if (success) 
		{
		    var stat = responseXML.documentElement.getElementsByTagName('friend')[0].firstChild.nodeValue;
		    if (stat == "0")
			{
				alert("请先登陆，再使用模板！");
				//GotoHead();
			}
			else
			{
			    if(confirm("您已经成功更新模板，去您的主页看看效果吗？"))
			    {
			        window.open("http://home.hexun.com/"+stat+"/default.html");
			    }	
			}			
		}
		
	}
	hexunAPI.callMethod('hexun.blog.templateset', {TemplatesetTid:tID,loginUrl:loginUrl}, listener,'/ResponseClient.aspx');	
	return ;

}
