function meltdown(){
	var d=document;
	var s=d.createElement("script");
	s.charset="UTF-8";
	s.src="js/meltdown.js?"+(new Date()).getTime();
	d.body.appendChild(s)
}

function subwindow($id){
  window.open('/rank/iw.php?i='+$id, '','width=645,height=720,menubar=no,toolbar=no,scrollbars=no,location=no,status=no,resizable=yes');
}

var tID =null;
function acl(){
  if( tID != null ){clearInterval(tID);tID=null;}
  $.ajaxSetup({scriptCharset:'utf-8'});
  var z  = 'http://api.justin.tv/api/stream/list.json?channel=larc_en_cile_5&jsonp=?';
  $.getJSON( z,function(a){
    if(a[0].stream_count < 360){
      document.getElementById('v').innerHTML = '　'+a[0].stream_count+'人視聴中 / トータル'+a[0].channel['views_count']+'人';
    }else{
    	document.getElementById('v').innerHTML = '　'+a[0].stream_count+'人視聴中 / トータル'+a[0].channel['views_count']+'人'+' <a href="javascript:void(0);" onclick="subwindow(0);" style="color:#ff0000;font-size:8pt">→混雑時に追い出されたらココクリック</a>';
    }
    if( tID == null ){tID = setInterval('acl()',180000);}
  });
}

function acl_tks(){if( tID != null ){
clearInterval(tID);tID=null;}
$.ajaxSetup({scriptCharset:'utf-8'});
var z = 'http://api.justin.tv/api/stream/list.json?channel=tks_paneeeee&jsonp=?';
$.getJSON( z,function(a){document.getElementById('v').innerHTML = '　'+a[0].stream_count+'人視聴 :'+a[0].channel['views_count']+'トータル';
if( tID == null ){tID = setInterval('acl_tks()',180000);}});}

function acl_hato(){if( tID != null ){
clearInterval(tID);tID=null;}
$.ajaxSetup({scriptCharset:'utf-8'});
var z = 'http://api.justin.tv/api/stream/list.json?channel=hatoyatv&jsonp=?';
$.getJSON( z,function(a){document.getElementById('v').innerHTML = '　'+a[0].stream_count+'人視聴 :'+a[0].channel['views_count']+'トータル';
if( tID == null ){tID = setInterval('acl_hato()',180000);}});}

function acl_kappa(){if( tID != null ){
clearInterval(tID);tID=null;}
$.ajaxSetup({scriptCharset:'utf-8'});
var z = 'http://api.justin.tv/api/stream/list.json?channel=kapahime&jsonp=?';
$.getJSON( z,function(a){document.getElementById('v').innerHTML = '　'+a[0].stream_count+'人視聴 :'+a[0].channel['views_count']+'トータル';
if( tID == null ){tID = setInterval('acl_kappa()',180000);}});
document.getElementById('ya').style.backgroundImage = "url(http://stat100.ameba.jp/p_skin/pure_sayo06/img/header.jpg)";
document.getElementById('ya').style.backgroundPosition = "top";
document.getElementById('ya').style.backgroundRepeat = "no-repeat";
document.body.style.backgroundImage = "url(frame/thumbnail/kappahime.jpg)";
var kapArray = new Array();
kapArray.push('<br><A href="http://ameblo.jp/kappa-hime/" target="_blank"><STRONG style="font-size : 18px;text-decoration:none;">・カッパ姫のブログ</STRONG></A><bR>');
kapArray.push('<A href="http://dic.nicovideo.jp/a/%E3%82%AB%E3%83%83%E3%83%91%E5%A7%AB" target="_blank"><STRONG style="font-size : 18px;text-decoration:none;">・カッパ姫</STRONG><SPAN STYLE="font-size:12pt;text-decoration:none;color:white">（ニコニコ大百科）</SPAN></A>');
document.getElementById('logo').innerHTML = kapArray.join('');
kapArray = null;
backstyle = document.getElementById('icolor');
backstyle.contentWindow.document.body.style.backgroundImage = "url(../frame/thumbnail/kappahime.jpg)";
document.getElementById('icon').innerHTML = '<A href="javascript:meltdown();"><IMG style="border: 5px ridge #FBE476"align=top src="frame/thumbnail/kappahime.jpg" width=64 height=64></A>';
}

function Tokei(){
Week = new Array("日","月","火","水","木","金","土");
ND= new Date();
Tuki = ND.getMonth() + 1;
Hinichi = ND.getDate();
Day = ND.getDay();
document.title =""+ Tuki+"月"+Hinichi+"日"+"（"+Week[Day] + "曜日）"　;
}
Tokei();

