/*////////////////////////////////
THIS JS FILE CONTAINS:

[1] JS-validation for form the 5 language versions of the BTGS COntact Us form:
http://www.btglobalservices.com/business/global/en/other/contact/index.html
- ENGLISH
- DUTCH
- FRENCH
- GERMAN
- SPANISH

[2] JP's scrubber function
- Converts special characters from form into encoded characters, so they display OK in HTML.
////////////////////////////////*/


/*////////////////////////////////
[1] ENGLISH Validation for form at:
http://www.btglobalservices.com/business/global/en/other/contact/index.html
////////////////////////////////*/

function validate_page(form1){
  var missing_intro = "Please answer the following questions:\n\n";
  var missing ="";
  var RegEx = /^[\w_-]+(\.[\w_-]+)*@[\w_-]+(\.[\w_-]+)*\.\w{2,3}$/i;  // email regular expression

	if (form1.first_name.value == ""){
		missing += "Please enter your First Name?\n";
		}

	if (form1.last_name.value == ""){
		missing += "Please enter your Last Name?\n";
		}

	if (form1.cust_email.value == ""){
		missing += "Please enter your Email Address?\n";
		}
	
	
	if (form1.cust_email.value != ""){
		if (RegEx.test(form1.cust_email.value) != true){  // test to see if email matches regex. 
		missing += "Please enter a VALID email address?\n";
			}
		}

	

	if (form1.country.selectedIndex == 0){
		missing += "Please select your Country?\n";
		}

/*	if (form1.organisation.value == ""){
		missing += "Please enter the name of your Organisation?\n";
		}
*/
	

	
	if (form1.bt_relationship.selectedIndex == 0){
		missing += "Describe your relationship with BT: Please select an option?\n";
		}

	if (form1.bt_relationship.selectedIndex == 8 && form1.bt_relationship_other.value == ""){
		missing += "If Other, please specify?\n";
		}

	if (form1.subject.selectedIndex == 0){
		missing += "Please select a Subject?\n";
		}

	if (form1.subject.selectedIndex == 16 && form1.subject_other.value == ""){
		missing += "If Other, please specify?\n";
		}

	if (form1.comments.value == ""){
		missing += "Please enter your Comments?\n";
		}

	if(missing) {
		alert( missing_intro + missing );
		return false;
		}
	else 
		{ 
			if(confirm("Is all the information entered correct?")) 
				{
				if (form1.first_name.value != ""){
					scrubMe(document.form1.first_name);
					}
				if (form1.last_name.value != ""){
					scrubMe(document.form1.last_name);
					}
				if (form1.cust_email.value != ""){
					scrubMe(document.form1.cust_email);
					}
				if (form1.tele.value != ""){
					scrubMe(document.form1.tele);
					}
				if (form1.job_title.value != ""){
					scrubMe(document.form1.job_title);
					}
				if (form1.organisation.value != ""){
					scrubMe(document.form1.organisation);
					}
				if (form1.bt_relationship_other.value != ""){
					scrubMe(document.form1.bt_relationship_other);
					}
				if (form1.subject_other.value != ""){
					scrubMe(document.form1.subject_other);
					}
				if (form1.comments.value != ""){
					scrubMe(document.form1.comments);
					}
				return true;
				}
			else
				{
				return false;
				}
		}
}

/*////////////////////////////////
[1] DUTCH Validation for form at:
http://www.btglobalservices.com/business/global/nl/other/contact/index.html

IMPORTANT
Since the page the alerts will be displayed in is in UTF-8, duplicate each alert line and comment one out.
Then go to http://www.pjb.com.au/comp/diacritics.html and replace all accented characters with OCT codes.
////////////////////////////////*/

