jQuery.fn.parseHeadlineTags = function parseHeadlineTags() {
  return this.each(function(){
    var update = $(this.parentNode.parentNode).find('.headline_tags')
    if (!update || update.length == 0) { return }
    update = $(update[0])

    var tags = $(this.text.split(/\s+/))
    tags = tags.filter( function(){ return this[0] == '#'} )
    if (tags.length == 0) { return }
    update.text("Tagged with: ")
    tags.each( function(){ update.text(update.text() + " " + this) } )
  })
}

$(function() {
  $('.pretty-date').livequery(function(){$(this).prettyDate('%b %d, %Y %I:%M%p')});
  setInterval(function(){ $('.pretty-date').prettyDate('%b %d, %Y %I:%M%p'); }, 30000);
  
  //Facebox
  $('a[rel*=facebox]').facebox(); 
  
  
  //Full Page Map
  //$('.thepagemap').show();
  
  
  //Search Box
	$('.search_box').click(function() {
		if ($(this).val() == 'Search Newtter') {
		  $(this).val('');
		  $(this).css('color', '#000000');
	  }
	});

  $('.postal_box').click(function() {
    if ($(this).val() == "Postal Code") {
      $(this).val('');
      $(this).css('color', '#000000');
    }
  });
  
  setInterval(function(){ $('.headlines_item_title a').parseHeadlineTags() })
});

