function open_window(url,windowname,wWidth,wHeight) 
{ 
	window.open(url,windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,left="+((screen.width-wWidth)/2)+",top="+((screen.height-wHeight)/2)+",width="+wWidth+",height="+wHeight ); 
}
function OpenWindowAndSetValue(Url,Width,Height,WindowObj,SetObj)
{
	var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'pt;dialogHeight:'+Height+'pt;status:no;help:no;scroll:no;');
	if (ReturnStr!='') SetObj.value=ReturnStr;
	return ReturnStr;
}
function OpenWindow(Url,Width,Height,WindowObj)
{
	showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'pt;dialogHeight:'+Height+'pt;status:no;help:no;scroll:no;');
}

//字体设置
function doZoom(size){
	var artibody = document.getElementById('artibody');
	if(!artibody){
		return;
	}
	var artibodyChild = artibody.childNodes;
	artibody.style.fontSize = size + 'px';
	//再对artibody div内的直接html节点设置fontSize属性
	for(var i = 0; i < artibodyChild.length; i++){
		if(artibodyChild[i].nodeType == 1){
			artibodyChild[i].style.fontSize = size + 'px';
			artibodyChild[i].style.lineHeight = size+10 + 'px';
		}
	}		
}

//菜单控制
function ShowMenu(i)
{
	document.getElementById("m"+i).className="mText2";
}
function ShowMenuOut(i)
{
	document.getElementById("m"+i).className="mText";
}

//搜索验证
function chkSearch(theForm)
{
	if (theForm.s_type.value == "") { theForm.s_type.focus(); return (false); }	
	if (theForm.keyword.value == "") { theForm.keyword.focus(); return (false); } 
}

function addFavorite(pageTitle,pageUrl){
        if ( window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) )
        {
                //  firefox
                window.sidebar.addPanel( pageTitle, pageUrl, '' );
        }
        else if ( document.all && "object" == typeof( window.external ) )
        {
                //  ie
                window.external.addFavorite( pageUrl, pageTitle );
        }
}

function setHomePage(pageUrl)
{
	if ( document.all && "object" == typeof( window.external ) )
        {
                //  ie
                document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(pageUrl);
        }
        else if (window.sidebar){
		//  firefox
		if(window.netscape){
			try{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}catch (e){
				alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );
			}
		}
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage',pageUrl);
	}
}
