// JavaScript Document

// Constants
var SENTENCES_MAX = 12;

// global
var searcher;
var draggableImages = new Array();
// var draggableImage;
var zIndex = 0;
var AVATAR_RUNS = 4;
var AVATAR_RUN_WIDTH = 901;
var AVATAR_RUN_HEIGHT = 501;
var AVATAR_RUN_DURATION = 3;


function avatarMove(){
	// alert('greg is brilliant');
	// while(true){
		// new Effect.Move('avatar2', { x: 20, y: 100, mode: 'relative' });
		// new Effect.Pulsate('avatar2', { pulses: 5, duration: 1.5 });
		// new Effect.Move('avatar2', { x: 20, y: 100, mode: 'absolute', duration:10 });
		// new Effect.Move('avatar2', { x: 20, y: 100, mode: 'absolute', duration:10 });

		// new Effect.MoveBy('avatar2', {20, 100, 'mode', });
		
		// works great!
		// new Effect.Move('avatar2', { x: -800, y: 230, mode: 'relative', queue: 'end', duration:3 });
		// new Effect.Move('avatar2', { x: 800, y: -230, mode: 'relative', queue: 'end', duration:3  });
		// new Effect.Move('avatar2', { x: -500, y: 100, mode: 'relative', queue: 'end', duration:3  });



		// works great
		// new Effect.Move('avatar2', { x: 30, y: 100, mode: 'absolute', queue: 'end', duration:3 });
		// 	new Effect.Move('avatar2', { x: 800, y: 200, mode: 'absolute', queue: 'end', duration:3  });
		// 	new Effect.Move('avatar2', { x: 40, y: 500, mode: 'absolute', queue: 'end', duration:3  });


		
		for( var i = 0; i < AVATAR_RUNS; i++ ){
			// alert(i);

			var xCoordinate = Math.floor(Math.random()*AVATAR_RUN_WIDTH);
			var yCoordinate = Math.floor(Math.random()*AVATAR_RUN_HEIGHT);

			new Effect.Move('avatar2', { x: xCoordinate, y: yCoordinate, mode: 'absolute', queue: 'end', duration:AVATAR_RUN_DURATION  });
			
		}
		new Draggable( 'avatar2' );	

		
		// setTimeout( new Effect.Move('avatar2', { x: -200, y: -50, mode: 'absolute'}), 1 );
		
		// new Effect.Move('avatar2', { x: -200, y: -50, mode: 'relative'});
		// new Effect.Move('avatar2', { x: 70, y: 200, mode: 'relative'  });
		// new Effect.Move('avatar2', { x: -100, y: -80, mode: 'relative' });
		// new Effect.Move('avatar2', { x: 90, y: 50, mode: 'relative'  });
		
		
	// }
	
}

function imagesDraggable()
{
	// alert('greg is really brilliant');
	
	var imagesDraggable = document.getElementById("imagesDraggable");
	// var imagesDraggableOld = document.getElementById("imagesDraggableOld");
	
	imagesDraggable.style.display = "block";
	// imagesDraggableOld.style.display = "block";
	
	// imagesDraggableOld.innerHTML += imagesDraggable.innerHTML;
	// imagesDraggable.innerHTML = "";
	
	// randomNumber = 
	var randomnumber=Math.floor(Math.random()*10001);
	
	// left:100px;
	// top:150px;
	
	var shiftUpImagesLength = zIndex * 640;
	zIndex = zIndex + 1;
	
	for(var i=0; i < 8; i++){
		imagesDraggable.innerHTML += "<img id='image" + (randomnumber + i) + "' class='imageDraggable' src='" + searcher.results[i].tbUrl +"' style='padding:20px; z-index:" + zIndex + "; position:relative; top:-" + shiftUpImagesLength + "px' alt='image'/>";
	}

	for(var i=0; i < 8; i++){
		var imageName = 'image' + (randomnumber + i);
		// alert(imageName);
		// draggableImage = new Draggable('image' + (randomnumber + i));	
		// var draggableImage = new Draggable( imageName );	
		// draggableImages.push( draggableImage );	
		draggableImages.push( imageName );	
	}
	setDraggableNames();
	
}

function setDraggableNames(){
	for(var i=0; i < draggableImages.length; i++){
		new Draggable( draggableImages[i] );	
	}
}

function customMark()
{
	unmarkCloudWord();
	// markCustomWords();
	markCustom();
}

function markCustom(){
	var customWords=document.getElementById("custom_wordlist_textarea").value;

	var cloud=document.getElementById("htmltagcloud");	
	var children = cloud.childNodes;
		
	for( var i = 0; i < children.length; i++ )
	{
		if( children[i].nodeType == 1 /* Node.ELEMENT_NODE */  ){

			var cloudWord = children[i].innerHTML;
			cloudWord = cloudWord.replace("\n", "");
			cloudWord = cloudWord.replace("\r", "");


			var pattern = new RegExp( "\\b" + cloudWord + "\\b", 'i'  );

			if( pattern.test( customWords ) ){			

				children[i].className += " academicword";			
			
			}			
		}
	}

}


function unmarkCloudWord(){

	var cloud=document.getElementById("htmltagcloud");
	
	
	var children = cloud.childNodes;
	
	for( var i = 0; i < children.length; i++ )
	{
		if( children[i].nodeType == 1 /* Node.ELEMENT_NODE */  ){
			var classString = children[i].className;
			classString = classString.replace(/academicword/gi, " ");			
			children[i].className = classString;
			
		}
	}
	
}




function changeTagVisualize(word)
{
	//writeUsageExample(word); 
	getExampleSentences(word);
	//	changeIframe('http://www.wordsift.com/index.php/tagcloud/visual/' + word); 
	//changeIframe('http://www.wordsift.com/visualize/visualthesaurus/' + word); 
	changeVisualThesaurus(word);
	changeWord(word);
	// add highlight effect here?
	// new Effect.Highlight('htmltagcloud',{});
	// new Effect.Shake('htmltagcloud',{});
	//new Effect.Shake('word_' + word,{});
	new Effect.Shake('word_' + word,{ distance: 10 });
	new Effect.Highlight('apiBoxesBig',{});
	new Effect.Highlight('usageTitleDiv',{});	
	new Effect.Highlight('usageDiv',{});	
}

function changeVisualThesaurus(word)
{
	// document.getElementById('visualthe').innerHTML = 
	// 	'<script src="http://www.visualthesaurus.com/vtembed.do?s=3&width=420&height=600&bgcolor=FFFFFF&up_lang=en&up_st=c&up_word=' + word + '"></script>';

	document.getElementById('visualthe').innerHTML =
	'<iframe id="iframe" src="/visualize/visualthesaurus/' + word + '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>' 

}

function getExampleSentences(word)
{
	// alert(word);
 	var usageExample = "<div id='exampleSentences'>'<span id='usageSearchWord'>" + capitalize(word) + "</span>'</div>";
	usageExample += getSentenceListing(word);
	var usageDiv = document.getElementById('usageDiv');
	usageDiv.innerHTML = usageExample;
}

function getSentenceListing(word)
{
	//return "<div class='usageExample'>greg is brilliant</div><div class='usageExample'>greg is brilliant</div>";
	//return document.getElementById('sourceTextHiddenDiv').innerHTML;
	var sourceText = document.getElementById('sourceTextHiddenDiv').innerHTML;
	sourceText = sourceTextStripQuotes(sourceText); // remove quotes
	var sourceTextArray = sourceText.split(". ");
	sourceTextArray = appendPeriod(sourceTextArray);
	var sentenceListing = appendSentencesMatchWord(sourceTextArray, word);
	// var sentenceListing = appendSentenceDiv(sourceTextArray[0]) + appendSentenceDiv(sourceTextArray[1]);
	return sentenceListing;
}

