//??????
var g_DomainName = "http://www.fmprc.gov.cn";   //??
var g_SiteName   = g_DomainName + "/esp";	    //???


//????
function position(){
	document.write("Your Position: ");
}

function header(){
	document.write("<TABLE cellSpacing=0 cellPadding=0 width=770 border=0>");
	document.write("<TBODY>");
	document.write("<TR>");
	document.write("<TD width=381><IMG height=13 src='"+g_SiteName+"/images/top-1.gif'></TD>");
	document.write("<TD width=389><IMG height=13 src='"+g_SiteName+"/images/top-2.gif' useMap=#Map border=0></TD></TR></TBODY></TABLE>");
	document.write("<TABLE cellSpacing=0 cellPadding=0 width=770 border=0>");
	document.write("<TBODY>");
	document.write("<TR>");
	document.write("<TD vAlign=top align=left width=328 height=55><IMG height=60 src='"+g_SiteName+"/images/top-3.gif'></TD>");
	document.write("<TD vAlign=top align=left width=442 height=55>");
	document.write("<OBJECT height=60 width=319><PARAM NAME='_cx' VALUE='8440'><PARAM NAME='_cy' VALUE='1588'><PARAM NAME='FlashVars' VALUE='8440'><PARAM NAME='Movie' VALUE='"+g_SiteName+"/images/top-flash1.swf'><PARAM NAME='Src' VALUE='"+g_SiteName+"/images/top-flash1.swf'><PARAM NAME='WMode' VALUE='Window'><PARAM NAME='Play' VALUE='-1'><PARAM NAME='Loop' VALUE='-1'><PARAM NAME='Quality' VALUE='High'><PARAM NAME='SAlign' VALUE=''><PARAM NAME='Menu' VALUE='-1'><PARAM NAME='Base' VALUE=''><PARAM NAME='AllowScriptAccess' VALUE='always'><PARAM NAME='Scale' VALUE='ShowAll'><PARAM NAME='DeviceFont' VALUE='0'><PARAM NAME='EmbedMovie' VALUE='0'><PARAM NAME='BGColor' VALUE=''><PARAM NAME='SWRemote' VALUE=''>");
	document.write("<embed src='"+g_SiteName+"/images/top-flash1.swf' quality=high type='application/x-shockwave-flash' width='319' height='60'></embed>");
	document.write("</OBJECT></TD></TR></TBODY></TABLE>");

	document.write("<TABLE height=4 cellSpacing=0 cellPadding=0 width=770 border=0>");
	document.write("<TBODY><TR>");
	document.write("<TD vAlign=top align=left height=2><IMG height=4 src='"+g_SiteName+"/images/top-4.gif'></TD>");
	document.write("</TR></TBODY></TABLE>");
	
	document.write("<TABLE height=35 cellSpacing=0 cellPadding=0 width=770 border=0>");
	document.write("<TBODY><TR bgColor=#82000C height=35>");
		document.write("<TD align='middle' width='17%' style='BORDER-RIGHT: #ffffff 1px solid;'><A href='"+g_SiteName+"/wjb/'><FONT color=#ffffff>Ministerio de Relaciones Exteriores</FONT></A></TD>");
		document.write("<TD align='middle' width='13%' style='BORDER-RIGHT: #ffffff 1px solid;'><A href='"+g_SiteName+"/wjdt/'><FONT color=#ffffff>Actualidad<br>Diplomática</FONT></A></TD>");
		document.write("<TD align='middle' width='13%' style='BORDER-RIGHT: #ffffff 1px solid;'><A href='"+g_SiteName+"/xwfw/'><FONT color=#ffffff>Servicios de información</FONT></A></TD>");
		document.write("<TD align='middle' width='15%' style='BORDER-RIGHT: #ffffff 1px solid;'><A href='"+g_SiteName+"/gjhdq/'><FONT color=#ffffff>Países y Regiones</FONT></A></TD>");
		document.write("<TD align='middle' width='14%' style='BORDER-RIGHT: #ffffff 1px solid;'><A href='"+g_SiteName+"/gjwt/'><FONT color=#ffffff>Temas Internacionales</FONT></A></TD>");         
		document.write("<TD align='middle' width='14%' style='BORDER-RIGHT: #ffffff 1px solid;'><A href='"+g_SiteName+"/ljzg/'><FONT color=#ffffff>Conocer a China</FONT></A></TD>");
		document.write("<TD align='middle' width='14%'><A href='"+g_SiteName+"/ziliao/'><FONT color=#ffffff>Documentación</FONT></A></TD>");
	document.write("</TR></TBODY></TABLE>");

	document.write("<map name='Map'>");
	document.write("<area shape='rect' coords='19,1,74,11' href='"+g_DomainName+"/chn/'>");
	document.write("<area shape='rect' coords='86,0,135,11' href='http://big5.fmprc.gov.cn/gate/big5/www1.fmprc.gov.cn/chn/'>");
	document.write("<area shape='rect' coords='148,0,190,11' href='"+g_DomainName+"/eng/'>");
	document.write("<area shape='rect' coords='199,1,240,11' href='"+g_DomainName+"/fra/'>");
	document.write("<area shape='rect' coords='248,0,296,11' href='"+g_DomainName+"/rus/'>");
	document.write("<area shape='rect' coords='304,0,337,11' href='"+g_DomainName+"/ara/'>");
	document.write("</map>");
}