function validate_page_nl(form1){
  var missing_intro = "Please answer the following questions:\n\n";
  var missing ="";
  var RegEx = /^[\w_-]+(\.[\w_-]+)*@[\w_-]+(\.[\w_-]+)*\.\w{2,3}$/i;  // email regular expression

	if (form1.first_name.value == ""){
		missing += "Please enter your First Name?\n";
		}

	if (form1.last_name.value == ""){
		missing += "Please enter your Last Name?\n";
		}

	if (form1.cust_email.value == ""){
		missing += "Please enter your Email Address?\n";
		}
	
	
	if (form1.cust_email.value != ""){
		if (RegEx.test(form1.cust_email.value) != true){  // test to see if email matches regex. 
		missing += "Please enter a VALID email address?\n";
			}
		}

	

	if (form1.country.selectedIndex == 0){
		missing += "Please select your Country?\n";
		}

/*	if (form1.organisation.value == ""){
		missing += "Please enter the name of your Organisation?\n";
		}
*/
	

	
	if (form1.bt_relationship.selectedIndex == 0){
		missing += "Describe your relationship with BT: Please select an option?\n";
		}

	if (form1.bt_relationship.selectedIndex == 8 && form1.bt_relationship_other.value == ""){
		missing += "If Other, please specify?\n";
		}

	if (form1.subject.selectedIndex == 0){
		missing += "Please select a Subject?\n";
		}

	if (form1.subject.selectedIndex == 16 && form1.subject_other.value == ""){
		missing += "If Other, please specify?\n";
		}

	if (form1.comments.value == ""){
		missing += "Please enter your Comments?\n";
		}

	if(missing) {
		alert( missing_intro + missing );
		return false;
		}
	else 
		{ 
			if(confirm("Is all the information entered correct?")) 
				{
				if (form1.first_name.value != ""){
					scrubMe(document.form1.first_name);
					}
				if (form1.last_name.value != ""){
					scrubMe(document.form1.last_name);
					}
				if (form1.cust_email.value != ""){
					scrubMe(document.form1.cust_email);
					}
				if (form1.tele.value != ""){
					scrubMe(document.form1.tele);
					}
				if (form1.job_title.value != ""){
					scrubMe(document.form1.job_title);
					}
				if (form1.organisation.value != ""){
					scrubMe(document.form1.organisation);
					}
				if (form1.bt_relationship_other.value != ""){
					scrubMe(document.form1.bt_relationship_other);
					}
				if (form1.subject_other.value != ""){
					scrubMe(document.form1.subject_other);
					}
				if (form1.comments.value != ""){
					scrubMe(document.form1.comments);
					}
				return true;
				}
			else
				{
				return false;
				}
		}
}

/*////////////////////////////////
[1] GERMAN Validation for form at:
http://www.btglobalservices.com/business/global/de/other/contact/index.html

IMPORTANT
Since the page the alerts will be displayed in is in UTF-8, duplicate each alert line and comment one out.
Then go to http://www.pjb.com.au/comp/diacritics.html and replace all accented characters with OCT codes.
////////////////////////////////*/

function validate_page_de(form1){
//  var missing_intro = "Bitte füllen Sie die folgenden Felder aus:\n\n";
  var missing_intro = "Bitte f\374llen Sie die folgenden Felder aus:\n\n";
  var missing ="";
  var RegEx = /^[\w_-]+(\.[\w_-]+)*@[\w_-]+(\.[\w_-]+)*\.\w{2,3}$/i;  // email regular expression

	if (form1.first_name.value == ""){
		missing += "Bitte geben Sie hier Ihren Vornamen ein.\n";
		}

	if (form1.last_name.value == ""){
		missing += "Bitte geben Sie hier Ihren Familiennamen ein.\n";
		}

	if (form1.cust_email.value == ""){
		missing += "Nennen Sie uns bitte Ihre Email-Adresse.\n";
		}
	
	
	if (form1.cust_email.value != ""){
		if (RegEx.test(form1.cust_email.value) != true){  // test to see if email matches regex. 
//		missing += "Bitte nur GÜLTIGE Email-Adressen angeben\n";
		missing += "Bitte nur G\334LTIGE Email-Adressen angeben\n";
			}
		}

	

	if (form1.country.selectedIndex == 0){
//		missing += "Bitte wählen Sie Ihr Land aus.\n";
		missing += "Bitte w\344hlen Sie Ihr Land aus.\n";
		}

/*	if (form1.organisation.value == ""){
		missing += "Please enter the name of your Organisation?\n";
		}
*/
	

	
	if (form1.bt_relationship.selectedIndex == 0){
//		missing += "Bitte wählen Sie eine der Optionen aus.\n";
		missing += "Bitte w\344hlen Sie eine der Optionen aus.\n";
		}

	if (form1.bt_relationship.selectedIndex == 8 && form1.bt_relationship_other.value == ""){
//		missing += "Falls ,Sonstiges', bitte näher beschreiben.\n";
		missing += "Falls ,Sonstiges', bitte n\344her beschreiben.\n";
		}

	if (form1.subject.selectedIndex == 0){
//		missing += "Bitte wählen Sie ein Thema aus.\n";
		missing += "Bitte w\344hlen Sie ein Thema aus.\n";
		}

	if (form1.subject.selectedIndex == 16 && form1.subject_other.value == ""){
//		missing += "Falls ,Sonstiges', bitte näher beschreiben.\n";
		missing += "Falls ,Sonstiges', bitte n\344her beschreiben.\n";
		}

	if (form1.comments.value == ""){
		missing += "Bitte geben Sie hier Ihre Kommentare ein.\n";
		}

	if(missing) {
		alert( missing_intro + missing );
		return false;
		}
	else 
		{ 
			if(confirm("Sind alle Angaben korrekt?")) 
				{
				if (form1.first_name.value != ""){
					scrubMe(document.form1.first_name);
					}
				if (form1.last_name.value != ""){
					scrubMe(document.form1.last_name);
					}
				if (form1.cust_email.value != ""){
					scrubMe(document.form1.cust_email);
					}
				if (form1.tele.value != ""){
					scrubMe(document.form1.tele);
					}
				if (form1.job_title.value != ""){
					scrubMe(document.form1.job_title);
					}
				if (form1.organisation.value != ""){
					scrubMe(document.form1.organisation);
					}
				if (form1.bt_relationship_other.value != ""){
					scrubMe(document.form1.bt_relationship_other);
					}
				if (form1.subject_other.value != ""){
					scrubMe(document.form1.subject_other);
					}
				if (form1.comments.value != ""){
					scrubMe(document.form1.comments);
					}
				return true;
				}
			else
				{
				return false;
				}
		}
}

