var W=screen.width;//取得屏幕分辨率宽度
var H=screen.height;//取得屏幕分辨率高度

var Tool=Class.create();
Tool.prototype={
		 initialize:function()
		 {

		 },
		 LimitStr:function(GetStr,ObectStr,LimitNum,LimitNum2)
		 {
			  var MyStr='';
			  if(GetStr!=undefined)
			  {
					  MyStr=this.Trim(GetStr);
					  if((MyStr.length>LimitNum2 || MyStr.length<LimitNum) && MyStr.length>0)
					  {
							 $(ObectStr).value=MyStr.substr(0,LimitNum2);
							 alert("文字范围"+LimitNum+"至"+LimitNum2+"个字,超出部分系统自动截取");
							 if($('ns'))
							 {
								   $('ns').innerHTML='目前有'+($(ObectStr).value.length)+'个字'
							 }
							 if($('ns1'))
							 {
								   $('ns1').innerHTML='目前有'+($(ObectStr).value.length)+'个字'
							 }
							 return false;
					  }
			  }
		 },
		 Trim:function(Str)
		 {
			  Str=Str.replace(/^ +/,"");
			  Str=Str.replace(/ +$/,""); 
			  Str=Str.replace(/^&+/,"");
			  Str=Str.replace(/&+$/,""); 
		      return Str;
		 },
		 CheckSubmit:function(objects,txt)
		 {
			  var Str=$("searchw_"+txt).value;
			  if(this.Trim(Str)=="")
			  {
				  alert("关键词不能为空!");
				  $("searchw_"+txt).focus();
				  return false;
			  }
		 },
		 FilterSet:function(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;
		  },
		  GetCode:function()
		  {
			  var c=Math.random();
			  $("codeimg1").src='../include/bbscode.php?c='+c;
		  },
		  GoURL:function(Value)
		  {
			   var GetUrl=document.referrer;
			   if(GetUrl=='')
			   {
				   location.href=Value;
			   }
			   else
			   {
				   location.href=GetUrl;
			   }
		  },
		  isIE:function()
		  {
				 return (document.all && window.ActiveXObject && !window.opera) ? true : false;
		  },
		  LoadIt:function(info,w,h)
		  {
			 $("SubDiv").innerHTML="<table><tr><td><img id='jdt' src='/images/05043143.gif'></td><td>"+info+"<font id='tDate'></font></td></tr></table>";

			 var MDiv=document.getElementById("MDiv");
			 var SubDiv=document.getElementById("SubDiv");
			  
			 MDiv.style.width =w+"px";
			 MDiv.style.height=h+"px"; 			 
			 MDiv.style.display="block";
			 MDiv.style.position="absolute";
			 MDiv.style.border="0px";
			 MDiv.style.left="0px";
			 MDiv.style.top="0px";
			 MDiv.style.background="#F6F6F6";
			 MDiv.style.width=parseFloat(document.body.clientWidth)-200+"px";
			 MDiv.style.height=document.body.clientHeight+"px"; 
			 if(this.isIE())
			 {
				   MDiv.style.filter="Alpha(Opacity=0)";
			 }
			 else
			 {
				   MDiv.style.opacity=0.6;
			 }
			 MDiv.style.zIndex="10";
			 SubDiv.style.display="block";
			 SubDiv.style.position="absolute";
			 SubDiv.style.border="1px solid #CCCCCC";
			 SubDiv.style.background="#F6F6F6";
			 SubDiv.style.left=(W/2-100)+"px";
			 SubDiv.style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight/2-100)+"px";
			 SubDiv.style.width =w+"px";
			 SubDiv.style.height=h+"px"; 
			 SubDiv.style.zIndex="10";
		  },
		  LoadItFrame:function(info,w,h)
		  {
			 $("SubDivs").innerHTML="<table><tr><td><img id='jdt' src='/images/05043143.gif'></td><td>"+info+"<font id='tDate'></font></td></tr></table>";

			 var MDiv=document.getElementById("MDivs");
			 var SubDiv=document.getElementById("SubDivs");
			  
			 MDiv.style.width =w+"px";
			 MDiv.style.height=h+"px"; 			 
			 MDiv.style.display="block";
			 MDiv.style.position="absolute";
			 MDiv.style.border="0px";
			 MDiv.style.left="200px";
			 MDiv.style.top="0px";
			 MDiv.style.background="#F6F6F6";
			 MDiv.style.height=document.body.clientHeight+"px"; 
			 if(this.isIE())
			 {
				   MDiv.style.filter="Alpha(Opacity=0)";
			 }
			 else
			 {
				   MDiv.style.opacity=0.6;
			 }
			 MDiv.style.zIndex="10";
			 SubDiv.style.display="block";
			 SubDiv.style.position="absolute";
			 SubDiv.style.border="1px solid #CCCCCC";
			 SubDiv.style.background="#F6F6F6";
			 SubDiv.style.left="200px";
			 SubDiv.style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight/2-100)+"px";
			 SubDiv.style.width =w+"px";
			 SubDiv.style.height=h+"px"; 
			 SubDiv.style.zIndex="10";
		  },		  
		  CloseIt:function()
		  {
			  $('MDiv').style.display='none';
			  $("SubDiv").style.display='none';
		  },
		  ClearImg:function()
		  {
			  $('MDivs').style.display='none';
			  $("SubDivs").style.display='none';
		  }
		  
}
document.write('<div id="SubDiv" style="font-size:14px;text-align:center;display:none;line-height:40px" ></div>');
document.write('<div id="MDiv" style="display:none"></div>');

document.write('<div id="SubDivs" style="font-size:14px;text-align:center;display:none;line-height:40px" ></div>');
document.write('<div id="MDivs" style="display:none"></div>');

var MyTool=new Tool();