function tailer()
{
	document.write("<br><TABLE cellSpacing='0' cellPadding='0' width='770' border='0'><TBODY>");
	//document.write("<TR><TD height='2'>&nbsp;</TD></TR>");
	document.write("<TR><TD width='100%' height='17' bgColor='#efefef' align='center' NOWRAP>");
	document.write("&copy;Copyright 1998-2005 todos los derechos reservados del Ministerio de Relaciones Exteriores de la República Popular China</TD></TR>");
	document.write("<TR vAlign=center align=middle>");
	document.write("<TD width='100%' height='37'><a href='mailto:webmaster@mfa.gov.cn'><font color='#000000'>Contáctenos en la siguiente dirección:</font></a>  Chaoyangmen Nan Dajie 2, Distrito Chaoyang, Beijing, 100701  Teléfono: 86-10-65961114</TD></TR>");
	document.write("</TBODY></TABLE>");
}



function header_1()
{
	document.write("<TABLE cellSpacing=0 cellPadding=0 width=770 border=0>");
	document.write("<TBODY>");
	document.write("<TR>");
	document.write("<TD width=381><IMG height=13 src='"+g_SiteName+"/images/top-1.gif'></TD>");
	document.write("<TD width=389><IMG height=13 src='"+g_SiteName+"/images/top-2.gif' useMap=#Map border=0></TD></TR></TBODY></TABLE>");
	document.write("<TABLE cellSpacing=0 cellPadding=0 width=770 border=0>");
	document.write("<TBODY>");
	document.write("<TR>");
	document.write("<TD vAlign=top align=left width=328 height=55><IMG height=60 src='"+g_SiteName+"/images/top-3.gif'></TD>");
	document.write("<TD vAlign=top align=left width=442 height=55>");
	document.write("<OBJECT height=60 width=319><PARAM NAME='_cx' VALUE='8440'><PARAM NAME='_cy' VALUE='1588'><PARAM NAME='FlashVars' VALUE='8440'><PARAM NAME='Movie' VALUE='"+g_SiteName+"/images/top-flash1.swf'><PARAM NAME='Src' VALUE='"+g_SiteName+"/images/top-flash1.swf'><PARAM NAME='WMode' VALUE='Window'><PARAM NAME='Play' VALUE='-1'><PARAM NAME='Loop' VALUE='-1'><PARAM NAME='Quality' VALUE='High'><PARAM NAME='SAlign' VALUE=''><PARAM NAME='Menu' VALUE='-1'><PARAM NAME='Base' VALUE=''><PARAM NAME='AllowScriptAccess' VALUE='always'><PARAM NAME='Scale' VALUE='ShowAll'><PARAM NAME='DeviceFont' VALUE='0'><PARAM NAME='EmbedMovie' VALUE='0'><PARAM NAME='BGColor' VALUE=''><PARAM NAME='SWRemote' VALUE=''>");
	document.write("<embed src='"+g_SiteName+"/images/top-flash1.swf' quality=high type='application/x-shockwave-flash' width='319' height='60'></embed>");
	document.write("</OBJECT></TD></TR></TBODY></TABLE>");
	document.write("<TABLE height=4 cellSpacing=0 cellPadding=0 width=770 border=0>");
	document.write("<TBODY><TR>");
	document.write("<TD vAlign=top align=left height=2><IMG height=4 src='"+g_SiteName+"/images/top-4.gif'></TD></TR></TBODY></TABLE>");
	
	document.write("<TABLE height=35 cellSpacing=0 cellPadding=0 width=770 border=0>");
	document.write("<TBODY><TR>");
	document.write("<TD vAlign=top align=left bgColor=#82000C height=35>");
	document.write("<TABLE height=35 cellSpacing=0 cellPadding=0 width=770 border=0><TBODY><TR align=middle>");
	document.write("<TD style='BORDER-RIGHT: #ffffff 1px solid' width='8%' height=35><a href='"+g_SiteName+"/'><FONT color=#ffffff>Portada</a></FONT></TD>");
	document.write("<TD style='BORDER-RIGHT: #ffffff 1px solid;' width='17%' height=35><A href='"+g_SiteName+"/wjb/'><FONT color=#ffffff>Ministerio de Relaciones Exteriores</FONT></A></TD>");
	document.write("<TD style='BORDER-RIGHT: #ffffff 1px solid;' width='11%' height=35><A href='"+g_SiteName+"/wjdt/'><FONT color=#ffffff >Actualidad<br>Diplomática</FONT></A></TD>");
	document.write("<TD style='BORDER-RIGHT: #ffffff 1px solid;' width='12%' height=35><A href='"+g_SiteName+"/xwfw/'><FONT color=#ffffff >Servicios de información</FONT></A></TD>");
	document.write("<TD style='BORDER-RIGHT: #ffffff 1px solid;' width='12%' height=35><A href='"+g_SiteName+"/gjhdq/'><FONT color=#ffffff >Países y Regiones</FONT></A></TD>");
	document.write("<TD style='BORDER-RIGHT: #ffffff 1px solid;' width='12%' height=35><A href='"+g_SiteName+"/gjwt/'><FONT color=#ffffff >Temas Internacionales</FONT></A></TD>");
    document.write("<TD style='BORDER-RIGHT: #ffffff 1px solid;' width='13%' height=35><A href='"+g_SiteName+"/ljzg/'><FONT color=#ffffff>Conocer a China</FONT></A></FONT></TD>");
	document.write("<TD width='13%' height=35 NOWRAP><A href='"+g_SiteName+"/ziliao/'><FONT color=#ffffff >Documentación</FONT></A></TD>");
	document.write("</TR></TBODY></TABLE></TD>");
	document.write("</TR></TBODY></TABLE>");

	document.write("<map name='Map'>");
	document.write("<area shape='rect' coords='19,1,74,11' href='"+g_DomainName+"/chn/'>");
	document.write("<area shape='rect' coords='86,0,135,11' href='http://big5.fmprc.gov.cn/gate/big5/"+g_DomainName+"/chn/'>");
	document.write("<area shape='rect' coords='148,0,190,11' href='"+g_DomainName+"/eng/'>");
	document.write("<area shape='rect' coords='199,1,250,11' href='"+g_DomainName+"/fra/'>");
	document.write("<area shape='rect' coords='258,0,296,11' href='"+g_DomainName+"/rus/'>");
	document.write("<area shape='rect' coords='304,0,337,11' href='"+g_DomainName+"/ara/'>");
	document.write("</map>");
}

