<!--
function show_legend() {

	var Legenda = document.getElementById("Legenda");
	Legenda.style.visibility = "visible";
}

function hide_legend() {

	var Legenda = document.getElementById("Legenda");
	Legenda.style.visibility = "hidden";
}

var strSearch = new String();

function mousedown(e){
	update_mouse_coords(e);
	if (window.getSelection && e.target.toString().indexOf("HTMLImageElement") != -1){ // Moz
		setTimeout('Alice_hide()',200);
	} else {
		setTimeout('Alice_hide()',10);
	}
}

function mouseup(e){

	update_mouse_coords(e);
	var str = get_selection();
	if (str.length == 0 || strSearch == str) return;
	strSearch = str; // Moz & Opera
	setTimeout('Alice_show()',10);
}

function Alice_hide(){

    try{
	var str = get_selection();

	if (str.length != 0) return;
	Alice.style.visibility = "hidden";
	window.status = "";
	}
	catch(ex){}
}

function Alice_hide_auto(){
    try{
	Alice.style.visibility = "hidden";
	}
	catch(ex){}
}

function Alice_show() {

	if (Alice.style.visibility == "visible") return;
	Alice.style.left = mouse_x+"px";
	Alice.style.top = mouse_y+"px";
	var version = 0;
	if (window.getSelection || navigator.appName == "Opera"){ // Moz
		Alice.style.visibility = "visible";
	} else if (navigator.appVersion.indexOf("MSIE")!=-1) {
		var temp = navigator.appVersion.split("MSIE");
		version = parseFloat(temp[1]);
		if (version>=5) Alice.style.visibility = "visible";
	}
}

function update_mouse_coords(e){

	if (!e) var e = window.event;
	if (e.pageX || e.pageY) {
		mouse_x = e.pageX - 15;
		mouse_y = e.pageY - 15;
	} else if (e.clientX || e.clientY) {
		mouse_x = e.clientX + document.documentElement.scrollLeft - 15;
		mouse_y = e.clientY + document.documentElement.scrollTop - 15;
	}
}

function alice_search(){

	var target="http://search.alice.it/search/cgi/search.cgi?dom=s&offset=0&hits=10&clck=auto&switch=0&f="+ cts_site +"&qs=";
	var str = get_selection();

	if (window.getSelection || !str){ // Moz & Opera
		str = strSearch;
	}
	msgX = (screen.width/2)-(700/2);
	msgY = (screen.height/2)-(500/2);
	msgWindow = window.open(target + str, "displayWindow", "location=yes,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,height=500,width=700,left="+msgX+",top="+msgY);
	Alice_hide_auto()
}

function get_selection(){

	var str = new String("");

	if (window.getSelection){   // Moz & Safari
		if(navigator.appVersion.indexOf("Safari")!=-1){ // Safari
			str = window.getSelection()+"";
		} else { // Moz
			str = window.getSelection().toString();
		}
	} else if (document.selection && document.selection.createRange){ // IE
		var range = document.selection.createRange();
		str = range.text.toString();
	}

	// remove non-alphanumeric stuff from the string
	//str = str.replace(/[^a-zA-Z 0-9]+/g,'');

	// limit string search
	str = str.slice(0, 100);
	return str;
}

function getElementsByClassName(strTagName, strClassName){

	var arrElements = (strTagName == "*" && document.all)? document.all : document.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;

	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			if(arrReturnElements.push){
				arrReturnElements.push(oElement);
			}else{
				arrReturnElements[arrReturnElements.length]=oElement;
			}
		}
	}
	return (arrReturnElements)
}

if(document.getElementById("Alice")){

	var Alice = document.getElementById("Alice");
	var contentarea = getElementsByClassName("*","content");

	for ( var oid, i = 0; ( elem = contentarea[i] ); i++ ) {
		elem.onmouseup = mouseup;
		elem.onmousedown = mousedown;
	}
	window.onblur = Alice_hide_auto;
}

document.onmousedown = mousedown;
-->
