
// Constants
var forceUpperCase = true;

// Tags to replace with heading_replace.swf, and font sizes to be used in the flash movie.
var headings = new Array( 
                        ["#home .tagline",'div {font-family: __standard; font-size: 12px; color: #eeeeee; letter-spacing: 2px; text-align: right;} a{display: inline; text-decoration: underline} strong{display: inline; color: #002e58}'],
                        [".tagline",'div {font-family: __standard; font-size: 12px; color: #999999; letter-spacing: 2px; text-align: right;} a{display: inline; text-decoration: underline} strong{display: inline; color: #002e58}'],
                        [".hp_menu_item strong",'div {font-family: __bold; font-size: 40px; color: #eeeeee; letter-spacing: 2px; text-align: left;}'],
                        [".mi_large strong",'div {font-family: __bold; font-size: 40px; color: #999999; letter-spacing: 2px; text-align: left;}'],
                        [".mi_small strong",'div {font-family: __bold; font-size: 25px; color: #999999; letter-spacing: 2px; text-align: left;}'],
                        ["#content h1",'div {font-family: __standard; font-size: 25px; color: #777777; letter-spacing: 2px;} a{display: inline; text-decoration: underline} strong{display: inline; color: #002e58}']
                        );

//var headings = new Array();

// Hide these elements until the flash is loaded.
document.write('<style type="text/css">');
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);
