	/*
	* 调整字符串，使之在多值中唯一
	* @param srcValue 源字串（被检测的目标字串）
	* @param newItem 监控字串（检测此字串在“源字串”中是否存在，无则添加；有则剔除掉）
	* @param separate 多值分隔符号
	* @Return 返回处理后的字符串
	*/
	function ajustValue(srcValue,newItem,separate){
		var ajustedValue = "";
		try{
			var blExist = false;
			var arrValue = srcValue.split(separate);
			for (var i=0;i<arrValue.length;i++){
				if (arrValue[i].Trim()==newItem){		//-发现新加的item在源值中已经存在，则剔除掉
					arrValue[i] = "";
					blExist = true;
				}
				if (ajustedValue.Trim()=="")
					ajustedValue = arrValue[i].Trim();
				else{
					if (arrValue[i].Trim()!="")
						ajustedValue = ajustedValue + separate + arrValue[i];
				}
			}
			if (!blExist) ajustedValue = ajustedValue + separate + newItem;
		}catch(e){}
		return ajustedValue;
	}

//将PX值转成数字
function getPositionNum(pos) {
	return pos.replace("px","")*1;
}

var doc = document.all;

function v() {return ;}

function getSel(){
      var txt = '';
      var foundIn = '';
      if(window.getSelection){
          txt = window.getSelection();
          foundIn = 'window.getSelection()';
      }else if(document.getSelection){
          txt = document.getSelection();
          foundIn = 'document.getSelection()';
      }else if(document.selection){
          txt = document.selection.createRange().text;
          foundIn = 'document.selection.createRange()';
      }else
          return;
      //document.forms[0].selectedtext.value = 'Found in: ' + foundIn + '\n' + txt;
      //alert(foundIn+"\n"+txt);
      return txt;
}

function refreshImg(o){
	var t   =   (new   Date()).getTime();  
	url = "/jcaptcha.lv?now="+t;
	o.src=url;
	var ci = document.getElementById("j_captcha_response");
	ci.focus();
}

function checkEnter(event,func){
	try{
		var NS4 = (document.layers) ? true : false;
	    var code = 0;
	    if (NS4)
	        code = event.which;
	    else
	        code = event.keyCode;
	    if (code==13){
	    	eval(func);
	    }
	}catch(e){}
}

function recordLoginCookie(){
	var userName = document.getElementById("userName");
	var password = document.getElementById("password");
	try{		
		if(userName.value == '' || password.value == ''){
			alert("请输入用户名称和密码！");
			userName.focus();
			return false;
		}
		setCookie("userName", userName.value,3);
	}catch(e){}
	return true
}

function clearSelect(selectObj){
	if (typeof(selectObj)!='object'){selectObj = document.getElementById(selectObj);}
	var len = selectObj.options.length;
	for (var i=0; i < len; i++){selectObj.options[0] = null;}
}
		
//-----打开前置的模式窗口[0]
//可用参数：urls，styles_t-top位置，styles_l--left位置，styles_w--窗口的宽，styles_h--窗口的高
function openbox_arrf(urls,styles_t,styles_l,styles_w,styles_h,strStyle,cT){
  var PrintStyle = "scroll:"+strStyle;
  var dialogArgs = new Array(); //定义参数 
  var result = new Array(); //定义参数   
  dialogArgs=cT; //参数赋值 
  styles = PrintStyle+";help:off;unadorned:no;center:yes;status:no;resizable:no;dialogTop:"+styles_t+";dialogLeft:"+styles_l+";dialogWidth:"+styles_w+"px;dialogHeight:"+styles_h+"px";
  result = showModalDialog(urls,dialogArgs,styles);
  try{return result;}
  catch(e){return 1}
}
//-----打开不前置的模式窗口
//可用参数：urls，styles_t-top位置，styles_l--left位置，styles_w--窗口的宽，styles_h--窗口的高, cT-参数值
//var result = "";
function openbox_m(urls,styles_t,styles_l,styles_w,styles_h,strStyle,cT){
  var PrintStyle = "scroll:"+strStyle;
  var dialogArgs = new Array(); //定义参数 
  var result = new Array(); //定义参数   
  dialogArgs=cT; //参数赋值 
  styles = PrintStyle+";center:yes;status:yes;resizable:yes;dialogTop:"+styles_t+";dialogLeft:"+styles_l+";dialogWidth:"+styles_w+"px;dialogHeight:"+styles_h+"px";
  var result = showModelessDialog(urls,dialogArgs,styles)
  try{return result;}
  catch(e){return 1}
}

function getCookie(NameOfCookie){
	if(document.cookie.length>0){
		begin = document.cookie.indexOf(NameOfCookie+"=");
		if (begin!=-1){
			begin += NameOfCookie.length+1;
			end = document.cookie.indexOf(";",begin);
			if (end==-1) end=document.cookie.length;
			return replaceAll(decodeURI(unescape(document.cookie.substring(begin,end)))," ","+");
		}return null;
	}return null;
}
function setCookie(NameOfCookie,value,expiredays){
	var ExpireDate = new Date();
	ExpireDate.setTime(ExpireDate.getTime()+(expiredays*24*3600*1000));
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays==null)?"":";expires="+ExpireDate.toGMTString()+";path=/");
}
function delCookie(NameOfCookie){
	var exp = new Date();
	exp.setTime(exp.getTime()-1);
	if(getCookie(NameOfCookie)!=null){document.cookie = NameOfCookie + "=" + ";expires="+exp.toGMTString();}
}
function hasChecked(cbid) {
	var cb = document.all[cbid];
	if(cb) {
		if(cb.length) {
			for(i=0;i<cb.length;i++) {
				if(cb[i].checked) {
					return true;
				}
			}
		} else {
			if(cb.checked) {
				return true;
			}
		}
	}
	return false;
}
/*通用checkbox检查*/

function commonCBCheck(cbid,alertStr,form) {
	if(hasChecked(cbid)) {
		if(confirm("你确定要进行此操作？")) {
			form.submit();
			return true;
		}
	} else {
		alert(alertStr);
		return false;
	}
	
}

/*通用checkbox检查*/

function commonCBCheckAndSend(cbid,alertStr,form, action) {
	if(hasChecked(cbid)) {
		if(confirm("你确定要进行此操作？")) {
			form.action = action;
			//alert(form.action);
			form.submit();
			return true;
		}
	} else {
		alert(alertStr);
		return false;
	}
	
}

function checkLength(str,len) {
	if(str.length>len)
		return false;
	return true;
}
/**
* 截取字符
*/
function render(ele,size) {
	if(!checkLength(ele.value,size)) {
		ele.value = ele.value.substr(0,size);
	}
}
function openWin(win) {
	//alert(window.event.clientY);
	//alert(win.id);
	//win.position = "absolute";
	win.style.display = "block";
	//win.style.top = window.event.clientY;
	//win.style.left = window.event.clientX;
	
	win.style.zIndex = "999";
}
function closeWin(win) {
	win.style.display = "none";
}

