﻿var
	defaultBC='#30C5EF',
	imgDir='30C5EF/';
var
   	aCnt=0;
	dAList=new Array();
	dList='js';
	sCnt=0;
	dSList=new Array();
        tCnt=0;
	dTList=new Array();

function ca(Ten_Ca_Si)
{
	aCnt++;
	sCnt=0;tCnt=0;
	dAList[aCnt]=Ten_Ca_Si;
	dSList[aCnt]=new Array();
              dTList[aCnt]=new Array();
              }
               

function khuc(Link_Nhac)
{
	sCnt++;
	dSList[aCnt][sCnt]=Link_Nhac;
}
function hay(Ten_Bai_Hat)
{
    
	tCnt++;
	dTList[aCnt][tCnt]=Ten_Bai_Hat;
	
}


function showAList()
{
	html='<TABLE width=100%  cellspacing=0 cellpadding=0>';
	html+='<TR><TD class=TH></TD></TR>';
	html+='<TR><TD><SPAN style="overflow-X: auto; overflow-Y: auto; width: 100%; height: 100%;"><TABLE cellspacing=0 cellpadding=0>';
	for (i=1; i<dAList.length; i++)
        html+='<TR><TD width=10 class=TD></TD><TD class=TD><font color=red><font face=tahoma>◊ <A href=#Play_'+i+'>'+mediaName(vniName(dAList[i]))+'</TD></TR>';
	html+='</TABLE></SPAN></TD></TR>';
	html+='</TABLE>';
	aListHTML.innerHTML=html;
}

function showSongList(ab)
{
	html='<TABLE width=100%  cellspacing=0 cellpadding=0>';
	html+='<TR><TD class=TH></TD></TR>';
	html+='<TR><TD><SPAN style="overflow-X: auto; overflow-Y: auto; width: 100%; height: 100%;"><TABLE cellspacing=0 cellpadding=0>';
	t=getVar(2);
	for (i=1; i<dTList[ab].length; i++)
	if (t==i)
	   html+='<TR><TD width=10 class=TD></TD><TD class=TD><font color=yellow><IMG src="'+imgDir+'play.gif" ></B>. <A href=#Play_'+ab+'_'+i+'><font color=blue>'+mediaName(vniName(dTList[ab][i]))+'</TD></TR>';
	else
		html+='<TR><TD width=10 class=TD></TD><TD class=TD><font color=red>'+i+'. <A href=#Play_'+ab+'_'+i+'>'+mediaName(vniName(dTList[ab][i]))+'</TD></TR>';
	html+='</TABLE></SPAN></TD></TR>';
	html+='</TABLE>';
	songListHTML.innerHTML=html;
}

function mediaPlay()
{ 
Media.controls.play();
}

function mediaStop()
{
Media.controls.stop();
}

function mediaPause()
{
Media.controls.pause();
}
function mediaEnded()
{
	mediaNext();
}


function mediaEnded()
{
	mediaNext();
}


function mediaError()
{

}

function mediaHide()
{	
	Media.style.display="none";	
}
function mediaShow()
{
	Media.style.display="";	
}
function mediaName(st)
{
	st=st.replace(/_/,' ');
	st=st.replace('.mp3','.%6Dp%33');
	st=st.replace('.mp9','');
	st=st.replace('.swf','');
	st=st.replace('.wma','.%77m%61');
	st=st.replace('.wm9','');
    st=st.replace('.MP3','.%4DP%33');
    st=st.replace('../default.htm','');
	return st;
}

function mediaPre()

{	
	s=getVar(2);
	if (s>1)
		s--;
	else
		s=dSList[ab].length-1;
	window.location='#Play_'+ab+'_'+s;
}

function mediaNext()
{	
	s=getVar(2);
	if (s<dSList[ab].length-1)
		s++;
	else
		s=1;
	window.location='#Play_'+ab+'_'+s;
}

