

$(document).ready(function() {
	
      /* Simon's Flash Replacement */
      if($('#homepagetitle').length > 0)
      {
            var so = new SWFObject('/site_media/swf/omniproductions/H1homepage.swf', "homePageTitle", '300', '45', "9", "#996633");
            // grab replacement txt from the h1's inner HTML
            var title = $('#homepagetitle').html().toLowerCase().split('<br>')[0]
            var subtitle = $('#homepagetitle').html().toLowerCase().split('<br>')[1].replace(/(<([^>]+)>)/ig,"")
            so.addParam("wmode", "transparent");
            so.addVariable("title", title);
            so.addVariable("subtitle", subtitle);
            so.write("homepagetitle");
      }
      
      /* H1 */
      $('.h1replace').each(function()
      {
            var so = new SWFObject('/site_media/swf/omniproductions/h1header.swf', "pageTitle", '608', '70', "9", "#000000");
            so.addParam("wmode", "transparent");
            // grab replacement txt from the h1's inner HTML
            var title = $(this).html().toLowerCase().split('<br>')[0]
            var subtitle = $(this).html().toLowerCase().split('<br>')[1]
            if(title)
            {
                  so.addVariable("title", title.replace('&amp', '%26'));
                  so.addVariable("subtitle", subtitle.replace('&amp', '%26'));
                  so.write($(this).attr('id'))
            }
      });

      /* H2 */
      $('.h2replace').each(function()
      {
            var so = new SWFObject('/site_media/swf/omniproductions/h2header.swf', "optionstitle", '180', '16', "9", "#ffffff");
            so.addParam("wmode", "transparent");
            var title = $(this).text().replace('&', '%26')
            title = title.toUpperCase()
            so.addVariable("title", title)
            so.write($(this).attr('id'))
      });
      
      
      $('.h3replace').each(function()
      {
            var so = new SWFObject('/site_media/swf/omniproductions/h3header.swf', "optionstitle", '200', '45', "9", "#ffffff");
            so.addParam("wmode", "transparent");
            var title = $(this).text().replace('&', '%26')
            title = title.toUpperCase()
            so.addVariable("title", title)
            so.write($(this).attr('id'))
      });
      
      /* H4 */
      $('.h4replace').each(function(){
            var so = new SWFObject('/site_media/swf/h4neutratext.swf', 'rep-'+$(this).attr('id'), '220', '27', "9", "#ffffff");
            so.addParam("wmode", "transparent");
            var href = $(this.firstChild).attr('href')
            so.addVariable("link", href);
            so.addVariable("title", $(this.firstChild).text());
            so.write($(this).attr('id'))
	});

      /* H5 */
	$('.h5replace').each(function(){
	    var so = new SWFObject('/site_media/swf/h5header.swf', "sectionTitle", '220', '15', "9", "#ffffff");
            so.addParam("wmode", "transparent")
            so.addVariable("title", $(this).text().replace('&', '%26'))
            so.write($(this).attr('id'))
	});

}); 