
jQuery(function($) {
    var $ticker = $('.ticker');
        
    //setup the gross marquee (options are managed on the tage)
    if ($ticker.length != 0) {
        if ($.browser.msie)
			$ticker.find('div').wrap('<marquee />');
		else
			$ticker.find('div').marquee();
    }
    
    $('select.links').change(function(e){
       if (this && makePopup) {
           var $selectedItem = $(':selected', $(this));
           
           //call the makePopup function and set it's *this* reference to the link
           this.href = $selectedItem.val();
           makePopup.call(this, e);
           
           // track these as outbound links in Google Analytics
           // category, event, label
           pageTracker._trackEvent('Outbound Links', 'Dropdown Link: '+ $selectedItem.text(), $selectedItem.val());
       }
    });
    
    // popup links in body of iCustomer articles
    $('.basic .externalContent a').click(function(e) {
        // if there's javascript, leave it alone
        if (this.href.indexOf('javascript') >= 0) return;
        
        e.preventDefault(); //don't follow the link
        makePopup.call(this, e);
    });
    
	var twitterFeed = $('#twitterfeed');
	if (twitterFeed.length > 0) {
		$('#twitterfeed').delegate('a', 'click', function(e) {
			makePopup.call(this, e);
			
			return false;
		});
	}
	
	$('#print').click(function() {
		var category = 'Print Links';
		var action = $('h1:first').text();
		var label = location.href;
		pageTracker._trackEvent(category, action, label);
	});
});
