//=====================================================================
// Toolkit Javascript Functions
//=====================================================================

//=====================================================================
// File:         cd-rom.js
// Version:      1.60
// Date:         2007-11-14
// Description:  Javascript Module for CD-ROM on Incentives Measures
// Organization: Secretariat of the Convention on Biological Diversity
//=====================================================================

//=====================================================================
// List of Functions
//=====================================================================
// HTML Output Functions
// ---------------------
// - function CD_WRITE_Records(i_sType, i_sParam1, i_sParam2, i_xmlID, i_xmlUrl)
// - function CD_WRITE_Menu_Left()
// - function CD_WRITE_Menu(i_sType, i_sHref, i_sText)
// - function CD_WRITE_Header()
// - function CD_WRITE_Footer()
// - function CD_WRITE_A(i_sType, i_sUrl, i_sText)
//
// HTML Header Functions
// ---------------------
// - function CD_HEADER_TopLeftBar()
// - function CD_HEADER_TopRightBar()
// - function CD_HEADER_NavBar()
// - function CD_HEADER_OnPrintVersion(bShow)

//=====================================================================
// New Functions
//=====================================================================


//=====================================================================
// HTML Output Functions
//=====================================================================
//------------------------------------
// CD_WRITE_Records
//------------------------------------
function CD_WRITE_Records(i_sType, i_sParam1, i_sParam2, i_xmlID, i_xmlUrl) {
var bRec  = false;
var bLoop = false;
var sLI_end = ""

//IE5
var bIE5 = NAV_IsIE5();
var rs = null;

//NS6
var bNS5 = NAV_IsNS5();
var xRoot    = null;
var xRecord  = null;
var iRecord  = 0;
var nRecords = 0;

var sID        = "";
var sTitle     = "";
var sLevelCode = "";
var sIncCodes  = "";
var sOrg = "";
var sOrg_old = "-";
var sMtgCd = "";
var sCountryCodes = "";
var sCountryCodes_old = "-";
var sCountries = "";
var sCountryCode = "";
var sCountryCode_old = "-";
var sCountry = "";

var sName = "";
var sShortName = "";
var sUrl = "";
var sSubgroupCode = "";
var sGroupCode = "";
var sDesc = "";

var sCode  = "";
var sFrom  = "";
var sTo    = "";
var sDocUrl= "";
var dmyNtf = "";
var dmyAct = "";
var bAct   = false;

	if (bIE5) { 
		rs = ID_Get(i_xmlID).recordset;
		rs.moveFirst();
		bRec = (! rs.EOF);
	} else {
		xRoot = XML_GetRoot(i_xmlUrl);
		nRecords = xRoot.childNodes.length;
		bRec = (iRecord < nRecords);
		if (bRec) { xRecord = xRoot.childNodes[iRecord]; }
	}

	if (bRec) {
		bLoop = true;
		U_WL("<ul>"); 
	}

	while (bLoop) {
		sID = XML_GetValue("ID", bIE5, rs, xRecord);

		switch (i_sType) {
		case 'CS':	// Case-Studies (by countries)
			sTitle        = XML_GetValue("Title",          bIE5, rs, xRecord);
			sLevelCode    = XML_GetValue("LevelCode",      bIE5, rs, xRecord);
			sIncCodes     = XML_GetValue("IncentiveCodes", bIE5, rs, xRecord);

			if ( i_sParam1==sLevelCode && U_Contains(sIncCodes,i_sParam2,' ') ) {
				switch (i_sParam1) {
				case '1-GEN':
					document.writeln("<li><a href='case-study.htm?id="+sID+"'>"+sTitle+"</a></li>");
				break;
				case '2-CS':
					sCountryCodes = XML_GetValue("CountryCodes",   bIE5, rs, xRecord);
					sCountries    = XML_GetValue("Countries", bIE5, rs, xRecord);

					if (sCountryCodes_old != sCountryCodes) { 
						U_WL(sLI_end + "<li><b>"+ (U_IsOK(sCountryCodes) ? sCountries : "Global") +"</b>");
						sLI_end = "</li>"
						sCountryCodes_old = sCountryCodes; 
					}
					U_WL("<table cellpadding='0'cellspacing='0'><tr><td valign='top'>-&nbsp;</td><td>"
					+ "<a href='case-study.htm?id="+sID+"'>"+sTitle+"</a>"
					+ "</td></tr></table>");
				break;
				}
			}


		break;
		case 'CS-NEW':	// Recent Case-Studies (>=SBSTTA-10, >=COP-08)
			sMtgCd        = XML_GetValue("MeetingCode",    bIE5, rs, xRecord);

			if ('SBSTTA-1'==U_Left(sMtgCd,8) || 'COP-08'==sMtgCd) {

				sLevelCode    = XML_GetValue("LevelCode",      bIE5, rs, xRecord);
				sTitle        = XML_GetValue("Title",          bIE5, rs, xRecord);
				sOrg          = XML_GetValue("Organization",   bIE5, rs, xRecord);
				sCountryCode  = XML_GetValue("CountryCode",    bIE5, rs, xRecord);
				sCountry      = XML_GetValue("Country",        bIE5, rs, xRecord);

				switch (i_sParam1) {
				case 'CTR':
					if ( U_IsOK(sCountryCode) ) {
						if (sCountryCode_old != sCountryCode) {
							U_WL(sLI_end + "<li><b>"+ sCountry +"</b>");
							sLI_end = "</li>"
							sCountryCode_old = sCountryCode; 
						}
						U_WL("<table cellpadding='0'cellspacing='0'><tr><td valign='top'>-&nbsp;</td><td>"
						+ "<a href='case-study.htm?id="+sID+"'>"+sTitle+"</a>"
						+ "</td></tr></table>");
					}

				break;
				case 'ORG':
					if ( U_IsOK(sOrg) ) { 
						if (sOrg_old != sOrg) {
							U_WL(sLI_end + "<li><b>"+ sOrg +"</b>");
							sLI_end = "</li>"
							sOrg_old = sOrg; 
						}
						U_WL("<table cellpadding='0'cellspacing='0'><tr><td valign='top'>-&nbsp;</td><td>"
						+ "<a href='case-study.htm?id="+sID+"'>"+sTitle+"</a>"
						+ "</td></tr></table>");
					}

				break;
				}
			}

		break;
		case 'ORG':	// Organizations
			sGroupCode    = XML_GetValue("GroupCode", bIE5, rs, xRecord);
			sSubgroupCode = XML_GetValue("SubgroupCode", bIE5, rs, xRecord);

			if ( U_Contains(sGroupCode,i_sParam1,' ') 
			&&  (U_IsOK(i_sParam2) ? i_sParam2==sSubgroupCode : true) ) {
				sName      = XML_GetValue("Name",       bIE5, rs, xRecord);
				sShortName = XML_GetValue("ShortName",  bIE5, rs, xRecord);
				sDesc      = XML_GetValue("Description",bIE5, rs, xRecord);
				sUrl       = XML_GetValue("Url",        bIE5, rs, xRecord);

				U_WL("<li>");
				CD_WRITE_A('OUT', sUrl, sName + U_IfOK(sShortName, ' ('+sShortName+')' ) );
				U_WL(U_IfOK(sDesc, '<br>'+sDesc+'<br>&nbsp;'));
				U_WL("</li>");
			}
		break;
		case 'NTF':	// Notifications
			sCode  = XML_GetValue("Code",          bIE5, rs, xRecord);
			dmyNtf = DATE_ToDMY(DATE_FromYMD(XML_GetValue("Date", bIE5, rs, xRecord)));
			sTitle = XML_GetValue("Title",         bIE5, rs, xRecord);
			sFrom  = XML_GetValue("From",          bIE5, rs, xRecord);
			sTo    = XML_GetValue("To",            bIE5, rs, xRecord);
			sUrl   = XML_GetValue("PdfUrl",        bIE5, rs, xRecord);
			sDocUrl= XML_GetValue("AttachedDocUrl",bIE5, rs, xRecord);
			bAct   = true && XML_GetValue("ActionRequired",bIE5, rs, xRecord);
			dmyAct = (bAct ? DATE_ToDMY(DATE_FromYMD(XML_GetValue("ActionDate",bIE5, rs, xRecord))) : '' ) ;



			if ( 0<=sTitle.indexOf('/') ) {
				sTitle = U_Replace(sTitle, "href='/programmmes/","href='http://www.cbd.int/programmes/");
				sTitle = U_Replace(sTitle, "/doc/meeting.asp?wg=WSIM-02","doc-wsim-02.htm");
				sTitle = U_Replace(sTitle, "/doc/notifications/","../doc/notifications/");
				sTitle = U_Replace(sTitle, "/decisions/default.aspx?dec=","cbd.htm?dec=");
			}

			U_WL("\n&nbsp;<br><li><b>Notification " + sCode +" </b>&nbsp;&nbsp;");

			if( U_IsOK(sUrl) ) { CD_WRITE_A("DOC",".."+sUrl, "PDF"); }

			if( U_IsOK(sDocUrl) ) { 
				U_WL("\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Attachment:</b>&nbsp;");
				//sDocUrl = U_Replace(sDocUrl, "/doc/","../doc/");
				CD_WRITE_A("DOC",".."+sDocUrl, "DOC"); 
			}

			U_WL("\n<table>"
			+"\n<tr><td valign='top'><b>Date:</b> </td><td>" + dmyNtf +" </td></tr>"
			+ U_IfOK(sFrom, "\n<tr><td valign='top'><b>From:</b> </td><td valign='top'>" + sFrom +" </td></tr>",'')
			+ U_IfOK(sTo,   "\n<tr><td valign='top'><b>To:</b>   </td><td valign='top'>" + sTo   +" </td></tr>",'')
			+ U_IfOK(sTitle,"\n<tr><td valign='top'>&nbsp;</td><td valign='top'>" + sTitle 
			+ (bAct ? "\n<br><span style='COLOR: 660000;'>(Deadline: " + dmyAct +")</span>" : '')
			+ "</td></tr>",'')
		 	+ "\n</table></li>");

		break;
		}

		if (bIE5) {
			rs.moveNext();
			bLoop = (! rs.EOF);
		} else {
			iRecord++;
			bLoop = (iRecord < nRecords);
			if (bLoop) { xRecord = xRoot.childNodes[iRecord]; }
		}
	} // Loop
	U_WL(sLI_end);
	if (bRec) {
		U_WL("</ul>");
	}
return;

}

