// JavaScript Document
$(function(){
	//Alt tags
	$("img[alt='']").each(function() {$(this).attr("alt", ( ( $(this).attr("name")== null ) ? $(this).attr("src") : $(this).attr("name")))});
	//Rollovers
	$("img").each(function() {
		if($(this).attr("over") != null) {
			var overImg = $(this).attr("over");
			var srcImg = $(this).attr("src");
			$(this).hover(
				function() {
					$(this).attr("src", $(this).attr("over"));
				},
				function() {
					$(this).attr("src", srcImg );
				}		
			)
		}
	});
	/* setup tooltips */
	var as = [];
	$('img, a').each(function(a){
		$(this).hover(function(e) {
			var oLeft = e.pageX + 3;
			var oTop = e.pageY + 3;
			var popup = $(document.createElement("div"));
			popup.addClass("popup");
			$("body").append(popup);
			popup.css({ position: "absolute", left:oLeft, top:oTop, opacity:0.9});
			popup.append($(this).attr("popup"));
		}, function() {
			$(".popup").each(function() {
				$(this).removeClass("popup");
				$(this).fadeOut("normal", function(){$(this).remove();});
			});
		});
		$(this).mousemove(function(e) {
			var oLeft = e.pageX + 3;
			var oTop = e.pageY + 3;
			$(".popup").css("left", oLeft);
			$(".popup").css("top", oTop);
			
		});
	});


	$("table").each(function() {
		if($(this).attr("cellspacing") == undefined) {
			$(this).attr("cellspacing", 0)					 
		}
	});

	$("input[type='text']").focus(function() {
		$(this).select();
	});
});