/**
*	在转跳之前进行检测
*   tips:提示信息,如:你还否要.... 
* 	url:转跳的地址
*/
function redirectURL(tips,url) {
	
	if(confirm(tips)) {
		//alert(confirm(tips));
		self.location.href = url;
		return true;
	}
	return false;
}

/**
*	在转跳之前进行检测
*   tips:提示信息,如:你还否要.... 
* 	url:转跳的地址
*   options:可选属性
*/
function redirectURL(tips,url,options) {
	if(confirm(tips)) {
		//alert(confirm(tips));
		if(options!=null && options.type=="ajax") {
			new Ajax.Updater('',url, {asynchronous:true,onComplete:options.callBack,evalScripts:true});
		} else {
			self.location.href = url;
		}
		return true;
	}
	return false;
}

/**
*	在转跳之前进行检测
*   tips:提示信息,如:你还否要.... 
* 	url:转跳的地址
*/
function redirectAjaxURL() {
	Event.observe(document.body, 'click', function(event) {
	  	var elt = Event.element(event);
	  	if ('A' == elt.tagName && 'ajaxRedirect' == elt.className){
	  		Event.stop(event);
	  		if(confirm(elt.tips)) {
				new Ajax.Updater('',elt.href, {asynchronous:true,onComplete:refrashPage,evalScripts:true}); 
			}
		}
	});
}
function refrashPage(originalRequest) {
	self.location.reload();
}
/**
 * 添加收藏
*/
function addFavorite(typeCode,objectID) {
	new Ajax.Updater('', '/favoriteFrontManager.do?method=addFavorite&typeCode=' + typeCode + "&objectID=" + objectID, {asynchronous:true,onComplete:addFavoriteCallBack,evalScripts:true}); 
	//this.location.reload();
}
function addFavoriteCallBack(originalRequest) {
	if(originalRequest.responseText.Trim() == 'Login') {
		openLoginPanel();
	} else {
		callBack(originalRequest);
	}
}
/**
 * 处理AJAX返回信息
*/
function dealAjaxReturnInfo(originalRequest) {
	alert(originalRequest.responseText);
}

/**
 * 读取用户的小组列表
*/

function loadTeamList(memberId) {
	new Ajax.Updater('myTeams', '/mySpaceScript.do?method=myTeamList&memberId=' + memberId, {asynchronous:true,evalScripts:true});
}

function loadFriendList(memberId) {
	new Ajax.Updater('myFriends', '/mySpaceScript.do?method=myFriendList&memberId=' + memberId, {asynchronous:true,evalScripts:true});
}

function loadClicksTopnTeamList() {
	new Ajax.Updater('clicksTopnTeamList', '/teamListAction.do?method=clicksTopnTeamList', {asynchronous:true,evalScripts:true});
}

function loadTeamDetailRightDiv(teamId) {
	//alert('teamListAction.do?method=loadTeamDetailRightDiv&teamid'+teamId);
	new Ajax.Updater('teamDetailRightDiv', '/teamListAction.do?method=loadTeamDetailRightDiv&teamid='+teamId, {asynchronous:true,evalScripts:true});
}

function loadTeamInfoDiv(teamId) {
	//alert('teamListAction.do?method=loadTeamDetailRightDiv&teamid'+teamId);
	new Ajax.Updater('teamLeft', '/teamInfo.do?teamId='+teamId, {asynchronous:true,evalScripts:true});
}

function setPicAsBlogTopPic(postId) {
	$(postId).innerHTML = "<font color=green>请稍候...</font>";
	new Ajax.Updater('', '/postFrontManager.do?method=setPicAsBlogTopPic&postId='+postId, {asynchronous:true,onComplete:updateBlogTop,evalScripts:true});
	
}

function cancelPicAsBlogTopPic(postId) {
	$(postId).innerHTML = "<font color=green>请稍候...</font>";
	new Ajax.Updater('', '/postFrontManager.do?method=cancelPicAsBlogTopPic&postId='+postId, {asynchronous:true,onComplete:updateBlogTop,evalScripts:true});
	
}

function updateBlogTop(originalRequest) {

	if(originalRequest.responseText=="-1") {
		alert('推荐失败');
	}
	if(originalRequest.responseText=="-2") {
		alert('撤消推荐失败');
	}
	if(originalRequest.responseText.indexOf('submit')!=-1) {
		//alert(originalRequest.responseText);
		var id = originalRequest.responseText.split('_');
		//alert(id[0]);
		$(id[0]).innerHTML = "<a href='javascript:v()' onclick='cancelPicAsBlogTopPic("+id[0]+")' target='_self'><font color='red'>撤消推荐</font></a>";
	}
	if(originalRequest.responseText.indexOf('cancel')!=-1) {
		//alert(originalRequest.responseText);
		var id = originalRequest.responseText.split('_');
		//alert(id[0]);
		$(id[0]).innerHTML = "<a href='javascript:v()' onclick='setPicAsBlogTopPic("+id[0]+")' target='_self'><font color='blue'>我的推荐</font></a>";
	}
}
//将悬浮层的位置定位在屏幕中央
/*
function setDivLocation(objdiv,obj,top,left){
		
	if(obj!=null) {
		if(window.event.clientY>210 && window.event.clientY<500) {
			//alert(1);
			//alert(window.event.clientY);
			objdiv.style.top = obj[0];
			objdiv.style.left = obj[1];
		} else if(window.event.clientY>130 && window.event.clientY<500) {
			//alert(2);
			//alert(window.event.clientY);
			objdiv.style.top = window.event.clientY ;
			objdiv.style.left = obj[1];
		} else {
			alert(3);
			alert(window.event.clientY);
			objdiv.style.top = window.event.clientY + 100;
			objdiv.style.left = obj[1];
		}
	} else {
		//alert(4);
		objdiv.style.top = top;
		objdiv.style.left = left;
	}
}
*/
//将悬浮层的位置定位在屏幕中央
function setDivLocation(objdiv,obj,top,left){
		
	if(obj!=null) {
		var p = Position.cumulativeOffset(obj);
		//alert(p); 
		
		objdiv.style.top = p[1];
		objdiv.style.left = p[0];
		if(getPositionNum(objdiv.style.left)>700 ) {
			objdiv.style.left = getPositionNum(objdiv.style.left) - objdiv.offsetWidth + obj.offsetWidth + "px";
		}
		
	} else {
		objdiv.style.top = top;
		objdiv.style.left = left;
	}
}

