function $(id) {
	
	return document.getElementById ? document.getElementById(id) : eval( "document.all." + id );
	
}

function set_opacity( elm, o ) { 

	elm.style.filter = 'alpha(opacity=' + o + ')';
	elm.style.KhtmlOpacity = o/100;
	elm.style.MozOpacity = o/100;
	elm.style.opacity = o/100;

}

function fade( elm, from, to ) {

	elm.style.display = from == 0 ? 'none' : 'block';

	if( from == to ) return;

	from = from > to ? from - 10 : from + 10;

	set_opacity( elm, from );
	setTimeout( function() { fade( elm, from, to ) }, 50 );

}

function move_cursor_to_the_end( editor_id ) {
    
	inst = tinyMCE.getInstanceById(editor_id);
    
	tinyMCE.execInstanceCommand( editor_id, "selectall", false, null );
    
	if ( tinyMCE.isMSIE ) {
        rng = inst.getRng();
        rng.collapse( false );
        rng.select();
    } else {
        sel = inst.getSel();
        sel.collapseToEnd();
    }
	
}