///*
//	[UCenter Home] (C) 2007-2008 Comsenz Inc.
//	$Id: script_common.js,v 1.1 2010/06/13 06:45:27 duke Exp $
//*/
//
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
var is_safari = (userAgent.indexOf('webkit') != -1 || userAgent.indexOf('safari') != -1);
var note_step = 0;
var note_oldtitle = document.title;
var note_timer;

////iframe包含
//if (top.location != location) {
//	top.location.href = location.href;
//}

function $(id) {
	return document.getElementById(id);
}


function test(){
	alert('1');
}

function addSort(obj) {
	if (obj.value == 'addoption') {
 	var newOptDiv = document.createElement('div')
 	newOptDiv.id = obj.id+'_menu';
 	newOptDiv.innerHTML = '<h1>添加</h1><a href="javascript:;" onclick="addOption(\'newsort\', \''+obj.id+'\')" class="float_del">删除</a><div class="popupmenu_inner" style="text-align: center;">名称：<input type="text" name="newsort" size="10" id="newsort" class="t_input" /><input type="button" name="addSubmit" value="创建" onclick="addOption(\'newsort\', \''+obj.id+'\')" class="button" /></div>';
 	newOptDiv.className = 'popupmenu_centerbox';
 	newOptDiv.style.cssText = 'position: absolute; left: 50%; top: 200px; width: 400px; margin-left: -200px;';
 	document.body.appendChild(newOptDiv);
 	$('newsort').focus();
 	}
}
	
function addOption(sid, aid) {
	var obj = $(aid);
	var newOption = $(sid).value;
	$(sid).value = "";
	if (newOption!=null && newOption!='') {
		var newOptionTag=document.createElement('option');
		newOptionTag.text=newOption;
		newOptionTag.value="new:" + newOption;
		try {
			obj.add(newOptionTag, obj.options[0]); // doesn't work in IE
		} catch(ex) {
			obj.add(newOptionTag, obj.selecedIndex); // IE only
		}
		obj.value="new:" + newOption;
	} else {
		obj.value=obj.options[0].value;
	}
	// Remove newOptDiv
	var newOptDiv = document.getElementById(aid+'_menu');
	var parent = newOptDiv.parentNode;
	var removedChild = parent.removeChild(newOptDiv);
}

function checkAll(form, name) {
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(e.name.match(name)) {
			e.checked = form.elements['chkall'].checked;
		}
	}
}

function cnCode(str) {
	return is_ie && document.charset == 'utf-8' ? encodeURIComponent(str) : str;
}

function isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
}

function in_array(needle, haystack) {
	if(typeof needle == 'string' || typeof needle == 'number') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
					return true;
			}
		}
	}
	return false;
}

function strlen(str) {
	return (is_ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
}

function getExt(path) {
	return path.lastIndexOf('.') == -1 ? '' : path.substr(path.lastIndexOf('.') + 1, path.length).toLowerCase();
}

function doane(event) {
	e = event ? event : window.event;
	if(is_ie) {
		e.returnValue = false;
		e.cancelBubble = true;
	} else if(e) {
		e.stopPropagation();
		e.preventDefault();
	}
}

//验证码
function seccode(imgheight) {
	var img = 'do.php?ac=seccode&rand='+Math.random();
	if(imgheight!=null){
		document.writeln('<img id="img_seccode" src="'+img+'" align="absmiddle" height="30px">');
	}else{
		document.writeln('<img id="img_seccode" src="'+img+'" align="absmiddle" height="30px">');
	}
}

//验证码2
function seccodehelp() {
	var img = 'do.php?ac=seccode&rand='+Math.random();
	document.writeln('<img id="img_seccode" src="'+img+'" align="absmiddle">');
}

//验证码
function returnseccode() {
	var img = 'do.php?ac=seccode&rand='+Math.random();
	return '<img id="img_seccode" src="'+img+'" align="absmiddle">';
}
function updateseccode() {
	var img = 'do.php?ac=seccode&rand='+Math.random();
	if($('img_seccode')) {
		$('img_seccode').src = img;
	}
}

//缩小图片并添加链接
function resizeImg(id,size) {
	var theImages = $(id).getElementsByTagName('img');
	for (i=0; i<theImages.length; i++) {
		theImages[i].onload = function() {
			if (this.width > size) {
				this.style.width = size + 'px';
				if (this.parentNode.tagName.toLowerCase() != 'a') {
					var zoomDiv = document.createElement('div');
					this.parentNode.insertBefore(zoomDiv,this);
					zoomDiv.appendChild(this);
					zoomDiv.style.position = 'relative';
					zoomDiv.style.cursor = 'pointer';
					
					this.title = '点击图片，在新窗口显示原始尺寸';
					
					var zoom = document.createElement('img');
					zoom.src = 'image/zoom.gif';
					zoom.style.position = 'absolute';
					zoom.style.marginLeft = size -28 + 'px';
					zoom.style.marginTop = '5px';
					this.parentNode.insertBefore(zoom,this);
					
					zoomDiv.onmouseover = function() {
						zoom.src = 'image/zoom_h.gif';
					}
					zoomDiv.onmouseout = function() {
						zoom.src = 'image/zoom.gif';
					}
					zoomDiv.onclick = function() {
						window.open(this.childNodes[1].src);
					}
				}
			}
		}
	}
}

//Ctrl+Enter 发布
function ctrlEnter(event, btnId, onlyEnter) {
	if(isUndefined(onlyEnter)) onlyEnter = 0;
	if((event.ctrlKey || onlyEnter) && event.keyCode == 13) {
		$(btnId).click();
		return false;
	}
	return true;
}
//缩放Textarea
function zoomTextarea(id, zoom) {
	zoomSize = zoom ? 10 : -10;
	obj = $(id);
	if(obj.rows + zoomSize > 0 && obj.cols + zoomSize * 3 > 0) {
		obj.rows += zoomSize;
		obj.cols += zoomSize * 3;
	}
}

//复制URL地址
function setCopy(_sTxt){
	if(is_ie) {
		clipboardData.setData('Text',_sTxt);
		alert ("网址“"+_sTxt+"”\n已经复制到您的剪贴板中\n您可以使用Ctrl+V快捷键粘贴到需要的地方");
	} else {
		prompt("请复制网站地址:",_sTxt); 
	}
}

//验证是否有选择记录
function ischeck(id, prefix) {
	form = document.getElementById(id);
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(e.name.match(prefix) && e.checked) {
			if(confirm("您确定要执行本操作吗？")) {
				return true;
			} else {
				return false;
			}
		}
	}
	alert('请选择要操作的对象');
	return false;
}
function showPreview(val, id) {
	var showObj = $(id);
	if(typeof showObj == 'object') {
		showObj.innerHTML = val.replace(/\n/ig, "<br />");
	}
}

