﻿window.onerror = function(){return true;}
String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, "");}

function showLocale(objD)
{
	var str,colorhead,colorfoot;
	var yy = objD.getYear();
	if(yy<1900) yy = yy+1900;
	var MM = objD.getMonth()+1;
	if(MM<10) MM = '0' + MM;
	var dd = objD.getDate();
	if(dd<10) dd = '0' + dd;
	var hh = objD.getHours();
	if(hh<10) hh = '0' + hh;
	var mm = objD.getMinutes();
	if(mm<10) mm = '0' + mm;
	var ss = objD.getSeconds();
	if(ss<10) ss = '0' + ss;
	var ww = objD.getDay();
	if  ( ww==0 )  colorhead="<font color=\"#333333\">";
	if  ( ww > 0 && ww < 6 )  colorhead="<font color=\"#333333\">";
	if  ( ww==6 )  colorhead="<font color=\"#333333\">";
	if  (ww==0)  ww="星期日";
	if  (ww==1)  ww="星期一";
	if  (ww==2)  ww="星期二";
	if  (ww==3)  ww="星期三";
	if  (ww==4)  ww="星期四";
	if  (ww==5)  ww="星期五";
	if  (ww==6)  ww="星期六";
	colorfoot="</font>"
	str = colorhead + "您好！今天是：" + yy + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss + "  " + ww + colorfoot;
	return(str);
}
function tick()
{
	var today;
	today = new Date();
	document.getElementById("localtime").innerHTML = showLocale(today);
	window.setTimeout("tick()", 1000);
}

function ContentSize(size)
{
	var obj=document.getElementById("content");
	obj.style.fontSize=size>0 ? size+"px" : "";
}

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 Ok3w_Search(frm)
{
	if(frm.q.value.trim()=="")
	{
		alert("请输入查询关键词。");
		frm.q.focus()
		return false;
	}
	frm.action = "search.asp";
	frm.bntSub.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 Ok3w_Marquee(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 Get_ValidCode(dns)
{
	var obj = document.getElementById("strValidCode");
	obj.src = dns+"inc/validcode.asp?rnd="+Math.random();
}
