// finds non-alphanumeric characters in headings and wraps them in a span

$(function(){
	$('h1').each(function(){
		var replacements = new Array();
		content = $(this).text();
		for(i=0; i<content.length; i++){
			if (!content.charAt(i).match(/[a-zA-Z0-9 \/]/)) {
				replacements.push(content.charAt(i));
			}
		}
		replacements = uniqueArr(replacements);
		for (j=0;j<replacements.length;j++) {
			term = new RegExp(replacements[j],'g');
			content = content.replace(term,'<span>' + replacements[j] + '</span>')
		}
		$(this).html(content);
	});
});

//Adds new uniqueArr values to temp array
function uniqueArr(a) {
 temp = new Array();
 for(i=0;i<a.length;i++){
  if(!contains(temp, a[i])){
   temp.length+=1;
   temp[temp.length-1]=a[i];
  }
 }
 return temp;
}
 
//Will check for the Uniqueness
function contains(a, e) {
 for(j=0;j<a.length;j++)if(a[j]==e)return true;
 return false;
}
