$(document).ready(function(){
	
	$("#welcome").append("<div id=\"box\"></div>");
	
	var rand1=Math.floor(Math.random()*1000);
	var rand2=Math.floor(Math.random()*1200);
	
	
	$("#links #footer").append("<div class=\"fishy\"></div><div class=\"fishy\"></div><div class=\"fishy\"></div>")
	$(".fishy:first").css({ right: rand1 + "px", top: "6px"})
	$(".fishy:last").css({ right: rand2 + "px", top: "10px", backgroundPosition: "-67px 0" }).animate({ right: "-100px", top: "20px" }, 60000)
	
	$(".fishy").animate({
		right: "1600px", top: "50px"
	}, 60000).click(function(){
		
		$(this).toggle(
			function (){
				$(this).stop().css({backgroundPosition: "-67px 0"})
				.animate({
					right: "-=200px"

				}, 500	,function(){
					$(this)
					.animate({
						right: "-200px",
						top: "-=10px"
					}, 60000)
					})	
			}, function(){
				$(this).stop().css({backgroundPosition: "0 0"})
				.animate({
					right: "+=800px"

				}, 6000 ,function(){
					$(this).css({backgroundPosition: "-67px 0"})
					.animate({
						right: "-100",
						top: "+=10px"
					}, 50000)
				})
			})
			.append("<p class=\"bubbles\">&nbsp;</p>")
		
		$(".bubbles").css({ position: "absolute"})
		.animate({
			bottom: "180px"
			
		}, 2000)
	});
	$(".logo").css({ opacity: "0.8" }).mouseover(function(){
		$(this).css({ opacity: "1" });
	}).mouseout(function(){
		$(this).css({ opacity: "0.8" }, 300);
	});
	

});

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
 var anchor = anchors[i];
 if (
 anchor.getAttribute("href") && (
 anchor.getAttribute("rel") == "external" ||
 anchor.getAttribute("rel") == "external nofollow" ||
 anchor.getAttribute("rel") == "nofollow" ||
 anchor.getAttribute("class") == "buy-button")
 )
 anchor.target = "_blank";
 }
}
window.onload = function() {
externalLinks();
}