//***********默认设置定义.*********************
tPopWait=50;//停留tWait毫秒后显示提示。
tPopShow=5000;//显示tShow毫秒后关闭提示
showPopStep=20;
popOpacity=99;
var bdy = (document.documentElement && document.documentElement.clientWidth)?document.documentElement:document.body;
//双击滚屏函数*******全局变量的定义
     var currentpos,timer;   
     function initialize()
     {
     timer=setInterval("scrollwindow()",10);
     }
     function sc(){
     clearInterval(timer);
     }
     function scrollwindow()
     {
     currentpos=bdy.scrollTop;
     window.scroll(0,++currentpos);
     if (currentpos != bdy.scrollTop)
     sc();
     }
     //document.onmousedown=sc
     //document.ondblclick=initialize

//双击滚屏函数结束
//***************内部变量定义*****************
sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;

document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText {  background-color: #ffffff;color: #000000; border: 1px #555555 solid; font-size: 12px;line-height:normal; padding:2px 4px 2px 4px; filter: Alpha(Opacity=0)}");

document.write("</style>");
document.write("<div id='ncpopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");


function showPopupText(){
var o=event.srcElement;
	MouseX=event.clientX;
	MouseY=event.clientY;
	if(o.alt!=null && o.alt!=""){o.ncpop=o.alt;o.alt=""};
    if(o.title!=null && o.title!=""){o.ncpop=o.title;o.title=""};
	if(o.ncpop!=sPop) {
			sPop=o.ncpop;
			clearTimeout(curShow);
			clearTimeout(tFadeOut);
			clearTimeout(tFadeIn);
			clearTimeout(tFadeWaiting);	
			if(sPop==null || sPop=="") {
				ncpopLayer.innerHTML="";
				ncpopLayer.style.filter="Alpha()";
				ncpopLayer.filters.Alpha.opacity=0;
				}
			else {
				if(o.dyclass!=null) popStyle=o.dyclass 
					else popStyle="cPopText";
				curShow=setTimeout("showIt()",tPopWait);
			}
			
	}
}

function showIt(){
		ncpopLayer.className=popStyle;
		ncpopLayer.innerHTML=sPop;
		popWidth=ncpopLayer.clientWidth;
		popHeight=ncpopLayer.clientHeight;
		if(MouseX+12+popWidth>bdy.clientWidth) popLeftAdjust=-popWidth-24
			else popLeftAdjust=0;
		if(MouseY+12+popHeight>bdy.clientHeight) popTopAdjust=-popHeight-24
			else popTopAdjust=0;
		ncpopLayer.style.left=MouseX+12+bdy.scrollLeft+popLeftAdjust;
		ncpopLayer.style.top=MouseY+12+bdy.scrollTop+popTopAdjust;
		ncpopLayer.style.filter="Alpha(Opacity=0)";
		fadeOut();
}

function fadeOut(){
	if(ncpopLayer.filters.Alpha.opacity<popOpacity) {
		ncpopLayer.filters.Alpha.opacity+=showPopStep;
		tFadeOut=setTimeout("fadeOut()",1);
		}
		else {
			ncpopLayer.filters.Alpha.opacity=popOpacity;
			tFadeWaiting=setTimeout("fadeIn()",tPopShow);
			}
}

function fadeIn(){
	if(ncpopLayer.filters.Alpha.opacity>0) {
		ncpopLayer.filters.Alpha.opacity-=1;
		tFadeIn=setTimeout("fadeIn()",1);
		}
}
document.onmouseover=showPopupText;




function noEffect() {
  with (event) {
    returnValue = false;
    cancelBubble = true;
  }
  return;
}




//---------------自建函数



//不显示脚本错误信息
window.onerror = function(){return true;}

String.prototype.Trim = function()
{
        return this.replace(/(^\s*)|(\s*$)/g, "");
}

function $(id, object){
	object = object || document;
	return document.getElementById ? object.getElementById(id) : document.all(id);
}

function mmm(o){
    if (o.className == "curr") return false;
    var tagCollect = o.parentNode.getElementsByTagName(o.tagName);
    for(i=0 ;i<tagCollect.length;i++)
	    tagCollect[i].className = "";
    o.className = "curr";
    return true;
}

//更改字号大小 FontSize
function font(v){
	var dv=$("div_c");
	if(parseInt(v)==1){
		var i=parseInt(dv.style.fontSize)-2;
		if(i<12){
		dv.style.fontSize="12px";
	}else{
		dv.style.fontSize=i+"px";
		}
	}
	if(parseInt(v)==2){
		dv.style.fontSize="14px";
	}
	if(parseInt(v)==3){
		var j=parseInt(dv.style.fontSize)+2;
		if(j>20){
			dv.style.fontSize="20px";
		}else{
			dv.style.fontSize=j+"px";
		}
	}   
}


function setCookie(name, value, expires, path){
    var cookie = name+"="+escape(value);
    if (expires) cookie += ";expires=" + expires.toGMTString();
    if (path) cookie += ";path=" + path;
    document.cookie = cookie;
}


function getCookie(name){
  var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
  if(arr=document.cookie.match(reg))
    return unescape(arr[2]);
  return null;
}
