var http = createRequestObject();
var lastUrl = '';
var current_url = '';
var field = '';
var interval = '';
var loading=0;
var update = '001';
var loadingText = "<img src='images/loading.gif' width=16 height=16 align=absmiddle hspace=5><font color=red>Loading ...</font>";

function createRequestObject() {
	var xmlhttp;
	try {
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e) 
	{
		try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
		catch(f) { xmlhttp=null; }
	}
	if(!xmlhttp&&typeof XMLHttpRequest!="undefined") 
	{
		xmlhttp=new XMLHttpRequest();
	}
	return  xmlhttp;
}

function sendRequest(current_url, act) {
	try{
		var sBasePath = window.location.pathname.substring(6,document.location.href.lastIndexOf('.php'));	// www
//		var sBasePath = window.location.pathname.substring(7,document.location.href.lastIndexOf('.php'));	// /localhost/
		site	= sBasePath;
		
		switch( act )
		{
			case 'Cat':
				self.scrollTo(0, 118);
				field	= document.getElementById('main');
				document.getElementById('View').style.display = 'none';
				break;
			case 'View_Help':
				self.scrollTo(0, 118);
				field	= document.getElementById('View_Help');
				field.style.display = "";
				break;
			case 'View':
				self.scrollTo(0, 118);
				field	= document.getElementById(act);
				document.getElementById(act).style.display = '';
				break;
			case 'Search':
				self.scrollTo(0, 118);
				site	= 'actions.php';
				field	= document.getElementById('main');
				break;
			case 'Play':
			case 'PlayVideo':
				site	= 'actions.php';
				field	= document.getElementById('Play_List');
				break;
			case 'listCat':
			case 'listAlbum':
			case 'listAuthor':
			case 'listSinger':
				field	= document.getElementById('List');
				break;
			case 'List_Review':
				site	= 'actions.php';
				field	= document.getElementById('List_Of_Review');
				break;
			default:
				self.scrollTo(0, 118);
				field	= document.getElementById('main');
				break;
		}
		current_url = encodeURIComponent(current_url);
		//field = document.getElementById(act);
		if (loading == 0) 
		{
			loading = 1;
			show_bOOm();
		}
		http.open('POST', site);
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.onreadystatechange = handleResponse;
		http.send('url=' + current_url);
	}
	catch(e){}
	finally{}
}