//??????
function dateSearch()
{		
	var now = new Date();
	var nowYear = now.getYear();
	var nowMonth = (now.getMonth() + 1);
	var nowDate = now.getDate();

	var nowDate = new Date();

	document.write("<form name=\"frmSearch\" action=\"http://192.168.115.234:8080/se/eng_sse.jsp\" method=\"post\">");
	document.write("<TABLE borderColor='#ffffff' cellSpacing='0' cellPadding='0' width='768' border='1' bFontSize='FALSE' styleType='0'><TR height=10>");
    document.write("      <TD>&nbsp;&nbsp;</TD></TR>");   
    document.write("<TR height=15>");
    document.write("<TD>&nbsp;&nbsp;");

	document.write("<select name=yf>");
    var i;
    for( i=1998;i<=nowYear;i++ ){
		document.write("<option value=\"" + i + "\" " + ((i == nowYear)?"selected":"") + ">" + i + "</option>");
    }
	document.write("</select>");
    document.write("Year");

    document.write("<select name=mf>");
    for( i=1;i<=12;i++ ){
		document.write("<option value=\"" + i + "\" " + ((i == nowMonth)?"selected":"") + ">" + i + "</option>");
    }
	document.write("</select>");
    document.write("Month");

	document.write("<select name=df>");
    for( i=1;i<=31;i++ ){
		document.write("<option value=\"" + i + "\" " + ((i == nowDate)?"selected":"") + ">" + i + "</option>");
    }    
	document.write("</select>Day&nbsp;To&nbsp;");

	document.write("<select name=yt>");
    for( i=1998;i<=nowYear;i++ ){
		document.write("<option value=\"" + i + "\" " + ((i == nowYear)?"selected":"") + ">" + i + "</option>");
    }    
	document.write("</select>");
	document.write("Year");

    document.write("<select name=mt>");
    for( i=1;i<=12;i++ ){
		document.write("<option value=\"" + i + "\" " + ((i == nowMonth)?"selected":"") + ">" + i + "</option>");
    }
    document.write("</select>Month");

	document.write("<select name=dt>");
    for( i=1;i<=31;i++ ){
		document.write("<option value=\"" + i + "\" " + ((i == nowDate)?"selected":"") + ">" + i + "</option>");
    }
	document.write("</select>");

    document.write("Day&nbsp;&nbsp;");
	document.write("<input type='hidden' name='website' value='eng'><input type='hidden' name='select' value='1'><input type='hidden' name='sw' value='%'><input type='hidden' name='urlname' value=''><input type='submit' name='Submit' value='Search'>");
	document.write("</TD></TR>");
	document.write("</TABLE>");
	document.write("</form>");
	var strUrl=window.location.href;
	strUrl=strUrl.substring(7);
	var nPos=strUrl.lastIndexOf("/");
	if( nPos >=0 )
	{
		strUrl=strUrl.substring( 0, nPos);
	}
	frmSearch.urlname.value = strUrl; 
}


