// javascript added by kchevalier@suntouchdesign.com, 10/08



/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */

this.tooltip = function(){	
	/* CONFIG */		
		xOffset = -15;
		yOffset = 15;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	jQuery("a.userPic").hover(function(e){											  
		info = jQuery(this).next(".userInfo").html();
		jQuery("body").append("<p class='hover'>"+ info +"</p>");
		jQuery(".hover")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn(160);		
    },
	function(){		
		jQuery(".hover").remove();
		
    });	
	jQuery("a.userPic").mousemove(function(e){
		jQuery(".hover")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
function submitpollnew(frmname,id,count)
{
	document.getElementById('poll').value=count;
	document.getElementById('id').value=id;
	document.getElementById(frmname).submit();
}
function activityPoints() {	
	/* CONFIG */		
		xOffset = -15;
		yOffset = 15;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	jQuery("span.activityStars").hover(function(e){											  
		info = jQuery(this).next("em.activityPoints").html();
		jQuery("body").append("<p class='hover'>"+ info +"</p>");
		jQuery(".hover")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn(160);		
    },
	function(){		
		jQuery(".hover").remove();
		
    });	
	jQuery("span.activityStars").mousemove(function(e){
		jQuery(".hover")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

function newWindow() {
	jQuery("a.newWin").click(
		function(){
			window.open( jQuery(this).attr("href"), 'forgot', 'left=200,top=100,width=500,height=500,toolbar=0,resizable=0' );
			return false;
		});
}


function healthNews() {
	jQuery("#healthNews h4").click(
		function() {
			var header = jQuery(this);
			var items = header.next( ".newsItems" );
			var current = jQuery(".newsItems:visible");
			if ( items.css("display") != 'block' ) {
				current.fadeOut( 400, function() {
					items.fadeIn( 400 );
					current.parent().removeClass( 'show' );
					header.parent().addClass( 'show' );
				} );
			}
			return false;
		} );
}


jQuery(document).ready(function(){
	tooltip();
	activityPoints();
	newWindow();
	healthNews();
});
