window.onerror = function(){return true;}
String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, "");}

function ImageZoom(Img,width,height)
{ 
	var image=new Image(); 
	image.src=Img.src;
	if(image.width>width||image.height>height)
	{
		w=image.width/width; 
		h=image.height/height; 
		if(w>h)
		{
			Img.width=width; 
			Img.height=image.height/w; 
		}
		else
		{
			Img.height=height; 
			Img.width=image.width/h; 
		} 
	}
}

function ImageOpen(Img)
{
	window.open(Img.src);
}

function ChkUserLogin(frm)
{
	if(frm.User_Name.value.trim()=='')
	{
		alert("请输入您的用户名。");
		frm.User_Name.focus();
		return false;
	}
	if(frm.User_Password.value.trim()=='')
	{
		alert("请输入您的密码。");
		frm.User_Password.focus();
		return false;
	}
	return true;
}

function ChkUserSearch(frm)
{
	if(frm.keyword.value.trim()=="")
	{
		alert("请输入你要查询的关键词。");
		frm.keyword.focus()
		return false;
	}
	return true;
}

function Ok3w_G_Submit(frm)
{
	if(frm.UserName.value.trim()=="" || frm.UserName.value=="请输入您的姓名")
	{
		alert("请输入姓名");
		frm.UserName.focus();
		return false;
	}
	if(frm.Content.value.trim()=="" || frm.Content.value=="请输入您的评论")
	{
		alert("请输入内容");
		frm.Content.focus();
		return false;
	}
	
	frm.bntSubmit.disabled=true;
	
	frm.submit();
}

function SetCwinHeight(obj)
{
  var cwin=obj;
  if (document.getElementById)
  {
    if (cwin && !window.opera)
    {
      if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)
        cwin.height = cwin.contentDocument.body.offsetHeight; 
      else if(cwin.Document && cwin.Document.body.scrollHeight)
        cwin.height = cwin.Document.body.scrollHeight;
    }
  }
}

function oCopy(a,type,str){
	if(str=="" || str=="http://")
	{
		alert("该网友没有填写相关内容");
		return false;
	}
	a.target="_blank";
	if(type==1)
		a.href = str;
	if(type==2)
		a.href = "mailto:" + str;
	if(type==3)
		a.href = "tencent://message/?uin="+ str + "&Site=im.qq.com&Menu=yes";
//	var obj = document.all.xCopy;
//	obj.value = Str;
//	obj.select();
//	js=obj.createTextRange();
//	js.execCommand('Copy');
//	alert('复制成功'); 
}

function Vote(id,action)
{
	mydown.location.href = "./c/soft_hits.asp?id=" + id + "&type=display&action=" + action;
}
