//////////////////////////////////////////////////////// 画像ポップアップ
function imgwin(src,w,h,name){
var win=window.open("",name,"width="+w+",height="+h+",resizable=0,scrollbars=0,top=0,left=0'")
win.document.open()
win.document.writeln("<html><head><title>高橋育美オフィシャルサイト</title></head>")
win.document.writeln("<body onBlur=closeWin() bgcolor=#ffffff leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>")
win.document.writeln("<img src='"+src+"'></body></html>")
win.document.writeln("<script language=javascript>function closeWin(){window.close();}</script>")
win.document.writeln("</body></html>")
win.document.close()
win.focus();
if(navigator.userAgent.indexOf("Mac")!=-1){
win.resizeTo(w,h)
}
}

//////////////////////////////////////////////////////// 小窓
function MakeChild(strFileName)
{
	window.open(strFileName,"","width=600,height=450,resizable=1,scrollbars=1");
}

function MakeChild2(strFileName)
{
	window.open(strFileName,"","width=500,height=600,resizable=1,scrollbars=1");
}

function MakeChild3(strFileName)
{
	window.open(strFileName,"","width=350,height=600,resizable=1,scrollbars=1");
}

function MakeChild4(strFileName)
{
	window.open(strFileName,"","width=850,height=650,resizable=1,scrollbars=1");
}

//////////////////////////////////////////////////////// スクロール
var scrj = 1;
function softScrollBack() {
   if(navigator.appName == "Microsoft Internet Explorer" && document.compatMode == "CSS1Compat")
      var scdist = document.body.parentNode.scrollTop;
   else
      var scdist = document.body.scrollTop;
   if(scrj<50 && scdist) {
      scdist = (scdist>2) ? Math.ceil(scdist*.2) : 1;
      scrj++;
      scrollBy(0,-scdist);
      setTimeout("softScrollBack()",20);
   } else {
      scrollTo(0,0);
      scrj = 1;
   }
}

//////////////////////////////////////////////////////// ランダム
function randomAdv() {
  m = 0, x = 0, y = 0;
  ad  = new Array();
  adv = new Array();
  hit = new Array();

  // hitには相対確率を入れる
  // 完全にランダムにするなら全部"1"にする
  // advには、広告のタグを入れる。改行はしないようにする
  // 広告を増やしたりする場合は、"[ ]"の数字が0から順になるようにする
  hit[0] = 1; adv[0] = '<div style="background-image:url(/themes/custom/images/header_img06.jpg);width:770px;height:245px;">';
  hit[1] = 1; adv[1] = '<div style="background-image:url(/themes/custom/images/header_img07.jpg);width:770px;height:245px;">';
  hit[2] = 1; adv[2] = '<div style="background-image:url(/themes/custom/images/header_img08.jpg);width:770px;height:245px;">';
  hit[3] = 1; adv[3] = '<div style="background-image:url(/themes/custom/images/header_img09.jpg);width:770px;height:245px;">';

  for(i=0; i<=hit.length - 1; i++) {
    m += hit[i];
  }
  n = Math.floor(Math.random() * m);
  n++;
  for(i=0; i<=hit.length - 1; i++) {
    x = y;
    y += hit[i];
    if(x<n && n<=y) ad = adv[i];
  }
  document.write(ad);
}
