
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22967433-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


jQuery(function($){
	$.expr[':'].external = function(obj){
	    return obj.href.match(/^http\:/)
	            && (obj.hostname != location.hostname);
	};


	$(window).load(function() {
		setTimeout(function(){
			$("body>div").fadeTo(400,1, function() { 
				setTimeout(function(){
					$("#logo").fadeTo("slow",1);

					fadeLogos();			
					
				}, 300);
			});
			
		}, 100);
	});
	
	$("#logo").click(function(e) {
		if($(this).css("opacity") == 1) {
			$(this).fadeTo("slow",0.7);
		} else {
			$(this).pulse({
				opacity: [0.2, 1],
			}, 800, 5, 'linear');
		}
		e.preventDefault();
	});
	
	$(".he").each(function() {
		var el = $(this);
		$.post("he.php", {"key":$(this).attr("id")}, function(ret) {
			el.replaceWith(ret);
		});
	});
	
	
	$('a:external').click(function(e) {
		var target = $(this).attr("href");
		try{ _gat._getTrackerByName()._trackEvent("Out link", $target);} catch(e){};
		$("body").fadeOut("slow",function() {
			window.location = target;
		});
		e.preventDefault();
	});
	
	var fadeLogos = function() {
		$("#logos .logo").each(function(i,el) {
			if($(this).css("opacity")==0) {
				$(el).fadeTo("fast",1, function() {
					fadeLogos();
					return false;
				});
				return false;
			}
		});		
	}
	 
    $('#logos .logo').hover(
	function(e) {
		$(this).find('img').
			stop(false,true).
			animate({
				'width': 56, 
				'height': 56, 
				'top':"2",
				'left':"2"
			}, {duration:300});
		
$("#tooltip").hide().html($(this).find("img").attr("alt")).css({"top":e.pageY+10, 
"left":e.pageX+10}).stop().fadeIn("fast");
    },
    function() {
		$(this).find('img').
			stop(false,true).
			animate({
				'width':60, 
				'height':60, 
				'top':'0', 
				'left':'0'
			}, {duration:300});
		$("#tooltip").fadeOut();
    }).mousemove(function(e) {
    	$("#tooltip").css({"top":e.pageY+10, "left":e.pageX+10});
    });
$("#tooltip").hide();
});

