// JavaScript Document

<!-- hiding from older non-JavaScript aware browsers

	// this function clears the value set for the form element passed to it
	// so long as the value is the default text passed in the variable txt.
	function clearme(fe,txt){
		// check to see that the form element is the default text
		if (fe.value == txt){
			// clear the default text
			fe.value = "";
		}
		return;
	}

	function writeme(fe){
		// check to see that the form element is the default text
		if (fe.value == ""){
			// clear the default text
			fe.value = "Search";
		}
		return;
	}

	function writeme2(fe){
		// check to see that the form element is the default text
		if (fe.value == ""){
			// clear the default text
			fe.value = "Search";
		}
		return;
	}
	// this function sets default text back to the input field if it is 
	// blank after the users focus leaves the field.
	function resetme(fe,txt){
		// check if the form element is empty
		if (fe.value == ""){
			// set the default text
			fe.value = txt;
		}
		return;
	}

	// this function returns a true/false result based on the presence of copy
	// in the form element passed. this is used by two functions checkvalue() 
	// and verify()
	function isblank(fe){
		// check that the value is not empty
		if (fe.value == "") {
			// its blank
			return true;
		} else {
			// it has data
			return false;
		}
	}

	// this takes a form element and checks to see if there is a value assigned 
	// to it. If it comes back as a blank field, the form element will display 
	// the errormessage variable to the user
	function checkvalue(fe, msg) {
		// call the isblank() function with this form element
		if (isblank(fe)){
			// display the error to the user
			alert(msg);
			// set focus on the element we just checked
			fe.focus();
		}
		return;
	}

	// this function is for validating an entire form for blank entries. The
	// error message that is displayed must be short enough to fit in users 
	// windows and get across the idea that there are problems. The benefit
	// of this function is its ease of use, because you simply pass it the 
	// form, a list of required fields and an error message to display. The 
	// function handles all of the logic of submitting the form.
	function verify(frm, fields, msg){
		// get fields marked required
		fieldarray = fields.split(",");
		// loop through all the elements on the form
		for (i=0; i<frm.elements.length; i++){
			// loop through each of the required fieldnames
			for (j=0; j<fieldarray.length; j++){
				// if a field is required (and we're processing that field) and its blank
				if (  fieldarray[j] == frm.elements[i].name &&
				      isblank(frm.elements[i])
					) {
					// display an error
					alert(msg);
					// set the cursor to he field that threw the error
					frm.elements[i].focus();
					// block the form from submitting
					return false;
				} 
			}
		}
		// exit clean and allow form to submit
		return true;
	}
// stop hiding from older non-JavaScript aware browsers -->

function fxprintIt(sprint, sclose){

var theContent = document.getElementById('MainContent').innerHTML;
var printContentHeader = "<HTML><HEAD><TITLE>"+document.title+"</TITLE><STYLE>body{font-family:Arial;}#MainContent{font-size: 12px; padding: 5px; margin-top: 15px;}li{font-size:12px;}table{font-size:12px;}p{font-size:12px;}div{font-size:12px;}.MainTitle{font-size: 20px; color:#8B2E56; line-height:1.2em;}#blackSub{border-bottom: 1px solid #E0E0E0; font-size: 12px; color: #000000; font-weight: bold; padding-bottom: 10px;}.imgFloat_left{float: left;margin-right: 12px;margin-top: 6px;	margin-bottom: 6px;}</STYLE></HEAD>";
printContentHeader = printContentHeader + "<BODY bgColor=#ffffff leftMargin=0 topMargin=0><table width=100% border=0 cellpadding=0 cellspacing=0><tr><td><img src=\"images/logo_unu.gif\" width=\"198\" height=\"98\" alt=\"UNU-IAS\"></td><td align=right valign=bottom style=font-size:11px;><a href=# onClick=\"window.print();return false\" style='font-size:10px;'>" + sprint + "</a> | <a href='javascript:window.close()' style='font-size:10px;'>" + sclose + "</a>&nbsp;</td></tr></table><div id=\"MainContent\" style=line-height:1.6em; margin-left: 20px;>";
var printContentFooter = "</div><div style='font-size:10px; border-top: 1px solid #CCCCCC; margin-top: 25px; padding: 10px;clear: both;'><div style='float: left;'>&copy; 1996-2006 UNU-IAS, All Rights Reserved.</div></div><script language=\"JavaScript\" type=\"text/javascript\" src=\"../Icons/ob_tree_505.js\"></script></BODY></HTML>";
var newContent = printContentHeader + theContent + printContentFooter;

var printWin = window.open("","printWin",'alwaysRaised=yes,dependent=yes,scrollbars=yes,status=yes,resizable=yes,width=580,height=550');
printWin.document.write(newContent);
printWin.location.reload();


}
function addToFavorite(favTitle){
  if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) {
    window.external.AddFavorite(location.href, unescape(favTitle));
  }
}

-->

