function resetta (){
	document.form1.country.value="";
	document.form1.topic.value="";
	document.form2.topic2.value="";
	document.form2.query1.value="";
	document.form2.query1.value="";
	document.form2.query3.value="";
	document.form1.querycountry.value="";
	document.form1.querytopic.value="";
	document.form1.query.value="";
	document.form2.selected.value="None";
	document.form2.select.value="";
	document.form2.nav.value="";
	
	}

        //scroller width
        var swidth=158;

        //scroller height
        var sheight=120;

        //background color
        var sbcolor='#EDEDED';

        //scroller's speed
        var sspeed=1;

        var msg=''

        //Your messages go below:


        msg +='<ul><li><b>&nbsp;May 2008</b></li><br>'+'<li>A new restyled and updated <b>Landtenure.info</b> website has just been launched.</li>'+'<li> </li></ul><br><hr><br>'+'<ul><li><b>&nbsp;March 2008</b></li><br>'+'<li>COPROFAM - one of the biggest farmers organizations in Latin America - has joined the <b>Landtenure.info</b> Consortium.</li>'+'<li> </li></ul><br><hr><br>'+'<ul><li><b>&nbsp;June 2008</b></li><br>'+'<li><b>Landtenure.info</b> website has been promoted at the FAO High-Level Conference on <b>"World Food Security: the Challenges of Climate Change and Bioenergy"</b> </li>'+'<li> </li></ul><br><hr><br>'+'<ul><li><b>&nbsp;Next coming</b></li><br>'+'<li>The institutional  framework of a new agreement with <b>FAO</b> is being set up over the next months</li>'+'<li> </li></ul><br><hr><br>'+'<ul><li><b>&nbsp;Next coming</b></li><br>'+'<li><b>Landtenure.info</b> website will be soon interlinked with the upcoming FAO gender and land database</li>'+'<li> </li></ul><br><hr><br>'+'';

        //End of your messages
        // Begin the ticker code

        var resumesspeed=sspeed
        function start() {
                if (document.all) iemarquee(ticker);
                else if (document.getElementById)
                        ns6marquee(document.getElementById('ticker'));
        }
        
        function iemarquee(whichdiv){
                iediv=eval(whichdiv)
                sheight += 0;
                iediv.style.pixelTop=sheight
                iediv.innerHTML=msg 
                sizeup=iediv.offsetHeight
                ieslide()
        }
        
        function ieslide(){
                if (iediv.style.pixelTop>=sizeup*(-1)){
                        iediv.style.pixelTop-=sspeed
                        setTimeout("ieslide()",100)
                }
                else{
                        iediv.style.pixelTop=sheight
                        ieslide()
                }
        }
        
        function ns6marquee(whichdiv){
                ns6div=eval(whichdiv)
                sheight += 0;
                ns6div.style.top=sheight + "px";
                ns6div.innerHTML=msg
                sizeup=ns6div.offsetHeight
                ns6slide()
        }
        function ns6slide(){
                if (parseInt(ns6div.style.top)>=sizeup*(-1)){
                        theTop = parseInt(ns6div.style.top)-sspeed
                        ns6div.style.top = theTop + "px";
                        setTimeout("ns6slide()",100)
                }
                else {
                        ns6div.style.top = sheight + "px";
                        ns6slide()
                }
        }