function sourceTextStripQuotes(sourceText)
{
	sourceText = sourceText.replace(/'/g, "");
	sourceText = sourceText.replace(/"/g, "");	
	return sourceText;
}

function appendSentencesMatchWord(sourceTextArray, word)
{
	//var sentenceListing = appendSentenceDiv(sourceTextArray[0]) + appendSentenceDiv(sourceTextArray[1]);
	var sentenceListing = "";
	var count = 0;
	var x;
	for(x in sourceTextArray)
	{
		sentenceMatchResult = getSentenceIfMatch( sourceTextArray[x], word ); 
		sentenceListing += sentenceMatchResult;
		// sentenceListing += appendSentenceDiv( sourceTextArray[x] );
		
		if(sentenceMatchResult != "") count++;
		if(count >= SENTENCES_MAX) return sentenceListing; 
	}
	
	return sentenceListing;
}

// if pattern match, return sentence (after add appended div, and append span on target word)
function getSentenceIfMatch( sentence, word )
{
	var sentenceDiv;
	var pattern = new RegExp(word.toLowerCase());
	
	if( pattern.test( sentence.toLowerCase()) && sentence.length > 25 )
	{
		sentenceDiv = getSentenceDiv( sentence, word );
		return sentenceDiv;
		// var sentenceHighlightedWord = sentenceHighlightWord(sentence, word);
		// return appendSentenceDiv( sentenceHighlightedWord );		
		// return sentence + '<br />';		
	}
	else
	{
		return "";
	}
}

function getSentenceDiv( sentence, word )
{
	var sentenceHighlighted = getSentenceHighlighted( sentence, word );
	var sentenceDiv = getSentenceHighlightedDiv( sentence, sentenceHighlighted, word );
	return sentenceDiv;
	// return sentenceHighlighted;
}

function getSentenceHighlightedDiv( sentence, sentenceHighlighted, word )
{
	var sentenceShowSource = "<div class='usageExample' onclick='showSource(";
	sentenceShowSource += '"' + sentence + '"';
	sentenceShowSource += ', "' + word + '"';
	sentenceShowSource += ")'>";
	sentenceShowSource += sentenceHighlighted;
	sentenceShowSource += "</div>";

	return( sentenceShowSource );
}

function getSentenceHighlighted( sentence, word )
{
	sentence = sentence.replace(word, "<span class='searchWordFound'>" + word + "</span>");
	
	wordCapitalize = capitalize(word);
	sentence = sentence.replace(wordCapitalize, "<span class='searchWordFound'>" + wordCapitalize + "</span>");
	
	return sentence;	
}

function appendPeriod(sourceTextArray)
{
	var x;
	for(x in sourceTextArray)
	{
		sourceTextArray[x] +=  ".";
	}
	return sourceTextArray;
}

function gregb()
{
	alert("greg is brilliant!!!");	
}

function changeIframe(url)
{
	document.getElementById('iframe').src=url;
}

function changeWord(word)
{
	var searchControl = new google.search.SearchControl();
	searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);

						  // Add in a full set of searchers
	var options = new google.search.SearcherOptions();
    options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
	
	searcher = new google.search.ImageSearch();
	searcher.setRestriction(google.search.Search.RESTRICT_SAFESEARCH,
                        google.search.Search.SAFESEARCH_STRICT);

	searchControl.addSearcher(searcher, options);

	options = new google.search.SearcherOptions();
	//options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
	options.setExpandMode(google.search.SearchControl.EXPAND_MODE_CLOSED);
	searchControl.addSearcher(new google.search.VideoSearch(), options);
			  
	searchControl.draw(document.getElementById("searchcontrol"));
	searchControl.execute(word);
}

	
	
function capitalize(word)
{			
	return (word.charAt(0).toUpperCase() + word.substr(1).toLowerCase());
}

function OnLoad() {
	changeWord(document.getElementById('queryHiddenDiv').innerHTML);
	getExampleSentences(document.getElementById('visualWordHiddenDiv').innerHTML);
}

function hideSource()
{
	var sourceTextBox = document.getElementById('sourceTextBox');
	sourceTextBox.style.display = 'none';	
}

function collapse()
{
	hideSource();
	location.href = '#usageBoxDiv';
}

function showSource(sentenceOrginial, searchWord)
{
	var sourceText = document.getElementById('sourceTextHiddenDiv').innerHTML;
	var sourceTextContext = document.getElementById('sourceTextContext');
	var sourceTextBox = document.getElementById('sourceTextBox');
	
	sourceTextBox.style.display = 'block';
	
	var searchSentence = sentenceOrginial;
	var sentenceReplace = getSentenceReplaceInSource( sentenceOrginial, searchWord );
	var sourceTextUsage  = sourceText.replace(searchSentence, sentenceReplace);
	sourceTextContext.innerHTML = sourceTextUsage;
	location.href = '#searchSentence';
	window.scrollBy(100,-200);
}

function getSentenceReplaceInSource( sentenceOrginial, searchWord )
{
	var sentenceHighlightTargetWord = sentenceOrginial.replace(searchWord, '<span class="searchWordSourceTarget">' + searchWord + '</span>');
	var sentenceHighlightTargetWord = sentenceHighlightTargetWord.replace(capitalize(searchWord), '<span class="searchWordSourceTarget">' + capitalize(searchWord) + '</span>');
	
	var sentenceReplace = "<span class='searchSentenceFound' id='searchSentence'>"; 
	sentenceReplace += sentenceHighlightTargetWord;
	sentenceReplace += "</span>";	
	sentenceReplace += "<span onclick='collapse();' class='collapse'> <img class='backArrow' src='/images/backArrowWordsift.png' alt='back' /> </span>";
	
	return sentenceReplace
}


function inputExampleSource()
{
	//alert('greg is brilliant');
	
	var exampleSourceText = '  RECONSTRUCTING THE KING LEGACY:  SCHOLARS AND NATIONAL MYTHS  Clayborne Carson  The modern black freedom struggle transformed my life, as it did the lives of many other young people. I became aware that young black students such as myself might transform America and assume new, previously unimaginable social roles. This awareness inspired my own political activism and altered my sense of racial identity and destiny. It also transformed my understanding of the black struggle as I absorbed its emergent values and began to understand its place within an previously-obscured African-American past.  I am now sometimes asked whether my previous participation in the struggle interferes with my ability to write about it. The question is meaningless because the struggle revealed the kind of history I wanted to write about. The experiences that brought me to the Capitol Historical Society conference on Martin Luther King, Jr. can be traced to another day more than two decades earlier when I participated in my initial civil rights demonstrations and saw King for the first time.  In 1963, after completing my freshman year in college, I joined the multitudes at the March on Washington. It was a wonderful introduction to the struggle, culminating in a major historical event, King "I Have a Dream" speech, but also punctuated with those unrecorded occurrences that forever separate history as lived from history as reconstructed by historians. The impact of the march was heightened by my initial encounters, a few days earlier, with the brash young activists of the Student Nonviolent Coordinating Committee (SNCC). Participating in the march was the most politically unconventional thing I had ever done, but the meaning I attached to my involvement was shaped when Stokely Carmichael gratuitously informed me that the event was only a sanitized, middle-class version of the real black movement, which was occurring in places such as Albany, Georgia; Cambridge, Maryland; Danville, Virginia; and the Mississippi Delta. Having just emerged from the racial isolation of New Mexico, I was not yet ready to venture into the deep South battlefields where Carmichael and other SNCC workers confronted racist authorities.  For me the Washington "picnic" was an epiphany. During that one day I saw more black people than I had seen in my life. Exposed to the constantly widening range of views among activists, I saw black politics differently than before. I will never forget King oration, but my enthusiasm was tempered by the militancy of SNCC workers, represented at the march in John Lewis caustic speech, given shortly before King s. The very fact that SNCC existed showed me that King was only one aspect of a multi-faceted social movement.  Today, after years of political activism and ivory-tower reflection, I have now come full circle, returning to the capital to take part in another occasion dominated by King. After spending the first years of my professional life studying SNCC, I have now -- as editor of King papers -- turned my scholarly attention to the person who was often seen as the anti-thesis of SNCC notion of leadership from the bottom up. Having once sympathized with the young SNCC militants who were my age when they challenged King, who was then fifteen years my senior, I currently find my sympathies have shifted somewhat as I study King, who, when he died, was younger than I am now.  During the last half of the 1960s, my own youthful impatience and a measure of arrogance led me to agree with some of SNCC criticisms of King moderation and his firm commitment to integration and nonviolence as a way of life. In subsequent years, acknowledgment that the black power movement failed to achieve much power, or even much racial unity, has fostered a greater degree of humility in my assessment of King alternative course. For me and for many of his youthful critics, King became wiser as we grew older. My changing views of him have been affected not only by my personal experiences, but also by the unique opportunity I have had to study the strengths and limitations of the black movement foremost leader and its little-known shock troops.  ****  King status as the main symbol of the modern African-American freedom struggle has now been sanctioned by the creation a federal holiday honoring his birth. Given this formal recognition of his historical importance, it becomes more difficult, yet also more necessary, for those of us who study and carry on King work to counteract innocuous, carefully-cultivated image that is honored in annual  observances. The historical King was far too interesting to be encased in simplistic, didactic legends designed to offend no one -- a black counterpart to the static, heroic myths that have embalmed George Washington as the Father of His Country and Abraham Lincoln as the Great Emancipator. King was an exceptionally gifted, fascinating, and courageous individual who challenged authority and took controversial stands, such as opposing American intervention in Vietnam and mobilizing the Poor People Campaign of 1968. He was also a leader best understood in the context of African-American history and as the product of the social movements that he has come to symbolize.  Serious students of King and of the black struggle have recognized their responsibility to understand both the nature and sources King ideas and the historical significance and social impact of those ideas. Contemporary biographers, theologians, political scientists, sociologists, philosophers, social psychologists, and historians, many of whom are participants in this symposium, are in the process of constructing a comprehensive assessment of King that takes into account his unique qualities and experiences as well as his representative ones. The recent Pulitzer-prize-winning work of David J. Garrow and Taylor Branch have illustrated benefits of studies that combine biographical investigation combined with efforts to understand larger issues of social and historical context.1 These and other contemporary writers may benefit from and stimulate the popular interest in King spurred by the national holiday, but their probing research and critical analyses serve as a necessary corrective against myth making. This symposium provides an opportunity to acknowledge and assess this outpouring of reflective and critical works about King and to place these works within the broader literature of African-American freedom struggles throughout history.  1 David J. Garrow, Bearing the Cross: Martin Luther King, Jr., and the Southern Christian Leadership Conference (New York: William Morrow, 1986); Taylor Branch, Parting the Waters:  Continued interest in King life is justified by his exceptional abilities and his undeniable historical importance, but even biographical studies have displayed increasing sophistication regarding the relationship between the exceptional personal qualities King brought to his leadership role and the social context in which he developed and displayed his leadership abilities. More recent biographies have taken on the task of critically assessing leadership and intellectual qualities. August Meier 1965 essay on King and David Lewis King: A Critical Biography, published in 1970, broke new ground in their acknowledgment of King limitations as well as achievements as a civil rights leader. Both scholars saw King as part of a broader social movement that included important factions that forcefully challenged his leadership.  Recent scholarship of King leadership has displayed a growing understanding of the interplay between King exceptional oratorical abilities and the expectations and understandings of his various audiences. The King myth emphasizes his supposedly charismatic qualities as an explanation for his unique role in the struggle. Although the term "charisma" has traditionally referred to the godlike, magical qualities possessed by a certain "ideal type" of leader, in our more secular age it has lost many of its religious connotations and now refers to a wide range of leadership styles that involve the capacity to inspire -- usually through oratory -- emotional bonds between leaders and followers. Arguing that King was not a charismatic leader in the broadest sense of the term, becomes somewhat akin to arguing that he was not a Christian, but emphasis on King charisma obscures other important aspects of his role in the black movement. To be sure, King oratory was exceptional and many people saw King as a divinely inspired leader, but King did not receive and did not want the kind of unquestioning support that is often associated with charismatic leaders. He was a profound and provocative public speaker as well as an emotionally powerful one. Emphasis on King charisma conveys the misleading notion of a movement held together by spellbinding speeches and blind faith rather than by a tenuous blend of rational and emotional bonds.  Not only did King supposed charisma fail to place him above criticism, he was, to the contrary, never able to gain mass support for his notion of nonviolent struggle as a way of life, rather than simply a tactic. Most movement activists saw King not as their unquestioned commander but as the most prominent among many outstanding movement strategists, ideologues, theologians, and institutional leaders. King used charisma as a tool for mobilizing black communities, but he always used it in the context of other forms of intellectual and political leadership reflecting his academic training and suited to a movement containing many strong leaders. King undoubtedly recognized that charisma was one of many leadership qualities at his disposal, but he also recognized that charisma was not a sufficient basis for leadership in a modern political movement enlisting numerous self-reliant leaders. Moreover, he rejected aspects of the charismatic model that conflicted with his sense of his own limitations.  Rather than exhibiting unwavering confidence in his power and wisdom, King was a leader full of self-doubts, keenly aware of his own limitations and human weaknesses. He was at times reluctant to take on the responsibilities suddenly and unexpectedly thrust upon him. Scholars have only begun to understanding the significance of King evolving religious beliefs as a crucial foundation of his leadership abilities and political attitudes. David Garrow, for example, has stressed the importance of the "kitchen experience" during the Montgomery bus boycott in 1956, when King was overcome with fear as a result of threats to his life and to the lives of his wife and child. Rather than confident and secure in his leadership role, King was able to carry on only after acquiring an enduring understanding of his dependence on a personal God who promised never to leave him alone.9 Despite the fact that many King biographies have already been written, a full understanding of King unique qualities will require further investigation of his deep roots in the black Baptist church and of values he acquired during his formative years in Atlanta thriving black community.  9 King described this episode, which occurred on the evening of January 27, 1956, in a remarkable 1966 speech delivered in Chicago. See discussion in David Garrow, Bearing the Cross: Martin Luther King, Jr. and the Southern Christian Leadership Conference (New York: William Morrow, 1986), pp. 56-58. Although King biographies and King-centered studies of the black struggle continue to appear, serious writers have moved beyond hagiography and have challenged the notion of King as the modern black struggle initiator and indispensable leader. As in other historical myths, a Great Man is seen as the decisive factor in the process of social change, and the unique qualities of a leader are used to explain major historical events. The King myth departs from historical reality because it attributes too much to King exceptional leadership qualities as a leader and too little to the impersonal, large-scale social forces that made it possible for King to display his singular abilities on a national stage. Because the myth emphasizes King rather than his social context, it exaggerates King considerable contribution to the black advancement without acknowledging his indebtedness to other organizers and activists who set the stage for his appearance in a leading role. Scholars should avoid the extremes of, on the one hand, debunking efforts that unfairly diminish King achievements, and, on the other hand, King-centered accounts that attribute more to him that is warranted. Robert Clayborne Carson, "Reconstructing the King Legacy" Page 9 November 3, 2009  Moses apt metaphor, offered in his commentary, of the movement as "an ocean of consciousness" provides a framework for understanding the unique and considerable wave that was King leadership.  Scholars who examine King primarily as a civil rights leader must determine not only the nature of his ideas but also their social impact. Scholars analyzing King political ideas, especially his contributions to the Gandhian and African-American traditions of non-violent resistance, have often failed to determine the extent to which activists adopted King tactics and strategies.10 The importance of James H. Cone assessment at the symposium of King impact on Third World liberation movements is enhanced by his decision to describe not only what King said about those movements but also his effort to determine the impact of King ideas on Third World activists and leaders. Cone only begins to explore an issue that requires much further research, both abroad and at home: to what extent did King ideas actually guide the mass struggles he sought to influence? Implicitly assuming that King role in the movement was indispensable or at least crucial to its success, King-centered scholarship has unfortunately contributed to the popular but misleading notion that most movement activists were committed to King philosophy of nonviolence. Such scholarship has reinforced the tendency of many Americans to see King as not only the exemplar of modern black leaders, at least in the pre-Jesse-Jackson era, but as a charismatic figure who single-handedly directed the course of the civil rights movement.  10 See, for example, Hanes Walton, Jr., The Political Philosophy of Martin Luther King, Jr. (Westport, Conn.: Greenwood Press, 1971).  11 This new orientation is most clearly evident in studies of local movements, such as William H. Chafe, Civilities and Civil Rights: Greensboro, North Carolina, and the Black Struggle for Equality (New York, 1980); David R. Colburn, Racial Change and Community Crisis: St. Augustine, Florida, 1877-1980 (New York, 1985); Charles Fager, Selma 1965 (New York, 1974); Robert J. Norrell, Reaping the Whirlwind: The Civil rights Movement in Tuskegee (New York, 1985); John R. Salter, Jackson, Mississippi: An American Chronicle of Struggle and  Even the most perceptive King-centered studies will have limited value, unless they acknowledge that the black struggle was a locally-based mass movement rather than simply a reform movement led by national civil rights leaders.11 King was certainly not the only significant leader of the civil rights  Schism (Hicksville, N. Y., 1979). A movement from King-centered biographies to more broadly conceived studies is also evident in the best works on King and the SCLC: Taylor Branch, Parting the Waters: America in the King Years, 1954-63 (New York: Simon and Schuster, 1988); Adam Fairclough, To Redeem the Soul of America: The Southern Christian Leadership Conference and Martin Luther King, Jr. (Athens, Georgia, 1987); David J. Garrow, Bearing the Cross: Martin LUther King, Jr. and the Southern Christian Leadership Conference (New York, 1986); David L. Lewis, King: A Biography 2nd ed. (Champaign, Illinois, 1978); and Stephen B. Oates, Let the Trumpet Sound: The Life of Martin Luther King, Jr. (New York, 1982).  12 See Clayborne Carson, In Struggle: SNCC and the Black Awakening of the 1960s (Cambridge, Massachusetts, 1981); Howard Zinn, SNCC: The New Abolitionists 2nd ed. (Boston, 1965). movement, for sustained protest movements arose in many southern communities in which King had little or no direct involvement. In Montgomery, for example, local black leaders such as E. D. Nixon, Rosa Parks, and Jo Ann Robinson started the bus boycott before King became the leader of the Montgomery Improvement Association. Thus, although King inspired blacks in Montgomery and black residents recognized that they were fortunate to have such a spokesperson, talented local leaders other than King played decisive roles in initiating and sustaining the boycott movement. Similarly, the black students who initiated the 1960 lunch counter sit-in admired King, but they did not wait for him to act before launching their own movement. The sit-in leaders who founded the Student Nonviolent Coordinating Committee (SNCC) became increasingly critical of King leadership style, linking it to the feelings of dependency that often characterize the followers of charismatic leaders.12 The essence of SNCC approach to community organizing was to instill in local residents the confidence that they could lead their own struggles. A SNCC organizer failed if local residents became dependent on his or her presence; as the organizers put it, their job was to work themselves out of a job. Though King influenced the struggles that took place in the Black Belt regions of Mississippi, Alabama, and Georgia, those movements were also guided by self-reliant local leaders who occasionally called on King oratorical skills to galvanize black protesters at mass meetings while refusing to depend on his presence.  If King had never lived, the black struggle would have followed a course of development similar to the one it did. The Montgomery bus boycott would have occurred, because King did not initiate it. Black students probably would have  rebelled -- even without King as a role model -- for they had sources of tactical and ideological inspiration besides King. Mass activism in southern cities and voting rights efforts in the deep South were outgrowths of large-scale social and political forces, rather than simply consequences of the actions of a single leader. Though perhaps not as quickly and certainly not as peacefully or with as universal a significance, the black movement would probably have achieved its major legislative victories without King leadership, for the southern Jim Crow system was a regional anachronism, and the forces that undermined it were inexorable.  To what extent, then, did King presence affect the movement? Answering that question requires us to look beyond the usually portrayal of the black struggle. Rather than seeing an amorphous mass of discontented blacks acting out strategies determined by a small group of leaders, we would recognize King as a major example of the local black leadership that emerged as black communities mobilized for sustained struggles. If not as dominant a figure as sometimes portrayed, the historical King was nevertheless a remarkable leader who acquired the respect and support of self-confident, grass-roots leaders, some of whom possessed charismatic qualities of their own. Directing attention to the other leaders who initiated and emerged from those struggles should not detract from our conception of King historical significance; such movement-oriented research reveals King as a leader who stood out in a forest of tall trees.  King major public speeches--particularly the "I Have a Dream" speech--have received much attention, but his exemplary qualities were also displayed in countless strategy sessions with other activists and in meetings with government officials. King success as a leader was based respect for his intellectual and moral cogency and his skill as a conciliator among movement activists who refused to be simply King "followers" or "lieutenants."  The success of the black movement required the mobilization of black communities as well as the transformation of attitudes in the surrounding society, and King wide range of skills and attributes prepared him to meet the internal as well as the external demands of the movement. King understood the black world from a privileged position, having grown up in a stable family within a major black urban community; yet he also learned how to speak persuasively to the surrounding white world. Alone among the major civil rights leaders of his time,  King could not only articulate black concerns to white audiences, but could also mobilize blacks through his day-to-day involvement in black community institutions and through his access to the regional institutional network of the black church. His advocacy of nonviolent activism gave the black movement invaluable positive press coverage, but his effectiveness as a protest leader derived mainly from his ability to mobilize black community resources.  Analyses of the southern movement that emphasize its nonrational aspects and expressive functions over its political character explain the black struggle as an emotional outburst by discontented blacks, rather than recognizing that the movement strength and durability came from its mobilization of black community institutions, financial resources, and grass-roots leaders.13 The values of southern blacks were profoundly and permanently transformed not only by King, but also by involvement in sustained protest activity and community-organizing efforts as well as through thousands of mass meetings, workshops, citizenship classes, freedom schools, and informal discussions. Rather than merely accepting guidance from above, southern blacks were resocialized as a result of their movement experiences.  13 For incisive critiques of psychological analyses of the modern black struggle, see Doug McAdam, Political Process and the Development of Black Insurgency, 1930-1970 (Chicago, 1982); and Aldon D. Morris, The Origins of the Civil Rights Movement: Black Communities Organizing for Change (New York, 1984). Although the literature of the black struggle has traditionally paid little attention to the intellectual content of black politics, movement activists of the 1960s made a profound, though often ignored, contribution to political thinking. King may have been born with rare potential, but his most significant leadership attributes were related to his immersion in, and contribution to, the intellectual ferment that has always been an essential part of Afro-American freedom struggles. Those who have written about King have too often assumed that his most important ideas were derived from outside the black struggle--from his academic training, his philosophical readings, or his acquaintance with Gandhian ideas. Scholars are only beginning to recognize the extent to which his attitudes and those of many other activists, white and black, were transformed through their  involvement in a movement in which ideas disseminated from the bottom up was well as from the top down.  Although such a movement-center perspective of King role in the black struggles of his time reduces him to human scale, it also increases the possibility that others may recognize his qualities in themselves. Idolizing King lessens one ability to exhibit some of his best attributes or, worse, encourages one to become a debunker, emphasizing King flaws in order to lessen the inclination to exhibit his virtues. King himself undoubtedly feared that some who admired him would place too much faith in his ability to offer guidance and overcome resistance, for he often publicly acknowledged his own limitations and mortality. Near the end of his life, King expressed his certainty that black people would reach the Promised Land whether or not he was with them. His faith was based on an awareness of the qualities that he knew he shared with all people. When he suggested his own epitaph, he asked not to be remembered for his exceptional achievements-- his Nobel Prize and other awards, his academic accomplishments; instead, he wanted to be remembered for giving his life to serve others, for trying to be right on the war question, for trying to feed the hungry and clothe the naked, for trying to love and serve humanity. "I want you to say that I tried to love and serve humanity."14 Those aspects of King life did not require charisma or other superhuman abilities.  14 "The Drum Major Instinct," February 4, 1968, in James Melvin Washington, ed., A Testament of Hope: The Essential Writings of Martin Luther King, Jr. (San Francisco, 1986), p. 267. If King were alive today, he would doubtless encourage those who celebrate his life to recognize their responsibility to struggle as he did for a more just and peaceful world. He would prefer that the black movement be remembered not only as the scene of his own achievements, but also as a setting that brought out extraordinary qualities in many people. If he were to return, his oratory would be unsettling and intellectually challenging rather than remembered diction and cadences. He would probably be the unpopular social critic he was on the eve of the Poor People campaign rather than the object of national homage he became after his death. His basic message would be the same as it was when he was alive, for he did not bend with the changing political winds. He would talk of ending  poverty and war and of building a just social order that would avoid the pitfalls of competitive capitalism and repressive communism. He would give scant comfort to those who condition their activism upon the appearance of another King, for he recognized the extent to which he was a product of the movement that called him to leadership.  The notion that appearances by Great men (or Great Women) are necessary preconditions for the emergence of major movements for social changes reflects not only a poor understanding of history, but also a pessimistic view of the possibilities for future social change. Waiting for the Messiah is a human weakness that is unlikely to be rewarded more than once in a millennium. Studies of the modern black freedom struggle offer support for an alternative optimistic belief that participants in social movements can develop dormant leadership abilities and collectively improve their lives.  Clayborne Carson is associate professor of history, Stanford University, and senior editor and director of the Martin Luther King, Jr. Papers Project, Martin Luther King, Jr. Center for Nonviolent Social Change and Stanford University. He wishes to thank Penny Russell, Rachel Bagby, Susan Carson, and other project staff members for their assistance.';
	//alert(exampleSourceText);
	var inputSourceTextarea = document.getElementById('source_sourcetext');
	inputSourceTextarea.value = exampleSourceText;
}


function inputExampleSourceTwo()
{
	//alert('greg is brilliant');
	
	var exampleSourceText = 'Evolution In biology, evolution is change in the genetic material of a population of organisms through successive generations. Although the changes produced in a single generation are normally small, the accumulation of these differences over time can cause substantial changes in a population, a process that can result in the emergence of new species. Similarities among species suggest that all known species descended from a common ancestor (or ancestral gene pool) through this process of gradual divergence.  The basis of evolution is the passing of genes from one generation to the next. Genes are what produce an organism inherited traits. These vary within populations, with organisms showing heritable differences (variation) in their traits. Evolution is the product of two opposing forces: processes that constantly introduce variation, and processes that make those variants become either more common or rare. New variation arises in two main ways: either from mutations in genes, or from the transfer of genes between populations and between species. New combinations of genes are also produced by genetic recombination, which can increase variation between organisms.  Two major mechanisms determine if variants will become more common or rare in a population. One is natural selection, a process whereby helpful traits (those that increase the chance of survival and reproduction) become more common in a population while harmful traits become increasingly rare. This occurs because individuals with advantageous traits are more likely to survive and reproduce, resulting in more individuals of the next generation inheriting those traits. Adaptations occur over many generations through successive, small, random changes in traits combined with natural selection of those variants best-suited for their environment. The other major mechanism driving evolution is genetic drift, an independent process that produces random changes in the frequency of traits in a population. Genetic drift results from the role that chance plays in whether a given trait will be passed on as individuals survive and reproduce.  Evolutionary biologists document the fact that evolution occurs, and also develop and test theories that explain its causes. The study of evolutionary biology began in the mid-nineteenth century, when research into the fossil record and the diversity of living organisms convinced most scientists that species changed over time.  However, the mechanism driving these changes remained unclear until the theories of natural selection were independently proposed by Charles Darwin and Alfred Wallace.  In 1859, Darwin seminal work On the Origin of Species brought the new theories of evolution by natural selection to a wide audience, leading to the overwhelming acceptance of evolution among scientists.  In the 1930s, Darwinian natural selection was combined with Mendelian inheritance to form the modern evolutionary synthesis, which connected the units of evolution (genes) and the mechanism of evolution (natural selection). This powerful explanatory and predictive theory has become the central organizing principle of modern biology, directing research and providing a unifying explanation for the diversity of life on Earth.  Evolution via Natural Selection Natural selection is the process by which genetic mutations that enhance reproduction become, and remain, more common in successive generations of a population. It has often been called a "self-evident" mechanism because it necessarily follows from three simple facts:   	Heritable variation exists within populations of organisms.  	Organisms produce more offspring than can survive.  	These offspring vary in their ability to survive and reproduce.  	 These conditions produce competition between organisms for survival and reproduction. Consequently, organisms with traits that give them an advantage over their competitors pass these advantageous traits on, while traits that do not confer an advantage are not passed on to the next generation.   The central concept of natural selection is the evolutionary fitness of an organism.  Fitness is measured by an organism ability to survive and reproduce, which determines the size of its genetic contribution to the next generation.  However, fitness is not the same as the total number of offspring: instead fitness is indicated by the proportion of subsequent generations that carry an organism genes.  For example, if an organism could survive well and reproduce rapidly, but its offspring were all too small and weak to survive, this organism would make little genetic contribution to future generations and would thus have low fitness. If an allele increases fitness more than the other alleles of that gene, then with each generation this allele will become more common within the population. These traits are said to be "selected for". Examples of traits that can increase fitness are enhanced survival, and increased fecundity. Conversely, the lower fitness caused by having a less beneficial or deleterious allele results in this allele becoming rarer — they are "selected against".  Importantly, the fitness of an allele is not a fixed characteristic, if the environment changes, previously neutral or harmful traits may become beneficial and previously beneficial traits become harmful.  However, even if the direction of selection does reverse in this way, traits that were lost in the past may not re-evolve in an identical form.  Natural selection within a population for a trait that can vary across a range of values, such as height, can be categorized into three different types. The first is directional selection, which is a shift in the average value of a trait over time — for example organisms slowly getting taller.  Secondly, disruptive selection is selection for extreme trait values and often results in two different values becoming most common, with selection against the average value. This would be when either short or tall organisms had an advantage, but not those of medium height. Finally, in stabilizing selection there is selection against extreme trait values on both ends, which causes a decrease in variance around the average value and less diversity.  This would, for example, cause organisms to slowly become all the same height.  A special case of natural selection is sexual selection, which is selection for any trait that increases mating success by increasing the attractiveness of an organism to potential mates. Traits that evolved through sexual selection are particularly prominent in males of some animal species, despite traits such as cumbersome antlers, mating calls or bright colors that attract predators, decreasing the survival of individual males. This survival disadvantage is balanced by higher reproductive success in males that show these hard to fake, sexually selected traits.  Natural selection most generally makes nature the measure against which individuals, and individual traits, are more or less likely to survive. "Nature" in this sense refers to an ecosystem, that is, a system in which organisms interact with every other element, physical as well as biological, in their local environment. Eugene Odum, a founder of ecology, defined an ecosystem as: "Any unit that includes all of the organisms...in a given area interacting with the physical environment so that a flow of energy leads to clearly defined trophic structure, biotic diversity, and material cycles (i.e.: exchange of materials between living and nonliving parts) within the system." Each population within an ecosystem occupies a distinct niche, or position, with distinct relationships to other parts of the system. These relationships involve the life history of the organism, its position in the food chain, and its geographic range. This broad understanding of nature enables scientists to delineate specific forces which, together, comprise natural selection.  An active area of research is the unit of selection, with natural selection being proposed to work at the level of genes, cells, individual organisms, groups of organisms and even species. None of these are mutually exclusive and selection may act on multiple levels simultaneously. An example of selection occurring below the level of the individual organism are genes called transposons, which can replicate and spread throughout a genome.    Charles Darwin and “On the Origin of Species”: Natural Selection  Charles Robert Darwin (12 February 1809 – 19 April 1882) was an English naturalist who realized that all species of life have evolved over time from common ancestors, and published compelling supporting evidence of this in his 1859 book On the Origin of Species in which he presented his scientific theory that this branching pattern of evolution resulted from a process that he called natural selection.  The fact that evolution occurs became accepted by the scientific community and much of the general public in his lifetime, but it was not until the emergence of the modern evolutionary synthesis from the 1930s to the 1950s that a broad consensus developed that natural selection was the basic mechanism of evolution  In modified form, Darwin’s scientific discovery is the unifying theory of the life sciences, explaining the diversity of life.   Darwin’s early interest in nature led him to neglect his course in medicine at Edinburgh University and instead help to investigate marine invertebrates, then the University of Cambridge encouraged a passion for natural science. His five-year voyage on HMS Beagle in which he visited the Galapagos Islands established him as an eminent geologist whose observations and theories supported Charles Lyell uniformitarian ideas, and publication of his journal of the voyage made him famous as a popular author.  Puzzled by the geographical distribution of wildlife and fossils he collected on the voyage, Darwin investigated the transmutation of species and conceived his theory of natural selection in 1838.  Although he discussed his ideas with several naturalists, he needed time for extensive research and his geological work had priority. He was writing up his theory in 1858 when Alfred Russel Wallace sent him an essay which described the same idea, prompting immediate joint publication of both of their theories. Darwin’s work established evolutionary descent with modification as the dominant scientific explanation of diversification in nature. In 1871 he examined human evolution and sexual selection in The Descent of Man, and Selection in Relation to Sex, followed by The Expression of the Emotions in Man and Animals. His research on plants was published in a series of books, and in his final book, he examined earthworms and their effect on soil.  When the Beagle reached Falmouth, Cornwall, on 2 October 1836, Darwin was already a celebrity in scientific circles as in December 1835 Henslow had fostered his former pupil reputation by giving selected naturalists a pamphlet of Darwin geological letters.  Darwin visited his home in Shrewsbury and saw relatives, then hurried to Cambridge to see Henslow, who advised on finding naturalists available to catalogue the collections and agreed to take on the botanical specimens. Darwin’s father organized investments, enabling his son to be a self-funded gentleman scientist, and an excited Darwin went round the London institutions being fêted and seeking experts to describe the collections. Zoologists had a huge backlog of work, and there was a danger of specimens just being left in storage.  Charles Lyell eagerly met Darwin for the first time on 29 October and soon introduced him to the up-and-coming anatomist Richard Owen, who had the facilities of the Royal College of Surgeons to work on the fossil bones collected by Darwin. Owen surprising results included gigantic extinct sloths, a near complete skeleton of the unknown Scelidotherium and a hippopotamus-sized rodent-like skull named Toxodon resembling a giant capybara. The armour fragments were from Glyptodon, a huge armadillo-like creature as Darwin had initially thought. These extinct creatures were related to living species in South America.  In mid-December Darwin took lodgings in Cambridge to organize work on his collections and rewrite his Journal. He wrote his first paper, showing that the South American landmass was slowly rising, and with Lyell enthusiastic backing read it to the Geological Society of London on 4 January 1837. On the same day, he presented his mammal and bird specimens to the Zoological Society. The ornithologist John Gould soon announced that the Galapagos birds that Darwin had thought a mixture of blackbirds, "gros-beaks" and finches, were, in fact, twelve separate species of finches. On 17 February Darwin was elected to the Council of the Geological Society, and Lyell presidential address presented Owen findings on Darwin’s fossils, stressing geographical continuity of species as supporting his uniformitarian ideas.  In their first meeting to discuss his detailed findings, Gould told Darwin that the Galapagos mockingbirds from different islands in Galapagos were separate species, not just varieties, and the finch group included the "wrens". Darwin had not labelled the finches by each island in the Galapagos archipelago, but from the notes of others on the Beagle, including FitzRoy, he allocated species to islands. The two rheas were also distinct species, and on 14 March Darwin announced how their distribution changed going southwards.  In mid-July 1837 Darwin started his "B" notebook on Transmutation of Species, and on page 36 wrote "I think" above his first evolutionary tree.  By mid-March, Darwin was speculating in his Red Notebook on the possibility that "one species does change into another" to explain the geographical distribution of living species such as the rheas, and extinct ones such as the strange Macrauchenia, resembling a giant guanaco. His thoughts on lifespan, asexual reproduction and sexual reproduction developed in his "B" notebook around mid-July on to variation in offspring "to adapt & alter the race to changing world" explaining the Galapagos tortoises, Galapagos mockingbirds and rheas. He sketched branching descent, then a genealogical branching of a single evolutionary tree, in which "It is absurd to talk of one animal being higher than another", discarding Lamarck independent lineages progressing to higher forms.  Darwin now had the framework of his theory of natural selection "by which to work" as his "prime hobby".  His research included animal husbandry and extensive experiments with plants, finding evidence that species were not fixed and investigating many detailed ideas to refine and substantiate his theory. For fifteen years this work was in the background to his main occupation of writing on geology and publishing expert reports on the Beagle collections.   When FitzRoy Narrative was published in May 1839, Darwin Journal and Remarks was such a success as the third volume that later that year it was published on its own.  Early in 1842, Darwin wrote about his ideas to Charles Lyell, who noted that his ally "denies seeing a beginning to each crop of species Darwin book The Structure and Distribution of Coral Reefs on his theory of atoll formation was published in May 1842 after more than three years of work, and he then wrote his first "pencil sketch" of his theory of natural selection. To escape the pressures of London, the family moved to rural Down House in September.  On 11 January 1844 Darwin mentioned his theorizing to the botanist Joseph Dalton H writing with melodramatic humor "it is like confessing a murder, he replied "There may in my opinion have been a series of productions on different spots, & also a gradual change of species. I shall be delighted to hear how you think that this change may have taken place, as no presently conceived opinions satisfy me on the subject”.   By July, Darwin had expanded his "sketch" into a 230-page "Essay", to be expanded with his research results if he died prematurely.[94] In November the anonymously published sensational best-seller Vestiges of the Natural History of Creation brought wide interest in transmutation. Darwin scorned its amateurish geology and zoology, but carefully reviewed his own arguments.  Controversy erupted, and it continued to sell well despite contemptuous dismissal by scientists.   Darwin completed his third geological book in 1846. He now renewed a fascination and expertise in marine invertebrates, dating back to his student days with Grant, by dissecting and classifying the barnacles he had collected on the voyage, enjoying observing beautiful structures and thinking about comparisons with allied structures. In 1847, H. read the "Essay" and sent notes that provided Darwin with the calm critical feedback that he needed, but would not commit himself and questioned Darwin opposition to continuing acts of creation.  He resumed work on his theory of species in 1854, and in November realized that divergence in the character of descendants could be explained by them becoming adapted to "diversified places in the economy of nature".  Darwin was forced into swift publication of his theory of natural selection.  By the start of 1856, Darwin was investigating whether eggs and seeds could survive travel across seawater to spread species across oceans. He increasingly doubted the traditional view that species were fixed, but their young friend Thomas Henry Huxley was firmly against evolution. Lyell was intrigued by Darwin speculations without realizing their extent. When he read a paper by Alfred Russel Wallace on the Introduction of species, he saw similarities with Darwin thoughts and urged him to publish to establish precedence. Though Darwin saw no threat, he began work on a short paper. Finding answers to difficult questions held him up repeatedly, and he expanded his plans to a "big book on species" titled Natural Selection. He continued his researches, obtaining information and specimens from naturalists worldwide including Wallace who was working in Borneo. The American botanist Asa Gray showed similar interests, and on 5 September 1857 Darwin sent Gray a detailed outline of his ideas including an abstract of Natural Selection. In December, Darwin received a letter from Wallace asking if the book would examine human origins. He responded that he would avoid that subject, "so surrounded with prejudices", while encouraging Wallace theorizing and adding that "I go much further than you”.  Darwin’s book was half way when, on 18 June 1858, he received a paper from Wallace describing natural selection. Shocked that he had been "forestalled", Darwin sent it on to Lyell, as requested, and, though Wallace had not asked for publication, he suggested he would send it to any journal that Wallace chose. His family was in crisis with children in the village dying of scarlet fever, and he put matters in the hands of Lyell. They decided on a joint presentation at the Linnean Society on 1 July of On the Tendency of Species to form Varieties; and on the Perpetuation of Varieties and Species by Natural Means of Selection; however, Darwin baby son died of the scarlet fever and he was too distraught to attend.   There was little immediate attention to this announcement of the theory; the president of the Linnean Society remarked in May 1859 that the year had not been marked by any revolutionary discoveries. Only one review rankled enough for Darwin to recall it later; Professor Samuel Haughton of Dublin claimed that "all that was new in them was false, and what was true was old." Darwin struggled for thirteen months to produce an abstract of his "big book", suffering from ill health but getting constant encouragement from his scientific friends. Lyell arranged to have it published by John Murray.  On the Origin of Species proved unexpectedly popular, with the entire stock of 1,250 copies oversubscribed when it went on sale to booksellers on 22 November 1859. In the book, Darwin set out "one long argument" of detailed observations, inferences and consideration of anticipated objections. His only allusion to human evolution was the understatement that "light will be thrown on the origin of man and his history".  His theory is simply stated in the introduction:  As many more individuals of each species are born than can possibly survive; and as, consequently, there is a frequently recurring struggle for existence, it follows that any being, if it vary however slightly in any manner profitable to itself, under the complex and sometimes varying conditions of life, will have a better chance of surviving, and thus be naturally selected. From the strong principle of inheritance, any selected variety will tend to propagate its new and modified form.    ';
	//alert(exampleSourceText);
	var inputSourceTextarea = document.getElementById('source_sourcetext');
	inputSourceTextarea.value = exampleSourceText;
}


function inputExampleSourceThree()
{
	//alert('greg is brilliant');
	
	var exampleSourceText = 'I am happy to join with you today in what will go down in history as the greatest demonstration for freedom in the history of our nation. [Applause]  Five score years ago, a great American, in whose symbolic shadow we stand signed the Emancipation Proclamation. This momentous decree came as a great beacon light of hope to millions of Negro slaves who had been seared in the flames of withering injustice. It came as a joyous daybreak to end the long night of captivity. But one hundred years later, we must face the tragic fact that the Negro is still not free. One hundred years later, the life of the Negro is still sadly crippled by the manacles of segregation and the chains of discrimination. One hundred years later, the Negro lives on a lonely island of poverty in the midst of a vast ocean of material prosperity. One hundred years later, the Negro is still languishing in the corners of American society and finds himself an exile in his own land. So we have come here today to dramatize an appalling condition. In a sense we have come to our nations capital to cash a check. When the architects of our republic wrote the magnificent words of the Constitution and the declaration of Independence, they were signing a promissory note to which every American was to fall heir. This note was a promise that all men would be guaranteed the inalienable rights of life, liberty, and the pursuit of happiness. It is obvious today that America has defaulted on this promissory note insofar as her citizens of color are concerned. Instead of honoring this sacred obligation, America has given the Negro people a bad check which has come back marked "insufficient funds." But we refuse to believe that the bank of justice is bankrupt. We refuse to believe that there are insufficient funds in the great vaults of opportunity of this nation. So we have come to cash this check -- a check that will give us upon demand the riches of freedom and the security of justice. We have also come to this hallowed spot to remind America of the fierce urgency of now. This is no time to engage in the luxury of cooling off or to take the tranquilizing drug of gradualism. Now is the time to rise from the dark and desolate valley of segregation to the sunlit path of racial justice. Now is the time to open the doors of opportunity to all of Gods children. Now is the time to lift our nation from the quicksands of racial injustice to the solid rock of brotherhood. It would be fatal for the nation to overlook the urgency of the moment and to underestimate the determination of the Negro. This sweltering summer of the Negros legitimate discontent will not pass until there is an invigorating autumn of freedom and equality. Nineteen sixty-three is not an end, but a beginning. Those who hope that the Negro needed to blow off steam and will now be content will have a rude awakening if the nation returns to business as usual. There will be neither rest nor tranquility in America until the Negro is granted his citizenship rights. The whirlwinds of revolt will continue to shake the foundations of our nation until the bright day of justice emerges. But there is something that I must say to my people who stand on the warm threshold which leads into the palace of justice. In the process of gaining our rightful place we must not be guilty of wrongful deeds. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again we must rise to the majestic heights of meeting physical force with soul force. The marvelous new militancy which has engulfed the Negro community must not lead us to distrust of all white people, for many of our white brothers, as evidenced by their presence here today, have come to realize that their destiny is tied up with our destiny and their freedom is inextricably bound to our freedom. We cannot walk alone. And as we walk, we must make the pledge that we shall march ahead. We cannot turn back. There are those who are asking the devotees of civil rights, "When will you be satisfied?" We can never be satisfied as long as our bodies, heavy with the fatigue of travel, cannot gain lodging in the motels of the highways and the hotels of the cities. We cannot be satisfied as long as the Negros basic mobility is from a smaller ghetto to a larger one. We can never be satisfied as long as a Negro in Mississippi cannot vote and a Negro in New York believes he has nothing for which to vote. No, no, we are not satisfied, and we will not be satisfied until justice rolls down like waters and righteousness like a mighty stream. I am not unmindful that some of you have come here out of great trials and tribulations. Some of you have come fresh from narrow cells. Some of you have come from areas where your quest for freedom left you battered by the storms of persecution and staggered by the winds of police brutality. You have been the veterans of creative suffering. Continue to work with the faith that unearned suffering is redemptive. Go back to Mississippi, go back to Alabama, go back to Georgia, go back to Louisiana, go back to the slums and ghettos of our northern cities, knowing that somehow this situation can and will be changed. Let us not wallow in the valley of despair. I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slave owners will be able to sit down together at a table of brotherhood. I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. I have a dream today. I have a dream that one day the state of Alabama, whose governors lips are presently dripping with the words of interposition and nullification, will be transformed into a situation where little black boys and black girls will be able to join hands with little white boys and white girls and walk together as sisters and brothers. I have a dream today. I have a dream that one day every valley shall be exalted, every hill and mountain shall be made low, the rough places will be made plain, and the crooked places will be made straight, and the glory of the Lord shall be revealed, and all flesh shall see it together. This is our hope. This is the faith with which I return to the South. With this faith we will be able to hew out of the mountain of despair a stone of hope. With this faith we will be able to transform the jangling discords of our nation into a beautiful symphony of brotherhood. With this faith we will be able to work together, to pray together, to struggle together, to go to jail together, to stand up for freedom together, knowing that we will be free one day. This will be the day when all of Gods children will be able to sing with a new meaning, "My country, tis of thee, sweet land of liberty, of thee I sing. Land where my fathers died, land of the pilgrims pride, from every mountainside, let freedom ring." And if America is to be a great nation this must become true. So let freedom ring from the prodigious hilltops of New Hampshire. Let freedom ring from the mighty mountains of New York. Let freedom ring from the heightening Alleghenies of Pennsylvania! Let freedom ring from the snowcapped Rockies of Colorado! Let freedom ring from the curvaceous peaks of California! But not only that; let freedom ring from Stone Mountain of Georgia! Let freedom ring from Lookout Mountain of Tennessee! Let freedom ring from every hill and every molehill of Mississippi. From every mountainside, let freedom ring. When we let freedom ring, when we let it ring from every village and every hamlet, from every state and every city, we will be able to speed up that day when all of Gods children, black men and white men, Jews and Gentiles, Protestants and Catholics, will be able to join hands and sing in the words of the old Negro spiritual, "Free at last! free at last! thank God Almighty, we are free at last!"    ';
	//alert(exampleSourceText);
	var inputSourceTextarea = document.getElementById('source_sourcetext');
	inputSourceTextarea.value = exampleSourceText;
}




function inputWordListCustom( list )
{
	//alert('greg is brilliant');
	
	// var wordlistCustom = 'abandon access accommodate accumulation acknowledge adjustment advocates alter alternative analyze attribute benefit biased bulk civil collapse complexity compound conceive confining conflicted considerable contemporary context contradict contrary contribute convince create culture cycle decade demonstrate design despite diversity dramatic element enhance enormous exhibit exploit exposure factor feature function fundamental hypothesis impact incidence incline incompatible incorporate indicate inevitable initiatives integrate integrity interpret intervention intrinsically justify manipulate migration modify monitor nonetheless persistent phenomenon potential presume priority prohibit project promote proportion react release reluctant rely resourceful reveal reverse route statistics structure substitute sufficient suspend temporarily tradition transfer transition transmit transport unethical unify valid variable violation';
	// //alert(exampleSourceText);
	// // var inputSourceTextarea = document.getElementById('source_sourcetext');
	// // inputSourceTextarea.value = exampleSourceText;
	// document.getElementById("custom_wordlist_textarea").value = wordlistCustom;
	
	
	switch( list ){
		case 'WG1':
			var wordlistCustom = 'abandon access accommodate accumulation acknowledge adjustment advocates alter alternative analyze attribute benefit biased bulk civil collapse complexity compound conceive confining conflicted considerable contemporary context contradict contrary contribute convince create culture cycle decade demonstrate design despite diversity dramatic element enhance enormous exhibit exploit exposure factor feature function fundamental hypothesis impact incidence incline incompatible incorporate indicate inevitable initiatives integrate integrity interpret intervention intrinsically justify manipulate migration modify monitor nonetheless persistent phenomenon potential presume priority prohibit project promote proportion react release reluctant rely resourceful reveal reverse route statistics structure substitute sufficient suspend temporarily tradition transfer transition transmit transport unethical unify valid variable violation';

	  		break;
		case 'WG2':
			var wordlistCustom = 'abstain acquire adequate advantage affect affirmative allegiance amnesty apathy approach aptitude aspect assess assume attribute capacity civic cohesive complex components compound concept conclusion consists constitutes constrain consume contaminate contrast corporal correspond creationism criteria critical decline derive design disclaimer discrimination disproportionate distribute economic eligible embryo emphasize enables enforce establish evidently exclude facilitate formulate generate guarantees illustrates implement incentive industry inequity invasion invest investigate involve legislate logical maintain maximize method morality motivate multicultural multidimensional obesity obtain occur orient parallel paralyzed perceive policy potential prerequisite prescribe prevention previous primary principle privacy proceed rating recite relevant rely renewable resolve resources responsibility restrict resumé retain secure signify specify standardized sustain theory tracking undertake undocumented xenophobia';

	  		break;
			case 'WG3':
				var wordlistCustom = 'adapt adequately adopt allocate anecdotal anonymous attain biases capable capacity circumstance cite commission commodity compatible compensation compile compromise conception conduct confront consent consequence contact controversy crucial data debate deny diminish discretion displace distribution DNA domestic dominant duration efficient eliminate emerge empower ensures equivalent escort estimate evaluate exceed explicit exploit export extend extract focus front furthermore gender genetic harassment implications import impose incident infer inherent initiative institute integrate interfere intrinsic invoke isolate justify literacy mandatory media minimum modify notion notwithstanding odds ongoing outcome outweigh paradigm perspective phasing pose practitioner predominantly prime prior radical range regime regulate regulation research revenue rigid role scheme sought source stable strategy subsequently suspicious symbolic tension trademark undergo underlying undernourish unmonitored visible vocation voluntary whereas widespread wiretapping';

		  		break;

		default:
			var wordlistCustom = 'Error: This custom wordlist is not functioning properly.';
	}
	
	document.getElementById("custom_wordlist_textarea").value = wordlistCustom;

}