/*
	@function - 去两边空格
	@param  - 
	@return 
*/
String.prototype.Trim = function(){
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
/**
* - 初始化下拉框，使之默认选中initValue
* @param obj			//目标select域对象	
* @param initValue		//需要Select的值
*/
function initSelect(obj,initValue){
	try{
		var someNodeList = obj.getElementsByTagName('option');
    	var nodes = $A(someNodeList);
		var nIndex = 1;
		var i = 1;
    	nodes.each(function(node){
            if (node.innerHTML==initValue)
            	nIndex = i;
            i++;
        	});
    	obj.selectedIndex = (nIndex-1);  				
	}catch(e){window.status=e}	
}
/*
function hasUnreadNotes(originalRequest) {
	new Ajax.Updater('', 'checkUnreadNotesAJAX.do', {asynchronous:true, evalScripts:true,onComplete:noteAlert}); 
	return false;
}

function noteAlert(originalRequest) {
	if(originalRequest.responseText!="0") {
		$('unReadNotes').style.display = "inline";
		//alert(originalRequest.responseText);
		$('noteImg').alt = originalRequest.responseText;
		$('noteImg').src = "/images/icon_email2.gif";
	}
}
*/
function checkAll(checkBox,cbIndex) {
	var cb = document.all[checkBox];
	if(cb!=null) {
		if(cb.length) {
			for(i=0;i<cb.length;i++) {
				cb[i].checked = cbIndex.checked;
			}
		} else {
			cb.checked = cbIndex.checked;
		}	
	}
}

/**
 普通的reload列表方法
 div:填充列表的层或任何时候有innerHTML属性的标签
*/
function reloadList(div) {
	//alert(self.location.href);
	var url = self.location.href;
	if(url.indexOf("#")!=-1) {
		//alert(url);
		url = url.replace("#","&goto=page");
		//alert(url);
	}
	new Ajax.Updater(div, url, {asynchronous:true, evalScripts:true});
}

function switchCss(vFolder,cCurID,enabledName,disabledName){
		try{
			//alert(vFolder.length);
			for (var i=0;i<vFolder.length;i++){
//				alert("cCurID="+cCurID+"\n\nvFolder["+i+"]="+vFolder[i]+"\n\nvFolder["+i+"].className="+$(vFolder[i]+"T").className);
				var cVF = vFolder[i];
				if (cVF==cCurID){
					//document.getElementById(cVF).className='menubar';					
					//$("img"+i).src="/style/default/header/img/search_m0"+(i+1)+"b.gif";		//v1.0文件夹切换
					$(cVF).className=enabledName;
					
				}else{
					try{
						if ($(cVF).style.display!='none'){
							//document.getElementById(cVF).className='menubar1';
							//$("img"+i).src="/style/default/header/img/search_m0"+(i+1)+".gif";		//v1.0文件夹切换
							$(cVF).className=disabledName;
						}
					}catch(e){}	//-如果传入参数与定义的数组不一致时跳过
				}
			}
		}catch(e){alert("switchCss:"+e)}
	}
	
	// 明星驴友游记
 	function starMemberPostList(memberId,div,count) {
		//alert(div);
		new Ajax.Updater(div, "/memberFrontScript.do?method=starMemberPostList&count="+count+"&memberId="+memberId, {asynchronous:true, evalScripts:true});
	}
	// 明星驴友日记
	function starMemberDiaryList(memberId,div,count) {
		new Ajax.Updater(div, "/memberFrontScript.do?method=starMemberDiaryList&count="+count+"&memberId="+memberId, {asynchronous:true, evalScripts:true});
	}
	// 明星驴友相册
	function starMemberPictureList(memberId,div,count) {
		//alert(count);
		new Ajax.Updater(div, "/memberFrontScript.do?method=starMemberPictureList&count="+count+"&memberId="+memberId, {asynchronous:true, evalScripts:true});
	}
	
	// 明星驴友游记(首页显示)
 	function indexStarMemberPostList(memberId,div,count) {
		//alert(div);
		new Ajax.Updater(div, "/memberFrontScript.do?method=indexStarMemberPostList&count="+count+"&memberId="+memberId, {asynchronous:true, evalScripts:true});
	}
	// 明星驴友日记(首页显示)
	function indexStarMemberDiaryList(memberId,div,count) {
		new Ajax.Updater(div, "/memberFrontScript.do?method=indexStarMemberDiaryList&count="+count+"&memberId="+memberId, {asynchronous:true, evalScripts:true});
	}
	// 明星驴友相册(首页显示)
	function indexStarMemberPictureList(memberId,div,count) {
		//alert(count);
		new Ajax.Updater(div, "/memberFrontScript.do?method=indexStarMemberPictureList&count="+count+"&memberId="+memberId, {asynchronous:true, evalScripts:true});
	}
	// 明星驴友攻略（首页显示)
	function indexStarMemberHandbookList(memberId,div,count) {
		//alert(count);
		new Ajax.Updater(div, "/memberFrontScript.do?method=indexStarMemberHandbookList&count="+count+"&memberId="+memberId, {asynchronous:true, evalScripts:true});
	}	
	
	// 显示字数
	function showStrLen(ele,strLimit,showLenDiv) {
		render(ele,strLimit);
		$(showLenDiv).innerHTML = "字数:" + ele.innerHTML.length;
	}	
	
	function marksOnShowPage(targetId,targetType,targetMemberId) {
		new Ajax.Updater('marksOnShowPage', "/markList.do?method="+targetType+"MarksOnShowPage&targetId="+targetId+"&targetType="+targetType+"&targetMemberId="+targetMemberId, {asynchronous:true, evalScripts:true});
	}
		
	function cg_rightSideBar() {
		new Ajax.Updater('cg_rightSideBar', '/cityGroup.do?method=cgRightSideBar&count=10', {asynchronous:true,evalScripts:true});
	}
	
	function postManager(postId) {
		new Ajax.Updater('manager', '/postFrontManager.do?method=postManager&postId='+postId, {asynchronous:true,evalScripts:true});
	}
	
	function albumManager(postId) {
		new Ajax.Updater('manager', '/postFrontManager.do?method=albumManager&postId='+postId, {asynchronous:true,evalScripts:true});
	}
	function recordPostClick(id) {
		new Ajax.Updater('', '/click.do?method=recordPostClick&id='+id, {asynchronous:true,evalScripts:true});
	}
	function recordClick(id) {
		new Ajax.Updater('', '/click.do?method=recordClick&id='+id, {asynchronous:true,evalScripts:true});
	}
	function credit(id,type) {
		new Ajax.Updater('credit', '/click.do?method='+type+'Credit&id='+id, {asynchronous:true,evalScripts:true});
	}
	function memberInfo(id) {
		new Ajax.Updater('memberInfo', '/memberInfo.do?memberId='+id, {asynchronous:true,evalScripts:true});
	}	
	function recordReviewClick(id) {
		new Ajax.Updater('', '/review.do?method=stat&field=hitTotal&show=false&id='+id, {asynchronous:true,evalScripts:true});
	}	
	
	
// 相关内容页面的评论显示
function commentsOnShowPage(targetId,targetType,targetMemberId) {
	new Ajax.Updater('commentsOnShowPage', "/comment.do?method=commentsOnShowPage&targetId="+targetId+"&targetType="+targetType+"&targetMemberId="+targetMemberId, {asynchronous:true, evalScripts:true});
}
	
	function loadLogin(){
		new Ajax.Updater('loginDiv', '/module/loginPanel.vm', {asynchronous:true,evalScripts:true}); 
	}
	function loadLogin20(){
		var timer = window.setTimeout('iframeReload()', 1000);	
		var url =  '/module/loginPanel20.vm';
		try{new Ajax.Updater('loginDiv', url, {asynchronous:true,evalScripts:true});}
		catch(e){		} 
	}	
	function loadLogin21(){
		var url =  '/module/loginPanel20.vm';
			$.ajax({
				  url: url,
				  cache: false,
				  success: function(html){
				  	$("#loginDiv").html(html);
				  }
			});
	}	
	function loadMCP(){
	 	if(autoLogin()==false){
	 			var rand="&rand="+Math.random();
	 			new Ajax.Updater('mcp', '/memberFrontScript.do?method=mcp'+rand, {asynchronous:true,evalScripts:true});
		} 
	}	
	
	function loadLinePanel(){
		new Ajax.Updater('linePanel', '/panel.do?method=linePanel', {asynchronous:true,evalScripts:true}); 
	}		
	
	function loadDiggMember(targetId, targetType){
		new Ajax.Updater('recent', '/panel.do?method=loadDiggMember&targetId=' + targetId + "&targetType=" + targetType, {asynchronous:true,evalScripts:true}); 
	}	
		
	function starTeamPostList(teamId,div) {
		new Ajax.Updater(div, "/teamListAction.do?method=starTeamPostList&count=4&teamid="+teamId, {asynchronous:true, evalScripts:true});
	}
	function starTeamPicList(teamId,div) {
		new Ajax.Updater(div, "/teamListAction.do?method=starTeamPicList&count=4&teamid="+teamId, {asynchronous:true, evalScripts:true});
	}
	function starTeamPartyList(teamId,div) {
		
		new Ajax.Updater(div, "/teamListAction.do?method=starTeamPartyList&count=4&teamid="+teamId, {asynchronous:true, evalScripts:true});
	}
	function starTeamMemberList(teamId,div) {
		new Ajax.Updater(div, "/teamListAction.do?method=starTeamMemberList&count=3&teamid="+teamId, {asynchronous:true, evalScripts:true});
	}
	function logout() {
		timer = window.setTimeout(logoutResult, 500);
		//停用与BBS同步
		//var url = "http://www.yiqiyou.com/bbs/api/passport.php?action=logout&forward=http%3A%2F%2Fwww.lvtou.com/bbs&verify=be2cab54ac203ec2263e1654a28c8f30";
		/*
		var url = "/LogoutAuth.do";
		var f = document.getElementById('alienFrame');
		f.src = url;
		loadLogin20();
		*/
	}	
	function logoutResult(){
		window.top.location = "/LogoutAuth.do";//"/logout.do";
	}
	
	function UrlEncode1(str){
		var cReturn = encodeURI(str);
		return cReturn;
	}
	
	//日期比较
	function CompareDate(d1,d2)
	{
	  return ((new Date(d1.replace(/-/g,"\/"))) > (new Date(d2.replace(/-/g,"\/"))));
	}
	
	function digg(diggType,targetId) {
		new Ajax.Updater("", "/digg.do?method=digg&diggType=" + diggType + "&targetId=" + targetId, {onComplete:callBack,asynchronous:true, evalScripts:true});
	}
	
	function preference(id, act, type) {
		new Ajax.Updater("", "/destination.do?method=preference&id="+ id +"&act=" + act + "&type=" + type, {onComplete:succReturn, asynchronous:true, evalScripts:true});
	}	
	
	function dig(id, targetType, type, comment) {
		new Ajax.Updater("", "/digg.do?method=dig&id="+ id +"&targetType=" + targetType + "&type=" + type + "&comment=" + comment, {onComplete:digReturn, asynchronous:true, evalScripts:true});
	}	
	
	//好评
	function digGood(id, targetType, type, comment) {
		new Ajax.Updater("", "/digg.do?method=dig&id="+ id +"&targetType=" + targetType + "&type=" + type + "&comment=" + comment, {onComplete:digGoodReturn, asynchronous:true, evalScripts:true});
	}	
	
	//差评
	function digBad(id, targetType, type, comment) {
		var url = "/digg.do?method=dig&id="+ id +"&targetType=" + targetType + "&type=" + type + "&commentId="+targetType+"_"+id+ "&comment=";
		openDigBadPanel(targetType, url);	
	}	
	
	function succReturn(originalRequest){
		var cValue = originalRequest.responseText;
		if(cValue.Trim()=="1") {
			alert("操作成功！");
		}else if(cValue.Trim()=="0") {
			alert("操作失败！");
		}else if(cValue.Trim() == "2"){
			openLoginPanel();
		}else if(cValue.Trim() == "3"){//已关联
			alert("您已经点过！");
		}else{
			alert("操作失败！");
		}
	}	
	
	function digReturn(originalRequest){
		var cValue = originalRequest.responseText;
		if(cValue.Trim() == "Login"){
			openLoginPanel();
		}else{
			document.getElementById('digValue').innerHTML = cValue.Trim();
		}
	}
	
	//好评返回
	function digGoodReturn(originalRequest){
		var cValue = originalRequest.responseText;
		if(cValue.Trim() == "Login"){
			openLoginPanel();
		}else if(cValue.Trim() == "Exist"){
			alert("您今天已经评过分了，不能再评分了！");			
		}else{
			if(document.getElementById('dig1') == null){
				alert("操作成功！");
			}else{
				alert("操作成功！");
				document.getElementById('dig1').innerHTML = cValue.Trim();
				//this.location.reload();				
			}
		}
	}
	
	//差评返回
	function digBadReturn(originalRequest){
		var cValue = originalRequest.responseText;
		if(cValue.Trim() == "Login"){
			openLoginPanel();
		}else if(cValue.Trim() == "Exist"){
			alert("您今天已经评过分了，不能再评分了！");				
		}else{
			if(document.getElementById('dig2') == null){
				alert("操作成功！");
			}else{
				alert("操作成功！");			
				document.getElementById('dig2').innerHTML = cValue.Trim();
				//this.location.reload();				
			}
		}
	}		
	
	//静态下编辑工具条	
	function panel(obj, pid) {
		new Ajax.Updater('' + obj, '/panel.do?method='+ obj +'&targetId=' + pid, {asynchronous:true, evalScripts:true}); 
	}
	
	//静态下统计条	
	function statPanel(obj, pid) {
		new Ajax.Updater('' + obj, '/panel.do?method='+obj+'&targetId=' + pid, {asynchronous:true, evalScripts:true}); 
	}	
			
function selectAll() {
  var objs = document.getElementsByTagName("input");
  for(var i=0; i<objs.length; i++) {
    if(objs[i].type.toLowerCase() == "checkbox" ){
    	if(objs[i].checked) objs[i].checked = false;
    	else  objs[i].checked = true;
	}	    
  }
}

function CopyURL(txt){
	var myHerf=top.location.href;
	var title=document.title;
	if(window.clipboardData){
	var tempCurLink=title + "\n" + myHerf;
	//var tempCurLink="我在www.yiqiyou.com发现了一个好东西，链接是" + "\n" + myHerf;
	var ok=window.clipboardData.setData("Text",tempCurLink);
	if(ok){if(txt!="")alert(txt)};
	}else{alert("对不起，目前此功能只支持IE，请直接复制地址栏的地址！");}
}


function updateOnlineTime(){
	var url = "/mySpace.do?method=updateOnlineTime";
	try{new Ajax.Updater("", url, {asynchronous:true, evalScripts:false});}catch(e){
	}
}
function updateOnlineTime21(){
	var url = "/mySpace.do?method=updateOnlineTime";
	$.ajax({
		  url: url,
		  cache: false,
		  success: function(html){
		  }
	});
}

function isChinese(str)
{
   	var lst = /[u00-uFF]/;       
   	return !lst.test(str);      
}
function strlen(str) 
{
   	var strlength=0;
   	for (i=0;i<str.length;i++){
		if (isChinese(str.charAt(i))==true){
	        strlength=strlength + 2;
	    }else{
	        strlength=strlength + 1;
	  	}
  	}
	return strlength;
}
function countnum(max, obj, out)   
{    
    var r = 0;
    var i = strlen(obj.value);
    var maxL = max;
    var outN = out;    
    if(max > i){
    	r = max - i;
    	//暂时注释
    	//obj.value = obj.value.substring(0, max); 
    } else{
    	obj.value = obj.value.substring(0, max); 
    }
    if(obj.value.replace(/[^\x00-\xff]/g,'**').length > obj.maxLength){
    	document.getElementById(out).innerHTML = "还可以输入<font color='#FF6600'>0</font>个字符";
    }else{
    	document.getElementById(out).innerHTML = "还可以输入<font color='#FF6600'>"+r+"</font>个字符";   
    }
    //此处截取字符中文字符串有问题
    obj.onchange=function(){
    	//忽略总字数
    	vLen = this.value.length;
    	//中文字数
    	cnLen = this.value.replace(/[\u0000-\u00ff]/ig,"").length;//去掉串中的英文
    	//英文字数
    	eLen = vLen - cnLen;
    	//真正的总字数
    	a = cnLen * 2 + eLen;
    	
    	//this.value = this.value.substring(0, a - maxL); 
    	this.value = this.value.substring(0, maxL - cnLen); 
    	
    	countnum(maxL, this, outN);
    }  
    
    //此处截取字符中文字符串有问题
    obj.onblur=function(){
    	//忽略总字数
    	vLen = this.value.length;
    	//中文字数
    	cnLen = this.value.replace(/[\u0000-\u00ff]/ig,"").length;//去掉串中的英文
    	//英文字数
    	eLen = vLen - cnLen;
    	//真正的总字数
    	a = cnLen * 2 + eLen;
    	
    	//this.value = this.value.substring(0, a - maxL); 
    	this.value = this.value.substring(0, maxL - cnLen); 
    	
    	countnum(maxL, this, outN);
    }    
}
function cnfullText(out){
	if(document.getElementById(out) != 'undefined'){
		document.getElementById(out).innerHTML = "还可以输入<font color='#FF6600'>0</font>个字符";   
	}
}

//用于同ucenter同步
function iframeReload(){
    var doc; 
    if (document.all){//IE 
    	document.frames('alienFrame').location.reload(true);
   	}else{//Firefox    
		var url = "/ucenter.vm";
		var f = document.getElementById('alienFrame');
		if(f != null){
			f.src = url;  
		}
    }
}

function loginAjaxForm(form){
	document.getElementById("submitButton").innerHTML="<img src='/images/loading.gif' />...";
	new Ajax.Updater('mcp', '/LoginAuth.do?refer=/memberFrontScript.do?method=mcp', {asynchronous:true, onComplete: loginAjaxFormed, evalScripts:true, parameters:Form.serialize(form)}); 
	return true;
}
function loginAjaxFormed(originalRequest) {
	if(originalRequest.responseText.indexOf('无效的用户或密码错误')!=-1) {
		loadMCP();
		alert("无效的用户或密码错误！");
	}else{
		iframeReload();
		document.getElementById('mcp').innerHTML = originalRequest.responseText;
	}
}

function loginAjaxFormTop(form, refer){
	var userName = document.getElementById("userName");
	var password = document.getElementById("password");
	try{		
		if(userName.value == '' || password.value == ''){
			alert("请输入用户名称和密码！");
			userName.focus();
			return false;
		}else{
			setCookie("userName", userName.value,3);
			document.getElementById("btnSubmitDiv").innerHTML="<img src='/images/loading.gif' />...";
			new Ajax.Updater('loginDiv', '/LoginAuth.do?refer=' + refer, {asynchronous:true, onComplete: loginAjaxFormedTop, evalScripts:true, parameters:Form.serialize(form)}); 
			return true;			
		}
		
	}catch(e){}
	return true;
}
function loginAjaxFormedTop(originalRequest) {
	if(originalRequest.responseText.indexOf('无效的用户或密码错误')!=-1) {
		loadLogin20();
		alert("无效的用户或密码错误！");
	}else{
		iframeReload();
		document.getElementById('loginDiv').innerHTML = originalRequest.responseText;		
	}
}

function checkLoginName(obj){
	var userName = obj.value;
	try{		
		if(userName.value == ''){
			return false;
		}else{
			document.getElementById("checkDiv").innerHTML="<img src='/images/loading.gif' />...";
			new Ajax.Updater('', '/check.do?method=checkUser&username=' + encodeURI(userName), {asynchronous:true, onComplete: checkLoginNameBack, evalScripts:true}); 
			return true;			
		}
		
	}catch(e){}
	return true;
}
function checkLoginNameBack(originalRequest) {
	if(originalRequest.responseText.indexOf('true')!=-1) {
		document.getElementById("checkDiv").innerHTML="<font color='blue'>存在</font>";
	}else{
		document.getElementById("checkDiv").innerHTML="<font color='red'>不存在，已自动注册</font>";
	}
}

function continueAdd(href){
	//alert(self.location.href);
	document.getElementById("saveAndContinue").value="" + href;
}

function fucCheckNUM(NUM)
{
 var i,j,strTemp;
 strTemp="0123456789";
 if ( NUM.length== 0)
  return 0
 for (i=0;i<NUM.length;i++)
 {
  j=strTemp.indexOf(NUM.charAt(i)); 
  if (j==-1)
  {
  //说明有字符不是数字
   return 0;
  }
 }
 //说明是数字
 return 1;
}  
	
function clearFormat(obj){
	try
	{
		var content = FCKeditorAPI.GetInstance(obj).EditorDocument.body.innerHTML;

		//处理多余符号
		content = content.replace(/(\n|\r|&nbsp;|　|)/ig,"");
		//杀死js
		content = content.replace(/<script.*?>.*?<\/scrip[^>]*>/ig,"");
		//content = content.replace(/<(.*?)[\s]+[^\s]+javascript:[^>^\s]*[\s]+(.*?)>/ig,"<$1 $2>");
		//content = content.replace(/<img([^>]*?)javascript:([^>]*)>/ig,"<img$1$2>");
		//杀死style
		content = content.replace(/<style[^>]*>.*?<\/styl[^>]*>/ig,"");
		//杀死垃圾内容
		content = content.replace(/<img[^>]*?http:\/\/www.pcpop.com\/doc\/Image\/popup.gif[^>]*>/ig,"");
		content = content.replace(/<img[^>]*?http:\/\/www.pcpop.com\/doc\/Image\/0ic.gif[^>]*>/ig,"");
		content = content.replace(/<img[^>]*?http:\/\/www.it.com.cn\/images\/comm\/arrow.gif[^>]*>/ig,"");
		content = content.replace(/<img[^>]*?http:\/\/images.enet.com.cn\/end.gif[^>]*>/ig,"");
		content = content.replace(/\([^\)]*资料[^\)]*文章[^\)]*价格[^\)]*评论[^\)]*\)/ig,"");
		content = content.replace(/\([^\)]*参数[^\)]报价*[^\)]*评论[^\)]*\)/ig,"");
		//清理多余html
		//Tag首
		content = content.replace(/<font[^>]*>/ig,'');
		content = content.replace(/<span[^>]*>/ig,'');
		content = content.replace(/<div([^>]*)>/ig,'<p$1>');
		content = content.replace(/<h1[^>]*>/ig,'');
		content = content.replace(/<h2[^>]*>/ig,'');
		content = content.replace(/<h3[^>]*>/ig,'');
		content = content.replace(/<code[^>]*>/ig,'<br>');
		content = content.replace(/<center([^>]*)>/ig,'<center$1>');
		content = content.replace(/<th[^>]*>/ig,'');
		content = content.replace(/<sohu[^>]*>/ig,'');
		content = content.replace(/<form[^>]*>/ig,'');
		content = content.replace(/<input[^>]*>/ig,'');
		content = content.replace(/<select[^>]*>/ig,'');
		content = content.replace(/<textarea[^>]*>/ig,'');
		content = content.replace(/<iframe[^>]*>/ig,'');
		content = content.replace(/<strong[^>]*>/ig,'<b>');
		content = content.replace(/<b\s[^>]*>/ig,'<b>');
		content = content.replace(/<st[^>]*>/ig,'');
		content = content.replace(/<o:p[^>]*>/ig,'');
		//Tag尾
		content = content.replace(/<\/font>/ig,'');
		content = content.replace(/<\/span>/ig,'');
		content = content.replace(/<\/div>/ig,'</p>');
		content = content.replace(/<\/h1>/ig,'');
		content = content.replace(/<\/h2>/ig,'');
		content = content.replace(/<\/h3>/ig,'');
		content = content.replace(/<\/code>/ig,'<br>');
		content = content.replace(/<\/center>/ig,'</center>');
		content = content.replace(/<\/th>/ig,'');
		content = content.replace(/<\/sohu[^>]*>/ig,'');
		content = content.replace(/<\/form[^>]*>/ig,'');
		content = content.replace(/<\/input[^>]*>/ig,'');
		content = content.replace(/<\/select[^>]*>/ig,'');
		content = content.replace(/<\/textarea[^>]*>/ig,'');
		content = content.replace(/<\/iframe[^>]*>/ig,'');
		content = content.replace(/<\/strong>/ig,'</b>');
		content = content.replace(/<\/st[^>]*>/ig,'');
		content = content.replace(/<\/o:p[^>]*>/ig,'');
		//单tag		
		content = content.replace(/<\?xml[^>]*>/ig,'');
		content = content.replace(/(<br[^>]*>)+/ig,'<br>');
		//清除解释文字
		content = content.replace(/<\!--.*?-->/ig,'');

		//处理表格
		//保留表格内容
		content = content.replace(/<(table|tbody|tr|td)[^>]*>/ig,'');
		content = content.replace(/<\/(table|tbody|tr|td)[^>]*>/ig,'');
				
		//去掉链接中的无用参数
		content = content.replace(/<a.*?href="([^"]*)"[^>]*>/ig,'<a href=\"$1\">');
		content = content.replace(/点击放大/ig,'<font color=#ff0000><b>点击放大</b></font>');
		//去掉图片中的无用参数
		content = content.replace(/<img.*?src=([^>]*)[^>]*>/ig,'<img src=$1 border=\"0\">');
		//去掉图片链接和加粗
		content = content.replace(/<a[^>]*>(([^\/]|\/[^a])*?<img([^\/]|\/[^a])*?)<\/a>/ig,'$1');
		content = content.replace(/<b>(([^\/]|\/[^b])*?<img([^\/]|\/[^b])*?)<\/b>/ig,'$1');
		content = content.replace(/(<img[^>]*>)\s*<\/a>/ig,'$1');
		//去多余b
		content = content.replace(/<b><\/b>/ig,'');
		content = content.replace(/<\/b><b>/ig,'');			
		
		//*/
		//*//强制图片居中，并处理小图并列，中间加空格
		content = content.replace(/(<img[^>]*>)/ig ,'<center>$1<\/center>');
		var re=/(<img[^>]*>)<\/center>(<b>|<\/b>|\s)*<center><img/;
		while(re.test(content)){
			content = content.replace(/(<img[^>]*>)<\/center>(<b>|<\/b>|\s)*<center><img/ig,"$1　<img");
		}

		//*/
		//格式文本
		content = "MM163brMM" + content;
		//换掉br
		content = content.replace(/<br[^>]*>/ig,'<br>');
		content = content.replace(/<br>(<br>|\s)*/ig,'<p>');
		
		//处理center和P
		content = content.replace(/<center>(<center>|\s)*/ig,'<center>');
		content = content.replace(/<\/center>(<\/center>|\s)*/ig,'</center>');
		content = content.replace(/<center>\s*<\/center>/ig,'');
		content = content.replace(/<p[^>]*>\s*<\/p>/ig,'');
		content = content.replace(/<p[^>]*>/ig,'MM163brMM');
		content = content.replace(/<\/p[^>]*>/ig,'');
		
		//处理段落
		content = content.replace(/MM163brMM(MM163brMM|\s)*/ig,'MM163brMM');
		content = content.replace(/MM163brMM/ig,'<p style="text-indent: 2em">');
		content = content.replace(/<p[^>]*>\s*<center>/ig,'<p><center>');//center不用退两格
		//去头加尾
		content = content.replace(/([^>\s]?)\s*<HR color=#ff0123>/ig,'$1</p><HR color=#ff0123>');
		content = content.replace(/<HR color=#ff0123>\s*([^<\s]?)/ig,'<HR color=#ff0123><p>$1');
		content = content.replace(/<p[^>]*>\s*?<\/p>/ig,'');
		content = content.replace("</p>","");
		
		FCKeditorAPI.GetInstance(obj).EditorDocument.body.innerHTML = content+"</p>";

		//alert("A " + FCKeditorAPI.GetInstance('body').EditorDocument.body.innerHTML);
	}
	catch(ex){}
	finally{}	
}

