$(function() {

	$("#contact_panel_link, #contact_panel_wrap").hover(
		function() { 
			$("#contact_panel_link").addClass("active");
			$("#contact_panel_wrap").show();
			try { pageTracker._trackEvent('UI', 'Contact Us Panel', 'Opened'); } catch (e) { }
		},
		function() {
			$("#contact_panel_wrap").hide();
			$("#contact_panel_link").removeClass("active");
		}
	);

	$(".rollover").hover(
		function() { 
			var currentImg = $(this).attr('src'); 
        	$(this).attr('src', $(this).attr('rel'));
	       	$(this).attr('rel', currentImg);
	   	}, 
	   	function() {
	       var currentImg = $(this).attr('src');
	       $(this).attr('src', $(this).attr('rel'));
	       $(this).attr('rel', currentImg);
	   	}
	);

	$(".legal_list").legalListify();

	$('a[rel*=facebox]').facebox({
		loadingImage : '/media/lib/facebox/loading.gif',
      	closeImage   : '/media/lib/facebox/closelabel.gif'
	});
	
	var profiles =
	{
		windowCenter:
		{
			height:500,
			width:900,
			center:1
		}		
	};

	
	$(".popupwindow").popupwindow(profiles);

});

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);