//---------------------------------------------------------------------
// CD_WRITE_Menu_Left()
//---------------------------------------------------------------------
function CD_WRITE_Menu_Left() {
	CD_WRITE_Menu('LMB','../2008/index.htm','Year 2008');
	CD_WRITE_Menu('LMS','','About');
	CD_WRITE_Menu('LMI','../2008/basis.htm','The Basis');
	CD_WRITE_Menu('LMI','../2008/atstake.htm','What is at stake?');
	CD_WRITE_Menu('LMI','../2008/sustainable-agriculture.htm','Sustainable Agriculture');
	CD_WRITE_Menu('LMI','../2008/agriculture.htm','Agricultural Biodiversity');
	CD_WRITE_Menu('LMI','../2008/water.htm','Water');
	CD_WRITE_Menu('LMS','','Partners and Stakeholders');
	CD_WRITE_Menu('LMI','../2008/cgiar.htm','CGIAR');
	CD_WRITE_Menu('LMI','../2008/fao.htm','FAO');
	CD_WRITE_Menu('LMI','../2008/ngo.htm','NGOs');
	CD_WRITE_Menu('LMI','../2008/scientific.htm','Scientific Organizations');
	CD_WRITE_Menu('LMI','../2008/business.htm','Business');
	CD_WRITE_Menu('LMS','','Resources');
	CD_WRITE_Menu('LMI','../2008/about-images.htm','About the Images');
	CD_WRITE_Menu('LMI','../2008/booklet.htm','Booklet');
	CD_WRITE_Menu('LMI','../2008/poster-logos.htm','Poster &amp; Logos');
	CD_WRITE_Menu('LMI','../2008/teaching.htm','Teaching Resources');
	CD_WRITE_Menu('LMI','../2008/2007.htm','Celebrations in 2007');
	CD_WRITE_Menu('LMI','../2008/factsheets.htm','Fact Sheets');
	CD_WRITE_Menu('LMS','','Related Information');
	CD_WRITE_Menu('LMI','../2008/bibliography.htm','Bibliography');
	CD_WRITE_Menu('LMI','../2008/consumers.htm','Consumers');
	CD_WRITE_Menu('LME','','');
}