function reload_Search()
{
	//document.getElementById("searchTT").style.display = 'none';
	nameCH = document.getElementById("nameCH").value;
	addCH = document.getElementById("addCH").value;
	ttID = document.getElementById("ttID").options[document.getElementById("ttID").selectedIndex].value;
	qhID = document.getElementById("qhID").options[document.getElementById("qhID").selectedIndex].value;
	try
	{
		field = document.getElementById("main");
		current_url = ttID +','+ qhID +','+ encodeURIComponent(nameCH) +','+ encodeURIComponent(addCH);
		if (loading == 0) 
		{
			loading = 1;
			show_bOOm();
		}
		http.open('POST',  'Tin_Tuc_Gan_Xa.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.onreadystatechange = handleResponse;
		http.send('url=SEARCH,'+ current_url);
	}
	catch(e){}
	finally{}
	return false;
}

function doSearch()
{
	kword	= document.getElementById("kw").value;
	typeID	= document.getElementById("typeID").options[document.getElementById("typeID").selectedIndex].value;
	/*if (kword.length <= 2)
	{
		 alert('Từ khóa bạn nhập vào quá ngắn !! \nXin hãy nhập lại.');
	} 
	else 
	{*/
		try
		{
			field = document.getElementById("main");
			current_url = typeID +','+ encodeURIComponent(kword);
			if (loading == 0) 
			{
				loading = 1;
				show_bOOm();
			}
			http.open('POST',  'actions.php');
			http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			http.onreadystatechange = handleResponse;
			http.send('url=Search,'+ current_url);
		}
		catch(e){}
		finally{}
	//}
	return false;
}

function doPlayList( divID )
{
	flag = 0;
	for(i=0 ; i<document._click.elements.length; i++)
		if(document._click.elements[i].type == "checkbox")
			if(document._click.elements[i].checked)
				flag = 1;
	if(flag != 0)
	{
		var listArr		= document.forms[1].mid;
		var listString	= "";
		var listArrList	= new Array();
		if( isArray(listArr) )
		{
			for ( var i=0; i<listArr.length; i++ )
			{
				if( listArr[i].checked )
					listArrList.push(listArr[i].value);
			}
			for ( var i=0; i<listArrList.length; i++ )
				listString += (i > 0 ? "&" : "") + encodeURI(listArrList[i]);
		}
		else if( document._click.mid.checked )
			listString = document._click.mid.value;
		try
		{
			current_url = encodeURIComponent(listString);
			//document.getElementById("List").style.display = 'none';
			field = document.getElementById(divID);
			if (loading == 0) 
			{
				loading = 1;
				show_bOOm();
			}
			http.open('POST', 'actions.php');
			http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
			http.onreadystatechange = handleResponse;
			http.send('url=PlayList,' + divID + ',' + current_url);
		}
		catch(e){}
		finally{}
	}
	else
	{
		alert("Chưa có bài nhạc nào được chọn !!");
	}
	return false;
}

function reload_PlayList( divID )
{
	try
	{
		field = document.getElementById(divID);
		if (loading == 0) 
		{
			loading = 1;
			show_bOOm();
		}
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.onreadystatechange = handleResponse;
		http.send('url=Load_PlayList');
	}
	catch(e){}
	finally{}
}

function reload_Review( ReviewID ) {
	field = 'Review_'+ ReviewID;
	try{
		document.getElementById(field).innerHTML = loadingText;
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.onreadystatechange = do_handleResponse;
		http.send('url=Review_Song,' + ReviewID);
	}
	catch(e){}
	finally{}
}

function doLyric( itemID )
{
	try
	{
		field = document.getElementById('Lyric');
		if (loading == 0) 
		{
			loading = 1;
			show_bOOm();
		}
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.onreadystatechange = handleResponse;
		http.send('url=Lyric,' + itemID);
	}
	catch(e){}
	finally{}
}

function handleResponse() 
{
	try {
		if((http.readyState == 4)&&(http.status == 200)){
			hide_bOOm();
			loading = 0;
			response = http.responseText;
			field.innerHTML = response;
			field.style.display = "";
		}
  	}
	catch(e){}
	finally{}
}

function doFix( mode, musicID )
{
	field = 'fix';
	try{
		document.getElementById(field).innerHTML = loadingText;
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.onreadystatechange = do_handleResponse;
		http.send('url=' + mode + ',' + musicID);
	}
	catch(e){}
	finally{}
}

function doFixLinkBroken( musicID ) 
{
	try{
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.send('url=Link_Broken,' + musicID);
		alert('Chúng tôi đã ghi nhận sự đóng góp của bạn.\n\nXin chân thành cám ơn.');
	}
	catch(e){}
	finally{}
}

function doDownload( musicID ) 
{
	field = 'Download';
	try{
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.onreadystatechange = do_handleResponse;
		http.send('url=Download,' + musicID);
	}
	catch(e){}
	finally{}
}

function doRemoveItem( listID, itemID )
{
	field = 'My_Play_List';
	try{
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.onreadystatechange = do_handleResponse;
		http.send('url=Remove,' + listID +','+ itemID);
	}
	catch(e){}
	finally{}
}

function request_Help()
{
	try{
		document.getElementById('Help').innerHTML = '<img src="images/spacer.gif" width=46 height=1>'+ loadingText;
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.onreadystatechange = Help_handleResponse;
		http.send('url=HELP');
	}
	catch(e){}
	finally{}
}

function Help_handleResponse() {
	try {
		if((http.readyState == 4)&&(http.status == 200))
			document.getElementById('Help').innerHTML = http.responseText;
  	}
	catch(e){}
	finally{}
}

function request_Review( act, site )
{
	field = 'dComment';
	if( act == 'send' )
	{
		//encodeURIComponent
		var hoten	= document.getElementById('ho_ten').value;
		var email	= document.getElementById('email').value;
		var tieude	= document.getElementById('tieu_de').value;
		var confirmcode	= document.getElementById('confirm_code').value;
		var confirmid	= document.getElementById('confirm_id').value;
		var content	= document.getElementById('content').value;
		content = content.replace(/,/g, "&cedil;");
		var newsid	= document.getElementById('NewsID').value;
		act_url = act +','+ newsid +','+ encodeURIComponent(site) +','+ confirmid +','+ encodeURIComponent(confirmcode) +','+ encodeURIComponent(hoten) +','+ encodeURIComponent(email) +','+ encodeURIComponent(tieude) +','+ encodeURIComponent(content);
	}
	else	act_url = act +','+ encodeURIComponent(site);
	
	try{
		document.getElementById(field).innerHTML = '<p align=center><img src="images/loading4.gif" width=86 height=10></p>';
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
		http.onreadystatechange = do_handleResponse;
		http.send('url=REVIEW,' + act_url);
	}
	catch(e){}
	finally{}
}
function submit_Review()
{
	field = 'dComment';
	
}

function reload_ConfirmCode() {
	field = 'Confirmation_Code';
	try{
		document.getElementById(field).innerHTML = loadingText;
		http.open('POST', 'actions.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.onreadystatechange = do_handleResponse;
		http.send('url='+ field);
	}
	catch(e){}
	finally{}
}

function reload_OptionQH(tt_id) {
	field = 'QH';
	try{
		document.getElementById(field).innerHTML = loadingText;
		http.open('POST', 'Tin_Tuc_Gan_Xa.php');
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.onreadystatechange = do_handleResponse;
		http.send('url=ListQH,'+ tt_id);
	}
	catch(e){}
	finally{}
}

function do_handleResponse() {
	try {
		if((http.readyState == 4)&&(http.status == 200))
			document.getElementById(field).innerHTML = http.responseText;
  	}
	catch(e){}
	finally{}
}

// bOOm Loading
//configure below variable for menu width, position on page
var offsetleft= 0;
var offsettop = 0;

var ns4 = document.layers ? 1 : 0;
var ie4 = document.all ? 1 : 0;
var ns6 = document.getElementById && !document.all ? 1 : 0;

function makeStatic() 
{
	if (ie4) LoadingDiv.style.pixelTop = document.body.scrollTop + offsettop;
	else if (ns6) document.getElementById("LoadingDiv").style.top = window.pageYOffset + offsettop;
	else if (ns4) eval(document.LoadingDiv.top = eval(window.pageYOffset + offsettop));
	setTimeout("makeStatic()", 0);
}

function menu3()
{
	if (ns6||ie4||ns4)
		makeStatic();
}
/* // code in html
<div id=bOOm_Loading style="display: none; position:absolute; top:0px; right:0px; padding: 5px; vertical-align:middle; text-align:center; background-color:#CC0033; width:140px; color:#FFFFFF; font-weight:bold; font-size:10px; font-family: Arial"><em>Đang tải trang</em></div>
<a href="javascript:void(0)" onclick="show_bOOm()">show</a> | <a href="javascript:void(0)" onclick="hide_bOOm()">hide</a>
*/
function show_bOOm()
{
	body_self = document.getElementsByTagName('body');
	body_self[0].style.filter = 'Alpha(opacity="60")';
	body_self[0].style.MozOpacity = '0.6';
	body_self[0].style.opacity = '0.6';
	document.getElementById('LoadingDiv').style.display = 'inline';
	menu3();
}

function hide_bOOm()
{
	body_self[0].style.filter = 'Alpha(opacity="100")';
	body_self[0].style.MozOpacity = '1';
	body_self[0].style.opacity = '1';
	document.getElementById('LoadingDiv').style.visibility = 'hidden';
//	document.getElementById('bOOm_Loading').style.display = 'none';
	window.clearTimeout(menu3);
}

function getVar(url, cnt)
{
	url = url + '#';
	url = url.split('#');
//	if (!url[1]) window.location.href = '#Home';
	url = url[1];
	url = url + ',';
	url = url.split(',');
	if (url[0] == 'Home') window.location.href = './';
	if (cnt != -1) {
		url = url[cnt];
		if (!url) return '';
	}
	return url;
}

function loadPage() {
	act = getVar(window.location.href, 0);
	if (act) {
		current_url = window.location.href;
		current_url = current_url+'#';
		current_url = current_url.split('#');
		current_url = current_url[1];
		if (current_url) sendRequest(current_url, act);
	}
}

function urlCheck()
{
	url = window.location.href;
	if (url != '' && url != lastUrl)
	{
		loadPage();
		lastUrl = url;
	}
}

function startLoad() 
{
	interval = setInterval('urlCheck()',100);
}

function trim(a) {
	return a.replace(/^s*(S*(s+S+)*)s*$/, "$1");
}

function popup(url,wdname,width,height)
{
	if (width == null)  { width  = 600; }   // default width
	if (height == null) { height = 500; }   // default height
	newwin = window.open(url, wdname, 'fullscreen=0, toolbar=0, location=0, channelmode=0, dependent=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width='+width+', height='+height);
	if (document.all)
	{
		newwin.moveTo(0,0);
		newwin.focus();
	}
}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) {
		alert("Thông điệp của bạn đã vượt quá " + maxlimit + " ký tự. Vui lòng tóm tắt lại.");
		field.value = field.value.substring(0, maxlimit);
	} else {
		countfield.value = maxlimit - field.value.length;
	}
}