/**
 * 通用的AJAX回调函数
 * 使用此回调函数时,其返回的信息应该使用以下格式,
 * boolean_message,例:"true_操作成功";此时
 * boolean为true,则刷新当前页面,弹出窗口提示信
 * 息为"操作成功"
 *  
*/
function callBack(originalRequest) {
	var returnMsg = originalRequest.responseText;
	var reload = true;
	var opIndex = returnMsg.split('_')[0];
	if(opIndex.Trim()!="login" && opIndex.Trim()!="Login") {
		if(opIndex=="false") {
			reload = false;
		} 
		alert(returnMsg.split('_')[1]);
		//showMessage(returnMsg.split('_')[1],function(){if(reload){window.location.reload();}return true;});
		return true;
	} else {
		openLoginPanel();
		return false;
	}	
}

/**
 封装了Dialog.alert方法
 message: 要显示的信息
 okCallBack: 点击确定后的回调方法
*/
function showMessage(message,okCallBack) {
	Dialog.alert("<br />" + message, 
				{
					windowParameters: {title:"系统提示",className:'alphacube',width:400,showEffect:Element.show,hideEffect:Element.hide}, 
					okLabel: "关闭", 
					ok:okCallBack
				});
}

/**
 显示异步内容
*/
function showContent(url,width) {
	Dialog.alert({url:url, options: {method: 'get',onCreate:showLoading,onComplete:hideLoading}}, {windowParameters: {className: "alphacube", width:width,hideEffect:Element.hide,showEffect:Element.show},okLabel: "关闭"});
}