//---------------------------------------------------------------------
// CD_WRITE_Menu
//---------------------------------------------------------------------
function CD_WRITE_Menu(i_sType, i_sHref, i_sText) {
var o_sHtml = "";

	switch (i_sType) {
	case 'LMB': // Left Menu Begin
		o_sHtml = "\n <div class='left_nav'><table cellSpacing=0 cellPadding=0 width='100%'>"
			+ "\n <table cellSpacing=0 cellPadding=0 width='100%'>"
			+ "\n <tr><td class='menuL1Top'><a href='"+i_sHref+"'>"+i_sText+"</a></td></tr>";
	break;
	case 'LME': // Left Menu End
		o_sHtml = "\n </table></div>";

	break;
	case 'LML': // Left Menu Line
		o_sHtml = "\n <tr><td><img src='../images/menuline.gif'></td></tr>";

	break;
	case 'LMS': // Left Menu Section 
		o_sHtml = "\n <tr><td class='menuL1'>"+i_sText+"</td></tr>";

	break;
	case 'LMI': // Left Menu Item
		o_sHtml = "\n <tr><td class='menuL2'><a class='menuL2' href= '"+i_sHref+"'>"+i_sText+"</a></td></tr>"

	break;
	}

	document.writeln(o_sHtml);
	return true;
}


