$(document).ready(function() {
	$('div#container').addClass("active");
	$('.issueArchive li a').after("<img src='/images/blue-more-arrow.gif' />"); 
});



/*
 * Base JavaScript Files to handle common tasks
 */

/* prepend article tools to contentWell */
$(document).ready(function() {
	$('#contentWell .articleTools ul').append('<li class="clickabilityEmail"><a href="#" onclick="return(ET());" onMouseOver="return(ETMouseOver());" onMouseOut="return(ETMouseOut());">Email</a></li><li class="clickabilitySave"><a href="#" onclick="return(ST());" onMouseOver="return(STMouseOver());" onMouseOut="return(STMouseOut());">Save</a></li><li class="clickabilityPrint"><a href="#" onclick="return(PT());" onMouseOver="return(PTMouseOver());" onMouseOut="return(PTMouseOut());">Print</a></li><li class="reprint"><a href="http://www.icopyright.com/' + icopy + '?icx_id=' + siteURL + '">Reprint</a></li>'); 
});

/* add _blank to any link with class="popup" */
$(document).ready(function() { 
	$('a.popup').click(function() {
		this.target = "_blank";
	});
});




/* grab search terms from google */
/*
$(document).ready(function() {
  if (!document.referrer) return;
  var matches = document.referrer.match(/[?&]q=([^&]*)/);
  if (!matches) return;
  var terms = unescape(matches[1].replace(/\+/g, ' '));
  var re = new RegExp().compile('(' + terms + ')', 'i');
  $("#content *").each(function() {
    if ($(this).children().size() > 0) return;
    if ($(this).is("xmp, pre")) return;
    var html = $(this).html();
    var newhtml = html.replace(re, '<span class="qterm">$1</span>');
    $(this).html(newhtml);
  });
});
*/

$(document).ready(function() {
  if (!document.referrer) return;
  var matches = document.referrer.match(/[?&]q=([^&]*)/);
  if (!matches) return;
  var search404Term = unescape(matches[1].replace(/\+/g, ' '));
  $("#404searchSite").val(search404Term);
});


