// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


var mouseX = 0;
function bBGoffset() {
		i = document.getElementById('bodyBG').offsetTop
}
function rdyBG() {
	 
	  
	 t = mouseX-width/2
	 x = t/100
	 xr = t/10
	 xr2 = t/30
	 x2 = 300
	 bBGoffset();

  bgx = 3388-width/2+x
	 bgy = i-1200
	$("#subwaypan").css("background-position", bgx+"px "+bgy+"px");
	
	$("#random1").css("top", i-165);
	$("#random1").css("left", -xr);
	 $("#random1").css("width", width-xr);
	$("#random2").css("top", i-150);
	$("#random2").css("left", -xr2);
	 $("#random2").css("width", width-xr2);
}

function daddy(){
    width = $(window).width()
		if (width <= 1180){
				$("#topMenu").css("margin-left", -333-(1180-width)/2);
		}
		bBGoffset(); 
		if (i <= 740){
			$("#bodyBG").css("top", "740px");
			$("#subwaypan").css("height", "740px");
			
		}
		$("#twitpicbutton").click(function () {
	      $("#TwitPicPoster").toggle();
	    });
			$("#twitCancel").click(function () {
		      $("#TwitPicPoster").toggle();
		    });
		
}

	$(document).mousemove(function(e){
      mouseX = e.pageX;
      
			rdyBG();
   });
 
$(document).ready(function () {
	
	setTimeout(function () {$("#framedMonsterFrame").css("z-index", "200");}, 500);
	$("#random1").css("visibility", "visible");
	$("#random2").css("visibility", "visible");
	daddy();
	rdyBG();
 });

$(window).resize(function (e) {
	mouseX = width;
	daddy();
	rdyBG();
 });


$(document).scroll(function () {
	
	var scrollTop = $(window).scrollTop();
	$("#doodle").css("top", scrollTop-10);
	 });