//---------------------------------------------------------------------
// CD_WRITE_Header
//---------------------------------------------------------------------
function CD_WRITE_Header() {
var o_sHtml = "";

	o_sHtml = "\n<table cellpadding='0' cellspacing='0' border='0' align='center' height='100%'>"
		+ "\n<tr >"
		+ "\n<td width='100%'>"
		+ "\n  <table width='100%' cellspacing='0' cellpadding='0' border='0' height='100%'>"
		+ "\n  <tr height='1px'>"
		+ "\n  <td>"
		+ "\n    <div style='width:100%;border:1px solid #E0E0E0;margin-bottom:0px;padding-right:2px;padding-left:2px'>"
		+ "\n    <table id='tableTop' cellpadding='0' cellspacing='0' border='0' width='100%'>"
		+ "\n    <tr>"
		+ "\n    <td style='padding-top:0px'>"
		+          CD_HEADER_TopLeftBar()
		+ "\n    </td>"
		+ "\n    <td rowspan='2' width='1px' valign='bottom'><img src='../images/header1.jpg'></td>"
		+ "\n    <td colspan='3' align='right' style='padding-top:2px'>"
		+          CD_HEADER_TopRightBar()
		+ "\n    </td>"
		+ "\n    </tr>"
		+ "\n    <tr>"
		+ "\n    <td width='1px' valign='bottom'><a href='#top' onclick=\"window.open('http://www.cbd.int/')\" "
		+ "\n      title='Convention on Biological Diversity'><img src='../images/header0.jpg' border='0'></a></td>"
		+ "\n    <td width='1px' valign='bottom'><img src='../images/header2.gif'></td>"
		+ "\n    <td width='99%' valign='bottom' "
		+ "\n      style='background-position: 0px -23px; "
		+ "\n      background-position-y: bottom; "
		+ "\n      background-image: url(../images/header3.gif)'><img src='../images/pixel.gif' width='62px' height='1px'></td>"
		+ "\n    <td width='1px' valign='bottom'><a href='#top' onclick=\"window.open('http://www.cbd.int/')\" "
		+ "\n      title='Convention on Biological Diversity'><img src='../images/header4.gif' border='0'></a></td>"
		+ "\n    </tr>"
		+ "\n    </table>"
		+ "\n    </div>"
		+ "\n  </td>"
		+ "\n</tr>"
		+ "\n<tr height='1px'>"
		+ "\n<td>"
		+ "\n  <table cellSpacing='0' cellPadding='0' width='100%' >"
		+ "\n  <tr>"
		+ "\n  <td id='tdLeft' valign='top' width='175'>"
		+ "\n    <div style='padding-left:3px;border-left:1px solid #E0E0E0'>";

	document.writeln(o_sHtml);

	CD_WRITE_Menu_Left();

	o_sHtml = "\n    </div>"
		+ "\n    <p></p>"
		+ "\n  </td>"
		+ "\n  <td valign='top' align='left' width='99%'>"
		+ "\n    <table cellSpacing='0' cellPadding='0' border='0' width='100%'>"
		+ "\n    <tr>"
		+ "\n    <td valign='top' class='PageHeader'>"
		+          CD_HEADER_NavBar()
		+ "\n    </td>"
		+ "\n    </tr>"
		+ "\n    <tr>"
		+ "\n    <td class='Text' valign='top' align='left'>"
		+ "\n      <div style='width:100%;padding:12px;padding-top:15px'>"
		+ "\n      <a name='top'></a>";

	document.writeln(o_sHtml);

	return true;
}




		
	
	
	   	
	
	
	



