//http://api.jquery.com/

(function($){
 	tile = function() {
		
		$(document).ready(function() {
			
			$.ajaxSetup({ cache: false });
			
			//show hide nutrition divs with fade
			$('[id^="VEVM"]').click(function() {
				$('[id^="showVEVM"]').fadeOut(600, 'linear');
				$('[id^="VEVM"]').css('color','#333333');
				$('[id^="showVEVM"]').css('display','none');
				$(this).css('color','#e36e05');
				$('#show'+this.id).fadeIn(600, 'linear');
			});
			//__^
			
			//suggest results close
			$('#SuggestResultClose').click(function() {
				$('#suggest_result').hide(0);
			});
			//__^
			
			//autoupdate last reactions every x seconds
			var refreshId = setInterval(function() {
				if ($('#updatelastreactions').length) {
					//$('#updatelastreactions').fadeOut("slow", function () {
					//$(this).load('/_lib/inc/lastreactionsahome.asp').fadeIn("slow");
					//});				
					$.get('/_lib/inc/lastreactionsahome.asp', function(data) {
					  $('#updatelastreactions').html(data);
					});
				}
				if ($('#updatenewmembers').length) {
					$.get('/_lib/inc/lastmembers.asp', function(data) {
					  $('#updatenewmembers').html(data);
					});
				}				
			}, 5000); // 5 seconds
			//__^
			
			//autoupdate last diaries every x seconds
//			var refreshId = setInterval(function() {
//				if ($('#updatelastdiaries').length) {
//					$.get('/_lib/inc/lasdiariesahome.asp', function(data) {
//					  $('#updatelastdiaries').html(data);
//					});
//				}
//			}, 5000); // 5 seconds
			//__^
			
			//autoupdate last members every x seconds
//			var refreshId = setInterval(function() {

//			}, 10000); // 10 seconds
			//__^
			
			//autoupdate last forum reactions every x seconds
//			var refreshId = setInterval(function() {
//				if ($('#updatevfrss').length) {
//					$.get('/_lib/inc/voedingsforumrss.asp', function(data) {
//					  $('#updatevfrss').html(data);
//					});
//				}
//			}, 5000); // 5 seconds
			//__^
					
			//animate icon images
			$(".dbreacicons img").hover(function() {
				var e = this;
				$(e).stop().animate({ marginTop: "-6px" }, 250, function() {
					$(e).animate({ marginTop: "-4px" }, 250);
				});
			},function(){
				var e = this;
				$(e).stop().animate({ marginTop: "2px" }, 250, function() {
					$(e).animate({ marginTop: "0px" }, 250);				
				});
			});
			//__^
			
			$.ajaxSetup({ cache: false });
			
		//end (document).ready
		});
	//end tile
	};
		
})(jQuery);
