var bBigSite = window.location.href.indexOf("gate/big5")<0?false:true;
//innerText 在firfox中兼容处理  ---start
function isIE(){ //ie?
   if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1) 
    return true; 
   else 
    return false; 
} 

if(!isIE()){ //firefox innerText define
   HTMLElement.prototype.__defineGetter__(     "innerText", 
    function(){
     var anyString = "";
     var childS = this.childNodes;
     for(var i=0; i<childS.length; i++) {
      if(childS[i].nodeType==1)
       anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText;
      else if(childS[i].nodeType==3)
       anyString += childS[i].nodeValue;
     }
     return anyString;
    } 
   ); 
   HTMLElement.prototype.__defineSetter__(     "innerText", 
    function(sText){ 
     this.textContent=sText; 
    } 
   ); 
}
//innerText 在firfox中兼容处理  ---end
function menuFix() { 
var sfEls = document.getElementById("nav").getElementsByTagName("li"); 
var sfEls1 = document.getElementById("nav1").getElementsByTagName("li"); 
var sfEls2 = document.getElementById("nav2").getElementsByTagName("li"); 
var sfEls3 = document.getElementById("nav3").getElementsByTagName("li"); 
var sfEls4 = document.getElementById("nav4").getElementsByTagName("li"); 

for (var i=0; i<sfEls.length; i++) { 
sfEls[i].onmouseover=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls[i].onMouseDown=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls[i].onMouseUp=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls[i].onmouseout=function() { 
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), 
""); 
} 
} 
for (var i=0; i<sfEls1.length; i++) { 
sfEls1[i].onmouseover=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls1[i].onMouseDown=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls1[i].onMouseUp=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls1[i].onmouseout=function() { 
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), 
""); 
} 
} 
for (var i=0; i<sfEls2.length; i++) { 
sfEls2[i].onmouseover=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls2[i].onMouseDown=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls2[i].onMouseUp=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls2[i].onmouseout=function() { 
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), 
""); 
} 
} 
for (var i=0; i<sfEls3.length; i++) { 
sfEls3[i].onmouseover=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls3[i].onMouseDown=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls3[i].onMouseUp=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls3[i].onmouseout=function() { 
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), 
""); 
} 
} 
for (var i=0; i<sfEls4.length; i++) { 
sfEls4[i].onmouseover=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls4[i].onMouseDown=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls4[i].onMouseUp=function() { 
this.className+=(this.className.length>0? " ": "") + "sfhover"; 
} 
sfEls4[i].onmouseout=function() { 
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), 
""); 
} 
} 
} 


<!-------
//日期显示
function DateIndex()
{
date1=new Date()
y=date1.getYear()
d=date1.getDate()
m=date1.getMonth()
w=date1.getDay()

switch(w)
{
	case 0:(w='日');break
	case 1:(w='一');break
	case 2:(w='二');break
	case 3:(w='三');break
	case 4:(w='四');break
	case 5:(w='五');break
	case 6:(w='六');break
}
document.write('<font color=#000000 class=day>'+''+y+'年'+(m+1)+'月'+d+'日'+'&nbsp;&nbsp;')
document.write('&nbsp;星期'+w)
document.write('</font>')
}

<!-------
//日期显示
function Dat1()
{
date1=new Date()
y=date1.getYear()
d=date1.getDate()
m=date1.getMonth()
w=date1.getDay()

switch(w)
{
	case 0:(w='日');break
	case 1:(w='一');break
	case 2:(w='二');break
	case 3:(w='三');break
	case 4:(w='四');break
	case 5:(w='五');break
	case 6:(w='六');break
}
document.write('<font color=blue size=2px>'+''+y+'年'+(m+1)+'月'+d+'日'+'')
document.write('&nbsp;星期'+w)
document.write('</font>')
}

//提交表单验证
function checkform(form)
{
if(form.user.value==""||form.password.value=="")
{
alert("用户名和密码均必须填写！")
return
}
else
{
form.submit()
}
}

//首页页头导航


