function doZoom(size)
{
	document.getElementById('content_body').style.fontSize=size+'px';
}

function switchTag(tag,content)
{
	for(i=1; i<12; i++)
	{
		if ("tag"+i==tag)
		{
			document.getElementById(tag).getElementsByTagName("span")[0].className="selectli"
		}else{
			document.getElementById("tag"+i).getElementsByTagName("span")[0].className="noselectli";
		}
		if ("content"+i==content)
		{
			document.getElementById(content).className="ps"+i;
		}else{
			document.getElementById("content"+i).className="hidecontent";
		}
	}
}

//代码框
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_saf = userAgent.indexOf('applewebkit') != -1 || navigator.vendor == 'Apple Computer, Inc.';
var is_webtv = userAgent.indexOf('webtv') != -1;
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera && !is_saf && !is_webtv) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
function runCode(obj) {
        var winname = window.open('', "_blank", '');
        winname.document.open('text/html', 'replace');
	winname.opener = null; // 防止代码对论谈页面修改
        winname.document.write(obj.value);
        winname.document.close();
}
function saveCode(obj) {
        var winname = window.open('', '_blank', 'top=10000');
        winname.document.open('text/html', 'replace');
        winname.document.write(obj.value);
        winname.document.execCommand('saveas','','code.htm');
        winname.close();
}
function copycode(obj) {
	if(is_ie && obj.style.display != 'none') {
		var rng = document.body.createTextRange();
		rng.moveToElementText(obj);
		rng.scrollIntoView();
		rng.select();
		rng.execCommand("Copy");
		rng.collapse(false);
	}
}
//代码框
function menuIn() //菜单隐藏
{
        if(n4) {
                clearTimeout(out_ID)
                if( menu.top > menuH*-1+20+10 ) {  
                        menu.top -= 8
                        in_ID = setTimeout("menuIn()", 1)
                }
                else if( menu.top > menuH*-1+20 ) {
                        menu.top--
                        in_ID = setTimeout("menuIn()", 1)
                }
        }
        else { 
                clearTimeout(out_ID)
                if( menu.pixelTop > menuH*-1+20+10 ) {
                        menu.pixelTop -= 8
                        in_ID = setTimeout("menuIn()", 1) 
                }
                else if( menu.pixelTop > menuH*-1+20 ) {
                        menu.pixelTop--
                        in_ID = setTimeout("menuIn()", 1)
                }
        }
}
function menuOut() //菜单显示
{
        if(n4) {
                clearTimeout(in_ID)
                if( menu.top < -10) { 
                        menu.top += 4
                        out_ID = setTimeout("menuOut()", 1)
                }
                else if( menu.top < 0) { 
                        menu.top++
                        out_ID = setTimeout("menuOut()", 1)
                }
                
        }
        else { 
                clearTimeout(in_ID)
                if( menu.pixelTop < -10) {
                        menu.pixelTop += 2
                        out_ID = setTimeout("menuOut()", 1)
                }
                else if( menu.pixelTop < 0 ) {
                        menu.pixelTop++
                        out_ID = setTimeout("menuOut()", 1)
                }
        }
}
function fireOver() { 
        clearTimeout(F_out)           
        F_over = setTimeout("menuOut()", 10) 
}
function fireOut() { 
        clearTimeout(F_over)
         F_out = setTimeout("menuIn()", 10)
}
function init() {
        if(n4) {
                menu = document.D1
                menuH = menu.document.height
                menu.top = menu.document.height*-1+20 
                menu.onmouseover = menuOut
                menu.onmouseout = menuIn
        menu.visibility = "visible"
        }
        else if(e4) {
                menu = D1.style
                menuH = D1.offsetHeight
                D1.style.pixelTop = D1.offsetHeight*-1+20
                D1.onmouseover = fireOver
                D1.onmouseout = fireOut
                D1.style.visibility = "visible"
        }
}
F_over=F_out=in_ID=out_ID=null
n4 = (document.layers)?1:0
e4 = (document.all)?1:0;