function do_search_site() {
	kw = document.getElementById("keyword").value;
	if (kw.length <= 3) alert('Từ khóa nhập vào quá ngắn !!');
	else {
		window.location.href = 'http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLG,GGLG:2005-22,GGLG:en&q='+ kw +'&sa=Search+Site&sitesearch=cdn5t.net&domains=cdn5t.net&oe=UTF-8&safe=active&hl=en";';
	}
	return false;
}

function isEmail(s)
{
	if (s=="") return false;
	if(s.indexOf(" ")>0) return false;
	var i = 1;
	var sLength = s.length;
	if (s.indexOf(".")==sLength) return false;
	if (s.indexOf(".")<=0) return false;
	if (s.indexOf("@")!=s.lastIndexOf("@")) return false;
	while ((i < sLength) && (s.charAt(i) != "@"))  { i++  }
	if ((i >= sLength) || (s.charAt(i) != "@")) return false;
	else i += 2;
	while ((i < sLength) && (s.charAt(i) != "."))  { i++  }
	if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
	var str="1234567890abcdefghikjlmnopqrstuvwxyzABCDEFGHIKJLMNOPQRSTUVWXYZ-@._";
	for(var j=0;j<s.length;j++)
		if(str.indexOf(s.charAt(j))==-1)
			return false;
	return true;
}