/*////////////////////////////////
[1] FRENCH Validation for form at:
http://www.btglobalservices.com/business/global/fr/other/contact/index.html

IMPORTANT
Since the page the alerts will be displayed in is in UTF-8, duplicate each alert line and comment one out.
Then go to http://www.pjb.com.au/comp/diacritics.html and replace all accented characters with OCT codes.
////////////////////////////////*/

function validate_page_fr(form1){
//  var missing_intro = "Veuillez répondre aux questions suivantes :\n\n";
  var missing_intro = "Veuillez r\351pondre aux questions suivantes :\n\n";
  var missing ="";
  var RegEx = /^[\w_-]+(\.[\w_-]+)*@[\w_-]+(\.[\w_-]+)*\.\w{2,3}$/i;  // email regular expression

	if (form1.first_name.value == ""){
//		missing += "Entrez votre prénom\n";
		missing += "Entrez votre pr\351nom\n";
		}

	if (form1.last_name.value == ""){
		missing += "Entrez votre nom\n";
		}

	if (form1.cust_email.value == ""){
		missing += "Entrez votre adresse email\n";
		}
	
	
	if (form1.cust_email.value != ""){
		if (RegEx.test(form1.cust_email.value) != true){  // test to see if email matches regex. 
		missing += "Entrez une adresse email valide\n";
			}
		}

	

	if (form1.country.selectedIndex == 0){
//		missing += "Sélectionnez votre pays\n";
		missing += "S\351lectionnez votre pays\n";
		}

/*	if (form1.organisation.value == ""){
		missing += "Please enter the name of your Organisation?\n";
		}
*/
	

	
	if (form1.bt_relationship.selectedIndex == 0){
//		missing += "Sélectionnez une option\n";
		missing += "S\351lectionnez une option\n";
		}

	if (form1.bt_relationship.selectedIndex == 8 && form1.bt_relationship_other.value == ""){
//		missing += "Si vous avez sélectionné Autre, veuillez préciser\n";
		missing += "Si vous avez s\351lectionn\351 Autre, veuillez pr\351ciser\n";
		}

	if (form1.subject.selectedIndex == 0){
//		missing += "Sélectionnez un domaine d'intérêt\n";
		missing += "S\351lectionnez un domaine d'int\351r\352t\n";
		}

	if (form1.subject.selectedIndex == 16 && form1.subject_other.value == ""){
//		missing += "Si vous avez sélectionné Autre, veuillez préciser\n";
		missing += "Si vous avez s\351lectionn\351 Autre, veuillez pr\351ciser\n";
		}

	if (form1.comments.value == ""){
		missing += "Entrez vos commentaires\n";
		}

	if(missing) {
		alert( missing_intro + missing );
		return false;
		}
	else 
		{ 
//			if(confirm("Toutes les informations entrées sont-elles correctes ?")) 
			if(confirm("Toutes les informations entr\351es sont-elles correctes ?")) 
				{
				if (form1.first_name.value != ""){
					scrubMe(document.form1.first_name);
					}
				if (form1.last_name.value != ""){
					scrubMe(document.form1.last_name);
					}
				if (form1.cust_email.value != ""){
					scrubMe(document.form1.cust_email);
					}
				if (form1.tele.value != ""){
					scrubMe(document.form1.tele);
					}
				if (form1.job_title.value != ""){
					scrubMe(document.form1.job_title);
					}
				if (form1.organisation.value != ""){
					scrubMe(document.form1.organisation);
					}
				if (form1.bt_relationship_other.value != ""){
					scrubMe(document.form1.bt_relationship_other);
					}
				if (form1.subject_other.value != ""){
					scrubMe(document.form1.subject_other);
					}
				if (form1.comments.value != ""){
					scrubMe(document.form1.comments);
					}
				return true;
				}
			else
				{
				return false;
				}
		}
}