//---------------------------------------------------------------------
// CD_WRITE_Headers
//---------------------------------------------------------------------
function CD_WRITE_Headers() {
var o_sHtml = "";

	o_sHtml = "\n   	    <div id='Header'><div id='TopLeftHeader'><div class='floatNear'><img src='../styles/css_img/banner-left.jpg'/></div>  "
			+ "\n			<div class='floatNear'><img src='../styles/css_img/banner-logo.gif'/></div></div> "
	        + "\n           <div id='TopRightHeader'><div class='floatFar'><a href='http://www.cec.org' target=_blank><img src='../styles/css_img/banner-cec.gif'/></a></div> "
		    + "\n           <div class='floatFar'><a href='http://www.iucn.org' target=_blank><img src='../styles/css_img/banner-iucn.gif'/></a></div><div class='floatFar'><a href='http://www.cbd.int' target=_blank><img src='../styles/css_img/banner-cbd.gif'/></a></div></div><div id='Banner'>"
            + "\n       	<ul><li><a href='index.htm'>CD Home</a></li><li><a href='videos.htm'>More Tools</a></li><li><a href='links.htm'>Links</a></li><li><a href='reading.htm'>Further Reading</a></li><li><a href='http://www.cbd.int/cepa/' target=_blank>CEPA CBD online</a></li></ul>"
            + "\n       	</div></div>";

	document.writeln(o_sHtml);
	return true;
}

//---------------------------------------------------------------------
// CD_WRITE_Menu_Left1()
//---------------------------------------------------------------------
function CD_WRITE_Menu_Left1() {
	CD_WRITE_Menu('LMB','index.htm','Toolkit CEPA');
	CD_WRITE_Menu('LMI','guide.htm','Users guide');
	CD_WRITE_Menu('LMI','copyright.htm','Copyright & disclaimer');
	CD_WRITE_Menu('LMI','initiators.htm','About the initiators');
	CD_WRITE_Menu('LMI','authors.htm','About the authors');
	CD_WRITE_Menu('LME','','');
}

//---------------------------------------------------------------------
// CD_WRITE_Menu_Left2()
//---------------------------------------------------------------------
function CD_WRITE_Menu_Left2() {
	CD_WRITE_Menu('LMB','videos.htm','More Tools');
	CD_WRITE_Menu('LMI','videos.htm','Videos');
	CD_WRITE_Menu('LMI','brochures.htm','Brochures');
	CD_WRITE_Menu('LMI','presentations.htm', 'Presentations');
	CD_WRITE_Menu('LME','','');
}


//---------------------------------------------------------------------
// CD_WRITE_Menu_Left3()
//---------------------------------------------------------------------
function CD_WRITE_Menu_Left3() {
	CD_WRITE_Menu('LMB','links.htm','Links');
	CD_WRITE_Menu('LMI','links.htm','CEPA Portals');
	CD_WRITE_Menu('LMI','links2.htm','Biodiversity Content Information');
	CD_WRITE_Menu('LMI','links3.htm','Communication manuals and toolkits');
	CD_WRITE_Menu('LMI','links4.htm','Communication manuals for specific themes');
	CD_WRITE_Menu('LMI','links5.htm','Participation manuals');
	CD_WRITE_Menu('LMI','links6.htm','Media');
	CD_WRITE_Menu('LMI','links7.htm','Campaigns');
	CD_WRITE_Menu('LMI','links8.htm','ESD resources');
	CD_WRITE_Menu('LMI','links9.htm','Nature education and interpretation');
	CD_WRITE_Menu('LMI','links10.htm','CEPA Training and train the trainers');
	CD_WRITE_Menu('LMI','links11.htm','Educational videos, slideshows, games');
	CD_WRITE_Menu('LME','','');
}








