﻿function isMatch(str1,str2) 
{  
var index = str1.indexOf(str2); 
if(index==-1) return false; 
return true; 
} 
//if (isMatch(window.location.hostname,'google.com') == false){window.location.href="http://www.google.com";}

function ResumeError() { 
return true; 
} 
window.onerror = ResumeError; 

function $(id) {
    return document.getElementById(id);
}
// 相对尺寸
function GetOffsetTop (el, p) {
    var _t = el.offsetTop;
    var _p = el.offsetParent;

    while (_p) {
        if (_p == p) break;
        _t += _p.offsetTop;
        _p = _p.offsetParent;
    }

    return _t;
};
function GetOffsetLeft (el, p) {
    var _l = el.offsetLeft;
    var _p = el.offsetParent;

    while (_p) {
        if (_p == p) break;
        _l += _p.offsetLeft;
        _p = _p.offsetParent;
    }

    return _l;
};
function showMenu (baseID, divID) {
    baseID = $(baseID);
    divID  = $(divID);

    //var l = GetOffsetLeft(baseID);
    //var t = GetOffsetTop(baseID);

    //divID.style.left = l + 'px';
	//divID.style.top = t + baseID.offsetHeight + 'px';
    if (showMenu.timer) clearTimeout(showMenu.timer);
	hideCur();
    divID.style.display = 'block';
	showMenu.cur = divID;

    if (! divID.isCreate) {
        divID.isCreate = true;
        //divID.timer = 0;
        divID.onmouseover = function () {
            if (showMenu.timer) clearTimeout(showMenu.timer);
			hideCur();
            divID.style.display = 'block';
        };

        function hide () {
            showMenu.timer = setTimeout(function () {divID.style.display = 'none';}, 300);
        }

        divID.onmouseout = hide;
        baseID.onmouseout = hide;
    }
	function hideCur () {
		showMenu.cur && (showMenu.cur.style.display = 'none');
	}
}

function doClick_down(o){
	 o.className="current";
	 var j;
	 var id;
	 var e;
	 for(var i=1;i<=4;i++){
	   id ="down"+i;
	   j = document.getElementById(id);
	   e = document.getElementById("d_con"+i);
	   if(id != o.id){
	   	 j.className="";
	   	 e.style.display = "none";
	   }else{
		e.style.display = "block";
	   }
	 }
	 }
	 
function doClick_jy(o){
	 o.className="current";
	 var j;
	 var id;
	 var e;
	 for(var i=1;i<=8;i++){
	   id ="jy"+i;
	   j = document.getElementById(id);
	   e = document.getElementById("jy_con"+i);
	   if(id != o.id){
	   	 j.className="";
	   	 e.style.display = "none";
	   }else{
		e.style.display = "block";
	   }
	 }
	 }


function doZoom(size){
	document.getElementById('textbody').style.fontSize=size+'px'
}
function UrlRegEx(url)   
{      
    //如果加上/g参数，那么只返回$0匹配。也就是说arr.length = 0 
	url=url.replace(/\"/g,' ');
	//alert(url);
    var re =/href *= *['"]*(\S+)["']* */gm ;   
    re.exec(url);   
	//window.parent.location=RegExp.$1
	return( RegExp.$1);
    //var arr = url.match(re);   
    //return arr;   
       
}
function changeLinkText(Link,text)
{
	document.write ( '<a href=' + UrlRegEx(Link) + '>' + text + '</a>');
	
}
function changeUrl(id,Url)
{
	$(id).href=UrlRegEx(Url);
}

function addtitle(id)
	{
		var obj=$(id);
		var objSummary=obj.getElementsByTagName("A")[1];
		var objTitle=$(id+"_title");
		//alert(obj.innerHTML);
		var strTitle=objTitle.innerHTML;
		//strTitle.replaceAll("\r","").replaceAll("\n","");
		objSummary.outerHTML = "<div style='margin-left:10px'>"+strTitle+objSummary.outerHTML+"</div>";
		obj.style.display="";
		objTitle.parentNode.removeChild(objTitle);
	}

