

//关闭头像列表
function cloaseqq(){document.getElementById("displayimgs").style.display="none";document.getElementById("displayimg").innerHTML="打开头像选择框";}

function classFocus(obj,object,objname){
	var divname = document.getElementById(obj);
	var oldclass = object;
	var newclass = object + " " + objname;
	var xinclass = divname.className;
	divname.className = object + " " + objname;
}

function classBlur(obj,object,objname){
	var divname = document.getElementById(obj);
	var oldclass = object;
	var newclass = object + " " + objname;
	var xinclass = divname.className;
			divname.className = object + " " + objname;
}

//隐藏显示
function showhidden(object){
	var obj = document.getElementById(object);
	if (obj.style.display == "none"){
		obj.style.display = "block";
		}
		else{
		obj.style.display = "none";	
		}
}

function grin(tagname,tag) {
        var myField;
        if (document.getElementById(tagname) && document.getElementById(tagname).type == 'textarea') {
                myField = document.getElementById(tagname);
        }
        else {
                return false;
        }
        if (document.selection) {
                myField.focus();
                sel = document.selection.createRange();
                sel.text = tag;
                myField.focus();
        }
        else if (myField.selectionStart || myField.selectionStart == '0') {
                var startPos = myField.selectionStart;
                var endPos = myField.selectionEnd;
                var cursorPos = endPos;
                myField.value = myField.value.substring(0, startPos)
                                          + tag
                                          + myField.value.substring(endPos, myField.value.length);
                cursorPos += tag.length;
                myField.focus();
                myField.selectionStart = cursorPos;
                myField.selectionEnd = cursorPos;
        }
        else {
                myField.value += tag;
                myField.focus();
        }
}

