var startTime,endTime;
var d=new Date();
startTime=d.getTime();

//运行代码
function runEx(cod1)  {
	 cod=document.getElementById(cod1)
	  var code=cod.value;
	  if (code!=""){
		  var newwin=window.open('','','');  
		  newwin.opener = null 
		  newwin.document.write(code);  
		  newwin.document.close();
	}
}
//复制代码
function doCopy(ID) { 
	if (document.all){
		 textRange = document.getElementById(ID).createTextRange(); 
		 textRange.execCommand("Copy"); 
	}
	else{
		 alert("此功能只能在IE上有效")
	}
}
function showElement(sid) {
	var whichEl = document.getElementById(sid);
	if (whichEl!=null) {
		if (whichEl.style.display == "none"){
			whichEl.style.display='';
		}else{
			whichEl.style.display='none';
		}
	}
}
function getElementsByClassName(strClassName, strTagName, oElm){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}
//文章内容字体控制
var initial_fontsize    = 10;
var initial_lineheight  = 18;
function newasp_fontsize(type,objname){
	var whichEl = document.getElementById(objname);
	if (whichEl!=null) {
		if (type==1){
			if(initial_fontsize<64){
				whichEl.style.fontSize=(++initial_fontsize)+'pt';
				whichEl.style.lineHeight=(++initial_lineheight)+'pt';
			}
		}else {
			if(initial_fontsize>8){
				whichEl.style.fontSize=(--initial_fontsize)+'pt';
				whichEl.style.lineHeight=(--initial_lineheight)+'pt';
			}
		}
	}
}

function urlencode(str) {
	var ns = (navigator.appName=="Netscape") ? 1 : 0;
	if (ns) { return escape(str); }
	var ms = "%25#23 20+2B?3F<3C>3E{7B}7D[5B]5D|7C^5E~7E`60";
	var msi = 0;
	var i,c,rs,ts ;
	while (msi < ms.length) {
		c = ms.charAt(msi);
		rs = ms.substring(++msi, msi +2);
		msi += 2;
		i = 0;
		while (true)	{ 
			i = str.indexOf(c, i);
			if (i == -1) break;
			ts = str.substring(0, i);
			str = ts + "%" + rs + str.substring(++i, str.length);
		}
	}
	return str;
}




//导航菜单切换开始

function isMatch(str1,str2) 
{  
var index = str1.indexOf(str2); 
if(index==-1) return false; 
return true; 
} 
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';}, 1000);
        }
        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 doClick_menu(o) {
  try
  {
	o.className = 'menu_gg';
	var j, id, e;
	for (var i = 1; i <= 5; i++) {
	    id = 'menu' + i;
	    j = document.getElementById(id);
	    e = document.getElementById('menu_con' + i);
	    if (id != o.id) {
	   	   j.className = '';
	   	   e.style.display = 'none';
	    }
        else {
		    e.style.display = 'block';
	    }
	 }
     var url = 'http://www.google.cn/search?hl=zh-CN&q=site%3Apeixunzhaosheng.net+';
     switch (o.innerHTML) {
        case '资讯':
            url = 'http://www.google.cn/search?hl=zh-CN&q=site%3Apeixunzhaosheng.net+';
            break;
        case '资料':
            url = 'http://www.google.cn/search?hl=zh-CN&q=site%3Apeixunzhaosheng.net+';
            break;
        case '培训班':
            url = 'http://www.google.cn/search?hl=zh-CN&q=site%3Apeixunzhaosheng.net+';
            break;
    }
     doClick_submit.url = url;
  }
  catch(e) {}
}

doClick_submit.url = 'http://www.google.cn/search?hl=zh-CN&q=site%3Apeixunzhaosheng.net+';

function doClick_submit () {
    var keyword = document.getElementsByName('keyword')[0].value;
    window.open(doClick_submit.url + keyword);
}
window.onload = function (){
	var keyword = document.getElementsByName('keyword')[0];
	keyword.onkeydown = function (e) {
		e = e || window.event;
		if (e.keyCode == 13) {
			doClick_submit();
		}
	};
}

//导航菜单切换结束

