if (!window['console']) {
	window.console = {};
}
console.info  = console.info  || function(){};
console.log   = console.log   || function(){};
console.warn  = console.warn  || function(){};
console.error = console.error || function(){};
console.debug = function(){}; // console.debug || function(){};

jQuery.fn.textNodes = function() {
  var ret = [];
  this.each( function() {
    var fn = arguments.callee;
    jQuery(this).contents().each( function() {
      if ( this.nodeType == 3 )
        ret.push( this );
      else fn.apply( jQuery(this) );
    });
  });
  return jQuery(ret);
}

jQuery(document).ready(function($){

	var nodes = $('h1, h2').textNodes();

	$.each(nodes, function(){
		if ( $(this.previousSibling).is('br') ||
		        ($(this.parentNode).is('h1, h2') &&
		         $(this.previousSibling).length == 0) ) {

			// "this.textContent" only works in Firefox.  "this.nodeValue" (might?) work everywhere...
			this.nodeValue = $(this).text().replace(/\s*/, "");
			// this.nodeValue = $(this).text().replace(/o/, "O");
		}
	});
});