function CheckForm ()
{
	var errorMsg = "";
	if (document.formsend.full_name.value == "")
		errorMsg += "\n-- Xin hãy cho biết họ tên đầy đủ của bạn !";
	if (document.formsend.telephone.value == "")
		errorMsg += "\n-- Xin hãy cho biết số điện thoại cá nhân của bạn !";
	if (document.formsend.email.value == "")
		errorMsg += "\n-- Xin hãy cho biết địa chỉ email của bạn !";
	else if ( !isEmail(document.formsend.email.value) )
		errorMsg += "\n-- Địa chỉ email không hợp lệ, xin hãy nhập lại !";
	if (document.formsend.message.value.length <= 10)
		errorMsg += "\n-- Nội dung thông điệp quá ngắn, xin hãy nhập vào nội dung !";

	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Error.\n";
		msg += "______________________________________________________________\n";
		
		errorMsg += alert(msg + errorMsg + "\n");
		return false;
	}
	
	if (submitcount == 0)
	{
		submitcount++;
		formsend.Submit.disabled = true;
		return true;
	}
	/*else
	{
		alert("Waiting...............................................!");
		return false;
	}*/
	return false;
}

function hideHelp()
{
	//document.getElementById('Help').style.display='none';
	document.getElementById('Help').innerHTML = '<a href="javascript:void(0)" onclick="request_Help()" class="mainmenu"><img src="images/mail_help.gif" width="40" height="40" border="0" hspace="5" align="absmiddle" />CLICK VÀO ĐÂY ĐỂ GỞI CÂU HỎI CỦA BẠN</a>';
}

function hideReview()
{
	document.getElementById('dComment').innerHTML = '<a href="javascript:void(0)" onclick="request_Review()" style="font-variant:small-caps;"><img src="images/csm.gif" width="11" height="9" hspace="5" /><u>Ý kiến của bạn ?</u></a>';
}

