﻿var website = {
"Remark": "<span style=\"background-color: #FFFF00\"><font face=\"ＭＳ Ｐゴシック\"> ←☑：表示　□：非表示</font></span>",
"Copyright": "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Times New Roman\"><font size=\"5\"><i><b><font color=\"#FF0000\">Neo</font></b></i>-<i><b><font color=\"#00FF00\">Tech</font></b></i>-<i><b><font color=\"#0000FF\">Lab</font></b></i>.<i><b>com</b></i></font></font>",
"count": 5,
"database": [
{ "window_id": "popup0", "width": "1020px", "height": "600px", "url": "http://neotechlab.bbs.fc2.com",                  "title": "<b><span style=\"background-color: #FF9933\"><a href=\"http://neotechlab.bbs.fc2.com\"><font color=\"#000080\">掲示板</font></a></span></b>"},
{ "window_id": "popup1", "width": "1020px", "height": "350px", "url": "http://www.google.com",                          "title": "<b><span style=\"background-color: #FF9933\">Google検索</span></b>"},
{ "window_id": "popup2", "width": "1020px", "height": "400px", "url": "http://translate.google.com/translate_t?hl=en#", "title": "<b><span style=\"background-color: #FF9933\">Google翻訳</span></b>"},
{ "window_id": "popup3", "width": "1020px", "height": "600px", "url": "http://www.geocities.jp/higuchuu4/index.htm",    "title": "<b><span style=\"background-color: #FF9933\">樋口優さんのVPVP</span></b>"},
{ "window_id": "popup4", "width": "1020px", "height": "600px", "url": "http://www6.atwiki.jp/vpvpwiki/pages/65.html",   "title": "<b><span style=\"background-color: #FF9933\">VPVP wiki</span></b>"}
]}; 

function Popup(chkbx) { if(chkbx.checked) { showURL(chkbx.value); } else { hideURL(chkbx.value); } }
function hideURL(pid) { var base=document.getElementById(website.database[pid].window_id); base.innerHTML=""; }
function showURL(pid) { var base=document.getElementById(website.database[pid].window_id); base.innerHTML="<hr>";
   var obj=document.createElement("iframe"); obj.setAttribute("border", "0"); obj.setAttribute("frameborder", "0");
   obj.style.width = website.database[pid].width; obj.style.height = website.database[pid].height; obj.src=website.database[pid].url; base.appendChild(obj);
}
function initPopup() {
  var PEM = ""; for (i=0; i<website.count; i++) { PEM +="<INPUT type=\"checkbox\" onClick=\"Popup(this);\" value=" + i + ">" + website.database[i].title + "&nbsp;&nbsp;&nbsp;"; }
　document.getElementById("PopExtMenu").innerHTML = PEM + website.Remark + website.Copyright;
}

var playButton = { "count": 3, "Button": [
{"name": "Stop"  , "Caption": "再生停止",       "Action": "stopPlay();",   "width":  "70px"},
{"name": "Skip"  , "Caption": "動画スキップ",   "Action": "skipPlay();",   "width":  "90px"},
{"name": "Change", "Caption": "動画ツアー変更", "Action": "changePlay();", "width": "110px"}
]};

playlist.width = "610";
playlist.height = "480";
playlist.tour[16].tour_name = "MikuMikuDanceのページにようこそ";
playlist.tour[16].width = "230px";
playlist.tour[17].tour_name = "MikuMikuDanceﾁｭｰﾄﾘｱﾙ";
playlist.tour[17].width = "160px";
playlist.tour[18].tour_name = "●";
playlist.tour[18].width = "35px";