//---------------------------------------------------------------------
// CD_WRITE_KidsMenu
//---------------------------------------------------------------------
function CD_WRITE_KidsMenu() {
var o_sHtml = "";

	o_sHtml = "\n   	    <div class='left_nav' id='CLeft'><a href='youth-intro.htm'><img src='../../images/icons/ico-intro.png'/></a><br/>"
			+ "\n			<a href='youth-biodiv.htm'><img src='../../images/icons/ico-biodiversity.png'/></a><br/>"
	        + "\n           <a href='youth-food.htm'><img src='../../images/icons/ico-food.png'/></a><br/>"
		    + "\n           <a href='youth-farmers.htm'><img src='../../images/icons/ico-farmer.png'/></a><br/>"
            + "\n       	<a href='youth-farming.htm'><img src='../../images/icons/ico-farming.png'/></a><br/>"
            + "\n       	<a href='youth-action.htm'><img src='../../images/icons/ico-what.png'/></a><br/>"
	        + "\n       	<a href='youth-cbd.htm'><img src='../../images/icons/ico-cbd.png'/></a><br/>"
            + "\n       	<a href='youth-games.htm'><img src='../../images/icons/ico-games.png'/></a><br/></div>";

	document.writeln(o_sHtml);
	return true;
}




//---------------------------------------------------------------------
// CD_WRITE_Footer
//---------------------------------------------------------------------
function CD_WRITE_Footer() {
var o_sHtml = "";

	o_sHtml = "\n 			<DIV id=footer><DIV class=right_footer><A href='http://www.unep.org/'><IMG id=imgUnep height=56 alt='United Nations Environment Programme' src='../images/logo-unep-en.gif' width=75></A> </DIV>"
                + "\n       <DIV class=left_footer><A href='cd-about.htm'>About this CD-ROM</A> | <A href='cd-requirements.htm'>System Requirements</A>"
                + "\n        | <A href='cd-technical.htm'>Technical Information</A></DIV></DIV></DIV></DIV>"
				+ "\n      	<DIV id=footerbottom>"
				+ "\n      	<DIV style='BACKGROUND: url(../images/bottom-center-65.gif) #ccc repeat-x; HEIGHT: 20px'>"
				+ "\n      	<DIV style='FLOAT: left; HEIGHT: 20px'><IMG alt='' src='../images/bottom-left-100.gif'> </DIV>"
				+ "\n      	<DIV style='FLOAT: right; HEIGHT: 20px'><IMG alt='' src='../images/bottom-right-100.gif'> </DIV></DIV></DIV>";

	document.writeln(o_sHtml);
	return true;
}