/**
 * 显示读取状态
 * ajax默认执行的方法 

Ajax.Responders.register({
  onCreate: function() {
	var loading = $('loading');
	var lvtouNav = $('lvtouNav');
	var lvtouNav_width = Element.getStyle(lvtouNav, 'width');
	Element.show(loading);
	loading.style.left = (window.screen.width + getPositionNum(lvtouNav_width)- 200)/2 - 20 + 'px';
	loading.style.top = document.documentElement.scrollTop + 10 + 'px';
  },
  onComplete: function() {
	var loading = $('loading');
   	Element.hide(loading);
  }
});
*/

function showLoading() {
	var loading = $('ajax-loading');
	var lvtouNav = $('lvtouNav');
	var lvtouNav_width = Element.getStyle(lvtouNav, 'width');
	loading.show();
	loading.style.left = (window.screen.width + getPositionNum(lvtouNav_width)- 200)/2 - 20 + 'px';
	loading.style.top = document.documentElement.scrollTop + 10 + 'px';
}

function hideLoading() {
	var loading = $('ajax-loading');
   	loading.hide();
}

function initLoading() {
	document.write("<div id='ajax-loading' style='position:absolute;display:none;background-color:yellow;border:1px solid #46B800;width:100px;z-index:100;'><img src='/style/default/header/img/ajax-loader.gif' /><lable id='loadingMsg'>数据读取中...</lable></div>");
}initLoading();

