var w;
var w_height;
var image_bg_pause = 1;
var temp;
var tempw;

jQuery(function() {
  jQuery(window).scroll(function() {
    w = jQuery(this).scrollTop();
    
    if(w<1) {w=1};
    if(w > 0 && w < 236) {
        jQuery("#runningman").css("display","block");
        jQuery("#runningman").css("left",222+(1.9*w));
        tempw = 10*w;
        temp = (tempw%252);
        jQuery("#runningman").css("background-position", (-36*Math.floor(temp/36))+"px 0px");
		jQuery("#logotype").stop().animate({
            marginTop: (104+(w/1.9))+"px"
          }, 500);
      
    } else {
        jQuery("#runningman").css("display","none");
    }
    
    if(w<200) {
    	jQuery("#logotype").css("opacity", 1);
    	jQuery("#logotype").css("margin-left", "202px");
    } else if(w > 200 && w < 236) {
    	jQuery("#logotype").css("opacity", 1-((w-200)/36));
    	jQuery("#logotype").css("margin-left", "202px");
    } else if (w>246 && w<282) {
    	jQuery("#logotype").css("opacity", (w-246)/36);
    	jQuery("#logotype").stop().animate({
            marginTop: (48+(w))+"px"
          }, 500);
    	jQuery("#logotype").css("margin-left", "24px");
    } else if (w>282) {
    	jQuery("#logotype").css("opacity", 1);
    	jQuery("#logotype").css("margin-left", "24px");
    	jQuery("#logotype").stop().animate({
            marginTop: (48+(w))+"px"
          }, 500);
    }
    
    if(w > 273) {
		jQuery("#navigator").css("position", "fixed");
    	jQuery("#navigator").css("top", 0);
    } else {
		jQuery("#navigator").css("position", "absolute");
		jQuery("#navigator").css("top", "276px");
    }

  });
});




