/*
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: script_manage.js 13178 2009-08-17 02:36:39Z liguode $
*/

//更新通知数
function shownotice(){
    var _hasExecuted = false;
	if (_hasExecuted === false) {
		var timer = null;
		var layer = $("membernotemenu_menu"),box = $("header");
		var top,checkShow = function() {};
		var box_top = box.offsetTop+ UI.height(box);
		ie6 = /msie 6/.test(navigator.userAgent.toLowerCase());
		_hasExecuted = true;
		if (ie6 || document.compatMode === "BackCompat") {
			checkShow = function() {
				if (layer.style.display == "none") {
					clearTimeout(timer);
					timer = null;
					top = UI.scrollY();
					if(UI.windowWidth()>970)
					    right = (UI.windowWidth()-970)/2;
					else
					    right = 0;		
					layer.style.top = (top < box_top ? box_top : top)+ "px";
					layer.style.right = right + "px";
					layer.style.display = "";
				}
			};
			window.onscroll = function() {
				if (top != UI.scrollY()) {
					layer.style.display = "none";
					if (timer == null) {
						timer = setTimeout(checkShow, 500)
					}
				}
			}
		} else {
			top = UI.scrollY();
			checkShow = function() {
				if (layer.style.display == "none") {
					layer.style.display = ""
				}
			};
			if(UI.windowWidth()>990)
			    right = (UI.windowWidth()-990)/2;
			else
			    right = 0;
			layer.style.cssText = "position:fixed;top:"+ (top < box_top ? box_top - top : 0)+ "px;right:" + right + "px";
			window.onscroll = function() {
				top = UI.scrollY();
				layer.style.right = right+ "px";
				layer.style.top = (top < box_top ? box_top - top: 0)+ "px";
			}
		}
	}
	_hasExecuted && checkShow();
}

function updatenotenum(){
    var random = new Date().getTime();
    var x = new Ajax();
    x.get('do.php?ac=ajax&op=remind&random'+random, function(s){
		if(s=="error"){
		    $("membernotemenu_menu").style.display = 'none';
		}else{
		    shownotice();
		    $("membernotemenu_menu").innerHTML= s;
		}
    });
}

function colsenote(){
    $("membernotemenu_menu").style.display = 'none';
    window.onscroll = function(){};
    var random = new Date().getTime();
    var x = new Ajax();
    x.get('do.php?ac=ajax&op=setnoticecookie&random'+random, function(s){}); 
}

//更新通知数
function normalupdate(){
    var random = new Date().getTime();
    var x = new Ajax();
    if(Cookie.get("remind")!=1){
        x.get('do.php?ac=ajax&op=remind&type=normal&random'+random, function(s){
		    if(s=="error"){
                $("membernotemenu_menu").style.display = 'none';
		    }else{
		        shownotice();
	            $("membernotemenu_menu").innerHTML= s;
		    }
        });
    }
}

//添加留言
function wall_add(cid, result) {
	if(result) {
		var obj = $('comment_ul');
		var newli = document.createElement("div");
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=comment', function(s){
			newli.innerHTML = s;
		});
		obj.insertBefore(newli, obj.firstChild);
		if($('comment_message')) {
			$('comment_message').value= '';
		}
		//提示获得积分
		showreward();
	}
}

//添加分享
function share_add(sid, result) {
	if(result) {
		var obj = $('share_ul');
		var newli = document.createElement("div");
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=share', function(s){
			newli.innerHTML = s;
		});
		obj.insertBefore(newli, obj.firstChild);
		$('share_link').value = 'http://';
		$('share_general').value = '';
		//提示获得积分
		showreward();
	}
}
//添加评论
function comment_add(id, result) {
	if(result) {
		var obj = $('comment_ul');
		var newli = document.createElement("div");
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=comment&type='+document.getElementsByName('idtype')[0].value,function(s){
			newli.innerHTML = s;
		});
		if($('comment_prepend')){
			obj = obj.firstChild;
			while (obj && obj.nodeType != 1){
				obj = obj.nextSibling;
			}
			obj.parentNode.insertBefore(newli, obj);
		} else {
			obj.appendChild(newli);
		}
		if($('comment_message')) {
			$('comment_message').value= '';
		}
		if($('comment_replynum')) {
			var a = parseInt($('comment_replynum').innerHTML);
			var b = a + 1;
			$('comment_replynum').innerHTML = b + '';
		}
		//提示获得积分
		showreward();
	}
}
//编辑
function comment_edit(id, result) {
	if(result) {
		var ids = explode('_', id);
		var cid = ids[1];
		var obj = $('comment_'+ cid +'_li');
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=comment&type='+document.getElementsByName('idtype')[0].value+'&cid='+ cid, function(s){
			obj.innerHTML = s;
		});
	}
}
//删除
function comment_delete(id, result) {
	if(result) {
		var ids = explode('_', id);
		var cid = ids[1];
		var obj = $('comment_'+ cid +'_li');
		obj.style.display = "none";
		if($('comment_replynum')) {
			var a = parseInt($('comment_replynum').innerHTML);
			var b = a - 1;
			$('comment_replynum').innerHTML = b + '';
		}
	}
}

