//v1.0.2.20041226: rearranged so "your" substitutes before "you"
//v1.0.1.20041119: added you're->yer, tweaked some other stuff
//v1.0.0.20041118: just does a few ridiculously obvious substitutions


if(!document.getElementById && document.all) {
	
	document.getElementById = function(id)
	{
		return document.all[id];
	}
}

function runme(){
	var english = document.getElementById("hagridize");
	
	$text = english.input.value;
	
	english.output.value = Hagridize($text);
			
}


function Hagridize($text) {
	
	$text = $text.replace(/ing( |\.|\,|\?|\!|\:|\;)/mg, "in'$1");
		
	$text = $text.replace(/(your|you\'re)/mg, "yer");
	$text = $text.replace(/you/mg, "yeh");
	$text = $text.replace(/You/mg, "Yeh");
	$text = $text.replace(/of /mg, "o' ");
	$text = $text.replace(/Of /mg, "O' ");
	$text = $text.replace(/(we|yeh|he|she|they) were/mg, "$1 was");
	$text = $text.replace(/yeh was/mg, "you was");
	$text = $text.replace(/just/mg, "jus'");
	
	$text = $text.replace(/ and /mg, " an' ");
	$text = $text.replace(/because/mg, "'cause");
	$text = $text.replace(/for /mg, "fer ");
	$text = $text.replace(/For /mg, "Fer ");
	
	$text = $text.replace(/n\'t/mg, "n'");
	$text = $text.replace(/that/mg, "tha'");
	$text = $text.replace(/That/mg, "Tha'");
	
	$text = $text.replace(/something/mg, "summat");
	$text = $text.replace(/Something/mg, "Summat");
	$text = $text.replace(/ them/mg, " 'em");
	$text = $text.replace(/(should|would|could) have/mg, "$1've"); 
	
	return $text;
}
