<!--
// code for redfish bolivia
// copyright 1999 by redfish hypermedia except as stated elsewhere.

var browsername = navigator.appName;
var browsernetscape4 = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var browsermicrosoft4 = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function dw(s) {
	document.writeln(s);
	document.writeln("\n");
}

function renderstyles() {
        gpath = (browsername=="Netscape" ? "../g/" : "../g/");
        bodytag = (browsername=="Netscape" ? "" : "TD {font-size: 90%}");
        h4border = (browsername=="Netscape" ? "" : "width: 100%; border-style:none; border-width:thin; background-color: #666666;");
        dw("<STYLE><!--");
        dw(".backbody { background-color: #dcdcdc; background-image: url(" + gpath + "bkbody.gif) }");
        dw("H4 {font-size: 100%; font-weight: bold; color: black; font-family: Courier, sans-serif;" + h4border + "}");
        dw("H4 {font-size: 100%; font-weight: bold; color: black; font-family: Courier, sans-serif;" + h4border + "}");
        dw(bodytag);
        dw("--></STYLE>");
}
renderstyles();


function formatnum(num, numto) {
	thefill = ""
	numspace = numto.toString().length - num.toString().length;
	for (j = 1; j<= numspace; j++) 
		thefill += "0"
	return thefill + num.toString();
}


function loadselectedpage() {
// load a page defined by the VALUE attribute
// of the first select box in the first form on a page (supply full filename and local target in VALUE)
	selvalue = document.forms[0].elements[0].options[document.forms[0].elements[0].selectedIndex].value;
	if (selvalue !=null && selvalue !="") {
		window.location = selvalue;
	}
}

function wo(winname, winurl, sizex, sizey, resize, menubar, toolbar) {
//open window
    var par = "status=no,scrollbars=yes";
    if (sizex != null) {
    	par += ",width=" + sizex;
    }
    if (sizey != null) {
        par += ",height=" + sizey;
    }
    if (resize != null) {
         par += ",resizable=" + resize;
    }
    if (toolbar != null) {
         par += ",toolbar=" + toolbar;
    }
    if (menubar != null) {
         par += ",menubar=" + menubar;
    }
    if (navigator.winlist == null) {
        navigator.winlist = new Object();
    }
   
    if (!navigator.winlist[winname] || navigator.winlist[winname].closed) {
        if (par == null) {
            navigator.winlist[winname] = open("", winname);
        } else {
            navigator.winlist[winname] = open("", winname, par);
        }
        window[winname] = navigator.winlist[winname];
        if (navigator.winlist[winname].document.URL == "about:blank" || navigator.winlist[winname].document.URL == "") {
            navigator.winlist[winname].location = winurl;
            navigator.winlist[winname].focus();
        }
    }
    window[winname] = navigator.winlist[winname];
  
    navigator.winlist[winname].focus();
}


function nyi() {
// not yet implemented
	alert('Not yet implemented');
}



// ---------------------------------------------------------------------------------------
// --- function printlastmodified(lang, author, email) 
// ---------------------------------------------------------------------------------------

function printlastmodified(lang, author, email)
{
lastmod = document.lastModified     // get string of last modified date
lastmoddate = Date.parse(lastmod)   // convert modified string to date
bytext = ""

if 	(lang == "de") 
	lastmodtext = "Dieses Dokument wurde zuletzt aktualisiert am "
else if (lang == "es") 
	lastmodtext = "Esta página fue actualizado la ultima vez el "
else
	lastmodtext = "This document has been actualized on "

// if (author != "" || email != "")
// 	if 	(lang == "de") 
// 		bytext = " von "
// 	else if (lang == "es") 
// 		bytext = " por "
// 	else 
// 		bytext = " by "

// if (author != "" && email != "")
// 	authorcontact = "<A HREF=mailto:" + email + ">" + author + "</A>"	
// else if (author != "" && email == "")
// 	authorcontact = author
// else if (author == "" && email != "")
// 	authorcontact = "<A HREF=mailto:" + email + ">" + email + "</A>"
// else
 	authorcontact = ""


if(lastmoddate != 0)
	document.writeln(lastmodtext + lastmod + bytext + authorcontact)

}


// ---------------------------------------------------------------------------------------
// --- function splitstring(s,csep) 
// ---------------------------------------------------------------------------------------