/*////////////////////////////////
[1] SPANISH Validation for form at:
http://www.btglobalservices.com/business/global/es/other/contact/index.html

IMPORTANT
Since the page the alerts will be displayed in is in UTF-8, duplicate each alert line and comment one out.
Then go to http://www.pjb.com.au/comp/diacritics.html and replace all accented characters with OCT codes.
////////////////////////////////*/

function validate_page_es(form1){
  var missing_intro = "Proporcione los datos solicitados a continuaci\363n:\n\n";
  var missing ="";
  var RegEx = /^[\w_-]+(\.[\w_-]+)*@[\w_-]+(\.[\w_-]+)*\.\w{2,3}$/i;  // email regular expression

	if (form1.first_name.value == ""){
		missing += "Escriba su nombre.\n";
		}

	if (form1.last_name.value == ""){
		missing += "Escriba su apellido.\n";
		}

	if (form1.cust_email.value == ""){
//		missing += "Escriba su dirección de correo electrónico.\n";
		missing += "Escriba su direcci\363n de correo electr\363nico.\n";
		}
	
	
	if (form1.cust_email.value != ""){
		if (RegEx.test(form1.cust_email.value) != true){  // test to see if email matches regex. 
//		missing += "Escriba una dirección de correo electrónico VÁLIDA.\n";
		missing += "Escriba una direcci\363n de correo electr\363nico V\301LIDA.\n";
			}
		}

	

	if (form1.country.selectedIndex == 0){
//		missing += "Seleccione su país.\n";
		missing += "Seleccione su pa\355s.\n";
		}

/*	if (form1.organisation.value == ""){
		missing += "Please enter the name of your Organisation?\n";
		}
*/
	

	
	if (form1.bt_relationship.selectedIndex == 0){
//		missing += "Describa el tipo de relación con BT: Elija una opción. \n";
		missing += "Describa el tipo de relaci\363n con BT: Elija una opci\363n.\n";
		}

	if (form1.bt_relationship.selectedIndex == 8 && form1.bt_relationship_other.value == ""){
//		missing += "Si elige Otros, especifique cuál.\n";
		missing += "Si elige Otros, especifique cu\341l.\n";
		}

	if (form1.subject.selectedIndex == 0){
		missing += "Elija un asunto.\n";
		}

	if (form1.subject.selectedIndex == 16 && form1.subject_other.value == ""){
//		missing += "Si elige Otros, especifique cuál.\n";
		missing += "Si elige Otros, especifique cu\341l.\n";
		}

	if (form1.comments.value == ""){
		missing += "Escriba sus comentarios.\n";
		}

	if(missing) {
		alert( missing_intro + missing );
		return false;
		}
	else 
		{ 
//			if(confirm("¿Es correcta toda la información que ha proporcionado?")) 
			if(confirm("\277Es correcta toda la informaci\363n que ha proporcionado?")) 
				{
				if (form1.first_name.value != ""){
					scrubMe(document.form1.first_name);
					}
				if (form1.last_name.value != ""){
					scrubMe(document.form1.last_name);
					}
				if (form1.cust_email.value != ""){
					scrubMe(document.form1.cust_email);
					}
				if (form1.tele.value != ""){
					scrubMe(document.form1.tele);
					}
				if (form1.job_title.value != ""){
					scrubMe(document.form1.job_title);
					}
				if (form1.organisation.value != ""){
					scrubMe(document.form1.organisation);
					}
				if (form1.bt_relationship_other.value != ""){
					scrubMe(document.form1.bt_relationship_other);
					}
				if (form1.subject_other.value != ""){
					scrubMe(document.form1.subject_other);
					}
				if (form1.comments.value != ""){
					scrubMe(document.form1.comments);
					}
				return true;
				}
			else
				{
				return false;
				}
		}
}


