//////////////////////////////////////////////////////// 画像ポップアップ
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;
   }
}

//////////////////////////////////////////////////////// ランダム(Main)
function randomMain() {
  m = 0, x = 0, y = 0;
  ad  = new Array();
  adv = new Array();
  hit = new Array();

  // hitには相対確率を入れる
  // 完全にランダムにするなら全部"1"にする
  // advには、広告のタグを入れる。改行はしないようにする
  // 広告を増やしたりする場合は、"[ ]"の数字が0から順になるようにする
  hit[0] = 1; adv[0] = '<img src="./themes/55ski/images/main_09.jpg" height="220" width="506" name="slide" border=0 style="filter:blendTrans(duration=3)"><br>';
  hit[1] = 1; adv[1] = '<img src="./themes/55ski/images/main_09.jpg" height="220" width="506" name="slide" border=0 style="filter:blendTrans(duration=3)"><br>';

  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);
}

//////////////////////////////////////////////////////// ランダム(Header)
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 id="header" style="background: url(/themes/55ski/images/header_bg1.gif) no-repeat;">';
  hit[1] = 1; adv[1] = '<div id="header" style="background: url(/themes/55ski/images/header_bg2.gif) no-repeat;">';
  hit[2] = 1; adv[2] = '<div id="header" style="background: url(/themes/55ski/images/header_bg3.gif) no-repeat;">';
  hit[3] = 1; adv[3] = '<div id="header" style="background: url(/themes/55ski/images/header_bg4.gif) no-repeat;">';
  hit[4] = 1; adv[4] = '<div id="header" style="background: url(/themes/55ski/images/header_bg5.gif) no-repeat;">';
  hit[5] = 1; adv[5] = '<div id="header" style="background: url(/themes/55ski/images/header_bg_keiko.gif) no-repeat;">';
  hit[6] = 1; adv[6] = '<div id="header" style="background: url(/themes/55ski/images/header_bg_kaori.gif) no-repeat;">';
  hit[7] = 1; adv[7] = '<div id="header" style="background: url(/themes/55ski/images/header_bg_yumi.gif) no-repeat;">';
  hit[8] = 1; adv[8] = '<div id="header" style="background: url(/themes/55ski/images/header_bg_hiromi.gif) no-repeat;">';

  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);
}

//////////////////////////////////////////////////////// 投稿者名別アイコン表示
function getCommentNameImageTag(userName) {
// 投稿者名ごとの画像のURL定義
// ['(投稿者名)', '(画像のURL)']
var userImages = [
['けいこ＠５５', '/images/icon_keiko_s.gif'], 
['かおり＠５５', '/images/icon_kaori_s.gif'], 
['ゆみ＠５５', '/images/icon_yumi_s.gif'],
['ひろみ＠５５', '/images/icon_hiromi_s.gif'],
['けいこ＠55', '/images/icon_keiko_s.gif'], 
['かおり＠55', '/images/icon_kaori_s.gif'], 
['ゆみ＠55', '/images/icon_yumi_s.gif'],
['ひろみ＠55', '/images/icon_hiromi_s.gif'],
['けいこ@55', '/images/icon_keiko_s.gif'], 
['かおり@55', '/images/icon_kaori_s.gif'], 
['ゆみ@55', '/images/icon_yumi_s.gif'],
['ひろみ@55', '/images/icon_hiromi_s.gif'],
['けいこ', '/images/icon_keiko_s.gif'], 
['かおり', '/images/icon_kaori_s.gif'], 
['ゆみ', '/images/icon_yumi_s.gif'],
['ひろみ', '/images/icon_hiromi_s.gif'],
['ゴーゴーズ', '/images/icon_55_s.gif']
];

// 上記投稿者名以外に表示する画像のURL
var otherImage = '/images/icon_other_s.gif';

// imgタグに指定する属性
// 例）var addAttribute = 'class="pict" alt="test"';
var addAttribute = '';

if ('' == userName) {
if ('' != otherImage) document.write('<img src="'+ otherImage +'" ' + addAttribute + ' />');
return;
}
if (userName.indexOf('</a>') > -1) {
var m = userName.match(/>.+<\/a>/);
if (null != m) userName = m[0].substr(1, m[0].length - 5);
}
for (var i = 0; i < userImages.length; i++) {
if (userImages[i][0] == userName) {
window.document.write('<img src="' + userImages[i][1] + '" ' + addAttribute + ' />');
return;
}
}
if ('' != otherImage) window.document.write('<img src="'+ otherImage +'" ' + addAttribute + ' />');
return;
}
//-->


