/**
 * La funzione sposta da un <select> ad un'altro gli elementi selezionati
 * Source e target sono gli oggetti, non i nomi.
 */
function findInSelect( sel_obj, val, txt ){
    for( i = 0 ; i < sel_obj.length ; i++ ){
        if( sel_obj.options[i] != null )
            if( sel_obj.options[i].value.equals(val) && sel_obj.options[i].text.equals(txt) )
                return true;
    }
    return false ;
}

function spostaElementi( source, target ) {
	if ( source.selectedIndex == -1)
		return false ;
	var val, txt ;
        while( source.selectedIndex != -1 ) 
        for( i=0 ; i < source.length ; i++ ){
            if( source.options[i] != null && source.options[i].selected ){
                val = source.options[i].value ;
		txt = source.options[i].text ;
		if( val != null && val != "undefined" ){
                    source.options[i] = null ;						
                    target.options[target.options.length] = new Option( txt, val );
                }
            }
        }
	return true ;
}

/**
 * Selects all elements of a <select> object
 */
function selectAll( el ){
    if( el != null )
        for( i = 0 ; i < el.length ; i++ )
            el.options[i].selected = true ;
}

function mostra(el){
	el.style.visibility = "visible" ;
}

function nascondi(el){
	el.style.visibility = "hidden" ;
}

/**
 * Semplice popup
 */
function popup( text ){
	var w = window.open();
	w.write( text );
}