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;
   }
}

function chgImage(shopID){
	parent.document.shopinfo.src = 'fimages/thumbnail/' + shopID + '.gif';

}

function restoreImage(){
	parent.document.shopinfo.src = "images/shopinfo-default.gif";
}

function openWin(theURL){//theURL , winName , width , height , scrollBars , Xmove , Ymove
	var  winName = "NW" , w = 600 , h = 600 , s = 0 , Xmove = 15 , Ymove = 15;
	NewWin = window.open(theURL , winName , 'width='+w+' , height='+h+' , scrollbars=' + s);
	NewWin.window.moveTo(Xmove , Ymove);
	NewWin.focus();
}

// Auto Scroll
/* Event.observe(window, 'load', function() {
  $$('a[href^=#]:not([href=#])').each(function(element) {
    element.observe('click', function(event) {
      new Effect.ScrollTo(this.hash.substr(1));
      Event.stop(event);
    }.bindAsEventListener(element))
  })
}) */

/* フォーム送信 */

function submitForm(formID) {
	document.forms[formID].submit();
}


// 数字をカンマ区切りに変換して表示

function dispPrice(price) {
  //区切り桁
  digitNum = 3;
  //区切り文字
  delim = ",";

  newNum = price + "";
  lengNum = newNum.length;

  for( i=lengNum; i>0; i-- ){
    if( i % digitNum == 0 && i != lengNum ) {
      ltNum = newNum.slice(0, -i);
      rtNum = newNum.slice(-i);
      newNum = ltNum + delim + rtNum;
    } // end of if
  } // end of for
		document.write(newNum);
} // end of function