var bgm_time; var bgm_stim; var AdsTim;
var msg_g1="<img src=\"Article.files/Dame.gif\" width=\"250px\" height=\"300px\">";
var msg_g2="<img src=\"Article.files/Dame.gif\" width=\"230px\" height=\"270px\">";
var msg_g3="<img src=\"Article.files/Dame.gif\" width=\"250px\" height=\"300px\">";
var msg_T1="<marquee width=\"610px\" height=\"200px\" behavior=\"alternate\"><font size=\"6\" color=\"red\">早くほしいぃ<i>！</i><br>&nbsp;&nbsp;&nbsp;</font><img src=\"Article.files/face1.png\" width=\"165px\" height=\"150px\"></marquee>";
var msg_T2="<marquee width=\"610px\" height=\"310px\" behavior=\"scroll\" direction=\"right\"><font size=\"6\" color=\"violet\">ねぇ、『ちびミクちゃん』も<br>物理エンジン使えるの？<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><img src=\"Article.files/face2.png\"></marquee>";
var msg_T3="";
var msg_T4="<font size=\"6\" color=\"red\"><a title=\"樋口優さんのダウンロードサイトへ遷移します。\" href=\"http://www.geocities.jp/higuchuu4/index.htm\" target=\"_blank\"><font color=\"fuchsia\"><b>MikuMikuDance7.xx【最新版】</b>はこちら！</font></a></font><img boder=\"0\" src=\"b/face1.png\" height=\"40px\" />";
var msg_N="";
var msg_M1="<font size=\"7\" color=\"red\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ミクミク動画</font>";
var msg_M2="<font size=\"7\" color=\"pink\">&nbsp;&hearts;&hearts;&hearts;&hearts;♪　     　　　　　   　 　♭&hearts;&hearts;&hearts;&hearts;</font>";
var msg_C1="【YouTubeに投稿された日付】 ";
var msg_C2="【題名】 ";
var msg_C3="【コメント】 ";
var RepeatFlag=1;

function RepeatProcess() { if (RepeatFlag==1) { RepeatFlag=0; } else { RepeatFlag=1; } }
function YouTubeLoad() {
   document.getElementById("g1").innerHTML = " "; document.getElementById("g2").innerHTML = " "; document.getElementById("g3").innerHTML = " "; document.getElementById("Telop").innerHTML = " "; document.getElementById("Telop2").innerHTML = " "; document.getElementById("Telop3").innerHTML = " "; document.getElementById("Telop4").innerHTML = " "; document.getElementById("News").innerHTML = " ";
//   if(bgm_tour==0 && bgm_num==0) { document.getElementById("Telop3").innerHTML = msg_M1; document.getElementById("Telop4").innerHTML = msg_M2; }
//　 if(bgm_tour==0 && bgm_num==1) { document.getElementById("g1").innerHTML = " "; document.getElementById("g2").innerHTML = " "; document.getElementById("g3").innerHTML = " "; document.getElementById("Telop").innerHTML = " "; document.getElementById("Telop2").innerHTML = " "; document.getElementById("Telop3").innerHTML = msg_T3; document.getElementById("Telop4").innerHTML = msg_T4; document.getElementById("News").innerHTML = msg_N; } 
   if(bgm_tour==16 && bgm_num==0) { document.getElementById("Telop3").innerHTML = msg_M1; document.getElementById("Telop4").innerHTML = msg_M2; }
　 if(bgm_tour==16 && bgm_num==1) { document.getElementById("g1").innerHTML = " "; document.getElementById("g2").innerHTML = " "; document.getElementById("g3").innerHTML = " "; document.getElementById("Telop").innerHTML = " "; document.getElementById("Telop2").innerHTML = " "; document.getElementById("Telop3").innerHTML = msg_T3; document.getElementById("Telop4").innerHTML = msg_T4; document.getElementById("News").innerHTML = msg_N; } 
   if (playlist.tour[bgm_tour].movie_data[bgm_num].movie_id=="M7Q8KSY7c0k") {
      document.getElementById("Telop3").innerHTML = "<mar" + "quee width=\"610px\" height=\"50px\" behavior=\"slide\" direction=\"left\" overflow=\"visible\"><font size=\"7\" color=\"red\">MikuMikuDance Version7.26</fo" + "nt></mar" + "quee>";
      document.getElementById("Telop4").innerHTML = "<mar" + "quee width=\"610px\" height=\"50px\" behavior=\"slide\" direction=\"left\" overflow=\"visible\"><a href=\"http://www.geocities.jp/higuchuu4/index.htm\"><font size=\"6\" color=\"orange\"><b>【最新版ダウンロードはこちら】</b></fo" + "nt></a></mar" + "quee>";
      AdsTim=setTimeout('ResetMMD_Ads()', 12500);
   }
   var ss = "<obj" + "ect width=" + playlist.width + " height=" + playlist.height + "><par" + "am name=\"movie\" value=\"http://www.youtube.com/v/" + playlist.tour[bgm_tour].movie_data[bgm_num].movie_id + "&autoplay=1&hl=ja&fs=1\"></par" + "am><par" + "am name=\"allowFullScreen\" value=\"true\"></par" + "am><par" + "am name=\"allowscriptaccess\" value=\"always\"></par" + "am><par" + "am name=\"wmode\" value=\"transparent\"></par" + "am><em" + "bed src=\"http://www.youtube.com/v/" + playlist.tour[bgm_tour].movie_data[bgm_num].movie_id + "&autoplay=1&hl=ja&fs=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=" + playlist.width + " height=" + playlist.height + " wmode=\"transparent\"></emb" + "ed></obj" + "ect>";
   document.getElementById("Youtube").innerHTML = ss; 
   bgm_time = setTimeout('YouTubeLoad()', playlist.tour[bgm_tour].movie_data[bgm_num].time_length + 3000);
   document.getElementById("comment").innerHTML = "<mar" + "quee behavior=\"scroll\" direction=\"left\" width=\"610\"><font color=\"white\">" + msg_C1 + playlist.tour[bgm_tour].movie_data[bgm_num].upload_date + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + msg_C2 + "<b>" + playlist.tour[bgm_tour].movie_data[bgm_num].title + "</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + msg_C3 + playlist.tour[bgm_tour].movie_data[bgm_num].comment + "</font></mar" + "quee>";
   DisplayTourMovie();
   if (RepeatFlag==1)
   {  if (bgm_tour==16 && bgm_num<1)
      { bgm_num++; }
      else
      { bgm_num = Math.floor(Math.random()*playlist.tour[bgm_tour].count);
        if (bgm_tour==16 && bgm_num<2) { bgm_num += 2; }
        if (bgm_num>=playlist.tour[bgm_tour].count) { bgm_num=0; }
      }
   }
   else
   {   bgm_num++;
       if (bgm_num==playlist.tour[bgm_tour].count) { bgm_num=0; }
   }
}
function ResetMMD_Ads() {
  document.getElementById("Telop3").innerHTML = "";
  document.getElementById("Telop4").innerHTML = "";
  clearTimeout(AdsTim);
}

