$(function() {
 
//	$("#featbox div.scrollable ul.items li span").css({opacity: .85});


// Tooltips for Webtools

	var offsetX = -10;
	var offsetY = 18;
	
	$('#webtools li a').hover(function(e) {
		var desc = $(this).attr('rel');
		$('<div id="wtDesc"><span>' + desc + '</span></div>')
		.css('top', e.pageY + offsetY)
		.css('left', e.pageX + offsetX)
		.appendTo('body').hide().show("fast");
	}, function() {
		$('#wtDesc').remove();
	});
	
	$('a').mousemove(function(e) {
		$("#wtDesc").css('top', e.pageY + offsetY).css('left', e.pageX + offsetX);
	});


// Show/Hide Submenu from Main Nav

  $('#nav > li').hover(
	function() { 
//	  $('#nav ul').hide();
	  $(this).children('ul').stop(true, true).delay(150).fadeIn(400);
	  $(this).children('a').addClass("hover"); 
	},
	function() { 
	  $(this).children('ul').stop(true, true).delay(300).fadeOut(100); 
	  $(this).children('a').removeClass("hover"); 
	});


//Tootips for Directory Listing
 
	var ttX = 7;
	var ttY = -13;
	
	$('#dirlist li a').hover(function(e) {
		var desc = $(this).attr('rel');
		$('<div id="activDesc"><span>' + desc + '</span></div>')
		.css('top', e.pageY + ttY)
		.css('left', e.pageX + ttX)
		.appendTo('body').hide().fadeIn(200);
	}, function() {
		$('#activDesc').remove();
	});
	
	$('#dirlist li a').mousemove(function(e) {
		$("#activDesc").css('top', e.pageY + ttY).css('left', e.pageX + ttX);
	});
 
 
// News Tabs

	$('#newsel > li a:first').addClass("sel");
	$("#newsContent").hide();
	$.ajax({
		type: "GET",
		url: "/_inc/gfeed-en.asp",
		data: "feed=albufeira",
		success: function(html){
			$('#loading').hide();
			$("#newsContent").html(html).slideDown('normal');
			}
	});
		
	$('#newsel > li a').click(function() {
		var newsf = $(this).attr('href');

		$('#newsel > li > a').removeClass("sel");
		$(this).addClass("sel");
		$('#newsfeed h3 a').attr('href', 'http://news.google.com/news?pz=1&amp;ned=us&amp;hl=en&amp;q=' + newsf);
		$("#newsContent").hide();
		$('#loading').stop().animate({opacity: "show"}, 400);

		$.ajax({
			type: "GET",
			url: "/_inc/gfeed-en.asp",
			data: "feed=" + newsf,
			success: function(html){
				$('#loading').hide();
				$("#newsContent").html(html).slideDown('normal');
				}
		});
		return false;
	});
});

//Clipping function to reduce & crop to specific size
(function($){  
    $.fn.imgClip = function(vars) {
				var clipW = 80;
				var clipH = 80;
				$(".piclip").each(function() {
					var imgsizew = parseInt( $(this).attr('width'));
					var imgsizeh = parseInt( $(this).attr('height'));
					$(this).css('position', 'relative');
					
					if (imgsizew > imgsizeh) {
						$(this).css('height', clipH+'px')
						$(this).css('left', '-'+((parseInt( $(this).attr('width'))-clipW)/2)+'px');
					}
					else{
						$(this).css('width', clipW+'px')
						$(this).css('top', '-'+((parseInt( $(this).attr('height'))-clipH)/2)+'px');
					};
				  $(this).animate({ opacity: "1" }, "fast");
     		});
		};
})(jQuery);

<!--
function addtofav(){t=document.title;l=location.href;m1="Press Ctrl + ";m2=" to Bookmark this page";if(window.opera != undefined ){var v="T";alert(m1+v+m2);}else if(window.sidebar){window.sidebar.addPanel(t, l,"")}else if(document.all!= -1){window.external.AddFavorite(l,t);}else {v="D";alert(m1+v+m2);}}
//-->
<!--
function tell(){
	t='/tellafriend';
	l=location.href;
	window.location=t+'?page='+l;
	};
//-->
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->