function splitstring(s,csep) {
// splits up parts of a string 's' seperated by 'csep' into an array
s+=csep;
var sarray=new Array();
var a=0;

while(s.indexOf(csep)!= -1) {
	sarray[a++]=s.substring(0,s.indexOf(csep));
	s = s.substring(s.indexOf(csep)+csep.length,s.length);
}
return sarray;
}


// ---------------------------------------------------------------------------------------
// --- function getcookieval(cname) | setcookieval(cname,cvalue) | clearcookie(cname)
// ---          getcookies([argumentlist]) | setcookies([argumentlist])
// ---------------------------------------------------------------------------------------

function getcookieval(cname)
{
          var csearch = cname + "="
          if (document.cookie.length > 0) { // if there are any cookies
                    coffset = document.cookie.indexOf(csearch) 
                    if (coffset != -1) { // if cookie exists 
                              coffset += csearch.length 
                              // set index of beginning of value
                              cend = document.cookie.indexOf(";", coffset) 
                              // set index of end of cookie value
                              if (cend == -1) 
                                        cend = document.cookie.length
                              return unescape(document.cookie.substring(coffset, cend))
                    } 
                    else 
                    	return "";
          }
}


function setcookieval(cname, cvalue) { 
          var today = new Date()
          var expire = new Date()
          expire.setTime(today.getTime() + 100*60*60*20*24*31*6) //6 months
          document.cookie = cname + "=" + escape(cvalue)
          + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}



function setcookies() {
// set cname1;cvalue1...cnamen;cvaluen from the argumentlist
// as part of the cookie named as first parameter. update cvalue if names already exist.

var cookiename=setcookies.arguments[0];
var thecookie = getcookieval(cookiename);
var csep='||';

//alert(thecookie);
if (typeof thecookie == 'undefined')	thecookie='';

for (var a=1; a < setcookies.arguments.length; a+=2) {
	var cname=setcookies.arguments[a];
	var re = new RegExp(cname);
	var cvalue=setcookies.arguments[a+1];
	var cookieindex = -1;                                //position im cookiestring
	var thecookiearray = new Array();
	if (thecookie!='')
		thecookiearray = splitstring(thecookie,csep);
	thecalength = thecookiearray.length;

	for (var i=0; i < thecalength; i+=2)              // does cname exist ?
		if (true==re.test(thecookiearray[i])) cookieindex=i;
		//if (thecookiearray[i]==cname) cookieindex=i;

	if (cookieindex==-1) {                                 // append new cname;cvalue
		thecookiearray[thecalength]=cname;
		thecookiearray[thecalength+1]=cvalue;
	} else		                                      // update cvalue
		thecookiearray[cookieindex+1]=cvalue;

	thecookie = '';
	for (var i=0; i < thecookiearray.length; i++)         // build new thecookie string
		thecookie+= (i>0) ? csep+thecookiearray[i] : thecookiearray[i];
}

// alert('setcookie: ' + setcookies.arguments[0] + ' = ' + thecookie);

setcookieval(setcookies.arguments[0],thecookie);

}


function getcookies() {
// returns an array of cvalues corresponding to the cnames cname1...cnamen from the argumentlist
// as part of the cookie named as first parameter. returns 'undefined' if cname doesn't exist.

var csep='||';
var thecookie = getcookieval(getcookies.arguments[0]);
//alert(thecookie);
var thecookiearray = new Array();
thecookiearray = splitstring(thecookie,csep);
var thecalength = thecookiearray.length;
var thecookievals = new Array(); 

for (var a=1; a < getcookies.arguments.length; a++) {
	var cname=getcookies.arguments[a];
	var re = new RegExp(cname);
	var cookieindex = -1;                             // position im cookiestring
	for (var i=0; i < thecalength; i+=2)              // does cname exist ?
		if (true==re.test(thecookiearray[i])) cookieindex=i;
		//if (thecookiearray[i]==cname) cookieindex=i;

	thecookievals[a-1] = (cookieindex==-1) ? 'undefined' : thecookiearray[cookieindex+1];
}
//alert(thecookievals.length);
return thecookievals;
}


function clearcookie(cname) {
// set the cname cookie to an empty string ''
setcookieval(cname,'');
}



// -->