function GamakaMenu() 
{
    /**
     * implementation of {@link EventHandler} interface
     */
    this.onEvent = function(evt, src, data) {
	if( evt == EventManager.EVENT_GAMAKA_ADDED ) {
	    var gamaka = src;
	    /*
	     * if we get this event, then that means that a new gamaka
	     * was specified by user (and he has selected it). So we 
	     * add it to our menu item but we also tell our action 
	     * handler that the user has selected the new gamaka
	     */
	    var svGamakaMenuItems = this.fGamakaMenuItems;
	    var newGamakaMenuItems = new Array();
	    var nFonts = svGamakaMenuItems.length;
	    var i;
	    var added = false;
	    for(i = 0; i < nGamakas; i++ ) {
		if( svGamakaMenuItems[i].gamaka.getName() == gamaka.getName() )  {
		    return;
		}
		else if ( !added && svGamakaMenuItems[i].gamaka.getName() > gamaka.getName() ) {
		    var midx = newGamakaMenuItems.length;

		    newGamakaMenuItems[midx] = new Object();
		    newGamakaMenuItems[midx].gamaka =  gamaka;
		    var m = new GamakaMenuItem(gamaka);
		    newFontMenuItems[midx].item =  m;
		    // insert a menu item making us as the action handler (we will
		    // handle the "Other..." if necessary before pass on action to
		    // the real action handler
		    this.insertItem(m, svGamakaMenuItems[i].item, this, gamaka);

		    newGamakaMenuItems[newGamakaMenuItems.length]=  svGamakaMenuItems[i];
		    added = true;
		}
		else
		    newGamakaMenuItems[newGamakaMenuItems.length] =  svGamakaMenuItems[i];
	    }
	    this.fGamakaMenuItems = newGamakaMenuItems;
	    if( this.fActionHandler ) {
		this.fActionHandler.doAction(this, gamaka);
	    }
	}
    }

    /**
     * implementation of {@link ActionHandler} interface - called when
     * a font menu item is selected
     */
    this.doAction = function(src, actionID) {
	var gamaka = actionID;
	if( gamaka == "Other ..." ) {
	    alert("Other... not supported yet");
	    /*
	     * user selected "Other ...", put up AddGamaka form. When
	     * user specifies a gamaka there, it will trigger a GAMAKA_ADDED
	     * event which we will catch in our event handler (and
	     * we will pass it on to fActionHandler
	     */
	    //var form = new AddGamakaForm();
	    //form.initForm(document.body);
	    //var obj = document.body;
	    //var x = LookAndFeel.findPosX(obj);
	    //var y = LookAndFeel.findPosY(obj);
	    //form.show(x,y);
	    return;
	}
	if( this.fActionHandler ) {
	    this.fActionHandler.doAction(this, gamaka);
	}
    }


    /**
     * initialize the menu - menu is usable only after this is called.
     * <p>
     * Note that this is different from {@link Menu#initMenu} which initializes
     * the menu display. This method callls that method. 
     *
     * @param {ActionHandler} actionHandler	the action handler which will 
     *						be called when a gamaka is
     *						selected (actionID is the gamaka
     */
    this.init = function(actionHandler) {
	this.fActionHandler = actionHandler;

    	var gamakaList = GamakaManager.getGamakas();
	var lgamakaList = new Array();
	var i;
	var key;
	for(key in gamakaList)
	{
	    var gamaka = gamakaList[key];
	    if( gamaka.getState() == GamakaStates.INSTALLED_YES ) {
	    	lgamakaList[lgamakaList.length] = gamaka.getName();
	    }
	}
	lgamakaList.sort();

	var nGamakas = lgamakaList.length;

	this.fGamakaMenuItems  = new Array();

	/*
	 * insert menu items making us as the action handler (we will
	 * handle the "Other..." if necessary before pass on action to
	 * the real action handler
	 */
	var midx;
	this.addItem(new  GamakaMenuItem("None"), this, null);
	for(var i = 0; i < nGamakas; i++ ) {
	    this.fGamakaMenuItems[midx] = new Object();
	    var gamaka = gamakaList[lgamakaList[i]];
	    this.fGamakaMenuItems[midx].gamaka = gamaka;
	    var m = new GamakaMenuItem(gamaka);

	    this.addItem(m, this, gamaka);
	    this.fGamakaMenuItems[midx].item = m;
	}
	this.addItem(new  GamakaMenuItem("Other ..."), this, "Other ...");
    }

    EventManager.addListener(EventManager.EVENT_GAMAKA_ADDED, this);

    /**
     * An array representing gamaka menu items {@link GamakaMenuItem}
     * @type Array
     * @private
     */
    this.fGamakaMenuItems = null;

    /**
     * the action handler called when gamaka is selected
     */
    this.fActionHandler = null;
}
/**
 * @class
 * represents a menu of selectable gamakas. 
 * <p>
 * The menu is usable only after {@link GamakaMenu#init} is called, to which an 
 * {@link ActionHandler} must be provided. This action handler will be called
 * when a gamaka is selected The actionID is the gamaka.
 */