//????

function rel_link(_obj) {
	var jmpURL=_obj.options[_obj.selectedIndex].value; 
	if( jmpURL!='' ) {
		window.open( jmpURL );
	}
	else {
		_obj.selectedIndex=0;
	}
}

function RelatedLinks()
{
	document.write("<STYLE TYPE='TEXT/CSS'> FORM {width:157}</STYLE><FORM action='' method=post>");
	document.write("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TBODY>");
	document.write("<TR><TD align='middle' bgColor='#c0c0c0' height='30' align='center'>");
	document.write("<SELECT size=1 style='width:136' name=select onchange='javascript:rel_link( this );'>");
	document.write("<OPTION align=center value='http://wcm.fmprc.gov.cn/eng/' selected>--Links--</OPTION>");
	document.write("<OPTION value='"+g_DomainName+"/eng/xglj/t25286.htm'>Missions Overseas</OPTION>");
	document.write("<OPTION value='"+g_DomainName+"/eng/xglj/t25285.htm'>Central Governments</OPTION>");
	document.write("<OPTION value='"+g_DomainName+"/eng/xglj/t25284.htm'>Local Governments</OPTION>");
	document.write("<OPTION value='"+g_DomainName+"/eng/xglj/t25283.htm'>Local Foreign Affairs Offices</OPTION>");
	document.write("<OPTION value='"+g_DomainName+"/eng/xglj/t25282.htm'>Press</OPTION>");
	document.write("<OPTION value='"+g_DomainName+"/eng/xglj/t25281.htm'>Other Websites</OPTION>");
	document.write("</SELECT>");
	document.write("</TD></TR>");
	document.write("</TBODY></TABLE>");
	document.write("</FORM>");
}


//about site search
function fh_writeSiteSearch(){
	fh_writeSiteSearchEx( 12 );
}

function fh_writeSiteSearchEx( p_nInputSize ){
	var sHtml = "<form name=\"frmSiteSearch\" action=\"http://wcm.fmprc.gov.cn/wcm/extapp/site_search.jsp\" method=\"POST\" style=\"margin-bottom:0\" onsubmit=\"javascript:return hr_onSiteSearch();\"> \n"
			  + "<input type=\"hidden\" name=\"SiteName\" value=\"esp\">\n"
			  + "<input type=\"hidden\" name=\"Encoding\" value=\"ISO-8859-1\">\n"
			  + "<INPUT TYPE=\"text\" NAME=\"Keywords\" style=\"border:solid 1px #000000\" SIZE=\""+p_nInputSize+"\">&nbsp;"
			  + "<INPUT TYPE=\"image\" BORDER=\"0\" SRC=\""+g_SiteName+"/images/y-sousuo.gif\" NAME=\"image\" align=\"absmiddle\"> \n"
			  + "</form> \n";
	document.write( sHtml );
}

function hr_onSiteSearch(){
	var frm = document.frmSiteSearch;

	//check the data valid
	var sValue = frm.Keywords.value;
	sValue = sValue.replace(/(^\s*)|(\s*$)/g, "");
	if( sValue.length==0 ){
		alert( "Introduzca el contenido que busca" );  //??????????
		frm.Keywords.focus();
		return false;
	}

	return true;
	//return false;  //why@2003-08-26 ??????? 
}

//?????????
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 Suggests 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=MFA Web Site News";
	}
	return validity;
}

//?????????2
function validate_form2() {

	var str0,str1,str2,str3,str4,str;

	validity = true; // assume valid

	if (!check_email(document.Form2003.FriendEmail.value)) {
		validity = false;
		alert('Invalid Email Address!');
	}

	if( validity ) {
		str0="MFA Web Site Suggests 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.Context.value=str;

		document.Form2003.action="mailto:"+document.Form2003.FriendEmail.value+"?Subject=MFA Web Site News";
	}
	return validity;
}

//???????EMail??????
function check_email( address ) {
	if( (address=="")||(address.indexOf('@')==-1)||(address.indexOf('.')==-1) )
		return false;

	return true;
}