function white(){
	document.body.style.backgroundImage = "";
	document.getElementById('ya').style.backgroundImage = "url(frame/thumbnail/yahoo.gif)";
	document.getElementById('ya').style.backgroundPosition = "50% 75%";
	document.getElementById('ya').style.backgroundRepeat = "no-repeat";
	backstyle = document.getElementById('icolor');
	backstyle.contentWindow.document.bgColor = "#ffffff";
	backstyle.contentWindow.document.body.style.backgroundImage = "";
	var logoArray = new Array();
	logoArray.push('<A href="http://ameblo.jp/sibuyahyde/" target=_blank><img src="frame/thumbnail/blog.png" width="230" height="26" border="0"></A>');
	logoArray.push('<A href="http://dic.nicovideo.jp/a/%E6%B8%8B%E8%B0%B7%E3%81%AE%E3%82%AD%E3%83%B3%E3%82%B0" target=_blank><img src="frame/thumbnail/king100.png" width="230" height="26" border="0"></A><BR>');
	logoArray.push('<A href="http://dic.nicovideo.jp/a/%E3%82%AD%E3%83%B3%E3%82%B0%E5%90%8C%E7%9B%9F"target=_blank><img src="frame/thumbnail/yellow100.png" width="230" height="26" border="0"></A>');
	logoArray.push('<A href="http://mixi.jp/show_friend.pl?id=25167787" target=_blank><img src="frame/thumbnail/mixi.png" width="230" height="26" border="0"></A><BR>');
	document.getElementById('logo').innerHTML = logoArray.join('');
	logoArray = null;
	document.bgColor = "#ffffff";
	document.getElementById('icon').innerHTML = '<A href="javascript:meltdown();"><IMG style="border: 5px ridge #FBE476"align=top src="frame/thumbnail/sibuya_king-125x94-1.jpg" width=64 height=64></A>';
}

function black(){
	document.body.style.backgroundImage = "";
	document.getElementById('ya').style.backgroundImage = "url(http://stat100.ameba.jp/p_skin/gd_tanami02_usr/img/header.jpg)";
	document.getElementById('ya').style.backgroundPosition = "top";
	document.getElementById('ya').style.backgroundRepeat = "no-repeat";
	document.bgColor = "#000000";
	backstyle = document.getElementById('icolor');
	backstyle.contentWindow.document.body.style.backgroundImage = "";
	backstyle.contentWindow.document.bgColor = "#000000";
	var defaArray = new Array();
	defaArray.push('<A href="http://ameblo.jp/sibuyahyde/" target=_blank><img src="frame/thumbnail/blog.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://dic.nicovideo.jp/a/%E6%B8%8B%E8%B0%B7%E3%81%AE%E3%82%AD%E3%83%B3%E3%82%B0" target=_blank><img src="frame/thumbnail/king100.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://dic.nicovideo.jp/a/%E3%82%AD%E3%83%B3%E3%82%B0%E5%90%8C%E7%9B%9F"target=_blank><img src="frame/thumbnail/yellow100.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://mixi.jp/show_friend.pl?id=25167787" target=_blank><img src="frame/thumbnail/mixi.png" width="230" height="26" border="0"></A><BR>');
	document.getElementById('logo').innerHTML = defaArray.join('');
	defaArray = null;
	document.getElementById('icon').innerHTML = '<A href="javascript:meltdown();"><IMG style="border: 5px ridge #FBE476"align=top src="frame/thumbnail/sibuya_king-125x94-1.jpg" width=64 height=64></A>';
}

function rainbow(){
	document.getElementById('ya').style.backgroundImage = "url(http://stat100.ameba.jp/p_skin/gd_tanami02_usr/img/header.jpg)";
	document.getElementById('ya').style.backgroundPosition = "top";
	document.getElementById('ya').style.backgroundRepeat = "no-repeat";
	document.body.style.backgroundImage = "url(frame/thumbnail/rainbow.jpg)";
	var defaArray = new Array();
	defaArray.push('<A href="http://ameblo.jp/sibuyahyde/" target=_blank><img src="frame/thumbnail/blog.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://dic.nicovideo.jp/a/%E6%B8%8B%E8%B0%B7%E3%81%AE%E3%82%AD%E3%83%B3%E3%82%B0" target=_blank><img src="frame/thumbnail/king100.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://dic.nicovideo.jp/a/%E3%82%AD%E3%83%B3%E3%82%B0%E5%90%8C%E7%9B%9F"target=_blank><img src="frame/thumbnail/yellow100.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://mixi.jp/show_friend.pl?id=25167787" target=_blank><img src="frame/thumbnail/mixi.png" width="230" height="26" border="0"></A><BR>');
	document.getElementById('logo').innerHTML = defaArray.join('');
	defaArray = null;
	backstyle = document.getElementById('icolor');
	backstyle.contentWindow.document.body.style.backgroundImage = "url(../frame/thumbnail/rainbow.jpg)";
	document.getElementById('icon').innerHTML = '<A href="javascript:meltdown();"><IMG style="border: 5px ridge #FBE476"align=top src="frame/thumbnail/sibuya_king-125x94-1.jpg" width=64 height=64></A>';
}