function angola () {
	document.form2.query1.value="ago";
	document.form2.selected.value="Angola";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
	
	
}
function Bangladesh () {
	document.form2.query1.value="bgd";
	document.form2.selected.value="Bangladesh";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Benin () {
	document.form2.query1.value="ben";
	document.form2.selected.value="Benin";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''

}
function Bolivia () {
	document.form2.query1.value="bol";
	document.form2.selected.value="Bolivia";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Bosnia () {
	document.form2.query1.value="bih";
	document.form2.selected.value="Bosnia and Herzegovina";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Brazil () {
	document.form2.query1.value="bra";
	document.form2.selected.value="Brazil";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Burkina () {
	document.form2.query1.value="bfa";
	document.form2.selected.value="Burkina Faso";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Burundi () {
	document.form2.query1.value="bdi";
	document.form2.selected.value="Burundi";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Cambodia () {
	document.form2.query1.value="khm";
	document.form2.selected.value="Cambodia";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Colombia () {
	document.form2.query1.value="col";
	document.form2.selected.value="Colombia";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Guatemala () {
	document.form2.query1.value="gtm";
	document.form2.selected.value="Guatemala";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Honduras () {
	document.form2.query1.value="hnd";
	document.form2.selected.value="Honduras";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Indonesia () {
	document.form2.query1.value="idn";
	document.form2.selected.value="Indonesia";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Mozambique () {
	document.form2.query1.value="moz";
	document.form2.selected.value="Mozambique";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Nepal () {
	document.form2.query1.value="npl";
	document.form2.selected.value="Nepal";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Niger () {
	document.form2.query1.value="ner";
	document.form2.selected.value="Niger";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Peru () {
	document.form2.query1.value="per";
	document.form2.selected.value="Peru";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}
function Philippines () {
	document.form2.query1.value="phl";
	document.form2.selected.value="Philippines";
	document.form1.querycountry.value=document.form2.query1.value;
	document.form1.country.value=document.form2.query1.value;
	document.form2.select.value=''
}

function control1() {
	
if ( document.form2.query1.value.length == 0 )
{
	alert('Please, select a country from the map!');
	return;
}
if ( document.form2.topic2.value == 0 )
{
	alert('Please, select a topic!');
	return;
}
else { change('x'),subchange('x'),document.form2.query3.value=document.form2.query1.value+'/'+document.form2.topic2.options[document.form2.topic2.selectedIndex].value,ajaxpage(document.form2.query3.value,'contenuti'),document.getElementById('contenuti').style.display = 'block',document.getElementById('homepage').style.display = 'none',document.form2.nav.value=document.form1.country.options[document.form1.country.selectedIndex].text,document.getElementById('nav').style.display = 'block';
	}
}

function controllo() {
	
if (document.form1.querycountry.value.length == 0 )
{
	alert('Please, select a country!');
	return;
}

if (document.form1.querytopic.value.length == 0 )
{
	alert('Please, select a topic!');
	return;
}	
else {document.form1.query.value=document.form1.querycountry.value+'/'+document.form1.querytopic.value,change('x'),subchange('x'),	ajaxpage(document.form1.query.value,'contenuti'),document.getElementById('contenuti').style.display = 'block',document.getElementById('homepage').style.display = 'none',document.form2.nav.value=document.form1.country.options[document.form1.country.selectedIndex].text,	document.getElementById('nav').style.display = 'block';
								 
	}

}

function control2() {	
document.form2.query2.value=document.form2.topic2.options[document.form2.topic2.selectedIndex].value;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function getElementsByClass(searchClass,node,tag) {
		var classElements = new Array();
		if ( node == null )
			node = document;
			
		if ( tag == null )
			tag = '*';
			
		var els = node.getElementsByTagName(tag);
		var elsLen = els.length;
		var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
		
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) ) {
				classElements[j] = els[i];
				j++;
			}
		}
		return classElements;
	}

function showHideClass(myclass){

	var el = getElementsByClass(myclass);
	for (var i=0; i < el.length; i++){
		
		if ( el[i].style.display != 'none' ) {
			el[i].style.display = "none";
		}
		else {
			el[i].style.display = "block";
		}
	}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

var regiondb = new Object()



regiondb["Africa"] = [{value:"South Africa", text:"South Africa"}];
                      
					  
regiondb["Latin America and the Caribbean"] = [
					  {value:"Nicaragua", text:"Nicaragua"}];
					  

function setCities(chooser) {
    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var cityChooser = chooser.form.elements["country"];
    while (cityChooser.options.length) {
        cityChooser.remove(0);
    }
    var choice = chooser.options[chooser.selectedIndex].value;
    var db = regiondb[choice];
    newElem = document.createElement("option");
    newElem.text = "Select a country:";
    newElem.value = "";
    cityChooser.add(newElem, where);
    if (choice != "") {
        for (var i = 0; i < db.length; i++) {
            newElem = document.createElement("option");
            newElem.text = db[i].text;
            newElem.value = db[i].value;
            cityChooser.add(newElem, where);
        }
    }
}
function setCities2(chooser) {
    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var cityChooser = chooser.form.elements["country2"];
    while (cityChooser.options.length) {
        cityChooser.remove(0);
    }
    var choice = chooser.options[chooser.selectedIndex].value;
    var db = regiondb[choice];
    newElem = document.createElement("option");
    newElem.text = "Select a country:";
    newElem.value = "";
    cityChooser.add(newElem, where);
    if (choice != "") {
        for (var i = 0; i < db.length; i++) {
            newElem = document.createElement("option");
            newElem.text = db[i].text;
            newElem.value = db[i].value;
            cityChooser.add(newElem, where);
        }
    }
}

function show(theNumber) {
	var theRules = new Array();
	if (document.styleSheets[0].cssRules) {
		theRules = document.styleSheets[0].cssRules;
	} else if (document.styleSheets[0].rules) {
		theRules = document.styleSheets[0].rules;
	}
	theRules[theNumber].style.visibility = 'visible';
}
			  

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}


function toggle(par)
{
	var ar=par.split(",");
	for(var i=0; i<ar.length; i++)
	{
		var id = ar[i];
		if( document.getElementById(id).style.display=='none' ){
		document.getElementById(id).style.display = '';
		}else{
		document.getElementById(id).style.display = 'none';
		}
	}

}

function visualizza(id){
 
      document.getElementById(id).style.display = 'block';
    
}
function nascondi(id){
 
      document.getElementById(id).style.display = 'none';
    
}

which='1';
function change(id)
{
	document.getElementById(which).className="leftmenuTD";
	document.getElementById(id).className="leftmenuTDON";
	which=id;
}
which2='sub3';
function subchange(id2)
{
	document.getElementById(which2).className="invisibile";
	document.getElementById(id2).className="visibile";
	which2=id2;
}
which3='3_1';
function subsubchange(id3)
{
	document.getElementById(which3).className="leftsubmenuTD";
	document.getElementById(id3).className="leftsubmenuTDON";
	which3=id3;
}

function posta()
{document.write('<a href=\"mailto:'+ 'ICARRD-Secretariat'+'@'+'fao.org' +'\"></a>')}