function at_delete(id, result) {
    if(result) {
		var ids = explode('_', id);
		var doid = ids[1];
		if($('dl'+ doid)){
		    var obj = $('dl'+ doid);
		    var oheight = UI.height(obj);
		    displayOpacity('dl'+ doid,100,"none",30,oheight);
		}
	}
}

//删除feed
function feed_delete(id, result) {
	if(result) {
		var ids = explode('_', id);
		var feedid = ids[1];
		var obj = $('feed_'+ feedid +'_li');
		obj.style.display = "none";
	}
}

//删除分享
function share_delete(id, result) {
	if(result) {
		var ids = explode('_', id);
		var sid = ids[1];
		var obj = $('share_'+ sid +'_li');
		obj.style.display = "none";
	}
}
//删除好友
function friend_delete(id, result) {
	if(result) {
		var ids = explode('_', id);
		var uid = ids[1];
		var obj = $('friend_'+ uid +'_li');
		if(obj != null) obj.style.display = "none";
		var obj2 = $('friend_tbody_'+uid);
		if(obj2 != null) obj2.style.display = "none";
		updatenotenum();
	}
}
//更改分组
function friend_changegroup(id, result) {
	if(result) {
		var ids = explode('_', id);
		var uid = ids[1];
		var obj = $('friend_group_'+ uid);
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=getfriendgroup&uid='+uid, function(s){
			obj.innerHTML = s;
		});
	}
}
//更改分组名
function friend_changegroupname(id, result) {
	if(result) {
		var ids = explode('_', id);
		var group = ids[1];
		var objj = $('friend_groupname_'+ group);
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=getfriendname&group='+group, function(s){
			msg=s.split("@@");
			if(objj){
				objj.innerHTML = msg[0];
			}else{
				var obj = $('friendgroup');
				var newli = document.createElement("li");
				newli.id="groupname_"+group;
				newli.innerHTML = msg[1];
				obj = obj.firstChild;
				while (obj && obj.nodeType != 1){
					obj = obj.nextSibling;
				}
				obj.parentNode.insertBefore(newli, obj);
			}
		});
	}
}
function friend_delgroupname(id, result){
	if(result) {
		var ids = explode('_', id);
		var group = ids[1];
		var obj = $('groupname_'+ group);
		obj.style.display = "none";
	}
}
//添加回帖
function post_add(pid, result) {
	if(result) {
		var obj = $('post_ul');
		var newli = document.createElement("div");
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=post', function(s){
			newli.innerHTML = s;
		});
		obj.appendChild(newli);
		if($('message')) {
			$('message').value= '';
			newnode = $('quickpostimg').rows[0].cloneNode(true);
			tags = newnode.getElementsByTagName('input');
			for(i in tags) {
				if(tags[i].name == 'pics[]') {
					tags[i].value = 'http://';
				}
			}
			var allRows = $('quickpostimg').rows;
			while(allRows.length) {
				$('quickpostimg').removeChild(allRows[0]);
			}
			$('quickpostimg').appendChild(newnode);
		}
		if($('post_replynum')) {
			var a = parseInt($('post_replynum').innerHTML);
			var b = a + 1;
			$('post_replynum').innerHTML = b + '';
		}
		//提示获得积分
		showreward();
	}
}
//编辑回帖
function post_edit(id, result) {
	if(result) {
		var ids = explode('_', id);
		var pid = ids[1];

		var obj = $('post_'+ pid +'_li');
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=post&pid='+ pid, function(s){
			obj.innerHTML = s;
		});
	}
}
//删除回帖
function post_delete(id, result) {
	if(result) {
		var ids = explode('_', id);
		var pid = ids[1];
		
		var obj = $('post_'+ pid +'_li');
		obj.style.display = "none";
		if($('post_replynum')) {
			var a = parseInt($('post_replynum').innerHTML);
			var b = a - 1;
			$('post_replynum').innerHTML = b + '';
		}
	}
}
//打招呼
function poke_send(id, result) {
	if(result) {
		var ids = explode('_', id);
		var uid = ids[1];
        updatenotenum();
		if($('poke_'+ uid)) {
			$('poke_'+ uid).style.display = "none";
		}
		//提示获得积分
		showreward();
	}
}
//好友请求
function myfriend_post(id, result) {
	if(result) {
		var ids = explode('_', id);
		var uid = ids[1];
		updatenotenum();
		$('friend_'+uid).innerHTML = '<p>你们现在是好友了，接下来，您还可以：<a href="space.php?uid='+uid+'#comment" target="_blank">给TA留言</a> ，或者 <a href="cp.php?ac=poke&op=send&uid='+uid+'" id="a_poke_'+uid+'" onclick="ajaxmenu(event, this.id, 1)">打个招呼</a></p>';
	}
}
//删除好友请求
function myfriend_ignore(id) {
	var ids = explode('_', id);
	var uid = ids[1];
	$('friend_tbody_'+uid).style.display = "none";
}

