function ImportForm()
{
    this.onOK = function() {
	var v = this.fTextArea.value;
	var t = v.replace(/^\s+|\s+$/, '');
	if( t == "" ) {
	    alert("nothing specified!");
	    return;
	}
	else if( v == this.fOrigContents ) {
	    // nothing changed.
	    this.hide();
	    return;
	}

	var r = Song.prototype.fromRawText(t);
	if( r == null || r.fResult == null )
	    return;

	var song = r.fResult;

	this.hide();

	if( theSongView ) {
	    // delete current view
	    var c = theSongView.getContents();
	    if( c != null ) {
		c.parentNode.removeChild(c);
	    }
	    createSong(editorWorkspace, song, false);
	}
    }
	
    this.onShow = function() {
	var o = document.getElementById("importform_ok");
	Utils.addToIdMap(o, this); 
	o = document.getElementById("importform_cancel");
	Utils.addToIdMap(o, this); 


	var t = theSongView.getModel().getRawContents();
	if(!t ) t = "";
	this.fOrigContents = t;
	o = document.getElementById("ieform_textarea");
	o.value = t;

	Utils.addToIdMap(o, this);
	this.fTextArea = o;
    }

    /**
     * override of {@link Form#provideContent} to provide content of
     * the form
     */
    this.provideContent = function() {
	var d = document.createElement("div");
	var s;
	s    = '<table style="overflow:auto;"><tr><td><span><b>Enter/edit contents in raw format:</b></span>';
	s    += '<tr><td>';
	s    += '<textarea id="ieform_textarea" style="word-wrap:normal;" name="textarea" type="textarea" rows="30" cols="100"></textarea>';
	s    += '<tr><td>';
	s    += '<tr><td>';
	s    += '<div><center>';
	s    += '<input id="importform_cancel" name="align" type="button" value="Align" onclick="onImportFormAlign(this)"> &nbsp;';
	s    += '<input id="importform_ok" name="ok" type="button" value="&nbsp;OK&nbsp;" onclick="onImportFormOK(this)"> &nbsp;';
	s    += '<input id="importform_cancel" name="cancel" type="button" value="Cancel" onclick="onImportFormCancel(this)">';
	s    += '</center>';
	s    += '</div>';
	s    += '</table>';
	d.innerHTML = s;
	d.style.overflow = "auto";

	return d;
    }

    this.align = function() {
	o = document.getElementById("ieform_textarea");
	var t = o.value;
	var sp = t.split( "\n" );
	var nlines = sp.length;
	for( var i = 0; i < nlines; i++ ) {
	    var line = sp[i];
	    if( line.match( /^\s*s:/i ) ) {
		var alignLines = new Array();
		alignLines[alignLines.length] = new Object();
		alignLines[alignLines.length-1].idx = i;
		var s1 = line.split( /\s\s*/ );
		var s2 = new Array();
		for(var si = 0; si < s1.length; si++ ) {
		    if( si == 1 && s1[si].match( /".*"/ )) {
			s2[s2.length-1] += " ";
			s2[s2.length-1] += s1[si];
		    }
		    else if( si > 0 && (s1[si] == '|' || s1[si] == '||' || s1[si] == "(" || s1[si] == ")" ) ) {
			s2[s2.length-1] += " ";
			s2[s2.length-1] += s1[si];
		    }
		    else
		    	s2[s2.length] = s1[si];

		}
		alignLines[alignLines.length-1].str = s2;

		for( var j = i+1; j < nlines; j++ ) {
		    line = sp[j];
		    if( line.match( /^\s*$/) ) 
			continue;
		    if( line.match( /^\s*l:/i ) ) {
			alignLines[alignLines.length] = new Object();
			alignLines[alignLines.length-1].idx = j;
			alignLines[alignLines.length-1].str = line.split( /\s\s*/ );
		    }
		    else
			break;
		}
		if( alignLines.length > 1 ) {
		    // need 
		    var idx = 0;
		    var nAlignLines = alignLines.length;
		    var a  = 0;
		    while( true ) {
			var len = 0;
			for(a = 0; a < nAlignLines; a++) {
			    var ar = alignLines[a].str;
			    if( idx >= ar.length )
				continue;
			    var al = ar[idx].length;
			    if( al > len ) len = al;
			}
			if( len == 0 ) break;
			for(a = 0; a < nAlignLines; a++) {
			    var ar = alignLines[a].str;
			    if( idx >= ar.length )
				continue;
			    var al = ar[idx].length;
			    if( al < len ) {
				var nspaces = len-al;
				for(var adj = 0; adj < nspaces; adj++ ) {
				    ar[idx] += ' ';
				}
			    }
			}
			idx++;
		    }
		    for(a = 0; a < nAlignLines; a++) {
			sp[alignLines[a].idx] = alignLines[a].str.join(" ");
		    }
		}
		if( alignLines.length > 1 ) {
		    i = alignLines[alignLines.length-1].idx;
		}	
	    }
	}
	o.value = sp.join( "\n" );
    }
}
/**
 * @class
 * the import/edit raw contents form
 */