function getEvent() {
	if (document.all) return window.event;
	func = getEvent.caller;
	while (func != null) {
		var arg0 = func.arguments[0];
		if (arg0) {
			if((arg0.constructor==Event || arg0.constructor ==MouseEvent) || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation)) {
				return arg0;
			}
		}
		func=func.caller;
	}
	return null;
}
 
function copyRow(tbody) {
	var add = false;
	var newnode;
	if($(tbody).rows.length == 1 && $(tbody).rows[0].style.display == 'none') {
		$(tbody).rows[0].style.display = '';
		newnode = $(tbody).rows[0];
	} else {
		newnode = $(tbody).rows[0].cloneNode(true);
		add = true;
	}
	tags = newnode.getElementsByTagName('input');
	for(i in tags) {
		if(tags[i].name == 'pics[]') {
			tags[i].value = 'http://';
		}
	}
	if(add) {
		$(tbody).appendChild(newnode);
	}
}
	
function delRow(obj, tbody) {
	if($(tbody).rows.length == 1) {
		var trobj = obj.parentNode.parentNode;
		tags = trobj.getElementsByTagName('input');
		for(i in tags) {
			if(tags[i].name == 'pics[]') {
				tags[i].value = 'http://';
			}
		}
		trobj.style.display='none';
	} else {
		$(tbody).removeChild(obj.parentNode.parentNode);
	}
}

function insertWebImg(obj) {
	if(checkImage(obj.value)) {
		insertImage(obj.value);
		obj.value = 'http://';
	} else {
		alert('图片地址不正确');
	}
}

function checkFocus(target) {
	var obj = $(target);
	if(!obj.hasfocus) {
		obj.focus();
	}
}
function insertImage(text) {
	text = "\n[img]" + text + "[/img]\n";
	insertContent('message', text)
}

function insertContent(target, text) {
	var obj = $(target);
	selection = document.selection;
	checkFocus(target);
	if(!isUndefined(obj.selectionStart)) {
		var opn = obj.selectionStart + 0;
		obj.value = obj.value.substr(0, obj.selectionStart) + text + obj.value.substr(obj.selectionEnd);
	} else if(selection && selection.createRange) {
		var sel = selection.createRange();
		sel.text = text;
		sel.moveStart('character', -strlen(text));
	} else {
		obj.value += text;
	}
}

function checkImage(url) {
	var re = /^http\:\/\/.{5,200}\.(jpg|gif|png)$/i
	return url.match(re);
}

function quick_validate(obj) {
    if($('seccode')) {
		var code = $('seccode').value;
		var x = new Ajax();
		x.get('cp.php?ac=common&op=seccode&code=' + code, function(s){
			s = trim(s);
			if(s != 'succeed') {
				alert(s);
				$('seccode').focus();
           		return false;
			} else {
				obj.form.submit();
				return true;
			}
		});
    } else {
    	obj.form.submit();
    	return true;
    }
}

function trim(str) { 
	var re = /\s*(\S[^\0]*\S)\s*/; 
	re.exec(str); 
	return RegExp.$1; 
}
// 停止音乐flash
function stopMusic(preID, playerID) {
	var musicFlash = preID.toString() + '_' + playerID.toString();
	if($(musicFlash)) {
		$(musicFlash).SetVariable('closePlayer', 1);
	}
}
// 显示影视、音乐flash
var openingmusic=false;
function showFlash(host, flashvar, obj, shareid) {
	if(host=='music'){
	   if(openingmusic){
		   alert("请关闭正在试听的音乐");
		   return false;
	   }
	}
	var flashAddr = {
		'youku.com' : 'http://player.youku.com/player.php/sid/FLASHVAR=/v.swf',
		'ku6.com' : 'http://player.ku6.com/refer/FLASHVAR/v.swf',
		'youtube.com' : 'http://www.youtube.com/v/FLASHVAR',
		'5show.com' : 'http://www.5show.com/swf/5show_player.swf?flv_id=FLASHVAR',
		'sina.com.cn' : 'http://vhead.blog.sina.com.cn/player/outer_player.swf?vid=FLASHVAR',
		'sohu.com' : 'http://v.blog.sohu.com/fo/v4/FLASHVAR',
		'mofile.com' : 'http://tv.mofile.com/cn/xplayer.swf?v=FLASHVAR',
		'music' : 'FLASHVAR',
		'flash' : 'FLASHVAR'
	};
	var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="480" height="400">'
	    + '<param name="movie" value="FLASHADDR" />'
	    + '<param name="quality" value="high" />'
	    + '<param name="bgcolor" value="#FFFFFF" />'
	    + '<embed width="480" height="400" menu="false" quality="high" src="FLASHADDR" type="application/x-shockwave-flash" />'
	    + '</object>';
	var videoFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="480" height="450">'
        + '<param value="transparent" name="wmode"/>'
		+ '<param value="FLASHADDR" name="movie" />'
		+ '<embed src="FLASHADDR" wmode="transparent" allowfullscreen="true" type="application/x-shockwave-flash" width="480" height="450"></embed>'
		+ '</object>';
	var musicFlash = '<object id="audioplayer_SHAREID" height="24" width="290" data="image/player.swf" type="application/x-shockwave-flash">'
		+ '<param value="image/player.swf" name="movie"/>'
		+ '<param value="autostart=yes&bg=0xCDDFF3&leftbg=0x357DCE&lefticon=0xF2F2F2&rightbg=0xF06A51&rightbghover=0xAF2910&righticon=0xF2F2F2&righticonhover=0xFFFFFF&text=0x357DCE&slider=0x357DCE&track=0xFFFFFF&border=0xFFFFFF&loader=0xAF2910&soundFile=FLASHADDR" name="FlashVars"/>'
		+ '<param value="high" name="quality"/>'
		+ '<param value="false" name="menu"/>'
		+ '<param value="#FFFFFF" name="bgcolor"/>'
	    + '</object>';
	var musicMedia = '<object height="64" width="290" data="FLASHADDR" type="audio/x-ms-wma">'
	    + '<param value="FLASHADDR" name="src"/>'
	    + '<param value="1" name="autostart"/>'
	    + '<param value="true" name="controller"/>'
	    + '</object>';
	var flashHtml = videoFlash;
	var videoMp3 = true;
	
	if('' == flashvar) {
		alert('音乐地址错误，不能为空');
		return false;
	}
	
	
	if('music' == host) {
		var mp3Reg = new RegExp('.mp3$', 'ig');
		var wavReg = new RegExp('.wav$', 'ig');
		var flashReg = new RegExp('.swf$', 'ig');
		flashHtml = musicMedia;
		videoMp3 = false;
		if(mp3Reg.test(flashvar)) {
			videoMp3 = true;
			flashHtml = musicFlash;
		} else if(wavReg.test(flashvar)) {
			videoMp3 = true;
			flashHtml = musicFlash;
		}else if(flashReg.test(flashvar)) {
			videoMp3 = true;
			flashHtml = flash;
		}
	}
	flashvar = encodeURI(flashvar);
	if(flashAddr[host]) {
		var flash = flashAddr[host].replace('FLASHVAR', flashvar);
		flashHtml = flashHtml.replace(/FLASHADDR/g, flash);
		flashHtml = flashHtml.replace(/SHAREID/g, shareid);
	}
	
	if(!obj) {
		$('flash_div_' + shareid).innerHTML = flashHtml;
		return true;
	}
	if($('flash_div_' + shareid)) {
		$('flash_div_' + shareid).style.display = '';
		$('flash_hide_' + shareid).style.display = '';
		obj.style.display = 'none';
		return true;
	}
	if(flashAddr[host]) {
		openingmusic=true;
		var flashObj = document.createElement('div');
		flashObj.id = 'flash_div_' + shareid;
		obj.parentNode.insertBefore(flashObj, obj);
		flashObj.innerHTML = flashHtml;
		obj.style.display = 'none';
		var hideObj = document.createElement('div');
		hideObj.id = 'flash_hide_' + shareid;
		var nodetxt = document.createTextNode("关闭");
		hideObj.appendChild(nodetxt);
		obj.parentNode.insertBefore(hideObj, obj);
		hideObj.style.cursor = 'pointer';
		hideObj.onclick = function() {
			if(true == videoMp3) {
				stopMusic('audioplayer', shareid);
				flashObj.parentNode.removeChild(flashObj);
				hideObj.parentNode.removeChild(hideObj);
				openingmusic=false;
			} else {
				flashObj.style.display = 'none';
				hideObj.style.display = 'none';
				
			}
			obj.style.display = '';
		}
	}
}