function media_DoFSCommand(command, args)
{
	if (command=='mediaPlay')
		mediaPlay();
	else if (command=='mediaStop')
		mediaStop();
	else if (command=='mediaPause')
		mediaPause();
	else if (command=='mediaReverse')
		mediaReverse();
	else if (command=='mediaForward')
		mediaForward();
	else if (command=='mediaVolume')
		mediaVolume(args);
	else if (command=='mediaPresent')
		mediaPresent();
	else if (command=='mediaDownload')
		mediaDownload();
}





function mediaState(state)
{
	switch(state)
	{

case 1:
window.defaultStatus=vniName('» Stopped');
mstatus=
     '<div style="position: absolute; width: 190px; height: 18px; z-index: 1; left: -35px; top: 80px" id="dangTamDungBaiHat">'+
     '</div>';

break;


case 2:
window.defaultStatus=vniName('» Paused');
mstatus='<b><font color=#000000 face=tahoma size=2><br></font> </b></div>';
break;


case 3:	
window.defaultStatus=vniName('» Ca Khúc Đang Phát : '+mediaName(vniName(dTList[ab][song]))+'');
mstatus= 
        //<div style="position: absolute; width: 165px; height: 16px; z-index: 1; left: -40px; top: 100px" id="copyright"><marquee scrollamount="4" bgcolor="#000000" width="165" height="16" style="font-family: Tahoma; font-size: 10pt; color: #00FFFF; font-weight: bold">Bạn đang nghe ca khúc <font color=yellow>'+mediaName(vniName(dTList[ab][song]))+'</font> tại website <font color=yellow>www.CaKhucHay.Tv</font></marquee></div>
        '<br><br><table align=right border="1" width="55%" id="table1" style="border-width: 0px">'+
           	    '<tr><br><br><br><br><br><br><br><br><br><br><br>'+
				'<td style="border: 1px dotted #008080" width="12%"><p align="center">'+
	    '<img border="0" src="'+imgSite+''+imgDir+'baihat.gif" width="16" height="16"> <b>'+
	    '<font size="1"></font></b></td>'+
	        '<td style="border: 1px dotted #808080" width="85%"><font color=black size=1>'+mediaName(vniName(dTList[ab][song]))+'</font></td>'+
	    '</tr>'+
	    '<tr>'+
		'<td style="border: 1px dotted #808080" width="12%"><p align="center">'+
		'<img border="0" src="'+imgSite+''+imgDir+'casi.gif" width="16" height="16"> <b>'+
		'<font size="1"></font></b></td>'+
	    	'<td style="border: 1px dotted #808080" width="85%"><font color=black size=1>'+mediaName(vniName(dAList[ab]))+'</font></td>'+
	    '</tr>'+
	    '<tr>'+
		'<td style="border: 1px dotted #008000" colspan="2">'+
	    	'<p align="center"><a href="'+songLink+'" target=1 title="Nháy chuột phải chọn Save Target As ..."><img border="0" src="'+imgSite+''+imgDir+'downloads.gif" width="74" height="20"></a></td>'+
	    '</tr>'+
	    '<tr>'+
		'<td style="border: 1px dotted #008000" colspan="2">'+
	    	'<p align="center"><a target="_blank" href="http://CaKhucHay.Tv" target=1 title="c a k h u c h a y . v e r y . t o"><font face="Comic Sans MS" style="font-size: 12pt" color="#FF9933"><b>www.CaKhucHay.Tv</b></font></a></td>'+
	    '</tr>'+
	    '</table>';
       

break;


case 9:
window.defaultStatus=vniName('» Đang kết nối tới bài : '+mediaName(vniName(dTList[ab][song]))+'');
mstatus=
        '<div style="position: absolute; width: 191px; height: 48px; z-index: 2; left: 186px; top: 80px" id="dangketnoivoimaychu">'+
        '<center><br><br><br><br><br><br><img src="'+imgSite+''+imgDir+'s.gif" border=0><br><b><font color=#000000 face=tahoma size=2>Đang kết nối tới máy chủ</center></div>';
break;

case 10:
window.defaultStatus=vniName('» Mất kết nối tới bài : '+mediaName(vniName(dTList[ab][song]))+'');
mstatus=
      '<div style="position: absolute; width: 202px; height: 100px; z-index: 1; left: 181px; top: 80px" id="ketnoibingat">'+
	      '<center><b><br><br><br><br><br><font color=#000000 face=tahoma size=1><img src="'+imgSite+''+imgDir+'matketnoi.gif" border=0> Kết Nối Không Thành - Bạn Ấn Lại Flay Lần Nữa ? <img src="'+imgSite+''+imgDir+'matketnoi.gif" border=0></font></center><font face=tahoma size=1><br></font></div>';

break;

case 11,6:
window.defaultStatus=vniName('» Buffering : '+mediaName(vniName(dTList[ab][song]))+'');
mstatus=
       '<div style="position: absolute; width: 220px; height: 74px; z-index: 3; left: 170px; top: 80px" id="KetNoiThanhCong">'+
	       '<center><br><br><br><br><br><br><font face="Tahoma" size="2" color="#FF0000"><img src="'+imgSite+''+imgDir+'s.gif" border=0><br>Dữ Liệu Ca Khúc Đang Tải Về !</font></center></div>';

break;


default:
	}
mediaLoadingHTML.innerHTML=''+mstatus+'';
}