//打印函数
function doPrint() {
	var str="<html>";
	var article;
	var css;
	var strAdBegin="<!--NEWSZW_HZH_BEGIN-->";
	var strAdEnd="<!--NEWSZW_HZH_END-->";
	var strFontSize='【<A href="javascript:doZoom(16)">大</A> <A href="javascript:doZoom(14)">中</A> <A href="javascript:doZoom(12)">小</A>】'
	var strdoPrint="doPrint()";
	var strTmp;
	var strContent;
	
	css="\n<style>"
	+"\n td,.f12{font-size:12.0pt;line-height:150%}"
	+"\n .f24 {font-size:24px;}"
	+"\n .f14 {font-size:14px;}"
	+"\n .title14 {font-size:14px;line-height:130%}"
	+"\n .bt {font-size:16pt}"
	+"\n</style>";
	
	str +=	css;
	str +=	'\n<meta http-equiv="content-type" content="text/html; charset=utf-8">';
	str +=	'\n<title>'+document.title+'</title>';
	str +=  '\n<script language="javascript"> function createPageHTML( s1,s2,s3,s4 ){ } </script>';		
	str +=	"\n<body bgcolor=#ffffff topmargin=5 leftmargin=5 marginheight=5 marginwidth=5 onLoad='window.print()'>";
	str +=	"\n<center>";
	str +=	"\n<table width=650 border=0 cellpadding=0 cellspacing=0 bgcolor=#EDF0F5><tr><td style='padding:20px'>";
	
	//wsw@2004-4-27 修改处理div的方式
	//var arDivs = document.getElementsByTagName('DIV');
	//for (var t=0; t<arDivs.length; t++)
	//{
	//	var objDiv = arDivs[t];
	//	if(objDiv.style.width == "600")
	//	{
	//		objDiv.removeAttribute('style');
	//		break;
	//	}
	//}
	
	article=document.getElementById('article').innerHTML;
	if(article.indexOf(strAdBegin)!=-1){
		str +=article.substr(0,article.indexOf(strAdBegin));
		strTmp=article.substr(article.indexOf(strAdEnd)+strAdEnd.length, article.length);
	}else{
		strTmp=article
	}
	//strTmp = strTmp.replace(/<div[^>]*>/ig,"");	//过滤掉</DIV>
	
	//wsw@2004-4-26 正则表达式中字符串提取功能([\s\S]*?)需要IE5.5以上版本才能支持
	strTmp = strTmp.replace(/<div[^>]*>([\s\S]*?)<\/div>/ig,"$1");	//过滤</DIV>
	//wsw@2004-4-26 分开处理替换<div>可以在IE5.0实现预览打印
	//strTmp = strTmp.replace(/<div[^>]*>/ig,"");
	//strTmp = strTmp.replace(/<\/div>/ig,"");

	strTmp = strTmp.replace(/width=760/ig,"width=100%");
	strTmp = strTmp.replace(/width=660/ig,"width=100%");
	str += strTmp;
	
	str +=	"</td></tr></table>";
	str += "<br><TABLE cellSpacing=0 cellPadding=0 width=650 border=0 align=center><TBODY><TR><TD height=10><IMG height='1' alt='' src='./7_c.gif' width='1' border='0'></TD></TR><TR><TD align=middle bgColor=#efefef style=font-size:14px>Embassy of the People's Republic of China in the United Kingdom of Great Britain and Northern Ireland   All Rights Reserved</TD></TR>	</TBODY></TABLE></CENTER></TD></TR></TBODY></TABLE>";
	str += "</center>";
	str +=	"</body></html>";
	document.write(str);
	document.close();
}

//文章推荐使用的函数
function openSendMail( sDocTitle ) {

	var sUrl = "http://app.fmprc.gov.cn/comments/send_mail.jsp?DocTitle="+sDocTitle+"&URL="+window.location.href;

	nWidth  = 430;
	nHeight = 230;

	var winMsg = open( sUrl,"","left=300,top=250,width="+nWidth+",height="+nHeight+",menubar=no,status=no,titlebar=no,resizable=no,scrollbars=no" );
			
	if( winMsg.opener==null ) {
		winMsg.opener = window;
	}
	winMsg.focus();
}


//推荐给朋友的新函数
function validate_form() {

	var str0,str1,str2,str3,str4,str;

	validity = true; // assume valid

	if (!check_email(document.Form2000.FriendEmail.value)) {
		validity = false;
		alert('Invalid Email Address!');
	}

	if( validity ) {
		str0="MFA Web Site Suggest This News";
		str1="Hello!";
		str2="Your Friend Suggests You To Read This New:";
		str3="\u201C"+document.title+"\u201D"+"\n\nLink Url:";
		str4=this.location;
		str=str0+"\n"+str1+"\n"+str2+"\n"+str3+"\n"+str4+"\n";
		document.Form2000.Context.value=str;

		document.Form2000.action="mailto:"+document.Form2000.FriendEmail.value+"?Subject=Your Friend Suggests You To Read It";
	}
	return validity;
}


//推荐给朋友的新函数2
function validate_form2() {

	var str0,str1,str2,str3,str4,str;

	validity = true; // assume valid

	if (!check_email(document.Form2003.FriendEmail2.value)) {
		validity = false;
		alert('您输入的Email无效或者为空！');
	}

	if( validity ) {
		str0="外交部网站推荐新闻";
		str1="您好!";
		str2="您的朋友向您推荐外交部网站新闻:";
		str3="“"+document.title+"”"+"\n\n链接网址：";
		str4=this.location;
		str=str0+"\n"+str1+"\n"+str2+"\n"+str3+"\n"+str4+"\n";
		document.Form2003.Context2.value=str;

		document.Form2003.action="mailto:"+document.Form2003.FriendEmail2.value+"?Subject=推荐新闻";
	}
	return validity;
}