@class
represents a menu of selectable gamakas.

The menu is usable only after  GamakaMenu#init is called, to which an
ActionHandler must be provided. This action handler will be called
when a gamaka is selected The actionID is the gamaka.
@class represents a menu of selectable gamakas . The menu is usable only after GamakaMenu#init is called to which an ActionHandler must be provided . This action handler will be called when a gamaka is selected The actionID is the gamaka .
function GamakaMenu() 
{
    this.onEvent = function(evt, src, data) {
	if( evt == EventManager.EVENT_GAMAKA_ADDED ) {
	    var gamaka = src;
	    var svGamakaMenuItems = this.fGamakaMenuItems;
	    var newGamakaMenuItems = new Array();
	    var nFonts = svGamakaMenuItems.length;
	    var i;
	    var added = false;
	    for(i = 0; i < nGamakas; i++ ) {
		if( svGamakaMenuItems[i].gamaka.getName() == gamaka.getName() )  {
		    return;
		}
		else if ( !added && svGamakaMenuItems[i].gamaka.getName() > gamaka.getName() ) {
		    var midx = newGamakaMenuItems.length;
		    newGamakaMenuItems[midx] = new Object();
		    newGamakaMenuItems[midx].gamaka =  gamaka;
		    var m = new GamakaMenuItem(gamaka);
		    newFontMenuItems[midx].item =  m;
		    this.insertItem(m, svGamakaMenuItems[i].item, this, gamaka);
		    newGamakaMenuItems[newGamakaMenuItems.length]=  svGamakaMenuItems[i];
		    added = true;
		}
		else
		    newGamakaMenuItems[newGamakaMenuItems.length] =  svGamakaMenuItems[i];
	    }
	    this.fGamakaMenuItems = newGamakaMenuItems;
	    if( this.fActionHandler ) {
		this.fActionHandler.doAction(this, gamaka);
	    }
	}
    }
    this.doAction = function(src, actionID) {
	var gamaka = actionID;
	if( gamaka == "Other ..." ) {
	    alert("Other... not supported yet");
	    return;
	}
	if( this.fActionHandler ) {
	    this.fActionHandler.doAction(this, gamaka);
	}
    }
    this.init = function(actionHandler) {
	this.fActionHandler = actionHandler;
    	var gamakaList = GamakaManager.getGamakas();
	var lgamakaList = new Array();
	var i;
	var key;
	for(key in gamakaList)
	{
	    var gamaka = gamakaList[key];
	    if( gamaka.getState() == GamakaStates.INSTALLED_YES ) {
	    	lgamakaList[lgamakaList.length] = gamaka.getName();
	    }
	}
	lgamakaList.sort();
	var nGamakas = lgamakaList.length;
	this.fGamakaMenuItems  = new Array();
	var midx;
	this.addItem(new  GamakaMenuItem("None"), this, null);
	for(var i = 0; i < nGamakas; i++ ) {
	    this.fGamakaMenuItems[midx] = new Object();
	    var gamaka = gamakaList[lgamakaList[i]];
	    this.fGamakaMenuItems[midx].gamaka = gamaka;
	    var m = new GamakaMenuItem(gamaka);
	    this.addItem(m, this, gamaka);
	    this.fGamakaMenuItems[midx].item = m;
	}
	this.addItem(new  GamakaMenuItem("Other ..."), this, "Other ...");
    }
    EventManager.addListener(EventManager.EVENT_GAMAKA_ADDED, this);
    this.fGamakaMenuItems = null;
    this.fActionHandler = null;
}
function GamakaMenu ( ) { this . onEvent = function ( evt , src , data ) { if ( evt == EventManager . EVENT_GAMAKA_ADDED ) { var gamaka = src ; var svGamakaMenuItems = this . fGamakaMenuItems ; var newGamakaMenuItems = new Array ( ) ; var nFonts = svGamakaMenuItems . length ; var i ; var added = false ; for ( i = 0 ; i < nGamakas ; i ++ ) { if ( svGamakaMenuItems [ i ] . gamaka . getName ( ) == gamaka . getName ( ) ) { return ; } else if ( ! added && svGamakaMenuItems [ i ] . gamaka . getName ( ) > gamaka . getName ( ) ) { var midx = newGamakaMenuItems . length ; newGamakaMenuItems [ midx ] = new Object ( ) ; newGamakaMenuItems [ midx ] . gamaka = gamaka ; var m = new GamakaMenuItem ( gamaka ) ; newFontMenuItems [ midx ] . item = m ; this . insertItem ( m , svGamakaMenuItems [ i ] . item , this , gamaka ) ; newGamakaMenuItems [ newGamakaMenuItems . length ] = svGamakaMenuItems [ i ] ; added = true ; } else newGamakaMenuItems [ newGamakaMenuItems . length ] = svGamakaMenuItems [ i ] ; } this . fGamakaMenuItems = newGamakaMenuItems ; if ( this . fActionHandler ) { this . fActionHandler . doAction ( this , gamaka ) ; } } } this . doAction = function ( src , actionID ) { var gamaka = actionID ; if ( gamaka == "Other ..." ) { alert ( "Other... not supported yet" ) ; return ; } if ( this . fActionHandler ) { this . fActionHandler . doAction ( this , gamaka ) ; } } this . init = function ( actionHandler ) { this . fActionHandler = actionHandler ; var gamakaList = GamakaManager . getGamakas ( ) ; var lgamakaList = new Array ( ) ; var i ; var key ; for ( key in gamakaList ) { var gamaka = gamakaList [ key ] ; if ( gamaka . getState ( ) == GamakaStates . INSTALLED_YES ) { lgamakaList [ lgamakaList . length ] = gamaka . getName ( ) ; } } lgamakaList . sort ( ) ; var nGamakas = lgamakaList . length ; this . fGamakaMenuItems = new Array ( ) ; var midx ; this . addItem ( new GamakaMenuItem ( "None" ) , this , null ) ; for ( var i = 0 ; i < nGamakas ; i ++ ) { this . fGamakaMenuItems [ midx ] = new Object ( ) ; var gamaka = gamakaList [ lgamakaList [ i ] ] ; this . fGamakaMenuItems [ midx ] . gamaka = gamaka ; var m = new GamakaMenuItem ( gamaka ) ; this . addItem ( m , this , gamaka ) ; this . fGamakaMenuItems [ midx ] . item = m ; } this . addItem ( new GamakaMenuItem ( "Other ..." ) , this , "Other ..." ) ; } EventManager . addListener ( EventManager . EVENT_GAMAKA_ADDED , this ) ; this . fGamakaMenuItems = null ; this . fActionHandler = null ; }
@class
 represents a menu of selectable gamakas.
