$(document).ready(function() {
  Shadowbox.init();
  
  var $w=$(window).width()-750;
  var $h=$(window).height()-200;
  $('#meemail').css({"top":$(window).height()-15+"px"});
  
  function myFadeIn($this,$fade){
  place($this);
  	$this.fadeIn($fade,function(){
  		var $fade2=Math.floor(Math.random()*2000)+1000;
		myFadeOut($this,$fade2);
	});//end myFadeIn
  }
  function myFadeOut($this,$fade){
  $this.fadeOut($fade,function(){
  	var $fade2=Math.floor(Math.random()*5000)+5000;
  	myFadeIn($this,$fade2);
	});//end myFadeOut
  }
  
  
  function place($this){
  	var $x=0;
	var $y=0;
	$x=Math.floor(Math.random()*$w);
	$x+=550;
	$y=Math.floor(Math.random()*$h);
	$y+=100;
	$this.css({"top":$y+'px',"left":$x+'px'});
  	}
  
  //ADD FUNCTIONS TO EACH LINK
  if ($(window).width()>=550){
    	$('a').each(function(i){
			$this=$(this);
			$(this).hover(function(){
								 $(this).stop(true,false).animate({"opacity":1},200);
								 },
								 function(){
									 
									 
									 $(this).stop(true,false);
									 myFadeOut($(this),1000);
									 });
			//$this.mouseover(function(){$this.click();});
			var $fade2=Math.floor(Math.random()*3000)+3000;
			myFadeIn($this,$fade2);
		});//end EACH
	}//if screen is large enough;
	
	
	
  });//END document ready