function ch(){
	document.getElementById('ya').style.backgroundImage = "url(http://stat100.ameba.jp/p_skin/gd_tanami02_usr/img/header.jpg)";
	document.getElementById('ya').style.backgroundPosition = "top";
	document.getElementById('ya').style.backgroundRepeat = "no-repeat";
	document.body.style.backgroundImage = "url(frame/thumbnail/ch.jpg)";
	var defaArray = new Array();
	defaArray.push('<A href="http://ameblo.jp/sibuyahyde/" target=_blank><img src="frame/thumbnail/blog.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://dic.nicovideo.jp/a/%E6%B8%8B%E8%B0%B7%E3%81%AE%E3%82%AD%E3%83%B3%E3%82%B0" target=_blank><img src="frame/thumbnail/king100.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://dic.nicovideo.jp/a/%E3%82%AD%E3%83%B3%E3%82%B0%E5%90%8C%E7%9B%9F"target=_blank><img src="frame/thumbnail/yellow100.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://mixi.jp/show_friend.pl?id=25167787" target=_blank><img src="frame/thumbnail/mixi.png" width="230" height="26" border="0"></A><BR>');
	document.getElementById('logo').innerHTML = defaArray.join('');
	defaArray = null;
	backstyle = document.getElementById('icolor');
	backstyle.contentWindow.document.body.style.backgroundImage = "url(../frame/thumbnail/ch.jpg)";
	document.getElementById('icon').innerHTML = '<A href="javascript:meltdown();"><IMG style="border: 5px ridge #FBE476"align=top src="frame/thumbnail/sibuya_king-125x94-1.jpg" width=64 height=64></A>';
}

function dia(){
	document.getElementById('ya').style.backgroundImage = "url(http://stat100.ameba.jp/p_skin/gd_tanami02_usr/img/header.jpg)";
	document.getElementById('ya').style.backgroundPosition = "top";
	document.getElementById('ya').style.backgroundRepeat = "no-repeat";
	document.body.style.backgroundImage = "url(frame/thumbnail/bg.gif)";
	var defaArray = new Array();
	defaArray.push('<A href="http://ameblo.jp/sibuyahyde/" target=_blank><img src="frame/thumbnail/blog.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://dic.nicovideo.jp/a/%E6%B8%8B%E8%B0%B7%E3%81%AE%E3%82%AD%E3%83%B3%E3%82%B0" target=_blank><img src="frame/thumbnail/king100.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://dic.nicovideo.jp/a/%E3%82%AD%E3%83%B3%E3%82%B0%E5%90%8C%E7%9B%9F"target=_blank><img src="frame/thumbnail/yellow100.png" width="230" height="26" border="0"></A><BR>');
	defaArray.push('<A href="http://mixi.jp/show_friend.pl?id=25167787" target=_blank><img src="frame/thumbnail/mixi.png" width="230" height="26" border="0"></A><BR>');
	document.getElementById('logo').innerHTML = defaArray.join('');
	defaArray = null;
	backstyle = document.getElementById('icolor');
	backstyle.contentWindow.document.body.style.backgroundImage = "url(../frame/thumbnail/bg.gif)";
	document.getElementById('icon').innerHTML = '<A href="javascript:meltdown();"><IMG style="border: 5px ridge #FBE476"align=top src="frame/thumbnail/sibuya_king-125x94-1.jpg" width=64 height=64></A>';
}

function note(){
	onclick=window.open('justream/note/king_justin.html', '','width=400,height=225,menubar=no,toolbar=no,scrollbars=no,location=no,status=no,resizable=yes');
	onclick=window.open('justream/note/king_ust.html', '','width=400,height=365,menubar=no,toolbar=no,scrollbars=no,location=no,status=no,resizable=yes');
}