

// Tags to replace with heading_replace.swf, and font sizes to be used in the flash movie.
var headings = new Array( 
["#sidebar_header h2",false],
["#promo_strip h4",false],
[".smartlift h1",'div {font-family: __standard; font-size: 20px; color: #151c54; letter-spacing: 0px;} strong {font-family: __standard; color: #091858; display: inline} em{display: inline; font-family: __em;}', false, false, "helvetica.swf"],
["#news h1",'div {font-family: __standard; font-size: 20px; color: #151c54; letter-spacing: 0px;} strong {font-family: __standard; color: #6292b8; display: inline} em{display: inline; font-family: __em;}', false, false, "helvetica.swf"],
["#welcome h1",'div {font-family: __standard; font-size: 20px; color: #151c54; letter-spacing: 0px; text-align: right;}', true, false, "helvetica.swf"],
["h1",'div {font-family: __standard; font-size: 20px; color: #151c54; letter-spacing: 0px;} strong {font-family: __standard; color: #6292b8; display: inline} em{display: inline; font-family: __em;}', true, false, "helvetica.swf"],

["#contact_details h2",'div {font-family: __standard; font-size: 18px; color: #6292b8; letter-spacing: 0px; leading: 2px;} strong {font-family: __standard; color: #091858; display: inline} a {color: #b8e3f0; display: inline;} a:hover {color: #ffffff; text-decoration: underline}', false, false, "helvetica.swf"],
["#products_overview h2",'div {font-family: __standard; font-size: 14px; color: #6292b8; letter-spacing: 0px; leading: 2px; text-align: right;} strong {font-family: __standard; color: #091858; display: inline} a {color: #b8e3f0; display: inline;} a:hover {color: #ffffff; text-decoration: underline}', true, false, "helvetica.swf"],
["h2",'div {font-family: __standard; font-size: 14px; color: #6292b8; letter-spacing: 0px; leading: 2px;} strong {font-family: __standard; color: #091858; display: inline} em {font-family: __em; display: inline} a {color: #b8e3f0; display: inline;} a:hover {color: #ffffff; text-decoration: underline}', false, false, "helvetica.swf"],
[".partner h3",'div {font-family: __standard; font-size: 14px; color: #6292b8; letter-spacing: 0px; leading: 2px;} strong {font-family: __standard; color: #091858; display: inline} a {color: #b8e3f0; display: inline;} a:hover {color: #ffffff; text-decoration: underline}', true, false, "helvetica.swf"],
[".smartlift h4",'div {font-family: __standard; font-size: 12px; color: #151c54; letter-spacing: 0px;} strong {font-family: __standard; color: #091858; display: inline}  em{display: inline; font-family: __em;}', false, false, "helvetica.swf"],

["#promo_distributors strong",'div {font-family: __strong; font-size: 14px; color: #ffffff; letter-spacing: 0px; leading: -2px;}', true, true, "helvetica.swf"]

);						  

// 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;} .hide {display: none}");
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);
		
		var forceUpper = headings[j][2];
		var showFilters = headings[j][3];
		var flashFile = headings[j][4];

		for(var i=0; i<els.length; i++){
			el = els[i];
			if(el) {
  			  if(css == false){
					el.skip = "skip";
					el.style.visibility = "visible";
			  }
			  else if(el.innerHTML.toLowerCase().indexOf('<object')==-1 && el.skip != "skip"){
				 
				  height = el.offsetHeight;
				  width = el.offsetWidth;
				  //Pull the text out of the node
				  //_origText = getInnerText(el);
				  origHtml = getInnerHtml(el);
				  if(forceUpper)origHtml = origHtml.toUpperCase();
				  replaceText = "<div>" + origHtml + "</div>";
				  writeFlash(el, flashFile, width, height, "replacecontent=" + encodeURIComponent(replaceText) + "&css=" + escape(css) + "&showfilters=" + showFilters);

			  }
			}
		}			
	}

}

EventUtils.addEventListener(window,'load',doHeadingReplace);