//加入群组
function mtag_join(tagid, result) {
	if(result) {
		location.reload();
	}
}

//选择图片
function picView(albumid) {
	if(albumid == 'none') {
		$('albumpic_body').innerHTML = '';
	} else {
		ajaxget('do.php?ac=ajax&op=album&id='+albumid+'&ajaxdiv=albumpic_body', 'albumpic_body');
	}
}
//删除重发邮件
function resend_mail(id, result) {
	if(result) {
		var ids = explode('_', id);
		var mid = ids[1];
		var obj = $('sendmail_'+ mid +'_li');
		obj.style.display = "none";
	}
}

//设置应用不可见
function userapp_delete(id, result) {
	if(result) {
		var ids = explode('_', id);
		var appid = ids[1];
		$('space_app_'+appid).style.display = "none";
	}
}

//do评论
function docomment_get(id, result) {
	if(result) {
		var ids = explode('_', id);
		var doid = ids[1];
		if(isUndefined(ids[3]) || ids[3]=="" || ids[3]==0){
            var shuoshuo=0;
            var showid = 'docomment_'+doid;
        }else{
            var shuoshuo = ids[3];
            var showid = 'docomment_'+doid+'_'+shuoshuo;
		}
		
		var opid = 'do_a_op_'+doid;
		$(showid).style.display = '';
		$(showid).className = 'sub_doing';
		ajaxget('cp.php?ac=doing&op=getcomment&doid='+doid+'&noticeshuoshuo='+shuoshuo, showid);

		if($(opid)) {
			$(opid).innerHTML = '收起';
			$(opid).onclick = function() {
				docomment_colse(doid);
			}
		}
		//提示获得积分
		showreward();		
	}
}

function shuoshuo_add(id, result) {
	if(result) {
	    var ids = explode('_', id);
		var obj = $('shuoshuo_ol');
		var newli = document.createElement("div");
		newli.id = "newdl"+ids[1];
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=getshuoshuo',function(s){
			newli.innerHTML = s;
		});
		var yy = UI.getY($('shuoshuo_ol'));
		window.scrollTo(0, yy);
		//if($('comment_prepend')){
			obj = obj.firstChild;
			while (obj && obj.nodeType != 1){
				obj = obj.nextSibling;
			}
			obj.parentNode.insertBefore(newli, obj);
		//} else {
			//obj.appendChild(newli);
		//}
		displayOpacity(newli.id,0,"",100);
		docomment_form_close(ids[1], ids[2]);
		//提示获得积分
		showreward();
	}
}

function feed_add(id,result){
    if(result) {
	    var ids = explode('_', id);
	    if($('feed_div')){
	       var obj = $('feed_div'); 
	    }else{
		    var obj = $('personfeed');
		}
		var newli = document.createElement("ul");
		newli.id = "newdl"+ids[1];
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=getfeed',function(s){
			newli.innerHTML = s;
		});
		var yy = UI.getY(obj);
		window.scrollTo(0, yy-20);
		//if($('comment_prepend')){
			obj = obj.firstChild;
			while (obj && obj.nodeType != 1){
				obj = obj.nextSibling;
			}
			obj.parentNode.insertBefore(newli, obj);
		//} else {
			//obj.appendChild(newli);
		//}
		displayOpacity(newli.id,0,"",100);
		docomment_form_close(ids[1], ids[2]);
		//提示获得积分
		showreward();
	}
}