var loginHTML = "<form name='winloginForm' id='winloginForm' action='/login.do' method='post' target='_self'>";
loginHTML = loginHTML + "<input name='forward' type='hidden' value=''>"
loginHTML = loginHTML + "<input name='refer' type='hidden' value=''>";    		      	
loginHTML = loginHTML + "<br />";
loginHTML = loginHTML + "<table width='400' border='0' align='center' >";
loginHTML = loginHTML + "<tr>";
//loginHTML = loginHTML + "<td width='28%' align='center' bgcolor='#EFFCE9'><img src='img/lock.gif' width='48' height='48' /></td>";
loginHTML = loginHTML + "<td width='100%' >";
loginHTML = loginHTML + "<table width='100%' border='0' align='center' cellspacing='5'>";
loginHTML = loginHTML + "<tr>";
loginHTML = loginHTML + "<td colspan='3' valign='left' style='text-align:center;color:red;'>你仍未登录,请先登录后再执行此操作<br /><br /></td>";
loginHTML = loginHTML + "</tr>";
loginHTML = loginHTML + "<tr><td width='25%' rowspan='2' align='right'><img src='/style/default/img/loginm.gif' /></td> ";
loginHTML = loginHTML + "<td width='15%' align='right'>用户名</td>";
loginHTML = loginHTML + "<td width='70%' align='left'><input name='userName' id='winuserName' type='text' size='20' style='border:1px solid #ccc; width:150px;background:none;' />";
loginHTML = loginHTML + "</td>";
loginHTML = loginHTML + "</tr>";
loginHTML = loginHTML + "<tr>";
loginHTML = loginHTML + "<td align='right'>密码</td>";
loginHTML = loginHTML + "<td align='left'><input name='password' id='winpassword' type='password' size='20' onkeydown=\"if(event.keyCode==13){submitLoginForm();}\" style='border:1px solid #ccc; width:150px;background:none;' />";
loginHTML = loginHTML + "</td>";
loginHTML = loginHTML + "</tr>";