function check_all()
{
	for(i=0 ; i<document._click.elements.length; i++)
	{
		if(document._click.elements[i].type == "checkbox")
		{
			if(document._click.elements[i].checked)
			{
				document._click.elements[i].checked = false;
			}
			else
			{
				document._click.elements[i].checked = true;
			}
		}
	}
}

function isArray(obj)
{
	return(typeof(obj.length) == "undefined") ? false : true;
}

function Shockwave_Flash( strSource, fwidth, fheight )
{
	var width=fwidth;
	var height=fheight;
    var s;
	s='<object width="'+ width +'" height="'+ height +'" codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>';
		s+='<param name="movie" value="Avertise">';
		s+='<PARAM NAME="Src" VALUE="'+ strSource +'">';
		s+='<PARAM NAME="WMode" VALUE="Window">';
		s+='<PARAM NAME="Quality" VALUE="High">';
		s+='<PARAM NAME="AllowScriptAccess" VALUE="always">';
		s+='<PARAM NAME="Scale" VALUE="ShowAll">';
		s+='<embed src="'+ strSource +'" width="'+ width +'" height="'+ height +'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>';
	s+='</object>';

	document.write(s);
}

function mediaPlayer(strSource)
{
	var HTML = '';
	HTML +=  ('<OBJECT id="wmp_music" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" type="application/x-oleobject" width="100%" height="66" standby="Loading Microsoft Windows Media Player components..." classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" name="winMediaPlayerID">');
		HTML +=  ('<PARAM NAME="URL" VALUE="' + strSource + '">');
		HTML +=  ('<PARAM NAME="autoplay" VALUE="1">');
		HTML +=  ('<PARAM NAME="autoStart" VALUE="1">');
		HTML +=  ('<PARAM NAME="balance" VALUE="0">');
		HTML +=  ('<PARAM NAME="currentPosition" VALUE="0">');
		HTML +=  ('<PARAM NAME="currentMarker" VALUE="0">');
		HTML +=  ('<PARAM NAME="CursorType" VALUE="-1">');
		HTML +=  ('<PARAM NAME="defaultFrame" VALUE="0">');
		HTML +=  ('<PARAM NAME="enabled" VALUE="1">');
		HTML +=  ('<PARAM NAME="enableContextMenu" VALUE="0">');
		HTML +=  ('<PARAM NAME="enableErrorDialogs" VALUE="0">');
		HTML +=  ('<PARAM NAME="fullScreen" VALUE="0">');
		HTML +=  ('<PARAM NAME="invokeURLs" VALUE="-1">');
		HTML +=  ('<PARAM NAME="mute" VALUE="0">');
		HTML +=  ('<PARAM NAME="playCount" VALUE="999">');
		HTML +=  ('<PARAM NAME="rate" VALUE="1">');
		HTML +=  ('<PARAM NAME="shuffle" VALUE="0">');
		HTML +=  ('<PARAM NAME="stretchToFit" VALUE="-1">');
		HTML +=  ('<PARAM NAME="volume" VALUE="50">');
		HTML +=  ('<PARAM NAME="windowlessVideo" VALUE="0">');
		HTML +=  ('<embed id="winMediaPlayerIDFF" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" Name="winMediaPlayerIDFF"');
			HTML +=  ('filename="' + strSource + '" src="' + strSource + '" width="100%" height="66"');
			HTML +=  ('AutoSize="1" AutoStart="1" AutoPlay="1" ClickToPlay="1" DisplaySize="1" EnableContextMenu="0" EnableFullScreenControls="1" EnableTracker="1" Mute="0" PlayCount="999" Shuffle="0" ShowControls="1" ShowAudioControls="1" ShowDisplay="0" ShowGotoBar="0" ShowPositionControls="1" ShowStatusBar="1" ShowTracker="1"');
		HTML +=  ('</embed>');
	HTML +=  ('</OBJECT>');
	document.getElementById("MediaPlayer").innerHTML = HTML;
}

function openSmallWindow(url,vtop,vleft,vwidth,vheight)
{
        if(vtop == null)
        if(vleft == null)
        if(vwidth == null) {vwidth=550; }
        if(vheight == null) {vheight=300; }
        var win_param;
        win_param = "top="+vtop+",left="+vleft+",width="+vwidth+",height="+vheight+"channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0,screenX=0,top=0,left=0,screenY=0";
        msgWindow = open(url, "smallWindow", win_param);
        msgWindow.focus();
        msgWindow.opener = self;
        return false;
}

