$(function(){
    /* catch-all for external links (eventually (you too can help)) */
    var ext_lynx = ''; // comma-sep. string of css selectors 
    ext_lynx += "#join-us a, .tweet-header a, .tweet-body a";
    ext_lynx += ", .news-excerpt-body a";
    ext_lynx += ', #upcoming-shows a, #dont-miss-rotator a, #rss-feed';
    ext_lynx += ', .dont_miss .rotator a';
    $(ext_lynx).each( function(){
	  $(this).attr("target","_blank");
    });

  $('#mailing-list-submit').
  click(function(){
	$(this).parents('form').submit();
  });

	/**************** AD ROTATOR **********************/
	$('#dont-miss-rotator').cycle({
	  fx: 'fade',
	  speed: 'fast',
	  timeout: 5000,
	  next: '#dont-miss h2 a.next',
	  prev: '#dont-miss h2 a.previous'
	});



    // fix column height?
    var lc_height = $('#left-column').height();
    var news_height = $('#left-column div:first').height();
    var rc_height = $('#right-column').height();
    var us_height = $('#upcoming-shows').height();

    // 
    if( lc_height > rc_height ){
      var msg = 'left column is bigger\n';
      msg += lc_height + ' > ' + rc_height + '\n';
      msg += 'news height: ' + news_height + '\nupcoming-shows height: ' + us_height + '\n';

      //      var height_difference = (lc_height - rc_height) - 75; // to account for padding
      var height_difference = (lc_height - rc_height) - 75; // to account for padding
      //var height_difference = (lc_height - rc_height); // to account for padding
      msg += height_difference + ' = difference\n';
      /**/
      $('#upcoming-shows').append('<div class="show"><!-- ie --></div>');
            $('#upcoming-shows .show:last').css('height', height_difference + 'px');
      $('#upcoming-shows .show:last').css('border-bottom', 'none');
      /**/
      //      alert(msg);

    }else if(lc_height < rc_height){

      /* this one seems to work */

      var msg = 'right column is bigger\n';
      msg += lc_height + ' < ' + rc_height + '\n';
      msg += 'news height: ' + news_height + '\n';
      msg += 'upcoming-shows height: ' + us_height + '\n';
            var height_difference = (rc_height - lc_height) + 15; // to account for padding
	    //var height_difference = (rc_height - lc_height); // to account for padding
      msg += height_difference + ' = difference\n';
      $('#news-paging').css('padding-top', height_difference + 'px');
      //            alert(msg);
    }


    /************
     * IE FIXES NEEDED ON EVERY PAGE
     * (THAT'S WHY THEY'RE IN GLOBAL)
     * Please leave near bottom of this file.
     *************/
    if($.browser.msie){

    // hide arrows in IE when no paging 
      if($('#previous-page').text() == ''){
	$('#previous-page').css('background-image', 'none');
      }
      if($('#next-page').text() == ''){
	$('#next-page').css('background-image', 'none');
      }
    }
});