loginHTML = loginHTML + "<tr>";
loginHTML = loginHTML + "<td colspan='3' valign='left' style='text-align:center;'>未注册?  请点击<a href='/register'><b><font color='green'>注册新用户</font></b></a></td>";
loginHTML = loginHTML + "</tr>";
loginHTML = loginHTML + "</table></td>";
loginHTML = loginHTML + "</tr>";
loginHTML = loginHTML + "</table>";
loginHTML = loginHTML + "</form>";
function openLoginPanel() {
	
	try{
	Dialog.confirm(loginHTML, {windowParameters: {title:"会员登录",className:"alphacube", width:400,hideEffect:Element.hide,showEffect:Element.show,wiredDrag:true}, 
								okLabel: "登录", 
								cancelLabel: "取消", 
								ok:function(win){ 
									submitLoginForm();
									return true;
								}});
	$('winuserName').focus();
	}catch(ex){}
	finally{}
}

function submitLoginForm() {
	if($F('winuserName').Trim() == "") {
		showMessage("<br> 请填写用户名");
		return false;
	}
	if($F('winpassword').Trim() == "") {
		showMessage("<br> 请填写密码");
		return false;
	}
	$('winloginForm').submit(); 
}

/*---------------差评理由--------------------*/
function setvalue(obj){
	document.getElementById("result2").value = obj.options[obj.selectedIndex].value;
}

