var g_ROOTPATH = "/eng/";

function setRootPath( p_sPath ){
	g_ROOTPATH = p_sPath;
}

function DateIndex()
{
date1=new Date()
y=date1.getYear()
d=date1.getDate()
m=date1.getMonth()
w=date1.getDay()

switch(w)
{
	case 0:(w='SUNDAY');break
	case 1:(w='MONDAY');break
	case 2:(w='TUESDAY');break
	case 3:(w='WENSEDAY');break
	case 4:(w='THURSDAY');break
	case 5:(w='FRIDAY');break
	case 6:(w='SATURDAY');break
}
if(navigator.appName == "Netscape")
{
document.write('<font color="#333333" STYLE="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height: 20px;  ">');
document.write('&nbsp;'+w+'&nbsp;&nbsp;&nbsp;'+d+'/'+(m+1)+'/'+(y+1900)+'');
document.write('</font>');
}
if(navigator.appVersion.indexOf("MSIE") != -1)
{
document.write('<font color="#333333" STYLE="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height: 20px; ">');
document.write('&nbsp;'+w+'&nbsp;&nbsp;&nbsp;'+d+'/'+(m+1)+'/'+y+'');
document.write('</font>');
}
}


function main_writeSearchxin()
{
	document.write("<DIV ALIGN='center'>"+
	 "<form action='http://www.fmprc.gov.cn/wjb/eng_search.jsp' method='post' style='margin-bottom:0'>"+
		"<input type='hidden' name='siteid' value='243'/><input type='hidden' name='sitename' value='zflt_eng'/>"+
		"<input type='text' name='sw' size='12'>"+
        "&nbsp;<input size='12' type='submit' name='Submit' value='Search'></td></tr>"+
	 "</form>"+
"</DIV>");
}

function main_writeFootxin()
{
	document.write("<table width='991' cellpadding='0' cellspacing='0' border='0'>"+    
		           "<tr><td background='"+ g_ROOTPATH +"images/dibubg.jpg' height='33' width='991' align='center'>"+ 
		              "<font style='font-size:12px; color:#333333; '>Ministry of Foreign Affairs, the People's Republic of China  Copyright@2004</font>"+ 
		             "</td></tr>"+ 
		             "<tr><td align='center' valign='middle'>"+ 
		              "<img src='"+ g_ROOTPATH +"images/email.jpg' border='0' width='21' height='19'>"+ 
		             "<a href='mailto:zhongfei_luntan@mfa.gov.cn' style='font-size:12px; color:#333333; '>Contact Us</a>"+ 
		              "&nbsp;&nbsp; <font style='font-size:12px; color:#333333; '>Address: No. 2, Chaoyangmen Nandajie, Chaoyang District, Beijing, 100701 Tel: 86-10-65961114  </font>"+ 
		             "</td></tr></table>");
}

function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){
	if(_nPageCount == null || _nPageCount<=1){
		return;
	}
	document.write("<style> \n");
	document.write(".pg a,.pg a:link,.pg a:visited,.pg a:action,.pg{font-size:14px} \n");
	document.write("a.o:link,a.o:visited,a.o:active,.vc a.o:visited{margin:0 2px;padding:0px 5px;border:1px solid #ddd;text-decoration:none;background:#fff;font-size:14px;font-family:verdana;height:24px;line-height:24px} \n");
	document.write("a.o:hover{border:1px solid #049;text-decoration:none;font-size:14px;font-family:verdana} \n");
	document.write("a.obg:link,a.obg:visited,a.obg:active{background:#e75f2f;color:#fff;font-size:14px;font-family:verdana} \n");
	document.write("</style> \n");

	document.write("<div class='pg'>");
	
	var nCurrIndex = _nCurrIndex || 0;

	if (nCurrIndex > 0) {
		if (nCurrIndex == 1) {
		    document.write("<a href=\""+_sPageName+"."+_sPageExt+"\">上一页</a>&nbsp;");
		} else {
		    document.write("<a href=\""+_sPageName+"_" + (nCurrIndex-1) + "."+_sPageExt+"\">上一页</a>&nbsp;");
		}
	    
	}

	document.write("第");	

	if(nCurrIndex == 0)
		document.write("<a class='o obg' href=\""+_sPageName+"."+_sPageExt+"\">1</a>");
	else
		document.write("<a class='o' href=\""+_sPageName+"."+_sPageExt+"\">1</a>");

	for(var i=1; i<_nPageCount; i++){
		if(nCurrIndex == i)
			document.write("<a class='o obg' href=\""+_sPageName+"_" + i + "."+_sPageExt+"\">"+(i+1)+"</a>");
		else
			document.write("<a class='o' href=\""+_sPageName+"_" + i + "."+_sPageExt+"\">"+(i+1)+"</a>");
	}
	document.write("页");

	if (nCurrIndex < _nPageCount-1) {
		document.write("&nbsp;<a href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">下一页</a>");
	}
	document.write("</div>");
}

function main_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;
	
	css="<style>"
	+"td,.f12{font-size:12px}"
	+".f24 {font-size:24px;}"
	+".f14 {font-size:14px;}"
	+".title14 {font-size:14px;line-height:130%}"
	+".l17 {line-height:170%;}"
	+"</style>";
	
	str +=	css;
	str +=	'<meta http-equiv="content-type" content="text/html; charset=gb2312">';
	str +=	'<title>'+document.title+'</title>';
	str +=	"<body bgcolor=#ffffff topmargin=5 leftmargin=5 marginheight=5 marginwidth=5 onLoad='window.print()'>";
	str +=	"<center>";
	str +=	"<table width=660 border=0 cellpadding=0 cellspacing=20 bgcolor=#EDF0F5><tr><td align=center>";
	
	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
	}
	//str +=strTmp.substr(0,strTmp.indexOf(strFontSize));
	//strTmp=strTmp.substr(strTmp.indexOf(strFontSize)+strFontSize.length, strTmp.length);
	str += strTmp;
	//str +=strTmp.substr(0,strTmp.indexOf(strdoPrint));
	//str +="window.print()";
	//str +=strTmp.substr(strTmp.indexOf(strdoPrint)+strdoPrint.length, strTmp.length);
	str +=	"</td></tr></table>";
	str += "<br><TABLE cellSpacing=0 cellPadding=0 width=660 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>Forum on China-Africa Cooperation</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="“"+document.title+"”"+"\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;
}

function validate_form2() {

	var str0,str1,str2,str3,str4,str;

	validity = true; // assume valid

	if (!check_email(document.Form2003.FriendEmail2.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="“"+document.title+"”"+"\n\nLink Url:";
		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=Your Friend Suggests You To Read It";
	}
	return validity;
}

function check_email( address ) {
	if( (address=="")||(address.indexOf('@')==-1)||(address.indexOf('.')==-1) )
		return false;

	return true;
}

function getElById(_sId){
    return document.getElementById(_sId);
}
 

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);
}
