function SwaraViewContent()
{
    /**
     * initialize the object - <b>must</b> be called first
     * @param {SwaraView} view	the swara view whose html content would be parsed to
     *				check if its display adheres to what we expect
     * @param {boolean}   noSpeed	(optional) if true no speed lines
     * @return null on success, else failure reason
     */
    this.init = function(view, noSpeed) {
       var contents = printNode(view.getContents());
       var defaultSpeed = view.rowView().pageView().songView().getSong().getDefaultSpeed();

	// remove new-lines
	var re = /\s/gm;
	var lContents = contents.replace( re, " " );

	/*
	 * parse the octave-wrapper div and stuff inside it. Remember
	 * 1. The attributes of octavewrapper div as it will have the border to
	 *    indicate if current element is selected or not
	 * 2. The div element of tara stayi div/spacer
	 * 3. The div element of label div
	 * 4. The div element of mandra stayi div/spacer
	 */
	re = /(\<div[^\<]*class=["]*octavewrapper["]*[^\>]*>).*\<center[^\>]*\>(.*)\<\/center\>(.*)\<center[^\>]*\>(.*)\<\/center\>/i;
	var i = re.exec(lContents);

	if( i == null || !i.length || i.length < 5 ) { return "cannot parse octave"; }
	var tara = 0;
	var mandra = 0;

	var selre = /border[^\s]*:[^;]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*255[\s]*\)/i;
	var selre1 = /border[^\s]*:[^;]*#0000ff/i;
	if( i[1].match(selre) || i[1].match(selre1) ) this.fSelected = true;

	var editre = /insert-caret.gif/i;
	if( i[1].match(editre) ) this.fIsBeingEdited = true;


	// some browsers use background:, some background-color, some may use #000000
	// and some may use rgb(0,0,0)
	var black1 = /background[^\s]*:[\s]*#000000/i;
	var black2 = /background[^\s]*:[\s]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*0[\s]*\)/i;

	if( i[2].match(black1) || i[2].match(black2) ) tara = 1;
	if( i[4].match(black1) || i[4].match(black2) ) mandra = 1;

	var t = tara + mandra ;
	if( t > 1 ) return false;

	this.fOctave = 0;
	if( tara  ) this.fOctave = 1;
	else if( mandra ) this.fOctave = -1;

	var lblre = /\<div[^\>]*>(.*)\<\/div/i;
	var l = lblre.exec(i[3]);
	if( l == null || l.length != 2 )
	    return "cannot parse label";
	this.fLabel = l[1];


	/*
	 * do the speeds
	 */
	if( !noSpeed ) {
	    re = /(\<div[^\<]*class=["]*speed["]*[^\>]*>).*(\<div[^\<]*class=["]*speed["]*[^\>]*>).*(\<div[^\<]*class=["]*speed["]*[^\>]*>)/i;
	    i = re.exec(lContents);

	    if( i == null || !i.length || i.length < 4 )
		return "cannot deduce speed";
	    var spre = /border-top[^;]*solid/i;
	    var spre2 = /border-bottom[^;]*solid/i;	// speed markers can be below

	    var lines = 0;
	    for(var sp = 0; sp < 3; sp++ ) {
		if(i[1+sp].match(spre) || i[1+sp].match(spre2)) lines++;
	    }
	    this.fNSpeedLines = lines;
	    //alert(this.fLabel + ": " + i[1] + i[2] + i[3]);
	}
	else
	    this.fNSpeedLines = 0;

	return null;
    }

    /**
     * get the octave of the swara as discerned from the html contents of its view
     * @return the octave, 0 for madya, -1 for mandra and 1 for tara
     * @type int
     */
    this.getOctave = function() { return this.fOctave; }

    /**
     * get the number of speed lines that are shown in the swara view as discerned
     * from its html contents
     * @return the number of speed lines shown
     * @type int
     */
    this.getNSpeedLines  = function() { return this.fNSpeedLines; }

    /**
     * get the label of the swara as discerned from the html contents of its view
     * @return the label
     * @type String
     */
    this.getLabel = function() { return this.fLabel; }

    /**
     * return whether or not the view is currently selected as discernible from the
     * html contents of its view
     * @return true or false indicating as to whether the view is currently selected
     *	       or not
     * @type boolean
     */
    this.isSelected = function() { return this.fSelected; }

    /**
     * return whether or not the view is currently being edited as discernible from the
     * html contents of its view
     * @return true or false indicating as to whether the view is currently selected
     *	       or not
     * @type boolean
     */
    this.isBeingEdited = function() { return this.fIsBeingEdited; }


    this.fOctave      = 0;
    this.fNSpeedLines = 0;
    this.fLabel       = "";
    this.fSelected    = false;
    this.fIsBeingEdited = false;
}
/**
 * @class
 * represents the html content of a swara view in the swara-editor (also used
 * to interpret tala markers on swara rows)
 */
