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";
}

function Vote(id,action)
{
	mydown.location.href = "./c/soft_hits.asp?id=" + id + "&type=display&action=" + action;
}

function Ok3w_insertFlash(base_url, focus_width, focus_height, swf_height, text_height, pics, links, texts)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+base_url+'images/focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#e7e7e7">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	document.write('</object>');
}

function Marquee_X(RndID,StrGD,Width,Height,Speed)
{
	document.write('<div id="'+RndID+'" style="overflow:hidden;height:'+Height+'px;width:'+Width+'px;">');
	document.write('<table border="0" cellspacing="0" cellpadding="0">');
	document.write('  <tr>');
	document.write('    <td id="'+RndID+'1" height="'+Height+'" nowrap="nowrap">'+StrGD+'</td>');
	document.write('    <td id="'+RndID+'2" height="'+Height+'" nowrap="nowrap"></td>');
	document.write('  </tr>');
	document.write('</table>');
	document.write('</div>');
	
	if(Speed==0)
		return;
	var speed = Speed;
	var pro = document.getElementById(RndID);
	var pro1 = document.getElementById(RndID+"1");
	var pro2 = document.getElementById(RndID+"2");
	pro2.innerHTML=pro1.innerHTML;
	var MyMar=setInterval(Marquee,speed) 
	pro.onmouseover=function() {clearInterval(MyMar)} 
	pro.onmouseout=function() {MyMar=setInterval(Marquee,speed)} 
	function Marquee()
	{ 
		var mm_mo = pro.offsetWidth - pro1.offsetWidth;
		if(mm_mo<0) mm_mo=0;
		if(pro2.offsetWidth-pro.scrollLeft<=mm_mo) 
			pro.scrollLeft-=pro1.offsetWidth;
			else
				pro.scrollLeft+=5;
	} 
}

function Marquee_Y(RndID,StrGD,Width,Height,Speed)
{
	<!--溢出时隐藏(如果边的范围超过总高度，那总高以外的数据隐藏)，总高height为264px，行高line-height为22px-->
	document.write('<div style="overflow:hidden;width:'+Width+'px;height:'+Height+'px;line-height:22px">');
	<!--调用marqueebox对象，行高22px，字体14px-->
	document.write('<div id="'+RndID+'" style="line-height:22px;font-size:14px">');
	<!--连接地址 窗口打开方式 显示文字-->
	document.write(StrGD)
//	document.write(StrGD+'<br><br><br><br>')//如要隔多行用这个
	document.write('</div></div>');


var lh=22;//滚动高度
var delay=0;//延迟
//function startmarquee(lh,speed,delay) {   //函数 函数名(变量1,变量2,变量3)
var p=false; //定义变量 p为假;
var t; //定义变量t了
var o=document.getElementById(RndID); //定义变量o为document.getElementById("marqueebox")对象
o.innerHTML+=o.innerHTML; //设置变量o的innerHTML对象为自加
o.style.marginTop=0; //o的属性，设置或获取对象的上边距宽度
o.onmouseover=function(){p=true;} //光标在滚动字幕范围内暂停滚动
o.onmouseout=function(){p=false;} //光标在滚动字幕范围外也就是离开的时候继续滚动

function start(){ //“开始”函数
t=setInterval(scrolling,Speed); //给前面定义的变量t赋值=自动（滚动，速度）
if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; //当P为空，属性o的上边距宽度为数字[把变量o上边距宽度转为integer类型，其中parseInt功能为转换]
}

function scrolling(){ //“滚动”函数
	if(parseInt(o.style.marginTop)%lh!=0){ //如果对象o的上边距宽度为空，则为0（parseInt为转换作用）
		o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; //上边距宽度为数字[把变量o上边距宽度转为integer类型，其中parseInt功能为转换]
		if(Math.abs(parseInt(o.style.marginTop))>=o.scrollHeight/2)
		{o.style.marginTop=0;} //如果计算出来的上边距宽度大于或者等于滚动的高度除以2 则o的上边距宽度为0
		}else{ //否则
		clearInterval(t); //指定T为空
		setTimeout(start,delay);//指定暂停时间(开始，延迟)
	}//相当于end if，表示结束如果
}

setTimeout(start,delay); 
}


function doClick(o){
	o.className="nav_current";
	var j;
	var id;
	var e;
	for(var i=1;i<=11;i++){
		id ="nav"+i;
		j = document.getElementById(id);
		e = document.getElementById("sub"+i);
		if(id != o.id){
			j.className="nav_link";
			e.style.display = "none";
		}else{
			e.style.display = "block";
		}
	}
}


function doClick2(o){
	o.className="nav_current2";
	var j;
	var id;
	var e;
	for(var i=1;i<=11;i++){
		id ="nav_2_"+i;
		j = document.getElementById(id);
		e = document.getElementById("sub_2_"+i);
		if(id != o.id){
			j.className="nav_link2";
			e.style.display = "none";
		}else{
			j.className="nav_current2";
			e.style.display = "block";
		}
	}
}