@class represents a menu of selectable gamakas .
/**
     * implementation of {@link EventHandler} interface
     */ /*
	     * if we get this event, then that means that a new gamaka
	     * was specified by user (and he has selected it). So we 
	     * add it to our menu item but we also tell our action 
	     * handler that the user has selected the new gamaka
	     */ // insert a menu item making us as the action handler (we will
 // handle the "Other..." if necessary before pass on action to
 // the real action handler
 /**
     * implementation of {@link ActionHandler} interface - called when
     * a font menu item is selected
     */ /*
	     * user selected "Other ...", put up AddGamaka form. When
	     * user specifies a gamaka there, it will trigger a GAMAKA_ADDED
	     * event which we will catch in our event handler (and
	     * we will pass it on to fActionHandler
	     */ //var form = new AddGamakaForm();
 //form.initForm(document.body);
 //var obj = document.body;
 //var x = LookAndFeel.findPosX(obj);
 //var y = LookAndFeel.findPosY(obj);
 //form.show(x,y);
 /**
     * initialize the menu - menu is usable only after this is called.
     * <p>
     * Note that this is different from {@link Menu#initMenu} which initializes
     * the menu display. This method callls that method. 
     *
     * @param {ActionHandler} actionHandler	the action handler which will 
     *						be called when a gamaka is
     *						selected (actionID is the gamaka
     */ /*
	 * insert menu items making us as the action handler (we will
	 * handle the "Other..." if necessary before pass on action to
	 * the real action handler
	 */ /**
     * An array representing gamaka menu items {@link GamakaMenuItem}
     * @type Array
     * @private
     */ /**
     * the action handler called when gamaka is selected
     */