function ModifiedSwara()
{
    this.setVisible = function(val) {
	if( this.fOuter ) {
	    if( val ) this.fOuter.style.display = "inline";
	    else      this.fOuter.style.display = "none";
	}
    }

    /**
     * get the modified swara
     */
    this.getSwara = function() { return this.fSwara; }

    /**
     * {@link EventListener} interface implementation
     */
    this.onEvent = function(evt, src, data) {
	if( evt == EventManager.EVENT_NOTATION_INSERTMODE ) {
	    this.setVisible( NotationEditModeController.insertMode() );
	}
	if( evt == EventManager.EVENT_NOTHING_SELECTED ) {
	    this.fSelSwaraView = null;
	}
	else if( evt == EventManager.EVENT_SWARA_SELECTED || evt == EventManager.EVENT_NEWSWARASPACER_SELECTED ) {
	    var swara = data;
	    this.fSelSwaraView = src;
	    this.fDefaultSpeed = src.rowView().pageView().songView().getModel().getDefaultSpeed();

	    this.fSwaraView.setLabel(swara.getLabel());
	    this.fSwaraView.setOctave(swara.getOctave());
	    this.fSwaraView.setSpeed(swara.getSpeed(), this.fDefaultSpeed);
	}
	else if( evt == EventManager.EVENT_SWARATOOLBAR_LABELCHANGED ) {
	    this.fSwaraView.setLabel(data);
	    this.fSelSwaraView.setLabel(data);
	}
	else if( evt == EventManager.EVENT_SWARATOOLBAR_STAYICHANGED )  {
	    this.fSwaraView.setOctave(data);
	    this.fSelSwaraView.setOctave(data);
	}
	else if( evt == EventManager.EVENT_SWARATOOLBAR_SPEEDCHANGED ) {
	    this.fSwaraView.setSpeed(data, this.fDefaultSpeed);
	    this.fSelSwaraView = this.fSelSwaraView.rowView().changeSwaraSpeed(this.fSelSwaraView, data);
	    if( this.fSelSwaraView )
		this.fSelSwaraView.rowView().pageView().songView().selectObject(this.fSelSwaraView);
	}
    }

    /**
     * initialize the object
     * @private
     */
    this._init = function() {
	var div = document.createElement("div");
	div.style.fontWeight = "bold";	// need to to this to match toolbar font
	div.style.width = "100%";
	if( !Utils.isIE() )		// IE doesnt support table
	    div.style.display  = "table";	// very important for firefox so that arrow
					// div below has a chance to occupy same
					// height as others (and draw at the bottom)
	div.style.height   = "20px";	// give some height

	/*
         * we will render such that space is allocated for octave AND speed
	 *
	 * we also must specify widths otherwise IE can lay them as columns
	 * (beside width is a good thing otherwise button size would shift
	 * as you change stayi's)
	 *
	 * for speed marks to work correctly, we have the swara rendered in a container
         * which has enough padding for the speed markers (4px min) AND we
	 * put that inside another container. This double-container is needed
 	 * because outer container must be "inline" for content to be on	
	 * one row, but if it is inline, then padding seems to be ignored 
	 * (atleast on firefox). So one container with padding and NOT inline,
	 * and outer container with inline
	 */
	var ccontainer = document.createElement("div");
	ccontainer.style.display = "inline";
	ccontainer.style.cssFloat = "left";
	div.appendChild(ccontainer);

	var container = document.createElement("div");
	container.style.paddingTop = "4px";	// required for rendering speeed - see SwaraView.addSpeed
	container.style.width = "100%";	// so that it expand if longer entries are entered
	//container.style.paddingLeft = "0.25em";
	if( Utils.isIE() ) {
	    container.style.display = "inline"; // MUST NOT BE for FIREFOX - else padding is ignored
						// but MUST BE for IE - else contents not in single row
	}
	ccontainer.appendChild(container);

	var bkColor = "rgb(0,200,0)";
	this.fSwaraView.setBackgroundColor(bkColor);
	this.fSwaraView.setColor("white");

	var c = this.fSwaraView.renderInnerAsDOM(this.fSwara,0,1,true);
	c.style.border = "none";
	c.style.cssFloat = "left";
	c.style.display  = "inline";
	c.style.overflow = "hidden";
	c.style.width = "100%";	// so that it expand if longer entries are entered
	c.style.paddingBottom = "2px";
	c.style.paddingRight = "0";
	c.style.border = "none";
	container.appendChild(this.fSwaraView.addSpeed(container,c,1)); 
	ccontainer.style.background = bkColor;
	ccontainer.style.padding = "4px 4px 4px 4px";
	ccontainer.style.paddingTop = "2px";
	ccontainer.style.paddingBottom = "2px";

	div.appendChild(ccontainer);
	div.style.paddingBottom = "4px";
	//div.style.background = bkColor;

	this.fOuter = div;
    }

    /**
     * local swara model object that is modified as user interacts with the
     * swara toolbar
     * @type Swara
     * @private
     */
    this.fSwara = new Swara("S", false, 0, 1, 0); 

    /**
     * view of the local swara model object
     * @type SwaraView
     * @private
     */
    this.fSwaraView = new SwaraView();

    EventManager.addListener(EventManager.EVENT_SWARA_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_NOTHING_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_NEWSWARASPACER_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_SWARATOOLBAR_LABELCHANGED, this);
    EventManager.addListener(EventManager.EVENT_SWARATOOLBAR_STAYICHANGED, this);
    EventManager.addListener(EventManager.EVENT_SWARATOOLBAR_SPEEDCHANGED, this);
    EventManager.addListener(EventManager.EVENT_NOTATION_INSERTMODE, this);

    /**
     * the (current) default speed
     * @type int
     * @private
     */
    this.fDefaultSpeed = 1;

    /**
     * the swara view of the current selected swara in the song
     * @type SwaraView
     * @private
     */
    this.fSelSwaraView = null;

    this._init();

}
/**
 * @class
 * represents the swara label on the toolbar which updates as current swara is
 * modified. It implements the {@link EventListener} interface.
 */