function showContent()
{
html+='';


html+=
      '<DIV style="FONT-WEIGHT: bold; FONT-SIZE: 11px; LEFT: 318px; TEXT-TRANSFORM: capitalize; FONT-FAMILY: Verdana; POSITION: absolute; TOP: 427px; height:246px; width:224px" align=center>'+
      '<TABLE WIDTH=144 BORDER=0 CELLPADDING=0 CELLSPACING=0>'+
      '<TD style="filter: Chroma2(color=#216134) Alpha(Opacity=60) Chroma2(color=#216134) Chroma2(color=#216134);  COLSPAN=2 width="100%" height="100%">'+
      '<DIV STYLE="TOP: 0px; LEFT:11px; height:229px"  id="MediaPlayer">'+
      '<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="Media" width="185" height="180" style="border-style: solid; border-width: 1,5px">'+
	  '<PARAM name="volume" value="100">'+
      '<PARAM name="wmode" value="transparent">'+
      '<PARAM name="uimode" value="full">'+
      '<PARAM NAME="enableErrorDialogs" VALUE=0></OBJECT>'+
      '</object>'+
      '</TD>'+
      '</TABLE>'+
      '</DIV>';

html+=
      '<DIV id=Download style="LEFT: 360px; WIDTH: 383px;  POSITION: absolute; TOP: 300px">'+
      '<TBODY>'+
      '<TR>'+
      '<FONT color=darkblue><b id=mediaLoadingHTML></b><br></FONT></DIV>';

html+=
      '<DIV class=scrollbar style="position:absolute; left:+25px; top: +495px; width:285px; height:350px; filter: chroma(color=#CCEBAB)" align=left id="Casi">'+
      '<TABLE width="100%">'+
      '<TBODY>'+
      '<TR>'+
      '<TD borderColor=darkblue border="1" id=aListHTML> </TD></TR></TBODY></TABLE></DIV>'+
      '</FONT></TD></TR></TBODY></DIV>';

html+=
      '<DIV  class=scrollbar style="position:absolute; left:322px; top:636px; width:414px; height:180px; filter: chroma(color=#CCEBAB)" align=left id="Baihat">'+
      '<TABLE width="100%">'+
      '<TBODY>'+
      '<TR>'+
      '<TD borderColor=darkblue border="1" id=songListHTML> </TD></TR></TBODY></TABLE></DIV>';


html+='</FORM>';
html+='</body>';

mediaHTML.innerHTML=html;
showAList();
	return html;

}

function getVar(cnt)
{
	var url;
	url=window.location.href;
	url=url+'#';
	url=url.split('#');
	url=url[1];
	url=url+'_';
	url=url.split('_');
	url=url[cnt];
	if (!url)
		return '';
	return url;
}

