function $ID(elm) {
	return document.getElementById(elm);
}
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";
document.getElementById("m"+i).className="mText2";
}

//搜索验证
function chkSearch(theForm)
{
	//if (theForm.s_type.value == "") { theForm.s_type.focus(); return (false); }	
	if (theForm.keyword.value == "" || 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);
	}
}

function chkVerifyCode(id)
{
	d = new Date();
	document.getElementById(id).src="/include/vIfyCode.asp?refresh=yes&t="+ d.getTime();
}

function chkLogin(theForm) 
{ 
	if (theForm.txtUsn.value == "") 
	{ 
		alert("系统提示：\n\n请输入用户名！\t");
		theForm.txtUsn.focus(); return (false); 
	}
	if (theForm.txtPwd.value == "") 
	{ 
		alert("系统提示：\n\n请输入密码！\t");
		theForm.txtPwd.focus(); return (false); 
	}
}

function writeSwf(swf_Src,swf_Width,swf_Height,swf_Wmode){
	var writeStr = '';
	writeStr += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+swf_Width+'" height="'+swf_Height+'" id="main">';
	writeStr += '<param name="allowScriptAccess" value="sameDomain" />';
	writeStr += '<param name="movie" value="'+swf_Src+'" />';
	writeStr += '<param name="quality" value="high" />';
	writeStr += '<param name="menu" value="false" />';
	writeStr += '<param name="wmode" value="'+swf_Wmode+'" />';
	writeStr += '<embed src="'+swf_Src+'" wmode="'+swf_Wmode+'" menu="false" quality="high" width="'+swf_Width+'" height="'+swf_Height+'" name="main" align="center" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	writeStr += '</object>';
	document.write(writeStr);
}