@class
represents the swara label on the toolbar which updates as current swara is
modified. It implements the  EventListener interface.
@class represents the swara label on the toolbar which updates as current swara is modified . It implements the EventListener interface .
function ModifiedSwara()
{
    this.setVisible = function(val) {
	if( this.fOuter ) {
	    if( val ) this.fOuter.style.display = "inline";
	    else      this.fOuter.style.display = "none";
	}
    }
    this.getSwara = function() { return this.fSwara; }
    this.onEvent = function(evt, src, data) {
	if( evt == EventManager.EVENT_NOTATION_INSERTMODE ) {
	    this.setVisible( NotationEditModeController.insertMode() );
	}
	if( evt == EventManager.EVENT_NOTHING_SELECTED ) {
	    this.fSelSwaraView = null;
	}
	else if( evt == EventManager.EVENT_SWARA_SELECTED || evt == EventManager.EVENT_NEWSWARASPACER_SELECTED ) {
	    var swara = data;
	    this.fSelSwaraView = src;
	    this.fDefaultSpeed = src.rowView().pageView().songView().getModel().getDefaultSpeed();
	    this.fSwaraView.setLabel(swara.getLabel());
	    this.fSwaraView.setOctave(swara.getOctave());
	    this.fSwaraView.setSpeed(swara.getSpeed(), this.fDefaultSpeed);
	}
	else if( evt == EventManager.EVENT_SWARATOOLBAR_LABELCHANGED ) {
	    this.fSwaraView.setLabel(data);
	    this.fSelSwaraView.setLabel(data);
	}
	else if( evt == EventManager.EVENT_SWARATOOLBAR_STAYICHANGED )  {
	    this.fSwaraView.setOctave(data);
	    this.fSelSwaraView.setOctave(data);
	}
	else if( evt == EventManager.EVENT_SWARATOOLBAR_SPEEDCHANGED ) {
	    this.fSwaraView.setSpeed(data, this.fDefaultSpeed);
	    this.fSelSwaraView = this.fSelSwaraView.rowView().changeSwaraSpeed(this.fSelSwaraView, data);
	    if( this.fSelSwaraView )
		this.fSelSwaraView.rowView().pageView().songView().selectObject(this.fSelSwaraView);
	}
    }
    this._init = function() {
	var div = document.createElement("div");
	div.style.fontWeight = "bold";	
	div.style.width = "100%";
	if( !Utils.isIE() )		
	    div.style.display  = "table";	
	div.style.height   = "20px";	
	var ccontainer = document.createElement("div");
	ccontainer.style.display = "inline";
	ccontainer.style.cssFloat = "left";
	div.appendChild(ccontainer);
	var container = document.createElement("div");
	container.style.paddingTop = "4px";	
	container.style.width = "100%";	
	if( Utils.isIE() ) {
	    container.style.display = "inline"; 
	}
	ccontainer.appendChild(container);
	var bkColor = "rgb(0,200,0)";
	this.fSwaraView.setBackgroundColor(bkColor);
	this.fSwaraView.setColor("white");
	var c = this.fSwaraView.renderInnerAsDOM(this.fSwara,0,1,true);
	c.style.border = "none";
	c.style.cssFloat = "left";
	c.style.display  = "inline";
	c.style.overflow = "hidden";
	c.style.width = "100%";	
	c.style.paddingBottom = "2px";
	c.style.paddingRight = "0";
	c.style.border = "none";
	container.appendChild(this.fSwaraView.addSpeed(container,c,1)); 
	ccontainer.style.background = bkColor;
	ccontainer.style.padding = "4px 4px 4px 4px";
	ccontainer.style.paddingTop = "2px";
	ccontainer.style.paddingBottom = "2px";
	div.appendChild(ccontainer);
	div.style.paddingBottom = "4px";
	this.fOuter = div;
    }
    this.fSwara = new Swara("S", false, 0, 1, 0); 
    this.fSwaraView = new SwaraView();
    EventManager.addListener(EventManager.EVENT_SWARA_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_NOTHING_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_NEWSWARASPACER_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_SWARATOOLBAR_LABELCHANGED, this);
    EventManager.addListener(EventManager.EVENT_SWARATOOLBAR_STAYICHANGED, this);
    EventManager.addListener(EventManager.EVENT_SWARATOOLBAR_SPEEDCHANGED, this);
    EventManager.addListener(EventManager.EVENT_NOTATION_INSERTMODE, this);
    this.fDefaultSpeed = 1;
    this.fSelSwaraView = null;
    this._init();
}
function ModifiedSwara ( ) { this . setVisible = function ( val ) { if ( this . fOuter ) { if ( val ) this . fOuter . style . display = "inline" ; else this . fOuter . style . display = "none" ; } } this . getSwara = function ( ) { return this . fSwara ; } this . onEvent = function ( evt , src , data ) { if ( evt == EventManager . EVENT_NOTATION_INSERTMODE ) { this . setVisible ( NotationEditModeController . insertMode ( ) ) ; } if ( evt == EventManager . EVENT_NOTHING_SELECTED ) { this . fSelSwaraView = null ; } else if ( evt == EventManager . EVENT_SWARA_SELECTED || evt == EventManager . EVENT_NEWSWARASPACER_SELECTED ) { var swara = data ; this . fSelSwaraView = src ; this . fDefaultSpeed = src . rowView ( ) . pageView ( ) . songView ( ) . getModel ( ) . getDefaultSpeed ( ) ; this . fSwaraView . setLabel ( swara . getLabel ( ) ) ; this . fSwaraView . setOctave ( swara . getOctave ( ) ) ; this . fSwaraView . setSpeed ( swara . getSpeed ( ) , this . fDefaultSpeed ) ; } else if ( evt == EventManager . EVENT_SWARATOOLBAR_LABELCHANGED ) { this . fSwaraView . setLabel ( data ) ; this . fSelSwaraView . setLabel ( data ) ; } else if ( evt == EventManager . EVENT_SWARATOOLBAR_STAYICHANGED ) { this . fSwaraView . setOctave ( data ) ; this . fSelSwaraView . setOctave ( data ) ; } else if ( evt == EventManager . EVENT_SWARATOOLBAR_SPEEDCHANGED ) { this . fSwaraView . setSpeed ( data , this . fDefaultSpeed ) ; this . fSelSwaraView = this . fSelSwaraView . rowView ( ) . changeSwaraSpeed ( this . fSelSwaraView , data ) ; if ( this . fSelSwaraView ) this . fSelSwaraView . rowView ( ) . pageView ( ) . songView ( ) . selectObject ( this . fSelSwaraView ) ; } } this . _init = function ( ) { var div = document . createElement ( "div" ) ; div . style . fontWeight = "bold" ; div . style . width = "100%" ; if ( ! Utils . isIE ( ) ) div . style . display = "table" ; div . style . height = "20px" ; var ccontainer = document . createElement ( "div" ) ; ccontainer . style . display = "inline" ; ccontainer . style . cssFloat = "left" ; div . appendChild ( ccontainer ) ; var container = document . createElement ( "div" ) ; container . style . paddingTop = "4px" ; container . style . width = "100%" ; if ( Utils . isIE ( ) ) { container . style . display = "inline" ; } ccontainer . appendChild ( container ) ; var bkColor = "rgb(0,200,0)" ; this . fSwaraView . setBackgroundColor ( bkColor ) ; this . fSwaraView . setColor ( "white" ) ; var c = this . fSwaraView . renderInnerAsDOM ( this . fSwara , 0 , 1 , true ) ; c . style . border = "none" ; c . style . cssFloat = "left" ; c . style . display = "inline" ; c . style . overflow = "hidden" ; c . style . width = "100%" ; c . style . paddingBottom = "2px" ; c . style . paddingRight = "0" ; c . style . border = "none" ; container . appendChild ( this . fSwaraView . addSpeed ( container , c , 1 ) ) ; ccontainer . style . background = bkColor ; ccontainer . style . padding = "4px 4px 4px 4px" ; ccontainer . style . paddingTop = "2px" ; ccontainer . style . paddingBottom = "2px" ; div . appendChild ( ccontainer ) ; div . style . paddingBottom = "4px" ; this . fOuter = div ; } this . fSwara = new Swara ( "S" , false , 0 , 1 , 0 ) ; this . fSwaraView = new SwaraView ( ) ; EventManager . addListener ( EventManager . EVENT_SWARA_SELECTED , this ) ; EventManager . addListener ( EventManager . EVENT_NOTHING_SELECTED , this ) ; EventManager . addListener ( EventManager . EVENT_NEWSWARASPACER_SELECTED , this ) ; EventManager . addListener ( EventManager . EVENT_SWARATOOLBAR_LABELCHANGED , this ) ; EventManager . addListener ( EventManager . EVENT_SWARATOOLBAR_STAYICHANGED , this ) ; EventManager . addListener ( EventManager . EVENT_SWARATOOLBAR_SPEEDCHANGED , this ) ; EventManager . addListener ( EventManager . EVENT_NOTATION_INSERTMODE , this ) ; this . fDefaultSpeed = 1 ; this . fSelSwaraView = null ; this . _init ( ) ; }
@class
 represents the swara label on the toolbar which updates as current swara is
 modified.