function docomment_colse(doid) {
	var showid = 'docomment_'+doid;
	var opid = 'do_a_op_'+doid;

	$(showid).style.display = 'none';
	$(showid).style.className = '';

	$(opid).innerHTML = '评论';
	$(opid).onclick = function() {
		docomment_get(showid, 1);
	}
}

function docomment_form(doid, id, onlydoid) {
    if($("message_menu")){
        $("message_menu").style.display = 'none';
    }
    var ids = explode('_', doid);
    doid = ids[0];
    if(isUndefined(ids[1]))
        var shuoshuo=0;
    else
        var shuoshuo = ids[1];
	var showid = 'docomment_form_'+doid+'_'+id;
	var divid = 'docomment_' + doid;
	if(id==0 && isUndefined(onlydoid))
	    var action = "getcomment";
	else
	    var action = "docomment";
	ajaxget('cp.php?ac=doing&op='+action+'&doid='+doid+'&id='+id+'&shuoshuo='+shuoshuo, showid,undefined,undefined,"do_message_"+doid+"_"+id);
	if($(divid)) {
		$(divid).style.display = '';
	}
}

function doreply_form(doid, id, type) {
    if($("message_menu")){
        $("message_menu").style.display = 'none';
    }
    if(isUndefined(type)){
        type = "";
    }
	var showid = 'docomment_form_'+doid+'_0';
	var divid = 'docomment_' + doid;
	ajaxget('cp.php?ac=doing&op=doreply&doid='+doid+'&id='+id+'&type='+type, showid,undefined,undefined,"do_message_"+doid+"_"+id);
	if($(divid)) {
		$(divid).style.display = '';
	}
}

function docomment_form_close(doid, id) {
    if(id==0)
        var showid = 'docommform_'+doid+'_'+id+'_0';
    else
	    var showid = 'docomment_form_'+doid+'_'+id;
	if($(showid)){
	    $(showid).innerHTML = '';
	}else{
	    var showid = 'docomment_form_'+doid+'_'+id;
	    $(showid).innerHTML = '';
	}
}

//feed评论
function feedcomment_get(feedid, result) {
	var showid = 'feedcomment_'+feedid;
	var opid = 'feedcomment_a_op_'+feedid;

	$(showid).style.display = '';
	$(showid).className = 'fcomment';
	ajaxget('cp.php?ac=feed&op=getcomment&feedid='+feedid, showid);
	if($(opid) != null) {
		$(opid).innerHTML = '收起';
		$(opid).onclick = function() {
			feedcomment_close(feedid);
		}
	}
}

function feedcomment_add(id, result) {
	if(result) {
		var ids = explode('_', id);
		var cid = ids[1];

		var obj = $('comment_ol_'+cid);
		var newli = document.createElement("div");
		var x = new Ajax();
		x.get('do.php?ac=ajax&op=comment&type='+document.getElementsByName('idtype')[0].value, function(s){
			newli.innerHTML = s;
		});
		obj.appendChild(newli);

		$('feedmessage_'+cid).value= '';
		//提示获得积分
		showreward();
	}
}

//关闭评论
function feedcomment_close(feedid) {
	var showid = 'feedcomment_'+feedid;
	var opid = 'feedcomment_a_op_'+feedid;

	$(showid).style.display = 'none';
	$(showid).style.className = '';

	$(opid).innerHTML = '评论';
	$(opid).onclick = function() {
		feedcomment_get(feedid);
	}
}

//分享完成
function feed_post_result(feedid, result) {
	if(result) {
		location.reload();
	}
}

//显示更多动态
function feed_more_show(feedid) {
	var showid = 'feed_more_'+feedid;
	var opid = 'feed_a_more_'+feedid;

	$(showid).style.display = '';
	$(showid).className = 'sub_doing';

	$(opid).innerHTML = '&laquo; 收起列表';
	$(opid).onclick = function() {
		feed_more_close(feedid);
	}
}

function feed_more_close(feedid) {
	var showid = 'feed_more_'+feedid;
	var opid = 'feed_a_more_'+feedid;

	$(showid).style.display = 'none';

	$(opid).innerHTML = '&raquo; 更多动态';
	$(opid).onclick = function() {
		feed_more_show(feedid);
	}
}