function stopPlay()   { clearTimeout(bgm_time); document.getElementById("Youtube").innerHTML =""; ResetMMD_Ads(); }
function skipPlay()   { clearTimeout(bgm_time); YouTubeLoad(); }
function changePlay() {
 clearTimeout(bgm_time); bgm_num=0; bgm_tour++;
 if(bgm_tour==1)  { bgm_tour=2; }
 if(bgm_tour==12) { bgm_tour=16; }
 if(bgm_tour==18) { bgm_tour=0; }
 YouTubeLoad();
}

function changeTour(sel_tour) {
   clearTimeout(bgm_time);
   bgm_num=0;
   bgm_tour=sel_tour;
   if ( bgm_tour == 3 ) { 
      var k = Math.floor(Math.random()*4);
      bgm_num = 11;
      switch (k) {
         case 0: bgm_num = 11; break;
         case 1: bgm_num = 12; break;
         case 2: bgm_num = 15; break;
         case 3: bgm_num = 19; break;
      }
   }
   YouTubeLoad();
}
function changeMovie(sel_movie) { clearTimeout(bgm_time); bgm_num=sel_movie; YouTubeLoad(); }
function DisplayTourMovie() { bgm_stim= new Date().getTime();
 var sMark = "<img src=\"b/p.gif?version=v0r94&dummy=" + ( new Date().getTime() ) + "&tour=" + bgm_tour + "&movie=" + bgm_num +"\">";
 if (playlist.tour[bgm_tour].count>9) { var sTML="<font face=\"ＭＳ Ｐゴシック\"><font color=\"#FF0000\"><mar" + "quee behavior=\"scroll\" direction=\"left\" overflow=\"visible\">≫" + sMark; } else { var sTML="<mar" + "quee behavior=\"slide\" direction=\"left\" overflow=\"visible\">" + sMark; }
 for (var i=bgm_num; i<playlist.tour[bgm_tour].count; i++) {
   sTML += "<a title=\"" + playlist.tour[bgm_tour].movie_data[i].title + "\"><input type=\"image\" src=\"http://i1.ytimg.com/vi/" + playlist.tour[bgm_tour].movie_data[i].movie_id + "/default.jpg\" width=\"90px\" height=\"70px\" onclick=\"changeMovie(" + i + ");\" /></a>";
 }
 if (bgm_num > 0) {
  for (var i=0; i<bgm_num; i++) {
    sTML += "<a title=\"" + playlist.tour[bgm_tour].movie_data[i].title + "\"><input type=\"image\" src=\"http://i1.ytimg.com/vi/" + playlist.tour[bgm_tour].movie_data[i].movie_id + "/default.jpg\" width=\"90px\" height=\"70px\" onclick=\"changeMovie(" + i + ");\" /></a>";
  }
 }
 if (playlist.tour[bgm_tour].count>9) { document.getElementById("TourList").innerHTML = sTML + "≫</marquee></font></font>"; } else { document.getElementById("TourList").innerHTML = sTML + " </marquee>"; }
}

