<!--
function trim(sString) {
	/*
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
	*/
	return sString.replace(/\s+$|^\s+/g,"");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function hide_element(element_id) {
	var div_element = document.getElementById(element_id);
	if (div_element) {
		div_element.style.display = 'none';
	}
}
function show_element(element_id) {
	var div_element = document.getElementById(element_id);
	if (div_element) {
		div_element.style.display = 'block';
	}
}
function hide_show_element(element_id)  {
	var div_element = document.getElementById(element_id);
	if (div_element) {
		if (div_element.style.display == 'none') {
			div_element.style.display = 'block';
		}
		else {
			div_element.style.display = 'none';
		}
	}
}
function hide_show_element_if(sel_field, sel_value, target_id)  {
	var div_element = document.getElementById(target_id);
	if (div_element) {
		if (div_element.style.display == 'none' && sel_field.selectedIndex == sel_value) {
			div_element.style.display = 'block';
		}
		else {
			div_element.style.display = 'none';
		}
	}
}
function goto_url(url) {
	window.location.assign(url);
}
function popup(nomefile, larghezza, altezza, x, y)
{
    win_popup = window.open(nomefile, "", "toolbar= 0,location= 0,directories= 0,status= 0,menubar= 0,scrollbars= 0,resizable= 0,marginheight= 0,marginwidth= 1,copyhistory= 0,width=" + (larghezza+30) + ",height=" + (altezza+60));
    x = parseInt(x);
    y = parseInt(y);
    win_popup.moveTo(x, y);
}
function resize_popup(new_width, new_height, doscroll) { //v2.0
	window.resizeTo(new_width,new_height);
}

function execJS(t)
{
    var p1 = 0, p2 = 0, p3 = 0, p4 = 0;
    p1 = t.indexOf("<" + "script", 0);
    if(p1 == -1) return t;
    
    p2 = t.indexOf(">", p1 + 7) + 1;
    p3 = t.indexOf("<" + "/script>", p2);
    p4 = p3 + 9;
    
    var c = t.substring(p2, p3);
    var s = document.createElement("script");
    s.type = "text/javascript";
    s.text = c;
    document.getElementsByTagName("head")[0].appendChild(s);
    
    t = t.substring(0, p1) + t.substr(p4);
    return execJS(t);

}

function select_menu(menu_id, normal_css_class, select_css_class) {
	for (i=0;i<menu_element.length; i++) {
		var div_output = document.getElementById(menu_element[i]); 
		if (div_output) { 
			if (menu_element[i] == menu_id) {
				div_output.className = normal_css_class + ' ' + select_css_class; 
			}
			else {
				div_output.className = normal_css_class; 
			}
		}
	}
}

function select_submenu(element_id, max_element) {
	for (i=1;i<=max_element;i++) {		
		var div_element = document.getElementById('submenu'+i);
		if (div_element) {
			if (i == element_id) {
				div_element.className = 'menu_selected';
			}
			else {
				div_element.className = '';
			}
		}
	}
}

var menu_element = new Array();

-->