//发布投票
function poll_post_result(id, result) {
	if(result) {
		var aObj = $('__'+id).getElementsByTagName("a");
		window.location.href = aObj[0].href;
	}
}

//点评之后
function show_click(id) {
	var ids = id.split('_');
	var idtype = ids[1];
	var id = ids[2];
	var clickid = ids[3];
	ajaxget('cp.php?ac=click&op=show&clickid='+clickid+'&idtype='+idtype+'&id='+id, 'click_div');
	//提示获得积分
	showreward();
}

//feed菜单
function feed_menu(feedid, show) {
	var obj = $('a_feed_menu_'+feedid);
	if(obj) {
		if(show) {
			obj.style.display='block';
		} else {
			obj.style.display='none';
		}
	}
	var obj = $('feedmagic_'+feedid);
	if(obj) {
		if(show) {
			obj.style.display='block';
		} else {
			obj.style.display='none';
		}
	}
}

//填写生日
function showbirthday(){
	$('birthday').length=0;
	for(var i=0;i<28;i++){
		$('birthday').options.add(new Option(i+1, i+1));
	}
	if($('birthmonth').value!="2"){
		$('birthday').options.add(new Option(29, 29));
		$('birthday').options.add(new Option(30, 30));
		switch($('birthmonth').value){
			case "1":
			case "3":
			case "5":
			case "7":
			case "8":
			case "10":
			case "12":{
				$('birthday').options.add(new Option(31, 31));
			}
		}
	} else if($('birthyear').value!="") {
		var nbirthyear=$('birthyear').value;
		if(nbirthyear%400==0 || nbirthyear%4==0 && nbirthyear%100!=0) $('birthday').options.add(new Option(29, 29));
	}
}
/**
 * 插入涂鸦
 * @param String fid: 要关闭的层ID
 * @param String oid: 要插入到对象的目标ID
 * @param String url: 涂鸦文件的地址
 * @param String tid: 切换标签ID
 * @param String from: 涂鸦从哪来的
 * @return 没有返回值
 */
function setDoodle(fid, oid, url, tid, from) {
	if(tid == null) {
		hideMenu();
	} else {
		//用于两标签切换用
		$(tid).style.display = '';
		$(fid).style.display = 'none';
	}
	var doodleText = '[img]'+url+'[/img]';
	if($(oid) != null) {
		if(from == "editor") {
			insertImage(url);
		} else {
			insertContent(oid, doodleText);
		}
	}
}

function selCommentTab(hid, sid) {
	$(hid).style.display = 'none';
	$(sid).style.display = '';
}


//文字闪烁
function magicColor(elem, t) {
	t = t || 10;//最多尝试
	elem = (elem && elem.constructor == String) ? $(elem) : elem;
	if(!elem){
		setTimeout(function(){magicColor(elem, t-1);}, 400);//如果没有加载完成，推迟
		return;
	}
	if(window.mcHandler == undefined) {
		window.mcHandler = {elements:[]};
		window.mcHandler.colorIndex = 0;
		window.mcHandler.run = function(){
			var color = ["#CC0000","#CC6D00","#CCCC00","#00CC00","#0000CC","#00CCCC","#CC00CC"][(window.mcHandler.colorIndex++) % 7];
			for(var i = 0, L=window.mcHandler.elements.length; i<L; i++)
				window.mcHandler.elements[i].style.color = color;
		}
	}
	window.mcHandler.elements.push(elem);
	if(window.mcHandler.timer == undefined) {
		window.mcHandler.timer = setInterval(window.mcHandler.run, 500);
	}
}

//隐私密码
function passwordShow(value) {
	if(value==4) {
		$('span_password').style.display = '';
		$('tb_selectgroup').style.display = 'none';
	} else if(value==2) {
		$('span_password').style.display = 'none';
		$('tb_selectgroup').style.display = '';
	} else {
		$('span_password').style.display = 'none';
		$('tb_selectgroup').style.display = 'none';
	}
}

//隐私特定好友
function getgroup(gid) {
	if(gid) {
		var x = new Ajax();
		x.get('cp.php?ac=privacy&op=getgroup&gid='+gid, function(s){
			s = s + ' ';
			$('target_names').innerHTML += s;
		});
	}
}

function addClass(a, b) {
	if (a.className)
		if (this.hasClass(a, b))
			return false;
		else
			a.className += " " + b;
	else
		a.className = b
}

function removeClass(a, b) {
	if (a)
		a.className = a.className.replace(new RegExp("\\b" + b+ "\\b"), "")
}

