var $j = jQuery.noConflict();

/*
var tooltips = { //tooltip to show Alt text
	init:function(selector){
		xOffset = -4;
		yOffset = -29;

		$j(selector).hover(function(e){
			var tip = $j(this).attr('alt');
			$j(this).parent().parent().parent().before("<div ID='btooltipOuter'><div ID='btooltipHolder'><div ID='btooltip'> "+ tip +"</div><div ID='btooltippointerBottom'></div></div></div>");
			$j("#btooltipOuter").css("top", yOffset + "px").css("left", xOffset + "px").fadeIn(1000); },
			//rollout						
			function(e){ $j('#btooltipOuter').remove();
			 });			
			$j('#btooltipHolder').mousemove(function(e){ $j(selector).css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px");
			});
						 }
		} 

*/

function mainmenu(){
$j("#mainNav ul").css({display: "none"}); // Opera Fix

$j(" #mainNav li").hover(function(){//rollover
	$j(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(400);
  	$j(this).addClass('activeHover');
  	}, function(){//rollout
  	$j(this).find('ul:first').slideUp(100);
   	$j(this).removeClass('activeHover');
  });
}

 
 $j(document).ready(function(){     
 	mainmenu();
	//menu styling
	//$j("#mainNav UL LI:first-child").before("<li class='navcap'>&nbsp;</li>");
	//$j("#mainNav UL LI:last-child").after("<li class='navbot'>&nbsp;</li>");
	$j("#mainNav UL LI:first-child").addClass("first");
	$j("#mainNav UL LI:last-child").addClass("last");
	
	$j("#contentRight UL:first").addClass("first");
	$j("#contentRight UL:first LI:first").addClass("first");
	$j("#contentRight P:first").addClass("first");
	
	//attachment links
	$j('#contentMain a[href$=".pdf"]').each(function(){
    		$j(this).wrap("<span class='pdf'></span>");
		}); 
		
	$j('#contentMain a[href$=".doc"]').each(function(){
    		$j(this).wrap("<span class='doc'></span>");
		}); 
		
	$j('#contentMain a[href$=".ppt"]').each(function(){
    		$j(this).wrap("<span class='ppt'></span>");
		}); 
		
	//init tooltips
	//tooltips.init(".feature_img");
		
		$j('.feature_img').mousemove(function(event) {
		
			$j('#btooltipHolder').css({
				top: (event.pageY - 41) + 'px',
				left: (event.pageX - 16) + 'px'
			});
			$j('#btooltipHolder').fadeIn(500);
		}); 
		
		$j('.feature_img').hover(
			//roll over
			function(){
				var tip = $j(this).attr('alt');
				$j('#tooltips').html("<div ID='btooltipHolder'><div ID='btooltip'> "+ tip +"</div><div ID='btooltippointerBottom'>&nbsp;</div></div>");
			},
			//rollout
			function () {
				$j('#btooltipHolder').remove();
     		 }
			 );			

		$j("a[href^='http']").not("[href*='ecmgroup.com.au']").attr('target','_blank');
		
		
	
	
});


