jQuery(document).ready(function($){
	$("#ipmbar ul:first > li").hover(
		function(){ $("ul:first", this).slideDown("fast"); }, 
		function(){ $("ul:first", this).slideUp("fast"); }
	);
	$("#ipmbar ul ul > li").hover(
		function(){ $("ul", this).fadeIn("fast"); }, 
		function(){ $("ul", this).fadeOut("fast"); }
	);
	if (document.all) { $("#ipmbar ul:first li").hoverClass("over"); }
});
jQuery.fn.hoverClass = function(c){
	return this.each(function(){
		jQuery(this).bind('mouseenter mouseleave', function(e){ jQuery(this).toggleClass('over'); });
	});
};
function find_ext_links() {
	// Tag all links in the IPM bar and anything else with rel="external"
	jQuery('#ipmbar').find('a').bind( 'click', function(ev){ which_bar_link(ev, 'ipmbar'); } ); // [rel!=tab]
	jQuery("a[rel*='external']").bind( 'click', function(ev){ external_link(ev); } );
	// Follow with any other custom events
	// jQuery("#top_nav").find("a").bind( 'click', function(ev){ which_link(ev, 'top_nav'); } );
}
// The following require Unica, but will not fire untill after it is loaded.
function external_link(ev)
{
	ntptAddPair("href", ev.target.href);
	ntptEventTag("ev=offsite_link");
}
function which_bar_link(ev, zone)
{
	switch(ev.target.tagName)
	{
		case 'IMG':
			evsrc = jQuery(ev.target).parent().parent().attr('href');
			break;
		default:
			evsrc = jQuery(ev.target).attr('href');
			break;
	}
	ntptAddPair("href", evsrc);
	ntptAddPair("zone", zone);
	ntptEventTag("ev=link");
}
jQuery(document).ready(function($){ find_ext_links(); });