function pls(ab,song,st)
{	
st=dSList[ab][song];

st=st.replace("http://Music.CaKhucHay.Tv","mms://media.tuoitre.com.vn/Stream",url);
st=st.replace("http://CaKhucHay.Tv_Music","mms://media.nhacso.net/Music",url);
st=st.replace("http://CaKhucHay-Tv","http://www.geocities.jp",url);
st=st.replace("http://CaKhucHay_Tv","http://music.geocities.jp",url);
st=st.replace("http://CaKhucHay.Tv","http://CaKhucHay.Tv",url);


songLink=st;window.status=songLink;Media.URL=songLink;
}

musicsite='';
lastUrl='DungandTran/';
hostSite='http://CaKhucHay.Tv';
imgSite='';

function loadPage()
{
	ab=getVar(1);
	song=getVar(2);
	if (ab=='')
		ab=1;
	showSongList(ab);
	if (song!='')
		pls(ab, song);

}

function urlCheck()
{

	document.title=pageTitle;	
	url=window.location.href;
	if (url!=lastUrl)
        {

		loadPage();
		lastUrl=url;
        }
}

function loadOK()
{
	window.defaultStatus='Bạn Đang Nghe Nhạc Trực Tuyến Tại C a K h u c H a y . V e r y . T o ';
	showContent();
	setInterval("urlCheck()",100);
}