//显示全部应用
function userapp_open() {
	var x = new Ajax();
	x.get('cp.php?ac=common&op=getuserapp', function(s){
		$('my_userapp').innerHTML = s;
		$('a_app_more').className = 'on';
		$('a_app_more').innerHTML = '收起';
		$('a_app_more').onclick = function() {
			userapp_close();
		}
	});
}

//关闭全部应用
function userapp_close() {
	var x = new Ajax();
	x.get('cp.php?ac=common&op=getuserapp&subop=off', function(s){
		$('my_userapp').innerHTML = s;
		$('a_app_more').className = 'off';
		$('a_app_more').innerHTML = '展开';
		$('a_app_more').onclick = function() {
			userapp_open();
		}
	});
}

//滚动
function startMarquee(h, speed, delay, sid) {
	var t = null;
	var p = false;
	var o = $(sid);
	o.innerHTML += o.innerHTML;
	o.onmouseover = function() {p = true}
	o.onmouseout = function() {p = false}
	o.scrollTop = 0;
	function start() {
	    t = setInterval(scrolling, speed);
	    if(!p) {
			o.scrollTop += 2;
		}
	}
	function scrolling() {
	    if(p) return;
		if(o.scrollTop % h != 0) {
	        o.scrollTop += 2;
	        if(o.scrollTop >= o.scrollHeight/2) o.scrollTop = 0;
	    } else {
	        clearInterval(t);
	        setTimeout(start, delay);
	    }
	}
	setTimeout(start, delay);
}



function readfeed(obj, id) {
	if(Cookie.get("read_feed_ids")) {
		var fcookie = Cookie.get("read_feed_ids");
		fcookie = id + ',' + fcookie;
	} else {
		var fcookie = id;
	}
	Cookie.set("read_feed_ids", fcookie, 48);
	obj.className = 'feedread';
}

function showreward() {
	if(Cookie.get('reward_notice_disable')) {
		return false;
	}
	var x = new Ajax();
	x.get('do.php?ac=ajax&op=getreward', function(s){
		if(s) {
			msgwin(s, 2000);
		}
	});
}



function msgwin(s, t) {
	
	var msgWinObj = $('msgwin');
	if(!msgWinObj) {
		var msgWinObj = document.createElement("div");
		msgWinObj.id = 'msgwin';
		msgWinObj.style.display = 'none';
		msgWinObj.style.position = 'absolute';
		msgWinObj.style.zIndex = '100000';
		$('append_parent').appendChild(msgWinObj);
	}
	msgWinObj.innerHTML = s;
	msgWinObj.style.display = '';
	msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)';
	msgWinObj.style.opacity = 0;
	var sTop = document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
	pbegin = sTop + (document.documentElement.clientHeight / 2);
	pend = sTop + (document.documentElement.clientHeight / 5);
	setTimeout(function () {showmsgwin(pbegin, pend, 0, t)}, 10);
	msgWinObj.style.left = ((document.documentElement.clientWidth - msgWinObj.clientWidth) / 2) + 'px';
	msgWinObj.style.top = pbegin + 'px';
}

function showmsgwin(b, e, a, t) {
	step = (b - e) / 10;
	var msgWinObj = $('msgwin');
	newp = (parseInt(msgWinObj.style.top) - step);
	if(newp > e) {
		msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + a + ')';
		msgWinObj.style.opacity = a / 100;
		msgWinObj.style.top = newp + 'px';
		setTimeout(function () {showmsgwin(b, e, a += 10, t)}, 10);
	} else {
		msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)';
		msgWinObj.style.opacity = 1;
		setTimeout('displayOpacity(\'msgwin\', 100)', t);
	}
}

