

// 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],
[".promotion h4",'div {font-family: __standard; font-size: 16px; color: #ffffff; letter-spacing: 1px;} strong {font-family: __standard; color: #ffffff; display: inline}', true, true, "myriad.swf"],
[".product h4",'div {font-family: __standard; font-size: 16px; color: #ffffff; letter-spacing: 1px;} strong {font-family: __standard; color: #ffffff; display: inline}', true, true, "myriad.swf"],
["#contact_address h3",'div {font-family: __strong; font-size: 18px; color: #ffffff; letter-spacing: 1px;} strong {font-family: __standard; color: #ffffff; display: inline}', true, true, "myriad.swf"],
["h1",'div {font-family: __standard; font-size: 17px; color: #bbbbbb; letter-spacing: 1px;} strong {font-family: __standard; color: #ffffff; display: inline}', true, true, "myriad.swf"],
["h3",'div {font-family: __standard; font-size: 14px; color: #ffffff; letter-spacing: 1px;} strong {font-family: __standard; color: #bbbbbb; display: inline}', true, true, "myriad.swf"],
["#footer h4",'div {font-family: __standard; font-size: 13px; color: #0077c0; letter-spacing: 1px;} strong {font-family: __standard; color: #ffffff; display: inline}', true, false, "myriad.swf"],
[".profile h4",'div {font-family: __standard; font-size: 16px; color: #ffffff; letter-spacing: 1px;} strong {font-family: __standard; color: #ffffff; display: inline}', true, false, "myriad.swf"],
[".profile h5",'div {font-family: __standard; font-size: 12px; color: #cccccc; letter-spacing: 1px;} strong {font-family: __standard; color: #ffffff; display: inline}', true, false, "myriad.swf"]

/*["h1",'div {font-family: __standard; font-size: 35px; color: #028bb5; letter-spacing: 0px;} strong {font-family: __standard; color: #091858; display: inline}', false, false, "frutiger.swf"],						 
["h2",'div {font-family: __standard; font-size: 35px; color: #028bb5; letter-spacing: 0px;} strong {font-family: __standard; color: #091858; display: inline}', false, false, "frutiger.swf"],
["h3",'div {font-family: __standard; font-size: 20px; color: #028bb5; letter-spacing: 0px; leading: 0px} strong {font-family: __standard; color: #091858; display: inline}', false, false, "frutiger.swf"],
["h4",'div {font-family: __standard; font-size: 20px; color: #028bb5; letter-spacing: 0px; leading: 0px} strong {font-family: __standard; color: #091858; display: inline}', false, false,  "frutiger.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=" + escape(replaceText) + "&css=" + escape(css) + "&showfilters=" + showFilters);

			  }
			}
		}			
	}

}

EventUtils.addEventListener(window,'load',doHeadingReplace);