//
function Ca()
{	
	document.title='C a K h u c H a y . V e r y . T o';
	pageTitle=document.title;
	
html=
	      '<LINK href="musicz.css" type=text/css rel=stylesheet>'+
          '<BODY  bgColor=#ffffff leftMargin=0 background="#e1ecc3" topMargin=0 marginwidth="0" marginheight="0">'+
          '<SCRIPT id=actionScript src=""></SCR'+'IPT>';

html+=
	      '<SCRIPT for=\'Media\' event=\'playStateChange(NewPlayState)\'>'+
	      'mediaState(NewPlayState);'+
	      'if (NewPlayState == 8)'+
	      'mediaEnded();'+
	      '</SCR'+'IPT>'+

	      '<SCRIPT LANGUAGE="VBScript">'+
	      'Sub site_FSCommand(ByVal command, ByVal args)'+
	      'call site_DoFSCommand(command, args)'+
	      'End Sub'+
	      '</SCR'+'IPT>'+
	      '<DIV id=mediaHTML style="position: absolute"></DIV>';

html+=
          '<table align="center" cellpadding="0" cellspacing="0" width="773" height="744"><tr>'+
	  '<td background="bg_left.gif" rowspan="4" width="22"></td>'+
	  '<td bgcolor="#FFFFFF" rowspan="2">'+
	  '<img border="0" src="yusegfweg8934.jpg" width=731 height=338></td>'+
	  '<td background="bg_right.gif" rowspan="4" width="18">&nbsp;</td>'+
	  '<td height="148"></td>'+
	  '</tr>'+
	  '<tr><td height="16"></td></tr>'+
	  '<tr><td bgcolor="#FFFFFF" valign="top"><table border="1" width="100%" id="table1" style="border-width: 0px"><tr>'+
	  '<td style="border-style: none; border-width: medium">'+
	  '<table border="1" width="100%" id="table2" style="border-width: 0px" background="">'+
	  '<td style="border-style: none; border-width: medium" width="290">'+
	  '<form method="POST" action="--WEBBOT-SELF--">'+

              '<fieldset style="padding:2px; background-image:url();border: 1px solid #FF9933">'+
	    '<legend>[ <font color=green>Liên Hệ Quảng Cáo</font> ]</legend>'+
    '<table border="1" width="100%" style="border-width: 0px">'+
    '<tr>'+
	  '<td style="border: 1px dotted #000080"><img src=quangcao.jpg></td>'+
    '</tr>'+
    '</table>'+
    '</fieldset>'+

          '<fieldset style="padding:2px; background-image:url(bg.gif);border: 1px solid #FF9933">'+
	  '<legend>[ <font color=green>List Ca Sĩ</font> ]</legend>'+
	  '<table border="1" width="100%" style="border-width: 0px">'+
	  '<tr>'+
	  '<td style="border: 1px dotted #808000" width="100%"><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>'+
	   '</td>'+
                 '</tr></table>'+
	  '</fieldset></form>'+
	  '</td>'+
	  '<td style="border-style: none; border-width: medium">'+
	  '<table border="1" width="100%" id="table4" style="border-width: 0px">'+
	  '<tr>'+
	  '<td style="border-style: none; border-width: medium">'+
	  '<form method="POST" action="--WEBBOT-SELF--">'+
          '<table border="1" width="100%" id="table7" style="border-width: 0px">'+
	  '<tr><td style="border-style: none; border-width: medium">'+
          '<center><img border="0" src="home.gif" width="41" height="50"><font face="Comic Sans MS" style="font-size: 20pt" color="green"><b>WwW.CaKhucHay.Tv</b></font></font><img border="0" src="home.gif" width="41" height="50"></a></center></font>'+
	  '</tr>'+
	  '</table>'+
          '<fieldset style="padding: 2px; background-image:url(bg.gif); border: 1px solid #70C415">'+
	  '<legend>[ <font color=green>Media Player</font> ]</legend>'+
	  '<table border="1" width="100%" id="table5" style="border-width: 0px">'+
	  '<tr>'+
	  '<td style="border: 1px dotted #808000" width="197">'+
               '<br><br><br><br><br><br><br><br><br><br><br><br>'+
	  '</td>'+
	   '<td style="border: 1px dotted #808000" rowspan="2">'+
               '<br><br><br><br><br><br><br><br><br>'+
	  '</td>'+
	  '</tr>'+
	  '</table>'+
          '</fieldset>'+
	  '<fieldset style="padding: 2px; background-image:url(bg.gif); border: 1px solid #70C415">'+
	  '<legend>[ <font color=green>List Bài Hát</font> ]</legend>'+
	  '<table border="1" width="100%" style="border-width: 0px">'+
	  '<tr>'+
	  '<td style="border: 1px dotted #808000" width="100%"><br><br><br><br><br><br><br><br><br><br><br><br>'+	  
                 '</td>'+
                 '</tr></table>'+
	  '</fieldset>'+
          '<fieldset style="padding: 2px; border: 1px solid #FF9933">'+
	  '<legend>[ <font color=green>About Me & WebSite</font> ]</legend>'+
	  '<table border="1" width="100%" id="table10" style="border-width: 0px">'+
	  '<tr>'+
	  ''+
	  '</iframe></td>'+
	  '<td style="border: 1px dotted #808000">'+
	      '<center>Y!M : <a href="ymsgr:sendim?Ket_ban51">Ket_ban51</td>'+
	  '<td style="border: 1px dotted #808000">'+
	      ' <a href="ymsgr:sendim?Ket_ban@Yahoo.com"><center>Ket_ban51@yahoo.com</td>'+
	  '<td style="border: 1px dotted #808000">'+
	      '<a href="http://CaKhucHay.Tv"><center>WwW.CaKhucHay.Tv</td>'+
	  '</tr>'+
	   '</table>'+
	  '</fieldset></form>'+
	  '</td>'+
	  '</tr>'+
	  '</table>'+
	  '</td>'+
	  '</table>'+
	  '</td>'+
	  '</tr>'+
	  '</table>'+
	  '</td>'+
	  '<td height="523"></td>'+
	  '</tr>'+
	  '<tr>'+
	  '<td width="731" valign="top" bgcolor="#FFFFFF"><img border="0" src="shutup.jpg" width="731" height="89"></td>'+
	  '<td height="49" width="2"></td>'+
	  '</tr>'+
	  '</table>';


	  //document.oncontextmenu = function (){ return false};

document.write(html);
setTimeout("loadData()",100);
}
Ca();
