
// Constants
var forceUpperCase = false;

// Tags to replace with heading_replace.swf, and font sizes to be used in the flash movie.
var headings = new Array( 
						  ["#content_title h1",'div {font-size: 19px; color: #ffffff; font-family: __heading;} a{display: inline; text-decoration: underline} strong{display: inline; color: #ffffff; font-family: __headingBold}'],
						  ["#service_title",'div {font-size: 13px; color: #dddddd; font-family: __heading;} a{display: inline; text-decoration: underline} strong{display: inline; color: #ffffff; font-family: __headingBold}']
);

//var headings = new Array();

// Hide these elements until the flash is loaded.
document.write('<style type="text/css" media="screen">');
document.write(".flash_replace {display: block !important;}");
for(var g=0; g<headings.length; g++)
	document.write(headings[g][0] + " {visibility: hidden;}");
document.write('</style>');


function doHeadingReplace(){
	var els;
	var el;
	var selector;

	var height;
	var width;
	var origHtml;
	var replaceText;
	var css;
	for(var j=0; j<headings.length; j++){
		selector = headings[j][0];
		css = headings[j][1];
		els = getElementsBySelector(selector);
		for(var i=0; i<els.length; i++){
			el = els[i];
			if(el) {
			  if(el.innerHTML.toLowerCase().indexOf('<object')==-1){
				 
				  height = el.offsetHeight;
				  width = el.offsetWidth;
				  
				  //Pull the text out of the node
				  //_origText = getInnerText(el);
				  origHtml = getInnerHtml(el);
				  if(forceUpperCase)origHtml = origHtml.toUpperCase();
				  replaceText = "<div>" + origHtml + "</div>";
				  writeFlash(el, "heading_replace.swf", width, height, "replacecontent=" + escape(replaceText) + "&css=" + escape(css));
			  }
			}
		}			
	}
	
}

EventUtils.addEventListener(window,'load',doHeadingReplace);