function initYouTubeWindow() {
 var YTpB="";
 for (i=0; i<playButton.count; i++) { 
   YTpB += "<input type=\"button\" name=\"" + playButton.Button[i].name + "\" value=\"" + playButton.Button[i].Caption + "\" onclick=\"" + playButton.Button[i].Action + "\" style=\"width: " + playButton.Button[i].width + ";\" />";
 }
// for (i=0; i<playlist.num; i++) { 
 YTpB += "&nbsp;";
 for (i=0; i<19; i++) { 
   if (playlist.tour[i].tour_name != "-") {
     YTpB += "<input type=\"button\" tabindex=\"" + i +"\" name=\"" + playlist.tour[i].name + "\" id=\"" + playlist.tour[i].name + "\" value=\"" + playlist.tour[i].tour_name + "\" onclick=\"changeTour(" + i + ");\" style=\"width: " + playlist.tour[i].width + ";\" />";
   }
 }
 document.getElementById("Panel").innerHTML = YTpB;
}

function initMovieViewer() { 
   if (Math.random()<1.00)  { bgm_tour=16; bgm_num=0; }
   else
   {  if (Math.random()<0.5) { bgm_tour=10; bgm_num=14; }
      else { bgm_tour=0; bgm_num=1; }
   }
// bgm_num = Math.floor(Math.random()*playlist.tour[bgm_num].count);
   initPopup(); initYouTubeWindow(); YouTubeLoad(); 
}

function post_msg() {
   if(SelColor[0].checked) { var sColor=SelColor[0].value; }
   if(SelColor[1].checked) { var sColor=SelColor[1].value; }
   if(SelColor[2].checked) { var sColor=SelColor[2].value; }
   if(SelColor[3].checked) { var sColor=SelColor[3].value; }
   if(SelColor[4].checked) { var sColor=SelColor[4].value; }
   if(SelColor[5].checked) { var sColor=SelColor[5].value; }
   if(SelColor[6].checked) { var sColor=SelColor[6].value; }
   if(SelColor[7].checked) { var sColor=SelColor[7].value; }
   if(SelType[0].checked) { var sType="<b>"; var eType="</b>"; var mType="b"; } else { var sType=""; var eType=""; var mType=""; }
   if(SelType[1].checked) { sType+="<i>"; eType+="</i>"; mType+="i"; }
   var bgm_order=bgm_num-1; if (bgm_order==-1) { bgm_order=playlist.tour[bgm_tour].count-1; }
   var bgm_ntim= new Date().getTime();
   var put_msg="<mar" + "quee width=\"610px\" height=\"30px\" behavior=\"scroll\" direction=\"left\" loop=1 overflow=\"visible\"><font size=\"5\" color=\"" + sColor + "\">" + sType + MessageBox.value + eType + "</fo" + "nt></mar" + "quee>";
   var send_msg="<img src=\"b/msg.gif?version=v0r95&dummy=" + bgm_stim + "&tour=" + bgm_tour + "&movie=" + bgm_order + "&time=" + (bgm_ntim - bgm_stim) + "&color=" + sColor + "&type=" + mType + "&message=\'" + MessageBox.value +"\'\">";
   MessageBox.value="";
   document.getElementById("Telop5").innerHTML=put_msg;
   document.getElementById("Ack").innerHTML=send_msg;
}