function hasClass(a, b) {
	if (!a.className)
		return false;
	return a.className != a.className.replace(new RegExp("\\b" + b
			+ "\\b"), "")
}

function cursorX(obj) {
    obj.focus();   
    if (document.selection) {
	    var sel = document.selection.createRange(), c = 0;
	    var rng = obj.createTextRange();
	    rng.collapse(true);
	    rng.select();
	    var selother = document.selection.createRange();
	    sel.setEndPoint("StartToStart",selother);
	    //c = sel.text.replace(/\r\n|\n/g, "").length;
	    c = sel.text.length;
	    sel.collapse(false);
	    sel.select();
	    return c;
    } else{
	    return obj.selectionStart;
	}
}

function newnext(a) {
	a = a.nextSibling;
	if (a == null)
		return false;
	if(a && a.nodeType == 1)
	    return a;
	else
	    return newnext(a);
}

UI = window.UI || 
{
	getX : function(a) {
		return a.offsetParent ? a.offsetLeft + UI.getX(a.offsetParent)
				: a.offsetLeft;
	},
	getY : function(a) {
		return a.offsetParent ? a.offsetTop + UI.getY(a.offsetParent)
				: a.offsetTop;
	},
	width : function(a) {
		return parseInt(a.offsetWidth);
	},
	height : function(a) {
		return parseInt(a.offsetHeight);
	},
	pageWidth : function() {
		return document.body.scrollWidth
				|| document.documentElement.scrollWidth;
	},
	pageHeight : function() {
		return document.body.scrollHeight
				|| document.documentElement.scrollHeight;
	},
	windowWidth : function() {
		var a = document.documentElement;
		return self.innerWidth || a && a.clientWidth
				|| document.body.clientWidth;
	},
	windowHeight : function() {
		var a = document.documentElement;
		return self.innerHeight || a && a.clientHeight
				|| document.body.clientHeight;
	},
	scrollX : function(a) {
		
		var b = document.documentElement;
		if (a) {
			var c = a.parentNode, e = a.scrollLeft || 0;
			if (a == b)
				e = UI.scrollX();
			return c ? e + UI.scrollX(c) : e;
		}
		return self.pageXOffset || b && b.scrollLeft
				|| document.body.scrollLeft;
	},
	scrollY : function(a) {
		var b = document.documentElement;
		if (a) {
			var c = a.parentNode, e = a.scrollTop || 0;
			if (a == b)
				e = UI.scrollY();
			return c ? e + UI.scrollY(c) : e;
		}
		return self.pageYOffset || b && b.scrollTop
				|| document.body.scrollTop;
	},
	scrollTo : function(a, b, c) {
		if (a == document.documentElement || a == document.body)
			return window.scrollTo(b, c);
	}
};

function aucfocus(obj) {
    addClass(obj,"txtfocus");
    if(obj.value.indexOf("@") == -1){
        if($("message_menu")){
            $("message_menu").style.display='none';
        }
    }
    
    if(typeof auc !="undefined"){
        auc.valObj = obj;
    }  
}

function setshuoshuo(toobj,slideobj){
    var xx = UI.getX(slideobj)-12;
    var yy = UI.getY(slideobj)+28;
    var maxh = UI.height(toobj)+UI.getY(toobj);
    if(maxh<yy){
        yy = maxh;
    }
    $('message_menu').style.left = xx + 'px';
    $('message_menu').style.top = yy + 'px';
}

function selectTxt(a, b, c) {
	if (document.createRange)
		a.setSelectionRange(b, c);
	else {
		a = a.createTextRange();
		a.collapse(1);
		a.moveStart("character", b);
		a.moveEnd("character", c - b);
		a.select()
	}
}
function insertTxt(a, b, c, e) {
	if (e == undefined)
		e = 0;
	a.focus();
	if (document.selection) {
		a = document.selection.createRange();
		a.moveStart("character", -e);
		a.text = b
	} else {
		var d = a.value, f = c + b.length - e;
		a.value = d.substring(0, c - e) + b + d.substring(c, d.length);
		selectTxt(a, f, f)
	}
}

function autofill(obj,type){
    if(obj.value=="顺便说点什么吧..."&&type==1){
        obj.value = '';
    }
    if(obj.value==''&&type==0){
        obj.value = "顺便说点什么吧...";
    }
}

function change_shareul(obj,id){
    if(obj.checked==true){
        $(id).style.display='';
    }else{
        $(id).style.display='none';
    }
}
