//////////////////////////////////////////////////////// 画像ポップアップ
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");
}


//////////////////////////////////////////////////////// ランダム(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/odo/images/top_01.jpg" height="290" width="730"><br>';
  hit[1] = 1; adv[1] = '<img src="/themes/odo/images/top_02.jpg" height="290" width="730"><br>';
  hit[2] = 1; adv[2] = '<img src="/themes/odo/images/top_03.jpg" height="290" width="730"><br>';
  hit[3] = 1; adv[3] = '<img src="/themes/odo/images/top_04.jpg" height="290" width="730"><br>';
  hit[4] = 1; adv[4] = '<img src="/themes/odo/images/top_05.jpg" height="290" width="730"><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] = '<img src="/themes/odo/images/head_01.jpg" height="150" width="730">';
  hit[1] = 1; adv[1] = '<img src="/themes/odo/images/head_01.jpg" height="150" width="730">';

  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_odo.gif'], 
['げんき', '/images/icon_genki.gif']
];

// 上記投稿者名以外に表示する画像のURL
var otherImage = '/images/icon_other_s.gif';

// imgタグに指定する属性
// 例）var addAttribute = 'class="pict" alt="test"';
var addAttribute = 'height="15" width="15"';

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;
}
//-->