/*////////////////////////////////
[2] JP's scrubber function
- Converts special characters from form into encoded characters, so they display OK in HTML.
////////////////////////////////*/

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
//
//	Program:		scrub.js
//	Purpose:		Component of the Export extension to the ICE3 editor to convert HTML into XML
//	Author:			JP Chun (Crash & Burn)
//	Organisation:	BT WebDev NL
//	Copyright:		BT WebDev NL
//	Date:			October 2004
//	Version:		1
//	Revision:		0
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //

	// MAIN FUNCTION
	function scrubMe(obj) {
		obj.value = name2num(obj.value);												// convert named entities to numerical entities
		obj.value = char2num(obj.value);												// convert diacritic characters to numerical entities
	}

	
	// MATCH NAMED ENTITIES WITH NUMERICALS [DO NOT EDIT, NEEDS TO BE SYNCHRONISED];
	var entityMatrix = new Array(
								new Array('&nbsp;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','&shy;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&sup1;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;','&quot;','&amp;','&lt;','&gt;','&fnof;','&Alpha;','&Beta;','&Gamma;','&Delta;','&Epsilon;','&Zeta;','&Eta;','&Theta;','&Iota;','&Kappa;','&Lambda;','&Mu;','&Nu;','&Xi;','&Omicron;','&Pi;','&Rho;','&Sigma;','&Tau;','&Upsilon;','&Phi;','&Chi;','&Psi;','&Omega;','&alpha;','&beta;','&gamma;','&delta;','&epsilon;','&zeta;','&eta;','&theta;','&iota;','&kappa;','&lambda;','&mu;','&nu;','&xi;','&omicron;','&pi;','&rho;','&sigmaf;','&sigma;','&tau;','&upsilon;','&phi;','&chi;','&psi;','&omega;','&thetasym;','&upsih;','&piv;','&bull;','&hellip;','&prime;','&Prime;','&oline;','&frasl;','&weierp;','&image;','&real;','&trade;','&alefsym;','&larr;','&uarr;','&rarr;','&darr;','&harr;','&crarr;','&lArr;','&uArr;','&rArr;','&dArr;','&hArr;','&forall;','&part;','&exist;','&empty;','&nabla;','&isin;','&notin;','&ni;','&prod;','&sum;','&minus;','&lowast;','&radic;','&prop;','&infin;','&ang;','&and;','&or;','&cap;','&cup;','&int;','&there4;','&sim;','&cong;','&asymp;','&ne;','&equiv;','&le;','&ge;','&sub;','&sup;','&nsub;','&sube;','&supe;','&oplus;','&otimes;','&perp;','&sdot;','&lceil;','&rceil;','&lfloor;','&rfloor;','&lang;','&rang;','&loz;','&spades;','&clubs;','&hearts;','&diams;','&OElig;','&oelig;','&Scaron;','&scaron;','&Yuml;','&circ;','&tilde;','&ensp;','&emsp;','&thinsp;','&zwnj;','&zwj;','&lrm;','&rlm;','&ndash;','&mdash;','&lsquo;','&rsquo;','&sbquo;','&ldquo;','&rdquo;','&bdquo;','&dagger;','&Dagger;','&permil;'),
								new Array('&#160;','&#161;','&#162;','&#163;','&#164;','&#165;','&#166;','&#167;','&#168;','&#169;','&#170;','&#171;','&#172;','&#173;','&#174;','&#175;','&#176;','&#177;','&#178;','&#179;','&#180;','&#181;','&#182;','&#183;','&#184;','&#185;','&#186;','&#187;','&#188;','&#189;','&#190;','&#191;','&#192;','&#193;','&#194;','&#195;','&#196;','&#197;','&#198;','&#199;','&#200;','&#201;','&#202;','&#203;','&#204;','&#205;','&#206;','&#207;','&#208;','&#209;','&#210;','&#211;','&#212;','&#213;','&#214;','&#215;','&#216;','&#217;','&#218;','&#219;','&#220;','&#221;','&#222;','&#223;','&#224;','&#225;','&#226;','&#227;','&#228;','&#229;','&#230;','&#231;','&#232;','&#233;','&#234;','&#235;','&#236;','&#237;','&#238;','&#239;','&#240;','&#241;','&#242;','&#243;','&#244;','&#245;','&#246;','&#247;','&#248;','&#249;','&#250;','&#251;','&#252;','&#253;','&#254;','&#255;','&#34;','&#38;','&#60;','&#62;','&#402;','&#913;','&#914;','&#915;','&#916;','&#917;','&#918;','&#919;','&#920;','&#921;','&#922;','&#923;','&#924;','&#925;','&#926;','&#927;','&#928;','&#929;','&#931;','&#932;','&#933;','&#934;','&#935;','&#936;','&#937;','&#945;','&#946;','&#947;','&#948;','&#949;','&#950;','&#951;','&#952;','&#953;','&#954;','&#955;','&#956;','&#957;','&#958;','&#959;','&#960;','&#961;','&#962;','&#963;','&#964;','&#965;','&#966;','&#967;','&#968;','&#969;','&#977;','&#978;','&#982;','&#8226;','&#8230;','&#8242;','&#8243;','&#8254;','&#8260;','&#8472;','&#8465;','&#8476;','&#8482;','&#8501;','&#8592;','&#8593;','&#8594;','&#8595;','&#8596;','&#8629;','&#8656;','&#8657;','&#8658;','&#8659;','&#8660;','&#8704;','&#8706;','&#8707;','&#8709;','&#8711;','&#8712;','&#8713;','&#8715;','&#8719;','&#8721;','&#8722;','&#8727;','&#8730;','&#8733;','&#8734;','&#8736;','&#8743;','&#8744;','&#8745;','&#8746;','&#8747;','&#8756;','&#8764;','&#8773;','&#8776;','&#8800;','&#8801;','&#8804;','&#8805;','&#8834;','&#8835;','&#8836;','&#8838;','&#8839;','&#8853;','&#8855;','&#8869;','&#8901;','&#8968;','&#8969;','&#8970;','&#8971;','&#9001;','&#9002;','&#9674;','&#9824;','&#9827;','&#9829;','&#9830;','&#338;','&#339;','&#352;','&#353;','&#376;','&#710;','&#732;','&#8194;','&#8195;','&#8201;','&#8204;','&#8205;','&#8206;','&#8207;','&#8211;','&#8212;','&#8216;','&#8217;','&#8218;','&#8220;','&#8221;','&#8222;','&#8224;','&#8225;','&#8240;')
								);

	// CONVERT NAMED ENTITIES TO NUMERICAL EQUIVALENTS
	function name2num(str) {
		var entityRegex	= /&(\w)+;/gi;													// regex describing a named html entity
		var entityArray = str.match(entityRegex);										// build array of all entities found
		if (entityArray != null)
			{
			for (var i=0; i<entityArray.length; i++)									// run through all found entities one at the time
				{
				for (var c=0; c<entityMatrix[0].length; c++)							// run through entity Matrix one at the time
					{
					if (entityMatrix[0][c] == entityArray[i])							// if a found entity matches one in the matrix
						{
						str = str.replace(entityArray[i],entityMatrix[1][c]);			// replace the found ones for the numerical ones in the matrix
						}
					}
				}
			}
		return str;																		// return content with no named entities
	}

	// CONVERT DIACRITIC CHARACTERS TO NUMERICAL ENTITIES
	function char2num(str) {
		var i			= -1;															// start at -1 due to i++ at start of while
		var resultStr	= '';															// empty result string
		var entity		= '';															// empty entity string
		var entityRegex	= /&(#)?(\d|\w)+;/i;											// regex describing html entity

		while (i < str.length)															// walk trough each character of the string
			{
			i++;																		// increment i to go to next character
			if (str.charCodeAt(i) == 38)												// all entities start with an ampersand
				{
				entity = str.substr(i,8).match(entityRegex);							// grab entity from substring if matched
				if (entity != null)														// regex actually found entity
					{
					i = i + (entity[0].length);											// increment i to the length of the found entity
					resultStr += entity[0];												// concatenate found entity to result string
					}
				}

			if ((str.charCodeAt(i) > 127) ||											// look for non keyboard characters
			   (str.charCodeAt(i) == 34) ||												// or double quote signs
			   (str.charCodeAt(i) == 39))												// or single quote signs
				{
				resultStr += '&#' + str.charCodeAt(i) + ';';							// replace character with numerical entity and concatenate
				}														 
			else																		// normal keyboard characters nothing to replace
				{
				resultStr += str.charAt(i);												// concatenate character to result string
				}
			}
		return resultStr;																// spit it out
	}