function viewSound(strLocation, strCaption, vwidth,vheight){
	if( vwidth  == null )	{ vwidth  = 300; }
	if( vheight == null )	{ vheight = 66; }
	window.open("test.php?url=" + strLocation + "&str=" + strCaption, "imgView", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width="+ vwidth +",height="+ vheight +",resizable=yes,top=50,left=100");
}

function findObj(id)
{
	return document.getElementById(id);
}

function dd(linkz)
{
	var url = linkz.split('`');
	var key = findObj('vietkar9').getElementsByTagName('span'); key = key.length;
	
	var link = '';
	for(var i=0; i<=url.length - 2; i++)
	{
		link = link + String.fromCharCode(parseInt(parseInt(url[i])- key));
	}
	
	return link;
}

function showPLayer_song(link)
{
	var height = 66;
	var e = link.split('.'); e = e[e.length-1];

	var WMP7;
	try
	{
		if ( navigator.appName != "Netscape" )
		{
			WMP7 = new ActiveXObject('WMPlayer.OCX');
		}
	}
	catch (error)
	{
		;
	}
	var HTML = '';

	// Windows Media Player 7 Code
	if ( WMP7 )
	{
	
	HTML +=  ('<object type="application/x-oleobject" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" width=100% height='+height+'> ');
	HTML +=  ('<PARAM NAME="URL" VALUE="'+link+'">');
	
	HTML +=  ('<param name="EnableContextMenu" value="0">');
	HTML +=  ('<param name="uiMode" value="full">');	
	HTML +=  ('<param name="stretchToFit" value="True">');	
	HTML +=  ('<param name="AnimationAtStart" value="false">');	
	HTML +=  ('<param name="playcount" value="10">');
	HTML +=  ('<PARAM NAME="Volume" VALUE="50">');
	
	HTML +=  ('<embed src="'+link+'" type="application/x-mplayer2" width="100%" height="'+height+'" align="center"'); 	  
	HTML +=  (' border="0" autostart="1" transparentatstart="1" animationatstart="1" showcontrols="true" 		showaudiocontrols="1" showpositioncontrols="0" enablecontextmenu="0" autosize="0" showstatusbar="1" displaysize="false" playcount="10"> ');
	
	HTML +=  ('</embed></OBJECT>');		
	
	}

	// Windows Media Player 6.4 Code
	else
	{
	HTML +=  ('<OBJECT  classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" ');
	HTML +=  ('codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ');
	HTML +=  ('width="100%" height="'+height+'"');
	HTML +=  ('standby="Loading Microsoft Windows Media Player components..." ');
	HTML +=  ('type="application/x-oleobject" VIEWASTEXT> ');
	HTML +=  ('<PARAM NAME="FileName"           VALUE="'+link+'">');
	HTML +=  ('<PARAM NAME="TransparentAtStart" Value="false">');
	HTML +=  ('<PARAM NAME="AutoStart"          Value="true">');
	HTML +=  ('<PARAM NAME="AnimationatStart"   Value="false">');
	HTML +=  ('<PARAM NAME="ShowControls"       Value="false">');
	HTML +=  ('<PARAM NAME="ShowDisplay"	 value ="false">');
	HTML +=  ('<PARAM NAME="playCount" VALUE="999">');
	HTML +=  ('<PARAM NAME="displaySize" 	 Value="0">');
	HTML +=  ('<PARAM NAME="Volume" VALUE="50">');
	HTML +=  ('<Embed type="application/x-mplayer2" ');
	HTML +=  ('pluginspage= ');
	HTML +=  ('"http://www.microsoft.com/Windows/MediaPlayer/" ');
	HTML +=  ('src="'+link+'" ');
	HTML +=  ('Name=MediaPlayer ');
	HTML +=  ('transparentAtStart=0 ');
	HTML +=  ('autostart=1 ');
	HTML +=  ('playcount=999 ');
	HTML +=  ('volume=50');
	HTML +=  ('animationAtStart=0 ');
	HTML +=  ('width="100%" height="'+height+'"');	
	HTML +=  ('displaySize=0></embed> ');
	HTML +=  ('</OBJECT> ');
	}	
		
	return HTML;	
}
