
function EP_eventHandler(evt) 
{
	// write the event to the text-area in the HTML page
	//EP_logEvent(evt);

	switch(evt) {
		
		case 'MP3_LOADING':
				var t = EP_getTrackInfo('ep_player');
				var id =t.title;
				var oldid;
					id = id.replace(' ',"");
				id = id.replace('track',"");
						id = id.replace('Powered',"");
				id = id.replace('by',"");
				id = id.replace('Kzshare',"");
				id = id.replace('.mp3',"");
			if(oldid != id){
				if(id){
			//sendscore(id);
				}

						oldid = id;

}		
var rushed = t.info.replace('`',"'");
var rushed = t.info.replace('and',"&");

var golem = rushed+" "+t.creator;

insertVideos('youtubeDiv','search',rushed,'5',0);
insertVideos('youtubeEMP','search',golem,'5',0);

			break;
		case 'MP3_BUFFERING':

			break;
		case 'MP3_PLAYING':
			
			// get track info
			var t = EP_getTrackInfo('ep_player');
			var text = '<h3>Listening : '+t.info+' - '+t.creator+'</h3>'; 
			text += '\n\n<p>คุณกำลังฟังเพลง '+t.info+' จาก '+t.creator+' หากไฟล์มีปัญหากรุณาแจ้งเวปมาสเตอร์ทันที เพื่อให้เพลงในเซริฟ์เวอร์มีความสมบูรณ์แบบมากที่สุด</p>\n<p>ไฟล์ Video ที่ได้จาก Youtube เป็นการใช้คำสั่ง Javascript + Ajax ทำการ Generate ขึ้นมา หาก ไฟล์ Video ที่ได้ไม่ตรงกับความต้องการ ก็ขออภัยมา ณ ที่นี้ด้วยครับ และ อีกเรื่องหนึ่ง สำหรับคนที่ใช้ IE 6 จะไม่สามารถเล่นสคริป Video ได้ จึงจำเป็นต้องเปลี่ยนมาใช้ Firefox หรือ IE7 ซึ่งสามารถโหลดได้ที่นี่ครับ : <a href="http://th.www.mozilla.com/th/" target="_blank">คลิกเพื่อดาวน์โหลด FireFox3</a></p>\n<b>Powered by KzShare ติดต่อโฆษณา 084-127-1861 (โจ) ตลอด 24 ชั่วโมง</b>';
			var id =t.title;
			var oldid;
			id = id.replace(' ',"");
			id = id.replace('track',"");
						id = id.replace('Powered',"");
			id = id.replace('by',"");
id = id.replace('Kzshare',"");
id = id.replace('.mp3',"");
if(oldid != id){
			//sendscore(id);
						oldid = id;

}
//document.getElementById("events").value = ""; 
			// write the event to the text-area in the HTML page
			/*EP_logEvent('playlistIndex: '+t.playlistIndex);
			EP_logEvent('location: '+t.location);*/
						/*alert(document.getElementById("ss").innerHTML);
document.getElementById("ss").innerHTML = t.creator;
document.ep_form.events.value =  t.creator;*/
			EP_logEvent(text);
			/*EP_logEvent('annotation: '+t.annotation);
			EP_logEvent('creator: '+t.creator);
			EP_logEvent('info: '+t.info);
			EP_logEvent('image: '+t.image);
			EP_logEvent('album: '+t.album);
			EP_logEvent('trackNum: '+t.trackNum);
			EP_logEvent('link: '+t.link);
			EP_logEvent('----------------------------');*/

			break;			
		case 'MP3_PREV':

			break;				
		case 'MP3_NEXT':

			break;			
		case 'MP3_SELECT':
		
			// write the event to the text-area in the HTML page
			//EP_logEvent("Select MP3 (#"+EP_getTrackInfo('ep_player').playlistIndex+") from playlist ...");
			
			break;
		case 'MP3_PAUSED':

			break;
		case 'MP3_COMPLETE':

			break;			
		case 'MP3_STOPPED':

			break;						
		default:
			break;
	}
}

////////////////////////////////////////////////

// write the event to the text-area in the HTML page
function EP_logEvent(evt) 
{
	/*document.ep_form.events.value = evt;*/
	document.getElementById("events").innerHTML = evt;
	//ep_form.events.value = 'Status\n'+evt+'\n';
}
/*function play(){
document.getElementById("events").value = ""; 
EP_setPlayListXML('ep_player', "<track><location>http://www.kzshare.com/download/music/zeal/1656.mp3</location><creator>Zeal</creator><title>track1656.mp3</title><info>??????</info></track><track><location>http://www.kzshare.com/download/music/love_maker_ii/1094.mp3</location><creator>love_maker_ii</creator><title>track1656.mp3</title><info>????????</info></track>");
EP_play('ep_player');
selfrun();
}
//text = window.setTimeout("play()",5000);
function selfrun() {
stt = document.getElementById("events").value;

stext = ">MP3_BUFFERING";
stt = stt.replace(/stext/g,"");
stext = ">MP3_PLAYING";
stt = stt.replace(/stext/g,"");
stext = ">MP3_LOADING";
stt = stt.replace(/stext/g,"");
stext = ">MP3_NEXT";
stt = stt.replace(/stext/g,"");
stext = "/n";
stt = stt.replace(/stext/g,"");
document.getElementById("events").value = stt;
text = window.setTimeout("selfrun()",3000);

}*/