//---------------------------------------------------------------------
// CD_WRITE_A()
//---------------------------------------------------------------------
function CD_WRITE_A(i_sType, i_sUrl, i_sText) {
var o_sHtml = "";
var sName = i_sUrl.replace(/http:\/\//g, "").replace(/\.\.\//g, "").replace(/\//g, "-").replace(/\?/g, "-").replace(/\./g, "-");

	switch(i_sType) {
		case 'IN': // standard link
			o_sHtml = "<a href= '"+i_sUrl+"'>"+i_sText+"</a>";
		break;
		case 'OUT': // New browser window (with External icon)
			o_sHtml = "<a name= '"+sName+"' href='#"+sName+"' onclick=\"window.open( '"+i_sUrl+"');\">"+i_sText+"</a>&nbsp;"
				+ "<a href='#"+sName+"' onclick=\"window.open( '"+i_sUrl+"');\"><img src='../images/ico-url-ext.gif' border='0'></a>";
		break
		case 'DOC': // New browser window 
			switch(i_sText) {
			case 'PDF': i_sText = "<img src='../images/ico-fmt-pdf.gif' border ='0' width='20' height='20' align='top'>"; break;
			case 'DOC': i_sText = "<img src='../images/ico-fmt-doc.gif' border ='0' width='20' height='20' align='top'>"; break;
			case 'XLS': i_sText = "<img src='../images/ico-fmt-xls.gif' border ='0' width='20' height='20' align='top'>"; break;
			case 'HTM': i_sText = "<img src='../images/ico-fmt-htm.gif' border ='0' width='20' height='20' align='top'>"; break;
			}

			var bDocNS = (NAV_IsNS5() && U_Right(i_sUrl,4).toLowerCase()=='.doc');
			if (bDocNS) {	// Don't open a window for Word documents, because Netscape does it.
				o_sHtml = "<a href= '"+i_sUrl+"'>"+i_sText+"</a>";
			} else {
				o_sHtml = "<a name= '"+sName+"' href='#"+sName+"' onclick=\"window.open( '"+i_sUrl+"');\">"+i_sText+"</a>";
			}

		break;
		case 'POP': // popup window 500x450
			var sOptions = "toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450";
			o_sHtml = "<a name= '"+sName+"' href='#"+sName+" onclick=\"window.open( '"+i_sUrl+"', 'win', '"+sOptions+"');\">"+i_sText+"</a>";
		break;
		case 'TOP':    // standard link in top-level frame
			o_sHtml = "<a href= '"+i_sUrl+"' target='_top'>"+i_sText+"</a>";
		case 'EMAIL': // E-mail address
			if (!U_IsOK(i_sText)) { i_sText = i_sUrl; }
			o_sHtml = "<a href='mailto:" + i_sUrl + "'>" + i_sText + "</a>";
		break;
		default:    // standard link
			o_sHtml = "<a href= '"+i_sUrl+"'>"+i_sText+"</a>";
		break;
	}
	document.write(o_sHtml);
return true;
}

//=====================================================================
// HTML Header Functions
//=====================================================================
//---------------------------------------------------------------------
// CD_HEADER_TopLeftBar
//---------------------------------------------------------------------
function CD_HEADER_TopLeftBar() {
var o_sHtml = "";

	o_sHtml = "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>"
		+ "\n<tr><td nowrap>"
		+ "\n &nbsp;<a class='hlink' title='CD Home' href='eti-intro.htm' style='MARGIN-RIGHT:8px'>CD Home</a>"
		+ "\n &nbsp;"
		+ "\n  <a href='#inc' onclick=\"window.open('http://www.cbd.int/incentives/')\" "
		+ "\n    class='hlite' style='TEXT-DECORATION: underline'>CBD&nbsp;Web&nbsp;Incentives</a>"
		+ "\n</td></tr></table>";

return o_sHtml;
}


//---------------------------------------------------------------------
// CD_HEADER_TopRightBar
//---------------------------------------------------------------------
function CD_HEADER_TopRightBar() {
var o_sHtml = "";

	o_sHtml = "\n<a class='hlite' href='#cbd' onclick=\"window.open('http://www.cbd.int/')\" >CBD Home</a> | "
		+ "\n<a class='hlite' href='#dec' onclick=\"window.open('http://www.cbd.int/decisions/')\" >Decisions</a> | "
		+ "\n<a class='hlite' href='#mtg' onclick=\"window.open('http://www.cbd.int/meetings/')\" >Meetings</a> | "
		+ "\n<a class='hlite' href='#doc' onclick=\"window.open('http://www.cbd.int/countries/')\" >Countries</a> | "
		+ "\n<a class='hlite' href='#chm' onclick=\"window.open('http://www.cbd.int/chm/')\" >CHM</a> | "
		
		+ "\n<a class='hlite' href='#bch' onclick=\"window.open('http://bch.cbd.int')\" >BCH</a> &nbsp;"

return o_sHtml;
}


//---------------------------------------------------------------------
// CD_HEADER_NavBar
//---------------------------------------------------------------------
function CD_HEADER_NavBar() {
var o_sHtml = "";

	o_sHtml = "\n<table>"
		+ "\n<tr>"
		+ "\n<td id='tdHideMenu'>"
		+ "\n  &nbsp;&nbsp;&nbsp;&nbsp;"
		+ "\n  <a href='#' class='navbar-link' onclick='CD_HEADER_OnPrintVersion(false);' " 
		+ "\n    ><img src='../images/ico-print.gif' border='0'>Printer-friendly version</a></td>"
		+ "\n<td id='tdShowMenu' style='display:none'>"
		+ "\n  &nbsp;&nbsp;&nbsp;&nbsp;"
		+ "\n  <a href='#' class='navbar-link' onclick='CD_HEADER_OnPrintVersion(true);' " 
		+ "\n    ><img src='../images/ico-print.gif' border='0'>Normal version</a></td>"
		+ "\n</td>"
		+ "\n</tr>"
		+ "\n</table>";


return o_sHtml;
}

//---------------------------------------------------------------------
// CD_HEADER_OnPrintVersion
//---------------------------------------------------------------------
function CD_HEADER_OnPrintVersion(bShow) {
	document.getElementById("tableTop"  ).style.display = bShow ? "" : "none";
	document.getElementById("tdLeft"    ).style.display = bShow ? "" : "none";
	document.getElementById("tdHideMenu").style.display = bShow ? "" : "none";
	document.getElementById("tdShowMenu").style.display = bShow ? "none" : "";
}