//判断用户填写的EMail是否有效函数
function check_email( address ) {
	if( (address=="")||(address.indexOf('@')==-1)||(address.indexOf('.')==-1) )
		return false;

	return true;
}

//打印函数(不带图片)
function doPrint_noImgs() {
	var str="<html>";
	var article;
	var css;
	var strAdBegin="<!--NEWSZW_HZH_BEGIN-->";
	var strAdEnd="<!--NEWSZW_HZH_END-->";
	var strFontSize='【<A href="javascript:doZoom(16)">大</A> <A href="javascript:doZoom(14)">中</A> <A href="javascript:doZoom(12)">小</A>】'
	var strdoPrint="doPrint()";
	var strTmp;
	var strContent;
	
	css="\n<style>"
	+"\n td,.f12{font-size:12.0pt;line-height:150%}"
	+"\n .f24 {font-size:24px;}"
	+"\n .f14 {font-size:14px;}"
	+"\n .title14 {font-size:14px;line-height:130%}"
	+"\n .bt {font-size:16pt}"
	+"\n</style>";
	
	str +=	css;
	str +=	'\n<meta http-equiv="content-type" content="text/html; charset=utf-8">';
	str +=	'\n<title>'+document.title+'</title>';
	str +=  '\n<script language="javascript"> function createPageHTML( s1,s2,s3,s4 ){ } </script>';	
	str +=	"\n<body bgcolor=#ffffff topmargin=5 leftmargin=5 marginheight=5 marginwidth=5 onLoad='window.print()'>";
	str +=	"\n<center>";
	str +=	"\n<table width=650 border=0 cellpadding=0 cellspacing=0 bgcolor=#EDF0F5><tr><td style='padding:20px'>";
	
	//wsw@2004-4-27 修改处理div的方式
	//var arDivs = document.getElementsByTagName('DIV');
	//for (var t=0; t<arDivs.length; t++)
	//{
	//	var objDiv = arDivs[t];
	//	if(objDiv.style.width == "600")
	//	{
	//		objDiv.removeAttribute('style');
	//		break;
	//	}
	//}
	
	article=document.getElementById('article').innerHTML;
	if(article.indexOf(strAdBegin)!=-1){
		str +=article.substr(0,article.indexOf(strAdBegin));
		strTmp=article.substr(article.indexOf(strAdEnd)+strAdEnd.length, article.length);
	}else{
		strTmp=article
	}

	//strTmp = strTmp.replace(/<div[^>]*>/ig,"");	//过滤掉</DIV>
	
	//wsw@2004-4-26 正则表达式中字符串提取功能([\s\S]*?)需要IE5.5以上版本才能支持
	strTmp = strTmp.replace(/<div[^>]*>([\s\S]*?)<\/div>/ig,"$1");	//过滤</DIV>
	//wsw@2004-4-26 分开处理替换<div>可以在IE5.0实现预览打印
	//strTmp = strTmp.replace(/<div[^>]*>/ig,"");
	//strTmp = strTmp.replace(/<\/div>/ig,"");
	strTmp = strTmp.replace(/width=760/ig,"width=100%");
	strTmp = strTmp.replace(/width=660/ig,"width=100%");

	str += strTmp;
	
	str +=	"</td></tr></table>";
	str += "<br><TABLE cellSpacing=0 cellPadding=0 width=650 border=0 align=center><TBODY><TR><TD height=10><IMG height='1' alt='' src='./7_c.gif' width='1' border='0'></TD></TR><TR><TD align=middle bgColor=#efefef style=font-size:14px>中华人民共和国外交部 2003 版权所有 &reg;</TD></TR>	<TR><TD height=10><IMG height='1' alt='' src='./7_c.gif' width='1' border='0'></TD></TR><TR><TD align=middle style=font-size:14px>地址：北京市朝阳区朝阳门南大街 2 号&nbsp;&nbsp; 邮编：100701&nbsp;&nbsp;电话：86-10-65961114&nbsp;&nbsp;京ICP备06038296号</TD></TR></TBODY></TABLE></CENTER></TD></TR></TBODY></TABLE>";
	str += "</center>";
	str +=	"</body></html>";
	document.write(str);
	document.close();
	
	var imgs= document.getElementsByTagName("IMG");
	if(imgs.length){
		for(var i=0;i<imgs.length;i++){
			imgs[i].style.display="none";
		}
	} else {
		imgs.style.display="none";
	}
	
}

 function getElById(_sId){
             return document.getElementById(_sId);
            }
 

            //根据id获得指定元素的内部文本
            function getInnerTextById(_sElId){
             var oEl = getElById(_sElId);
             return oEl.childNodes[0].nodeValue;
            }
 
            //去除字符串左边的所有空格
            function LTrim( p_string ){
             var nLen = p_string.length;
             var nStartPose = 0;
             for(var i=0; i<nLen; i++){
              var sChar = p_string.charAt(i);
              if(sChar == ' ' || sChar == '　'){
               continue;
              }
 
              nStartPose = i;
              break;
             }
 
             return p_string.substring(nStartPose);
            }