@class represents the swara label on the toolbar which updates as current swara is modified .
/**
     * get the modified swara
     */ /**
     * {@link EventListener} interface implementation
     */ /**
     * initialize the object
     * @private
     */ // need to to this to match toolbar font
 // IE doesnt support table
 // very important for firefox so that arrow
 // div below has a chance to occupy same
 // height as others (and draw at the bottom)
 // give some height
 /*
         * we will render such that space is allocated for octave AND speed
	 *
	 * we also must specify widths otherwise IE can lay them as columns
	 * (beside width is a good thing otherwise button size would shift
	 * as you change stayi's)
	 *
	 * for speed marks to work correctly, we have the swara rendered in a container
         * which has enough padding for the speed markers (4px min) AND we
	 * put that inside another container. This double-container is needed
 	 * because outer container must be "inline" for content to be on	
	 * one row, but if it is inline, then padding seems to be ignored 
	 * (atleast on firefox). So one container with padding and NOT inline,
	 * and outer container with inline
	 */ // required for rendering speeed - see SwaraView.addSpeed
 // so that it expand if longer entries are entered
 //container.style.paddingLeft = "0.25em";
 // MUST NOT BE for FIREFOX - else padding is ignored
 // but MUST BE for IE - else contents not in single row
 // so that it expand if longer entries are entered
 //div.style.background = bkColor;
 /**
     * local swara model object that is modified as user interacts with the
     * swara toolbar
     * @type Swara
     * @private
     */ /**
     * view of the local swara model object
     * @type SwaraView
     * @private
     */ /**
     * the (current) default speed
     * @type int
     * @private
     */ /**
     * the swara view of the current selected swara in the song
     * @type SwaraView
     * @private
     */