var img = document.getElementsByTagName("img");
var div = document.getElementsByTagName("div");
function ovr() {
	for(i = 0; i < img.length; i++) {
		img[i].onmouseover = function() {
			if(this.className == "ovr") {
				this.src = this.src.replace(".gif" , "_ovr.gif");
				this.src = this.src.replace(".jpg" , "_ovr.jpg");
				this.src = this.src.replace(".png" , "_ovr.png");
			}
		}
		img[i].onmouseout = function() {
			if(this.className == "ovr") {
				this.src = this.src.replace("_ovr.gif" , ".gif");
				this.src = this.src.replace("_ovr.jpg" , ".jpg");
				this.src = this.src.replace("_ovr.png" , ".png");
			}
		}
	}
}

function on() {
	for(i = 0; i < img.length; i++) {
		if(img[i].className == "on") {
			img[i].src = img[i].src.replace(".gif" , "_ovr.gif");
			img[i].src = img[i].src.replace(".jpg" , "_ovr.jpg");
			img[i].src = img[i].src.replace(".png" , "_ovr.png");
		}
	}
}
function GetLeft(oj) {
    var px = 0;
    while(oj){
        px += oj.offsetLeft;
        oj = oj.offsetParent;
    }
    return px;
}
function GetTop(oj) {
    var px = 0;
    while(oj){
        px += oj.offsetTop;
        oj = oj.offsetParent;
    }
    return px;
}

function subMenuON() {
	div["shopMenu"].style.display = "block";
	var left = GetLeft(img["shopIMG"]);
	var top = GetTop(img["shopIMG"]) + 40;
	div["shopMenu"].style.left = left+"px";
	div["shopMenu"].style.top = top+"px";
}
function subMenuOFF() {
	div["shopMenu"].style.display = "none";
}

function sends(ID) {
	if(ID == "bank") {
		div["send"].innerHTML = "宅急便（ヤマト運輸）";
	} else if(ID == "yu") {
		div["send"].innerHTML = "ゆうパック（日本郵便）";
	}
}



window.onload = function() {
	ovr();
	on();
}

var scrollStep = 1;
function scrollToTop() {
   if(navigator.appName == "Microsoft Internet Explorer" && document.compatMode == "CSS1Compat"){
      var ScrollPs = document.body.parentNode.scrollTop;
   }else{
      var ScrollPs = document.body.scrollTop;
   }
   if(scrollStep < 50 && ScrollPs) {
      ScrollPs = (ScrollPs > 2) ? Math.ceil(ScrollPs*.2) : 1;
      scrollStep++;
      scrollBy(0,-ScrollPs);
      setTimeout("scrollToTop()",10);
   }else{
      scrollTo(0,0);
      scrollStep = 1;
   }
}
