
/*
 * jQuery replaceText - v1.1 - 11/21/2009
 * http://benalman.com/projects/jquery-replacetext-plugin/
 * 
 * Copyright (c) 2009 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($){$.fn.replaceText=function(b,a,c){return this.each(function(){var f=this.firstChild,g,e,d=[];if(f){do{if(f.nodeType===3){g=f.nodeValue;e=g.replace(b,a);if(e!==g){if(!c&&/</.test(e)){$(f).before(e);d.push(f)}else{f.nodeValue=e}}}}while(f=f.nextSibling)}d.length&&$(d).remove()})}
																																																																							//EDIT THE TWO ARRAYS BELOW FOR SEARCH AND REPLACE WORDS
																																																																							//USES REGEX
																																																																							// - \B = Don't start at the beginning or the end of the word (depending on where it's placed in the search (ex. /\Bization\b/g will look for organization or specialization)																																																																																														
																																																																																																	
$.fn.translate = function(){					
	//words to search for					
	var wordArray = [/\Bavorite\b/gi, /\bcenter\b/g, /\bCenter\b/g, /\bcentered\b/g, /\bCentered\b/g, /\Bolor\b/gi,/\Batacenter\b/gi, /\Batacenters\b/gi, /\Befense\b/gi, /\Bffense\b/gi, /\Bpecialt\B/g, /\Bomiz\B/g, /\Bimiz\B/g, /\Biniz\B/g, /\Baliz\B/g, /\Baniz\B/g, /\Boriz\B/g, /\Balyz\B/g, /\Boriz\B/g, /\bTrialing\b/g, /\btrialling\b/g, /\bprogram\b/g, /\bProgram\b/g, /\Bnalog\b/gi, /\blicense\b/g, /\bLicense\b/g,/\bnoon\b/g, /\bNoon\b/g, /\bvacation\b/g, /\bVacation\b/g];
	
	//replacement words
	var queensArray = ["avourite", "centre", "Centre", "centred", "Centred", "olour", "atacentre", "atacentres",
					   "nalyse", "ffence", "pecialit", "omis", "imis", "inis", "alis", "anis", "oris", "alys", "oris", "Trialling", "trialling", "programme", "Programme", "nalogue",
					   "licence", "Licence", "midday", "Midday", "holiday", "Holiday"];
	
	//an array of the elements you want it to search through
	var elementsArray = ['title', 'h1', 'h2', 'h3', 'h4', 'p', 'li'];

	//initialize the loop variables
	var i=0;
	var j=0;
	
	//loop through all words and replace if they are in the document
	for (i=0; i < wordArray.length; i++)
	{ 
		for (j=0; j < elementsArray.length; j++)
		{ 
			var newWord = $("#contentWrap").find(elementsArray[j]);
			newWord.replaceText( wordArray[i], queensArray[i] );}
		}
	}
})(jQuery);

$(document).ready(function(){ $(document).translate();});