@class
the import/edit raw contents form
@class the import / edit raw contents form
function ImportForm()
{
    this.onOK = function() {
	var v = this.fTextArea.value;
	var t = v.replace(/^\s+|\s+$/, '');
	if( t == "" ) {
	    alert("nothing specified!");
	    return;
	}
	else if( v == this.fOrigContents ) {
	    this.hide();
	    return;
	}
	var r = Song.prototype.fromRawText(t);
	if( r == null || r.fResult == null )
	    return;
	var song = r.fResult;
	this.hide();
	if( theSongView ) {
	    var c = theSongView.getContents();
	    if( c != null ) {
		c.parentNode.removeChild(c);
	    }
	    createSong(editorWorkspace, song, false);
	}
    }
    this.onShow = function() {
	var o = document.getElementById("importform_ok");
	Utils.addToIdMap(o, this); 
	o = document.getElementById("importform_cancel");
	Utils.addToIdMap(o, this); 
	var t = theSongView.getModel().getRawContents();
	if(!t ) t = "";
	this.fOrigContents = t;
	o = document.getElementById("ieform_textarea");
	o.value = t;
	Utils.addToIdMap(o, this);
	this.fTextArea = o;
    }
    this.provideContent = function() {
	var d = document.createElement("div");
	var s;
	s    = '<table style="overflow:auto;"><tr><td><span><b>Enter/edit contents in raw format:</b></span>';
	s    += '<tr><td>';
	s    += '<textarea id="ieform_textarea" style="word-wrap:normal;" name="textarea" type="textarea" rows="30" cols="100"></textarea>';
	s    += '<tr><td>';
	s    += '<tr><td>';
	s    += '<div><center>';
	s    += '<input id="importform_cancel" name="align" type="button" value="Align" onclick="onImportFormAlign(this)"> &nbsp;';
	s    += '<input id="importform_ok" name="ok" type="button" value="&nbsp;OK&nbsp;" onclick="onImportFormOK(this)"> &nbsp;';
	s    += '<input id="importform_cancel" name="cancel" type="button" value="Cancel" onclick="onImportFormCancel(this)">';
	s    += '</center>';
	s    += '</div>';
	s    += '</table>';
	d.innerHTML = s;
	d.style.overflow = "auto";
	return d;
    }
    this.align = function() {
	o = document.getElementById("ieform_textarea");
	var t = o.value;
	var sp = t.split( "\n" );
	var nlines = sp.length;
	for( var i = 0; i < nlines; i++ ) {
	    var line = sp[i];
	    if( line.match( /^\s*s:/i ) ) {
		var alignLines = new Array();
		alignLines[alignLines.length] = new Object();
		alignLines[alignLines.length-1].idx = i;
		var s1 = line.split( /\s\s*/ );
		var s2 = new Array();
		for(var si = 0; si < s1.length; si++ ) {
		    if( si == 1 && s1[si].match( /".*"/ )) {
			s2[s2.length-1] += " ";
			s2[s2.length-1] += s1[si];
		    }
		    else if( si > 0 && (s1[si] == '|' || s1[si] == '||' || s1[si] == "(" || s1[si] == ")" ) ) {
			s2[s2.length-1] += " ";
			s2[s2.length-1] += s1[si];
		    }
		    else
		    	s2[s2.length] = s1[si];
		}
		alignLines[alignLines.length-1].str = s2;
		for( var j = i+1; j < nlines; j++ ) {
		    line = sp[j];
		    if( line.match( /^\s*$/) ) 
			continue;
		    if( line.match( /^\s*l:/i ) ) {
			alignLines[alignLines.length] = new Object();
			alignLines[alignLines.length-1].idx = j;
			alignLines[alignLines.length-1].str = line.split( /\s\s*/ );
		    }
		    else
			break;
		}
		if( alignLines.length > 1 ) {
		    var idx = 0;
		    var nAlignLines = alignLines.length;
		    var a  = 0;
		    while( true ) {
			var len = 0;
			for(a = 0; a < nAlignLines; a++) {
			    var ar = alignLines[a].str;
			    if( idx >= ar.length )
				continue;
			    var al = ar[idx].length;
			    if( al > len ) len = al;
			}
			if( len == 0 ) break;
			for(a = 0; a < nAlignLines; a++) {
			    var ar = alignLines[a].str;
			    if( idx >= ar.length )
				continue;
			    var al = ar[idx].length;
			    if( al < len ) {
				var nspaces = len-al;
				for(var adj = 0; adj < nspaces; adj++ ) {
				    ar[idx] += ' ';
				}
			    }
			}
			idx++;
		    }
		    for(a = 0; a < nAlignLines; a++) {
			sp[alignLines[a].idx] = alignLines[a].str.join(" ");
		    }
		}
		if( alignLines.length > 1 ) {
		    i = alignLines[alignLines.length-1].idx;
		}	
	    }
	}
	o.value = sp.join( "\n" );
    }
}
function ImportForm ( ) { this . onOK = function ( ) { var v = this . fTextArea . value ; var t = v . replace ( / ^\s+|\s+$ / , '' ) ; if ( t == "" ) { alert ( "nothing specified!" ) ; return ; } else if ( v == this . fOrigContents ) { this . hide ( ) ; return ; } var r = Song . prototype . fromRawText ( t ) ; if ( r == null || r . fResult == null ) return ; var song = r . fResult ; this . hide ( ) ; if ( theSongView ) { var c = theSongView . getContents ( ) ; if ( c != null ) { c . parentNode . removeChild ( c ) ; } createSong ( editorWorkspace , song , false ) ; } } this . onShow = function ( ) { var o = document . getElementById ( "importform_ok" ) ; Utils . addToIdMap ( o , this ) ; o = document . getElementById ( "importform_cancel" ) ; Utils . addToIdMap ( o , this ) ; var t = theSongView . getModel ( ) . getRawContents ( ) ; if ( ! t ) t = "" ; this . fOrigContents = t ; o = document . getElementById ( "ieform_textarea" ) ; o . value = t ; Utils . addToIdMap ( o , this ) ; this . fTextArea = o ; } this . provideContent = function ( ) { var d = document . createElement ( "div" ) ; var s ; s = '<table style="overflow:auto;"><tr><td><span><b>Enter/edit contents in raw format:</b></span>' ; s += '<tr><td>' ; s += '<textarea id="ieform_textarea" style="word-wrap:normal;" name="textarea" type="textarea" rows="30" cols="100"></textarea>' ; s += '<tr><td>' ; s += '<tr><td>' ; s += '<div><center>' ; s += '<input id="importform_cancel" name="align" type="button" value="Align" onclick="onImportFormAlign(this)"> &nbsp;' ; s += '<input id="importform_ok" name="ok" type="button" value="&nbsp;OK&nbsp;" onclick="onImportFormOK(this)"> &nbsp;' ; s += '<input id="importform_cancel" name="cancel" type="button" value="Cancel" onclick="onImportFormCancel(this)">' ; s += '</center>' ; s += '</div>' ; s += '</table>' ; d . innerHTML = s ; d . style . overflow = "auto" ; return d ; } this . align = function ( ) { o = document . getElementById ( "ieform_textarea" ) ; var t = o . value ; var sp = t . split ( "\n" ) ; var nlines = sp . length ; for ( var i = 0 ; i < nlines ; i ++ ) { var line = sp [ i ] ; if ( line . match ( / ^\s*s: / i ) ) { var alignLines = new Array ( ) ; alignLines [ alignLines . length ] = new Object ( ) ; alignLines [ alignLines . length - 1 ] . idx = i ; var s1 = line . split ( / \s\s* / ) ; var s2 = new Array ( ) ; for ( var si = 0 ; si < s1 . length ; si ++ ) { if ( si == 1 && s1 [ si ] . match ( / ".*" / ) ) { s2 [ s2 . length - 1 ] += " " ; s2 [ s2 . length - 1 ] += s1 [ si ] ; } else if ( si > 0 && ( s1 [ si ] == '|' || s1 [ si ] == '||' || s1 [ si ] == "(" || s1 [ si ] == ")" ) ) { s2 [ s2 . length - 1 ] += " " ; s2 [ s2 . length - 1 ] += s1 [ si ] ; } else s2 [ s2 . length ] = s1 [ si ] ; } alignLines [ alignLines . length - 1 ] . str = s2 ; for ( var j = i + 1 ; j < nlines ; j ++ ) { line = sp [ j ] ; if ( line . match ( / ^\s*$ / ) ) continue ; if ( line . match ( / ^\s*l: / i ) ) { alignLines [ alignLines . length ] = new Object ( ) ; alignLines [ alignLines . length - 1 ] . idx = j ; alignLines [ alignLines . length - 1 ] . str = line . split ( / \s\s* / ) ; } else break ; } if ( alignLines . length > 1 ) { var idx = 0 ; var nAlignLines = alignLines . length ; var a = 0 ; while ( true ) { var len = 0 ; for ( a = 0 ; a < nAlignLines ; a ++ ) { var ar = alignLines [ a ] . str ; if ( idx >= ar . length ) continue ; var al = ar [ idx ] . length ; if ( al > len ) len = al ; } if ( len == 0 ) break ; for ( a = 0 ; a < nAlignLines ; a ++ ) { var ar = alignLines [ a ] . str ; if ( idx >= ar . length ) continue ; var al = ar [ idx ] . length ; if ( al < len ) { var nspaces = len - al ; for ( var adj = 0 ; adj < nspaces ; adj ++ ) { ar [ idx ] += ' ' ; } } } idx ++ ; } for ( a = 0 ; a < nAlignLines ; a ++ ) { sp [ alignLines [ a ] . idx ] = alignLines [ a ] . str . join ( " " ) ; } } if ( alignLines . length > 1 ) { i = alignLines [ alignLines . length - 1 ] . idx ; } } } o . value = sp . join ( "\n" ) ; } }
@class
 the import/edit raw contents form
@class the import / edit raw contents form
// nothing changed.
 // delete current view
 /**
     * override of {@link Form#provideContent} to provide content of
     * the form
     */ // need 