function dishDigBadHtml(){
	var badHtml = "";
	badHtml = badHtml + "						<option value='差评原因：一点都不好吃'>一点都不好吃</option>";
	badHtml = badHtml + "						<option value='差评原因：垃圾食物'>垃圾食物</option>";
	return badHtml;
}

function hotelDigBadHtml(){
	var badHtml = "";
	badHtml = badHtml + "						<option value='差评原因：服务太差'>服务太差</option>";
	badHtml = badHtml + "						<option value='差评原因：黑店'>黑店</option>";
	return badHtml;
}

function postDigBadHtml(){
	var badHtml = "";
	badHtml = badHtml + "						<option value='差评原因：内容抄袭'>内容抄袭</option>";
	badHtml = badHtml + "						<option value='差评原因：文字错误'>文字错误</option>";
	badHtml = badHtml + "						<option value='差评原因：水平初级'>水平初级</option>";
	badHtml = badHtml + "						<option value='差评原因：感觉不舒服'>感觉不舒服</option>";
	return badHtml;
}

function placeDigBadHtml(){
	var badHtml = "";
	badHtml = badHtml + "						<option value='差评原因：不好玩'>不好玩</option>";
	badHtml = badHtml + "						<option value='差评原因：没意思'>没意思</option>";
	return badHtml;
}

function viewsDigBadHtml(){
	var badHtml = "";
	badHtml = badHtml + "						<option value='差评原因：不好玩'>不好玩</option>";
	badHtml = badHtml + "						<option value='差评原因：没意思'>没意思</option>";
	return badHtml;
}

function equipDigBadHtml(){
	var badHtml = "";
	badHtml = badHtml + "						<option value='差评原因：抄袭'>抄袭</option>";
	badHtml = badHtml + "						<option value='差评原因：设计错误'>设计错误</option>";
	badHtml = badHtml + "						<option value='差评原因：粗糙'>粗糙</option>";
	badHtml = badHtml + "						<option value='差评原因：感觉不舒服'>感觉不舒服</option>";
	return badHtml;
}

function getDigBadHTML(forTarget){
	var digBadHTML = "<form name='winloginForm' id='winloginForm' action='/login.do' method='post' target='_self'>";
	digBadHTML = digBadHTML + "<table width='500' border='0' align='center' >";
	digBadHTML = digBadHTML + "<tr>";
	digBadHTML = digBadHTML + "<td valign='left' style='text-align:center;color:red;'>必须选择或填写差评的理由，否则无法提交。<br /><br /></td>";
	digBadHTML = digBadHTML + "</tr>";
	digBadHTML = digBadHTML + "<tr>";
	digBadHTML = digBadHTML + "<td>";
	
	digBadHTML = digBadHTML + "					<table><tr><td>&nbsp;</td><td>";
	digBadHTML = digBadHTML + "						<select onchange='setvalue(this)'>";
	digBadHTML = digBadHTML + "						<option>请选择差评的理由</option>";
	
	
	digBadHTML = digBadHTML + eval(forTarget + "DigBadHtml()");
	
	digBadHTML = digBadHTML + "						</select>";
	digBadHTML = digBadHTML + "						</td><td>";
	digBadHTML = digBadHTML + "						<input type='text'  size='50' id='result2' name='data[Comment][content]'>";
	digBadHTML = digBadHTML + "						</td></tr>";
	digBadHTML = digBadHTML + "					</table>";
	
	digBadHTML = digBadHTML + "</td>";
	digBadHTML = digBadHTML + "</tr>";
	digBadHTML = digBadHTML + "</table>";
	digBadHTML = digBadHTML + "</form>";
	return digBadHTML;
}

function openDigBadPanel(forTarget, url) {
	
	Dialog.confirm(getDigBadHTML(forTarget), {windowParameters: {title:"请输入差评理由",className:"alphacube", width:500,hideEffect:Element.hide,showEffect:Element.show,wiredDrag:true}, 
								okLabel: "提交", 
								cancelLabel: "取消", 
								ok:function(win){ 
									submitDigBadForm(url);
									return true;
								}});
	$('result2').focus();
}

function submitDigBadForm(url) {
	if($F('result2').Trim() == "") {
		showMessage("<br> 请选择或者填写差评的理由，否则不能评分！！！");
		return false;
	}
	new Ajax.Updater("", url + encodeURIComponent($F('result2').Trim()), {onComplete:digBadReturn, asynchronous:true, evalScripts:true});
}

/*
	*	加载小纸条数
	*/
	var fla;
	var title=document.title;
	function loadInfoCount(div){
		var url="/info.do?method=ajaxNum";
			$j.ajax({
		  		url: url,
	      		type: 'GET',
				success: function(txt){
					if(txt.indexOf('error')<0){
						var par="<a href='javascript:void(0)' onclick=\"clearFlash();window.open('/person.do?method=personIndex')\" target='_self'>小纸条</a>("+txt+")";
						$j("#"+div).html(par);             
						var c=parseInt(txt);
						if(c>0){
							fla=setInterval("flash('你有新的信息')",500);
						}else{
							 clearFlash();
						}
					}
					else{
						$j("#"+div).html(""); 
					}
				},                           
				error:function(txt){
				}
			});
		setTimeout("loadInfoCount('"+div+"')",600000);
	}
	function clearFlash(){
		clearInterval(fla);
		document.title=title;
	}
	function flash(txt){
		if(document.title.indexOf(txt)>-1)
			document.title='　　　　　　';
		else
			document.title=txt;
	}
	
	//分类切换
	function routeZXCategory(show, typeTab, max, showTab, showDiv){
		for(i = 1; i<max + 1; i++){
			$(typeTab + "_" + i).removeClassName("active1"); 
		}
		$( showTab).addClassName("active1");
		$( show).innerHTML = $( showDiv).innerHTML;
	}
	
	//生成搜索的url
	function searchUrl(tag,c){
		var url ="/subjectSearch.do?method=search&key="+encodeURIComponent(tag)+"&cate="+c;
		return url;
	}

	function autoLogin(){
		var user=getCookie("lvtou_user");
		var rand="&rand="+new Date().getTime();
		if(user!=null){
			var values=user.split("_");
			var url="/LoginAuth.do?refer=/memberFrontScript.do?method=mcp&userName="+values[3]+"&password="+values[1]+rand;
			new Ajax.Updater('mcp', url, {asynchronous:true,evalScripts:true});
			return true;
		}
		return false;
	}