function displayOpacity(id, n) {
	if(!$(id)) {
		return;
	}
	if(n >= 0) {
		n -= 10;
		$(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + n + ')';
		$(id).style.opacity = n / 100;
		setTimeout('displayOpacity(\'' + id + '\',' + n + ')', 50);
	} else {
		$(id).style.display = 'none';
		$(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)';
		$(id).style.opacity = 1;
	}
}

function display(id) {
	var obj = $(id);
	obj.style.display = obj.style.display == '' ? 'none' : '';
}

function urlto(url) {
	window.location.href = url;
}

function explode(sep, string) {
	return string.split(sep);
}




function selector(pattern, context) {
	var re = new RegExp('([a-z]*)([\.#:]*)(.*|$)', 'ig');
	var match = re.exec(pattern);
	var conditions = [];	
	if (match[2] == '#')	conditions.push(['id', match[3]]);
	else if(match[2] == '.')	conditions.push(['className', match[3]]);
	else if(match[2] == ':')	conditions.push(['type', match[3]]);	
	var s = match[3].replace(/\[(.*)\]/g,'$1').split('@');
	for(var i=0; i<s.length; i++) {
		var cc = null;
		if (cc = /([\w]+)([=^%!$~]+)(.*)$/.exec(s[i])){
			conditions.push([cc[1], cc[2], cc[3]]);
		}
	}
	var list = (context || document).getElementsByTagName(match[1] || "*");	
	if(conditions) {
		var elements = [];
		var attrMapping = {'for': 'htmlFor', 'class': 'className'};
		for(var i=0; i<list.length; i++) {
			var pass = true;
			for(var j=0; j<conditions.length; j++) {
				var attr = attrMapping[conditions[j][0]] || conditions[j][0];
				var val = list[i][attr] || (list[i].getAttribute ? list[i].getAttribute(attr) : '');
				var pattern = null;
				if(conditions[j][1] == '=') {
					pattern = new RegExp('^'+conditions[j][2]+'$', 'i');
				} else if(conditions[j][1] == '^=') {
					pattern = new RegExp('^' + conditions[j][2], 'i');
				} else if(conditions[j][1] == '$=') {
					pattern = new RegExp(conditions[j][2] + '$', 'i');
				} else if(conditions[j][1] == '%=') {
					pattern = new RegExp(conditions[j][2], 'i');
				} else if(conditions[j][1] == '~=') {
					pattern = new RegExp('(^|[ ])' + conditions[j][2] + '([ ]|$)', 'i');
				}
				if(pattern && !pattern.test(val)) {
					pass = false;
					break;
				}
			}
			if(pass) elements.push(list[i]);
		}
		return elements;
	} else {
		return list;
	}
}

function reviewn(kid){
     var obj = document.getElementById("keydiv_"+kid);
     if(obj.style.display==""){
    	 //obj.style.display="none";
     }else{
    	 obj.getElementsByTagName("TEXTAREA")[0].value="";
    	 obj.style.display="";
     }
     //checreview(obj);
     
     document.getElementById('txtarea_'+kid).style.display="";
     document.getElementById('btnreview_'+kid).style.display="";
  }

function checreview(obj){
       for(var i=0;i<=10;i++){
          try{
          var nobj = document.getElementById("keydiv_"+i);
          if(nobj==obj)continue;
          nobj.style.display="none";
          }catch(e){
        	  continue;
          }
       }
}




//评论提交
function reviewsub(itemid,txtid){
    var reobj = document.getElementById("keydiv_"+txtid);
    var txt = reobj.getElementsByTagName("TEXTAREA")[0];
    if(isNull(txt.value)){
    	alert("评论内容不能为空！");
        return;
    }
    if(txt==null || txt.value==null || txt.value.length==0){
         alert("评论内容不能为空！");
         return;
    }
    var xajax = new Ajax('XML','ajax_wait');
    xajax.showLoading();
    xajax.post("source/ajax_handler.php","method=addreview&value1="+itemid+"&value2="+txt.value,function($){
           if($=="0" || $==""){
        	     txt.value="";
                 alert("操作成功!");
                 window.location.reload();
           }else{
           	alert("操作失败!");
           }
    });
 }

//批量关注指定用户
function ajaxsumbit(cuid,obj){
	 var xajax = new Ajax('XML','ajax_wait');
    xajax.showLoading();
    xajax.post("source/ajax_concern.php","uidlist="+cuid,function($){
           if($=="0" || $==""){
              alert("操作成功!");
              if(obj!=null){
            	 obj.style.display="none";  
              }else{
              window.location.reload();
              }
           }else{
           	alert("操作失败!");
           }
    });
}

//取消关注
function cancelconern(item){
	  
	 var xajax = new Ajax('XML','ajax_wait');
    xajax.showLoading();
    xajax.post("source/ajax_handler.php","method=cancelconcern&value1="+item,function($){
           if($=="1" || $==""){
        	   var obj = document.getElementById('friend_li_'+item);
      	     if(obj){
      	    	var parent = obj.parentNode;
      	    	parent.removeChild(obj);
      	     }
           }else{
           	alert("操作失败!");
           }
    });
 }
//赞一下
function goodsubmit(itemid){
	    var xajax = new Ajax('HTML','ajax_wait');
		xajax.showLoading();
		xajax.post("source/ajax_handler.php","method=goodthis&value1="+itemid,function($){
			if($=="0"){
			      alert("操作成功!");
			      window.location.reload();
			}else if($=="1"){
				alert("不能重复操作!");
			}else{
			   alert("操作失败"+$);	
			}
		});
}

//收藏FEED
function favfeed(itemid){
	    var xajax = new Ajax('XML','ajax_wait');
		xajax.showLoading();
		xajax.post("source/ajax_handler.php","method=favfeed&value1="+itemid,function($){
			alert($);	
		});
}
































//赞一下MMS模板
function goodsubmitmms(itemid){
	    var xajax = new Ajax('HTML','ajax_wait');
		xajax.showLoading();
		xajax.post("source/ajax_handler.php","method=goodthismms&value1="+itemid,function($){
			if($=="0"){
			      alert("操作成功!");
			      window.location.reload();
			}else if($=="1"){
				alert("不能重复操作!");
			}else{
			   alert("操作失败"+$);	
			}
		});
}

//十二差投票
function votetw(uid,groupid){
	var obj;
	var xajax = new Ajax('HTML','ajax_wait');
	xajax.showLoading();
	xajax.post("source/ajax_handler.php","method=votetw&uid="+uid+"&groupid="+groupid,function($){
		if($=="0"){
			alert("投票失败");
		}else if($=="1"){
			var spanobj = document.getElementById("vote_"+uid+"_"+groupid);
			var qty = Number(spanobj.innerHTML);
			qty++;
			spanobj.innerHTML=qty;
		    alert("投票成功");	
		}else{
		    alert($);	
		}
			
	});
	return obj;
}



//是否为空
function isNull(str){
	if(str == "")return true;
	var regu = "^[ ]+$";
	var re = new RegExp(regu);
	return re.test(str);
	}


//修改为精品
function changetojinpin(name,hvalueid){
    if(!window.confirm("你确定要把此短信更改为精品短信吗?"))return false;
    var obj = document.getElementsByName(name);
    var v="";
    for(var i=0;i<obj.length;i++){
    	if(obj[i].checked){
    		v+=obj[i].value+"|";
    	}
    }
    if(v==""){
    	alert("请选择至少一条短信!");
    	return;
    }
    document.getElementById(hvalueid).value = v;
    return true;
} 

//删除短信
function todelsms(name,hvalueid){
    if(!window.confirm("你确定要删除此批短信吗?"))return false;
    var obj = document.getElementsByName(name);
    var v="";
    for(var i=0;i<obj.length;i++){
    	if(obj[i].checked){
    		v+=obj[i].value+"|";
    	}
    }
    if(v==""){
    	alert("请选择至少一条短信!");
    	return;
    }
    document.getElementById(hvalueid).value = v;
    return true;
} 

function isMobile(mobile){
	 if(!(/^1[3|5|8][0-9]\d{4,8}$/.test(mobile))){ 
		alert("请输入正确的手机号码!");
    	return false;
	}
	return true;
}

//转发
function showdig(itemid){
	
	var author=document.getElementById("sf_author");
	var smsc = document.getElementById("sf_smsc");
	
	author.innerHTML = document.getElementById(itemid+"_author").innerHTML+"：";
	smsc.innerHTML = document.getElementById(itemid+"_smsc").innerHTML;
	
	document.getElementById("forwardsub").onclick=function(){
		var tv = document.getElementById("dreview").value;
		var xajax = new Ajax('HTML','ajax_wait');
		xajax.showLoading();
		xajax.post("source/ajax_handler.php","method=smsforward&value1="+itemid+"&value2="+tv,function($){
			alert($);
		});
	};
	
	document.getElementById("smsforward").style.display="";
}

//删除模板
function todelmmstpl(name,hvalueid){
    if(!window.confirm("你确定要删除此批模板吗?"))return false;
    var obj = document.getElementsByName(name);
    var v="";
    for(var i=0;i<obj.length;i++){
    	if(obj[i].checked){
    		v+=obj[i].value+"|";
    	}
    }
    if(v==""){
    	alert("请选择至少一条短信!");
    	return;
    }
    
    document.getElementById(hvalueid).value = v;
    return true;
} 

//新版 短信大全 类别选择
//批量关注指定用户
function ajaxtestsms(type1,type2){
	 var xajax = new Ajax('HTML','ajax_wait');
    xajax.showLoading();
    xajax.post("ajax_sms_index.php?type1="+type1+"&type2="+type2,"",function($){
    	alert($);
//    	if($=="0"){
//    		alert("操作成功!");
//    	}
//    	else{
//    		alert("操作失败!");
//    	}
//           if($=="0" || $==""){
//              alert("操作成功!");
//              window.location.reload();
//           }else{
//           	alert("操作失败!");
//           }
    });
}

function ajaxgetsms(a,b){
	var xajax = new Ajax('HTML','ajax_wait');
    xajax.showLoading();
    xajax.post("ajax_sms_index.php?type1="+type1+"&type2="+type2,"",function($){
    	alert($);
    });
}
//获取类别
function ajaxgetsmstype(){
	var xajax = new Ajax('HTML','ajax_wait');
    xajax.showLoading();
    
    xajax.post("source/zk/ajax_sms_type.php?fatherid=1","",function($){
    	alert($);
    });
}
function look_smst(t){
	switch(t){
		case "1":
			
			document.getElementById("a_jr").style.display="none";
			document.getElementById("span_jr").style.display="none";
			document.getElementById("div_jr").style.display="block";
			document.getElementById("str_jr2").value="";
			document.getElementById("str_jr").value="";
			break;
		case "2":
			document.getElementById("a_lx").style.display="none";
			document.getElementById("span_lx").style.display="none";
			document.getElementById("div_lx").style.display="block";
			document.getElementById("str_lx2").value="";
			document.getElementById("str_lx").value="";
			break;
		case "3":
			document.getElementById("a_dx").style.display="none";
			document.getElementById("span_dx").style.display="none";
			document.getElementById("div_dx").style.display="block";
			document.getElementById("str_dx2").value="";
			document.getElementById("str_dx").value="";
			break;
		default:
			break;
	}
}
function hidd_smst(t){
	switch(t){
	case "1":
		document.getElementById("a_jr").style.display="block";
		document.getElementById("span_jr").style.display="block";
		document.getElementById("div_jr").style.display="none";
		break;
	case "2":
		document.getElementById("a_lx").style.display="block";
		document.getElementById("span_lx").style.display="block";
		document.getElementById("div_lx").style.display="none";
		break;
	case "3":
		document.getElementById("a_dx").style.display="block";
		document.getElementById("span_dx").style.display="block";
		document.getElementById("div_dx").style.display="none";
		break;
	default:
		break;
}
}
function sms_xz_jr(){
	//发布短信选择节日
	var s="";
	var ids="";
	var ddiv = document.getElementById("type_jr");
	var controls = ddiv.getElementsByTagName("input");

	for (i = 0; i < controls.length; i++) {
        if (controls[i].type == "checkbox") {
            if (controls[i].checked == true) {
            	ids = ids + controls[i].id.toString().substring(7, controls[i].id.toString().length) + ",";
                s = s + controls[i].value + ",";
            }
        }
    }

	//document.getElementById("span_jr").innerHTML=s.substring(0, s.length-1);
 	document.getElementById("str_jr2").value=s;
	document.getElementById("str_jr").value=ids;//.substring(0, ids.length-1);
	//hidd_smst('1');
}
//头部搜索1
function head_lookt1(){
	document.getElementById("search_b2").src="/template/skin2011/images/index/zk_search_s1.jpg";
	document.getElementById("search_t2").style.display="none";
	if(document.getElementById("search_t1").style.display=="none"){
		document.getElementById("search_b1").src="/template/skin2011/images/index/zk_search_s2.jpg";
		document.getElementById("search_t1").style.display="block";
		var xajax = new Ajax('HTML','ajaxwaitid');
	    xajax.showLoading();
	    xajax.post("source/zk/ajax_header.php?fatherid=3","",function($){
	    	document.getElementById("search_t1").innerHTML=$;
	    });
	}
	else{
		document.getElementById("search_b1").src="/template/skin2011/images/index/zk_search_s1.jpg";
		document.getElementById("search_t1").style.display="none";
	}
}
//头部搜索2
function head_lookt2(){
	document.getElementById("search_b1").src="/template/skin2011/images/index/zk_search_s1.jpg";
	document.getElementById("search_t1").style.display="none";
	if(document.getElementById("search_t2").style.display=="none"){
		document.getElementById("search_b2").src="/template/skin2011/images/index/zk_search_s2.jpg";
		document.getElementById("search_t2").style.display="block";
		var xajax = new Ajax('HTML','ajax_wait');
	    xajax.showLoading();
	    xajax.post("source/zk/ajax_header.php?fatherid=1","",function($){
	    	document.getElementById("search_t2").innerHTML=$;
	    });
	}
	else{
		document.getElementById("search_b2").src="/template/skin2011/images/index/zk_search_s1.jpg";
		document.getElementById("search_t2").style.display="none";
	}
}
function head_xz1(id,name){
	document.getElementById("search_dx").value="送"+name;
	document.getElementById("s_dx").value=id;
	document.getElementById("search_b1").src="/template/skin2011/images/index/zk_search_s1.jpg";
	document.getElementById("search_t1").style.display="none";
}
function head_xz2(id,name){
	document.getElementById("search_jr").value="在"+name;
	document.getElementById("s_jr").value=id;
	document.getElementById("search_b2").src="/template/skin2011/images/index/zk_search_s1.jpg";
	document.getElementById("search_t2").style.display="none";
}
function search_c(){
//	alert("aa");
	var str=document.getElementById("search_str").value;
	var jr=document.getElementById("s_jr").value;
	var dx=document.getElementById("s_dx").value;
	if(str=="请输入短信的关键字"){
		str="";
	}
	location.href="space.php?do=smslist&jr="+jr+"&lx=0&dx="+dx+"&search="+encodeURI(str)+"&type=&by=time";
	//alert(escape(str));
}
function search_list_s(jr,lx,dx,type,by){
	var str=document.getElementById("list_search").value;
	if(str=="关键字/作者"){
		str="";
	}
	location.href="space.php?do=smslist&jr="+jr+"&search="+encodeURI(str)+"&type=&by=time";
}
function search_list_t(jr,lx,dx,search,type,by){
	location.href="space.php?do=smslist&jr="+jr+"&lx="+lx+"&dx="+dx+"&search="+search+"&type="+type+"&by="+by;
}
function search_list_b(jr,lx,dx,search,type){
	var by=document.getElementById("search_select").value;
	location.href="space.php?do=smslist&jr="+jr+"&lx="+lx+"&dx="+dx+"&search="+search+"&type="+type+"&by="+by;
}

function sms_fz(kid,str,fun){
	 //window.clipboardData.setData("Text",content+"\r来自"+str+"：指客网\r"+document.location.href); 
	
	var xajax = new Ajax('HTML','');
   xajax.showLoading();
   xajax.post("/source/zk/newlog.php","content="+kid+"&function="+fun,function($){
   		//alert($);
   });
	
	
	// copyToClipboard(content+"\r来自"+str+"：指客网\r"+document.location.href);
   //copyToClipboard(kid);
}

function copyToClipboard(kid) { 
	var txt = "";
	var xajax = new Ajax('HTML','');
   xajax.showLoading();
   xajax.post("/source/zk/getcontent.php","kid="+kid,function($){
   		//alert($);
   		txt = $+"\r来自指客网:\r http://www.zk008.com/";//document.location.href;
   		var isChrome = window.navigator.userAgent.indexOf("Chrome");
   		if(isChrome!='-1')
   		{
   			alert("暂不支持该浏览器,请选中需要复制内容!");return;
   		}
   	　if(window.clipboardData) { 
   	　	window.clipboardData.clearData(); 
   	　	window.clipboardData.setData("Text", txt);
   			alert("复制成功!"); 
   	　} else if(navigator.userAgent.indexOf("Opera") != -1) { 
   			//oper浏览器
   			alert("暂不支持该浏览器,请选中需要复制内容!");
   	　	//window.location = txt; 
   			
   	　} else if (window.netscape) { 
   		　　try { 
   		　　	netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
   		　　} catch (e) { 
   		　　	alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'"); 
   		　　} 
   		　　var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 
   		　　if (!clip) 
   		　　return; 
   		　　var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 
   		　　if (!trans) 
   		　　return; 
   		　　trans.addDataFlavor('text/unicode'); 
   		　　var str = new Object(); 
   		　　var len = new Object(); 
   		　　var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 
   		　　var copytext = txt; 
   		　　str.data = copytext; 
   		　　trans.setTransferData("text/unicode",str,copytext.length*2); 
   		　　var clipid = Components.interfaces.nsIClipboard; 
   		　　if (!clip) 
   		　　	return false; 
   		　　	clip.setData(trans,null,clipid.kGlobalClipboard); 
   				alert("复制成功!"); 
	　　}
   		else{
   			alert("暂不支持该浏览器模式(如果是傲游浏览器请设为浏览模式),请选中需要复制内容!");return;
   		}
   });
	
　}

function sms_xz_lx(){
	//发布短信选择类型
	var s="";
	var ids="";
	var ddiv = document.getElementById("type_lx");
	var controls = ddiv.getElementsByTagName("input");
    for (i = 0; i < controls.length; i++) {
        if (controls[i].type == "checkbox") {
            if (controls[i].checked == true) {
            	ids = ids + controls[i].id.toString().substring(7, controls[i].id.toString().length) + ",";
                s = s + controls[i].value + ",";
            }
        }
    }
	//document.getElementById("span_lx").innerHTML=s.substring(0, s.length-1);
	document.getElementById("str_lx2").value=s;//.substring(0, s.length-1);
	document.getElementById("str_lx").value=ids;//.substring(0, ids.length-1);
	//hidd_smst('2');
}
function sms_xz_dx(){
	//发布短信选择对象
	var s="";
	var ids="";
	var ddiv = document.getElementById("type_dx");
	var controls = ddiv.getElementsByTagName("input");
    for (i = 0; i < controls.length; i++) {
        if (controls[i].type == "checkbox") {
            if (controls[i].checked == true) {
            	ids = ids + controls[i].id.toString().substring(7, controls[i].id.toString().length) + ",";
                s = s + controls[i].value + ",";
            }
        }
    }
	//document.getElementById("span_dx").innerHTML=s.substring(0, s.length-1);
	document.getElementById("str_dx2").value=s;//.substring(0, s.length-1);
	document.getElementById("str_dx").value=ids;//.substring(0, ids.length-1);
	//hidd_smst('3');
}

function textsms_index_click(a,b){
	//短信大全  获取文字短信推荐信息
	if(a!='0'){
		var obj= document.getElementById("text_smst_as");
		var controls = obj.getElementsByTagName("div");
		for (i = 0; i < controls.length; i++) {
			controls[i].className="new_smsdq2_l2s2_n";
		}
		document.getElementById("text_smst_a"+a).className="new_smsdq2_l2s2_s";
		document.getElementById("text_smst_a_r").className="new_smsdq2_l2s2_r";
		document.getElementById("text_smst_a_mr").value=a;
	}
	else{
		a=document.getElementById("text_smst_a_mr").value;
	}
	if(b!='0'){
		var obj= document.getElementById("text_smst_bs");
		var controls = obj.getElementsByTagName("div");
		for (i = 0; i < controls.length; i++) {
			controls[i].className="new_smsdq2_l2xz_n";
		}
		document.getElementById("text_smst_b"+b).className="new_smsdq2_l2xz_s";
		document.getElementById("text_smst_b_mr").value=b;
	}
	else{
		b=document.getElementById("text_smst_b_mr").value;
	}
	var xajax = new Ajax('HTML','ajax_wait');
    xajax.showLoading();
    xajax.post("source/zk/ajax_sms_index.php?a="+a+"&b="+b,"",function($){
    	document.getElementById("sms_index_dq_text").innerHTML=$;
    });
}
function voicesms_index_click(a,b){
	//短信大全  获取有声短信推荐信息
	if(a!='0'){
		var obj= document.getElementById("voice_smst_as");
		var controls = obj.getElementsByTagName("div");
		for (i = 0; i < controls.length; i++) {
			controls[i].className="new_smsdq2_l2s2_n";
		}
		document.getElementById("voice_smst_a"+a).className="new_smsdq2_l2s2_s";
		document.getElementById("voice_smst_a_r").className="new_smsdq2_l2s2_r";
		document.getElementById("voice_smst_a_mr").value=a;
	}
	else{
		a=document.getElementById("voice_smst_a_mr").value;
	}
	if(b!='0'){
		var obj= document.getElementById("voice_smst_bs");
		var controls = obj.getElementsByTagName("div");
		for (i = 0; i < controls.length; i++) {
			controls[i].className="new_smsdq2_l2xz_n";
		}
		document.getElementById("voice_smst_b"+b).className="new_smsdq2_l2xz_s";
		document.getElementById("voice_smst_b_mr").value=b;
	}
	else{
		b=document.getElementById("voice_smst_b_mr").value;
	}
	var xajax = new Ajax('HTML','ajax_wait');
    xajax.showLoading();
    xajax.post("source/zk/ajax_sms_index2.php?a="+a+"&b="+b,"",function($){
    	document.getElementById("sms_index_dq_voice").innerHTML=$;
    });
}

//短信列表 js
function get_smslist_jr_more(){//展示
	document.getElementById("jr_other").style.display="none";
	document.getElementById("jr_more").style.display="block";
}
function get_smslist_jr_more2(){//收起
	document.getElementById("jr_other").style.display="block";
	document.getElementById("jr_more").style.display="none";
}


function sms_dl(userno,usercode,content,smsid){
	
	if(!isMobile(userno)){
	     return;
	}
	
	if(isNull(usercode)  || userno=='填写验证码'){
	     alert("请输入验证码！");
	     return;
	}
	if(isNull(content)){
	     alert("发送内容不能为空");
	     return;
	}
	
	
	 var xajax = new Ajax('HTML','');
     xajax.post("source/smsdl.php","method=dl&vc="+usercode+"&userno="+userno+"&smsid="+smsid+"&content="+content,function($){
    	alert($);
        });
}
function sms_setcookie(kid){
	//设置cookie(添加到备选短信)
	var xajax = new Ajax('HTML','');
    xajax.showLoading();
    xajax.post("/source/zk/ajax_smscookie.php","kid="+kid,function($){
    	alert($);
    });
}
function sms_get_newthread(id){
	//悬赏论坛新首页
	var xajax = new Ajax('HTML','');
    xajax.showLoading();
    xajax.post("/source/zk/ajax_newthread.php","id="+id,function($){
    	document.getElementById("n_thread_1").innerHTML=$;
    	//alert($);
    });
}
function put_sms_rk(uid){
	var message=document.getElementById("message").value;
	alert(message);
	//alert(uid);
	var xajax = new Ajax('HTML','');
    xajax.showLoading();
    xajax.post("source/zk/smsruku.php","a="+uid+"&t="+message,function($){
    	//alert($);
    	if($.length>6)
    	{
    		alert("入红段子库成功,种子ID为:"+$);
    	}
    	else{
    		alert("入红段子库失败,错误代码为:"+$);
    	}
    	document.getElementById("realykid").value="";
    	document.getElementById("realykid").value=$;
//    	alert(document.getElementById("realykid").value);
    	//document.getElementById("sms_index_dq_voice").innerHTML=$;
    });
    
//    document.getElementById("realykid").value="0707";
}
//管理员确认评分
function gly_qr(pid,id,gold,grade,reason){
	var tid=document.getElementById("post_tid_"+pid).value;
	var uid=document.getElementById("post_uid_"+pid).value;
	var touid=document.getElementById("post_touid_"+pid).value;
	var content=document.getElementById("post_content_"+pid).value;
	var realkid=document.getElementById("post_realkid_"+pid).value;
	//var grade=document.getElementById("post_grade_"+pid).value;
	//var reason=document.getElementById("post_reason_"+pid).value;
	//var gold=document.getElementById("post_gold_"+pid).value;
	var groupid='1';
	var glypf='';
	if(groupid=='1')
	{
		glypf=document.getElementById("post_glypf_"+pid).innerHTML;
	}
	var bzpf=document.getElementById("post_bzpf_"+pid).innerHTML;
	
	
	reason=reason.replace('&','');
	content=content.replace('&','');

	var xajax = new Ajax('HTML','');
    xajax.showLoading();
    xajax.post("source/zk/newrating.php","pid="+pid+"&tid="+tid+"&uid="+uid+"&touid="+touid+"&content="+content+"&realkid="+realkid+"&grade="+grade+"&reason="+reason+"&gold="+gold+"&groupid="+groupid,function($){

    	
    	//var r=$;
    	//alert(r);
    	if($!='0'){
    		alert("评分成功");
    		//评分成功
    		if(groupid=='1')
    		{
    			//害群之马(金币：<span style=" color: red;">+1</span>&nbsp;等级：A2&nbsp;理由：22)、
    			document.getElementById("post_glypf_"+pid).innerHTML=glypf+"金币：<span style=\" color: red;\">"+gold+"</span>&nbsp;标准：<span style=\" color: red;\">"+grade+"</span>&nbsp;理由：<span style=\" color: red;\">"+reason+"</span><br />";
    		}
    		else
    		{
    			document.getElementById("post_bzpf_"+pid).innerHTML=bzpf+"金币：<span style=\" color: red;\">"+gold+"</span>&nbsp;标准：<span style=\" color: red;\">"+grade+"</span>&nbsp;理由：<span style=\" color: red;\">"+reason+"</span><br />";
    		}
    	}
    	
    });
}
//短信不通过
function setsmsnotpass(kid){
	var xajax = new Ajax('HTML','');
    xajax.showLoading();
    xajax.post("source/zk/setsmsnotpass.php","kid="+kid,function($){
		//var r=$;
    	alert("设置成功");
    });
}
//批量入库
function newrating_rkadd(pid){
	//alert(document.getElementById("post_cbx_"+pid).value);
	var a=pid+",";
	if(document.getElementById("post_cbx_"+pid).value)
		document.getElementById("ruku_pids").value=document.getElementById("ruku_pids").value+a;
	else
	{
		document.getElementById("ruku_pids").value=document.getElementById("ruku_pids").value.replace(a,'');
	}
		//alert(document.getElementById("ruku_pids").value);
}
function newrating_rk(){
	if(document.getElementById("ruku_pids").value)
	{
		var xajax = new Ajax('HTML','');
	    xajax.showLoading();
	    xajax.post("source/zk/newratingruku.php","str="+document.getElementById("ruku_pids").value+"&type="+document.getElementById("ruku_types").value,function($){
    		var r=$;
	    	alert(r);
	    });
	}
}
//评分
function newrating(pid){
	
	//pid=pid.substr(14,pid.length);//截取字符串后的pid
	var tid=document.getElementById("post_tid_"+pid).value;
	var uid=document.getElementById("post_uid_"+pid).value;
	var touid=document.getElementById("post_touid_"+pid).value;
	var content=document.getElementById("post_content_"+pid).value;
	var realkid=document.getElementById("post_realkid_"+pid).value;
	var grade=document.getElementById("post_grade_"+pid).value;
	var reason=document.getElementById("post_reason_"+pid).value;
	var gold=document.getElementById("post_gold_"+pid).value;
	var groupid=document.getElementById("post_groupid_"+pid).value;
	
	var msgedit=document.getElementById("post_msgedit_"+pid).value;
	
	
	
	
	var glypf='';
	if(groupid=='1')
	{
		glypf=document.getElementById("post_glypf_"+pid).innerHTML;
	}
	var bzpf=document.getElementById("post_bzpf_"+pid).innerHTML;
	
	//alert(tid);alert(uid);alert(touid);alert(content);alert(realkid);
	//alert(grade);alert(reason);alert(gold);alert(groupid);alert(msgedit);
	//return;
	reason=reason.replace('&','');
	content=content.replace('&','');

	var xajax = new Ajax('HTML','');
    xajax.showLoading();
    xajax.post("source/zk/newrating.php","pid="+pid+"&tid="+tid+"&uid="+uid+"&touid="+touid+"&content="+content+"&realkid="+realkid+"&grade="+grade+"&reason="+reason+"&gold="+gold+"&groupid="+groupid+"&msgedit="+msgedit,function($){

    	
    	//var r=$;
    	//alert(r);
    	if($!='0'){
    		alert("评分成功");
    		//评分成功
    		if(groupid=='1')
    		{
    			//害群之马(金币：<span style=" color: red;">+1</span>&nbsp;等级：A2&nbsp;理由：22)、
    			document.getElementById("post_glypf_"+pid).innerHTML=glypf+"金币：<span style=\" color: red;\">"+gold+"</span>&nbsp;标准：<span style=\" color: red;\">"+grade+"</span>&nbsp;理由：<span style=\" color: red;\">"+reason+"</span><br />";
    		}
    		else
    		{
    			document.getElementById("post_bzpf_"+pid).innerHTML=bzpf+"金币：<span style=\" color: red;\">"+gold+"</span>&nbsp;标准：<span style=\" color: red;\">"+grade+"</span>&nbsp;理由：<span style=\" color: red;\">"+reason+"</span><br />";
    		}
    	}
    	
    });
}

function show_new_supportta(pid)
{
	var obj = document.getElementById("trace_div_"+pid);
    if(obj.style.display=="none"){
   	 	obj.style.display="block";
    }else{
   	 	obj.style.display="none";
    }
	//document.getElementById("trace_div_"+pid).style.display="block";
}
