function limitstr(getstr,objectstr,limitnun,limitnun2)
{
   var mystr;
   if(getstr!=undefined)
   {
      mystr=trim(getstr);
      if((mystr.length>limitnun2 || mystr.length<limitnun) && mystr.length>0)
      {
	     document.getElementById(objectstr).value=mystr.substr(0,limitnun2);
	     alert("文字范围"+limitnun+"至"+limitnun2+"个字,超出部分系统自动截取");
		 if(document.getElementById('ns'))
		 {
		       document.getElementById('ns').innerHTML='目前有'+(document.getElementById(objectstr).value.length)+'个字'
		 }
		 if(document.getElementById('ns1'))
		 {
		       document.getElementById('ns1').innerHTML='目前有'+(document.getElementById(objectstr).value.length)+'个字'
		 }		 
	     return false;
      }
   }
}

function trim(str1)
{
   str1=str1.replace(/^ +/,"");
   str1=str1.replace(/^ +/,"");
   str1=str1.replace(/ +$/,"");
   str1=str1.replace("object","");
   str1=str1.replace(/<.*?>/g,"");
   str1=str1.replace(/\</,"");
   str1=str1.replace(/=/,"");
   str1=str1.replace(/\|/,"");   
   return str1;
}

function _CheckSubmit(objects,txt)
{
str1=document.getElementById("searchw_"+txt).value;
str1=str1.replace(/^ +/,"");
str1=str1.replace(/ +$/,"");
   if(str1=="")
   {
   alert("关键词不能为空!");
   document.getElementById("searchw_"+txt).focus();
   return false;
   }
}

function adddisk(recordid,type)
{	
		var Result=IsLogin();
		if(Result=="NO")
		{
			alert('您尚未登陆!');
		}
		else
		{
			var url='../include/adddisk.php';
			var pars="id="+recordid+"&type="+type;
			var myAjax = new Ajax.Request(url,{method: 'post',asynchronous:true,parameters:pars,onComplete:disk_showResponse});
		}

}
function disk_showResponse(originalRequest)
{
  	var str=originalRequest.responseText;
	alert(str);	
}

function setcomments(id,s,type)
{
    var url='../include/addcomments.php';
    var pars="id="+id+"&dowhat="+s+"&type="+type;
    var myAjax = new Ajax.Request(url,{method: 'post',asynchronous:true,parameters:pars,onComplete:setcomments_showResponse})
}
function setcomments_showResponse(originalRequest)
{
  	var str=originalRequest.responseText;
	arr=new Array();
	arr=str.split("|||");
	if(arr[1]=="yes")
	{
	    document.getElementById(arr[2]).innerHTML=arr[3];
		alert(arr[0]);
	}
	else
	{
		alert(arr[0]);
	}
}




function addlrc(recordid)
{
    var Result=IsLogin();
	if(Result=="NO")
	{
		alert("你尚未登录!");
	}
	else 
	{
	    _error_msg_show("<iframe id='abc' name='abc' src='/include/addlrc.php?id="+recordid+"'  scrolling='no' border='0' frameborder='0' width='100%'  height='60px'></iframe>", '','窗口加载中,请稍等！');	
	}
}

function FilterSet(GetStr)
{
		 var url='/Ajax/AjaxWords.php';
		 var pars='Str='+encodeURIComponent(GetStr);
		 var x;
		 var myAjax=new Ajax.Request(url,{method:'post',asynchronous:false,parameters:pars,onComplete:function(a)
         {
			 var GArr;
			 GArr=a.responseText;
			 if(GArr!='ok')
			 {
				 x=GArr;
			 }
			 else
			 {
				 x=true;
			 }
		 }});
		 return x;
}