@class
represents the html content of a swara view in the swara-editor (also used
to interpret tala markers on swara rows)
@class represents the html content of a swara view in the swara - editor ( also used to interpret tala markers on swara rows )
function SwaraViewContent()
{
    this.init = function(view, noSpeed) {
       var contents = printNode(view.getContents());
       var defaultSpeed = view.rowView().pageView().songView().getSong().getDefaultSpeed();
	var re = /\s/gm;
	var lContents = contents.replace( re, " " );
	re = /(\<div[^\<]*class=["]*octavewrapper["]*[^\>]*>).*\<center[^\>]*\>(.*)\<\/center\>(.*)\<center[^\>]*\>(.*)\<\/center\>/i;
	var i = re.exec(lContents);
	if( i == null || !i.length || i.length < 5 ) { return "cannot parse octave"; }
	var tara = 0;
	var mandra = 0;
	var selre = /border[^\s]*:[^;]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*255[\s]*\)/i;
	var selre1 = /border[^\s]*:[^;]*#0000ff/i;
	if( i[1].match(selre) || i[1].match(selre1) ) this.fSelected = true;
	var editre = /insert-caret.gif/i;
	if( i[1].match(editre) ) this.fIsBeingEdited = true;
	var black1 = /background[^\s]*:[\s]*#000000/i;
	var black2 = /background[^\s]*:[\s]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*0[\s]*\)/i;
	if( i[2].match(black1) || i[2].match(black2) ) tara = 1;
	if( i[4].match(black1) || i[4].match(black2) ) mandra = 1;
	var t = tara + mandra ;
	if( t > 1 ) return false;
	this.fOctave = 0;
	if( tara  ) this.fOctave = 1;
	else if( mandra ) this.fOctave = -1;
	var lblre = /\<div[^\>]*>(.*)\<\/div/i;
	var l = lblre.exec(i[3]);
	if( l == null || l.length != 2 )
	    return "cannot parse label";
	this.fLabel = l[1];
	if( !noSpeed ) {
	    re = /(\<div[^\<]*class=["]*speed["]*[^\>]*>).*(\<div[^\<]*class=["]*speed["]*[^\>]*>).*(\<div[^\<]*class=["]*speed["]*[^\>]*>)/i;
	    i = re.exec(lContents);
	    if( i == null || !i.length || i.length < 4 )
		return "cannot deduce speed";
	    var spre = /border-top[^;]*solid/i;
	    var spre2 = /border-bottom[^;]*solid/i;	
	    var lines = 0;
	    for(var sp = 0; sp < 3; sp++ ) {
		if(i[1+sp].match(spre) || i[1+sp].match(spre2)) lines++;
	    }
	    this.fNSpeedLines = lines;
	}
	else
	    this.fNSpeedLines = 0;
	return null;
    }
    this.getOctave = function() { return this.fOctave; }
    this.getNSpeedLines  = function() { return this.fNSpeedLines; }
    this.getLabel = function() { return this.fLabel; }
    this.isSelected = function() { return this.fSelected; }
    this.isBeingEdited = function() { return this.fIsBeingEdited; }
    this.fOctave      = 0;
    this.fNSpeedLines = 0;
    this.fLabel       = "";
    this.fSelected    = false;
    this.fIsBeingEdited = false;
}
function SwaraViewContent ( ) { this . init = function ( view , noSpeed ) { var contents = printNode ( view . getContents ( ) ) ; var defaultSpeed = view . rowView ( ) . pageView ( ) . songView ( ) . getSong ( ) . getDefaultSpeed ( ) ; var re = / \s / gm ; var lContents = contents . replace ( re , " " ) ; re = / (\<div[^\<]*class=["]*octavewrapper["]*[^\>]*>).*\<center[^\>]*\>(.*)\<\/center\>(.*)\<center[^\>]*\>(.*)\<\/center\> / i ; var i = re . exec ( lContents ) ; if ( i == null || ! i . length || i . length < 5 ) { return "cannot parse octave" ; } var tara = 0 ; var mandra = 0 ; var selre = / border[^\s]*:[^;]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*255[\s]*\) / i ; var selre1 = / border[^\s]*:[^;]*#0000ff / i ; if ( i [ 1 ] . match ( selre ) || i [ 1 ] . match ( selre1 ) ) this . fSelected = true ; var editre = / insert-caret.gif / i ; if ( i [ 1 ] . match ( editre ) ) this . fIsBeingEdited = true ; var black1 = / background[^\s]*:[\s]*#000000 / i ; var black2 = / background[^\s]*:[\s]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*0[\s]*\) / i ; if ( i [ 2 ] . match ( black1 ) || i [ 2 ] . match ( black2 ) ) tara = 1 ; if ( i [ 4 ] . match ( black1 ) || i [ 4 ] . match ( black2 ) ) mandra = 1 ; var t = tara + mandra ; if ( t > 1 ) return false ; this . fOctave = 0 ; if ( tara ) this . fOctave = 1 ; else if ( mandra ) this . fOctave = - 1 ; var lblre = / \<div[^\>]*>(.*)\<\/div / i ; var l = lblre . exec ( i [ 3 ] ) ; if ( l == null || l . length != 2 ) return "cannot parse label" ; this . fLabel = l [ 1 ] ; if ( ! noSpeed ) { re = / (\<div[^\<]*class=["]*speed["]*[^\>]*>).*(\<div[^\<]*class=["]*speed["]*[^\>]*>).*(\<div[^\<]*class=["]*speed["]*[^\>]*>) / i ; i = re . exec ( lContents ) ; if ( i == null || ! i . length || i . length < 4 ) return "cannot deduce speed" ; var spre = / border-top[^;]*solid / i ; var spre2 = / border-bottom[^;]*solid / i ; var lines = 0 ; for ( var sp = 0 ; sp < 3 ; sp ++ ) { if ( i [ 1 + sp ] . match ( spre ) || i [ 1 + sp ] . match ( spre2 ) ) lines ++ ; } this . fNSpeedLines = lines ; } else this . fNSpeedLines = 0 ; return null ; } this . getOctave = function ( ) { return this . fOctave ; } this . getNSpeedLines = function ( ) { return this . fNSpeedLines ; } this . getLabel = function ( ) { return this . fLabel ; } this . isSelected = function ( ) { return this . fSelected ; } this . isBeingEdited = function ( ) { return this . fIsBeingEdited ; } this . fOctave = 0 ; this . fNSpeedLines = 0 ; this . fLabel = "" ; this . fSelected = false ; this . fIsBeingEdited = false ; }
@class
 represents the html content of a swara view in the swara-editor (also used
 to interpret tala markers on swara rows)
@class represents the html content of a swara view in the swara - editor ( also used to interpret tala markers on swara rows )
/**
     * initialize the object - <b>must</b> be called first
     * @param {SwaraView} view	the swara view whose html content would be parsed to
     *				check if its display adheres to what we expect
     * @param {boolean}   noSpeed	(optional) if true no speed lines
     * @return null on success, else failure reason
     */ // remove new-lines
 /*
	 * parse the octave-wrapper div and stuff inside it. Remember
	 * 1. The attributes of octavewrapper div as it will have the border to
	 *    indicate if current element is selected or not
	 * 2. The div element of tara stayi div/spacer
	 * 3. The div element of label div
	 * 4. The div element of mandra stayi div/spacer
	 */ // some browsers use background:, some background-color, some may use #000000
 // and some may use rgb(0,0,0)
 /*
	 * do the speeds
	 */ // speed markers can be below
 //alert(this.fLabel + ": " + i[1] + i[2] + i[3]);
 /**
     * get the octave of the swara as discerned from the html contents of its view
     * @return the octave, 0 for madya, -1 for mandra and 1 for tara
     * @type int
     */ /**
     * get the number of speed lines that are shown in the swara view as discerned
     * from its html contents
     * @return the number of speed lines shown
     * @type int
     */ /**
     * get the label of the swara as discerned from the html contents of its view
     * @return the label
     * @type String
     */ /**
     * return whether or not the view is currently selected as discernible from the
     * html contents of its view
     * @return true or false indicating as to whether the view is currently selected
     *	       or not
     * @type boolean
     */ /**
     * return whether or not the view is currently being edited as discernible from the
     * html contents of its view
     * @return true or false indicating as to whether the view is currently selected
     *	       or not
     * @type boolean
     */